1 /* SCCS Id: @(#)pcvideo.h 3.4 1994/06/07 */
2 /* Copyright (c) NetHack PC Development Team 1993, 1994 */
3 /* NetHack may be freely redistributed. See license for details. */
6 * pcvideo.h - Hardware video support definitions and prototypes
9 * Initial Creation M. Allison 93/10/30
20 # define MONO_CHECK /* Video BIOS can do the check */
24 # ifdef SCREEN_DJGPPFAST
25 /*# define MONO_CHECK /* djgpp should be able to do check */
33 #define DOS_EXT_FUNC 0xdc
34 #define DIRECT_CON_IO 0x10
36 #define VIDEO_BIOS 0x10
42 * Video BIOS functions
45 #define SENSEMODE 0x0b /* Sense CRT Mode */
47 #define PUTCHAR 0x00 /* Put Character */
48 #define SETATT 0x02 /* Set Attribute */
49 #define SETCURPOS 0x03 /* Set Cursor Position */
50 #define CURSOR_RIGHT 0x08 /* Move Cursor Right */
51 #define CURSOR_LEFT 0x09 /* Move Cursor Left */
52 #define SCREEN_CLEAR 0x0a /* Clear Screen */
53 #define LINE_CLEAR 0x0b /* Clear Line */
55 #define SETCURPOS 0x02 /* Set Cursor Position */
58 #define GETCURPOS 0x03 /* Get Cursor Position */
59 #define GETMODE 0x0f /* Get Video Mode */
60 #define SETMODE 0x00 /* Set Video Mode */
61 #define SETPAGE 0x05 /* Set Video Page */
62 #define FONTINFO 0x1130 /* Get Font Info */
63 #define SCROLL 0x06 /* Scroll or initialize window */
64 #define PUTCHARATT 0x09 /* Write attribute & char at cursor */
70 /* #define HW_PANNING /* Hardware panning enabled */
71 #define USHORT unsigned short
72 #define MODE640x480 0x0012 /* Switch to VGA 640 x 480 Graphics mode */
73 #define MODETEXT 0x0003 /* Switch to Text mode 3 */
76 #define PIXELINC 16 /* How much to increment by when panning */
77 /*#define PIXELINC 1 /* How much to increment by when panning */
78 #define SCREENBYTES 128
80 #define VERT_RETRACE {while (!(inportb(crt_status) & 0x08)); }
81 #define VERT_RETRACE_END {while ( (inportb(crt_status) & 0x08)); }
83 #define SCREENBYTES 80
86 #define CharacterWidth 8
87 #define SCREENHEIGHT 480
88 #define SCREENWIDTH (SCREENBYTES * CharacterWidth)
89 #define VIDEOSEG 0xa000
90 #define FONT_PTR_SEGMENT 0x0000
91 #define FONT_PTR_OFFSET 0x010C
92 #define SCREENPLANES 4
94 #define egawriteplane(n) { outportb(0x3c4,2); outportb(0x3c5,n); }
95 #define egareadplane(n) { outportb(0x3ce,4); outportb(0x3cf,n); }
96 #define col2x8(c) ((c) * 8)
97 #define col2x16(c) ((c) * 16)
98 #define col2x(c) ((c) * 2)
99 #define row2y(c) ((c) * 16)
100 #define MAX_ROWS_PER_CELL 16
101 #define MAX_COLS_PER_CELL 16
102 #define MAX_BYTES_PER_CELL 2 /* MAX_COLS_PER_CELL/8 */
103 #define ROWS_PER_CELL MAX_ROWS_PER_CELL
104 #define COLS_PER_CELL MAX_COLS_PER_CELL
105 #define BYTES_PER_CELL MAX_BYTES_PER_CELL
108 char image[MAX_ROWS_PER_CELL][MAX_BYTES_PER_CELL];
111 struct planar_cell_struct {
112 struct cellplane plane[SCREENPLANES];
115 struct overview_cellplane {
116 char image[MAX_ROWS_PER_CELL][1];
119 struct overview_planar_cell_struct {
120 struct overview_cellplane plane[SCREENPLANES];
125 # endif /* SCREEN_VGA */
129 * Default color Indexes for hardware palettes
131 * Do not change the values below.
132 * These are the color mappings defined by the particular video
133 * hardware/mode. You can rearrange the NetHack color mappings at
134 * run-time via the defaults.nh "videocolors" and "videoshades"
139 # if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)
142 #define M_GRAY 7 /* low-intensity white */
145 #define M_BROWN 6 /* low-intensity yellow */
150 #define M_BRIGHTGREEN 10
152 #define M_BRIGHTBLUE 9
153 #define M_BRIGHTMAGENTA 13
154 #define M_BRIGHTCYAN 11
156 #define M_TEXT M_GRAY
157 #define BACKGROUND_COLOR 0
158 #define ATTRIB_NORMAL M_TEXT /* Normal attribute */
159 #define ATTRIB_INTENSE M_WHITE /* Intense White */
160 #define ATTRIB_MONO_NORMAL 0x01 /* Underlined,white */
161 #define ATTRIB_MONO_UNDERLINE 0x01 /* Underlined,white */
162 #define ATTRIB_MONO_BLINK 0x87 /* Flash bit, white */
163 #define ATTRIB_MONO_REVERSE 0x70 /* Black on white */
164 # endif /*SCREEN_BIOS || SCREEN_DJGPPFAST */
166 # if defined(SCREEN_VGA) || defined(SCREEN_8514)
167 #define BACKGROUND_VGA_COLOR 0
168 #define ATTRIB_VGA_NORMAL CLR_GRAY /* Normal attribute */
169 #define ATTRIB_VGA_INTENSE 13 /* Intense White 94/06/07 palette chg*/
170 # endif /*SCREEN_VGA || SCREEN_8514*/
173 static unsigned char attr98[CLR_MAX] = {
179 0x61, /* 5 magenta */
183 0x25, /* 9 reversed blue */
184 0x85, /* 10 reversed green */
185 0xa5, /* 11 reversed cyan */
186 0x45, /* 12 reversed red */
187 0x65, /* 13 reversed magenta */
188 0xc5, /* 14 reversed yellow */
189 0xe5, /* 15 reversed white */
193 # ifdef SIMULATE_CURSOR
194 #define CURSOR_HEIGHT 3 /* this should go - MJA */
196 #define CURSOR_INVIS 0 /* cursor not visible at all */
197 #define CURSOR_FRAME 1 /* block around the current tile */
198 #define CURSOR_UNDERLINE 2 /* thin line at bottom of the tile */
199 #define CURSOR_CORNER 3 /* cursor visible at the 4 tile corners */
200 #define NUM_CURSOR_TYPES 4 /* number of different cursor types */
201 #define CURSOR_DEFAULT_STYLE CURSOR_CORNER
202 #define CURSOR_DEFAULT_COLOR M_GRAY
203 /* global variables for cursor */
204 extern int cursor_type;
205 extern int cursor_flag;
206 extern int cursor_color;
211 * Function Prototypes
217 /* ### video.c ### */
219 # ifdef SIMULATE_CURSOR
220 E void NDECL(DrawCursor);
221 E void NDECL(HideCursor);
224 /* ### vidtxt.c ### */
227 E void NDECL(txt_backsp);
228 E void NDECL(txt_clear_screen);
229 E void FDECL(txt_cl_end,(int,int));
230 E void NDECL(txt_cl_eos);
231 E void NDECL(txt_get_scr_size);
232 E void FDECL(txt_gotoxy,(int,int));
233 E int NDECL(txt_monoadapt_check);
234 E void NDECL(txt_nhbell);
235 E void FDECL(txt_startup,(int*,int*));
236 E void FDECL(txt_xputs, (const char *, int, int));
237 E void FDECL(txt_xputc, (CHAR_P, int));
239 /* ### vidvga.c ### */
242 E void NDECL(vga_backsp);
243 E void FDECL(vga_clear_screen,(int));
244 E void FDECL(vga_cl_end,(int,int));
245 E void FDECL(vga_cl_eos,(int));
246 E int NDECL(vga_detect);
247 # ifdef SIMULATE_CURSOR
248 E void NDECL(vga_DrawCursor);
250 E void FDECL(vga_DisplayCell, (struct planar_cell_struct *, int, int));
251 E void FDECL(vga_DisplayCell_O,
252 (struct overview_planar_cell_struct *, int, int));
253 E void NDECL(vga_Finish);
254 E char __far *NDECL(vga_FontPtrs);
255 E void NDECL(vga_get_scr_size);
256 E void FDECL(vga_gotoloc,(int,int));
258 E void FDECL(vga_update_positionbar, (char *));
260 # ifdef SIMULATE_CURSOR
261 E void NDECL(vga_HideCursor);
263 E void NDECL(vga_Init);
264 E void FDECL(vga_SwitchMode, (unsigned int));
265 E void FDECL(vga_SetPalette, (char *));
266 E void NDECL(vga_tty_end_screen);
267 E void FDECL(vga_tty_startup,(int*,int*));
268 E void FDECL(vga_WriteChar, (int, int, int, int));
269 E void FDECL(vga_WriteStr, (char *, int, int, int, int));
270 E void FDECL(vga_xputs, (const char *, int, int));
271 E void FDECL(vga_xputc, (CHAR_P, int));
272 E void FDECL(vga_xputg, (int, int, unsigned));
273 E void FDECL(vga_userpan, (BOOLEAN_P));
274 E void FDECL(vga_overview, (BOOLEAN_P));
275 E void FDECL(vga_traditional, (BOOLEAN_P));
276 E void NDECL(vga_refresh);
277 # endif /* SCREEN_VGA */
278 # endif /* NO_TERMS */
282 #endif /* PCVIDEO_H */