Hi Everyone, can you help me in getting the remainder and the quotient and display it together? I really don't know how to code it in assembly language as I'm a beginner.
In the code below, I created a program that will add two numbers and display it's sum in decimal form. The sum will be divided to 7 as we need to display the sum in Base 7 form. So for example, I added 7 and 6, the sum should be 16 instead of 13.
To get 16, the sum 13 (base 10/decimal) should be divided to 7 (which is the base) 13/7=1 remainder 6. 1 and 6 should be displayed together (16).
Hope someone can help me to get an idea on how to code this one.
What I have tried:
.MODEL SMALL
.STACK 1000h
.DATA
abase7 db 0dh,0ah,'Base 07 Addition$'
ad db 0dh,0ah, 'Addend(00-99): $'
au db 0dh,0ah, 'Augend(00-99): $'
sum db 0dh,0ah,'The sum is : $'
sev db 7
.CODE
start:
mov ax,@data
mov ds,ax
mov dx,offset abase7
mov ah,09
int 21h
mn:
mov dx,offset ad
mov ah,09
int 21h
mov ah,01
int 21h
mov cl,al
sub cl,30h
mov dx,offset au
mov ah,09
int 21h
mov ah,01
int 21h
sub al,30h
xor ah,ah
add al,cl
aaa
mov cx,ax
add cx,3030h
mov dx, offset sum
mov ah,09
int 21h
mov ah,2
mov dl,ch
int 21h
mov dl,cl
int 21h
mov ah,4ch
int 21h
end start