flat assembler
Message board for the users of flat assembler.
Index
> Main > The '$' operator... |
Author |
|
Tomasz Grysztar 30 Mar 2004, 21:03
The $ operator is never actually related to the offset in output file. It's the value of assumed address at which currently generated code will be loaded into memory. You can adjust this assumed address with "org" directive, for example at the beginning of .com program you put the "org 100h" directive and just after it the value of $ is 100h. And when you write a boot sector, you use "org 7C00h", and then $ points to 7C00h and above.
The "virtual" directive marks a special block of code, which can have the different "org" setting (you do it by putting the "at" operator and address after "virtual" word) and the code from such block is not put into the output file. So after you end the virtual block, assembler goes back to the offset at which it was before starting that block, and restores the "org" setting. In case of "virtual at 0" directive, the $ address is zero-based, so it can be used as the size of the already generated code inside the virtual block. In the same way when you've got the source with "org 0" setting at the very beginning (which the same as default setting for the binary output, in case when you don't use any "org" and "format" directives at all), the $ value is the same as the offset in the output file, but this is the only case. |
|||
30 Mar 2004, 21:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.