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

📄 _prompt.asm

📁 此为本书配套光盘.本书主要内容包括:微型计算机基础知识、IBM-PC微型计算机系统概述、汇编语言程序设计基本方法、三大结构程序设计、子程序设计、汇编语言程序设计等内容。
💻 ASM
字号:
TITLE Prompt For Integers	      (_prompt.asm)

; Last update: 8/29/01

INCLUDE sum.inc

.code
;-----------------------------------------------------
PromptForIntegers PROC,
  ptrPrompt:PTR BYTE,		; prompt string
  ptrArray:PTR DWORD,		; pointer to array
  arraySize:DWORD		; size of the array
;
; Prompts the user for an array of integers and fills
; the array with the user's input.
; Returns:  nothing
;-----------------------------------------------------
	pushad		; save all registers

	mov  ecx,arraySize
	cmp  ecx,0		; array size <= 0?
	jle  L2		; yes: quit
	mov  edx,ptrPrompt		; address of the prompt
	mov  esi,ptrArray

L1:
	call WriteString		; display string
	call ReadInt		; read integer into EAX
	call Crlf		; go to next output line
	mov  [esi],eax		; store in array
	add  esi,4		; next integer
	loop L1

L2:
	popad		; restore all registers
	ret
PromptForIntegers ENDP

END

⌨️ 快捷键说明

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