The ( + , - , * , / ) of two numbers in assembly using procedure.

Bismillahir Rahmanir Rahim
Solution:

if 1
include mylib1.lib
endif
mydata segment
am  db  "The sum is= $"
sm  db  "  The subtruction is = $"
mm  db  "  The multipliction is = $"
dm  db  "  The division part: $"
qm  db  "  The Quotient is = $"
rm  db  "  The reminder is= $"
aa  db  07 
ba  db  05
r1  db  ?
r2  db  ?
r3  db  ?
rq  db  ?
rr  db  ?

mydata ends
mystack segment
db 100 dup(0)
mystack ends
mycode segment
assume cs:mycode, ds:mydata, ss:mystack
start:
mov ax, seg mydata
mov ds, ax
mov ax, seg mystack
mov ss, ax

call sum

mov dx,offset am
mov ah,09
int 21h

mov bh,00
mov bl,r1
printd

call subb

mov dx,offset sm
mov ah,09
int 21h

mov bh,00
mov bl,r2
printd

call mult


mov dx,offset mm
mov ah,09
int 21h
mov bh,00
mov bl,r3
printd

call divv

mov dx,offset dm
mov ah,09
int 21h
mov dx,offset qm
mov ah,09
int 21h

mov bh,00
mov bl,rq
printd

mov dx,offset rm
mov ah,09
int 21h

mov bh,00
mov bl,rr
printd

mov ax, 4c00h
int 21h
printfd
sum PROC
mov al, aa
mov bl, ba
add al, bl
mov r1, al
 ret
sum ENDP

subb PROC
mov al, aa
mov bl, ba
sub al, bl
mov r2, al
 ret
subb ENDP

mult PROC
mov al, aa
mov bl, ba
mul bl
mov r3, al
 ret
mult ENDP

divv PROC
mov al, aa
mov bl, ba
mov ah,00
div bl
mov rq, al
mov rr,ah
 ret
divv ENDP

mycode ends
end start

Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →