http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VESA questions



   From my understanding of SVGA Windows, some modes have only one window,
while others have two.   The windows do not have to have the same
functionality, so you check that by looking at the WindowAAttributes and
WindowBAttributes fields of the SVGA mode info struct to see if they exist
and their capabilites.  (I included this struct here along with the
GetSVGAModeInfo() function.  You probably already have it, but I didn't want
to confuse naming conventions).

    If anyone knows anything about setting up the linear frame buffer, I
would appreciate it a lot.  I have tried setting it up by setting the linear
frame buffer flag (<mode number> & 0x4000) and getting the address of mapped
memory from the LinearVideoBufferAddress member of the SVGA mode info
struct.  Any ideas/comments would be appreciated.

    I hope this helps a little.

~Greg

All of this code is written using DJGPP.  You may have to alter it if you
are using a different compiler, but I just wanted to give an example.

int inline SetSVGABank(int bank)
{
   static int CurrentBank;
   if (bank == CurrentBank) return 1; // to save unneccessary bank switches
   else{
        __dpmi_regs r;
        r.x.ax = 0x4f05;
        r.x.bx = 0;
        r.x.dx = bank;
        __dpmi_int(0x10, &r);
        CurrentBank = bank;
      return (0x4f == r.x.ax);
   }
}

//  declare video to be a pointer in your case char, to video memory

//  coded for 640x480x16bpp

void PlotPixel16(int x, int y , short color)
{
   unsigned int Address = y * 640 + x;
   unsigned int DestBank = Address >> 15; // find the destination bank
   Address = (Address) & 0x7fff; // and the offset
   SetSVGABank(DestBank);
   video[Address] = color;
}

//  Since the SVGA bios funcitons only return info in conventional memory,
and DJGPP is
//  a protected mode compiler, you have to use the transfer buffer (__tb) to
store, then
//  copy to your program memory

int GetSVGAModeInfo(SVGAModeInfo *DestPtr, int Mode)
{
   __dpmi_regs r;
   r.x.ax = 0x4f01;
   r.x.cx = Mode;
   r.x.es = (__tb & 0xf0000) >> 4;
   r.x.di = (__tb & 0xffff);
   __dpmi_int(0x10, &r);
   if (r.x.ax == 0x4f)
   {
      dosmemget(__tb, sizeof(SVGAModeInfo), DestPtr);
      return 1;
   }else
 return 0;

};

typedef struct
{
 WORD ModeAttributes PACKED;
 BYTE WindowAAttributes PACKED; // bit 0: exists if set
                                                             //     1:
readable if set
                                                             //     2:
writable if set
 BYTE WindowBAttributes PACKED; // same
 WORD WindowGranularity PACKED; // in K
 WORD WindowSize PACKED; // in K
 WORD StartSegWindowA PACKED;
 WORD StartSegWindowB PACKED;
 DWORD WindowPositioningFuncPtr PACKED;
 WORD BytesPerScanLine PACKED;
//  Optional--only if (ModeAttributes & 2)
 WORD XResolution PACKED;
 WORD YResolution PACKED;
 BYTE CharacterWidthInPixels PACKED;
 BYTE CharacterHeightInPixels PACKED;
 BYTE NumMemoryPlanes PACKED;
 BYTE BitsPerPixel PACKED;
 BYTE NumberBanks PACKED;
 BYTE MemoryModel PACKED;
 BYTE BankSize PACKED;//in K
 BYTE NumImagePages PACKED;
 BYTE reserved PACKED;
// -------VBE 1.2+-------
 BYTE RedMaskSize PACKED;
 BYTE RedMaskPosition PACKED;
 BYTE GreenMaskSize PACKED;
 BYTE GreenMaskPosition PACKED;
 BYTE BlueMaskSize PACKED;
 BYTE BlueMaskPosition PACKED;
 BYTE ReservedMaskSize PACKED;

 BYTE ReservedMaskPosition PACKED;
 BYTE DirectScreenModeInfo PACKED;
// -------VBE 2.0---------
 DWORD LinearVideoBufferAddress PACKED;
 DWORD StartOffscreenMemoryPtr PACKED;
 WORD OffscreenMemory PACKED;// In Kb
}SVGAModeInfo;


----- Original Message -----
From: "Lionel Pinkhard" <lionelp@worldonline.co.za>
To: <gameprogrammer@gameprogrammer.com>
Sent: Monday, December 31, 1979 7:47 PM
Subject: VESA questions


> Hey guys/gals,
>
> I'm having some trouble with VESA bank switching, I have a copy of the
> VESA specification with me, and it shows the following:
>
> AH = 4Fh Super VGA support
> AL = 05h Super VGA video memory window control
> BH = 00h Select Super VGA video memory window
> BL = Window number
> 0 = Window A
> 1 = Window B
> DX = Window position in memory
>      (in window granularity units)
>
> Okay, now my question is: What do I put in BL and DX? How do I calculate
> the values? I'm using 640x480x256, mode 101h. Can somebody help me out
> please? A simple pixel plotting routine would also be really appreciated,
> since I'm just starting out with this stuff, I have tried before, but
> everything's been a failure, but now I'm determined to make it work :-).
>
> Ciao,
>
> Lionel
>
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
>
> To SUBSCRIBE or UNSUBSCRIBE please visit:
> http://gameprogrammer.com/mailinglist.html
>
>
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html




  • References: