Prev: 6D9C Up: Map Next: 6ED2
6DBA: Game Play Entry
Handles Robbie while he is not carrying a spray can (Robbie state 01). While the "get ready" delay in PlayDelay_Counter counts down, Robbie does nothing and the label for the player flashes. After that, the controls move him around the play area. When he walks into a cubby hole which contains a spray can he picks it up and becomes Robbie carrying a can (see Robbie_CarryingCan). Walking into a cubby hole which has a bonus item in it collects the item (see UpdateBonusItem).
Input
IX Robbie object
The Robbie object fields used (here and in Robbie_CarryingCan) are:
Field Use
+0 The state: 01 when empty-handed and 02 when carrying a can
+3 The colour (white when empty-handed, otherwise the colour of the can)
+4 bit 0 Facing left (Robbie faces right if this is not set)
+4 bit 2 Cannot pick up or drop a can (until he has moved away)
+4 bit 3 Has just picked up a can
+6 The item last dropped into a cubby hole
GamePlayEntry 6DBA LD HL,$5E22 HL=PlayDelay_Counter (the "get ready" delay).
6DBD LD A,(HL) Jump to Robbie_EmptyHanded_Move if the delay is zero.
6DBE AND A
6DBF JR Z,Robbie_EmptyHanded_Move
6DC1 DEC (HL) Decrease the delay by one.
6DC2 JP NZ,FlashPlayerLabel Jump to FlashPlayerLabel to flash the player label if the delay has not run out (which returns to the main loop).
6DC5 LD A,($5E1E) A=the current player from Current_Player.
6DC8 AND A Jump to Robbie_EmptyHanded_GetReady2UP if it is the second player.
6DC9 JR NZ,Robbie_EmptyHanded_GetReady2UP
6DCB LD HL,$0018 HL=18 (the position of the label for 1UP).
Robbie_EmptyHanded_GetReady 6DCE CALL StopFlashingPlayerLabel Stop the player label flashing using StopFlashingPlayerLabel.
6DD1 CALL PlayMidTone Play a tone using PlayMidTone.
6DD4 JR Robbie_EmptyHanded_Move Jump to Robbie_EmptyHanded_Move.
Robbie_EmptyHanded_GetReady2UP 6DD6 LD HL,$00D8 HL=D8 (the position of the label for 2UP).
6DD9 JR Robbie_EmptyHanded_GetReady Jump to Robbie_EmptyHanded_GetReady.
Once Robbie is away from the cubby holes he can pick up and drop things again.
Robbie_EmptyHanded_Move 6DDB LD A,(IX+$01) A=the X position of Robbie.
6DDE CP $20 Jump to Robbie_EmptyHanded_Input if Robbie is too far to the left.
6DE0 JR C,Robbie_EmptyHanded_Input
6DE2 CP $D0 Jump to Robbie_EmptyHanded_Input if Robbie is too far to the right.
6DE4 JR NC,Robbie_EmptyHanded_Input
6DE6 RES 2,(IX+$04) Reset bit 2 of IX+04.
Robbie_EmptyHanded_Input 6DEA CALL StoreEntity Remember the position and state using StoreEntity.
6DED CALL ReadInput Read the controls using ReadInput.
6DF0 BIT 0,A Jump to Robbie_EmptyHanded_Right if right is being pressed.
6DF2 JR Z,Robbie_EmptyHanded_Right
6DF4 BIT 1,A Jump to Robbie_EmptyHanded_Left if left is being pressed.
6DF6 JR Z,Robbie_EmptyHanded_Left
Robbie_EmptyHanded_Vertical 6DF8 LD A,(IX+$01) A=the X position of Robbie.
6DFB CP $18 Jump to Robbie_EmptyHanded_Draw if Robbie is in the cubby hole column on the left.
6DFD JR C,Robbie_EmptyHanded_Draw
6DFF CP $D8 Jump to Robbie_EmptyHanded_Draw if Robbie is in the cubby hole column on the right.
6E01 JR NC,Robbie_EmptyHanded_Draw
6E03 CALL ReadInput Read the controls using ReadInput.
6E06 BIT 3,A Jump to Robbie_EmptyHanded_Up if up is being pressed.
6E08 JR Z,Robbie_EmptyHanded_Up
6E0A BIT 2,A Jump to Robbie_EmptyHanded_Down if down is being pressed.
6E0C JR Z,Robbie_EmptyHanded_Down
Robbie_EmptyHanded_Draw 6E0E JP DrawObject Jump to DrawObject to draw Robbie.
Move right.
Robbie_EmptyHanded_Right 6E11 LD A,(IX+$01) A=the X position of Robbie.
6E14 ADD A,$02 Add 02.
6E16 CP $D8 Jump to Robbie_EmptyHanded_CubbyColumn if Robbie has reached the cubby hole column on the right.
6E18 JR NC,Robbie_EmptyHanded_CubbyColumn
Robbie_EmptyHanded_StoreX 6E1A LD (IX+$01),A Write the new X position.
6E1D JR Robbie_EmptyHanded_Vertical Jump to Robbie_EmptyHanded_Vertical.
Move left.
Robbie_EmptyHanded_Left 6E1F LD A,(IX+$01) A=the X position of Robbie.
6E22 SUB $02 Subtract 02.
6E24 CP $18 Jump to Robbie_EmptyHanded_CubbyColumn if Robbie has reached the cubby hole column on the left.
6E26 JR C,Robbie_EmptyHanded_CubbyColumn
6E28 JR Robbie_EmptyHanded_StoreX Jump to Robbie_EmptyHanded_StoreX.
Move up.
Robbie_EmptyHanded_Up 6E2A LD A,(IX+$02) A=the Y position of Robbie.
6E2D SUB $02 Subtract 02.
6E2F CP $28 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the top.
6E31 JR C,Robbie_EmptyHanded_Draw
Robbie_EmptyHanded_StoreY 6E33 LD (IX+$02),A Write the new Y position.
6E36 JR Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Move down.
Robbie_EmptyHanded_Down 6E38 LD A,(IX+$02) A=the Y position of Robbie.
6E3B ADD A,$02 Add 02.
6E3D CP $B8 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the bottom.
6E3F JR NC,Robbie_EmptyHanded_Draw
6E41 JR Robbie_EmptyHanded_StoreY Jump to Robbie_EmptyHanded_StoreY.
Robbie has reached one of the cubby hole columns.
Robbie_EmptyHanded_CubbyColumn 6E43 CALL CheckCubbyHole Check for a cubby hole using CheckCubbyHole.
6E46 BIT 0,E Jump to Robbie_EmptyHanded_Vertical if Robbie is not level with a cubby hole.
6E48 JR Z,Robbie_EmptyHanded_Vertical
6E4A BIT 1,E Test bit 1 of E (the right hand side).
6E4C LD A,(IX+$01) A=the X position of Robbie.
6E4F JR Z,Robbie_EmptyHanded_CubbyHoleLeft Jump to Robbie_EmptyHanded_CubbyHoleLeft if Robbie is on the left hand side.
6E51 ADD A,$02 Add 02.
6E53 CP $E4 Jump to Robbie_EmptyHanded_Draw if Robbie has reached the edge of the play area.
6E55 JR NC,Robbie_EmptyHanded_Draw
Robbie_EmptyHanded_CubbyHole 6E57 BIT 2,E Jump to Robbie_EmptyHanded_Pickup if the cubby hole is not empty.
6E59 JR NZ,Robbie_EmptyHanded_Pickup
6E5B LD (IX+$01),A Write the new X position.
6E5E JR Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Robbie_EmptyHanded_CubbyHoleLeft 6E60 SUB $02 Subtract 02.
6E62 CP $0C Jump to Robbie_EmptyHanded_Draw if Robbie has reached the edge of the play area.
6E64 JR C,Robbie_EmptyHanded_Draw
6E66 JR Robbie_EmptyHanded_CubbyHole Jump to Robbie_EmptyHanded_CubbyHole.
Robbie has walked into a cubby hole which is not empty.
Robbie_EmptyHanded_Pickup 6E68 LD A,(HL) A=the contents of the cubby hole.
6E69 BIT 7,A Jump to Robbie_EmptyHanded_Bonus if bit 7 is set (a bonus item is in the hole).
6E6B JR NZ,Robbie_EmptyHanded_Bonus
6E6D BIT 2,(IX+$04) Jump to Robbie_EmptyHanded_TakeCan if Robbie is free to pick the item up.
6E71 JR Z,Robbie_EmptyHanded_TakeCan
6E73 CP (IX+$06) Jump to Robbie_EmptyHanded_Draw if this is the item that Robbie has just dropped.
6E76 JP Z,Robbie_EmptyHanded_Draw
Robbie_EmptyHanded_TakeCan 6E79 AND %00000111 Keep only bits 0-2 (the colour of the can).
6E7B OR %01000000 Set bit 6 (BRIGHT).
6E7D LD (IX+$03),A Write it to the colour of Robbie.
6E80 LD (IX+$0B),A Write it to the colour of the spray can object.
6E83 LD A,$02 A=02 (the state of Robbie when he is carrying a can).
6E85 LD (IX+$00),A Make Robbie carry a can (state 02).
6E88 INC A Increment the state by one (the state of the spray can object).
6E89 LD (IX+$08),A Make the spray can object active (state 03).
6E8C CALL PlayHighTone Play a tone using PlayHighTone.
6E8F BIT 7,(IX+$01) Test bit 7 of the X position of Robbie.
6E93 LD A,(IX+$01) A=the X position of Robbie.
6E96 JR Z,Robbie_EmptyHanded_TakeCanLeft Jump to Robbie_EmptyHanded_TakeCanLeft if Robbie is on the left hand side.
6E98 RES 0,(IX+$04) Reset bit 0 of IX+04 (Robbie faces right).
6E9C ADD A,$14 Add 14.
6E9E LD (IX+$09),A Write it to the X position of the spray can object.
6EA1 SUB $04 Subtract 04.
Robbie_EmptyHanded_PlaceCan 6EA3 LD (IX+$0D),A Write it to the new X position of the spray can.
6EA6 LD A,(IX+$02) A=the Y position of Robbie.
6EA9 LD (IX+$0A),A Write it to the Y position of the spray can object.
6EAC LD (IX+$0E),A Write it to the new Y position of the spray can.
6EAF LD (IX+$0C),$00 Write 00 to IX+0C (the can is not being put away).
6EB3 LD (HL),$00 Empty the cubby hole.
6EB5 SET 2,(IX+$04) Set bit 2 of IX+04.
6EB9 SET 3,(IX+$04) Set bit 3 of IX+04.
6EBD JP Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Robbie_EmptyHanded_Bonus 6EC0 LD (HL),$80 Write 80 to the cubby hole to mark the bonus item as collected.
6EC2 JP Robbie_EmptyHanded_Draw Jump to Robbie_EmptyHanded_Draw.
Robbie_EmptyHanded_TakeCanLeft 6EC5 SUB $0D Subtract 0D.
6EC7 LD (IX+$09),A Write it to the X position of the spray can object.
6ECA ADD A,$01 Add 01.
6ECC SET 0,(IX+$04) Set bit 0 of IX+04 (Robbie faces left).
6ED0 JR Robbie_EmptyHanded_PlaceCan Jump to Robbie_EmptyHanded_PlaceCan.
View the equivalent code in;
Prev: 6D9C Up: Map Next: 6ED2