![]() |
Routines |
Prev: 763B | Up: Map | Next: 76D3 |
Used by the routine at Game_Loop.
|
||||
Handler_Fuel | 763C | CALL $7420 | Call 7420. | |
763F | LD HL,($783C) | HL=*Fuel. | ||
7642 | LD A,H | Jump to ProcessFuelConsumption if H is lower than 80. | ||
7643 | CP $80 | |||
7645 | JR C,ProcessFuelConsumption | |||
7647 | LD HL,($782E) | HL=*LevelProgressPointer. | ||
764A | LD A,(HL) | A=*HL. | ||
764B | DEC A | Decrease A by one. | ||
764C | JR Z,TriggerOutOfFuel | Jump to TriggerOutOfFuel if A is zero. | ||
764E | CP $31 | Call EBF3 if A is higher than 31. | ||
7650 | CALL NC,$EBF3 | |||
7653 | CP $2D | Call EBF3 if A is lower than 2D. | ||
7655 | CALL C,$EBF3 | |||
7658 | NOP | No operation. | ||
7659 | NOP | |||
765A | NOP | |||
765B | NOP | |||
Start the "Out Of Fuel" sequence.
|
||||
TriggerOutOfFuel | 765C | CALL RemoveSprites | Call RemoveSprites. | |
765F | LD A,($7822) | A=*Speed. | ||
7662 | BIT 7,A | Check the direction bit. | ||
7664 | LD A,$87 | Load the base player sprite into A (87). | ||
7666 | JR NZ,SetWheelieSprite | Jump to SetWheelieSprite if the player is moving left. | ||
7668 | ADD A,$40 | Modify the player sprite ID for the player moving right (C7). | ||
SetWheelieSprite | 766A | LD ($7834),A | Write the player sprite ID to *PlayerSpriteID. | |
766D | CALL Handler: PlayerSprite | Call Handler: PlayerSprite. | ||
Print the "OUT OF FUEL" messaging in the footer.
![]() |
||||
7670 | LD A,$A9 | A=A9 (INK: BLUE, PAPER: CYAN FLASH: ON). | ||
7672 | LD HL,$BA86 | HL=Messaging_OutOfFuel. | ||
7675 | CALL PrintFooterColourString | Call PrintFooterColourString. | ||
Play the "out of fuel" audio.
|
||||
7678 | LD D,$10 | Set an outer loop count in D for 10 iterations. | ||
767A | LD C,$01 | Set the initial tone value in C to 01. | ||
PlayFuelSound_OuterLoop | 767C | LD HL,$1E00 | Set the tone duration counter in HL to 1E00. | |
767F | LD A,C | Get current tone value. | ||
PlayFuelSound_ToneLoop | 7680 | LD B,C | Set inner delay counter. | |
7681 | OUT ($FE),A | Send to the speaker. | ||
7683 | XOR %00010000 | Flip the speaker bit. | ||
PlayFuelSound_InnerDelayLoop | 7685 | DJNZ PlayFuelSound_InnerDelayLoop | Decrease the inner delay counter by one and loop back to PlayFuelSound_InnerDelayLoop until the counter is zero. | |
7687 | DEC L | Decrease the tone duration low byte by one. | ||
7688 | JR NZ,PlayFuelSound_ToneLoop | Jump back to PlayFuelSound_ToneLoop until the tone duration low byte is zero. | ||
768A | DEC H | Decrease the tone duration high byte by one. | ||
768B | JR NZ,PlayFuelSound_ToneLoop | Jump back to PlayFuelSound_ToneLoop until the tone duration high byte is zero. | ||
768D | INC C | Increase the tone frequency by one (higher pitch). | ||
768E | DEC D | Decrease the outer loop counter by one. | ||
768F | JR NZ,PlayFuelSound_OuterLoop | Jump back to PlayFuelSound_OuterLoop until the outer loop counter is zero. | ||
Reset the players fuel and restart the game.
|
||||
7691 | LD HL,$3400 | Write 3400 to *Fuel. | ||
7694 | LD ($783C),HL | |||
7697 | JP $7161 | Jump to 7161. | ||
Normal fuel consumption processing.
|
||||
ProcessFuelConsumption | 769A | LD A,($7822) | A=*Speed. | |
769D | BIT 7,A | Check the direction bit. | ||
769F | JR NZ,CalculateFuelConsumption | Jump to CalculateFuelConsumption if the player is moving backwards. | ||
The player is moving forwards.
|
||||
76A1 | CPL | Invert the speed for forward movement calculation. | ||
CalculateFuelConsumption | 76A2 | SUB $7E | Calculate the fuel consumption rate in DE; (speed-7E)/02. | |
76A4 | SRL A | |||
76A6 | LD E,A | |||
76A7 | LD D,$00 | |||
76A9 | AND A | Subtract the consumption from the players fuel level. | ||
76AA | SBC HL,DE | |||
76AC | LD ($783C),HL | Write the updated fuel value back to *Fuel. | ||
76AF | JR C,Handler_Fuel_0 | Jump to Handler_Fuel_0 if the fuel value is negative. | ||
Update the fuel gauge display.
|
||||
76B1 | LD A,H | Get the fuel high byte. | ||
76B2 | SRL A | Divide it by 04. | ||
76B4 | SRL A | |||
76B6 | CPL | Invert the byte for the gauge display. | ||
76B7 | SUB $0C | Abjust by an offset of 0C bytes for where the gauge displays. | ||
76B9 | LD L,A | Set this value in L. | ||
76BA | LD H,$BA | Load the high byte in H with BA. | ||
76BC | LD DE,$5A65 | Point DE to the gauge position 5A65 (attribute buffer location). | ||
76BF | CALL CopyTwelveBytes | Call CopyTwelveBytes. | ||
Handle fuel-related audio effects during gameplay.
|
||||
76C2 | LD HL,($783C) | HL=*Fuel. | ||
76C5 | LD A,H | Call 6D50 if the fuel level is 0400 or higher, or for every 40 fuel units (which creates pulses as the fuel decreases). | ||
76C6 | CP $04 | |||
76C8 | CALL NC,$6D50 | |||
76CB | BIT 6,L | |||
76CD | CALL NZ,$6D50 | |||
Handler_Fuel_0 | 76D0 | JP $EBF3 | Jump to EBF3. |
Prev: 763B | Up: Map | Next: 76D3 |