如何输入包含1到50个字符的字符串。(程序集)

问题描述 投票:-1回答:1
;This program reverses a string.
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

我完成了问题的第一部分,即制作反向字符串程序,但现在我需要修改程序,以便用户可以输入包含1到50个字符的字符串。我不确定如何做到这一点,并想知道是否有人可以提供帮助。这是汇编语言顺便说一句

string assembly masm irvine32 machine-language
1个回答
2
投票

你可以使用qazxsw poi。因此,您必须将qazxsw poi更改为变量并增加ReadString from irvine32.lib的大小。

我为你做了;-):

nameSize
© www.soinside.com 2019 - 2024. All rights reserved.