home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / PASCAL / PAVT199 / PAVTDESQ.INC < prev    next >
Text File  |  1993-03-10  |  3KB  |  85 lines

  1. (*******************************************************************)
  2. (*  Avatar level 1 Console driver.  Unit for providing a program   *)
  3. (*  with proper Avatar levels 0, 0+, and 1 emulations.             *)
  4. (*  Copyright (c) 1991 - 93 Gregory P. Smith                       *)
  5. (*  All Rights Reserved                                            *)
  6. (*-----------------------------------------------------------------*)
  7. (*  Last Update:  March 10, 1993                                   *)
  8. (*========================================================**********)
  9. (* Include file for PAvatar to add DESQview API functions *)
  10. (**********************************************************)
  11.  
  12. function DESQview_Version: word; {$IFNDEF VER55} assembler; {$ENDIF}
  13. {$IFDEF VER55}
  14. var
  15.   regs : Registers;
  16. begin
  17.   with regs do begin
  18.     CX := $4445;
  19.     DX := $5351;
  20.     AX := $2b01;
  21.     MsDos(regs);
  22.     if AL = $ff then DESQview_version := 0 { not in DV }
  23.     else begin
  24.       DESQview_version := BX;
  25.       In_DV := True;
  26.     end;
  27.   end;
  28. end;  { 5.5 DESQview_Version }
  29. {$ELSE}  { TP 6.0 or later supports BASM }
  30. asm
  31.   MOV    CX,'DE'          { CX+DX to 'DESQ' (invalid date) }
  32.   MOV    DX,'SQ'
  33.   MOV    AX,2B01h         { Dos' set date funct. }
  34.   INT    21H              { call dos }
  35.   CMP    AL,0FFh          { Was it invalid? }
  36.   JE     @No_dv           { yep, no dv }
  37.   MOV    AX,BX            { AH=major AL=minor }
  38.   MOV    In_DV,01h        { In_DV is true }
  39.   JMP    @DvGv_x          { other routines }
  40. @No_dv:
  41.   XOR    AX,AX              { Return 0 for no DV }
  42. @DvGv_x:
  43. end;  { 6.0+ DESQview_version }
  44. {$ENDIF}
  45.  
  46. procedure DV_Sound(freq,dur:word); {$IFNDEF VER55} assembler; {$ENDIF}
  47. {$IFDEF VER55}
  48. begin
  49.   InLine($b8/$19/$10/$8b/$9e/freq/$8b/$8e/dur/$cd/$15);
  50. end;
  51. {$ELSE}
  52. asm
  53.   MOV   AX,1019H
  54.   MOV   BX,freq   { frequency above 20 Hz }
  55.   MOV   CX,dur    { duration in clock ticks }
  56.   INT   15H
  57. end;
  58. {$ENDIF}
  59.  
  60. Procedure DESQview_Init;
  61. {$IFDEF VER55}
  62. var
  63.   tmp : word;
  64. {$ENDIF}
  65. begin
  66.   {$IFDEF VER55} tmp := {$ENDIF}DESQview_Version; { init In_DV flag }
  67. end;
  68.  
  69. Procedure IdlePause;  { give up multitasker time slice }
  70. begin
  71.  if In_DV then Inline($B8/$00/$10/$cd/$15) { MOV AX, 1000h; INT 15h }
  72.    else Inline($CD/$28); { INT 28h; DOS Idle call, gives up time. }
  73. end;
  74.  
  75. { A replacement ReadKey procedure which issues a DESQview
  76.   Pause call if no input is ready.  Works identical to the
  77.   ReadKey function in the Crt unit.  }
  78.  
  79. function ReadKey : char;
  80. begin
  81.   while not KeyPressed do IdlePause; { give up until key ready! }
  82.   ReadKey := Crt.ReadKey; { now get the char }
  83. end;
  84.  
  85.