[英]My input code for LC-3 isn't working as intended
I've been working on this bit of code to take a string of input and to have it displayed after I hit the enter key, but it doesn't work for some reason and I can't figure out where I'm going wrong at all. 我一直在研究这段代码来获取一串输入,并在我按下回车键后显示它,但是由于某种原因它不起作用我无法弄清楚我哪里出错了一点都不 I would love some help to figure this one out. 我希望得到一些帮助来解决这个问题。
LD R1, RT
LEA R2, ARRAY
INPUT GETC ;read the input character
OUT ;echoes the character
ADD R3, R0, R1
BRz ENDINPUT
STR R0, R2, #0
ADD R2, R2, #1
BR INPUT
ENDINPUT
STR R3, R2, #0
LEA R0, ARRAY ;outputs the string of characters
PUTS
Late response, but in case it's still haunting you, hope these help! 迟到的反应,但万一它仍然困扰着你,希望这些帮助!
Check that the value in location RT
is correct. 检查位置RT
中的值是否正确。 If you are checking for a 'LF' when you hit 'Enter', R2 should have the value of negative 'LF'. 如果您在点击“Enter”时检查“LF”,则R2的值应为负“LF”。 In 2s-complement this is 0xFFFFFFF0
. 在2s补码中,这是0xFFFFFFF0
。
Make sure your ARRAY
is large enough to hold your inputs. 确保您的ARRAY
足够大以容纳您的输入。 Check your .BLKW
line – I'm assuming you didn't post these lines in your post. 检查.BLKW
行 - 我假设您没有在帖子中发布这些行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.