Assembly Language Storing Issue

0

I'm trying to make an Assembly program concatenate two Strings. Here's my program.

        AREA Assignment4, CODE, READONLY
    ENTRY   

;;;;;;;;;;Setting Up

    ADR r0, StrF    ;Address of first block in destination        

    ;;;String 1
    ADR  r1, Str1   ;Address of first string
    ADR  r2, EoS    ;Address of EoS1
    SUBS r2, r2,r1  ;Length of str1, counter

    ;;;;String2
    ADR r3, Str2    ;Address of second string
    ADR r4, EoS2    ;Address of EoS2
    SUBS r4, r4,r3  ;Length of Str2 

;;;;;;;;;;Performing Actions

    ;;;;First String
Loop    LDRB r5,[r1],#1     ;Load next bit of "r1" in r5
    STRB r5,[r0],#1     ;Store prev bit in memory at r0
    SUBS r2, r2, #1     ;Decrement counter
    CMP r2, #0          ;Compare our counter
    BNE Loop            ;Branch if counter != 0

    ;;;;;Second String
Loop2   LDRB r5,[r3],#1     ;Load next bit of "r3" to r5
    STRB r0,[r5],#1     ;Store this bit in r0
    SUBS r4, r4, #1     ;Decrement length counter
    CMP r4, #0          ;Compare our counter
    BNE Loop2           ;Branch if counter != 0

            ;; Testing the memory - Delete these lines later
    ADR r0, StrF
loop3   LDRB r1,[r0],#1
    B   loop3   


Finished    B   Finished


Str1    DCB "This is a test string1"  ;Str1
EoS     DCB 0x00
Str2    DCB "This is a test string2"  ;Str2
EoS2    DCB 0x00
StrF    DCB 0x00    ;Saving this

    END

My problem is on lines 22 + 29. I don't know how to successfully store the current byte onto the memory; more specifically the memory in register r0, initialized initially by StrF.

Any ideas on how to fix my STRB or STR?

I get this once I pass that line:

"error 65: access violation at 0x00000082 : no 'write' permission" thats the memory address that at StrF that im trying to save into.

string
memory
assembly
arm
storage
asked on Stack Overflow Nov 12, 2013 by Sedky A • edited Nov 13, 2013 by Gunner

2 Answers

0

You see that big "READONLY" in the first line?

Since strF is located in the same area as the code declared as readonly, it of course doesn't work.

You should put strF in a differnt area declared as readwrite, but you won't be able to use adr then.

All in all, you should design the routines in a way that they receive memory addresses as parameters from the callers.

0

i had this problem, so if you are using keil, when u in debug mode go to debug -> memorymap, then add memory range manually

0x00000048 ,0x0000011A 

and check on read, write a/o execute

check this page DEBUGGER: ERROR 65 (ACCESS VIOLATION)

answered on Stack Overflow Dec 5, 2013 by user2954718

User contributions licensed under CC BY-SA 3.0