source equ $10 ;$10 was chosen arbitrarily source_hi equ source+1 ;the high byte MUST be after the low byte, otherwise this will not work. dest equ $12 dest_hi equ dest+1 LDA #MyString ;get the high byte STA source_hi ;we just created a "shallow reference" to an existing string. ;As it turns out, this is a necessary step to do a deep copy. LDA #RamBuffer STA dest_hi strcpy: ;assumes that RamBuffer is big enough to hold the source string, and that the memory ranges do not overlap. ;if you've ever wondered why C's strcpy is considered "unsafe", this is why. LDY #0 .again: LDA (source),y STA (dest),y BEQ .done INY BNE .again ;exit after 256 bytes copied or the null terminator is reached, whichever occurs first. RTS MyString: byte "hello",0 RamBuffer: byte 0,0,0,0,0,0