如何在lc3的内存中覆盖

时间:2015-06-13 15:11:35

标签: lc3

我在程序集lc3中编写程序,虽然我知道如何读取存储在内存中的字母,但我不知道如何用另一个字母覆盖这封字母。我不想使用.STRINGZ这样做,因为在这封信之后会添加一个额外的“0”,我将失去我的话。你看我正在读一个字,一个字母,我想逐个字母地替换这些字母。

谢谢;)

1 个答案:

答案 0 :(得分:0)

使用的最佳命令是STR命令:

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最适合存储字符串的字符,因为您可以增加存储在R2中的值,以便逐个存储每个字符。