![]() |
Routines |
Prev: A570 | Up: Map | Next: A612 |
|
||||||||
A5AA | PUSH IX | Save IX | ||||||
A5AC | LD ($A23D),HL | Save the number into $A23D | ||||||
A5AF | XOR A | Set A=0 | ||||||
A5B0 | LD ($A243),A | Init the charcode buffer | ||||||
A5B3 | LD ($A242),A | |||||||
A5B6 | LD ($A241),A | |||||||
A5B9 | LD ($A240),A | |||||||
A5BC | LD ($A23F),A | |||||||
A5BF | LD DE,$2710 | Set DE=10.000 | ||||||
A5C2 | CALL $A5EF | Computes the charcode for the digit in the ten thousands | ||||||
A5C5 | LD ($A243),A | Set this charcode into $A243 | ||||||
A5C8 | LD DE,$03E8 | Set DE=1.000 | ||||||
A5CB | CALL $A5EF | Computes the charcode for the digit in the thousands | ||||||
A5CE | LD ($A242),A | Set this charcode into $A242 | ||||||
A5D1 | LD DE,$0064 | Set DE=100 | ||||||
A5D4 | CALL $A5EF | Computes the charcode for the digit in the hundreds | ||||||
A5D7 | LD ($A241),A | Set this charcode into $A241 | ||||||
A5DA | LD DE,$000A | Set DE=10 | ||||||
A5DD | CALL $A5EF | Computes the charcode for the digit in the tens | ||||||
A5E0 | LD ($A240),A | Set this charcode into $A240 | ||||||
A5E3 | LD DE,$0001 | Set DE=1 | ||||||
A5E6 | CALL $A5EF | Computes the charcode for the digit in the units | ||||||
A5E9 | LD ($A23F),A | Set this charcode into $A23F | ||||||
A5EC | POP IX | Restore IX | ||||||
A5EE | RET | |||||||
Computes the charcode for the digit in the units, tens, hundreds, thousands o ten toushands
|
||||||||
A5EF | LD HL,($A23D) | Set HL to the number to convert | ||||||
A5F2 | LD IX,$0000 | Set IX=0. The part of the number that has been converted [ x0.000, x.000, x00, x0 or x ] | ||||||
A5F6 | LD B,$00 | Set B=0. The digit number that we need to convert to charcode [x] | ||||||
A5F8 | AND A | Reset carry bit | ||||||
A5F9 | SBC HL,DE | Substract DE [10.000, 1.000, 100, 10 or 1] to HL | ||||||
A5FB | JR C,$A602 | Jump if the result in HL is a negative number (DE is greater than the number to convert) | ||||||
A5FD | ADD IX,DE | Add DE to IX | ||||||
A5FF | INC B | Increment the digit number | ||||||
A600 | JR $A5F8 | Jump back and repeat the process until obtain the digit number | ||||||
A602 | PUSH IX | Copy in DE the value of IX | ||||||
A604 | POP DE | |||||||
A605 | LD HL,($A23D) | Set HL to the number to convert | ||||||
A608 | AND A | Reset carry bit | ||||||
A609 | SBC HL,DE | Substract to the number to convert the part just converted | ||||||
A60B | LD ($A23D),HL | Set into $A23D the remaining number to convert | ||||||
A60E | LD A,B | Copy into A the digit number to convert | ||||||
A60F | ADD A,$30 | Set A to the charcode of the digit ($30 is the base charcode for digit, i.e. is the 0 digit charcode) | ||||||
A611 | RET |
Prev: A570 | Up: Map | Next: A612 |