flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Programming Language Design > align directive

Author
Thread Post new topic Reply to topic
HopekForth



Joined: 13 Jul 2017
Posts: 1
Location: Poland
align directive
Good morning, everyone.

In his flat assembler 1.71 Programmer's Manual Tomek wrote about align directive:


Quote:
The align directive fills the bytes that had to be skipped to perform the alignment with the nop instructions



and later:


Quote:
If you need to fill the alignment area with some other values, you can combine align with virtual to get the size of alignment needed and then create the alignment yourself, like:

virtual
align 16
a = $ - $$
end virtual
db a dup 0


Today I found that the same can be done shorter:

db (- $) and $F dup 0

and you needn't know what virtual or $$ is Smile

You all can freely use my idea in your works.
Post 13 Jul 2017, 08:43
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6508
Location: Kraków, Poland
Keep in mind that this only works if $ has an absolute value (a known number), and this is not true in case of relocatable formats, like object files (COFF/ELF) or PE executables with fixups - for this reason internally implemented ALIGN directive was needed.
Post 13 Jul 2017, 10:10
View user's profile Send private message Visit poster's website 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.