home *** CD-ROM | disk | FTP | other *** search
- PAGE 80,132
- TITLE DESQview TP 5.0 interfaces, Ver 5.X
-
- ; DESQ5X.ASM - DESQview interface routines
- ; by James H. LeMay, CIS 76011,217
- ; for Eagle Performance Software
- ; P.O. Box 122237
- ; Ft. Worth, TX 76121
- ; These procedures are published in the DESQview users manual and
- ; have been modified for use for TP 5.0. Note that some of these
- ; routines are useful for direct screen writing utilities
- ; like QWIK5X.ARC
- ; Only uses 95 bytes of code.
-
- DATA SEGMENT WORD PUBLIC
- EXTRN In_DV: BYTE ; defaults as FALSE in DESQxx.PAS
- DATA ENDS
-
- CODE SEGMENT WORD PUBLIC
- ASSUME CS:CODE, DS:DATA
- PUBLIC DV_GET_VERSION
- PUBLIC DV_GET_VIDEO_BUFFER
- PUBLIC DV_PAUSE
- PUBLIC DV_BEGIN_CRITICAL
- PUBLIC DV_END_CRITICAL
-
-
- DV_GET_VERSION PROC FAR
- ; function DV_Get_Version: word;
- ; Returns in AH/AL the DESQview major/minor version numbers,
- ; and sets up the In_DV variable for later use.
- ; Returns 0 in AX if DESQview isn't there.
- mov cx,'DE' ; Set CX to 4445h; DX to 5351h
- mov dx,'SQ' ; (an invalid date)
- mov ax,2B01h ; DOS's set date function
- int 21h ; call DOS
- cmp al,0FFh ; did DOS see it as invalid?
- je NoDV ; if so, DESQview isn't there
- xchg ax,bx ; AH=major version; AL=minor version
- mov In_DV,1 ; Set In_DV = true
- jmp SHORT DVGV_X ;
- NoDV: xor ax,ax ; Set AX = false (No DESQview)
- mov In_DV,al ; Set In_DV = false (this was left out
- ; of the publication!)
- DVGV_X: ret
- DV_GET_VERSION ENDP
-
-
- VideoSeg EQU [bp+6]
-
- DV_GET_VIDEO_BUFFER PROC FAR
- ; function DV_Get_Video_Buffer (VideoSeg: word): word;
- ; Takes the hardware video segment and returns the same
- ; segment (if DESQview is not present) or DESQview's alternate
- ; video buffer (in AX). Sets up the In_DV variable for later use.
- ; Call this instead of DV_GET_VERSION_ if your program writes
- ; directly to video memory.
- ; Note: DV keeps the alternate buffer paragraph aligned so only
- ; the segment is needed.
- push bp ; Set turbo's stack frame
- mov bp,sp ;
- call DV_GET_VERSION ; Returns AX=0 if not in DESQview
- mov es,VideoSeg ; Put hardware segment in ES
- xor di,di ; Put hardware offset in DI (usually 0)
- test ax,ax ; In DV?
- jz DVGVB_X ; No, jump.
- ; Yes, get new buffer segment
- mov ah,0FEh ; DV's get buffer function
- int 10h ; Returns ES:DI as alternate buffer
- DVGVB_X:mov ax,es ; Return correct video buffer
- pop bp ; Restore Turbo's BP
- ret 2
- DV_GET_VIDEO_BUFFER ENDP
-
-
- API_CALL PROC NEAR
- ; This local routine takes a program interface function in BS,
- ; and makes that call to DESQview after swithching onto a stack
- ; that DESQview provides for your program.
- mov ax,101Ah ; The function to switch to DV's stack
- int 15h ; DV's software interrupt
- mov ax,bx ; Move the desired function to AX
- int 15h ; Make that call
- mov ax,1025h ; Function to switch off DV's stack
- int 15h ; Make that call
- ret
- API_CALL ENDP
-
-
- DV_PAUSE PROC FAR
- ; procedure DV_Pause;
- ; This procedure gives up the rest of your program's time slice.
- mov bx,1000h ; This is the function code
- jmp SHORT DV_API ; Finish routine
- DV_PAUSE ENDP
-
-
- DV_BEGIN_CRITICAL PROC FAR
- ; procedure DV_Begin_Critical;
- ; This routine tells DESQview not to slice away from your program
- ; until you make a DV_END_CRITICAL call.
- mov bx,101Bh ; This is the function code
- jmp SHORT DV_API ; Finish routine
- DV_BEGIN_CRITICAL ENDP
-
-
- DV_END_CRITICAL PROC FAR
- ; procedure DV_End_Critical;
- ; This routine tells DESQview that it is all right to slice away
- ; from your program again.
- mov bx,101Ch ; This is the function code
- DV_API: cmp In_DV,1 ; Are we in DESQview?
- jne DVEC_X ; If not, nothing to do
- call API_CALL ; Do it
- DVEC_X: ret
- DV_END_CRITICAL ENDP
-
-
- CODE ENDS
-
- END