1 // FIXME: Make these variables so we can also use modes like 800x600
2 #define SCREEN_X	640
3 #define SCREEN_Y	480
4 
5 #define SCREEN_STRIDE   80
6 
7 #define VGA_NORMAL 0
8 #define VGA_AND    8
9 #define VGA_OR     16
10 #define VGA_XOR    24
11 
12 //This is in mingw standard headers
13 //typedef struct { int quot, rem; } div_t;
14 
15 extern int maskbit[640];
16 extern int y80[480];
17 extern int xconv[640];
18 extern int bit8[640];
19 extern int startmasks[8];
20 extern int endmasks[8];
21 
22 extern UCHAR PreCalcReverseByte[256];
23 
24 extern PBYTE vidmem;
25 
26 #define MISC     0x3c2
27 #define SEQ      0x3c4
28 #define CRTC     0x3d4
29 #define GRAPHICS 0x3ce
30 #define FEATURE  0x3da
31 #define ATTRIB   0x3c0
32 #define STATUS   0x3da
33 
34 typedef struct _VideoMode {
35   unsigned short VidSeg;
36   unsigned char  Misc;
37   unsigned char  Feature;
38   unsigned char  Seq[5];
39   unsigned char  Crtc[25];
40   unsigned char  Gfx[9];
41   unsigned char  Attrib[21];
42 } VideoMode;
43 
44 VOID vgaPreCalc(VOID);
45 VOID vgaPutPixel(INT x, INT y, UCHAR c);
46 VOID vgaPutByte(INT x, INT y, UCHAR c);
47 VOID vgaGetByte(ULONG offset,
48                 UCHAR *b, UCHAR *g,
49                 UCHAR *r, UCHAR *i);
50 INT vgaGetPixel(INT x, INT y);
51 BOOL vgaHLine(INT x, INT y, INT len, UCHAR c);
52 BOOL vgaVLine(INT x, INT y, INT len, UCHAR c);
53 INT __cdecl abs(INT nm);
54 BOOL VGADDIIntersectRect(PRECTL prcDst, PRECTL prcSrc1, PRECTL prcSrc2);
55 
56 #define SEQ_I   0x3C4           /* Sequencer Index */
57 #define SEQ_D   0x3C5           /* Sequencer Data Register */
58 
59 #define GRA_I   0x3CE           /* Graphics Controller Index */
60 #define GRA_D   0x3CF           /* Graphics Controller Data Register */
61 
62 #define LowByte(w)  (*((unsigned char *)&(w) + 0))
63 #define HighByte(w) (*((unsigned char *)&(w) + 1))
64 
65 #define ASSIGNVP4(x, y, vp) vp = vidmem /* VBUF */ + (((x) + (y)*SCREEN_X) >> 3);
66 #define ASSIGNMK4(x, y, mask) mask = 0x80 >> ((x) & 7);
67 
68 void get_masks(int x, int w);
69 
70 #define mod8(n) ((n)&7)
71 #define mod2(n) ((n)&1)
72 void DIB_BltFromVGA(int x, int y, int w, int h, void *b, int Dest_lDelta);
73 void DIB_BltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta, int StartMod);
74 void DIB_BltToVGAWithXlate(int x, int y, int w, int h, void *b, int Source_lDelta, XLATEOBJ* Xlate);
75 void DIB_TransparentBltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta, ULONG trans);
76