switched to vidsys (not working yet)
[retroray] / src / dos / vga.h
1 #ifndef VGA_H_
2 #define VGA_H_
3
4 /* ---- VGA registers ---- */
5 #define VGA_AC_PORT             0x3c0
6 #define VGA_AC_RD_PORT          0x3c1
7 #define VGA_SC_ADDR_PORT        0x3c4
8 #define VGA_SC_DATA_PORT        0x3c5
9 #define VGA_DAC_STATUS_PORT     0x3c7
10 #define VGA_DAC_RADDR_PORT      0x3c7
11 #define VGA_DAC_WADDR_PORT      0x3c8
12 #define VGA_DAC_DATA_PORT       0x3c9
13 #define VGA_GC_ADDR_PORT        0x3ce
14 #define VGA_GC_DATA_PORT        0x3cf
15 #define VGA_CRTC_PORT           0x3d4
16 #define VGA_CRTC_ADDR_PORT      0x3d4
17 #define VGA_CRTC_DATA_PORT      0x3d5
18 #define VGA_STAT0_PORT          0x3c2
19 #define VGA_STAT1_PORT          0x3da
20 #define VGA_MISC_PORT           0x3c2
21 #define VGA_MISC_RD_PORT        0x3cc
22
23 /* attribute controller registers */
24 #define VGA_AC_EN               0x20
25 #define VGA_AC_MODE_REG         0x10
26
27 /* sequence controller registers */
28 #define VGA_SC_RESET_REG        0x00
29 #define VGA_SC_CLOCK_REG        0x01
30 #define VGA_SC_MAPMASK_REG      0x02
31 #define VGA_SC_MEMMODE_REG      0x04
32
33 /* graphics controller registers */
34 #define VGA_GC_SR_REG           0x00
35 #define VGA_GC_SREN_REG         0x01
36 #define VGA_GC_ROT_REG          0x03
37 #define VGA_GC_MODE_REG         0x05
38 #define VGA_GC_MASK_REG         0x08
39
40 /* attribute controller mode register (10h) bits */
41 #define VGA_AC_MODE_GFX         0x01
42 #define VGA_AC_MODE_MONO        0x02
43 #define VGA_AC_MODE_LGE         0x04
44 #define VGA_AC_MODE_BLINK       0x08
45 #define VGA_AC_MODE_PIXPAN      0x20
46 #define VGA_AC_MODE_8BIT        0x40
47
48 /* misc register bits */
49 #define VGA_MISC_COLOR          0x01
50 #define VGA_MISC_CPUEN          0x02
51 #define VGA_MISC_CLK25          0
52 #define VGA_MISC_CLK28          0x04
53 #define VGA_MISC_PG1            0x20
54 #define VGA_MISC_400            0
55 #define VGA_MISC_350            0x40
56 #define VGA_MISC_480            0xc0
57
58
59 /* CRTC registers */
60 #define CRTC_HTOTAL_REG         0x00
61 #define CRTC_HEND_REG           0x01
62 #define CRTC_HBLSTART_REG       0x02
63 #define CRTC_HBLEND_REG         0x03
64 #define CRTC_HRETSTART_REG      0x04
65 #define CRTC_HRETEND_REG        0x05
66 #define CRTC_VTOTAL_REG         0x06
67 #define CRTC_OVF_REG            0x07
68 #define CRTC_PRESET_REG         0x08
69 #define CRTC_MAXSCAN_REG        0x09
70 #define CRTC_CURSTART_REG       0x0a
71 #define CRTC_CUREND_REG         0x0b
72 #define CRTC_STARTH_REG         0x0c
73 #define CRTC_STARTL_REG         0x0d
74 #define CRTC_CURH_REG           0x0e
75 #define CRTC_CURL_REG           0x0f
76 #define CRTC_VRETSTART_REG      0x10
77 #define CRTC_VRETEND_REG        0x11
78 #define CRTC_VEND_REG           0x12
79 #define CRTC_OFFSET_REG         0x13
80 #define CRTC_UL_REG             0x14
81 #define CRTC_VBLSTART_REG       0x15
82 #define CRTC_VBLEND_REG         0x16
83 #define CRTC_MODE_REG           0x17
84 #define CRTC_LCMP_REG           0x18
85
86 /* CRTC register bits */
87 #define CRTC_VRETEND_PR         0x80
88
89 void vga_vsync(void);
90 void vga_setpal(int idx, int count, const struct vid_color *col);
91 void vga_getpal(int idx, int count, struct vid_color *col);
92
93 #endif  /* VGA_H_ */