Marsport | Routines |
Prev: B668 | Up: Map | Next: B68F |
|
||||||||||||||
Using the return address to hold information is a common and fast way to pass in arguments.
The data will look something like:
|
||||||||||||||
Data_ClearToZero | B67B | XOR A | Clear as value stored. | |||||||||||
B67C | POP HL | Get return address from stack, this holds the address of data. | ||||||||||||
B67D | LD E,(HL) | |||||||||||||
B67E | INC HL | |||||||||||||
B67F | LD D,(HL) | |||||||||||||
B680 | LD (DE),A | |||||||||||||
B681 | INC HL | |||||||||||||
B682 | LD C,(HL) | it also holds numer of bytes in data. | ||||||||||||
B683 | INC HL | Put next address back as the true return address just after the data info. | ||||||||||||
B684 | PUSH HL | |||||||||||||
B685 | LD L,E | Clear the first byte of data. | ||||||||||||
B686 | LD H,D | |||||||||||||
B687 | INC DE | |||||||||||||
B688 | DEC C | |||||||||||||
B689 | RET Z | |||||||||||||
B68A | LD B,$00 | If the data is longer, clear the rest of it as well. | ||||||||||||
B68C | LDIR | |||||||||||||
B68E | RET |
Prev: B668 | Up: Map | Next: B68F |