OSDN Git Service

upgrade to 3.6.2
[jnethack/source.git] / sys / msdos / vesa.h
1 /* NetHack 3.6  vesa.h  $NHDT-Date: 1507161296 2017/10/04 23:54:56 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.0 $ */
2
3 /* VESA structures from the VESA BIOS Specification, retrieved 15 Jan 2016
4  * from http://flint.cs.yale.edu/cs422/readings/hardware/vbe3.pdf
5  * Part of rchason vesa port */
6
7 #ifndef VESA_H
8 #define VESA_H
9
10 #include <stdint.h>
11
12 struct VbeInfoBlock {
13     uint8_t  VbeSignature[4];   /* VBE Signature */
14     uint16_t VbeVersion;        /* VBE Version */
15     uint32_t OemStringPtr;      /* VbeFarPtr to OEM String */
16     uint32_t Capabilities;      /* Capabilities of graphics controller */
17     uint32_t VideoModePtr;      /* VbeFarPtr to VideoModeList */
18     uint16_t TotalMemory;       /* Number of 64kb memory blocks */
19     /* Added for VBE 2.0+ */
20     uint16_t OemSoftwareRev;    /* VBE implementation Software revision */
21     uint32_t OemVendorNamePtr;  /* VbeFarPtr to Vendor Name String */
22     uint32_t OemProductNamePtr; /* VbeFarPtr to Product Name String */
23     uint32_t OemProductRevPtr;  /* VbeFarPtr to Product Revision String */
24     uint8_t  Reserved[222];     /* Reserved for VBE implementation scratch area */
25     uint8_t  OemData[256];      /* Data Area for OEM Strings */
26 } __attribute__((packed));
27
28 struct ModeInfoBlock {
29     /* Mandatory information for all VBE revisions */
30     uint16_t ModeAttributes;        /* mode attributes */
31     uint8_t  WinAAttributes;        /* window A attributes */
32     uint8_t  WinBAttributes;        /* window B attributes */
33     uint16_t WinGranularity;        /* window granularity */
34     uint16_t WinSize;               /* window size */
35     uint16_t WinASegment;           /* window A start segment */
36     uint16_t WinBSegment;           /* window B start segment */
37     uint32_t WinFuncPtr;            /* real mode pointer to window function */
38     uint16_t BytesPerScanLine;      /* bytes per scan line */
39     /* Mandatory information for VBE 1.2 and above */
40     uint16_t XResolution;           /* horizontal resolution in pixels or characters */
41     uint16_t YResolution;           /* vertical resolution in pixels or characters */
42     uint8_t  XCharSize;             /* character cell width in pixels */
43     uint8_t  YCharSize;             /* character cell height in pixels */
44     uint8_t  NumberOfPlanes;        /* number of memory planes */
45     uint8_t  BitsPerPixel;          /* bits per pixel */
46     uint8_t  NumberOfBanks;         /* number of banks */
47     uint8_t  MemoryModel;           /* memory model type */
48     uint8_t  BankSize;              /* bank size in KB */
49     uint8_t  NumberOfImagePages;    /* number of images */
50     uint8_t  Reserved1;             /* reserved for page function */
51     /* Direct Color fields (required for direct/6 and YUV/7 memory models) */
52     uint8_t  RedMaskSize;           /* size of direct color red mask in bits */
53     uint8_t  RedFieldPosition;      /* bit position of lsb of red mask */
54     uint8_t  GreenMaskSize;         /* size of direct color green mask in bits */
55     uint8_t  GreenFieldPosition;    /* bit position of lsb of green mask */
56     uint8_t  BlueMaskSize;          /* size of direct color blue mask in bits */
57     uint8_t  BlueFieldPosition;     /* bit position of lsb of blue mask */
58     uint8_t  RsvdMaskSize;          /* size of direct color reserved mask in bits */
59     uint8_t  RsvdFieldPosition;     /* bit position of lsb of reserved mask */
60     uint8_t  DirectColorModeInfo;   /* direct color mode attributes */
61     /* Mandatory information for VBE 2.0 and above */
62     uint32_t PhysBasePtr;           /* physical address for flat memory frame buffer */
63     uint32_t Reserved2;             /* Reserved - always set to 0 */
64     uint16_t Reserved3;             /* Reserved - always set to 0 */
65     /* Mandatory information for VBE 3.0 and above */
66     uint16_t LinBytesPerScanLine;   /* bytes per scan line for linear modes */
67     uint8_t  BnkNumberOfImagePages; /* number of images for banked modes */
68     uint8_t  LinNumberOfImagePages; /* number of images for linear modes */
69     uint8_t  LinRedMaskSize;        /* size of direct color red mask (linear modes) */
70     uint8_t  LinRedFieldPosition;   /* bit position of lsb of red mask (linear modes) */
71     uint8_t  LinGreenMaskSize;      /* size of direct color green mask  (linear modes) */
72     uint8_t  LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */
73     uint8_t  LinBlueMaskSize;       /* size of direct color blue mask  (linear modes) */
74     uint8_t  LinBlueFieldPosition;  /* bit position of lsb of blue mask (linear modes) */
75     uint8_t  LinRsvdMaskSize;       /* size of direct color reserved mask (linear modes) */
76     uint8_t  LinRsvdFieldPosition;  /* bit position of lsb of reserved mask (linear modes) */
77     uint32_t MaxPixelClock;         /* maximum pixel clock (in Hz) for graphics mode */
78     uint8_t  Reserved4[189];        /* remainder of ModeInfoBlock */
79 } __attribute__((packed));
80
81 #endif