View Single Post
Old May 16th, 2006, 4:15 PM   #4
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
>but know how do get the remainder of a division operation in ASM
mov dx,0   ; It's important to clear DX because DX:AX is the dividend
mov ax,123
mov bx,10  ; Divisor
div 10
After the div instruction, AX (the quotient) will contain 12 and DX (the remainder) will contain 3. This design is well suited for a loop where the least significant digit is chopped off of AX for each iteration.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote