assembly - copying data with ldm/stm instructions -


it's arm assembler. need copy 8 words of array in 1 iteration using instructions ldm , stm. not allowed add or clear line of code. how do this?

this code need use:

  num   equ 24         import exit          export start            start   ldr r0, =src         ldr r1, =dst         mov r2, #num             lsl     r2,#3 loop    ldm ????                        put instead of ????                              stm ????                            subs    r2, r2, #1         bne loop                 bl exit                  area block, data, readwrite  src    dcd 1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8  dst    dcd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 end 

you can find description of ldm , stm here.

the instructions you're looking ldmia , stmia (ia means increment after; i.e. transfer 1 word, increment address).

for example:

ldmia r0!,{r3-r6}  @ read 4 words src (r0) registers r3, r4, r5 , r6.                    @ final address written r0. 

by way, doesn't quite right me:

     mov r2, #num, lsl#2 loop ...                     subs r2, r2, #1 

from looks of things, you're iterating 96 times (== size of array in bytes). you're not copying single byte per iteration. if you're planning copy 8 words per iteration should iterate 3 times (96/32).


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -