home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / util / misc / 018 / mufmtask.pas < prev    next >
Pascal/Delphi Source File  |  1991-08-17  |  24KB  |  500 lines

  1. UNIT MufMTask;
  2.  
  3. INTERFACE
  4.  
  5. USES
  6.    Dos,   Crt, MufGlobs;
  7.  
  8. (* EXPORTS *)
  9.  
  10.    FUNCTION IsTimeSharingActive : BOOLEAN;
  11.    PROCEDURE TurnOnTimeSharing;
  12.    PROCEDURE TurnOffTimeSharing;
  13.    PROCEDURE GiveUpTime( NSlices : INTEGER );
  14.    PROCEDURE Sync_Screen( S_Pos: INTEGER; NChars : INTEGER );
  15.    PROCEDURE Sync_Entire_Screen;
  16.  
  17. IMPLEMENTATION
  18.                                    (* Ensure multitasking defined       *)
  19. {$DEFINE MTASK}
  20.                                    (* Multitasker interface routines    *)
  21.  
  22. (*--------------------------------------------------------------------------*)
  23. (*             PIBMDOS.PAS --- Multitasker interface routines               *)
  24. (*--------------------------------------------------------------------------*)
  25. (*                                                                          *)
  26. (*  Author:  Philip R. Burns                                                *)
  27. (*                                                                          *)
  28. (*  Date:    Version 1.0: January, 1986.   DoubleDos support.               *)
  29. (*           Version 2.0: April, 1986.     Add DesqView support.            *)
  30. (*           Version 3.0: July, 1986.      Add TopView/Windows support.     *)
  31. (*           Version 3.1: September, 1986. Update for TaskView support.     *)
  32. (*           Version 3.2: December, 1986.  Distinguish TaskView/DesqView.   *)
  33. (*           Version 4.0: January, 1988.   Fix bogus TopView update, add    *)
  34. (*                                         check for Novell to stop lockup. *)
  35. (*                                                                          *)
  36. (*  Systems: MS DOS or PC DOS with DoubleDos/DesqView/TopView/Windows       *)
  37. (*           installed.                                                     *)
  38. (*                                                                          *)
  39. (*  History: These routines provide a simple interface for PibTerm          *)
  40. (*           with SoftLogic's DoubleDos multitasking executive,             *)
  41. (*           Quarterdeck's DesqView multitasker, IBM's TopView,             *)
  42. (*           MicroSoft's Windows, and Sunny Hill's TaskView.                *)
  43. (*           (Windows is handled as a Topview-emulating product.  This is   *)
  44. (*           also true for TaskView and DesqView, but those programs do     *)
  45. (*           not require the explicit screen updates TopView requires.      *)
  46. (*                                                                          *)
  47. (*           If you have another multitasker, you should be able to         *)
  48. (*           replace these routines fairly easily with similar-acting       *)
  49. (*           ones for your multitasker.  Use the global types defined       *)
  50. (*           for MultiTasker and MultiTaskerType.                           *)
  51. (*                                                                          *)
  52. (*           Note also that the routine Get_Screen_Address in Pibscren.pas  *)
  53. (*           needs to know about multitaskers.                              *)
  54. (*                                                                          *)
  55. (*           With DoubleDos, it is necessary to reobtain the display buffer *)
  56. (*           address every time the screen memory is written to.  With      *)
  57. (*           DesqView, this is unnecessary.  With TopView and Windows,      *)
  58. (*           it is necessary to inform them that the screen has changed.    *)
  59. (*           TaskView works like DesqView.                                  *)
  60. (*                                                                          *)
  61. (*--------------------------------------------------------------------------*)
  62. (*                                                                          *)
  63. (*           Please leave messages on Gene Plantz's BBS (312) 882 4145      *)
  64. (*           or Ron Fox's BBS (312) 940 6496.                               *)
  65. (*                                                                          *)
  66. (*--------------------------------------------------------------------------*)
  67.  
  68. (*--------------------------------------------------------------------------*)
  69. (*           IsNovellActive  --- Checks if Novell network is active         *)
  70. (*--------------------------------------------------------------------------*)
  71.  
  72. FUNCTION IsNovellActive : BOOLEAN;
  73.  
  74. (*--------------------------------------------------------------------------*)
  75. (*                                                                          *)
  76. (*    Function: IsNovellActive                                              *)
  77. (*                                                                          *)
  78. (*    Purpose:  Checks if Novell network active                             *)
  79. (*                                                                          *)
  80. (*    Calling Sequence:                                                     *)
  81. (*                                                                          *)
  82. (*       Novell_On := IsNovellActive : BOOLEAN;                             *)
  83. (*                                                                          *)
  84. (*          Novell_On --- TRUE if Novell network is active.                 *)
  85. (*                                                                          *)
  86. (*    Calls:  MsDos                                                         *)
  87. (*                                                                          *)
  88. (*--------------------------------------------------------------------------*)
  89.  
  90. VAR
  91.    Regs : Registers;
  92.  
  93. BEGIN (* IsNovellActive *)
  94.  
  95.    Regs.CX := 0;
  96.    Regs.AL := 0;
  97.                                    (* Request workstation ID.          *)
  98.                                    (* This should be ignored if Novell *)
  99.                                    (* network software isn't active.   *)
  100.    Regs.AH := $DC;
  101.  
  102.    MsDos( Regs );
  103.                                    (* If we got back a non-zero station *)
  104.                                    (* ID, then Novell must be loaded.   *)
  105.  
  106.    IsNovellActive := ( Regs.AL <> 0 );
  107.  
  108. END   (* IsNovellActive *);
  109.  
  110. (*--------------------------------------------------------------------------*)
  111. (*           IsTimeSharingActive --- Checks if multitasker is active        *)
  112. (*--------------------------------------------------------------------------*)
  113.  
  114. FUNCTION IsTimeSharingActive : BOOLEAN;
  115.  
  116. (*--------------------------------------------------------------------------*)
  117. (*                                                                          *)
  118. (*    Function: IsTimeSharingActive                                         *)
  119. (*                                                                          *)
  120. (*    Purpose:  Checks if multitasker is active                             *)
  121. (*                                                                          *)
  122. (*    Calling Sequence:                                                     *)
  123. (*                                                                          *)
  124. (*       Ts_On := IsTimeSharingActive : BOOLEAN;                            *)
  125. (*                                                                          *)
  126. (*          Ts_On --- TRUE if multitasker is active.                        *)
  127. (*                                                                          *)
  128. (*    Calls:  MsDos                                                         *)
  129. (*                                                                          *)
  130. (*--------------------------------------------------------------------------*)
  131.  
  132. VAR
  133.    Regs : Registers;
  134.  
  135. (*--------------------------------------------------------------------------*)
  136.  
  137. FUNCTION Get_TopView_Screen_Address : BOOLEAN;
  138.  
  139. VAR
  140.    SegS : INTEGER;
  141.    SegO : INTEGER;
  142.  
  143. BEGIN (* Get_TopView_Screen_Address *)
  144.  
  145.    Regs.Di := 0;
  146.    Regs.Ax := $FE00;
  147.    Regs.Es := SEG( DesqView_Screen^ );
  148.  
  149.    SegO    := 0;
  150.    SegS    := Regs.Es;
  151.  
  152.    INTR( $10 , Regs );
  153.  
  154.    DesqView_Screen := PTR( Regs.Es , Regs.Di );
  155.  
  156.    Get_TopView_Screen_Address := ( ( Regs.Es <> SegS )