home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
desqview
/
tvgluetc.arc
/
INT15.C
next >
Wrap
C/C++ Source or Header
|
1988-03-02
|
5KB
|
124 lines
/*
** INT15.C - C interface functions.
** IBM Personal Computer - TopView C Interface Header File.
** Written for Borland Turbo C v1.5.
** (Microsoft MASM v5 is required to recompile the interface functions.)
*/
#pragma inline
#include <dos.h>
#include "int15def.h" /* definitions */
#include "int15c.h" /* types and function prototypes */
WORD pascal TopVer(void) /* GET TOPVIEW VERSION (0 = NOT TOPVIEW) */
{
_BX = 0; /* use to test for TopView not loaded */
_AX = 0x1000+GETVER; /* get version number */
geninterrupt(0x15); /* issue the interrupt */
return _BX; /* return value */
}
void pascal SetBit( /* SETBIT POST FROM A 1ST-LEVEL INT HANDLER */
WORD bit /* bit to set */
)
{
_BX = bit;
_AX = 0x1000+SETBIT;
geninterrupt(0x15); /* issue the interrupt */
}
void pascal SubCall( /* TOPVIEW SUBROUTINE CALL */
WORD func_code, /* function code */
REGLIST *call_args /* registers to/from */
)
{
asm mov di,func_code ; /* save the caller's AL function code */
#if defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)
asm mov si,call_args ; /* get address of call_args record parameter */
asm mov ax,ds ;
asm mov es,ax ;
#else
asm les si,call_args ; /* get address of call_args record parameter */
#endif
asm mov ax,1000h+OSTACK ; /* set system stack seg & stack ptr */
asm int 15h ; /* issue the interrupt */
asm push si ; /* save es:si */
asm push es ;
asm mov ax,di ; /* get the caller's AL function code */
asm mov ah,10h ; /* and add the subcall function code */
asm mov bx,es:[si].bxreg; /* get the value of bx from call_args for subcall */
asm mov cx,es:[si].cxreg; /* do the same for cx, */
asm mov dx,es:[si].dxreg; /* dx, */
asm les di,es:[si].direg; /* es, and di. */
asm int 15h ; /* issue the interrupt */
asm mov ax,es ; /* save es */
asm pop es ; /* restore es:si */
asm pop si ;
asm mov es:[si].bxreg,bx; /* move the values from the registers returned by */
asm mov es:[si].cxreg,cx; /* subcall back into call_args record parameter */
asm mov es:[si].dxreg,dx; /* . */
asm mov es:[si].direg,di; /* . */
asm mov es:[si].esreg,ax; /* . */
asm mov ax,1000h+USTACK ; /* restore user stack seg & stack ptr */
asm int 15h ; /* issue the interrupt */
}
void pascal SendMsg( /* SEND MESSAGE TO TOPVIEW OBJECT */
WORD msg_num, /* message number */
WORD mod_num, /* object modifier */
OBJECT object_hdl, /* object handle (0 = none) */
PARMLIST *msg_args /* parameter list & return value(s) */
)
{
asm mov bh,msg_num ; /* get the caller's message number */
asm mov bl,mod_num ; /* and the modifier */
asm les di,object_hdl ; /* get the caller's object handle */
asm mov dx,es ; /* . */
#if defined(__TINY__) || defined(__SMALL__) || defined(__COMPACT__)
asm mov si,msg_args ; /* get address of msg_args record parameter */
asm mov ax,ds ;
asm mov es,ax ;
#else
asm les si,msg_args ; /* get address of msg_args record parameter */
#endif
asm mov ax,1000h+OSTACK ; /* set system stack seg & stack ptr */
asm int 15h ; /* issue the interrupt */
asm mov ax,sp ; /* save stack pointer */
asm mov cx,es:[si] ; /* number of arguments */
asm jcxz send40 ; /* none */
send30:
asm push es:[si+4] ; /* push argument h on stack */
asm push es:[si+2] ; /* push argument l on stack */
asm add si,4 ; /* point to next */
asm loop send30 ; /* until done */
asm sub si,ax ; /* restore argument pointer */
asm add si,sp
send40:
asm mov cx,dx ; /* test object pointer */
asm or cx,di
asm jz send50 ; /* none */
asm push dx ; /* push the object pointer */
asm push di ;
send50:
asm mov cx,ax ; /* save stack pointer */
asm mov ah,12h ; /* get the send message function code */
asm int 15h ; /* issue the interrupt request */
asm sub cx,sp ; /* calculate the number of bytes returned */
asm mov ax,cx ; /* save the number of bytes */
asm shr cx,1 ; /* shift right twice to divide by 4 giving the */
asm shr cx,1 ; /* number of msg_args arguments returned */
asm mov es:[si],cx ; /* and put in # of args to be returned */
asm jcxz send70 ; /* if no arguments returned then continue */
asm add si,ax ; /* advance pointer to last slot in result area */
send60:
asm pop es:[si-2] ; /* pop "l" part of argument into result list */
asm pop es:[si] ; /* pop "h" part of argument into result list */
asm sub si,4 ; /* skip back 4 bytes to next argument */
asm loop send60 ; /* loop if there are more arguments to move */
send70:
asm mov ax,1000h+USTACK ; /* restore user stack seg & stack ptr */
asm int 15h ; /* issue the interrupt */
}