我如何输出用户输入的字符串

How do i output a user input string

我是 LC-3 汇编语言的新手,目前正在做作业,其中一个问题是输出用户输入的字符串,例如:

Please enter a text: Hello world123

The text you have entered is: Hello world123

这是我一直在使用的代码:

.orig x3000

Lea r0, Name

Puts

Lea r0, inputstring

Puts

lea r2, outputstring

loop

getc

add r1,r0, -10

brz outside

out

str r0,r2, #0

add r2, r2, #1

brnzp loop

outside 

lea r0, output_text

puts

Halt

Name .stringz "Francois Van Zyl"

inputstring .stringz "\nPlease enter a text: "

output_text .stringz "\nThe text you have typed is: "

outputstring .blkw 99

.end

我希望用户输入字符串后,程序会显示结果。我该如何解决这个问题?

终于找到了!通过大量试验。 这是我完成的代码:

.orig   x3000
Lea r1, storeString

Lea r0, Student
puts

Lea r0, Userinput
puts

LOOP
getc

out
str r0, r1, 0
add r1, r1, 1
add r0, r0, -10

brz OUTSIDE

brnzp LOOP

OUTSIDE

Lea r0, Outputtext
puts

Lea r0, storeString
puts

Halt
Student .stringz "Francois Van Zyl"
Userinput .stringz "\n\nPlease enter a text: "
Outputtext .stringz "The text you have typed is: "
storeString .blkw 99

.end