mmicroprocessor.blogspot.com
.model small
.data
opr1 db 11h
opr2 db 11h
sum db 2 dup(0)
subt db 2 dup(0)
div1 db 2 dup(0)
div2 db 2 dup(0)
m1 db " sum
is : $"
m2 db
0Dh,0Ah," difference is : $"
m3 db
0Dh,0Ah," division is : $"
.code
.startup
mov dx,offset m1
mov ah,09h
int 21h
mov al,opr1
mov bl,opr2
add al,bl
mov sum,al
mov al,sum
CALL P1
mov dx,offset m2
mov ah,09h
int 21h
mov al,opr1
sub al,bl
mov subt,al
mov al,subt
CALL P1
mov dx,offset m3
mov ah,09h
int 21h
mov al,opr1
cbw
div bl
mov div1,al
mov DIV2,ah
mov al,DIV2
CALL P1
MOV AL,DIV1
CALL P1
mov ah,4ch
int 21h
P1 PROC NEAR
mov dl,al
mov bh,al
and dl,0f0h
mov cl,4
ror dl,cl
add dl,30h
cmp dl,'9'
jbe a0
add dl,7h
a0:
mov ah,02h
int 21h
mov dl,bh
and dl,0fh
add dl,30h
cmp dl,'9'
jbe a1
add dl,7h
a1:
mov ah,02h
int 21h
RET
P1 ENDP
end
Output:
sum is : 22
difference is : 00
division is : 0001
No comments:
Post a Comment