using tasm/tlink/dosbox in notepad++
want: how do i fix 2 digit divide to 2 digits and when if the quotient or remainder answer is also 2 digits? and also what is the possible logic?
my flow is: the flow I made was first I took the first digit of the first number or dividend then I multiplied by 10 to be and I added to the second digit the same as the second number or divisor so that it would be 2 digits in the register after that I'll divide them both.
My Code in notepad++:
.model small
.stack 100h
.data
d0 db 0dh,0ah,"Base 03$"
d1 db 0dh,0ah,"Enter Dividend : $" ;string
d2 db 0dh,0ah,"Enter Divisor : $"
d3 db 0dh,0ah,"Display Quotient : $"
d4 db 0dh,0ah,"Display Remainder : $"
.code
main proc ;main program here
mov ax,@data ;initialize ds
mov ds,ax
Div1:
mov ah,09h
lea dx,d0
int 21h
lea dx, d1
int 21h
mov ah,01h
int 21h ;1st Digit
mov ch,al
mov ah,01h
int 21h ;2nd Digit
mov cl,al
or cx,3030h
mov al,ch
mov bl,10h
mul bl ;02*10 = 20
mov bh,al
add bh,cl ;dividend
Div2:
mov ah,09h
lea dx, d2
int 21h
mov ah,01h
int 21h ;1st Digit
mov ch,al
mov ah,01h
int 21h ;2nd Digit
mov cl,al
or cx,3030h
mov al,ch
mul bl
mov dh,al
add dh,cl ;divisor
mov ah,00h
mov al,bh
aad
div dh
mov cx,ax
or cx,3030h
mov ah,09h
lea dx, d3
int 21h
mov ah,02h
mov dl,cl
int 21h
mov ah,09h
lea dx, d4
int 21h
mov ah,02h
mov dl,ch
int 21h
mov ah,4Ch ;end here
int 21h
main endp
end main
Output:
Want Output:
Enter Dividend : 22
Enter Divisor : 02
Display Quotient : 02
Display Remainder : 00
proj
Enter Dividend : 21
Enter Divisor : 02
Display Quotient : 10
Display Remainder : 01
proj
Enter Dividend : 21
Enter Divisor : 11
Display Quotient : 01
Display Remainder : 10
like this calculation but the only i need is the quotient and remainder.