the rewrite branch builds, not tested yet
[dosdemo] / src / dos / gfx.h
1 #ifndef GFX_H_
2 #define GFX_H_
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 void *set_video_mode(int xsz, int ysz, int bpp);
9 int set_text_mode(void);
10
11 int get_color_depth(void);
12 int get_color_bits(int *rbits, int *gbits, int *bbits);
13 int get_color_shift(int *rshift, int *gshift, int *bshift);
14 int get_color_mask(unsigned int *rmask, unsigned int *gmask, unsigned int *bmask);
15
16 void set_palette(int idx, int r, int g, int b);
17
18 enum {
19         FLIP_NOW,
20         FLIP_VBLANK,
21 };
22 /* page flip and return pointer to the start of the display area (front buffer) */
23 void *page_flip(int vsync);
24
25 #ifdef __WATCOMC__
26 void wait_vsync(void);
27 #pragma aux wait_vsync = \
28         "mov dx, 0x3da" \
29         "l1:" \
30         "in al, dx" \
31         "and al, 0x8" \
32         "jnz l1" \
33         "l2:" \
34         "in al, dx" \
35         "and al, 0x8" \
36         "jz l2" \
37         modify[al dx];
38 #endif
39
40 #ifdef __DJGPP__
41 #define wait_vsync()  asm volatile ( \
42         "mov $0x3da, %%dx\n\t" \
43         "0:\n\t" \
44         "in %%dx, %%al\n\t" \
45         "and $8, %%al\n\t" \
46         "jnz 0b\n\t" \
47         "0:\n\t" \
48         "in %%dx, %%al\n\t" \
49         "and $8, %%al\n\t" \
50         "jz 0b\n\t" \
51         :::"%eax","%edx")
52 #endif
53
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif  /* GFX_H_ */