back | Last regenerated: 2022-04-20 17:31:36 kio |
org, .org or .locorg <value> .org <value> .loc <value> org <value>, <fillbyte> The Pseudo instructions It can define the start address of the assembler code or it can insert some space up to the new address. Define the start address for the codezasm requires that the source initially defines the address where the code will be stored and run. This can be done in either of two ways:
Using 'org' is the traditional way for old sources. The code origin must be defined before any real code. When the origin is defined, zasm will silently create a single code segment. Assembler directives: #if, #elif, #else, #endif 'org' actually defines two kinds of addresses:
The logical code address is what you mostly work with. E.g. Types of labels: Program labels The physical code address is the address at which the generated code is actually visible to the cpu. (At least it should be.) Because most code is executed at the same address where it is visible to the cpu (which means: it is not copied somewhere else in ram before it is executed there) the physical and the logical address are most times the same. In case you need to access the physical address of the code at a position where you have shifted the logical address with .phase you can use '$$' instead of '$'. Note: the physical code address is biased to the 'org' address resp. to the start address of the current Assembler directives: #code Insert space up to a new addressThe second use case for 'org' – which can also be used Assembler directives: #if, #elif, #else, #endif Note: This second behavior of 'org' differs from the behavior in zasm v3. In zasm v3 'org' was solely used to Pseudo instructions: defl, set and '=' The 'org' instruction is most commonly used to advance the code position up to the address of the next restart vector: org 8 is the same as defs 8-$ 'org' behaves exactly the same Assembler directives: #if, #elif, #else, #endif Assembler directives: #code This will insert 256 spaces at the beginning of the segment. Name '.loc' is also recognized to support sources for different assemblers. org is recommended, the others are deprecated for new source. |