Routines
| Prev: A59D | Up: Map | Next: A5C4 |
A59F: Print the message at HL
|
The message interpreter's entry point; almost every word the game prints comes through here (see the message area at 67B7 for the bytecode). Parameters - extra messages or words, such as what a character says - are pushed on the stack before the call and control codes pick them up; on the way out the stack pointer is reset past them (A59D), so callers push and never pop. Saves the registers, runs the byte loop (A5C4 / A5CD) and returns through JP (HL).
How it works:
1. Save the registers and take the address of the caller's parameters (stack pointer plus 12) for A59D.
3. Run the interpreter over the message (A5C4).
4. Restore the registers, drop the parameters from the stack and return.
|
||||||||||||||
| A59F | PUSH BC | Save BC on the stack - Print message HL: save the registers | ||||||||||||
| A5A0 | PUSH DE | Save DE on the stack | ||||||||||||
| A5A1 | PUSH IX | Save IX on the stack | ||||||||||||
| A5A3 | PUSH AF | Save AF on the stack | ||||||||||||
| A5A4 | PUSH HL | Save HL on the stack | ||||||||||||
| A5A5 | LD HL,$000C | Load HL with $000C - HL = SP + 12: the caller's parameters | ||||||||||||
| A5A8 | ADD HL,SP | Add SP to HL | ||||||||||||
| A5A9 | LD ($A59D),HL | Save the message pointer in (A59D) | ||||||||||||
| A5AC | POP HL | Restore HL | ||||||||||||
| A5AD | LD A,($A00B) | Read $A00B in "Game variables" into A - $A00B set? Then skip the next store | ||||||||||||
| A5B0 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||
| A5B1 | JR NZ,$A5B6 | If A is not zero, skip ahead to A5B6 | ||||||||||||
| A5B3 | LD ($A00C),A | Otherwise $A00C = 0 | ||||||||||||
| A5B6 | CALL $A5C4 | Call the routine "Interpret message bytes until the end of the message" (A5C4) - Interpret the message | ||||||||||||
| A5B9 | POP AF | Restore AF from the stack | ||||||||||||
| A5BA | POP IX | Restore IX from the stack | ||||||||||||
| A5BC | POP DE | Restore DE from the stack | ||||||||||||
| A5BD | POP BC | Restore BC from the stack | ||||||||||||
| A5BE | POP HL | The return address | ||||||||||||
| A5BF | LD SP,($A59D) | Drop the parameters | ||||||||||||
|
This entry point is used by the routine at A621.
|
||||||||||||||
| A5C3 | JP (HL) | Return | ||||||||||||
| Prev: A59D | Up: Map | Next: A5C4 |