程序需要从用户那里获取一个简单的字符串并将其显示回来。我已经让程序从用户那里获取输入,但我似乎无法存储它。这是我到目前为止所拥有的:
BITS 32
global _main
section .data
prompt db "Enter a string: ", 13, 10, '$'
input resd 1 ; something I can using to store the users input.
name db "Name: ******", 13, 10,'$'
StudentID db "********", 13, 10, '$'
InBoxID db "*************", 13, 10, '$'
Assignment db "************", 13, 10, '$'
version db "***************", 13, 10, '$'
section .text
_main:
mov ah, 9
mov edx, prompt
int 21h
mov ah, 08h
while:
int 21h
; some code that should store the input.
mov [input], al
cmp al, 13
jz endwhile
jmp while
endwhile:
mov ah, 9
; displaying the input.
mov edx, name
int 21h
mov edx, StudentID
int 21h
mov edx, InBoxID
int 21h
mov edx, Assignment
int 21h
mov edx, version
int 21h
ret
我正在使用 NASM 组装它。