I am trying to get this program to use LOOPZ instead of LOOPNZ to find the first positive value in an array but I am not sure how to go about it. Any hints or ideas behind doing it would be much appreciated. This is the code below:
.data
array SWORD -3,-6,-1,-10,10,30,40,4
sentinel SWORD 0
.code
main PROC
mov esi,OFFSET array
mov ecx,LENGTHOF array
next:
test WORD PTR [esi],8000h ; test sign bit
pushfd ; push flags on stack
add esi,TYPE array
popfd ; pop flags from stack
loopnz next ; continue loop
jnz quit ; none found
sub esi,TYPE array ; ESI points to value
quit: