how to overwrite in the memory of lc3

810 views Asked by At

I am writing a program in assembly lc3 and although I know how to read a letter which is stored in the memory I don't know how to overwrite this letter with another one. I don't want to do it using .STRINGZ because then an extra "0" will be added after the letter and I will lose my word. You see I am reading a word, letter by letter and I want to replace the letters, letter by letter.

thank you ;)

1

There are 1 answers

0
Chris M On

The best command to use would be the STR command:

LEA R2, STRING
STR R3, R2, #0      ; stores the value of R3 into the
                    ; memory stored into R2, with an 
                    ; offset of #0

; You can create a loop to cycles through as many char
; you would like to store

STRING  .BLKW 10

STR is the best for storing characters of a string because you can increment the value stored in R2 to store each char one after another.