back | Last regenerated: 2010-09-08 15:25:13 kio |
Pseudo instructionsSource files: Pseudo instructionsPseudo instructions are instructions like 'Pseudo instructions: orgorg' or 'Pseudo instructions: defs, dsdefs', which are written at the place of a Target files: #target z80Z80 assembler instruction but which are not Source files: Z80 InstructionsZ80 instructions. Some Source files: Pseudo instructionspseudo instructions generate code, others don't. Target files: #target z80Z80 and Source files: Pseudo instructionspseudo instructions must not start in column 1, because then the assembler will assume a Source files: Label definitionslabel definition. Instructions are always preceded by 'white space', at minimum one space or one tab. orgPseudo instructions: orgorg <value>
The Pseudo instructions: orgorg Source files: Pseudo instructionspseudo instruction defines a new logical origin for the generated code. The code generation pointer is not moved, but all subsequent generated code is generated for the new logical origin. This comes in handy if you write routines or a jump table which you want to move around in memory later. All Source files: Label definitionslabels defined after the Pseudo instructions: orgorg Source files: Pseudo instructionspseudo instruction refer to the new logical origin. The Expressions: $ (dollar sign)dollar sign '$' in Source files: Expressionsexpressions refers to the logical origin too. Normally you don't need the Pseudo instructions: orgorg Source files: Pseudo instructionspseudo instruction, because you set the origin when you define a code segment with the Assembler directives: #code#code Source files: Assembler directivesassembler directive. If you actually want to move the code generation pointer to that new position and fill the unused space with $00 or the like, then you can use Pseudo instructions: defs, dsdefs: Example: advance code deposition pointer; ------------------------------------------------------
... ; some code
pop af
ret
Pseudo instructions: defs, dsdefs $66 - $ ; advance to address $66
nmi_vek: ...
; ------------------------------------------------------
Example: relocated jump table; ------------------------------------------------------ ... ; some code ccf ret rom_table: Pseudo instructions: orgorg $FE00 ; Source files: Label definitionslabel based on old Pseudo instructions: orgorg ram_table: ; Source files: Label definitionslabel based on new Pseudo instructions: orgorg putchar: jp putchar_rom puttext: jp puttext_rom getchar: jp getchar_rom getline: jp getline_rom table_size: Pseudo instructions: defl, equequ $ - ram_table ; back to old origin Pseudo instructions: orgorg rom_table + table_size gizmo: ld de,ram_table ld hl,rom_table ld bc,table_size ldir ld a,0 ; more code ... ; ------------------------------------------------------ note: in version 3.0.5 and 3.0.6 the Pseudo instructions: orgorg Source files: Pseudo instructionspseudo instruction behaved differently! data<label>: Pseudo instructions: datadata <value>
The Source files: Pseudo instructionspseudo instruction 'Pseudo instructions: datadata' assigns the current value of the Pseudo instructions: datadata segment pointer to the <label> and reserves <value> bytes from the Pseudo instructions: datadata segment defined with the Assembler directives: #data#data Source files: Assembler directivesassembler directive. If Pseudo instructions: datadata allocation exceeds the size given in the Assembler directives: #data#data Source files: Assembler directivesassembler directive, the assembler reports an Listings and Errors: Errorserror. Example:... Assembler directives: #data#data $4000,$100 ... ticks Pseudo instructions: datadata 3 foo Pseudo instructions: datadata 4 bar Pseudo instructions: datadata 4 cheese Pseudo instructions: datadata $20 ... defw, dwPseudo instructions: defw, dwdefw <value>[,<value>...] Pseudo instructions: defw, dwdw <value>[,<value>...] Same as 'Pseudo instructions: defb, defm, db, dmdefb' but for words (double bytes). Words are stored with their least significant byte first! This means, $1234 is stored as $34, $12 and 'ab' is stored as 'b','a'. If you don't like this, try using the Pseudo instructions: defb, defm, db, dmdefm Source files: Pseudo instructionspseudo instruction. defb, defm, db, dmSince version 3.0.16 the functionality of Pseudo instructions: defb, defm, db, dmdefb and Pseudo instructions: defb, defm, db, dmdefm are merged. Any vombination of Pseudo instructions: datadata which was valid for either of both can now be used with any of both. Pseudo instructions: defb, defm, db, dmdefb <value>[,<value>...] Pseudo instructions: defb, defm, db, dmdb <value>[,<value>...] The Pseudo instructions: defb, defm, db, dmdefb Source files: Pseudo instructionspseudo instruction evaluates the argument Source files: Expressionsexpressions and puts them one byte after the other into the code segment. Pseudo instructions: defb, defm, db, dmdefm <text>[,<text>] Pseudo instructions: defb, defm, db, dmdm <text>[,<text>] Stores a string of text into the code segment. The text string may be given in the following formats: $12345678.... packed hex string 12345678h packed hex string 'text' text string, delimited by <'>, must not contain <'> "text" text string, delimited by <">, must not contain <"> The hex bytes or ascii bytes are stored in the same order as they appear in the string, e.g. $1234 is stored as $12,$34 and 'ab' is stored as 'a','b'. The last byte of a packed hex string or a text string may be modified by an Source files: Expressionsexpression; commonly used is setting bit 7 of the last character of a message: Pseudo instructions: defb, defm, db, dmdefm "this is my message"+$80
There are three predefined names for text strings: __date__ current date: "Jan.31.96" __time__ current time: "23:56:30" __file__ current file name "filename.ext" defs, dsPseudo instructions: defs, dsdefs <value1>[,<value2>] Pseudo instructions: defs, dsds <value1>[,<value2>] This Source files: Pseudo instructionspseudo instruction inserts a block of <value1> bytes into the code segment. The default fill pattern is $FF for Target files: #target romROMs and $00 for all other target formats. If you append a <value2>, this byte is used as pattern instead. Within a Assembler directives: #head#head segment the default values for the header Pseudo instructions: datadata are used by Pseudo instructions: defs, dsdefs if no second value is given. defl, equ<label>: Pseudo instructions: defl, equdefl <value> <label>: Pseudo instructions: defl, equequ <value> These two Source files: Pseudo instructionspseudo instructions do quite the same and are used to assign a value to a name. The Source files: Expressionsexpression needs not to be evaluatable in the first pass but if possible it is. |