home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PARADIS1 / VIDTRIK.PAS < prev    next >
Pascal/Delphi Source File  |  1991-01-30  |  2KB  |  70 lines

  1. (10734) Tue 18 Jun 91 22:59
  2. By: Sten Kalenda
  3. To: Jan Feijes
  4. Re: Different video segment trick
  5. St:
  6. ---------------------------------------------------------------------------
  7. @MSGID: 2:512/29.999 285ed6ac
  8. In a message to All <14 Jun 91 17:36> Jan Feijes wrote:
  9.  
  10.  JF> Hello "All",
  11.  
  12.  JF> When you want to make programs desqview aware you should use a
  13.  JF> different vedeo segement. (Anyway different than $B800 or $B000
  14.  JF> (for medieval hercules users))
  15.  
  16.  JF> Is there a way to trick turbo pascal, for example by means of
  17.  
  18. Yes, there is. Try the following code:
  19.  
  20. type
  21.   t_video = array[1..25,1..80] of record c : char; a : byte; end;
  22. var
  23.   Cur_vm  : byte absolute $0040:$0049;                { Current Video mode   }
  24.   scr     : ^t_video;
  25.   DesqView: boolean;
  26. Function ksMakeFarPtr(Seg,Ofs : word ) : pointer;
  27. begin
  28.   inline($8B/$46/$08/               { MOV AX,[BP+8] ; get seg from stack     }
  29.          $89/$46/$FE/               { MOV [BP-2],AX ; and move it to pointer }
  30.          $8B/$46/$06/               { MOV AX,[BP+6] ; get offset from stack  }
  31.          $89/$46/$FC);              { MOV [BP-4],AX ; and move it to pointer }
  32. end;
  33. procedure ChkVideo;
  34. var regs  : registers;
  35. begin
  36.   with regs do begin                                         { Under DesqView?}
  37.     AX:=$2B01;
  38.     CH:=Ord('D');
  39.     CL:=Ord('E');
  40.     DH:=Ord('S');
  41.     DL:=Ord('Q');
  42.     Intr($21,regs);
  43.     if   AL <> $FF then begin                                { YO! so behave..}
  44.          DesqView:=true;
  45.          if   cur_vm = 7 then AX:=$B000
  46.          else AX:=$B800;
  47.          ES:=AX;                                             { and get the... }
  48.          DI:=0;                                              { DV screen Adr. }
  49.          AH:=$FE;                                            { pointer and... }
  50.          Intr($10,regs);
  51.          scr:=ksMakeFarPtr(ES,DI);                           { set DV videoAdr}
  52.     end
  53.     else begin
  54.          DesqView:=false;
  55.         if   cur_vm = 7 then scr:=ksMakeFarPtr($B000,0000)    { herc.B000:0000}
  56.          else scr:=ksMakeFarPtr($B800,0000);                  { else B800:0000}
  57.     end;
  58.   end;
  59.   ScrBase:=Seg(scr^);
  60. end; { ChkVideo }
  61.  
  62. The code is untested but should work fine.
  63. ByBy and gegroet,
  64.      S10
  65.  
  66. --- XRS! 4.00
  67.  * Origin: ****  This is a QMX-user from RCC-BBS node 512/29 (RAX 2:512/29.999)
  68.  
  69. @PATH: 30027/999 512/29 39 0 1007 
  70.