X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fdos%2Fgfx.h;h=109bbcf6686f961f6e170af00294bbb1030852d6;hp=b19c99249c24793efb46239ccabc8ffaf1245735;hb=5f36e95f19ad8d7a5a1dd546ffeb54ce95d51749;hpb=0165ec15f868a16a70b56ada2d42db0cb69ea193 diff --git a/src/dos/gfx.h b/src/dos/gfx.h index b19c992..109bbcf 100644 --- a/src/dos/gfx.h +++ b/src/dos/gfx.h @@ -15,7 +15,43 @@ int get_color_mask(unsigned int *rmask, unsigned int *gmask, unsigned int *bmask void set_palette(int idx, int r, int g, int b); +enum { + FLIP_NOW, + FLIP_VBLANK, + FLIP_VBLANK_WAIT +}; +/* page flip and return pointer to the start of the display area (front buffer) */ +void *page_flip(int vsync); + +#ifdef __WATCOMC__ void wait_vsync(void); +#pragma aux wait_vsync = \ + "mov dx, 0x3da" \ + "l1:" \ + "in al, dx" \ + "and al, 0x8" \ + "jnz l1" \ + "l2:" \ + "in al, dx" \ + "and al, 0x8" \ + "jz l2" \ + modify[al dx]; +#endif + +#ifdef __DJGPP__ +#define wait_vsync() asm volatile ( \ + "mov $0x3da, %%dx\n\t" \ + "0:\n\t" \ + "in %%dx, %%al\n\t" \ + "and $8, %%al\n\t" \ + "jnz 0b\n\t" \ + "0:\n\t" \ + "in %%dx, %%al\n\t" \ + "and $8, %%al\n\t" \ + "jz 0b\n\t" \ + :::"%eax","%edx") +#endif + #ifdef __cplusplus }