I don't have your starting code, but guessing at what is required...
You might start by producing a more detailed explanation in English.
For example:
You have a string to copy. The string is in memory, beginning at a fixed address. The fixed address is in R1. You are going to copy the string to memory, to another fixed address. That other fixed address is in R2.
You can approach this by copying one character, moving to the next, and repeating. You will stop when you hit the last character (the one with value 0).
- Copy the character at the address in R1 to the address in R2
- Check if the character copied was the null terminator
- If it was, stop.
- If it was not, move the addresses in R1 and R2 up one character (point to next character), and go to step (1).
Then turn that into assembly:
Some of the sorts of instructions you will to translate this English recipe into LC3 assembly are likely to be:
LDR R3, R1, #0
will load the character at the address in R1 into R3.
STR
is the analogous command you can use for storing the character in R2 (but you should work that out yourself if this is homework).
ADD R1, R1, #1
will add 1 to the address in register R1 (R1 = R1 + 1).
AND R4, R3, x1111
will set R4 to 0 if R3 is 0 (the null character) (R4 = R3 & 0x1111).
BRZ DONE
will go to the label "DONE:" if the last instruction set the zero flag.
LEA R5, NEXT
followed by JMP R5
will go to the label "NEXT:" by loading the address of the label "NEXT:" into R5 and then jumping to that value.
I imagine your code will look something like:
LEA R5, NEXT Put the address of NEXT in R5
NEXT:
LDR R3, R1, #0 Copy what is in the address in R1 (a character) to R3
STR... Store the character in R2
AND R4, R3, x1111 See if the character in R3 (the one copied) is 0
BRZ DONE If it is, finish
ADD R1, R1, #1 If not, go to the next character
ADD ...
JMP R5 Jump to the address in R5 (which is NEXT)
DONE:
...
You should not assume I have this correct. I don't have an LC3 simulator handy.
Best of luck.