Prev: D303 Up: Map Next: D392
D307: Action Controls
Used by the routine at D2D9.
On entry A will contain one of;
Value Bits Door
10 00010000 Door 2
11 00010001 Door 3
12 00010010 Door 1
This is written to Controls_Byte, and then decoded into writing a $01, $02 or $03 to Hit to represent which door has been shot at. This routine also writes $01 to One, Two and Three to represent the same thing. Before returning, HL is set to the screen location for displaying the shot mask/ shot image in the centre of the door.
Action_Controls D307 LD HL,$D306 Writes A to Controls_Byte and sets HL=Hit.
D30A LD (HL),A
D30B LD HL,$D300
D30E LD A,C
D30F BIT 0,A If "3" was pressed then jump to Shot_Three (a check for if bit 0 is set).
D311 JR NZ,Shot_Three
D313 BIT 1,A If "1" was pressed then jump to Shot_One (a check for if bit 1 is set).
D315 JR NZ,Shot_One
Handles settings flags and shot drawing location for door 2.
Shot_Two D317 LD A,($D303) If Two is not zero then return.
D31A AND A
D31B RET NZ
D31C LD ($D304),A Sets the other two door flags to zero (Three and One).
D31F LD ($D305),A
D322 INC A Indicate the the middle door is being shot at (write $01 to Two and $02 to Hit).
D323 LD ($D303),A
D326 LD A,$02
D328 LD (HL),A
D329 LD HL,$D8AC Increase D8AC by one.
D32C INC (HL)
D32D LD HL,$482F Sets the screen location for this shot to $482F and stash it.
D330 PUSH HL
D331 CALL Draw_GunShot_Mask Draw the shot mask.
D334 POP HL Grab the screen location again, and now draw the shot.
D335 CALL Draw_GunShot
D338 JP Shot_Sound_01_Alias Jump to Shot_Sound_01_Alias.
Handles settings flags and shot drawing location for door 3.
Shot_Three D33B LD A,($D304) If Three is not zero then return.
D33E AND A
D33F RET NZ
D340 LD ($D303),A Sets the other two door flags to zero (Two and One).
D343 LD ($D305),A
D346 INC A Indicate the the right door is being shot at (write $01 to Three and $03 to Hit).
D347 LD ($D304),A
D34A LD A,$03
D34C LD (HL),A
D34D LD HL,$D8AC Shifts the value at D8AC to the left with bit 7 moved to the carry flag and bit 0 reset (zeroed).
D350 SLA (HL)
D352 LD HL,$483A Sets the screen location for this shot to $483A and stash it.
D355 PUSH HL
D356 CALL Draw_GunShot_Mask Draw the shot mask.
D359 POP HL Grab the screen location again, and now draw the shot.
D35A CALL Draw_GunShot
D35D JP Shot_Sound_02_Alias Jump to Shot_Sound_02_Alias.
Handles settings flags and shot drawing location for door 1.
Shot_One D360 LD A,($D305) If One is not zero then return.
D363 AND A
D364 RET NZ
D365 LD ($D303),A Sets the other two door flags to zero (Two and Three).
D368 LD ($D304),A
D36B INC A Indicate the the left door is being shot at (write $01 to One and $01 to Hit).
D36C LD ($D305),A
D36F LD A,$01
D371 LD (HL),A
D372 LD HL,$D8AC Shifts the value at D8AC to the left with bit 7 moved to the carry flag and bit 0 reset (zeroed).
D375 SLA (HL)
D377 LD HL,$4824 Sets the screen location for this shot to $4824 and stash it.
D37A PUSH HL
D37B CALL Draw_GunShot_Mask Draw the shot mask.
D37E POP HL Grab the screen location again, and now draw the shot.
D37F CALL Draw_GunShot
D382 CALL Shot_Sound_03_Alias Jump to Shot_Sound_03_Alias.
D385 RET Return.
Sets the flag for indicating "right" has been pressed by the player.
Set_Right D386 LD HL,$D301 Write $01 to Right and return.
D389 LD (HL),$01
D38B RET
Sets the flag for indicating "left" has been pressed by the player.
Set_Left D38C LD HL,$D302 Write $01 to Left and return.
D38F LD (HL),$01
D391 RET
Prev: D303 Up: Map Next: D392