#1862 - regularkid - Fri Jan 24, 2003 6:40 pm
Hi, I found this code on GBADev.org about calling an ASM function from C code:
My quesions:
1. Where are the parameters stored? I think it said lowest registers, but I just want to make sure.
2. What does this do:
stmfd sp!,{r4-r5}
3. What does this do:
ldmfd sp!,{r4-r5}
thanks!
_________________
- RegularKid
Code: |
@ Draw pixel in GBA graphics modes 3/5 in ARM asm (fast) @ Entry: px = pixel X coordinate @ py = pixel Y coordinate @ color = pixel color @ scrnadr = base screen address @ (void) DrawPixel32 (u32 x, u32 y, u32 color, u32 scrnadr); .ARM .ALIGN .GLOBL DrawPixel32 DrawPixel32: stmfd sp!,{r4-r5} mov r4,#480 mul r5,r4,r1 add r5,r5,r0,lsl #1 add r4,r5,r3 strh r2,[r4] ldmfd sp!,{r4-r5} bx lr |
My quesions:
1. Where are the parameters stored? I think it said lowest registers, but I just want to make sure.
2. What does this do:
stmfd sp!,{r4-r5}
3. What does this do:
ldmfd sp!,{r4-r5}
thanks!
_________________
- RegularKid