Stkabi
Stkabi

Reputation: 121

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

Upvotes: 0

Views: 30672

Answers (1)

Jens Björnhager
Jens Björnhager

Reputation: 5648

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.

Upvotes: 1

Related Questions