Page 1 of 1

How to process multiple data in ARM assembly

PostPosted: Dec 1, 2003 @ 11:02am
by momomo
I was just writing ARM assembly in these few days.
And I want to implement a bilinear filter like

void Interpolate(uchar *src,uchar *dest, int width)
{
int i;
for(i=0;i<width;i++)
*(dest) = (*(src) + *(src+1) +1) >> 1;
}

And I want to use LDR to load 4 bytes instead of using LDRB 4 times, but the program seems crashed when I ran it on my PDA,can anyone tell me why?
the ASM is like :

Interpolate_ASM
stmdb sp!, {r4-r8, r10, r11, lr}
ldr r4,[r0] ;I added this useless
;code and r4 will never be
;used ,but the program
;crashed anyway

;start original code
.
.
.
;end of original code

ldmia sp!, {r4-r8, r10, r11, pc} ; ldmfd
ENDP

PostPosted: Dec 1, 2003 @ 11:04am
by refractor
Check you're loading from a 4-byte aligned address.

PostPosted: Dec 2, 2003 @ 3:23am
by momomo

PostPosted: Dec 2, 2003 @ 5:45am
by Dan East

PostPosted: Dec 2, 2003 @ 7:51am
by momomo