| Prev: 60A5 | Up: Map | Next: 6136 |
6124: Calculate fuel gauge sprite offset
|
Computes a sprite data offset for the fuel gauge display using the formula: offset = (7 - B) * 8 + D. The result is patched into the operand of the following RLC instruction via self-modifying code.
|
||||||||||||||
| calculate_fuel_gauge_offset | 6124 | LD A,$07 | Calculate offset = (7 - B) * 8 + D and patch into next instruction. | |||||||||||
| 6126 | PUSH DE | |||||||||||||
| 6127 | SUB B | |||||||||||||
| 6128 | SLA A | |||||||||||||
| 612A | SLA A | |||||||||||||
| 612C | SLA A | |||||||||||||
| 612E | POP DE | |||||||||||||
| 612F | ADD A,D | |||||||||||||
| 6130 | LD ($6134),A | |||||||||||||
| 6133 | RLC B | Rotate B left through carry. | ||||||||||||
| 6135 | RET | |||||||||||||
| Prev: 60A5 | Up: Map | Next: 6136 |