revstr.asm

来自「想学习汇编语言的」· 汇编 代码 · 共 41 行

ASM
41
字号
TITLE Program Template          (RevStr.asm)

; This program reverses a string.
; Last update: 1/28/02

INCLUDE Irvine32.inc

.data
aName BYTE "Abraham Lincoln",0
nameSize = ($ - aName) - 1

.code
main PROC

; Push the name on the stack.
	mov ecx,nameSize
	mov esi,0

L1:	movzx eax,aName[esi]	; get character
	push eax	; push on stack
	inc esi
	Loop L1

; Pop the name from the stack, in reverse,
; and store in the aName array.
	mov ecx,nameSize
	mov esi,0

L2:	pop eax	; get character
	mov aName[esi],al	; store in string
	inc esi
	Loop L2

; Display the name.
	mov edx,OFFSET aName
	call Writestring
	call Crlf

	exit
main ENDP
END main

⌨️ 快捷键说明

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