Inline asm
Posted: Thu Jul 06, 2006 9:50 pm
Hi,
I want to use some inline asm in my raycaster lib to speed up the floors etc, can you clear a few things up for me so I can determine if it's possible?
1, can you use a C++ defined variable/pointer in the asm?
i.e
Which shold take pp,p2, add them together and store the result in op.
That's semi-pesudeo code, but what would the real code look like if it's possible? Or do I have to use a preset part of memory and use the memory address to access it? (I take it that's fairly easy on a closed system like the ps2)
Thanks
I want to use some inline asm in my raycaster lib to speed up the floors etc, can you clear a few things up for me so I can determine if it's possible?
1, can you use a C++ defined variable/pointer in the asm?
i.e
Code: Select all
int p = 25;
int n = 20;
int * pp = &p;
int * p2 = *p2;
int output=0;
int * op = &p;
inline asm volatile{
"lw $4,pp\n"
"lw $5,p2\n"
"addui $6,$5,$4\n"
"sw $6,op\n"
}
That's semi-pesudeo code, but what would the real code look like if it's possible? Or do I have to use a preset part of memory and use the memory address to access it? (I take it that's fairly easy on a closed system like the ps2)
Thanks