View Single Post
Old May 18th, 2006, 5:00 PM   #21
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
After division, DX contains the remainder. In this case, DX holds the digit we just sliced off. Earlier I posted how the division works:
123 / 10
AX = 12
DX = 3

12 / 10
AX = 1
DX = 2

1 / 10
AX = 0
DX = 1
The only problem is that these values are bare. 3 is 3, 2 is 2, and 1 is 1. You want the ASCII representation of those numbers, where 3 is 51, 2 is 50, and 1 is 49. So to force that representation, you take the bare number and add '0', which has a value of 48.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote