Solved

How to change the visual Page in Vesa Grafik Mode

Posted on 2000-03-14
4
328 Views
Last Modified: 2010-04-16
Im in Vesa Grafik Mode Nr. $101 ( 640x480x256), my GrafikCard has 2MB RAM, so I've got more than 1 Page. When I change it with the two Ports ( Port to set StartOffSet ), The Screen is only shifted away by ca. 80 %, cause one Page is bigger than 64k.
0
Comment
Question by:DennisWood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:ntdragon
ID: 2616263
are you using:
activepage(...)
visualpage(...)

or give us some code
0
 
LVL 3

Expert Comment

by:Alisher_N
ID: 2616776
you may need to switch banks on your card because system doesn't allow you to access more than 64K
or you may use Linear Frame Buffering mode which gives you all video memory access
0
 
LVL 12

Accepted Solution

by:
Hypo earned 300 total points
ID: 2617925
Hi,
Take a look at my example... I've used pageflipping in several vesamodes before so I recognize your problem. Check out the pascalcode in the SetVesaMode procedure to see the calculations I use... it works fine to me.

Anyway, I'm not using ports to set the visual page in vesa modes, I'm using the vesa function $4F07 to do that.

Let me know if you want me to explain it better. (this is the second time I write this thing to you since the first answer i tried to submit got lost in a server error)

Program Flipping;

uses crt;

Type modeinfo = record
   ModeAttributes   : word;
   WinAAttributes   : byte;
   WinBAttributes   : byte;
   WinGranularity   : word;
   WinSize          : word;
   WinASegment      : word;
   WinBSegment      : word;
   WinFunc          : pointer;
   BytesPerScanLine : word;
   XResolution      : word;
   YResolution      : word;
   XCharSize        : byte;
   YCharSize        : byte;
   NumberOfPlanes   : byte;
   BitsPerPixel     : byte;
   NumberOfBanks    : byte;
   MemoryModel      : byte;
   BankSize         : byte;
   NumberOfImgPages : byte;
   OtherData        : array[0..225] of byte;
   CurBank          : byte;
   AddPage          : byte;
end;

var _VMode    : ModeInfo;

    _FlipPages,
    _FlipYc,
    _FlipXc,
    _FlipPage  : integer;

    loop,a,b   : integer;

Procedure SetVesaMode(Mode : word);
begin
 asm
  MOV AX,4F01h        { regs.AX := $4F01;      }
  MOV CX,mode         { regs.CX := Mode;       }
  MOV BX,DS           { regs.BX := regs.DS;    }
  MOV ES,BX           { regs.ES := regs.BX;    }
  LEA DI,_VMode       { regs.DI := ofs(Vmode); }
  INT $10;            { intr($10,regs);        }

  MOV AX,4F02h        { regs.AX := $4F02;      }
  MOV BX,CX           { regs.BX := regs.CX;    }
  INT $10             { intr($10,regs);        }

  MOV AX,4F06h
  MOV BL,0
  MOV CX,_VMode.XResolution;
  INT $10
 end;
 _FlipPages := (longint(_VMode.Yresolution)*longint(_VMode.BytesPerScanLine)) shr 16 +1;
 _FlipYc := longint(_FlipPages) shl 16 div (_VMode.BytesPerScanLine);
 _FlipXc := ((longint(_FlipPages) shl 16) mod (_VMode.BytesPerScanLine)) div 2;
 _VMode.CurBank := 0;
 _VMode.AddPage := 0;
end;

Procedure _SetVisualPage(scrn : byte); assembler;
asm
  MOV AX,$4F07
  XOR BX,BX
  XOR DX,DX
  MOV CL,SCRN
  AND CX,1
  JZ  @FirstPage
  MOV CX,_FlipXc;
  MOV DX,_FlipYc;
  @FirstPage:
  INT $10
end;

Procedure _SetActivePage(Page : byte); assembler;
asm
  MOV AL,Page
  AND AX,1
  JZ  @ActivateFirstPage
  MOV AH,byte ptr _FlipPages
  @ActivateFirstPage:
  MOV _VMode.AddPage,AH
end;

Procedure Retrace; assembler;
asm
  MOV DX, $3DA
  @NotVert:
  IN  AL, DX
  AND AL, 8
  JNZ @NotVert
  @IsVert:
  IN  AL, DX
  AND AL, 8
  JZ @IsVert
end;

Procedure SetBank(num : byte); assembler;
asm
  XOR  DX,DX
  XOR  BX,BX
  MOV  DL,num
  ADD  DL,_VMode.AddPage
  CALL _Vmode.WinFunc
  SUB  DL,_VMode.AddPage
  MOV  _VMode.CurBank,DL
end;

Procedure _Flip;
begin
  _FlipPage := not _FlipPage and 1;
  _SetVisualPage(_FlipPage);
  _SetActivePage((_FlipPage+1) and 1);
end;

Procedure _Putpixel(X,Y,C : word);
var VidMem : longint;
begin
 VidMem := longint(longint(Y)*longint(_VMode.XResolution)+X)*longint(_VMode.BitsPerPixel shr 3);
 if (VidMem shr 16) <> _VMode.CurBank then
  SetBank(VidMem shr 16);
 if _VMode.BitsPerPixel > 8 then
  memw[$A000:VidMem] := C else
   mem[$A000:VidMem] := C;
end;

Procedure TextMode; assembler;
asm
 MOV AX,3
 INT $10;
end;

Procedure MakeScreen;
var A,B,C : integer;
begin
 _SetActivePage(0);
 for A := 0 to _VMode.YResolution do begin
  for B := 0 to (A shr 4) do _PutPixel(Random(A),A,random(255));
 _PutPixel(A,A,15);
 end;
 _SetActivePage(1);
 for A := 0 to _VMode.YResolution do begin
  for B := 0 to (A shr 4) do _PutPixel(_VMode.YResolution-Random(A),A,random(255));
  _PutPixel(_VMode.YResolution-A,A,15);
 end;
end;

begin
 SetVesaMode($101);
 MakeScreen;
 repeat
 delay(250);
 retrace;
 _Flip;
 until keypressed;
 TextMode;
end.
0
 

Author Comment

by:DennisWood
ID: 2639669
Thanks, this makes what i wanted. But on my second Computer, with a Cirrus Logic ??22 - ??28 with 1 MB the second screenpage is always black, whats up there ? 640*480 is ca 300kByte two Pages are only around 600 kB.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
In this blog we highlight approaches to managed security as a service.  We also look into ConnectWise’s value in aiding MSPs’ security management and indicate why critical alerting is a necessary integration.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question