从键盘输入一组字符串,以相反的顺序输出显示

来源:百度知道 编辑:UC知道 时间:2024/05/14 20:12:40
用汇编语言编程 急!!

用LIFO结构的堆栈,接受每个字母并push,然后pop到一个缓冲区中,最后输出,或者输入的字母放在一个缓冲区中,然后压入堆栈,最后弹出
TITLE Program Template

; 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