Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!ptsfa!ihnp4!homxb!whuts!picuxa!gp From: gp@picuxa.UUCP (Greg Pasquariello X1190) Newsgroups: comp.lang.c Subject: MSC and stack manipulation Message-ID: <325@picuxa.UUCP> Date: Mon, 5-Oct-87 15:00:38 EDT Article-I.D.: picuxa.325 Posted: Mon Oct 5 15:00:38 1987 Date-Received: Fri, 9-Oct-87 01:22:20 EDT Organization: AT&T Information Systems, Parsippany NJ Lines: 33 Keywords: MSC Here is a question for anyone who cares to throw his stack in the ring. When MSC 4.0 calls a function, it subtracts the amount of space needed by local variables from the stack. Why? The 80x86 instructions subtract two bytes from SP when a push is done anyway. Therefore the MSC function calls leave an unused gap in the stack equal to the count of bytes required by local variables. For example: func FOO1: SP = 128 CALL FOO2 func FOO2(char, char): SP = 126 BP = SP SP = SP - 2 /* WHY??? */ . . . SP = BP RETURN Unless I'm missing something, the SP = SP - 2 statement points the stack two bytes below the last push. Therefor the next push will put the value of the register (whatever it may be) two bytes below the previous push thus leaving a gap in the stack of two bytes. Any answers will be appreciated. Oh yeah, no flames please, if this sounds like a pathetically stupid question :-)