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

📄 repeat.asm

📁 想学习汇编语言的
💻 ASM
字号:
TITLE Repeat Block Examples         (Repeat.asm)

; This program demonstrates the REPEAT, FOR,
; FORC, and WHILE directives.
; Last update: 2/30/02

INCLUDE Irvine32.inc
INCLUDE Macros.inc

COURSE STRUCT
  Number  BYTE 9 DUP(?)
  Credits BYTE ?
COURSE ENDS

; A semester contains an array of courses.
SEMESTER STRUC
	Courses COURSE 6 DUP(<>)
	NumCourses WORD ?
SEMESTER ENDS

.data

; Create a character lookup table:
Delimiters LABEL BYTE
FORC code,<@#$%^&*!<!>>
  BYTE "&code"
ENDM
BYTE 0  	; marks the end

; Generate Fibonacci numbers up to 0FFFFh
f1  = 1
f2  = 1
f3 = f1 + f2
DWORD f1,f2

WHILE f3 LT 0FFFFh
	DWORD f3
	f1 = f2
	f2 = f3
	f3 = f1 + f2
ENDM

ECHO ---------------------------------------------------------

iVal = 10
REPEAT 100                 	; begin REPT loop
	DWORD iVal	; status
	iVal = iVal + 10
ENDM

; Define a set of semester variables.
FOR semName,<Fall1999,Spring2000,Summer2000,Fall2000,Spring2001,Summer2001>
	semName SEMESTER <>
ENDM

.code
main PROC
	mov esi,OFFSET Fall1999
	mov ecx,2
L1:
	mov edx,esi
	add edx,OFFSET COURSE.Number
	mWrite "Enter a course name: "
	mReadStr edx,8
	mWrite "Enter the credits: "
	call ReadInt
	mov  (COURSE PTR [esi]).Credits,al
	add esi,SIZEOF COURSE
	Loop L1

    exit
main ENDP
END main

⌨️ 快捷键说明

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