News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

push/pop

Started by ragdog, November 29, 2007, 09:22:17 AM

Previous topic - Next topic

ragdog

hi guys

i have a questions to push/pop
use a subroutine with registers must I  set the registers with push and pop?

example:

subroutine proc
push esi
inc esi
...
...
..

pop esi
ret
subroutine endp


greets
ragdog

Shantanu Gadgil

Quoteuse a subroutine with registers must I  set the registers with push and pop?
"set" ???
Do you mean save ?

Form the sample code ... if you are setting 'esi' before the function is called, at the end of the function it has been reset to the same.

-
Shantanu
To ret is human, to jmp divine!

ragdog

hi

yes i mean save ::)

i uses esi ebx register in my wndproc and call then the subroutine
if I in the subroutine registers not  save with push then does not work  the routine my ask was if I with register work must I always the registers save with push


sry for my english

greets
ragdog

sonic

esi edi ebx must be preserved otherwise you may encounter errors. Masm offers "uses" keyword which simplifies the preservation. You won't have to worry about the order with which registers needs to be popped.
Just use it like this

YourProc uses esi ebx proc
.
.
.
YourProc endp

ragdog

thanks for your reply and info

greets
ragdog