Newer
Older
Scratch / lockwasher / src / lib / views / include / ogDisplay_UbixOS.h
#ifndef OGDISPLAY_UBIXOS_H
#define OGDISPLAY_UBIXOS_H

#include "objgfx30.h"

struct ogMode_Rec {
    uInt16 ModeAttributes     __attribute__((packed));
    uInt8  WindowAFlags       __attribute__((packed));
    uInt8  WindowBFlags       __attribute__((packed));
    uInt16 Granularity        __attribute__((packed));
    uInt16 WindowSize         __attribute__((packed));
    uInt16 WindowASeg         __attribute__((packed));
    uInt16 WindowBSeg         __attribute__((packed));
    void*  BankSwitch         __attribute__((packed));
    uInt16 BytesPerLine       __attribute__((packed));
    uInt16 xRes               __attribute__((packed));
    uInt16 yRes               __attribute__((packed));
    uInt8  CharWidth          __attribute__((packed));
    uInt8  CharHeight         __attribute__((packed));
    uInt8  NumBitPlanes       __attribute__((packed));
    uInt8  BitsPerPixel       __attribute__((packed));
    uInt8  NumberOfBanks      __attribute__((packed));
    uInt8  MemoryModel        __attribute__((packed));
    uInt8  BankSize           __attribute__((packed));
    uInt8  NumOfImagePages    __attribute__((packed));
    uInt8  Reserved           __attribute__((packed));
    // Direct colour fields (required for Direct/6 and YUV/7 memory models
    uInt8  RedMaskSize        __attribute__((packed));
    uInt8  RedFieldPosition   __attribute__((packed));
    uInt8  GreenMaskSize      __attribute__((packed));
    uInt8  GreenFieldPosition __attribute__((packed));
    uInt8  BlueMaskSize       __attribute__((packed));
    uInt8  BlueFieldPosition  __attribute__((packed));
    uInt8  AlphaMaskSize      __attribute__((packed));
    uInt8  AlphaFieldPosition __attribute__((packed));
    uInt8  DirectColourMode   __attribute__((packed));
    // VESA 2.0 specific fields
    uInt32 physBasePtr        __attribute__((packed));
    void*  OffScreenMemOffset __attribute__((packed));
    uInt16 OffScreenMemSize   __attribute__((packed));
    uInt8  paddington[461]    __attribute__((packed));
};

struct ogVESA_Rec {
    char    VBESignature[4]   __attribute__((packed));
    uInt8   minVersion        __attribute__((packed));
    uInt8   majVersion        __attribute__((packed));
    uInt32  OEMStringPtr      __attribute__((packed));
    uInt32  Capabilities      __attribute__((packed));
    uInt32  VideoModePtr      __attribute__((packed));
    uInt16  TotalMemory       __attribute__((packed));
    // VESA 2.0 specific fields
    uInt16  OEMSoftwareRev    __attribute__((packed));
    uInt32  OEMVendorNamePtr  __attribute__((packed));
    uInt32  OEMProductNamePtr __attribute__((packed));
    uInt32  OEMProductRevPtr  __attribute__((packed));
    uInt8   paddington[474]   __attribute__((packed));
};

class ogDisplay_UbixOS : public ogSurface {
 protected:
  ogVESA_Rec*    VESARec;
  ogMode_Rec*    modeRec;
  uInt16         findMode(uInt32, uInt32, uInt32);
  void           getModeInfo(uInt16);
  void           getVESAInfo(void);
  void           setMode(uInt16);
  void		 setPal(void);
 public:
                 ogDisplay_UbixOS(void);
  virtual bool   ogAlias(ogSurface&, uInt32, uInt32, uInt32, uInt32);
  virtual bool   ogClone(ogSurface&);
  virtual void   ogCopyPal(ogSurface&);
  virtual bool   ogCreate(uInt32, uInt32, ogPixelFmt);
  virtual bool   ogLoadPal(const char *);
  virtual void   ogSetRGBPalette(uInt8, uInt8, uInt8, uInt8);
  virtual        ~ogDisplay_UbixOS(void);
}; // ogDisplay_UbixOS

#endif