1 /*****************************************************************************
2 ** This is part of the CTSim program
3 ** Copyright (C) 1983-2000 Kevin Rosenberg
5 ** $Id: cio.h,v 1.3 2000/04/28 14:14:16 kevin Exp $
7 ** Revision 1.3 2000/04/28 14:14:16 kevin
8 ** *** empty log message ***
11 ** This program is free software; you can redistribute it and/or modify
12 ** it under the terms of the GNU General Public License (version 2) as
13 ** published by the Free Software Foundation.
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ** GNU General Public License for more details.
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program; if not, write to the Free Software
22 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 ******************************************************************************/
28 int init; /* True if initialized */
29 int bios_mode; /* Current BIOS crt mode */
30 int text_attr; /* Current text attribute */
31 int act_page; /* Active page */
32 int tcols, trows; /* Maximum text coords */
33 int xmax, ymax; /* Maximum x, y for both text & graphic modes */
34 int cx, cy; /* Current x, y position */
38 extern struct crtv_st crtv;
41 /*----------------------------------------------------------------------*/
48 #define GM_TEXT40 1 /* color */
49 #define GM_TEXT80 3 /* color */
50 #define GM_320x200 4 /* color */
53 #define GM_E320x200 13
54 #define GM_E640x200 14
56 #define GM_ENHANCED 16
58 #define GM_640x480x16 0x12
59 #define GM_640x480x256 0x2E
60 #define GM_1024x768x16 0x37
61 #define GM_1024x768x256 0x38
72 #define CRT_ENHANCED 2
74 /*----------------------------------------------------------------------*/
77 #define ATTR_REVERSE 14
78 #define ATTR_HIGHLIGHT 15
80 #define C_BLACK 0 /* color codes */
93 #define C_LTMAGENTA 13
97 /*----------------------------------------------------------------------*/
99 /* screen character codes */
105 #define SC_TOP_LEFT 218
106 #define SC_TOP_RIGHT 191
107 #define SC_BOTT_LEFT 192
108 #define SC_BOTT_RIGHT 217
110 #define SC_VERTICAL 179
113 #define WAITKEY() {cio_kb_clr(); while (cio_kb_read() == 0);}
116 void b_setcpos(int col, int row, int page);
117 void crt_wrt_cca(int c, int attr, int count, int page);
118 void crt_wrt_ca(int c, int attr, int page);
119 void crt_wrt_stra(const char *str, int count, int attr, int row, int col, int page);
121 int crt_save(const char *fname);
123 int crt_center_line(const char *str);
125 void crt_clreol(void);
127 void crt_clrline(unsigned int line);
129 void crt_clrscrn(void);
131 void crt_tab(unsigned int n);
132 void crt_save_cpos(void);
133 void crt_restore_cpos(void);
135 void crt_set_ctype(int start, int end);
136 void crt_cursor_off(void);
137 void crt_cursor_on(void);
139 void crt_fill_eol(int c, int attr);
141 void crt_get_ca(int *c, int *attr);
142 void crt_set_mon(int mon);
144 void crt_get_state(void);
146 void crt_set_text_clr(int fclr, int bclr);
147 int crt_get_texta(void);
148 void crt_set_texta(int a);
149 int crt_blank_attr(void);
150 void crt_put_ca(int c, int attr);
151 void crt_put_c(int c);
152 void crt_put_cc(int c, int count);
153 void crt_put_cca(int c, int attr, int count);
154 void crt_put_str(const char *str);
155 void crt_put_stra(const char *str, int attr);
156 void crt_inc_col(int count);
157 void crt_dec_col(int count);
158 void crt_dec_row(int count);
160 void crt_scrollup(int xmin, int ymin, int xmax, int ymax, int nline, int attr);
162 void crt_set_cpos(int col, int row);
163 void crt_get_cpos(int *col, int *row);
165 void crt_set_palette(int id, int color);
166 void crt_set_color_table(char *color_table);
167 void crt_set_border(int bcolor);
168 int crt_calc_color(double nr, double ng, double nb);
169 int crt_icalc_color(int r, int g, int b);
173 int cio_kb_chk(void);
175 void cio_kb_clr(void);
177 unsigned int cio_kb_getc(void);
178 void cio_kb_ungetc(unsigned int c);
180 char *cio_kb_gets(char *str, int maxlen);
182 unsigned int cio_kb_read(void);
183 void cio_kb_unread(unsigned int c);
185 unsigned int cio_kb_waitc(const char *astr, const char *estr, int beep_on_error);
187 void cio_tone(double freq, double length);
189 int cio_check_kb_escape(void);