mmicroprocessor.blogspot.com
.model small
.data
m1 db "Total
positive numbers $"
m2 db
0Dh,0Ah,"Total negative numbers $"
list dw
2579h,0a345h,0d876h,7896h,0b900h
count equ 05h
.code
.startup
xor si,si
xor dx,dx
mov cl,count
mov bx,offset list
again:mov ax,[bx]
shl ax,01
jc negi
inc si
jmp next
negi:inc dx
next:add bx,2
dec cl
jnz again
push dx
push si
mov dx,offset m1
mov ah,09h
int 21h
pop ax
call disph
mov dx,offset m2
mov ah,09h
int 21h
pop ax
call disph
mov ah,4ch
int 21h
disph proc near
mov cl,4
mov ch,4
disph1:rol ax,cl
push ax
and al,0fh
add al,30h
cmp al,'9'
jbe disph2
add al,7
disph2:
mov ah,2
mov dl,al
int 21h
pop ax
dec ch
jnz disph1
ret
disph endp
end
Output:
Total positive
numbers 0002
Total negative
numbers 0003
But which numbers are positive nd negative
ReplyDelete