Original Post
Experimenting with learning x64 asm and how code operates on a low level, and trying to work out where speed is increased in projects when ASM is appropriately used.
My project is x64 with MASM in visual studio 2010
Currently I am trying to replace the basic glClear glLoadIdentity etc with asm to understand how to interface between code and asm.
I'm following the asm examples over at NEHE, but I constantly keep getting an access violation error when I seem to introduce 'push' into the code.
This is the code asm-side:
Over in C++ I am just doing the standard 'extern "C" void ASMrender
and then calling ASMrender() in the main render loop.
Here's a screenshot of some of the action where it all goes wrong.
My project is x64 with MASM in visual studio 2010
Currently I am trying to replace the basic glClear glLoadIdentity etc with asm to understand how to interface between code and asm.
I'm following the asm examples over at NEHE, but I constantly keep getting an access violation error when I seem to introduce 'push' into the code.
This is the code asm-side:
include gl.inc
include glu.inc
.data
_45d0 equ 40468000h ;45.0
_45d1 equ 0
_01d0 equ 1069128089
_01d1 equ -1717986918 ;0.1
_100d0 equ 1079574528
_100d1 equ 0 ;100.0
_1d0 equ 1072693248
_1d1 equ 0 ;1.0
_05 equ 1056964608 ; 0.5
_1 equ 1065353216 ; 1.0
_m1 equ -1082130432 ;-1.0
_3 equ 1077936128 ; 3.0
_m15 equ -1077936128 ;-1.5
_m6 equ -1061158912 ;-6.0
.code
ASMrender proc
display:
push GL_COLOR_BUFFER_BIT
call glClear
call glLoadIdentity
call glEnd
push _m15
push 0
push _m6
call glTranslatef
xor eax,eax
ret
ASMrender endp
end
Over in C++ I am just doing the standard 'extern "C" void ASMrender
and then calling ASMrender() in the main render loop.
Here's a screenshot of some of the action where it all goes wrong.