Start Offset EXE

Programming, for all ages and all languages.
Post Reply
asmZ80
Posts: 4
Joined: Thu Jul 17, 2008 3:09 am

Start Offset EXE

Post by asmZ80 »

Hi to all, only a question, how i can find (in asm x86) the start offset of an EXE. I'm coding a diassembler, and i must start to diasm from start offset. Any ideas?
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Start Offset EXE

Post by bewing »

The loader always has to know where to load an executable. So the loadpoint must either be a default value, or the loadpoint must be encoded in the header. So you need to study up on the header format for the particular exe type.
asmZ80
Posts: 4
Joined: Thu Jul 17, 2008 3:09 am

Re: Start Offset EXE

Post by asmZ80 »

but can i set the start offset maybe at 0x0100 in asm? So i can use this offset?
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: Start Offset EXE

Post by suthers »

Try the attachment, it's got all the details on EXE format binaries you'll ever need (sorry couldn't find the original link so just attached it...)\
Jules
Attachments
WINHDR.TXT
(28.38 KiB) Downloaded 87 times
asmZ80
Posts: 4
Joined: Thu Jul 17, 2008 3:09 am

Re: Start Offset EXE

Post by asmZ80 »

yes i have simil one with debugging info, but my question is: in asm i can set start offset os each exe that i diasm use this offset? (maybe 0x0100)
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Start Offset EXE

Post by bewing »

No, you have to use the offset that the header tells you to use. Otherwise any absolute memory address references will point to the wrong place.
asmZ80
Posts: 4
Joined: Thu Jul 17, 2008 3:09 am

Re: Start Offset EXE

Post by asmZ80 »

ok thx
Post Reply