NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: cm on September 22, 2010, 03:21:34 PM

Title: %stacksize documentation?
Post by: cm on September 22, 2010, 03:21:34 PM
The %stacksize preprocessor directive (http://nasm.us/doc/nasmdoc4.html#section-4.8.2) is documented to accept the "large" parameter as well as the "small" one for 16-bit code. "large" is documented to accept a far call form, but actually uses a stack offset (between bp and the first argument) of 4 - which is suitable for near calls, as ip and bp take 2 bytes each. "small" is documented to accept a far call form, and "it also assumes that the old value of bp is pushed onto the stack (i.e. it expects an ENTER instruction)". This makes no sense because all the %stacksize parameters do expect (e/r)bp on stack (i.e. ENTER), though "small" is suitable for far call form functions. (It reserves 6 byte for bp, ip, cs as found for far calls.) It doesn't occur to me though why "%stacksize large" is for near 16-bit calls, while "%stacksize small" is for far 16-bit calls. Note that both the documentation and the source code comments state that near 16-bit calls aren't supported. But "%stacksize large" isn't useful for anything else.