![]() |
Routines |
| Prev: AD54 | Up: Map | Next: ADB0 |
|
Used by the routine at OBJECT_DONE.
Once a turn from the main loop (OBJECT_DONE). CLOCK is four digits, a byte each, the highest first; each byte is the digit in bits 4-7 and, in bits 0-2, how far it still has to roll. A digit that changes is drawn rows out of line: the eight rows from its count down its character, so that it shows mostly the next digit up with a count of 7 and rolls down into place as the count runs out, like a mechanical counter's wheel (PRINT_ROLLING_DIGIT). Every turn the rolling digits roll one row (ROLL_CLOCK); when the last has finished, a light year is taken off (CLOCK_BORROW) and the digits it changes start rolling. So a light year takes seven turns.
The four digits are printed into the buffer at the right of the panel, the last one inverted, and copied to the screen; when all four bytes are zero the game is over (GAME_ENDED).
The font's character after 9 (code $3A, 11th of FONT) is a second nought, so a 9 that follows a 0 rolls in from a nought.
|
||||
| RUN_CLOCK | AD66 | CALL CLOCK_BORROW | a light year off, if the last digit has rolled into place | |
| AD69 | CALL ROLL_CLOCK | roll the rolling digits a row | ||
| AD6C | LD HL,$D4FA | the four digits, at the right of the panel, with the font's digits as characters 0 to 9 | ||
| AD6F | LD DE,CLOCK | |||
| AD72 | LD B,$04 | |||
| AD74 | PUSH HL | |||
| AD75 | LD HL,FONT | |||
| AD78 | LD (FONT_BASE),HL | |||
| AD7B | POP HL | |||
| RUN_CLOCK_0 | AD7C | LD A,(DE) | each digit, rolled | |
| AD7D | INC DE | |||
| AD7E | CALL PRINT_ROLLING_DIGIT | |||
| AD81 | DJNZ RUN_CLOCK_0 | |||
| AD83 | LD HL,$D41D | invert the last digit | ||
| AD86 | LD B,$08 | |||
| AD88 | LD DE,$0020 | |||
| RUN_CLOCK_1 | AD8B | LD A,(HL) | ||
| AD8C | CPL | |||
| AD8D | LD (HL),A | |||
| AD8E | ADD HL,DE | |||
| AD8F | DJNZ RUN_CLOCK_1 | |||
| AD91 | LD BC,$10D0 | copy the four digits' 32 by 8 pixels to the screen | ||
| AD94 | CALL CALC_VRAM_ADDR | |||
| AD97 | CALL CALC_VIDBUF_ADDR | |||
| AD9A | LD L,C | |||
| AD9B | LD H,B | |||
| AD9C | LD BC,$0804 | |||
| AD9F | CALL BLIT_TO_SCREEN | |||
| ADA2 | LD HL,CLOCK | all four bytes | ||
| ADA5 | LD B,$04 | |||
| ADA7 | XOR A | |||
| RUN_CLOCK_2 | ADA8 | OR (HL) | ||
| ADA9 | INC HL | |||
| ADAA | DJNZ RUN_CLOCK_2 | |||
| ADAC | JP Z,GAME_ENDED | zero: the game is over | ||
| ADAF | RET | |||
| Prev: AD54 | Up: Map | Next: ADB0 |