I was wondering why in some instances you must "push offset something" when other times you only have to "push something"? Is there a certain context where one is always true over the other? Thanks
Posted on 2005-03-12 11:40:46 by z_boy
"push offset something" means you are transmiting the address of the data you want to use in a procedure. You would use that for example when the procedure would need to know where a string, structure, or other large amount of data is located in your data section and it would not be practical to send all that data directly to the procdedure.

You use "push something" whenever you can transmit the data directly to the procedure. You would use that for example when the procedure need the latest value of a variable in your data section, the current value in a register, the value of a handle, or the address of a memory chunk which you may have allocated from general memory.

In some cases, you may have the option of using either method.

Note that you may also see "push addr something with some assemblers. That would be used for the address of LOCAL variables within a current procedure since the address would not be known at compile time. Such an instruction would be replaced by "lea eax,something" followed by "push eax".

Posted on 2005-03-12 12:09:09 by Raymond