Below is the code to find the first positive value in an array, however I need t
ID: 3620918 • Letter: B
Question
Below is the code to find the first positive value in an array, however I need to modify it so that it finds the first negative value... i'm pretty sure that I need to change the line: test WORD PTR [esi],8000h but I am not sure what I need to change it to.... any help would be great! .data array SWORD -3,-6,-1,-10,10,30,40,4sentinel SWORD 0
.code
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:
Below is the code to find the first positive value in an array, however I need to modify it so that it finds the first negative value... i'm pretty sure that I need to change the line: test WORD PTR [esi],8000h but I am not sure what I need to change it to.... any help would be great! .data
Explanation / Answer
.data
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.