loopnz.asm
来自「想学习汇编语言的」· 汇编 代码 · 共 34 行
ASM
34 行
TITLE Scanning for a Positive Value (Loopnz.asm)
; Scan an array for the first positive value.
; If no value is found, ESI will point to a sentinel
; value (0) stored immediately after the array.
; Last update: 11/4/01
INCLUDE Irvine32.inc
.data
array SWORD -3,-6,-1,-10,10,30,40,4
;array SWORD -3,-6,-1,-10 ; alternate test data
sentinel SWORD 0
.code
main PROC
mov esi,OFFSET array
mov ecx,LENGTHOF array
next:
test WORD PTR [esi],10000000b ; test highest 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 ; SI points to value
quit:
call crlf
exit
main ENDP
END main
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?