home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
msdos
/
desqview
/
dvglue10.arc
/
TVINT15.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-07-10
|
6KB
|
121 lines
/******************************************************************************/
/* TVINT15.C - C interface functions */
/* IBM Personal Computer - TopView/DESQview C Interface Header File. */
/* Written for Borland Turbo C v1.5. */
/* (Microsoft MASM or A86 is required to recompile these functions.) */
/******************************************************************************/
#pragma inline
#include "tvapi.h" /* types and function prototypes */
/*======================================================*/
/* TVsendmsg send a message to a TopView object */
/* John Navas */
/* Ralf Brown 4/22/88 made work if already on private */
/* stack--don't switch */
/* Ralf Brown 6/20/88 fix again by not using private */
/* stack at all */
/*======================================================*/
void pascal TVsendmsg(WORD msg_num,WORD modifier,OBJECT object_hdl,PARMLIST far *msg_args)
/* object handle 0 = none */
{
asm mov ax,sp ; /* save stack pointer */
asm mov bh,msg_num ; /* get the message number */
asm mov bl,modifier ; /* and the modifier */
asm les di,object_hdl ; /* get the object handle */
asm mov dx,es ; /* . */
asm les si,msg_args ; /* get address of msg_args record parameter */
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 original 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:
}
/*======================================================*/
/* TVsendmsg0 send a message without parameters to a */
/* TopView object */
/* John Navas */
/* Ralf Brown 4/22/88 made work if already on private */
/* stack--don't switch */
/* Ralf Brown 4/23/88 modified TVsendmsg for no parms */
/*======================================================*/
void pascal TVsendmsg0(WORD msg_num,WORD modifier,OBJECT object_hdl)
/* object handle 0 = none */
{
asm mov cx,sp ; /* save stack pointer */
asm mov bh,msg_num ; /* get the message number */
asm mov bl,modifier ; /* and the modifier */
asm les di,object_hdl ; /* get the object handle */
asm mov ax,es ; /* test object pointer */
asm or ax,di
asm jz send1 ; /* none */
asm push es ; /* push the object pointer */
asm push di ;
send1:
asm mov ah,12h ; /* get the send message function code */
asm int 15h ; /* issue the interrupt request */
asm mov sp,cx ; /* restore stack pointer, removing ret values */
}
/*======================================================*/
/* TVsendmsg1 send a message without parameters to a */
/* TopView object, return single result */
/* John Navas */
/* Ralf Brown 4/22/88 made work if already on private */
/* stack--don't switch */
/* Ralf Brown 4/23/88 modified TVsendmsg for no parms */
/* Ralf Brown 6/21/88 modified from TVsendmsg0 */
/*======================================================*/
DWORD pascal TVsendmsg1(WORD msg_num,WORD modifier,OBJECT object_hdl)
/* object handle 0 = none */
{
asm mov bh,msg_num ; /* get the message number */
asm mov bl,modifier ; /* and the modifier */
asm les di,object_hdl ; /* get the object handle */
asm mov ax,es ; /* test object pointer */
asm or ax,di
asm jz send1 ; /* none */
asm push es ; /* push the object pointer */
asm push di ;
send1:
asm mov ah,12h ; /* get the send message function code */
asm int 15h ; /* issue the interrupt request */
asm pop ax ; /* get result value */
asm pop dx
/* TurboC will warn about not returning a value, but we really are in DX:AX */
}
/* end TVINT15.C */