Click here to Skip to main content
15,076,130 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project that I need to create a program in assembly language that will perform addition, subtraction, multiplication and division of base 7 to base 9. I have no idea on this as I'm a beginner in assembly language. My main problem on this is that I don't know how to perform basic calculator operations by coding in assembly language. Hope you can help me with this. At least an idea on how to perform calculation will help.

What I have tried:

.STACK 1000h
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 : $'
mov ax,@data
mov ds,ax
mov dx,offset abase7
mov ah,09
int 21h

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

xor ah,ah
add al,cl

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
Updated 11-May-21 2:01am

1 solution

Vee Jay Recana 11-May-21 10:51am
Can someone help me if how should I extract quotient and remainder and display together?
For example, I have a quotient of 1 and a remainder of 6, it should output 16. How should I do that?
Richard MacCutchan 11-May-21 12:10pm
The same way you output any data. Set up a message in your DATA section and store the two values in the appropriate positions before printing. Something like:
qr        db       0dh,0ah, 'Quotient: '
quot      db       0  ; store the quotient here
          db       ' Remainder: '
rem       db       0, ' $'  ; and the remainder here; and then print the message beginning at qr

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900