![]() |
Routines |
| Prev: 44464 | Up: Map | Next: 44517 |
|
Used by the routine at UpdateLightYears.
Subtracts one from LightYearsRemaining when the animation step of its last digit has reached zero. A digit which is already zero becomes nine, with the next digit up borrowed from.
|
||||
|
See Infinite Light Years.
|
||||
| DecrementLightYears | 44489 | LD HL,23353 | Point HL at LightYearsRemaining_LastDigit. | |
| 44492 | LD B,4 | Set a counter of four digits. | ||
| 44494 | LD A,(HL) | Fetch the digit and its animation step. | ||
| 44495 | AND %00000111 | Keep bits 0 to 2. | ||
| 44497 | RET NZ | Return if the digit is still rolling. | ||
| DecrementLightYears_SubtractFromDigit | 44498 | LD A,(HL) | Fetch the digit and its animation step. | |
| 44499 | LD C,A | Keep it in C. | ||
| 44500 | AND %11110000 | Keep bits 4 to 7. | ||
| 44502 | JR Z,DecrementLightYears_Borrow | Jump to DecrementLightYears_Borrow if the digit is zero. | ||
| 44504 | SUB 16 | Subtract 16. | ||
| 44506 | OR %00000111 | Set bits 0 to 2. | ||
| 44508 | LD (HL),A | Store the digit and its step. | ||
| 44509 | RET | Return. | ||
| DecrementLightYears_Borrow | 44510 | LD A,151 | Set the digit to 151. | |
| 44512 | LD (HL),A | Store it. | ||
| 44513 | DEC HL | Move on to the next digit up. | ||
| 44514 | DJNZ DecrementLightYears_SubtractFromDigit | Jump to DecrementLightYears_SubtractFromDigit. | ||
| 44516 | RET | Return. | ||
| Prev: 44464 | Up: Map | Next: 44517 |