fix dos build
[retroray] / src / dos / vga.h
1 #ifndef VGA_H_
2 #define VGA_H_
3
4 #include "sizeint.h"
5 #include "dosutil.h"
6 #include "cdpmi.h"
7 #include "vgaregs.h"
8
9 #define VGA_FBADDR      ((void*)phys_to_virt(0xa0000))
10
11 int vga_setmode(int mode);
12 int vga_setmodex(void);
13
14 #define vga_planemask(mask)             vga_sc_write(VGA_SC_MAPMASK_REG, mask)
15
16 #ifdef __WATCOMC__
17 void vga_setpal(int16_t idx, uint8_t r, uint8_t g, uint8_t b);
18 #pragma aux vga_setpal = \
19         "test ax, 0x8000" \
20         "jnz skip_dacaddr" \
21         "mov dx, 0x3c8" \
22         "out dx, al" \
23         "skip_dacaddr:" \
24         "mov dx, 0x3c9" \
25         "mov al, bl" \
26         "shr al, 2" \
27         "out dx, al" \
28         "mov al, bh" \
29         "shr al, 2" \
30         "out dx, al" \
31         "mov al, cl" \
32         "shr al, 2" \
33         "out dx, al" \
34         parm[ax][bl][bh][cl] \
35         modify[dx];
36 #endif /* __WATCOMC__ */
37
38 #define vga_sc_write(reg, data) \
39         outpw(VGA_SC_ADDR_PORT, (uint16_t)(reg) | ((uint16_t)(data) << 8))
40 #define vga_sc_read(reg) \
41         (outp(VGA_SC_ADDR_PORT, reg), inp(VGA_SC_DATA_PORT))
42 #define vga_crtc_write(reg, data) \
43         outpw(VGA_CRTC_PORT, (uint16_t)(reg) | ((uint16_t)(data) << 8))
44 #define vga_crtc_read(reg) \
45         (outp(VGA_CRTC_ADDR_PORT, reg), inp(VGA_CRTC_DATA_PORT))
46 #define vga_crtc_wrmask(reg, data, mask) \
47         outp(VGA_CRTC_DATA_PORT, (crtc_read(reg) & ~(mask)) | (data))
48
49 #endif  /* VGA_H_ */