1 /* aNetHack 0.0.1 pcvideo.h $ANH-Date: 1457207040 2016/03/05 19:44:00 $ $ANH-Branch: chasonr $:$ANH-Revision: 1.9 $ */
2 /* Copyright (c) aNetHack PC Development Team 1993, 1994 */
3 /* aNetHack 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
41 * Video BIOS functions
44 #define SENSEMODE 0x0b /* Sense CRT Mode */
46 #define PUTCHAR 0x00 /* Put Character */
47 #define SETATT 0x02 /* Set Attribute */
48 #define SETCURPOS 0x03 /* Set Cursor Position */
49 #define CURSOR_RIGHT 0x08 /* Move Cursor Right */
50 #define CURSOR_LEFT 0x09 /* Move Cursor Left */
51 #define SCREEN_CLEAR 0x0a /* Clear Screen */
52 #define LINE_CLEAR 0x0b /* Clear Line */
54 #define SETCURPOS 0x02 /* Set Cursor Position */
57 #define GETCURPOS 0x03 /* Get Cursor Position */
58 #define GETMODE 0x0f /* Get Video Mode */
59 #define SETMODE 0x00 /* Set Video Mode */
60 #define SETPAGE 0x05 /* Set Video Page */
61 #define FONTINFO 0x1130 /* Get Font Info */
62 #define SCROLL 0x06 /* Scroll or initialize window */
63 #define PUTCHARATT 0x09 /* Write attribute & char at cursor */
69 /* #define HW_PANNING /* Hardware panning enabled */
70 #define USHORT unsigned short
71 #define MODE640x480 0x0012 /* Switch to VGA 640 x 480 Graphics mode */
72 #define MODETEXT 0x0003 /* Switch to Text mode 3 */
75 #define PIXELINC 16 /* How much to increment by when panning */
76 /*#define PIXELINC 1 /* How much to increment by when panning */
77 #define SCREENBYTES 128
79 #define VERT_RETRACE \
81 while (!(inportb(crt_status) & 0x08)) \
84 #define VERT_RETRACE_END \
86 while ((inportb(crt_status) & 0x08)) \
90 #define SCREENBYTES 80
93 #define CharacterWidth 8
94 #define SCREENHEIGHT 480
95 #define SCREENWIDTH (SCREENBYTES * CharacterWidth)
96 #define VIDEOSEG 0xa000
97 #define FONT_PTR_SEGMENT 0x0000
98 #define FONT_PTR_OFFSET 0x010C
99 #define SCREENPLANES 4
100 #define COLORDEPTH 16
101 #define egawriteplane(n) \
103 outportb(0x3c4, 2); \
104 outportb(0x3c5, n); \
106 #define egareadplane(n) \
108 outportb(0x3ce, 4); \
109 outportb(0x3cf, n); \
111 #define col2x8(c) ((c) *8)
112 #define col2x16(c) ((c) *16)
113 #define col2x(c) ((c) *2)
114 #define row2y(c) ((c) *16)
115 #define MAX_ROWS_PER_CELL 16
116 #define MAX_COLS_PER_CELL 16
117 #define MAX_BYTES_PER_CELL 2 /* MAX_COLS_PER_CELL/8 */
118 #define ROWS_PER_CELL MAX_ROWS_PER_CELL
119 #define COLS_PER_CELL MAX_COLS_PER_CELL
120 #define BYTES_PER_CELL MAX_BYTES_PER_CELL
123 char image
[MAX_ROWS_PER_CELL
][MAX_BYTES_PER_CELL
];
126 struct planar_cell_struct
{
127 struct cellplane plane
[SCREENPLANES
];
130 struct overview_cellplane
{
131 char image
[MAX_ROWS_PER_CELL
][1];
134 struct overview_planar_cell_struct
{
135 struct overview_cellplane plane
[SCREENPLANES
];
138 #endif /* SCREEN_VGA */
141 * Default color Indexes for hardware palettes
143 * Do not change the values below.
144 * These are the color mappings defined by the particular video
145 * hardware/mode. You can rearrange the aNetHack color mappings at
146 * run-time via the defaults.nh "videocolors" and "videoshades"
151 #if defined(SCREEN_BIOS) || defined(SCREEN_DJGPPFAST)
154 #define M_GRAY 7 /* low-intensity white */
157 #define M_BROWN 6 /* low-intensity yellow */
162 #define M_BRIGHTGREEN 10
164 #define M_BRIGHTBLUE 9
165 #define M_BRIGHTMAGENTA 13
166 #define M_BRIGHTCYAN 11
168 #define M_TEXT M_GRAY
169 #define BACKGROUND_COLOR 1
170 #define ATTRIB_NORMAL M_TEXT /* Normal attribute */
171 #define ATTRIB_INTENSE M_WHITE /* Intense White */
172 #define ATTRIB_MONO_NORMAL 0x01 /* Underlined,white */
173 #define ATTRIB_MONO_UNDERLINE 0x01 /* Underlined,white */
174 #define ATTRIB_MONO_BLINK 0x87 /* Flash bit, white */
175 #define ATTRIB_MONO_REVERSE 0x70 /* Black on white */
176 #endif /*SCREEN_BIOS || SCREEN_DJGPPFAST */
178 #if defined(SCREEN_VGA) || defined(SCREEN_8514)
179 #define BACKGROUND_VGA_COLOR 1
180 #define ATTRIB_VGA_NORMAL CLR_GRAY /* Normal attribute */
181 #define ATTRIB_VGA_INTENSE 14 /* Intense White 94/06/07 palette chg*/
182 #endif /*SCREEN_VGA || SCREEN_8514*/
185 static unsigned char attr98
[CLR_MAX
] = {
191 0x61, /* 5 magenta */
195 0x25, /* 9 reversed blue */
196 0x85, /* 10 reversed green */
197 0xa5, /* 11 reversed cyan */
198 0x45, /* 12 reversed red */
199 0x65, /* 13 reversed magenta */
200 0xc5, /* 14 reversed yellow */
201 0xe5, /* 15 reversed white */
205 #ifdef SIMULATE_CURSOR
206 #define CURSOR_HEIGHT 3 /* this should go - MJA */
208 #define CURSOR_INVIS 0 /* cursor not visible at all */
209 #define CURSOR_FRAME 1 /* block around the current tile */
210 #define CURSOR_UNDERLINE 2 /* thin line at bottom of the tile */
211 #define CURSOR_CORNER 3 /* cursor visible at the 4 tile corners */
212 #define NUM_CURSOR_TYPES 4 /* number of different cursor types */
213 #define CURSOR_DEFAULT_STYLE CURSOR_CORNER
214 #define CURSOR_DEFAULT_COLOR M_GRAY
215 /* global variables for cursor */
216 extern int cursor_type
;
217 extern int cursor_flag
;
218 extern int cursor_color
;
222 * Function Prototypes
228 /* ### video.c ### */
230 #ifdef SIMULATE_CURSOR
231 E
void NDECL(DrawCursor
);
232 E
void NDECL(HideCursor
);
235 /* ### vidtxt.c ### */
238 E
void NDECL(txt_backsp
);
239 E
void NDECL(txt_clear_screen
);
240 E
void FDECL(txt_cl_end
, (int, int));
241 E
void NDECL(txt_cl_eos
);
242 E
void NDECL(txt_get_scr_size
);
243 E
void FDECL(txt_gotoxy
, (int, int));
244 E
int NDECL(txt_monoadapt_check
);
245 E
void NDECL(txt_nhbell
);
246 E
void FDECL(txt_startup
, (int *, int *));
247 E
void FDECL(txt_xputs
, (const char *, int, int));
248 E
void FDECL(txt_xputc
, (CHAR_P
, int));
250 /* ### vidvga.c ### */
253 E
void NDECL(vga_backsp
);
254 E
void FDECL(vga_clear_screen
, (int));
255 E
void FDECL(vga_cl_end
, (int, int));
256 E
void FDECL(vga_cl_eos
, (int));
257 E
int NDECL(vga_detect
);
258 #ifdef SIMULATE_CURSOR
259 E
void NDECL(vga_DrawCursor
);
261 E
void NDECL(vga_Finish
);
262 E
char __far
*NDECL(vga_FontPtrs
);
263 E
void NDECL(vga_get_scr_size
);
264 E
void FDECL(vga_gotoloc
, (int, int));
266 E
void FDECL(vga_update_positionbar
, (char *));
268 #ifdef SIMULATE_CURSOR
269 E
void NDECL(vga_HideCursor
);
271 E
void NDECL(vga_Init
);
272 E
void NDECL(vga_tty_end_screen
);
273 E
void FDECL(vga_tty_startup
, (int *, int *));
274 E
void FDECL(vga_xputs
, (const char *, int, int));
275 E
void FDECL(vga_xputc
, (CHAR_P
, int));
276 E
void FDECL(vga_xputg
, (int, int, unsigned));
277 E
void FDECL(vga_userpan
, (BOOLEAN_P
));
278 E
void FDECL(vga_overview
, (BOOLEAN_P
));
279 E
void FDECL(vga_traditional
, (BOOLEAN_P
));
280 E
void NDECL(vga_refresh
);
281 #endif /* SCREEN_VGA */
283 E
void NDECL(vesa_backsp
);
284 E
void FDECL(vesa_clear_screen
, (int));
285 E
void FDECL(vesa_cl_end
, (int, int));
286 E
void FDECL(vesa_cl_eos
, (int));
287 E
int NDECL(vesa_detect
);
288 #ifdef SIMULATE_CURSOR
289 E
void NDECL(vesa_DrawCursor
);
291 E
void NDECL(vesa_Finish
);
292 E
void NDECL(vesa_get_scr_size
);
293 E
void FDECL(vesa_gotoloc
, (int, int));
295 E
void FDECL(vesa_update_positionbar
, (char *));
297 #ifdef SIMULATE_CURSOR
298 E
void NDECL(vesa_HideCursor
);
300 E
void NDECL(vesa_Init
);
301 E
void NDECL(vesa_tty_end_screen
);
302 E
void FDECL(vesa_tty_startup
, (int *, int *));
303 E
void FDECL(vesa_xputs
, (const char *, int, int));
304 E
void FDECL(vesa_xputc
, (CHAR_P
, int));
305 E
void FDECL(vesa_xputg
, (int, int, unsigned));
306 E
void FDECL(vesa_userpan
, (BOOLEAN_P
));
307 E
void FDECL(vesa_overview
, (BOOLEAN_P
));
308 E
void FDECL(vesa_traditional
, (BOOLEAN_P
));
309 E
void NDECL(vesa_refresh
);
310 #endif /* SCREEN_VESA */
311 #endif /* NO_TERMS */
315 #endif /* PCVIDEO_H */