-1

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 ;)

otrym
  • 21
  • 2
  • Downvote because you did not post code you have thus far. We will help you with it, but not write it for you. – Evan Carslake Jun 13 '15 at 15:19
  • I am sorry but I didn't mean to ask you guys to write it for me, I am just asking if anyone knows whether there is a certain command that I can use . Here is part of what I have written but it doesn't work... LD R3, DATA STR R3, R4, #0 DATA .FILL x5001 Where R4 has the value of a letter. I am trying to put the data which are saved in the R3,where the R4 shows in the memory but the STR command doesn't seem to do what I am expecting... – otrym Jun 13 '15 at 18:49

1 Answers1

0

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.

Chris M
  • 651
  • 6
  • 10