Mihail121
04-08-2004, 02:15 AM
Ok so here is the deal:
I wanted to write my newly written raycaster in ASM. To understand whether there is some point in doing that i decided to make this experiment: go to the biggest res supported, create a dib section and fill it every frame with random pixels. I first do it for 10 seconds with C routine and then with assembler one. It's simply a profiler compare after that ;)
and now the real problem:
Iuse MASM to write the ASM routine. Since i need the rand() func for the random pixels i define it's proto in the ASM file:
rand PROTO c
and then simply use it. Upon link with GCC (which links with stdlib) the correct address for the rand function is found and used. __BUT__ - when i call the rand from the C routine everything is fine, when i call it from the ASM routine the app CRASHES?!.
Yes, yes i'm 100% sure that i use the correct calling convention and all addresses are computed correctly. Also i bet five bucks the damn stack frame for the call is correct cause the rand function simply doesn't have any parameters :D
Does anyone have any ideas on this one?
P.S.
A little hint, the function abs() from the same lib (stdlib that is) is called from the ASM routine correctly.
I wanted to write my newly written raycaster in ASM. To understand whether there is some point in doing that i decided to make this experiment: go to the biggest res supported, create a dib section and fill it every frame with random pixels. I first do it for 10 seconds with C routine and then with assembler one. It's simply a profiler compare after that ;)
and now the real problem:
Iuse MASM to write the ASM routine. Since i need the rand() func for the random pixels i define it's proto in the ASM file:
rand PROTO c
and then simply use it. Upon link with GCC (which links with stdlib) the correct address for the rand function is found and used. __BUT__ - when i call the rand from the C routine everything is fine, when i call it from the ASM routine the app CRASHES?!.
Yes, yes i'm 100% sure that i use the correct calling convention and all addresses are computed correctly. Also i bet five bucks the damn stack frame for the call is correct cause the rand function simply doesn't have any parameters :D
Does anyone have any ideas on this one?
P.S.
A little hint, the function abs() from the same lib (stdlib that is) is called from the ASM routine correctly.