![]() |
Routines |
| Prev: 703F | Up: Map | Next: 708F |
|
Used by the routines at GamePlayEntry and Robbie_CarryingCan_CubbyColumn.
Checks whether Robbie is level with one of the rows of cubby holes. If he is then his Y position is made exactly level with the row. E holds whether there is a cubby hole, which side it is on and whether it has something in it.
|
||||||||||||||||||
| CheckCubbyHole | 7049 | LD E,$00 | E=00 (no cubby hole). | |||||||||||||||
| 704B | LD A,(IX+$02) | A=the Y position of Robbie. | ||||||||||||||||
| 704E | AND %00011111 | Keep only bits 0-4. | ||||||||||||||||
| 7050 | SUB $17 | Subtract 17 (the cubby holes are at Y positions which are a multiple of 20 plus 17). | ||||||||||||||||
| 7052 | JP P,CheckCubbyHole_Test_Row | Make sure we have a positive byte. | ||||||||||||||||
| 7055 | NEG | |||||||||||||||||
| CheckCubbyHole_Test_Row | 7057 | CP $05 | Jump to ReleaseItemLock if Robbie is 05 pixels or more away from a row. | |||||||||||||||
| 7059 | JR NC,ReleaseItemLock | |||||||||||||||||
| 705B | LD A,(IX+$02) | A=the Y position of Robbie. | ||||||||||||||||
| 705E | AND %11100000 | Keep only bits 5-7. | ||||||||||||||||
| 7060 | OR %00010111 | Set bits 0-2 and 4. | ||||||||||||||||
| 7062 | LD (IX+$02),A | Write the new Y position. | ||||||||||||||||
| 7065 | BIT 7,(IX+$01) | Jump to CheckCubbyHole_Left if Robbie is on the left hand side. | ||||||||||||||||
| 7069 | JR Z,CheckCubbyHole_Left | |||||||||||||||||
| 706B | LD E,$03 | E=03 (Robbie is on the right hand side). | ||||||||||||||||
| CheckCubbyHole_Row | 706D | LD A,(IX+$02) | A=the Y position of Robbie. | |||||||||||||||
| 7070 | RLCA | Rotate bits 5-7 round to bits 0-2. | ||||||||||||||||
| 7071 | RLCA | |||||||||||||||||
| 7072 | RLCA | |||||||||||||||||
| 7073 | AND %00000111 | Keep only bits 0-2. | ||||||||||||||||
| 7075 | DEC A | Decrease A by one to give the row number (0 to 4). | ||||||||||||||||
| 7076 | BIT 7,(IX+$01) | Jump to CheckCubbyHole_Hole if Robbie is on the left hand side. | ||||||||||||||||
| 707A | JR Z,CheckCubbyHole_Hole | |||||||||||||||||
| 707C | ADD A,$05 | Add 05 to select the cubby holes on the right. | ||||||||||||||||
| CheckCubbyHole_Hole | 707E | LD C,A | C=the cubby hole number. | |||||||||||||||
| 707F | LD B,$00 | Clear the high byte of the number in B. | ||||||||||||||||
| 7081 | LD HL,$5E23 | HL=CubbyHoles. | ||||||||||||||||
| 7084 | ADD HL,BC | Add the cubby hole number to find its contents. | ||||||||||||||||
| 7085 | LD A,(HL) | A=the contents of the cubby hole. | ||||||||||||||||
| 7086 | AND A | Test the contents. | ||||||||||||||||
| 7087 | RET Z | Return if the cubby hole is empty. | ||||||||||||||||
| 7088 | SET 2,E | Set bit 2 of E (the cubby hole is not empty). | ||||||||||||||||
| 708A | RET | Return. | ||||||||||||||||
| CheckCubbyHole_Left | 708B | LD E,$01 | E=01 (Robbie is on the left hand side). | |||||||||||||||
| 708D | JR CheckCubbyHole_Row | Jump to CheckCubbyHole_Row. | ||||||||||||||||
| Prev: 703F | Up: Map | Next: 708F |