Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHERE IS MY CODE AT ORG 401000?

Status
Not open for further replies.

StudioC

Programmer
Aug 31, 2003
1
0
0
US
*************** WHERE IS MY CODE AT ORG 401000? ******************

Dear TEK-TIPPERS,

I scratch my head and call it a day. The next day I find TEK-TIPS.COM
and I decide to send this dumb question. What am I doing wrong? How can
I fix it? What can be missing? This is my first time trying to assemble
anything since my old 8080/Z80/Varian/Interdata days... Can anybody help
me? Please?

(WHAT I DID ----->)

When I assemble with Masm I do this:

D:\New assembler stuff\GoAsm>ml /coff test.asm
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000. All rights reserved.

Assembling: test.asm
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

"test.obj"
"/OUT:test.exe"
LINK : fatal error LNK1561: entry point must be defined

So, Now I have an .OBJ file, I try this:

D:\New assembler stuff\GoAsm>link /SUBSYSTEM:WINDOWS /ENTRY:main test.obj
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : error LNK2001: unresolved external symbol _main
test.exe : fatal error LNK1120: 1 unresolved externals

So I try this:

D:\New assembler stuff\GoAsm>link /SUBSYSTEM:WINDOWS /ENTRY:start test.obj
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : error LNK2001: unresolved external symbol _start
test.exe : fatal error LNK1120: 1 unresolved externals

Then this:

D:\New assembler stuff\GoAsm>d:\borland\bcc55\bin\ilink32 test.obj
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: 'D:\NEW ASSEMBLER STUFF\GOASM\TEST.OBJ' contains invalid OMF record,
type 0x4c (possibly COFF)

So I try:

D:\New assembler stuff\GoAsm>..\golink\golink test.obj

GoLink.Exe Version 0.22 - Copyright Jeremy Gordon 2002/3 - JG@JGnet.co.uk
Output file: test.exe size: 4,342,784 bytes

But of course the .EXE file does not work.......

So...I try to debug...

Microsoft (R) Windows Debugger Version 6.2.0013.1
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: D:\New assembler stuff\GoAsm\test.exe
Symbol search path is: E:\Program Files\Debugging Tools for Windows\symbols
Executable search path is:
ModLoad: 00400000 00827000 image00400000
ModLoad: 77f80000 77ffb000 ntdll.dll
(6a0.6bc): Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=00131f04 ecx=00000009 edx=00000000 esi=7ffdf000 edi=00131f70
eip=77fa144b esp=0012f984 ebp=0012fc98 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000202
*** WARNING: symbols timestamp is wrong 0x3ef274dc 0x3d3d0209 for ntdll.dll
ntdll!RtlUpcaseUnicodeToMultiByteN+0x40e:
77fa144b cc int 3

And then:

!run
ntdll!RtlUpcaseUnicodeToMultiByteN+0x40e:
77fa144b cc int 3
0:000> g
(6a0.6bc): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00813cbf ebx=7ffdf000 ecx=00877b90 edx=00070000 esi=00000000 edi=0291f788
eip=7c4e87b3 esp=0012fffc ebp=00000000 iopl=0 nv up ei pl nz na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00010202
7c4e87b3 ?? ???

!offset:00401000
00401000 0000 add [eax],al
00401002 0000 add [eax],al
00401004 0000 add [eax],al
00401006 0000 add [eax],al
00401008 0000 add [eax],al
0040100a 0000 add [eax],al
0040100c 0000 add [eax],al

Where is my code at org 401000?

(See the top of the .ASM file below)

Thanks in advance for any help that you can offer.

Best Regards,

--Grace

; **************************************************

; This file is the header file that I am using
; File Name : TEST.ASM
; Format : WINDOWS 2000
;. (virtual address 00001000)
; Virtual size : 0001A700 (Big)
; Section size in file : 0001B000 (Big)
; Offset to raw data for section: 00001000
; Alignment : 16 bytes ?

.486

.model flat

_text segment para public 'CODE' use32
assume cs:_text
assume es:nothing, ss:nothing, ds:_data, fs:nothing, gs:nothing

org 401000h

; *************** Code Begins Here *****************

_start:

main:

sub esp, 8
push esi
xor esi, esi
call ds:GetThreadLocale
.....
.....
call Aother

; Etc..............

; **************** Another ******************

align 16

Another:
.....
.....
retn

; Etc...........

; *********************************************
-eof-

Thanks Again,

-Grace

 
why do u need org 401000 directive? that's what makes ur exe so huge: 401000h = 4198400 decimal. looks u r confused with virtual address.. NO NEED to bother where ur code is to be loaded - this is up to windows loader, as i can recall. many win32 pragrams are loaded to THIS address (in fact, they have RVA 1000 and loaded to 400000) but it can be almost anything under 2M.
was i any help?
i think u should consult izcelion win32 assembly pages.
good luck

ps things will looks much clearer if u try to get in with a debugger, i advice a Numega one
 
You can try use "end _start" instead of the appointment in the compiler's parameters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top