How to get variables in a procedure with assembler
Posted: Tue Aug 31, 2004 5:44 pm
Code updated For 5.20+
not a real tip, but good to know that purbasic puts all variables on the stack:
not a real tip, but good to know that purbasic puts all variables on the stack:
Code: Select all
EnableASM
Global L
Procedure testme(a,b,c,d)
Debug a
Debug b
Debug c
Debug d
Debug "------------"
MOV eax,dword[esp] ; this is variable a
MOV L,eax
Debug L
MOV eax,dword[esp+4] ; this is variable b
MOV L,eax
Debug L
MOV eax,dword[esp+8] ; this is variable c
MOV L,eax
Debug L
MOV eax,dword[esp+12] ; this is variable d
MOV L,eax
Debug L
Debug "------------"
!MOV eax,dword[esp] ; this is variable a
!MOV dword[v_L],eax
Debug L
!MOV eax,dword[esp+4]
!MOV dword[v_L],eax
Debug L
!MOV eax,dword[esp+8] ; this is variable c
!MOV dword[v_L],eax
Debug L
!MOV eax,dword[esp+12] ; this is variable d
!MOV dword[v_L],eax
Debug L
EndProcedure
result=testme(1,2,3,4)