• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2 *
3 *                   VBE 2.0 Linear Framebuffer Profiler
4 *                    By Kendall Bennett and Brian Hook
5 *
6 * Filename:     LFBPROF.H
7 * Language:     ANSI C
8 * Environment:  Watcom C/C++ 10.0a with DOS4GW
9 *
10 * Description:  Header file for the LFBPROF.C progam.
11 *
12 ****************************************************************************/
13 
14 #ifndef __LFBPROF_H
15 #define __LFBPROF_H
16 
17 /*---------------------- Macros and type definitions ----------------------*/
18 
19 #pragma pack(1)
20 
21 /* SuperVGA information block */
22 
23 typedef struct {
24     char    VESASignature[4];       /* 'VESA' 4 byte signature          */
25     short   VESAVersion;            /* VBE version number               */
26     long    OemStringPtr;           /* Pointer to OEM string            */
27     long    Capabilities;           /* Capabilities of video card       */
28     long    VideoModePtr;           /* Pointer to supported modes       */
29     short   TotalMemory;            /* Number of 64kb memory blocks     */
30 
31     /* VBE 2.0 extensions */
32 
33     short   OemSoftwareRev;         /* OEM Software revision number     */
34     long    OemVendorNamePtr;       /* Pointer to Vendor Name string    */
35     long    OemProductNamePtr;      /* Pointer to Product Name string   */
36     long    OemProductRevPtr;       /* Pointer to Product Revision str  */
37     char    reserved[222];          /* Pad to 256 byte block size       */
38     char    OemDATA[256];           /* Scratch pad for OEM data         */
39     } VBE_vgaInfo;
40 
41 /* SuperVGA mode information block */
42 
43 typedef struct {
44     short   ModeAttributes;         /* Mode attributes                  */
45     char    WinAAttributes;         /* Window A attributes              */
46     char    WinBAttributes;         /* Window B attributes              */
47     short   WinGranularity;         /* Window granularity in k          */
48     short   WinSize;                /* Window size in k                 */
49     short   WinASegment;            /* Window A segment                 */
50     short   WinBSegment;            /* Window B segment                 */
51     long    WinFuncPtr;             /* Pointer to window function       */
52     short   BytesPerScanLine;       /* Bytes per scanline               */
53     short   XResolution;            /* Horizontal resolution            */
54     short   YResolution;            /* Vertical resolution              */
55     char    XCharSize;              /* Character cell width             */
56     char    YCharSize;              /* Character cell height            */
57     char    NumberOfPlanes;         /* Number of memory planes          */
58     char    BitsPerPixel;           /* Bits per pixel                   */
59     char    NumberOfBanks;          /* Number of CGA style banks        */
60     char    MemoryModel;            /* Memory model type                */
61     char    BankSize;               /* Size of CGA style banks          */
62     char    NumberOfImagePages;     /* Number of images pages           */
63     char    res1;                   /* Reserved                         */
64     char    RedMaskSize;            /* Size of direct color red mask    */
65     char    RedFieldPosition;       /* Bit posn of lsb of red mask      */
66     char    GreenMaskSize;          /* Size of direct color green mask  */
67     char    GreenFieldPosition;     /* Bit posn of lsb of green mask    */
68     char    BlueMaskSize;           /* Size of direct color blue mask   */
69     char    BlueFieldPosition;      /* Bit posn of lsb of blue mask     */
70     char    RsvdMaskSize;           /* Size of direct color res mask    */
71     char    RsvdFieldPosition;      /* Bit posn of lsb of res mask      */
72     char    DirectColorModeInfo;    /* Direct color mode attributes     */
73 
74     /* VBE 2.0 extensions */
75 
76     long    PhysBasePtr;            /* Physical address for linear buf  */
77     long    OffScreenMemOffset;     /* Pointer to start of offscreen mem*/
78     short   OffScreenMemSize;       /* Amount of offscreen mem in 1K's  */
79     char    res2[206];              /* Pad to 256 byte block size       */
80     } VBE_modeInfo;
81 
82 #define vbeMemPK        4           /* Packed Pixel memory model        */
83 #define vbeUseLFB       0x4000      /* Enable linear framebuffer mode   */
84 
85 /* Flags for the mode attributes returned by VBE_getModeInfo. If
86  * vbeMdNonBanked is set to 1 and vbeMdLinear is also set to 1, then only
87  * the linear framebuffer mode is available.
88  */
89 
90 #define vbeMdAvailable  0x0001      /* Video mode is available          */
91 #define vbeMdColorMode  0x0008      /* Mode is a color video mode       */
92 #define vbeMdGraphMode  0x0010      /* Mode is a graphics mode          */
93 #define vbeMdNonBanked  0x0040      /* Banked mode is not supported     */
94 #define vbeMdLinear     0x0080      /* Linear mode supported            */
95 
96 /* Structures for issuing real mode interrupts with DPMI */
97 
98 struct _RMWORDREGS {
99     unsigned short ax, bx, cx, dx, si, di, cflag;
100     };
101 
102 struct _RMBYTEREGS {
103     unsigned char   al, ah, bl, bh, cl, ch, dl, dh;
104     };
105 
106 typedef union {
107     struct  _RMWORDREGS x;
108     struct  _RMBYTEREGS h;
109     } RMREGS;
110 
111 typedef struct {
112     unsigned short  es;
113     unsigned short  cs;
114     unsigned short  ss;
115     unsigned short  ds;
116     } RMSREGS;
117 
118 /* Inline assembler block fill/move routines */
119 
120 void LfbMemset(void *p,int c,int n);
121 #pragma aux LfbMemset =             \
122 	"shr    ecx,2"                  \
123 	"xor    eax,eax"                \
124 	"mov    al,bl"                  \
125 	"shl    ebx,8"                  \
126 	"or     ax,bx"                  \
127 	"mov    ebx,eax"                \
128 	"shl    ebx,16"                 \
129 	"or     eax,ebx"                \
130 	"rep    stosd"                  \
131 	parm [edi] [ebx] [ecx];
132 
133 void LfbMemcpy(void *dst,void *src,int n);
134 #pragma aux LfbMemcpy =             \
135 	"shr    ecx,2"                  \
136 	"rep    movsd"                  \
137 	parm [edi] [esi] [ecx];
138 
139 /* Map a real mode pointer into address space */
140 
141 #define LfbMapRealPointer(p)    (void*)(((unsigned)((p)  & 0xFFFF0000) >> 12) + ((p) & 0xFFFF))
142 
143 /* Get the current timer tick count */
144 
145 #define LfbGetTicks()       *((long*)0x46C)
146 
147 #pragma pack()
148 
149 #endif  /* __LFBPROF_H */
150