News:

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

Pushing a zero after pushing DS

Started by BigDaddy, December 22, 2004, 11:29:28 PM

Previous topic - Next topic

BigDaddy

I personally have only coded for small models, but I have some old example code that HLL's link to for bigger models.  These FAR procs tend to push DS (which seems reasonable) but then push a zero on top of DS.  What is the purpose of this, and will 32 bit code need the same treatment?

MichaelW

I would need more information to even understand your question, much less answer it. What HLL will be linking to this code? Can you post a complete example procedure?
eschew obfuscation

BigDaddy

I'm referring to the entry point of the MASM routine, The part of the overhead code that preserves the stack frame, like:

push bp
mov bp,sp

push ds
xor ax,ax
push ax

;start yanking the arguments
etc....

I don't have a piece of code in front of me, but I seem to recall a RET 6, so it's more like the Pascal calling convention than C. 

I was thinking that the purpose of the zero was to serve as the offset on the FAR return, but that confuses me, somewhat, given that the real offset should have been pushed onto the stack by the calling program. 

I'll look around for the mystery code when I get home. 

Thanks,
Dan

BigDaddy

Sorry I haven't been able to get on the web to update this question.  When I looked at the source in question, again, I saw that I had made a couple of wrong assumptions about the program's purpose.  So, when I get the time, I'll start a new thread that gets the questions right, and includes the full source.