Prev: DE72 Up: Map Next: DF34
DED3: Trim a step along +U at the walls
As CLIP_PLUS_V, with U and V exchanged: the front edge is at U plus the half-size in U, the corners at V less and plus the half-size in V, and CUT_STEP_PLUS_U trims the U step.
Input
IX The record
Output
F Carry set if a wall trimmed the step
CLIP_PLUS_U DED3 LD L,(IX+$01) DE: U plus the half-size, the front edge
DED6 LD H,(IX+$02)
DED9 LD C,(IX+$08)
DEDC LD B,$00
DEDE ADD HL,BC
DEDF EX DE,HL
DEE0 LD L,(IX+$03) HL: V less the half-size
DEE3 LD H,(IX+$04)
DEE6 LD C,(IX+$09)
DEE9 AND A
DEEA SBC HL,BC
DEEC PUSH DE Test the cell under the one front corner; done if a wall
DEED PUSH HL
DEEE CALL CUT_STEP_PLUS_U
DEF1 POP HL
DEF2 POP DE
DEF3 RET C
DEF4 PUSH DE The other corner, V plus the half-size: in the same cell?
DEF5 PUSH HL
DEF6 LD C,(IX+$09)
DEF9 SLA C
DEFB LD B,$00
DEFD LD A,H
DEFE ADD HL,BC
DEFF CP H
DF00 JR Z,CLIP_PLUS_U_0
DF02 CALL CUT_STEP_PLUS_U No: test its cell too
DF05 POP DE
DF06 POP HL
DF07 RET C
DF08 LD C,(IX+$0A) Does the step take the front edge into the next column of cells? Done if not
DF0B LD B,$00
DF0D LD A,H
DF0E ADD HL,BC
DF0F CP H
DF10 RET Z
DF11 EX DE,HL Yes: test the cells the two corners go into
DF12 PUSH DE
DF13 PUSH HL
DF14 CALL CUT_STEP_PLUS_U
DF17 POP HL
DF18 POP DE
DF19 RET C
DF1A LD C,(IX+$09)
DF1D SLA C
DF1F LD B,$00
DF21 ADD HL,BC
DF22 JP CUT_STEP_PLUS_U
CLIP_PLUS_U_0 DF25 POP DE Both corners in one cell: test only the cell the step goes into, if another
DF26 POP HL
DF27 LD C,(IX+$0A)
DF2A LD B,$00
DF2C LD A,H
DF2D ADD HL,BC
DF2E CP H
DF2F RET Z
DF30 EX DE,HL
DF31 JP CUT_STEP_PLUS_U
Prev: DE72 Up: Map Next: DF34