MadDog
Member
I've been wasting most of my dev time on this, turned out to be the clobber lists on the inline asm. That is unless I got it very wrong on how they work. (could be a posiblity
This one works, I store the regs I mess with, then restore on exit.
asm volatile
(
"stmfd sp!, {r0-r11} \n"
"mov r0,#0x000000f0 \n"
"mov r1,%1 \n"
"mov r2,%0 \n"
"orr r2,r2,r2,lsl #8 \n"
"orr r2,r2,r2,lsl #16 \n"
"mov r3,r2 \n"
"mov r4,r2 \n"
"mov r5,r2 \n"
"mov r6,r2 \n"
"mov r7,r2 \n"
"mov r8,r2 \n"
"mov r9,r2 \n"
"mov r10,r2 \n"
"mov r11,r2 \n"
"clear_screen_loop: \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" subs r0,r0,#1 \n"
"bne clear_screen_loop \n"
"ldmfd sp!, {r0-r11} \n"
:
:"r"(pPalette_index), "r"(pDest)
);*/
On this code I ask the compiler to do it for me with a clobber list, and it locks up the CPU.
asm volatile
(
"mov r0,#0x000000f0 \n"
"mov r1,%1 \n"
"mov r2,%0 \n"
"orr r2,r2,r2,lsl #8 \n"
"orr r2,r2,r2,lsl #16 \n"
"mov r3,r2 \n"
"mov r4,r2 \n"
"mov r5,r2 \n"
"mov r6,r2 \n"
"mov r7,r2 \n"
"mov r8,r2 \n"
"mov r9,r2 \n"
"mov r10,r2 \n"
"mov r11,r2 \n"
"clear_screen_loop: \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" subs r0,r0,#1 \n"
"bne clear_screen_loop \n"
:
:"r"(pPalette_index), "r"(pDest)
:"r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11"
);
This one works, I store the regs I mess with, then restore on exit.
asm volatile
(
"stmfd sp!, {r0-r11} \n"
"mov r0,#0x000000f0 \n"
"mov r1,%1 \n"
"mov r2,%0 \n"
"orr r2,r2,r2,lsl #8 \n"
"orr r2,r2,r2,lsl #16 \n"
"mov r3,r2 \n"
"mov r4,r2 \n"
"mov r5,r2 \n"
"mov r6,r2 \n"
"mov r7,r2 \n"
"mov r8,r2 \n"
"mov r9,r2 \n"
"mov r10,r2 \n"
"mov r11,r2 \n"
"clear_screen_loop: \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" subs r0,r0,#1 \n"
"bne clear_screen_loop \n"
"ldmfd sp!, {r0-r11} \n"
:
:"r"(pPalette_index), "r"(pDest)
);*/
On this code I ask the compiler to do it for me with a clobber list, and it locks up the CPU.
asm volatile
(
"mov r0,#0x000000f0 \n"
"mov r1,%1 \n"
"mov r2,%0 \n"
"orr r2,r2,r2,lsl #8 \n"
"orr r2,r2,r2,lsl #16 \n"
"mov r3,r2 \n"
"mov r4,r2 \n"
"mov r5,r2 \n"
"mov r6,r2 \n"
"mov r7,r2 \n"
"mov r8,r2 \n"
"mov r9,r2 \n"
"mov r10,r2 \n"
"mov r11,r2 \n"
"clear_screen_loop: \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" stmia r1!,{r2-r11} \n"
" subs r0,r0,#1 \n"
"bne clear_screen_loop \n"
:
:"r"(pPalette_index), "r"(pDest)
:"r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11"
);