Untitled
unknown
plain_text
4 years ago
1.4 kB
7
Indexable
.model small
.data
m1 db 10,13, "Enter 5 numbers: $"
m2 db 10,13, "Total Number of positive numbers are: $"
m3 db 10,13, "Total Number of Negative numbers are; $"
cntp db 00h
cntn db 00h
.code
mov ax, @data
mov ds, ax
mov ah,09h
lea dx,m1
int 21h
mov ch, 05h
X3: call accept
AND bl, 80h
JNS X4
inc cntn
dec ch
JNZ X3
cmp ch, 00h
je X5
X4:
inc cntp
dec ch
JNZ X3
X5:
mov ah, 09h
lea dx, m2
int 21h
mov dl, cntp
add dl, 30h
mov ah , 02h
int 21h
mov ah, 09h
lea dx, m3
int 21h
mov dl, cntn
add dl, 30h
mov ah, 02h
int 21h
mov ah, 4ch
int 21h
accept proc near
mov ah,01h ; ascii code goes in to AL(0 to F)
int 21h
mov bl, al ; make free al
sub bl, 30h ; seperate the accepted no forms ascii code
cmp bl, 09h ; if single digit is >9 then need to sub 07h
JLE X1 ; bl=5 bl=50 bl=50+8 = 58
sub bl,07h ;bh = 8
X1:
mov cl, 04h ; create tens place value for 2 digit no
SHL bl,cl
mov ah,01h ; second no.accept (0-F) unit value
int 21h
mov bh, al
sub bh,30h
cmp bh,09h
JLE X2
sub bh, 07h
X2:
add bl, bh ; two digit no is created
ret ;pop the next instruction address from the stack
endp
end
Editor is loading...