Prev: 28487 Up: Map Next: 28536
28503: 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
0 to 17 175 to 191 Outer dustbin Reset
32 to 49 143 to 160 Inner dustbin Reset
65 to 127 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 28503 LD B,3 Set the position counter to 3.
28505 LD A,(IX+1) Fetch the horizontal co-ordinate.
28508 CP 192 Jump to TestLandingPosition_Gap if the actor is off to the right.
28510 JR NC,TestLandingPosition_Gap
28512 AND A Test the horizontal co-ordinate.
28513 JP P,TestLandingPosition_Loop Jump to TestLandingPosition_Loop if the actor is in the left half.
28516 NEG Negate A.
28518 SUB 64 Subtract 64.
28520 AND %01111111 Keep only bits 0-6.
TestLandingPosition_Loop 28522 DEC B Decrease the position counter by one.
28523 JR Z,TestLandingPosition_Finish Jump to TestLandingPosition_Finish if the position counter is zero.
28525 SUB 32 Subtract 32.
28527 JR NC,TestLandingPosition_Loop Jump to TestLandingPosition_Loop if there was no carry.
TestLandingPosition_Finish 28529 NEG Negate A.
28531 CP 15 Compare with 15.
28533 RET Return.
TestLandingPosition_Gap 28534 SCF Set the carry flag.
28535 RET Return.
Prev: 28487 Up: Map Next: 28536