X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_vl.h;h=af357b08c09d85874f74868749b27d5ab70350e9;hb=3d7af30456302e0bf6accc07431e8210b3af052e;hp=41e037629bc0b6f99d52da93bd45f9b2b4bbe11b;hpb=45f3e2d77b5287888a171d442f74ca4e0e807d9b;p=16.git diff --git a/src/lib/16_vl.h b/src/lib/16_vl.h index 41e03762..af357b08 100755 --- a/src/lib/16_vl.h +++ b/src/lib/16_vl.h @@ -26,7 +26,6 @@ #define MODEX16_H #include "src/lib/16_head.h" -#include "src/lib/bitmap.h" //#include "src/lib/planar.h" //#include "src/lib/modex16/16planar.h" #include "src/lib/16text.h" @@ -36,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,7 +49,14 @@ #define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2)) #define PLANE(x) (1 << ((x) & 3)) #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02) -#define PALSIZE 768 + +// 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 { @@ -75,17 +73,62 @@ 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 #define VRETRACE 0x08 //#define INPUT_STATUS_1 0x03da defined in 16_head +#define STATUS_REGISTER_1 INPUT_STATUS_1 +#define ATR_INDEX AC_INDEX +#define ATR_OVERSCAN 17 #define DISPLAY_ENABLE 0x01 #define MAP_MASK 0x02 #define PAL_READ_REG 0x03C7 /* Color register, read address */ @@ -93,12 +136,36 @@ extern byte far* VGA; /* The VGA Memory */ #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 VGAMAPMASK(byte x); +void VGAWRITEMODE(byte x); +void VGAREADMAP(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_SetLineWidth (unsigned width, ofs_t *ofs); void modexsetBaseXMode(); page_t modexDefaultPage(page_t *p); page_t modexNextPage(page_t *p); @@ -115,6 +182,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); @@ -122,21 +190,26 @@ void modexFlashOff(word fade, byte *palette); /* palette loading and saving */ void modexPalSave(byte *palette); -byte *modexNewPal(); -void modexLoadPalFile(char *filename, 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 modexSavePalFile(char *filename, byte *palette); +#define MenuFadeIn() VL_FadeIn(0,255,&gamepal,10) /* fixed palette functions */ void modexPalBlack(); void modexPalWhite(); /* utility functions */ -void modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset); -void modexPalUpdate1(byte *p); +void modexPalUpdate(byte *p); void modexPalUpdate0(byte *p); -void modexPalOverscan(word col); -void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/); +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 modexputPixel(page_t *page, int x, int y, byte color); byte modexgetPixel(page_t *page, int x, int y); @@ -167,12 +240,15 @@ 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, word x, word y, word t, 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 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_PrintmodexmemInfo(video_t *v); #endif