#define max(A,B) ((A) > (B) ? (A) : (B))
max(i++,j++)
#define square(x) x * x
int MyFunction(int argWord, char argByte)
{
int localWord;
char localByte;
...
...
...
return localWord;
}
Suppose that MyFunction() is called in a program and a
debugger is used to display the contents of the stack while the body
of the function is executing. Shown below is the stack dump that a
debugger might give, and is very similar to the output given by the
"ds" or "dump stack" command in Emu86. In the left column
are the addresses of stack locations and in the right column are the
16-bit values stored at those locations. For example, we see from the
table below that the number 0x1243 (4,660 in decimal) is stored at
address 0000:FFF0. Since the 8086 is little endian, this means that
the byte value 0x43 is stored at address 0000:FFF0 and the byte value
0x12 is stored at 0000:FFF1.
Assume that SS is 0, SP is 0xFFE8 and BP is 0xFFEC. Also, assume that the C calling convention is followed and that a standard stack frame is used (refer to the document C Calling Convention and the 8086 if necessary).Address | Value ------------------ 0000:FFF2 | 0xF320 0000:FFF0 | 0x1243 0000:FFEE | 0x02EA 0000:FFEC | 0xFFF6 0000:FFEA | 0x0321 0000:FFE8 | 0x02B9