Prev: 6F90 Up: Map Next: 7210
70E4: Check for users input and update the ship.
Used by the routine at Game_Update.
Ship_Update 70E4 CALL Game_KeyPress See which keys are being pressed.
70E7 LD HL,Keyboard_RowPressed
70EA BIT 3,(HL) Key '5' row
70EC JR Z,Ship_Update_0
70EE INC HL Keys '6' ~ '0'
70EF BIT 5,(HL) '6'
70F1 JR Z,Ship_Update_1
70F3 BIT 4,(HL) '7'
70F5 JR Z,Ship_Update_2
70F7 BIT 3,(HL) '8'
70F9 JR Z,Ship_Update_3
70FB JR Ship_Update_4
Ship_Update_0 70FD LD HL,Item_ShipX If ship X is greater than 1 move left by one character.
7100 LD A,$01
7102 CP (HL)
7103 JR Z,Ship_Update_4
7105 DEC (HL)
7106 LD HL,(Item_ShipPosOffset)
7109 DEC HL
710A LD (Item_ShipPosOffset),HL
710D JR Ship_Update_4
Ship_Update_1 710F LD HL,Item_ShipY If ship Y is less than 22 move down by one character.
7112 LD A,$16
7114 CP (HL)
7115 JR Z,Ship_Update_4
7117 INC (HL)
7118 LD DE,$0020
711B LD HL,(Item_ShipPosOffset)
711E ADD HL,DE
711F LD (Item_ShipPosOffset),HL
7122 JR Ship_Update_4
Ship_Update_2 7124 LD HL,Item_ShipY If ship Y is greater than 1 move up by one character.
7127 LD A,$01
7129 CP (HL)
712A JR Z,Ship_Update_4
712C DEC (HL)
712D LD DE,$FFE0
7130 LD HL,(Item_ShipPosOffset)
7133 ADD HL,DE
7134 LD (Item_ShipPosOffset),HL
7137 JR Ship_Update_4
Ship_Update_3 7139 LD HL,Item_ShipX Make sure ship X is less then 16.
713C LD A,$10
713E CP (HL)
713F JR Z,Ship_Update_4
7141 LD HL,(Item_ShipPosOffset) Make sure the space the ship is moving into is a space.
7144 LD DE,BgMap_Start0
7147 ADD HL,DE
7148 LD A,(HL)
7149 CP $20
714B JR NZ,Ship_Update_4
714D LD HL,Item_ShipX Move ship forward by one character.
7150 INC (HL)
7151 LD HL,Item_ShipPosOffset
7154 INC (HL)
Ship_Update_4 7155 LD HL,BgMap_Start0
7158 LD DE,(Item_ShipPosOffset)
715C ADD HL,DE
715D LD A,(HL)
715E CP $20
7160 JR NZ,Ship_Update_5
7162 LD A,$9C Update the ships tile and the background map.
7164 LD (HL),A
7165 LD (Item_ShipTile),A
7168 LD HL,Bg_Attr_From Update the colour as well.
716B ADD HL,DE
716C LD A,$45
716E LD (HL),A
716F LD (Item_ShipColour),A
7172 JR Ship_Update_8
Ship_Update_5 7174 LD A,$9A Set ship to exploded tile.
7176 LD (HL),A
7177 LD (Item_ShipTile),A
717A LD HL,Bg_Attr_From
717D ADD HL,DE
717E LD A,$47
7180 LD (HL),A
7181 LD (Item_ShipColour),A
7184 LD HL,Char_Ships Decrease number of ships left.
7187 DEC (HL)
7188 LD HL,(Item_ShipPosOffset) Workout which bomb, if any, has hit the ship and remove it.
718B LD DE,(Rocket1_Offset)
718F XOR A
7190 SBC HL,DE
7192 JR NZ,Ship_Update_6
7194 LD (Rocket1_Offset),HL
Ship_Update_6 7197 LD HL,(Item_ShipPosOffset)
719A LD DE,(Rocket2_Offset)
719E XOR A
719F SBC HL,DE
71A1 JR NZ,Ship_Update_7
71A3 LD (Rocket2_Offset),HL
Ship_Update_7 71A6 RET
Ship_Update_8 71A7 LD HL,Keyboard_KeyPressed
71AA BIT 1,(HL) '0'
71AC JR Z,Ship_Update_14
71AE BIT 2,(HL) '9'
71B0 JR Z,Ship_Update_9
71B2 RET
Bombs
Ship_Update_9 71B3 LD HL,(Bomb1_Offset) If bomb one is available, use it.
71B6 LD A,H
71B7 OR L
71B8 JR Z,Ship_Update_10
71BA LD HL,(Bomb2_Offset) If bomb two is available, use it.
71BD LD A,H
71BE OR L
71BF JR Z,Ship_Update_12
71C1 RET No bombs available, do nothing.
Bomb One Fire
Ship_Update_10 71C2 LD HL,(Item_ShipPosOffset) Position bomb below the ship.
71C5 LD DE,$0021
71C8 ADD HL,DE
71C9 LD (Bomb1_Offset),HL
71CC LD DE,(Bomb2_Offset) If bomb 2 is already there, remove the bomb 1
71D0 XOR A
71D1 SBC HL,DE
71D3 JR NZ,Ship_Update_11
71D5 LD (Bomb1_Offset),HL
71D8 RET
Ship_Update_11 71D9 LD A,$9D Set tile and colour for bomb.
71DB LD (Bomb1_Tile),A
71DE LD A,$47
71E0 LD (Bomb1_Colour),A
71E3 CALL Bomb1_Handler
71E6 RET
Bomb Two Fire
Ship_Update_12 71E7 LD HL,(Item_ShipPosOffset) Position bomb below the ship.
71EA LD DE,$0021
71ED ADD HL,DE
71EE LD (Bomb2_Offset),HL
71F1 LD DE,(Bomb1_Offset) If Bomb 1 is already in position, remove this bomb.
71F5 XOR A
71F6 SBC HL,DE
71F8 JR NZ,Ship_Update_13
71FA LD (Bomb2_Offset),HL
71FD RET
Ship_Update_13 71FE LD A,$9D Set tile and colour for Bomb 2
7200 LD (Bomb2_Tile),A
7203 LD A,$47
7205 LD (Bomb2_Colour),A
7208 CALL Bomb2_Handler
720B RET
Ship_Update_14 720C CALL Laser_Handler Lasers
720F RET
Prev: 6F90 Up: Map Next: 7210