z80 » Intermediate
rst commands jump
to an address and execute code until encountering a return command.
They are exactly like calls but only take up 1 byte (instead of
3). They are only capable of going to a few preset addresses.
Those addresses are:
$0000, $0008, $0010, $0018, $0020, $0028,
|none||Hardware Restart. It's just like when you pull
out the batteries; once the calculator has power, the Program Counter is
reset to |
|Copies 11 bytes from |
|See the section on FindSym in the Variables Section.|
|Pushes OP1 to the Floating Point Stack|
|Copies 10 bytes starting at the address pointed to by HL to OP1.|
|Multiplies OP1 and OP2 and stores the result in OP1.|
|Adds OP1 and OP2 and stores the result in OP1.|
|none||This is the interrupt handler. See the secion on Interrupts.|
Here's an example from the _FindSym section using
rst 20h (
_FindSym) to find a variable.
find_variable: ld hl,variable-1 ;address of one byte before ; 'variable' label rst 20h ;same as 'call _Mov10toOP1' rst 10h ;same as 'call _FindSym' ret variable: .db $06,"Stupid" ;just need the length and string ; now because we're using the byte ; infront of this as our type
More from z80 » Intermediate
All the Flags // Debugging // Down-Left Bug // _GetKey Codes // Logical Operators // Memory, ROM, RAM, and Safe Areas // Miscellaneous Instructions // PC and SP // Random Numbers // TI's ROM Calls // Restart Commands // Simulated 16-bit Addition // The Stack // Tables and Arrays // Text Display // Variables