ogDisplay_VESA.h

00001 #ifndef OGDISPLAY_VESA_H
00002 
00003 #define OGDISPLAY_VESA_H
00004 
00005 
00006 
00007 #include "objgfx30.h"
00008 
00009 
00010 
00011 struct TMode_Rec {
00012 
00013     uInt16 ModeAttributes     __attribute__((packed));
00014 
00015     uInt8  WindowAFlags       __attribute__((packed));
00016 
00017     uInt8  WindowBFlags       __attribute__((packed));
00018 
00019     uInt16 Granularity        __attribute__((packed));
00020 
00021     uInt16 WindowSize         __attribute__((packed));
00022 
00023     uInt16 WindowASeg         __attribute__((packed));
00024 
00025     uInt16 WindowBSeg         __attribute__((packed));
00026 
00027     void*  BankSwitch         __attribute__((packed));
00028 
00029     uInt16 BytesPerLine       __attribute__((packed));
00030 
00031     uInt16 xRes               __attribute__((packed));
00032 
00033     uInt16 yRes               __attribute__((packed));
00034 
00035     uInt8  CharWidth          __attribute__((packed));
00036 
00037     uInt8  CharHeight         __attribute__((packed));
00038 
00039     uInt8  NumBitPlanes       __attribute__((packed));
00040 
00041     uInt8  BitsPerPixel       __attribute__((packed));
00042 
00043     uInt8  NumberOfBanks      __attribute__((packed));
00044 
00045     uInt8  MemoryModel        __attribute__((packed));
00046 
00047     uInt8  BankSize           __attribute__((packed));
00048 
00049     uInt8  NumOfImagePages    __attribute__((packed));
00050 
00051     uInt8  Reserved           __attribute__((packed));
00052 
00053     // Direct colour fields (required for Direct/6 and YUV/7 memory models
00054 
00055     uInt8  RedMaskSize        __attribute__((packed));
00056 
00057     uInt8  RedFieldPosition   __attribute__((packed));
00058 
00059     uInt8  GreenMaskSize      __attribute__((packed));
00060 
00061     uInt8  GreenFieldPosition __attribute__((packed));
00062 
00063     uInt8  BlueMaskSize       __attribute__((packed));
00064 
00065     uInt8  BlueFieldPosition  __attribute__((packed));
00066 
00067     uInt8  AlphaMaskSize      __attribute__((packed));
00068 
00069     uInt8  AlphaFieldPosition __attribute__((packed));
00070 
00071     uInt8  DirectColourMode   __attribute__((packed));
00072 
00073     // VESA 2.0 specific fields
00074 
00075     uInt32 physBasePtr        __attribute__((packed));
00076 
00077     void*  OffScreenMemOffset __attribute__((packed));
00078 
00079     uInt16 OffScreenMemSize   __attribute__((packed));
00080 
00081     uInt8  paddington[461]    __attribute__((packed));
00082 
00083 };
00084 
00085 
00086 
00087 struct TVESA_Rec {
00088 
00089     char    VBESignature[4]   __attribute__((packed));
00090 
00091     uInt8   minVersion        __attribute__((packed));
00092 
00093     uInt8   majVersion        __attribute__((packed));
00094 
00095     uInt32  OEMStringPtr      __attribute__((packed));
00096 
00097     uInt32  Capabilities      __attribute__((packed));
00098 
00099     uInt32  VideoModePtr      __attribute__((packed));
00100 
00101     uInt16  TotalMemory       __attribute__((packed));
00102 
00103     // VESA 2.0 specific fields
00104 
00105     uInt16  OEMSoftwareRev    __attribute__((packed));
00106 
00107     uInt32  OEMVendorNamePtr  __attribute__((packed));
00108 
00109     uInt32  OEMProductNamePtr __attribute__((packed));
00110 
00111     uInt32  OEMProductRevPtr  __attribute__((packed));
00112 
00113     uInt8   paddington[474]   __attribute__((packed));
00114 
00115 };
00116 
00117 
00118 
00119 class ogDisplay_VESA : public ogSurface {
00120 
00121  protected:
00122 
00123   uInt16       ScreenSelector;
00124 
00125   TVESA_Rec*   VESARec;
00126 
00127   TMode_Rec*   ModeRec;
00128 
00129   bool         InGraphics;
00130 
00131   uInt16       findMode(uInt32, uInt32, uInt32);
00132 
00133   void         getModeInfo(uInt16);
00134 
00135   void         getVESAInfo(void);
00136 
00137   void         setMode(uInt16);
00138 
00139   virtual uInt32 rawGetPixel(uInt32, uInt32);  
00140 
00141   virtual void rawSetPixel(uInt32, uInt32, uInt32);
00142 
00143   virtual void rawLine(uInt32, uInt32, uInt32, uInt32, uInt32);
00144 
00145   void         setPal(void);
00146 
00147  public:
00148 
00149                ogDisplay_VESA(void);
00150 
00151   virtual bool ogAvail(void);
00152 
00153   virtual bool ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32);
00154 
00155   virtual void ogClear(uInt32);
00156 
00157   virtual bool ogClone(ogSurface&);
00158 
00159   virtual void ogCopyLineTo(uInt32, uInt32, const void *, uInt32);
00160 
00161   virtual void ogCopyLineFrom(uInt32, uInt32, void *, uInt32);
00162 
00163   virtual void ogCopyPal(ogSurface&);
00164 
00165   virtual bool ogCreate(uInt32, uInt32, ogPixelFmt);
00166 
00167   virtual uInt32 ogGetPixel(int32, int32);
00168 
00169   virtual void * ogGetPtr(uInt32, uInt32);
00170 
00171   virtual void ogHLine(int32, int32, int32, uInt32);
00172 
00173   virtual bool ogLoadPal(const char *);  
00174 
00175   virtual void ogSetPixel(int32, int32, uInt32);
00176 
00177   virtual void ogSetRGBPalette(uInt8, uInt8, uInt8, uInt8);  
00178 
00179   virtual void ogVFlip(void);
00180 
00181   virtual void ogVLine(int32, int32, int32, uInt32);
00182 
00183   virtual      ~ogDisplay_VESA(void);
00184 
00185 }; // ogDisplay_VESA
00186 
00187 
00188 
00189 #endif
00190 

Generated on Wed Apr 28 17:49:38 2004 for Ubixos by doxygen 1.3.3