?
Solved

How to change the visual Page in Vesa Grafik Mode

Posted on 2000-03-14
4
Medium Priority
?
329 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 1200 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

New style of hardware planning for Microsoft Exchange server.
Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

771 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