X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_vl.h;h=519b1026588cfe89d463036bcf7d1154d71a34aa;hb=320be82ab5e414d1b771b295403218b614ed9d13;hp=cec79507ad5189ec035ab3b06fe07a36ea6aabf7;hpb=52fab2ff9ef6a39ed9303b0df1ce0ad9c9180ef1;p=16.git diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index cec79507..519b1026 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -35,14 +35,6 @@ // #include "src/lib/modex16/192x144_.h" // #include "src/lib/modex16/160x120.h" -#ifdef __WATCOMC__ -#include -#include -#include -#include -#include -#endif - //320x240 = 20x15 //192x144 = 12x9 @@ -58,6 +50,14 @@ #define PLANE(x) (1 << ((x) & 3)) #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02) +// clips for rectangles not on 4s +#define LRCLIPDEF \ + static byte lclip[4] = {0x0f, 0x0e, 0x0c, 0x08}; \ + static byte rclip[4] = {0x00, 0x01, 0x03, 0x07}; + +#define VCLIPDEF \ + static byte pclip[4] = {1,2,4,8}; + typedef union { byte red; @@ -73,12 +73,54 @@ extern byte far* VGA; /* The VGA Memory */ #define VGA_256_COLOR_MODE 0x13 #define TEXT_MODE 0x03 -#define AC_INDEX 0x03c0 #define SC_INDEX 0x03c4 +#define SC_RESET 0 +#define SC_CLOCK 1 +#define SC_MAPMASK 2 +#define SC_CHARMAP 3 +#define SC_MEMMODE 4 + +#define CRTC_INDEX 0x3D4 +#define CRTC_H_TOTAL 0 +#define CRTC_H_DISPEND 1 +#define CRTC_H_BLANK 2 +#define CRTC_H_ENDBLANK 3 +#define CRTC_H_RETRACE 4 +#define CRTC_H_ENDRETRACE 5 +#define CRTC_V_TOTAL 6 +#define CRTC_OVERFLOW 7 +#define CRTC_ROWSCAN 8 +#define CRTC_MAXSCANLINE 9 +#define CRTC_CURSORSTART 10 +#define CRTC_CURSOREND 11 +#define CRTC_STARTHIGH 12 +#define CRTC_STARTLOW 13 +#define CRTC_CURSORHIGH 14 +#define CRTC_CURSORLOW 15 +#define CRTC_V_RETRACE 16 +#define CRTC_V_ENDRETRACE 17 +#define CRTC_V_DISPEND 18 +#define CRTC_OFFSET 19 +#define CRTC_UNDERLINE 20 +#define CRTC_V_BLANK 21 +#define CRTC_V_ENDBLANK 22 +#define CRTC_MODE 23 +#define CRTC_LINECOMPARE 24 + +#define GC_INDEX 0x03ce +#define GC_SETRESET 0 +#define GC_ENABLESETRESET 1 +#define GC_COLORCOMPARE 2 +#define GC_DATAROTATE 3 +#define GC_READMAP 4 +#define GC_MODE 5 +#define GC_MISCELLANEOUS 6 +#define GC_COLORDONTCARE 7 +#define GC_BITMASK 8 + +#define AC_INDEX 0x03c0 #define SC_DATA 0x03c5 -#define CRTC_INDEX 0x03d4 #define CRTC_DATA 0x03d5 -#define GC_INDEX 0x03ce #define MISC_OUTPUT 0x03c2 #define HIGH_ADDRESS 0x0C #define LOW_ADDRESS 0x0D @@ -88,20 +130,50 @@ extern byte far* VGA; /* The VGA Memory */ #define ATR_INDEX AC_INDEX #define ATR_OVERSCAN 17 #define DISPLAY_ENABLE 0x01 -#define MAP_MASK 0x02 +//#define MAP_MASK 0x02 #define PAL_READ_REG 0x03C7 /* Color register, read address */ #define PAL_WRITE_REG 0x03C8 /* Color register, write address */ #define PAL_DATA_REG 0x03C9 /* Color register, data port */ #define PAL_SIZE (256 * 3) +//=========================================================================== + +#define SCREENSEG 0xa000 + +//#define SCREENWIDTH 80 // default screen width in bytes +//#define MAXSCANLINES 240 // size of ylookup table + +//#define CHARWIDTH 2 +//#define TILEWIDTH 4 + +//=========================================================================== + +// +// VGA hardware routines +// +void VGAWRITEMODE(byte x), + VGAMAPMASK(byte x), + VGAREADMAP(byte x), + VGABITMASK(byte x); + +#define VW_Hlin(x,z,y,c,q) VL_Hlin(x,y,(z)-(x)+1,c,q) +#define VW_Vlin(y,z,x,c,q) VL_Vlin(x,y,(z)-(y)+1,c,q) + /* -============================ Functions =============================- */ /* mode switching, page, and plane functions */ -void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv); -void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv); -byte vgaGetMode(); -void modexLeave(); +void VL_Startup (global_game_variables_t *gvar), + VL_Shutdown (global_game_variables_t *gvar), + VL_SetVGAPlaneMode (global_game_variables_t *gvar), + VL_ClearVideo (byte color), + VL_DePlaneVGA (), + VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv), + modexEnter(sword vq, boolean cmem, global_game_variables_t *gv); +void VL_vgaSetMode(byte mode); +byte VL_vgaGetMode(void); +extern void TL_VidInit(global_game_variables_t *gvar); +void modexLeave(void); void modexsetBaseXMode(); -page_t modexDefaultPage(page_t *p); +page_t modexDefaultPage(page_t *p, video_t *v); page_t modexNextPage(page_t *p); page_t modexNextPageFlexibleSize(page_t *p, word x, word y); void modexCalcVmemRemain(video_t *video); @@ -116,6 +188,7 @@ void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color); void modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); /* Palette fade and flash effects */ +void VL_FadeIn (int start, int end, byte far *palette, int steps, video_t *v); void modexFadeOn(word fade, byte *palette); void modexFadeOff(word fade, byte *palette); void modexFlashOn(word fade, byte *palette); @@ -125,10 +198,13 @@ void modexFlashOff(word fade, byte *palette); void modexPalSave(byte *palette); //byte *modexNewPal(); void modexLoadPalFile(char *filename, byte *palette); -void VL_LoadPalFile(const char *filename, byte *palette); -void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o); -void VL_UpdatePaletteWrite(byte *palette, word o); +void VL_LoadPalFile(const char *filename, byte *palette, global_game_variables_t *gvar); +void VL_LoadPalFileCore(byte *palette, global_game_variables_t *gvar); +void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, global_game_variables_t *gvar); +void VL_UpdatePaletteWrite(byte *palette, word o, global_game_variables_t *gvar); +void VL_PaletteSync(global_game_variables_t *gvar); void modexSavePalFile(char *filename, byte *palette); +#define MenuFadeIn() VL_FadeIn(0,255,&gamepal,10) /* fixed palette functions */ void modexPalBlack(); @@ -136,8 +212,13 @@ void modexPalWhite(); /* utility functions */ void modexPalUpdate(byte *p); -void modexPalUpdate0(byte *p); -void modexPalOverscan(word col); +void VL_modexPalScramble(byte *p); +word modexPalOverscan(word col); +void VL_Plot (int x, int y, int color, ofs_t *ofs); +void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs); +void VL_Vlin (int x, int y, int height, int color, ofs_t *ofs); +void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs); +void VL_MemToScreen (byte far *source, int width, int height, int x, int y, ofs_t *ofs); void modexputPixel(page_t *page, int x, int y, byte color); byte modexgetPixel(page_t *page, int x, int y); @@ -168,14 +249,16 @@ static inline byte modexreadPixel(page_t *page, int x, int y, word addr) #endif void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, word col, word bgcol, word addr); -void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, const byte *str); +void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, boolean sw, const byte *str); void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str); +void VL_modexPrintTextBox(global_game_variables_t *gvar); void modexpdump(page_t *pee); -void modexcls(page_t *page, byte color, byte *Where); void VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw); void modexWaitBorder(); void modexWaitBorder_start(); void modexWaitBorder_end(); +void VL_WaitVBL(word num); +void VL_SetLineWidth (unsigned width, global_game_variables_t *gvar); void VL_PrintmodexmemInfo(video_t *v); #endif