home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / DESQ10 / DESQ10.ASM next >
Assembly Source File  |  1988-06-05  |  4KB  |  119 lines

  1. PAGE 80,132
  2. TITLE DESQview TP 4.0 interfaces, Ver 1.0
  3.  
  4. ; DESQ10.ASM - DESQview interface routines
  5. ;  by James H. LeMay, CIS 76011,217
  6. ; These procedures are published in the DESQview users manual and
  7. ; have been modified for use for TP 4.0.  Note that some of these
  8. ; routines are useful for direct screen writing utilities
  9. ; like QWIK41A.ARC.
  10. ; Only uses 95 bytes of code.
  11.  
  12. DATA    SEGMENT WORD PUBLIC
  13.         EXTRN  In_DV:  BYTE    ; defaults as FALSE in DESQxx.PAS
  14. DATA    ENDS
  15.  
  16. CODE    SEGMENT WORD PUBLIC
  17.         ASSUME  CS:CODE
  18.         PUBLIC  DV_GET_VERSION
  19.         PUBLIC  DV_GET_VIDEO_BUFFER
  20.         PUBLIC  DV_PAUSE
  21.         PUBLIC  DV_BEGIN_CRITICAL
  22.         PUBLIC  DV_END_CRITICAL
  23.  
  24.  
  25. DV_GET_VERSION  PROC  FAR
  26. ; function DV_Get_Version: word;
  27. ; Returns in AH/AL the DESQview major/minor version numbers,
  28. ;   and sets up the In_DV variable for later use.
  29. ; Returns 0 in AX if DESQview isn't there.
  30.         mov   cx,'DE'        ; Set CX to 4445h; DX to 5351h
  31.         mov   dx,'SQ'        ; (an invalid date)
  32.         mov   ax,2B01h       ; DOS's set date function
  33.         int   21h            ; call DOS
  34.         cmp   al,0FFh        ; did DOS see it as invalid?
  35.         je    NoDV           ; if so, DESQview isn't there
  36.         xchg  ax,bx          ; AH=major version; AL=minor version
  37.         mov   In_DV,1        ; Set In_DV = true
  38.         jmp   SHORT DVGV_X   ;
  39. NoDV:   xor   ax,ax          ; Set AX    = false (No DESQview)
  40.         mov   In_DV,al       ; Set In_DV = false (this was left out
  41.                              ;   of the publication!)
  42. DVGV_X: ret
  43. DV_GET_VERSION  ENDP
  44.  
  45.  
  46. VideoSeg   EQU   [bp+6]
  47.  
  48. DV_GET_VIDEO_BUFFER  PROC  FAR
  49. ; function DV_Get_Video_Buffer (VideoSeg: word): word;
  50. ; Takes the hardware video segment and returns the same
  51. ; segment (if DESQview is not present) or DESQview's alternate
  52. ; video buffer (in AX).  Sets up the In_DV variable for later use.
  53. ; Call this instead of DV_GET_VERSION_ if your program writes
  54. ; directly to video memory.
  55. ; Note: DV keeps the alternate buffer paragraph aligned so only
  56. ; the segment is needed.
  57.         push  bp             ; Set turbo's stack frame
  58.         mov   bp,sp          ;
  59.         call  DV_GET_VERSION ; Returns AX=0 if not in DESQview
  60.         mov   es,VideoSeg    ; Put hardware segment in ES
  61.         xor   di,di          ; Put hardware offset in DI (usually 0)
  62.         test  ax,ax          ; In DV?
  63.         jz    DVGVB_X        ;   No, jump.
  64.                              ;   Yes, get new buffer segment
  65.         mov   ah,0FEh        ; DV's get buffer function
  66.         int   10h            ; Returns ES:DI as alternate buffer
  67. DVGVB_X:mov   ax,es          ; Return correct video buffer
  68.         pop   bp             ; Restore Turbo's BP
  69.         ret   2
  70. DV_GET_VIDEO_BUFFER  ENDP
  71.  
  72.  
  73. API_CALL  PROC  NEAR
  74. ; This local routine takes a program interface function in BS,
  75. ; and makes that call to DESQview after swithching onto a stack
  76. ; that DESQview provides for your program.
  77.         mov   ax,101Ah       ; The function to switch to DV's stack
  78.         int   15h            ; DV's software interrupt
  79.     mov   ax,bx          ; Move the desired function to AX
  80.     int   15h            ; Make that call
  81.         mov   ax,1025h       ; Function to switch off DV's stack
  82.     int   15h            ; Make that call
  83.         ret
  84. API_CALL  ENDP
  85.  
  86.  
  87. DV_PAUSE  PROC  FAR
  88. ; procedure DV_Pause;
  89. ; This procedure gives up the rest of your program's time slice.
  90.         mov   bx,1000h       ; This is the function code
  91.         jmp   SHORT DV_API   ; Finish routine
  92. DV_PAUSE  ENDP
  93.  
  94.  
  95. DV_BEGIN_CRITICAL  PROC  FAR
  96. ; procedure DV_Begin_Critical;
  97. ; This routine tells DESQview not to slice away from your program
  98. ; until you make a DV_END_CRITICAL call.
  99.         mov   bx,101Bh       ; This is the function code
  100.         jmp   SHORT DV_API   ; Finish routine
  101. DV_BEGIN_CRITICAL  ENDP
  102.  
  103.  
  104. DV_END_CRITICAL  PROC  FAR
  105. ; procedure DV_End_Critical;
  106. ; This routine tells DESQview not to slice away from your program
  107. ; until you make a DV_END_CRITICAL call.
  108.         mov   bx,101Ch       ; This is the function code
  109. DV_API: cmp   In_DV,1        ; Are we in DESQview?
  110.         jne   DVEC_X         ; If not, nothing to do
  111.         call  API_CALL       ; Do it
  112. DVEC_X: ret
  113. DV_END_CRITICAL  ENDP
  114.  
  115.  
  116. CODE    ENDS
  117.  
  118.         END
  119.