wolf3d

The original open source release of Wolfenstein 3D
Log | Files | Refs

ID_VL.H (4532B)


      1 // ID_VL.H
      2 
      3 // wolf compatability
      4 
      5 #define MS_Quit	Quit
      6 
      7 void Quit (char *error);
      8 
      9 //===========================================================================
     10 
     11 
     12 #define SC_INDEX			0x3C4
     13 #define SC_RESET			0
     14 #define SC_CLOCK			1
     15 #define SC_MAPMASK			2
     16 #define SC_CHARMAP			3
     17 #define SC_MEMMODE			4
     18 
     19 #define CRTC_INDEX			0x3D4
     20 #define CRTC_H_TOTAL		0
     21 #define CRTC_H_DISPEND		1
     22 #define CRTC_H_BLANK		2
     23 #define CRTC_H_ENDBLANK		3
     24 #define CRTC_H_RETRACE		4
     25 #define CRTC_H_ENDRETRACE 	5
     26 #define CRTC_V_TOTAL		6
     27 #define CRTC_OVERFLOW		7
     28 #define CRTC_ROWSCAN		8
     29 #define CRTC_MAXSCANLINE 	9
     30 #define CRTC_CURSORSTART 	10
     31 #define CRTC_CURSOREND		11
     32 #define CRTC_STARTHIGH		12
     33 #define CRTC_STARTLOW		13
     34 #define CRTC_CURSORHIGH		14
     35 #define CRTC_CURSORLOW		15
     36 #define CRTC_V_RETRACE		16
     37 #define CRTC_V_ENDRETRACE 	17
     38 #define CRTC_V_DISPEND		18
     39 #define CRTC_OFFSET			19
     40 #define CRTC_UNDERLINE		20
     41 #define CRTC_V_BLANK		21
     42 #define CRTC_V_ENDBLANK		22
     43 #define CRTC_MODE			23
     44 #define CRTC_LINECOMPARE 	24
     45 
     46 
     47 #define GC_INDEX			0x3CE
     48 #define GC_SETRESET			0
     49 #define GC_ENABLESETRESET 	1
     50 #define GC_COLORCOMPARE		2
     51 #define GC_DATAROTATE		3
     52 #define GC_READMAP			4
     53 #define GC_MODE				5
     54 #define GC_MISCELLANEOUS 	6
     55 #define GC_COLORDONTCARE 	7
     56 #define GC_BITMASK			8
     57 
     58 #define ATR_INDEX			0x3c0
     59 #define ATR_MODE			16
     60 #define ATR_OVERSCAN		17
     61 #define ATR_COLORPLANEENABLE 18
     62 #define ATR_PELPAN			19
     63 #define ATR_COLORSELECT		20
     64 
     65 #define	STATUS_REGISTER_1    0x3da
     66 
     67 #define PEL_WRITE_ADR		0x3c8
     68 #define PEL_READ_ADR		0x3c7
     69 #define PEL_DATA			0x3c9
     70 
     71 
     72 //===========================================================================
     73 
     74 #define SCREENSEG		0xa000
     75 
     76 #define SCREENWIDTH		80			// default screen width in bytes
     77 #define MAXSCANLINES	200			// size of ylookup table
     78 
     79 #define CHARWIDTH		2
     80 #define TILEWIDTH		4
     81 
     82 //===========================================================================
     83 
     84 extern	unsigned	bufferofs;			// all drawing is reletive to this
     85 extern	unsigned	displayofs,pelpan;	// last setscreen coordinates
     86 
     87 extern	unsigned	screenseg;			// set to 0xa000 for asm convenience
     88 
     89 extern	unsigned	linewidth;
     90 extern	unsigned	ylookup[MAXSCANLINES];
     91 
     92 extern	boolean		screenfaded;
     93 extern	unsigned	bordercolor;
     94 
     95 //===========================================================================
     96 
     97 //
     98 // VGA hardware routines
     99 //
    100 
    101 #define VGAWRITEMODE(x) asm{\
    102 cli;\
    103 mov dx,GC_INDEX;\
    104 mov al,GC_MODE;\
    105 out dx,al;\
    106 inc dx;\
    107 in al,dx;\
    108 and al,252;\
    109 or al,x;\
    110 out dx,al;\
    111 sti;}
    112 
    113 #define VGAMAPMASK(x) asm{cli;mov dx,SC_INDEX;mov al,SC_MAPMASK;mov ah,x;out dx,ax;sti;}
    114 #define VGAREADMAP(x) asm{cli;mov dx,GC_INDEX;mov al,GC_READMAP;mov ah,x;out dx,ax;sti;}
    115 
    116 
    117 void VL_Startup (void);
    118 void VL_Shutdown (void);
    119 
    120 void VL_SetVGAPlane (void);
    121 void VL_SetTextMode (void);
    122 void VL_DePlaneVGA (void);
    123 void VL_SetVGAPlaneMode (void);
    124 void VL_ClearVideo (byte color);
    125 
    126 void VL_SetLineWidth (unsigned width);
    127 void VL_SetSplitScreen (int linenum);
    128 
    129 void VL_WaitVBL (int vbls);
    130 void VL_CrtcStart (int crtc);
    131 void VL_SetScreen (int crtc, int pelpan);
    132 
    133 void VL_FillPalette (int red, int green, int blue);
    134 void VL_SetColor	(int color, int red, int green, int blue);
    135 void VL_GetColor	(int color, int *red, int *green, int *blue);
    136 void VL_SetPalette (byte far *palette);
    137 void VL_GetPalette (byte far *palette);
    138 void VL_FadeOut (int start, int end, int red, int green, int blue, int steps);
    139 void VL_FadeIn (int start, int end, byte far *palette, int steps);
    140 void VL_ColorBorder (int color);
    141 
    142 void VL_Plot (int x, int y, int color);
    143 void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color);
    144 void VL_Vlin (int x, int y, int height, int color);
    145 void VL_Bar (int x, int y, int width, int height, int color);
    146 
    147 void VL_MungePic (byte far *source, unsigned width, unsigned height);
    148 void VL_DrawPicBare (int x, int y, byte far *pic, int width, int height);
    149 void VL_MemToLatch (byte far *source, int width, int height, unsigned dest);
    150 void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height);
    151 void VL_MemToScreen (byte far *source, int width, int height, int x, int y);
    152 void VL_MaskedToScreen (byte far *source, int width, int height, int x, int y);
    153 
    154 void VL_DrawTile8String (char *str, char far *tile8ptr, int printx, int printy);
    155 void VL_DrawLatch8String (char *str, unsigned tile8ptr, int printx, int printy);
    156 void VL_SizeTile8String (char *str, int *width, int *height);
    157 void VL_DrawPropString (char *str, unsigned tile8ptr, int printx, int printy);
    158 void VL_SizePropString (char *str, int *width, int *height, char far *font);
    159 
    160 void VL_TestPaletteSet (void);
    161