Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with ARM CODE

Hello we were told to take some code and

1: Add a function to print out the contents of dststr before and after the program runs. Hint in the work book from last week SWI_WriteC.

2: the above code so that it stores in the reverse order.

i have not been able to do the first one yet

below is my code can someone tell me what i am doing wrong and advise on how to second one

code:

AREA StrCopy1, CODE
SWI_WriteC EQU &0
ENTRY ; mark the first instruction
main
ADR r1, srcstr ; pointer to first stri ng
ADR r0, dststr ; pointer to second string
BL strcopy ; copy the first into second
SWI 0x11 ; and exit

srcstr DCB " CAT",0
dststr DCB " DOG",1
start
LDR r1, =sourcestring ; Pointer to the sourcestring
LDR r2, =sourcestring ; Pointer to the sourcestring
repeat ; Repeat label sets the point where we repeat to
ALIGN ; realign address to word boundary
strcopy
LDRB r0, [r1], #1 ; load byte, then update address
SWI SWI_WriteC
CMP r0, #0 ; check for zero terminator


BNE strcopy ; keep going if not

strcopy2
LDRB r1 , [r2], #1 ; load byte, then update address
SWINE SWI_WriteC
CMP r0, #0 ; check for zero terminator
BNE strcopy2 ; keep going if not

stop
SWI 0x11

END

any help would be apriecated


Sign In or Register to comment.