home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / DVTECH.ZIP / DVTECH.NOT
Encoding:
Text File  |  1986-12-06  |  14.4 KB  |  365 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. DESQview Technical Notes
  8. Revised: April 18, 1986                                Page  1
  9. ---------------------------------------------------------------------
  10.  
  11.                 RUNNING YOUR PROGRAM IN A SMALL WINDOW
  12.  
  13. Programs that call DOS or the ROM BIOS to display information  on  the
  14. screen  run  in a small window with no modifications.   These programs
  15. are referred to as "well-behaved".  "Misbehaved" programs are programs
  16. that write directly into the hardware video  buffer  and/or  move  the
  17. cursor by directly manipulating the hardware.  These programs can only
  18. be  run  in  a  full-screen  window  and  cannot be run in background.
  19. "Misbehaved" programs can  be  made  to  behave  using  the  following
  20. techniques:
  21.  
  22. Programs  the  write  directly to the video buffer typically determine
  23. during initialization whether they should run on a monochrome or color
  24. monitor.   They select  a  video  buffer  address  of  B000:0000H  for
  25. monochrome or B800:0000H for color displays.   DESQview provides a new
  26. BIOS call that supplies the caller  with  an  alternate  video  buffer
  27. address.  The program can write into this buffer exactly as if it were
  28. the  hardware video buffer.   DESQview will automatically take care of
  29. displaying only the information that falls within the  current  window
  30. area.
  31. The  following  code  sequence checks for DESQview's presence and then
  32. requests the alternate buffer address:
  33.  
  34.     MOV  AX,2B01H       ; set date & check DV version
  35.     MOV  CX,'DE'        ; set CX DX to DESQ
  36.     MOV  DX,'SQ'        ; for the date (invalid)
  37.     INT  21H            ; call DOS
  38.     CMP  AL,FFH         ; check for invalid
  39.     JZ   NO_DESQVIEW    ; DESQview is not running
  40.     MOV  MAJOR_VERSION,BH ; DV Version number
  41.     MOV  MINOR_VERSION,BL ; (no real need to store these)
  42. ; Since DESQview is running, get the alternate buffer
  43.     MOV  AX,0B800H      ; load hardware buffer address
  44.     MOV  ES,AX          ;  into ES:DI (0B000H for monochrome)
  45.     MOV  DI,0
  46.     MOV  AH,0FEH        ; load function code into AH
  47.     INT  10H            ; ask for alternate buffer address
  48.                         ; ES:DI now has alternate buffer address
  49.  
  50. The first section of this code checks to be sure that DESQview is run-
  51. ning.   If it is not,  then there is no need to check for an alternate
  52. buffer address.   If DESQview is running,  then ES:DI contains the al-
  53. ternate buffer address after the INT 10 call.   There is  no  need  to
  54. synchronize   with  video  retrace  when  writing  into  this  buffer;
  55. DESQview will automatically synchronize when the information is  writ-
  56. ten  to the "real" screen.   Users familiar with IBM's TopView program
  57. will note that TopView supports an equivalent call to find  an  alter-
  58. nate screen buffer.   TopView requires,  however, that another call be
  59. made every time you write into the buffer to tell TopView  that  some-
  60. thing changed (the 0FFH function code).  DESQview supports these calls
  61.  
  62. but  DOES  NOT require them.   Note that if TopView or DESQview is not
  63. running, ES:DI are returned unchanged.
  64.  
  65.  
  66.  
  67.  
  68.  
  69. DESQview Technical Notes
  70. Revised: April 18, 1986                                Page  2
  71. ---------------------------------------------------------------------
  72.  
  73.                          MANAGING THE CURSOR
  74. Programs that manipulate the hardware  to  move  the  cursor  must  be
  75. modified  so  that  all  cursor movement is done through the ROM BIOS.
  76. The following code sequence moves the cursor to row 5, column 30:
  77.  
  78.     MOV  DH,5           ; specify row 5
  79.     MOV  DL,30          ; specify column 30
  80.     MOV  BH,0           ; specify display page 0
  81.     MOV  AH,2           ; load function code
  82.     INT  10H            ; move the cursor
  83.  
  84. Coordinates are zero based starting in the upper left  corner  of  the
  85. screen.  The display page is almost always 0 unless your program makes
  86. special  use  of  the  extra  text  pages on a color graphics adapter.
  87. DESQview will insure that the current cursor position will  always  be
  88. visible in the window.  Please note that this function is very easy to
  89. use and is actually quite fast.
  90.  
  91. That's  all  it  takes  to make a program run in a small window.   The
  92. various loader programs that Quarterdeck supplies with  DESQview  per-
  93. form  these  modifications  automatically for several popular software
  94. packages.   Let us know if  you  have  any  problems  converting  your
  95. program.
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102. DESQview Technical Notes
  103. Revised: April 18, 1986                                Page  3
  104. ---------------------------------------------------------------------
  105.  
  106.                           LINKABLE INTERFACE
  107.  
  108. The  following  routines  can  be  assembled with the IBM or Microsoft
  109. Assembler and then linked into your program.   We  believe  they  will
  110. work as-is when linked to Assembler and MS Pascal programs.   They may
  111. also work with "C".  We know that they are not linkable as-is to Turbo
  112. Pascal or Compiled BASIC although you may be able  to  adapt  them  by
  113. studying  the  code.    Perhaps we can provide examples for other lan-
  114. guages in the future.  This source is also available as an ASM and OBJ
  115. file on the Quarterdeck Bulletin Board System.    Contact  Quarterdeck
  116. for information on the Bulletin Board.
  117.  
  118. Functions provided:
  119.  
  120. DV_GET_VERSION      - Allows a program to determine if it is run-
  121.                       ning  in  DESQview and returns the DESQview
  122.                       version number.
  123.  
  124. DV_PAUSE            - Allows application to give up the  rest  of
  125.                       its  time  slice  when engaged in processor
  126.                       intensive,    but   non-critical   activity
  127.                       (Example:  testing  for  keyboard  input on
  128.                       menus).   Users of this call  are  eligible
  129.                       for the Multi-tasker's Good Citizen Award.
  130.  
  131. DV_BEGIN_CRITICAL   - When  used  with  the DV_END_CRITICAL call,
  132.                       defines a section  of  code  that  DESQview
  133.                       will  not  slice  out  of.   Use for timing
  134.                       critical operations.
  135.  
  136. DV_END_CRITICAL     - See DV_BEGIN_CRITICAL.
  137.  
  138. DV_GET_VIDEO_BUFFER - If your program writes directly  to  screen
  139.                       buffer,  use  this  routine  in  the module
  140.                       where you determine screen  address.    Put
  141.                       the  address  on  the  stack  and  call the
  142.                       routine.  Routine determines if DESQview is
  143.                       running  and  if  so,  returns  in  AX  the
  144.                       address to use in DESQview.
  145.  
  146. (code begins next page)
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153. DESQview Technical Notes
  154. Revised: April 18, 1986                                Page  4
  155. ---------------------------------------------------------------------
  156.  
  157.                       NAME    DVINT
  158.                       TITLE   DESQview Interfaces
  159.                       PAGE    66,132
  160.  
  161. DVINT_SEG SEGMENT 'CODE'
  162.                       ASSUME  CS:DVINT_SEG
  163.  
  164.                       PUBLIC  DV_GET_VERSION
  165.                       PUBLIC  DV_PAUSE
  166.                       PUBLIC  DV_BEGIN_CRITICAL
  167.                       PUBLIC  DV_END_CRITICAL
  168.                       PUBLIC  DV_GET_VIDEO_BUFFER
  169.  
  170. IN_DV                 DB 1
  171.  
  172. GET_VERSION PROC
  173.                       PUSH    BX
  174.                       PUSH    CX
  175.                       PUSH    DX
  176.                       MOV     AX,2B01H       ; DV get version
  177.                                              ; request
  178.                       MOV     CX,'DE'
  179.                       MOV     DX,'SQ'
  180.                       INT     21H
  181.                       CMP     AL,0FFH             ; Are we in DV?
  182.                       JE NO_DV                    ; Jump if not
  183.                       MOV     AX,BX               ; We are; put
  184.                                                   ; the version
  185.                                                   ; number in AX
  186.                       MOV     CS:IN_DV,1          ; Set the local
  187. IN_DV flag
  188.                       JMP     SHORT DVGV_EXIT
  189. NO_DV:                SUB     AX,AX               ; Clear AX
  190.                       MOV     CS:IN_DV,AL         ; And the local
  191.                                                   ; flag
  192. DVGV_EXIT:
  193.                       POP     DX
  194.                       POP     CX
  195.                       POP     BX
  196.                       RET
  197. GET_VERSION ENDP
  198.  
  199. ; DV_GET_VERSION returns the DV version number in AX, or 0 if not
  200. ;in DV.  This should be called before any other DV functions.
  201.  
  202. DV_GET_VERSION PROC FAR
  203.                       CALL    GET_VERSION
  204.                       RET
  205. DV_GET_VERSION ENDP
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212. DESQview Technical Notes
  213. Revised: April 18, 1986                                Page  5
  214. ---------------------------------------------------------------------
  215.  
  216. ; API_CALL is a local routine that goes on stack, does whatever
  217. ;call is passed it in BX, and then goes off stack
  218. API_CALL PROC
  219.                       PUSH    AX
  220.                       MOV     AX,101AH
  221.                       INT     15H            ; OSTACK
  222.                       MOV     AX,BX
  223.                       INT     15H            ; Parameter
  224.                       MOV     AX,1025H
  225.                       INT     15H            ; USTACK
  226.                       POP     AX
  227.                       RET
  228. API_CALL ENDP
  229.  
  230. ; DV_PAUSE gives up the rest of its time slice when called.
  231. DV_PAUSE PROC FAR
  232.                       CMP     CS:IN_DV,1          ; Are we in DV?
  233.                       JNE     DVP_END             ; Jump if not
  234.                       PUSH    BX
  235.                       MOV     BX,1000H       ; PAUSE function
  236.                                              ; call
  237.                       CALL    API_CALL
  238.                       POP     BX
  239. DVP_END:
  240.                       RET
  241. DV_PAUSE ENDP
  242.  
  243. ; Begins a critical region.  This is a section of code which DV
  244. ;will not slice out of.  It MUST be ended with a DV_END_CRITICAL
  245. ;call.
  246. DV_BEGIN_CRITICAL PROC FAR
  247.                       CMP     CS:IN_DV,1     ; Are we in DV?
  248.                       JNE     DVBC_END       ; Jump if not
  249.                       PUSH    BX
  250.                       MOV     BX,101BH       ; BEGINC
  251.                       CALL    API_CALL
  252.                       POP     BX
  253. DVBC_END:
  254.                       RET
  255. DV_BEGIN_CRITICAL ENDP
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262. DESQview Technical Notes
  263. Revised: April 18, 1986                                Page  6
  264. ---------------------------------------------------------------------
  265.  
  266. ; Ends a critical region.
  267. DV_END_CRITICAL PROC FAR
  268.                       CMP     CS:IN_DV,1     ; Are we in DV?
  269.                       JNE     DVEC_END       ; Jump if not
  270.                       PUSH    BX
  271.                       MOV     BX,101CH       ; ENDC
  272.                       CALL    API_CALL
  273.                       POP     BX
  274. DVEC_END:
  275.                       RET
  276. DV_END_CRITICAL ENDP
  277.  
  278. ; Passed on the stack the video buffer address to use outside of
  279. ; DV. Returns the video buffer address to use instead.
  280. ; If what it returns is different, then video synching is not
  281. ; necessary. Also, this call does a DV_GET_VERSION call itself,
  282. ; so if you get the video buffer, it is not required that you get
  283. ; the version.
  284. DV_GET_VIDEO_BUFFER PROC FAR
  285.                       PUSH    BP
  286.                       MOV     BP,SP
  287.                       PUSH    BX
  288.                       PUSH    DI
  289.                       PUSH    ES
  290.                       MOV     ES,[BP+6]      ; Put the starting
  291.                                              ; segment in ES
  292.                       CALL    GET_VERSION
  293.                       TEST    AX,AX          ; Are we in
  294.                                              ; DESQview?
  295.                       JZ DVGVB_END           ; Jump if not
  296.                       SUB     DI,DI          ; Clear DI
  297.                       MOV     AH,0FEH        ; Get video buffer
  298.                                              ; function call
  299.                       INT     10H
  300. DVGVB_END:
  301.                       MOV     AX,ES
  302.                       POP     ES
  303.                       POP     DI
  304.                       POP     BX
  305.                       POP     BP
  306.                       RET     2
  307. DV_GET_VIDEO_BUFFER ENDP
  308.  
  309. DVINT_SEG ENDS
  310.  
  311.                       END
  312. ;(end of file)
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319. DESQview Technical Notes
  320. Revised: April 18, 1986                                Page  7
  321. ---------------------------------------------------------------------
  322.  
  323.                    Use of DESQview .DVP files
  324.  
  325. Once a program has been installed in DESQview.   DESQview creates
  326. a file which is loaded in the \DV directory that has the filename
  327.  
  328.           ??-PIF.DVP
  329.  
  330. where "??" represents the two  keys  used  to  open  the  window.
  331. After  installing  your program,  you will find a file in the \DV
  332. directory that corresponds to the keys you  chose  to  open  your
  333. program  window.    This  file  contains all of the configuration
  334. parameters necessary to run your program properly in DESQview.
  335.  
  336. It is important  for  you  to  know  that  Quarterdeck  holds  no
  337. copyright to these .DVP files and that you are free to distribute
  338. them with your software.  In fact, we encourage you to do so.
  339.  
  340. If one of these files is present in the drive and subdirectory in
  341. which  your program is installed and a user is adding the program
  342. to DESQview,  DESQview will automatically find the .DVP file  and
  343. allow  the  user  to install the program by selecting it from the
  344. Add Program menu.
  345.  
  346. If you are planning to include both a DESQview .DVP  file  and  a
  347. TopView PIF, you may want to add a (DV) to the program name field
  348. in  the  DVP  so  that  the DESQview user will know which file to
  349. select.   The DESQview "Add a Program" utility will find both the
  350. DVP and the PIF and display the program name from each,  so it is
  351. important that the program name distinguish which is which.
  352.  
  353. When programs are added in this fashion, it ensures that the user
  354. will get them installed right the first time.   This makes  users
  355. happy and eliminates a lot of support calls,  which I'm sure will
  356. make both of our companies happy.
  357.  
  358. The file is only 416 bytes in size.   All that  is  necessary  on
  359. your part is to include it on your distribution disk.   Then when
  360. your install program transfers your program to the user's  floppy
  361. or hard drive be sure that the .DVP file is also transferred.
  362.  
  363. If you have any questions or need help in setting up your program
  364. in DESQview, don't hesitate to call us at Quarterdeck.
  365.