Prev: 8D0F Up: Map Next: 8D52
8D2E: Update the movement tables (down)
Used by the routine at 8C3D.
Input
HL Attribute in the current position
IY Pointer to movement table (8D54)
B Number of rows
8D2E LD DE,$C51A Point to the start of the movement attributes table (C51A).
8D31 PUSH BC Remember BC.
8D32 LD B,$04 Count four types.
8D34 LD A,(HL) Is the current attribute this one?
8D35 EX DE,HL
8D36 CP (HL)
8D37 JR Z,$8D50 If so, found the attribute we want.
8D39 INC (IY+$00) Increment the type of attribute looked for.
8D3C INC HL Move to the next attribute.
8D3D DJNZ $8D36 Repeat for the next four types.
8D3F EX DE,HL Restore HL to the start of the table.
8D40 POP BC Restore BC.
8D41 LD (IY+$00),$00 Initialise to no movement.
8D45 LD DE,$0020 Move forward a row.
8D48 ADD HL,DE
8D49 DJNZ $8D2E Repeat until all rows have been checked.
8D4B LD (IY+$00),$04 Mark this as empty space and return. } We've found a matching attribute and have set it. This entry point is used by the routine at 8D0F.
8D4F RET
8D50 POP BC Tidy up the stack and return.
8D51 RET
Prev: 8D0F Up: Map Next: 8D52