0
我試圖在一個字符串的同一行輸入單個字符,然後用一個字符串在一行上輸出該字符。我已經嘗試過GETC和PUTC,但是我得到了'0我對這個LC-3的東西真的很陌生,並且非常感謝一些幫助在路上克服這個碰撞。LC-3 - 如何存儲輸入字符,然後在輸入字符串之後同時輸入和輸出字符?
這是我到目前爲止。
.ORIG x3000 ;start assembly directive
MyMain
lea r0, input ;point to input string
trap x22 ;print string out
GETC
ld r0, newLine ;get <crlf>
trap x21 ;print it out
lea r0, output ;point to output string
trap x22 ;print string out
PUTC
ld r0, newLine ;get <crlf>
trap x21 ;print it out
lea r0, term ;point to termination string
trap x22 ;print string out
ld r0, newLine ;get <crlf>
trap x21 ;print it out
MyMainEnd trap x25 ;stop the program
; constants
newLine .FILL x0A ;line feed and Carriage return in LC-3
input .STRINGZ "Please input a character: "
output .STRINGZ "You input the character: "
term .STRINGZ "Program execution terminated!"
.END ;end assembly directive