Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to change the visual Page in Vesa Grafik Mode

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Sometimes Administrators rights are not enough. These cases call for the SYSTEM account. The process in this article outlines the steps required to execute commands using the SYSTEM account.
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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