[comp.lang.pascal] Video Page Address Wanted--Help Me Please!

gonzalm@jacobs.CS.ORST.EDU (Mario Gonzales) (02/12/91)

Ok.  I am writing a screen saver and the video port addresses given to
me in a book to turn the port on/off are not working.
  What I would like to know is what the address of these ports are.

  Part two of my question is: I am going to upgrade this program
  to switch the physical page to a virtual and vice versa so 
  a message can be displayed whil the screen saver is active.

  Configuration: IBM Ps/2  Vga Monitor (everthing came with the PS/2 30)
  So.. all factory installed.

  below is the program an what I am attempting to do.  You can see
  that I try to detect the video type and switch accordingly to
  the Porton/PortOff addresses but nothing happens.

  Help If you can:  Mario L. Gonzales
	gonzalm@jacobs.cs.orst.edu


{$M 2000,0,0}
{$R-,s-,i-,d+,f+,v-,b-,n-,l+}
Program ScreenSaver;

uses
  dos,crt;
const
  timerint=$08;
  Kbdint=$09;
  Timelimit: Word=5460;
var
  Regs :registers;
  Cnt:word;
  PortNum:word;
  Portoff:word;
  Porton:word;
  OldkbdVec,OldTimerVec:pointer;
  i:real;
  Code:word;
(*--------------------------------------------------------------------*)
Procedure STI;
Inline ($FB);
(*--------------------------------------------------------------------*)
Procedure CLI;
Inline ($FA);
(*--------------------------------------------------------------------*)
Procedure CallOldInt (Sub:pointer);
Begin
  Inline ($9C/             {PushHF                 }
          $FF/$5E/$06);     {Call Dword Ptr [BP+6]  }
  end;
(*--------------------------------------------------------------------*)
Procedure Keyboard(Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP:WORD); INTERRUPT;
  BEGIN
    CALLOLDINT(OLDKBDVEC);
    IF (CNT >= TimeLimit) then
       Port[portnum]:=PortOn;
       Cnt:=0;
       STI;
  End;
(*---------------------------------------------------------------------*)
Procedure Clock(Flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP:WORD); INTERRUPT;
 Begin
   CallOldInt(OldTimerVec);
     if (Cnt>TimeLimit) then
       Port[Portnum]:=Portoff
     else
       Inc(Cnt,1);
       STI;
   end;
(*---------------------------------------------------------------------*)
Procedure Help;
  begin
  clrscr;
  writeln;
  writeln ('-------------------------------------------');
  writeln ('| SCREEN WARDEN (c)1991 Mario L. Gonzales |');
  writeln ('-------------------------------------------');
  writeln;
  writeln ('Saver [Time in Minutes]');
  writeln ('eg. Saver 5');
  writeln ('Will Blank the Screen in 5 minutes of idle time.');
  writeln;
  Writeln ('SCREEN WARDEN (c)1991 -- Not Installed');
  Halt;
  end;

(*---------------------------------------------------------------------*)
Begin
  If ParamCount=0 then Help;
  If (ParamCount=1) and (ParamStr(1)='?') then Help;
  If ParamCount=1 then
    begin
    VAl(ParamStr(1),i,code);
  If (Code=0) and (i>0) and (i<11) then
    TimeLimit:=Trunc(i*18.2*60);
  end;

  Regs.AH :=$0F;
  Intr($10,Regs);

  If Regs.AL=7 then
    begin
      PortNum:=$3B8;
      PortOff:=$21;
      PortOn:=$29;
    end
  Else
    Begin
      PortNum:=$3D8;
      Portoff:=$25;
      PortOn:=$2D;
    end;
  GetIntVec(KbdInt,OldKbdVec);
  GetIntVec(TimerInt,OldTimerVec);

  SetIntVec(TimerInt,@Clock);
  SetIntVec(KbdInt,@Keyboard);
  Cnt:=0;
  clrscr;
  writeln;
  writeln ('-------------------------------------------');
  writeln ('| SCREEN WARDEN (c)1991 Mario L. Gonzales |');
  writeln ('-------------------------------------------');
  writeln;
  WRiteln ('Installation Successful.');
  keep(0);
  End.

So  If you read this far maybee you know what I need to?
THANKS IN ADVANCE.  E-Mail Directly or Post.
  (gonzalm@Jacobs.cs.orst.edu))