Sherlock: annotated disassembly

Routines

Prev: B405 Up: Map Next: B4A0
B483: Copy the word pair at IY + E to HL, if B is not 0
B counts down when the pair is not empty; HL moves on two. Used by B39D to build its match pattern.
Input
HL Where to copy to
IY A node
E The offset of the word pair
B The number of pairs still wanted
Output
F Z if the pair was empty or B was 0
B One fewer if the pair was not empty
HL Moved on two bytes if copied
B483 XOR A Clear A to zero (and the carry flag) - B = 0: nothing to copy
B484 CP B Compare A with B
B485 RET Z If A equals B, return
B486 LD D,$00 Load D with $00 - Word pair at IY + E...
B488 PUSH IY Save IY on the stack
B48A ADD IY,DE Add DE to IY
B48C LD A,(IY+$00) Read the first byte of the record at IY into A - ...copied to HL, HL+1
B48F LD (HL),A Store A at the address HL points to
B490 INC HL Step HL on to the next byte
B491 LD A,(IY+$01) Read byte +1 of the record at IY into A
B494 LD (HL),A Store A at the address HL points to
B495 DEC HL Step HL back one byte
B496 OR (IY+$00) Set in A the bits that are set in the first byte of the record at IY - Z if the pair was empty
B499 POP IY Restore IY from the stack
B49B RET Z An empty one is not counted
B49C DEC B Subtract one from B - Count down B; HL on to the next pair
B49D INC HL Step HL on to the next byte
B49E INC HL Step HL on to the next byte
B49F RET Return to the caller
Prev: B405 Up: Map Next: B4A0