Hi thx for the replies
After reading them i played around a bit and ended up with these 2 codes...
Both of them get an "address" (at least is seems so) and that confuses me
I would be happy if someone could explain me what esp exactly holds after the function is called and what im doing wrong/right
Here are my 2 codes:
Code1:
Code: Select all
Procedure TEST0(xyz,a,b,c,d,e,f)
x = 0
MOV eax, [esp+36]
MOV x, eax
Debug (x)
EndProcedure
Procedure TEST1()
TEST0(1,2,3,4,5,6,7)
EndProcedure
Procedure TEST2()
V = 1000
V = V - 200
TEST0(1,2,3,4,5,6,7)
EndProcedure
Procedure TEST3()
TEST1()
EndProcedure
TEST0(1,2,3,4,5,6,7)
TEST2()
TEST3()
TEST3()
TEST2()
TEST2()
TEST0(1,2,3,4,5,6,7)
TEST1()
TEST1()
Code2:
Code: Select all
Procedure TEST0(xyz,a,b,c,d,e,f)
x = 0
MOV eax, esp
MOV x, eax
Debug (x)
EndProcedure
Procedure TEST1()
TEST0(1,2,3,4,5,6,7)
EndProcedure
Procedure TEST2()
V = 1000
V = V - 200
TEST0(1,2,3,4,5,6,7)
EndProcedure
Procedure TEST3()
TEST1()
EndProcedure
TEST0(1,2,3,4,5,6,7)
TEST2()
TEST3()
TEST3()
TEST2()
TEST2()
TEST0(1,2,3,4,5,6,7)
TEST1()
TEST1()
What exactly stored in esp
So far i got this info by testing:
esp 0 -> return address ?
esp 4 -> ?
esp 8 -> xyz
esp 12 -> a
esp 16 -> b
esp 20 -> c
esp 24 -> d
esp 28 -> e
esp 32 -> f
esp 36 -> return address ?
When i use the second code the "calling" addresses are closer together which makes more sense to me...
What should i use/do ?
(sorry my english is not the best :S)