From: anonymous c. <nas...@ya...> - 2004-04-01 17:12:20
|
Beth, > It's the old "one ORG" business again... I too dislike(d) NASM's implementation of ORG as a means to specify the program's origin just once. So in my local forked version I changed it as follows. First, I'm maintaining two separate location pointers per segment: one inside the assembler (used for e.g. branch offsets and/or effective address displacements, as well as the address column of the list file) and one inside the output format (used to determine at which offset the next byte will be emitted). They can be queried by $ and @, respectively. Normally both pointers advance for each byte which gets emitted; absolute segments are an exception: since they don't have any contents, they don't have a valid @ pointer. One can use ORG to change the offset part of the location pointer(s), just like in the majority of other x86 assemblers. Of course one can use multiple ORGs, and their direction can be "forward" or "backward". One-operand ORGs change both pointers to the same value, while two- operand (separated by :) ORGs change the pointers to separate values. Later segment contents overwrites earlier one. Last but not least, the treatment of resulting "holes" depends on whether the selected output format is sparse or not. (In case of the latter the "holes" get filled with a predefined value -- usually zero.) PS: See SF #767378. __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ |