Routines |
Prev: 11747 | Up: Map | Next: 12187 |
This subroutine is called by PRINT_FP to multiply each byte of D'E'DE by 10 and return the integer part of the result in the C register. On entry, the A register contains the byte to be multiplied by 10 and the C register contains the carry over from the previous byte. On return, the A register contains the resulting byte and the C register the carry forward to the next byte.
|
||||||||||||||||
CA_10A_C | 12171 | PUSH DE | Save whichever DE pair is in use. | |||||||||||||
12172 | LD L,A | Copy the multiplicand from A to HL. | ||||||||||||||
12173 | LD H,0 | |||||||||||||||
12175 | LD E,L | Copy it to DE too. | ||||||||||||||
12176 | LD D,H | |||||||||||||||
12177 | ADD HL,HL | Double HL. | ||||||||||||||
12178 | ADD HL,HL | Double it again. | ||||||||||||||
12179 | ADD HL,DE | Add in DE to give HL=5*A. | ||||||||||||||
12180 | ADD HL,HL | Double again: now HL=10*A. | ||||||||||||||
12181 | LD E,C | Copy C to DE (D is zero) for addition. | ||||||||||||||
12182 | ADD HL,DE | Now HL=10*A+C. | ||||||||||||||
12183 | LD C,H | H is copied to C. | ||||||||||||||
12184 | LD A,L | L is copied to A, completing the task. | ||||||||||||||
12185 | POP DE | The DE register pair is restored. | ||||||||||||||
12186 | RET | Finished. |
Prev: 11747 | Up: Map | Next: 12187 |