Sherlock: annotated disassembly

Routines

Prev: D4A7 Up: Map Next: D4EF
D4CC: Count the things in place B that should be listed (B)
Each through D4EF.
Input
A A place
Output
A, B The number of things there to be listed
F Z if none
D4CC PUSH IX Save IX on the stack - Save IX, IY, HL, BC
D4CE PUSH IY Save IY on the stack
D4D0 PUSH HL Save HL on the stack
D4D1 PUSH BC Save BC on the stack
D4D2 CALL $D04F Call the routine "IX = just before the start of the thing index (8B6F)" (D04F) - From the first thing, count (B) those in place A that should be listed (D4EF)
D4D5 LD B,$00 Load B with $00
D4D7 LD C,A Copy A into C
D4D8 CALL $D206 Call the routine "Step to the next 3-byte entry" (D206)
D4DB JR Z,$D4E6 If the zero flag is set, skip ahead to D4E6
D4DD LD A,C Copy C into A
D4DE CALL $D4EF Call the routine "Should this thing be listed here?" (D4EF)
D4E1 JR NC,$D4D8 If the carry flag is clear, go back to D4D8
D4E3 INC B Add one to B
D4E4 JR $D4D8 Go back to D4D8
D4E6 LD A,B Copy B into A - A = B; Z if none
D4E7 AND A Test A for zero (this leaves A as it was and clears carry)
D4E8 POP BC Restore BC from the stack
D4E9 POP HL Restore HL from the stack
D4EA POP IY Restore IY from the stack
D4EC POP IX Restore IX from the stack
D4EE RET Return to the caller
Prev: D4A7 Up: Map Next: D4EF