delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/01/13:10:43

From: "stefan fröberg" <traveler AT netti DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: STACK (Enter, Leave, etc...)
Date: Fri, 1 Oct 1999 17:15:24 +0300
Organization: SAUNALAHDEN SERVERIN asiakas
Lines: 34
Message-ID: <7t2fgv$1hu$1@tron.sci.fi>
NNTP-Posting-Host: mkccxcviii.hdyn.saunalahti.fi
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello fellow coders !

In my long (well, not so long) travels with NASM & DJGPP I have encountered
following unanswered mysteries:

-    Is the instruction "enter n,0" the same thing as doing:
    push    ebp
    mov    ebp,esp
    sub    esp, n bytes

Also, the last part of the "enter" instruction has something to do with the
(function nesting ?) in Pascal and I should not worry about it, right ?

-   The instruction "leave" performs the same as:

    mov     esp,ebp
    pop    ebp

    right ?

-    If I use the "enter n,0" instruction to set the stack frame pointer and
allocate space for local variables do I have to set instruction "add esp,n
bytes" before the "leave" or will the "leave" take care of unallocating
space of the local variables ?

-    Is there use for the "ret n bytes" instruction in C ?
    (That should unallocate passed parameters and local variables but the
above thing
    should also do that, right ?)

Thanks for your time !
traveler AT netti DOT fi


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019