Sherlock: annotated disassembly

Routines

Prev: AC8F Up: Map Next: ACA6
AC94: Put word BC in the first empty pair at $AAAE (NZ if both are taken)
Addresses named in the title: $AAAE.
Input
BC The word
Output
F Z when stored in one of the two slots at $AAAE; NZ when both are taken
AC94 LD HL,$AAAE The two word slots at $AAAE (2 bytes each)
This entry point is used by the routine at AC8F.
AC97 LD A,(HL) Read the byte HL points at into A - First slot empty?
AC98 INC HL Step HL on to the next byte
AC99 OR (HL) Set in A the bits that are set in the byte HL points at
AC9A JR Z,$ACA1 If the result is zero, skip ahead to ACA1
AC9C INC HL Step HL on to the next byte - No: second slot empty?
AC9D LD A,(HL) Read the byte HL points at into A
AC9E INC HL Step HL on to the next byte
AC9F OR (HL) Set in A the bits that are set in the byte HL points at
ACA0 RET NZ Both taken: return NZ
ACA1 LD (HL),B Store B at the address HL points to - Store the word BC in the empty slot...
ACA2 DEC HL Step HL back one byte
ACA3 LD (HL),C Store C at the address HL points to
ACA4 XOR A Set A to zero, which sets the zero flag for the caller - ...Z: done
ACA5 RET Return to the caller
Prev: AC8F Up: Map Next: ACA6