ALP to count negative (-ve) numbers from a given list of 10 numbers

title ALP to count negative (-ve) numbers from a given list
of 10 numbers
dosseg
.model small
.stack 100
.code
main proc
mov ax, @data
mov ds, ax
mov cx, 0ah ;counter of 10
mov si, offset list ;array accessing
mov bl, 00h ;counts -ve numbers
mov al, 07Fh ;largest possible +ve number
BACK: cmp al, si ;compares al and si contents
jnc ahead ;if nc=0, jump ahead
inc bl
AHEAD: inc si ;pointer increment
loop back
mov result, bl
mov ax, 4c00h
INT 21h
main endp
.data
list db 0AFH, 03H, 087H……
result db ?
end main

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top