flat assembler
Message board for the users of flat assembler.

Index > Main > How to pad code

Author
Thread Post new topic Reply to topic
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 13 Dec 2003, 07:28
If I am writing boot sector code and I want to put the 55AA right at the end making my entire file exactly 512bytes long, how would I do it?

With TASM I believe you can do something like the following:

BootSignature:
ORG Boot_Start+510
db 055h,0AAh

Where Boot_Start is the start of your code.


Thanks
Post 13 Dec 2003, 07:28
View user's profile Send private message Reply with quote
AMD64



Joined: 19 Sep 2003
Posts: 8
AMD64 13 Dec 2003, 08:20
On FAsm (and also NAsm), the ORG functions "correctly", so you cannot use it to jump around in the code.

You can do it like this:

times (510-($-Boot_Start)) db 0
dw 0AA55h
Post 13 Dec 2003, 08:20
View user's profile Send private message Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 14 Dec 2003, 20:05
Sweet, thank-you.

Just out of curiosity, how do you guys know this stuff. Is it just by reading the source code and inc files?

The docs that come with fasm seem to be more of an assembly language tutorial rather than giving out the compiler specific commands.

Thanks,

...Gomer
Post 14 Dec 2003, 20:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.