Sherlock: annotated disassembly

Routines

Prev: AEB6 Up: Map Next: AEEA
AEC5: IY = the node before IY in the sentence list ($9FF0)
Addresses named in the title: 9FF0.
Through A104, stepping back over nodes marked with bit 6 of +1 and stopping at the head (9FF2).
Input
IY A node
B The sentence count
Output
IY The node before it, skipping nodes marked BUT
IX The node given
B One fewer
AEC5 DEC B One sentence fewer (A012 is kept in B)
This entry point is used by the routines at AEEA and B0FD.
AEC6 PUSH IY Save IY on the stack - IX = the node, then IY = the node before it in the list at 9FF0 (A104)
AEC8 POP IX Restore IX from the stack
AECA PUSH HL Save HL on the stack
AECB PUSH DE Save DE on the stack
AECC PUSH IY Save IY on the stack
AECE POP DE Restore DE from the stack
AECF LD IY,$9FF0 Point IY at words the player has (9FF0)
AED3 CALL $A104 Call the routine "Find the node before node DE in the list at IY" (A104)
AED6 PUSH IY Save IY on the stack - At the head of the list (9FF2)? Then stop
AED8 POP HL Restore HL from the stack
AED9 LD DE,$9FF2 Point DE at 9FF2 in "Game variables"
AEDC AND A Clear the carry flag, so that the subtraction that follows is a plain one (a compare)
AEDD SBC HL,DE Subtract DE from HL (a compare: carry = HL was smaller, zero = equal)
AEDF JR Z,$AEE7 If the two values are equal, skip ahead to AEE7
AEE1 BIT 6,(IY+$01) Test bit 6 of byte +1 of the record at IY - Skip nodes marked with bit 6 of +1 (BUT nodes)
AEE5 JR NZ,$AECC If bit 6 of byte +1 of the record at IY is set, go back to AECC
AEE7 POP DE Restore DE from the stack
AEE8 POP HL Restore HL from the stack
AEE9 RET Return to the caller
Prev: AEB6 Up: Map Next: AEEA