Prev: 6F47 Up: Map Next: 6F78
6F57: Test Landing Position
Used by the routine at LandHitActor.
Tests whether the horizontal co-ordinate of an actor is over the mixing bowl, over one of the four dustbins or over one of the gaps between them. The screen is the same on both sides, so a co-ordinate in the right half is changed to the equivalent one in the left half first.
Horizontal co-ordinate Over Carry flag
00 to 11 AF to BF Outer dustbin Reset
20 to 31 8F to A0 Inner dustbin Reset
41 to 7F Mixing bowl Reset
Everywhere else Gap Set
Input
IX Actor
Output
B Zero if the actor is over the mixing bowl
F The carry flag is set if the actor is over a gap
TestLandingPosition 6F57 LD B,$03 Set the position counter to 03.
6F59 LD A,(IX+$01) Fetch the horizontal co-ordinate.
6F5C CP $C0 Jump to TestLandingPosition_Gap if the actor is off to the right.
6F5E JR NC,TestLandingPosition_Gap
6F60 AND A Test the horizontal co-ordinate.
6F61 JP P,TestLandingPosition_Loop Jump to TestLandingPosition_Loop if the actor is in the left half.
6F64 NEG Negate A.
6F66 SUB $40 Subtract 40.
6F68 AND %01111111 Keep only bits 0-6.
TestLandingPosition_Loop 6F6A DEC B Decrease the position counter by one.
6F6B JR Z,TestLandingPosition_Finish Jump to TestLandingPosition_Finish if the position counter is zero.
6F6D SUB $20 Subtract 20.
6F6F JR NC,TestLandingPosition_Loop Jump to TestLandingPosition_Loop if there was no carry.
TestLandingPosition_Finish 6F71 NEG Negate A.
6F73 CP $0F Compare with 0F.
6F75 RET Return.
TestLandingPosition_Gap 6F76 SCF Set the carry flag.
6F77 RET Return.
Prev: 6F47 Up: Map Next: 6F78