home *** CD-ROM | disk | FTP | other *** search
- /*=======================================================*/
- /* TVINT15W.C */
- /* low-level functions to send streams to windows */
- /* requires MASM or A86 to recompile */
- /* */
- /* (c) Copyright 1988 Ralf Brown All Rights Reserved */
- /* May be freely copied for noncommercial use, so long */
- /* as this copyright notice remains intact, and any */
- /* changes are marked in the comment blocks preceding */
- /* functions. */
- /*=======================================================*/
-
- #pragma inline
-
- #include "tvapi.h"
- #include "tvstream.h"
-
- /*======================================================*/
- /* TVwin_stream--send a stream to specified window */
- /* do not use with opcode 0xE6 */
- /* Ralf Brown 4/3/88 */
- /*======================================================*/
-
- void pascal TVwin_stream(OBJECT window,BYTE *stream)
- {
- #if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
- asm push ds ; /* pass pointer to stream to TV */
- asm mov bx,stream
- asm push bx
- asm xor ax,ax ; /* get length of stream */
- asm push ax
- asm mov ax,[bx+2]
- #else
- asm les bx,stream ; /* get pointer to stream */
- asm push es ; /* and pass it to TV */
- asm push bx
- asm xor ax,ax ; /* get length of stream */
- asm push ax
- asm mov ax,es:[bx+2]
- #endif
- asm add ax,4 ; /* adjust for stream header */
- asm push ax ; /* and push total length */
- asm les bx,window ; /* get object handle */
- asm mov ax,es
- asm or ax,bx ; /* was handle NULL? */
- asm je null_handle
- asm push es ; /* and push it if non-NULL */
- asm push bx
- asm mov bl,0 ; /* object is TOS */
- asm jmp short nonull
- null_handle:
- asm mov bl,1 ; /* object is ME */
- nonull:
- asm mov ah,12h ; /* SEND message */
- asm mov bh,05h ; /* message is WRITE */
- asm int 15h ; /* do it */
- }
-
- /*======================================================*/
- /* TVwin_new--create a new window from specified window */
- /* Ralf Brown 4/3/88 */
- /*======================================================*/
-
- OBJECT pascal TVwin_new(OBJECT window,int rows,int cols)
- {
- static BYTE stream[] = { S_WINDOW(3), 0xE6, 0, 0 } ;
- unsigned seg, ofs ;
-
- stream[5] = rows ;
- stream[6] = cols ;
-
- asm lea bx,stream ; /* get pointer to stream */
- asm push ds ; /* and pass it to TV */
- asm push bx
- asm xor ax,ax ; /* get length of stream */
- asm push ax
- asm mov ax,7
- asm push ax ; /* and push it, too */
- asm les bx,window ; /* get object handle */
- asm mov ax,es
- asm or ax,bx ; /* was handle NULL? */
- asm je null_handle
- asm push es ; /* and push it if non-NULL */
- asm push bx
- asm mov bl,0 ; /* object is TOS */
- asm jmp short nonull
- null_handle:
- asm mov bl,1 ; /* object is ME */
- nonull:
- asm mov ah,12h ; /* SEND message */
- asm mov bh,05h ; /* message is WRITE */
- asm int 15h ; /* do it */
- asm pop ofs ; /* get returned object handle */
- asm pop seg
-
- return MK_FP(seg,ofs) ;
- }
-
- /* End of TVINT15W.C */
-