简体   繁体   中英

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.

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. Solved

.BLKW is supposed to save a block of memory. 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.

            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 . If you hope to recover the input characters, you need to store them to DIFFERENT locations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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