Hey there. I''m programming a game with my DirectX 3D engine, and I want to optimize it using ASM (Assembly Language). Right now I am trying to call the IDirect3DDevice8::SetRenderState() functions ASM. Here is my code right now:
__asm
{
;; Enable z-buffer parameters
PUSH 1 ;; Second parameter
PUSH D3DRS_ZENABLE ;; First parameter
;; Call the IDirect3DDevice8::SetRenderState function
MOV EAX, DWORD PTR g_pDevice ;; Interface of d3d device
MOV ECX, DWORD PTR [EAX] ;; Move EAX pointer to ECX
MOV EDX, DWORD PTR g_pDevice ;; Set EDX as ''g_pDevice''
PUSH EDX ;; Push out EDX
CALL DWORD PTR [ECX+200] ;; Set the z-buffer render state
}
When I run the executable file it gives me an error. It says that the ESP register was saved correctly. I have tried "ADD ESP, (4, 8, 16, 32, and 64)", and they still give me an error. Here is the code that I converted, using Listing Files in the Settings:
mov eax, DWORD PTR ?g_pDevice@@3PAUIDirect3DDevice8@@A ; g_pDevice
; Line 434
mov ecx, DWORD PTR [eax]
; Line 435
mov edx, DWORD PTR ?g_pDevice@@3PAUIDirect3DDevice8@@A ; g_pDevice
; Line 436
push edx
; Line 438
call DWORD PTR [ecx+200]
; Line 440
add esp, esi
and I have also tried the "ADD ESP, ESI", but sometimes my computer will freeze and I have to restart it. Can someone please give me the correct method for "saving" the ESP register? Thanks in advance! =)
If thispost = 0 Then
GoBack()
Else
Read()
End If
I'll have a link to the TriFaze website as soon as possible. It's still currently being designed, by myself of course! =) I'll update the URL and my signature as soon as possible.Feel free to send me a message on Yahoo! or AOL IM™. =)