![]() |
Routines |
| Prev: CC63 | Up: Map | Next: CCBA |
|
Moves the needle of the fuel gauge one row towards the level of the fuel. The needle is a small marker that is drawn at the right of the gauge using XOR, so drawing it again at the same row erases it.
|
||||
| UpdateFuelGauge | CC77 | CALL ColourFuelGauge | Colour the gauge. | |
| CC7A | LD A,($CC62) | The row the needle is on. | ||
| CC7D | LD B,A | Keep that row. | ||
| CC7E | LD A,($CC4C) | The row of the top of the fuel. | ||
| CC81 | SUB B | How far the needle is from the fuel. | ||
| CC82 | JR Z,CheckFuelEmpty | The needle has arrived: see if the tank is empty. | ||
| CC84 | DEC B | Step the needle one row up. | ||
| CC85 | LD H,B | The upper row of the marker. | ||
| CC86 | BIT 7,A | The fuel is above the needle, so that step stands. | ||
| CC88 | JR NZ,UpdateFuelGauge_Store | |||
| CC8A | INC B | The fuel is below, so put that row back. | ||
| CC8B | LD H,B | The row the needle is leaving. | ||
| CC8C | INC B | Step the needle one row down. | ||
| UpdateFuelGauge_Store | CC8D | LD A,B | The new row of the needle. | |
| CC8E | LD ($CC62),A | Remember it. | ||
| CC91 | LD A,H | The other row of the marker. | ||
| CC92 | LD ($5C1C),A | Keep it while the screen address is found. | ||
| CC95 | LD L,$F0 | The needle sits in the right-hand column. | ||
| CC97 | CALL GetScreenAddress | Find the screen address of that row. | ||
| CC9A | LD A,$03 | The upper part of the marker. | ||
| CC9C | XOR (HL) | Toggle it into the screen byte. | ||
| CC9D | LD (HL),A | Write that byte back. | ||
| CC9E | INC HL | The next byte of the marker. | ||
| CC9F | LD A,$80 | The right-hand bit of the upper part. | ||
| CCA1 | XOR (HL) | Toggle it into the screen byte. | ||
| CCA2 | LD (HL),A | Write that byte back. | ||
| CCA3 | LD A,($5C1C) | The other row of the marker. | ||
| CCA6 | CP $BC | Nothing more to draw once the needle is this low. | ||
| CCA8 | RET NC | |||
| CCA9 | INC A | The row below that one. | ||
| CCAA | LD H,A | That row. | ||
| CCAB | LD L,$F0 | The same column. | ||
| CCAD | CALL GetScreenAddress | Find the screen address. | ||
| CCB0 | LD A,$04 | The lower part of the marker. | ||
| CCB2 | XOR (HL) | Toggle it into the screen byte. | ||
| CCB3 | LD (HL),A | Write that byte back. | ||
| CCB4 | INC HL | The next byte of the marker. | ||
| CCB5 | LD A,$40 | The right-hand bit of the lower part. | ||
| CCB7 | XOR (HL) | Toggle it into the screen byte. | ||
| CCB8 | LD (HL),A | Write that byte back. | ||
| CCB9 | RET | Return. | ||
| Prev: CC63 | Up: Map | Next: CCBA |