Routines |
Prev: 28160 | Up: Map | Next: 28292 |
|
||||||||||
28186 | PUSH DE | Save the display file address | ||||||||
28187 | EX DE,HL | Transfer the number to print to DE | ||||||||
28188 | LD HL,32719 | Fill the number string buffer at 32714 with space characters | ||||||||
28191 | LD B,5 | |||||||||
28193 | DEC L | |||||||||
28194 | LD (HL),32 | |||||||||
28196 | DJNZ 28193 | |||||||||
28198 | LD A,48 | 48 is the ASCII code for the digit '0' | ||||||||
28200 | LD BC,55536 | BC=-10000 | ||||||||
28203 | EX DE,HL | Transfer the number to print to HL | ||||||||
28204 | ADD HL,BC | Is HL>=10000? | ||||||||
28205 | JR C,28235 | Jump if so to compute and store the 10000s digit | ||||||||
28207 | INC E | Point DE at the slot for the 1000s digit in the number string buffer | ||||||||
28208 | SBC HL,BC | Add the 10000 back | ||||||||
28210 | LD BC,64536 | BC=-1000 | ||||||||
28213 | ADD HL,BC | Is HL>=1000? | ||||||||
28214 | JR C,28248 | Jump if so to compute and store the 1000s digit | ||||||||
28216 | INC E | Point DE at the slot for the 100s digit in the number string buffer | ||||||||
28217 | SBC HL,BC | Add the 1000 back | ||||||||
28219 | LD BC,65436 | BC=-100 | ||||||||
28222 | ADD HL,BC | Is HL>=100? | ||||||||
28223 | JR C,28261 | Jump if so to compute and store the 100s digit | ||||||||
28225 | INC E | Point DE at the slot for the 10s digit in the number string buffer | ||||||||
28226 | SBC HL,BC | Add the 100 back | ||||||||
28228 | LD C,246 | BC=-10 | ||||||||
28230 | ADD HL,BC | Is HL>=10? | ||||||||
28231 | JR C,28273 | Jump if so to compute and store the 10s digit | ||||||||
28233 | JR 28280 | Jump forward to compute and store the units digit | ||||||||
Compute and store the 10000s digit.
|
||||||||||
28235 | INC A | Get the ASCII code for the 10000s digit in A | ||||||||
28236 | ADD HL,BC | |||||||||
28237 | JR C,28235 | |||||||||
28239 | LD (DE),A | Place the 10000s digit into the number string buffer | ||||||||
28240 | SBC HL,BC | |||||||||
28242 | INC E | Point DE at the slot for the 1000s digit | ||||||||
28243 | LD A,47 | |||||||||
28245 | LD BC,64536 | BC=-1000 | ||||||||
Compute and store the 1000s digit.
|
||||||||||
28248 | INC A | Get the ASCII code for the 1000s digit in A | ||||||||
28249 | ADD HL,BC | |||||||||
28250 | JR C,28248 | |||||||||
28252 | LD (DE),A | Place the 1000s digit into the number string buffer | ||||||||
28253 | LD A,47 | |||||||||
28255 | SBC HL,BC | |||||||||
28257 | LD BC,65436 | BC=-100 | ||||||||
28260 | INC E | Point DE at the slot for the 100s digit | ||||||||
Compute and store the 100s digit.
|
||||||||||
28261 | INC A | Get the ASCII code for the 100s digit in A | ||||||||
28262 | ADD HL,BC | |||||||||
28263 | JR C,28261 | |||||||||
28265 | LD (DE),A | Place the 100s digit into the number string buffer | ||||||||
28266 | LD A,47 | |||||||||
28268 | SBC HL,BC | |||||||||
28270 | LD C,246 | BC=-10 | ||||||||
28272 | INC E | Point DE at the slot for the 10s digit | ||||||||
Compute and store the 10s digit.
|
||||||||||
28273 | INC A | Get the ASCII code for the 10s digit in A | ||||||||
28274 | ADD HL,BC | |||||||||
28275 | JR C,28273 | |||||||||
28277 | LD (DE),A | Place the 10s digit into the number string buffer | ||||||||
28278 | LD A,48 | |||||||||
Compute and store the units digit.
|
||||||||||
28280 | SBC HL,BC | |||||||||
28282 | INC E | Point DE at the slot for the units digit | ||||||||
28283 | ADD A,L | A=ASCII code for the units digit | ||||||||
28284 | LD (DE),A | Place it into the number string buffer | ||||||||
The number string buffer is now ready.
|
||||||||||
28285 | LD E,202 | DE=32714 (start of the number string buffer) | ||||||||
28287 | POP HL | Restore the display file address to HL | ||||||||
28288 | EX DE,HL | Transfer it to DE, and point HL at the number string buffer at 32714 | ||||||||
28289 | JP 28160 | Print the number |
Prev: 28160 | Up: Map | Next: 28292 |