- #1
cupcake
- 76
- 0
Hi, I want to ask.. suppose I have an array and a constant called threshold in my data segments
array db 1,2,3,4,5,6
threshold equ 5
I want to compare my array elements with the constant, and only display/print the number which is less that the threshold, if there are none, display the none message
this is what I have done so far...
cmpr_thr:
mov dl,10d ;display line
mov ah,2h
int 21h
mov al,array[bx]
cmp al,threshold
jl print
inc bx ;increment index register
dec cl ;decrement counter
jnz cmpr_thr
print:
mov ah,2
mov dl,array[bx] ;display data on screen
add dl, 30h
int 21h
inc bx ;next piece
dec cl ;decrement counter
jnz print
can someone enlighten me?
it's not working as I expect
array db 1,2,3,4,5,6
threshold equ 5
I want to compare my array elements with the constant, and only display/print the number which is less that the threshold, if there are none, display the none message
this is what I have done so far...
cmpr_thr:
mov dl,10d ;display line
mov ah,2h
int 21h
mov al,array[bx]
cmp al,threshold
jl print
inc bx ;increment index register
dec cl ;decrement counter
jnz cmpr_thr
print:
mov ah,2
mov dl,array[bx] ;display data on screen
add dl, 30h
int 21h
inc bx ;next piece
dec cl ;decrement counter
jnz print
can someone enlighten me?
it's not working as I expect