Sherlock: annotated disassembly

Routines

Prev: A5CD Up: Map Next: A63A
A621: Run control code A
Through the table at A55D (see there).
Input
A The control code (below $20)
IX The message position
Output
F Z to stop or NZ to go on, from the handler
A621 PUSH DE Save DE on the stack - Control code A: HL = the handler from the table at A55D, two bytes each
A622 LD E,A Copy A into E
A623 LD D,$00 Load D with $00
A625 LD HL,$A55D Point HL at "Routines for the message control codes $00-$1F" (A55D)
A628 ADD HL,DE Add DE to HL
A629 ADD HL,DE Add DE to HL
A62A LD E,(HL) Read the byte HL points at into E
A62B INC HL Step HL on to the next byte
A62C LD D,(HL) Read the byte HL points at into D
A62D EX DE,HL Swap DE and HL
A62E POP DE Restore DE from the stack
A62F CP $1D Compare A with $1D - Codes below $1D: call it and carry on with the same message
A631 JR NC,$A5C3 If A is $1D or more, go back to A5C3
A633 CALL $A5C3 Call A5C3 (inside "Print the message at HL") - $1D and above end the message: call it, then Z goes on to A5ED, NZ to A5EA
A636 JR Z,$A5ED If the zero flag is set, go back to A5ED
A638 JR $A5EA Go back to A5EA
Prev: A5CD Up: Map Next: A63A