Prev: 71EA Up: Map Next: 7240
7225: Compare two word references
Compares the word reference at HL with the one at IY (both stored low byte first) and then moves both pointers on by two bytes. Only the low 12 bits count (the offset from 6000), so the class or flag bits in the top nibble are ignored.
Returns with the Z flag set if the words are the same, or if the reference at HL is zero (an empty slot, which ends a list of words). Used five times by the routine at 71D9 when matching the words the player typed against the four word slots of an object record (C00B).
Input
HL Word reference
IY Word reference
Output
F Z set if they match (or HL points to 0)
7225 PUSH HL Save HL
7226 LD A,(HL) Is the word at HL empty?
7227 INC HL Increment HL
7228 OR (HL) Combine with (HL)
7229 JR Z,$7238 If it is zero, go to 7238
722B LD A,(IY+$01) Compare the top four bits of the offset...
722E XOR (HL) Flip the bits in (HL)
722F AND $0F Keep only the bits of $0F
7231 JR NZ,$7238 If it is not zero, go to 7238
7233 DEC HL ...and the bottom eight
7234 LD A,(HL) A = (HL)
7235 CP (IY+$00) Compare with the byte at (IY+$00)
7238 POP HL Move both pointers on
7239 INC HL Increment HL
723A INC HL Increment HL
723B INC IY Increment IY
723D INC IY Increment IY
723F RET Done
Prev: 71EA Up: Map Next: 7240