1{
2
3    This file is part of the Free Pascal run time library.
4    Copyright (c) 1999-2000 by Carl Eric Codere
5
6    This include implements VESA basic access.
7
8    See the file COPYING.FPC, included in this distribution,
9    for details about the copyright.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 **********************************************************************}
16
17
18TYPE
19  pFarChar = ^char;far;
20
21  pModeList = ^tModeList;far;
22  tModeList = Array [0..255] of word; {list of modes terminated by -1}
23                                      {VESA modes are >=100h}
24
25  TVESAinfo = packed record  { VESA Information request }
26    signature : array [1..4] of char;     { This should be VESA   }
27    version   : word;                     { VESA revision         }
28    str       : pFarChar;                 { pointer to OEM string }
29    caps      : longint;                  { video capabilities    }
30    modeList  : pModeList;                { pointer to SVGA modes }
31(*    pad       : array [18..260] of byte;  { extra padding more then   }
32  end;                             { VESA standard because of bugs on }
33                                   { some video cards.                }
34  *)
35  { VESA 1.1 }
36    TotalMem     : word;
37  { VESA 2.0 }
38    OEMversion   : word;
39    VendorPtr    : longint;
40    ProductPtr   : longint;
41    RevisionPtr  : longint;
42    filler       : Array[1..478]of Byte;
43  end;
44
45  TVESAModeInfo = packed record
46    attr           : word;             { mode attributes   (1.0)    }
47    winAAttr,
48    winBAttr       : byte;             { window attributes (1.0)    }
49    winGranularity : word;  {in K}     { Window granularity (1.0)   }
50    winSize        : word;  {in K}     { window size       (1.0)    }
51    winASeg,                           { Window A Segment address (1.0) }
52    winBSeg        : word;             { Window B Segment address (1.0) }
53    winFunct       : farpointer;       { Function to swtich bank    }
54    BytesPerScanLine: word;            {bytes per scan line (1.0)   }
55    { extended information }
56    xRes, yRes : word;    {pixels}
57    xCharSize,
58    yCharSize  : byte;
59    planes     : byte;
60    bitsPixel  : byte;
61    banks      : byte;
62    memModel   : byte;
63    bankSize   : byte;  {in K}
64    NumberOfPages: byte;
65(*
66    pad : array [29..260] of byte; { always put some more space then required}
67  end; *)
68    reserved       : byte; { pos $1E }
69    rm_size        : byte; { pos $1F }
70    rf_pos         : byte; { pos $20 }
71    gm_size        : byte; { pos $21 }
72    gf_pos         : byte; { pos $22 }
73    bm_size        : byte; { pos $23 }
74    bf_pos         : byte; { pos $24 }
75    (* res_mask       : word; { pos $25 }
76      here there was an alignment problem !!
77      with default alignment
78      res_mask was shifted to $26
79      and after PhysAddress to $2A !!! PM *)
80    res_size       : byte;
81    res_pos        : byte;
82    DirectColorInfo: byte; { pos $27 }
83  { VESA 2.0 }
84    PhysAddress    : longint; { pos $28 }
85    OffscreenPtr   : longint; { pos $2C }
86    OffscreenMem   : word; { pos $30 }
87  { VESA 3.0 }
88    LinBytesPerScanLine: Word;   {bytes per scan line for linear modes}
89    BnkNumberOfImagePages: Byte; {number of images for banked modes}
90    LinNumberOfImagePages: Byte; {number of images for linear modes}
91    LinRedMaskSize: Byte;        {size of direct color red mask (linear modes)}
92    LinRedFieldPosition: Byte;   {bit position of lsb of red mask (linear modes)}
93    LinGreenMaskSize: Byte;      {size of direct color green mask (linear modes)}
94    LinGreenFieldPosition: Byte; {bit position of lsb of green mask (linear modes)}
95    LinBlueMaskSize: Byte;       {size of direct color blue mask (linear modes)}
96    LinBlueFieldPosition: Byte;  {bit position of lsb of blue mask (linear modes)}
97    LinRsvdMaskSize: Byte;       {size of direct color reserved mask (linear modes)}
98    LinRsvdFieldPosition: Byte;  {bit position of lsb of reserved mask (linear modes)}
99    MaxPixelClock: longint;      {maximum pixel clock (in Hz) for graphics mode}
100
101    reserved2: array [1..189] of Byte; {remainder of ModeInfoBlock}
102   end;
103
104
105
106
107var
108  VESAInfo    : TVESAInfo;         { VESA Driver information  }
109  VESAModeInfo    : TVESAModeInfo;     { Current Mode information }
110  hasVesa: Boolean;       { true if we have a VESA compatible graphics card}
111                          { initialized in QueryAdapterInfo in graph.inc }
112