Accessing System Manager Services From ASM

Assembler programs access the services by pushing any required arguments onto the stack and then using the SMCALL macro to "call" the service. For example, usage of m_disp might appear as the following:

include     interfac.mac 

... 


push        dx   ; ostyle (not actually used)
push        dx   ; style 
push        cx   ; string length 
push        ds   ; string segment 
push        si   ; string offset
push        ax   ; column 
push        bx   ; row 

SMCALL F_M_DISP  ; display the string 

add      sp,14   ; remove arguments from the stack

There are three things to note in this example:

Note: it is very important that API2 be defined before #including interface.h or interface.mac, unless the program is a "95-style" program. Either use

#define API2
for a C program, or
API2 equ 0
for an assembly program.