⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arryscan.asm

📁 想学习汇编语言的
💻 ASM
字号:
TITLE Scanning an Array              (ArryScan.asm)

; Scan an array for the first nonzero value.
; Last update: 2/16/02

INCLUDE Irvine32.inc
.data
intArray SWORD  0,0,0,0,1,20,35,-12,66,4,0
;intArray SWORD  1,0,0,0
;intArray SWORD  0,0,0,0
;intArray SWORD  0,0,0,1
noneMsg  BYTE "A non-zero value was not found",0

.code
main PROC
	mov   ebx,OFFSET intArray		; point to the array
	mov   ecx,LENGTHOF intArray		; loop counter

L1:
	cmp   WORD PTR [ebx],0		; compare value to zero
	jnz   found		; found a value
	add   ebx,2		; point to next
	loop  L1		; continue the loop
	jmp   notFound		; none found

found:
	movsx eax,WORD PTR [ebx]		; otherwise, display it
	call  WriteInt
	jmp   quit

notFound:
	mov   edx,OFFSET noneMsg		; display "not found" message
	call  WriteString

quit:
	call  crlf
	exit
main ENDP
END main

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -