![]() |
Routines |
| Prev: 52323 | Up: Map | Next: 52410 |
|
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 | 52343 | CALL ColourFuelGauge | Colour the gauge. | |
| 52346 | LD A,(52322) | The row the needle is on. | ||
| 52349 | LD B,A | Keep that row. | ||
| 52350 | LD A,(52300) | The row of the top of the fuel. | ||
| 52353 | SUB B | How far the needle is from the fuel. | ||
| 52354 | JR Z,CheckFuelEmpty | The needle has arrived: see if the tank is empty. | ||
| 52356 | DEC B | Step the needle one row up. | ||
| 52357 | LD H,B | The upper row of the marker. | ||
| 52358 | BIT 7,A | The fuel is above the needle, so that step stands. | ||
| 52360 | JR NZ,UpdateFuelGauge_Store | |||
| 52362 | INC B | The fuel is below, so put that row back. | ||
| 52363 | LD H,B | The row the needle is leaving. | ||
| 52364 | INC B | Step the needle one row down. | ||
| UpdateFuelGauge_Store | 52365 | LD A,B | The new row of the needle. | |
| 52366 | LD (52322),A | Remember it. | ||
| 52369 | LD A,H | The other row of the marker. | ||
| 52370 | LD (23580),A | Keep it while the screen address is found. | ||
| 52373 | LD L,240 | The needle sits in the right-hand column. | ||
| 52375 | CALL GetScreenAddress | Find the screen address of that row. | ||
| 52378 | LD A,3 | The upper part of the marker. | ||
| 52380 | XOR (HL) | Toggle it into the screen byte. | ||
| 52381 | LD (HL),A | Write that byte back. | ||
| 52382 | INC HL | The next byte of the marker. | ||
| 52383 | LD A,128 | The right-hand bit of the upper part. | ||
| 52385 | XOR (HL) | Toggle it into the screen byte. | ||
| 52386 | LD (HL),A | Write that byte back. | ||
| 52387 | LD A,(23580) | The other row of the marker. | ||
| 52390 | CP 188 | Nothing more to draw once the needle is this low. | ||
| 52392 | RET NC | |||
| 52393 | INC A | The row below that one. | ||
| 52394 | LD H,A | That row. | ||
| 52395 | LD L,240 | The same column. | ||
| 52397 | CALL GetScreenAddress | Find the screen address. | ||
| 52400 | LD A,4 | The lower part of the marker. | ||
| 52402 | XOR (HL) | Toggle it into the screen byte. | ||
| 52403 | LD (HL),A | Write that byte back. | ||
| 52404 | INC HL | The next byte of the marker. | ||
| 52405 | LD A,64 | The right-hand bit of the lower part. | ||
| 52407 | XOR (HL) | Toggle it into the screen byte. | ||
| 52408 | LD (HL),A | Write that byte back. | ||
| 52409 | RET | Return. | ||
| Prev: 52323 | Up: Map | Next: 52410 |