TIP: Click on subject to list as thread! ANSI
echo: pascal
to: ALL
from: RICHARD RJFORS
date: 1998-05-23 18:39:00
subject: vrtual pascal and fullscreen gfx

Hi All.
I have played around with this (taken from flame.pas):
==============
program gfx;
uses Os2Base, Use32;
{$PMTYPE NOVIO}
{$IFDEF DYNAMIC_VERSION}
  {$Dynamic System}
  {$L VPRTL.LIB}
{$ENDIF}
type
  Ptr16Rec = record
    Ofs,Sel: SmallWord;
  end;
var
  RGBValues: array [1..128] of record R,G,B: Byte; end;
  OrgMode: VioModeInfo;
  VioBufOfs: Longint;
  C,X,Y,Z: Word;
  Status: Byte;
{ BIOS Video Mode #13 }
const
  VioMode: VioModeInfo =
   ( cb:     SizeOf(VioModeInfo);
     fbType: vgmt_Other + vgmt_Graphics;
     Color:  colors_256;
     Col:    40;
     Row:    25;
     HRes:   320;
     VRes:   200
   );
  ColorRegs: VioColorReg =
   ( cb:            SizeOf(VioColorReg);
     rType:         3;  { Color registers }
     FirstColorReg: 1;
     NumColorRegs:  128;
     ColorRegAddr:  @RGBValues
   );
  VioBuf: VioPhysBuf =
   ( pBuf: Ptr($A0000);
     cb:   64*1024
   );
const
  Locked: Boolean = False;
{ Restores screen to the original state }
procedure RestoreScreen;
begin
  VioSetMode(OrgMode, 0);
  if Locked then VioScrUnLock(0);
end;
{ Prepares R,G and B values for color register # No }
procedure SetRGB(No,AR,AG,AB: Byte);
begin
  with RGBValues[No] do
  begin
    R := AR;
    G := AG;
    B := AB;
  end;
end;
begin
  for X := 1 to 32 do
  begin
    SetRGB(X     , X*2-1, 0    , 0    );
    SetRGB(X + 32, 63   , X*2-1, 0    );
    SetRGB(X + 64, 63   , 63   , X*2-1);
    SetRGB(X + 96, 63   , 63   , 63   );
  end;
  { Save original video mode }
  OrgMode.cb := SizeOf(VioModeInfo);
  VioGetMode(OrgMode, 0);
  { Set VGA 320x200x256 video mode }
  if VioSetMode(VioMode, 0)  0 then Halt;
  { Convert flat pointer to 16:16 form that is used by Vio }
  FlatToSel(ColorRegs.ColorRegAddr);
  { Modify color registers with values prepared above }
  if VioSetState(ColorRegs, 0)  0 then Halt;
  { Lock the screen }
  if (VioScrLock(lockIO_NoWait, Status, 0)  0) or
    (Status  lock_Success) then Halt;
  Locked := True;
  { Get selector for physical video buffer }
  if VioGetPhysBuf(VioBuf, 0)  0 then Halt;
  { Make flat pointer that points to the physical video buffer}
  Ptr16Rec(VioBufOfs).Ofs := 0;
  Ptr16Rec(VioBufOfs).Sel := VioBuf.Sel;
  SelToFlat(Pointer(VioBufOfs));
  { Clear the screen. Unlike function 0 of the BIOS INT 10h }
  { VioSetMode doesn't clear the screen.                    }
  FillChar(Pointer(VioBufOfs)^,64*1024,0);
  RestoreScreen;
end.
==============
Fillchar works perfectly, but I tried to with the move command. I hade an 
array of bytes that I tried to copy but it didn't work.
Any Idea?
And how to I change the palette in the program?
/Richard
--- FleetStreet 1.22+
--- Squish/386 v1.11
---------------
* Origin: jo (2:203/631.19)
* Origin: Richards point (2:203/631.19)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.