简体   繁体   English

LC-3 .BLKW如何工作

[英]LC-3 .BLKW How it works

Solved! 解决了!

I am writing a program in assembly for LC-3 that is supposed to wait for the user to type all the characters he wants, then print them on the monitor only after he hits enter. 我正在为LC-3编写一个程序集,该程序应该等待用户键入他想要的所有字符,然后在按下Enter键后才在监视器上打印它们。

I got so far to solve the issue if the user only hits the enter button. 如果用户仅点击输入按钮,我到目前为止已经解决了这个问题。 Examples: 例子:

I press enter ---> program behaves as it should. 我按回车--->程序表现正常。 (goes to new line and halts) (转到新行并暂停)

I press "ABCDEF" ---> program displays "F" instead of going to new line and displaying ABCDEF. 我按“ ABCDEF” --->程序显示“ F”,而不是换行并显示ABCDEF。 Solved 解决了

.BLKW is supposed to save a block of memory. .BLKW应该保存一块内存。 SO to solve this issue I was supposed to load a .blkw to a register, then store the new letter value into that register and each time update the storage location to move to the next location. 因此,要解决此问题,我应该将.blkw加载到寄存器,然后将新的字母值存储到该寄存器中,并每次更新存储位置以移至下一个位置。

            LEA    R2 INPUT
    onemoretime    GETC

        ADD    R3 R1 R0
        BRz    DONE
        STR    R0 R2 0
        ADD    R2 R2 1
        BR     onemoretime        

INPUT      .BLKW 10

You are just adding the ascii values of the input into ONE location, INPUT . 您只是将输入的ascii值添加到一个位置INPUT中 If you hope to recover the input characters, you need to store them to DIFFERENT locations. 如果希望恢复输入的字符,则需要将它们存储到不同的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM