>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.