#12927 - shadow_gg - Mon Dec 01, 2003 1:24 pm
hello,got a problem accessing variables in a function
in fact still not resolved since last time :/
it compiles but it seems it doesn't read the variable sky
r3 don't get the correct value of sky
it displays me strange data
blitasm()
{
void *sky=(void *)(0x8000000+SIZE_ROM+SIZE_PAL+SIZE_IMAGE+SIZE_MAP);
asm volatile("
.ALIGN
.ARM
ldr r0,=screen
ldr r0,[r0]
ldr r3,%0
ldr r3,[r3]
ldr r2,=9600
boucle:
ldr r1,[r3],#4
str r1,[r0],#4
subs r2,r2,#1
bpl boucle
.pool
":/*no output*/:"m"(sky):"r0","r1","r2","r3");
}
but when declaring sky global
doing ldr r3,=sky
ldr r3,[r3] it works ?
:/
what happens?
I know it's better to write in a separate .s file,but more simple for me to write in C functions.
in fact still not resolved since last time :/
it compiles but it seems it doesn't read the variable sky
r3 don't get the correct value of sky
it displays me strange data
blitasm()
{
void *sky=(void *)(0x8000000+SIZE_ROM+SIZE_PAL+SIZE_IMAGE+SIZE_MAP);
asm volatile("
.ALIGN
.ARM
ldr r0,=screen
ldr r0,[r0]
ldr r3,%0
ldr r3,[r3]
ldr r2,=9600
boucle:
ldr r1,[r3],#4
str r1,[r0],#4
subs r2,r2,#1
bpl boucle
.pool
":/*no output*/:"m"(sky):"r0","r1","r2","r3");
}
but when declaring sky global
doing ldr r3,=sky
ldr r3,[r3] it works ?
:/
what happens?
I know it's better to write in a separate .s file,but more simple for me to write in C functions.