![]() |
Routines |
| Prev: 28735 | Up: Map | Next: 28815 |
|
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 | 28745 | LD E,0 | E=0 (no cubby hole). | |||||||||||||||
| 28747 | LD A,(IX+2) | A=the Y position of Robbie. | ||||||||||||||||
| 28750 | AND %00011111 | Keep only bits 0-4. | ||||||||||||||||
| 28752 | SUB 23 | Subtract 23 (the cubby holes are at Y positions which are a multiple of 32 plus 23). | ||||||||||||||||
| 28754 | JP P,CheckCubbyHole_Test_Row | Make sure we have a positive byte. | ||||||||||||||||
| 28757 | NEG | |||||||||||||||||
| CheckCubbyHole_Test_Row | 28759 | CP 5 | Jump to ReleaseItemLock if Robbie is 5 pixels or more away from a row. | |||||||||||||||
| 28761 | JR NC,ReleaseItemLock | |||||||||||||||||
| 28763 | LD A,(IX+2) | A=the Y position of Robbie. | ||||||||||||||||
| 28766 | AND %11100000 | Keep only bits 5-7. | ||||||||||||||||
| 28768 | OR %00010111 | Set bits 0-2 and 4. | ||||||||||||||||
| 28770 | LD (IX+2),A | Write the new Y position. | ||||||||||||||||
| 28773 | BIT 7,(IX+1) | Jump to CheckCubbyHole_Left if Robbie is on the left hand side. | ||||||||||||||||
| 28777 | JR Z,CheckCubbyHole_Left | |||||||||||||||||
| 28779 | LD E,3 | E=3 (Robbie is on the right hand side). | ||||||||||||||||
| CheckCubbyHole_Row | 28781 | LD A,(IX+2) | A=the Y position of Robbie. | |||||||||||||||
| 28784 | RLCA | Rotate bits 5-7 round to bits 0-2. | ||||||||||||||||
| 28785 | RLCA | |||||||||||||||||
| 28786 | RLCA | |||||||||||||||||
| 28787 | AND %00000111 | Keep only bits 0-2. | ||||||||||||||||
| 28789 | DEC A | Decrease A by one to give the row number (0 to 4). | ||||||||||||||||
| 28790 | BIT 7,(IX+1) | Jump to CheckCubbyHole_Hole if Robbie is on the left hand side. | ||||||||||||||||
| 28794 | JR Z,CheckCubbyHole_Hole | |||||||||||||||||
| 28796 | ADD A,5 | Add 5 to select the cubby holes on the right. | ||||||||||||||||
| CheckCubbyHole_Hole | 28798 | LD C,A | C=the cubby hole number. | |||||||||||||||
| 28799 | LD B,0 | Clear the high byte of the number in B. | ||||||||||||||||
| 28801 | LD HL,24099 | HL=CubbyHoles. | ||||||||||||||||
| 28804 | ADD HL,BC | Add the cubby hole number to find its contents. | ||||||||||||||||
| 28805 | LD A,(HL) | A=the contents of the cubby hole. | ||||||||||||||||
| 28806 | AND A | Test the contents. | ||||||||||||||||
| 28807 | RET Z | Return if the cubby hole is empty. | ||||||||||||||||
| 28808 | SET 2,E | Set bit 2 of E (the cubby hole is not empty). | ||||||||||||||||
| 28810 | RET | Return. | ||||||||||||||||
| CheckCubbyHole_Left | 28811 | LD E,1 | E=1 (Robbie is on the left hand side). | |||||||||||||||
| 28813 | JR CheckCubbyHole_Row | Jump to CheckCubbyHole_Row. | ||||||||||||||||
| Prev: 28735 | Up: Map | Next: 28815 |