ARM程序集:从内存中连接2个字符串

时间:2015-03-19 20:15:00

标签: arm risc

简单的ARM语言,请保持答案简单

    AREA one, CODE
        ENTRY
        LDR r0, =STRING1
        LDR r1, =STRING2
        LDR r3, =STRING3

`loop1` LDRB r4, [r0], #1
        STRB r4, [r3], #1
        CMP r0, #0x00
        BNE loop1

loop2   LDRB r4, [r1], #1
        STRB r4, [r3], #1
        CMP r1, #0x00
        BNE loop2

        LDRB r4, #0x00
        STRB r4, [r3]

        ALIGN
STRING1 DCB "This is a test string1"            ;String1
EoS1    DCB 0x00                                ;end of string1
STRING2 DCB "This is a test string2"            ;String
EoS2    DCB 0x00                                ;end of string2
STRING3 space 0xFF 
        END

我尝试连接STRING1STRING2并将结果存储在STRING3中,并附加NULL字符串结尾0x00

这是对的吗?

1 个答案:

答案 0 :(得分:1)

您获得'无写权限',因为您必须将基尔模拟器的调试选项卡中的内存映射设置为读/写/执行权限