![]() |
Routines |
Prev: 32112 | Up: Map | Next: 32159 |
Take the current score and divide it by 10000 repeatedly until there's less than 10000 left. However many of those we did, that goes into the leftmost printable score digit. Move along one, reduce the divisor to 1000, and do it again.
Used by the routine at print_score.
|
||||||||||||
gen_printable_score | 32127 | LD IX,_PRINTABLE_SCORE_DIGITS | Divisor table is 5 bytes past this | |||||||||
32131 | LD B,5 | Score is printed as 5 chars wide | ||||||||||
gen_printable_score_0 | 32133 | LD D,(IX+5) | DE contains divisor, 10000, 1000, 100, 100 or 1 | |||||||||
32136 | LD E,(IX+10) | |||||||||||
32139 | OR 255 | A=-1 | ||||||||||
gen_printable_score_1 | 32141 | SBC HL,DE | Subtract the divisor | |||||||||
32143 | INC A | If no carry we had at least that many in the score and go around again | ||||||||||
32144 | JR NC,gen_printable_score_1 | |||||||||||
32146 | ADD HL,DE | There was a carry, put that last lot back | ||||||||||
32147 | LD (IX+0),A | A contains number of divisors (i.e. the digit) | ||||||||||
32150 | INC IX | Move to next digit, and go round again | ||||||||||
32152 | DJNZ gen_printable_score_0 | |||||||||||
32154 | LD IX,_PRINTABLE_SCORE_DIGITS | Exit with IX pointing at the string result | ||||||||||
32158 | RET |
Prev: 32112 | Up: Map | Next: 32159 |