Prev: D895 Up: Map Next: D9A7
D951: Move into a new 8x8 cell and check what is there.
Used by the routines at D3EC and D4B5.
Input
D High word of the current screen address
AF On return, the zero flag is set if there's a wall in the way
D951 LD A,($C872) Put Dan's Y co-ordinate (C872) in E.
D954 LD E,A
D955 INC E Move forward two rows to get a valid screen address.
D956 INC E
D957 CALL $E909 Convert to get an attribute address.
D95A EX DE,HL Put this in HL.
D95B LD DE,$0020 Set DE to the offset for the next row.
D95E LD A,($C876) Get the height fallen. (C876)
D961 CP $05 Is it less than 5?
D963 JR C,$D96F Jump if so.
D965 LD A,($C872) Get bits 0-3 of the Y co-ordinate.
D968 AND $07
D96A CP $06 Are bits 1-2 set, but not bit 0?
D96C JR Z,$D96F Jump forward if so.
D96E ADD HL,DE Move to the next row.
D96F LD B,(HL) Put the attribute address in B.
D970 ADD HL,DE Move to the next row.
D971 LD C,(HL) Put the attribute address in C.
D972 ADD HL,DE Move to the next row.
D973 LD D,(HL) Put the attribute address in D.
D974 LD HL,$CFD3 Point HL at the wall attributes.
D977 LD A,$06 6 entries to check.
D979 EX AF,AF' Swap AF for the shadow set, to stop A getting overwritten.
D97A LD E,(HL) Does the attribute match the current one?
D97B CALL $D9A7
D97E RET Z Return if it does, Dan can't move as there's a wall in the way.
D97F INC HL Otherwise move to the next entry.
D980 EX AF,AF' Swap AF back.
D981 DEC A Loop while there are more entries to check.
D982 JR NZ,$D979
D984 LD E,$38 Is there an oxygen tank here?
D986 CALL $D9A7
D989 JP Z,$DE0B Jump if so.
D98C LD E,$68 Is there a bank card here?
D98E CALL $D9A7
D991 JP Z,$DE1B Jump if so.
D994 LD E,$60 Is there an aerosol here?
D996 CALL $D9A7
D999 JP Z,$DE28 Jump if so.
D99C LD A,($CFC9) Is there food here?
D99F LD E,A
D9A0 CALL $D9A7
D9A3 JP Z,$DBB8 Jump if so.
D9A6 RET Otherwise return.
Prev: D895 Up: Map Next: D9A7