All functions declared in C-style use the C calling convention (parameters on stack; return value in EAX/AX/AL; EAX, EBX, ECX, and EDX may be clobbered) and also have the function name prepended with a underscore ( _ ). Parameters and return values specified in C format obey the following size conventions:
short, 16 bit integer (default signed)
int, 32-bit integer (default signed)
pointer (of any type), 32-bit
bool, 32-bit value: 1=true, 0=false
Important: Pointer parameters take the address of the variable, not the contents.
The 32-bit C calling convention is described in much more detail in Chapter 8. See Section 18.2 to learn about the proc and invoke macros, which simplify both writing functions that use the C calling convention and calling PModeLib functions.
There are a number of global variables defined by the library. Some of these act as implicit inputs into functions such as DPMI_Int.
Not really a variable in and of itself, it's the offset of the start of the entire DPMI Registers structure used by DPMI_Int. The layout of DPMI_Regs is identical to the layout described in the reference page for DPMI function 0300h.
The EAX/AX/AL (depending on access size) member of DPMI_Regs.
The EBX/BX/BL (depending on access size) member of DPMI_Regs.
The ECX/CX/CL (depending on access size) member of DPMI_Regs.
The EDX/DX/DL (depending on access size) member of DPMI_Regs.
The ESI/SI (depending on access size) member of DPMI_Regs.
The EDI/DI (depending on access size) member of DPMI_Regs.
The EBP/BP (depending on access size) member of DPMI_Regs.
The SP member of DPMI_Regs. It's usually not necessary to set this.
The processor flags member of DPMI_Regs.
The DS segment member of DPMI_Regs. Set to _Transfer_Buf_Seg value in LibInit().
The ES segment member of DPMI_Regs. Set to _Transfer_Buf_Seg value in LibInit().
The FS segment member of DPMI_Regs. Set to _Transfer_Buf_Seg value in LibInit().
The GS segment member of DPMI_Regs. Set to _Transfer_Buf_Seg value in LibInit().
The SS segment member of DPMI_Regs. It's usually not necessary to set this.
Protected mode selector of real mode transfer buffer. See Section 17.3.3 for details on why a transfer buffer is necessary.
Real mode segment of real mode transfer buffer. See Section 17.3.3 for details on why a transfer buffer is necessary.
Protected mode selector of 1 MB scratch buffer. This buffer is used by several library routines but is free for temporary program use between library calls. Don't expect the contents of this block to be preserved over a library call.
Protected mode selector of NetBIOS transfer area. The transfer area contains the RXBuffer and TXBuffer receive and transmit buffers. Used by the NetBIOS functions described in Section A.11.
Protected mode selector of text mode video memory.