r6: *** empty log message ***
[ctsim.git] / include / cio.h
1 /*****************************************************************************
2 **  This is part of the CTSim program
3 **  Copyright (C) 1983-2000 Kevin Rosenberg
4 **
5 **  $Id: cio.h,v 1.3 2000/04/28 14:14:16 kevin Exp $
6 **  $Log: cio.h,v $
7 **  Revision 1.3  2000/04/28 14:14:16  kevin
8 **  *** empty log message ***
9 **
10 **
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.
14 **
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.
19 **
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 ******************************************************************************/
24 #ifndef __CIO_H
25 #define __CIO_H
26
27 struct crtv_st {
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 */
35 }; 
36
37 #ifndef DEFINE_CRTV
38    extern struct crtv_st crtv;
39 #endif
40
41 /*----------------------------------------------------------------------*/
42
43 #define CRT_ROWS  25
44 #define CRT_COLS  80
45
46 /* crt modes */
47
48 #define GM_TEXT40    1     /* color */
49 #define GM_TEXT80    3     /* color */
50 #define GM_320x200   4     /* color */
51 #define GM_640x200   6
52 #define GM_MONOTEXT  7
53 #define GM_E320x200 13
54 #define GM_E640x200 14
55 #define GM_MONOGRF  15
56 #define GM_ENHANCED 16
57
58 #define GM_640x480x16   0x12
59 #define GM_640x480x256  0x2E
60 #define GM_1024x768x16  0x37
61 #define GM_1024x768x256 0x38
62
63
64
65 #define GM_TEXT      -1
66 #define GM_HIGHRES   -2
67 #define GM_MEDRES    -3
68
69 #define CRT_NONE    -1
70 #define CRT_MONO     0
71 #define CRT_COLOR    1
72 #define CRT_ENHANCED 2
73
74 /*----------------------------------------------------------------------*/
75
76 #define  ATTR_NORMAL     7
77 #define  ATTR_REVERSE   14
78 #define  ATTR_HIGHLIGHT 15
79
80 #define C_BLACK      0                  /* color codes */
81 #define C_BLUE       1
82 #define C_GREEN      2
83 #define C_CYAN       3
84 #define C_RED        4
85 #define C_MAGENTA    5
86 #define C_BROWN      6
87 #define C_WHITE      7
88 #define C_GREY       8
89 #define C_LTBLUE     9
90 #define C_LTGREEN   10
91 #define C_LTCYAN    11
92 #define C_LTRED     12
93 #define C_LTMAGENTA 13
94 #define C_YELLOW    14
95 #define C_LTWHITE   15
96
97 /*----------------------------------------------------------------------*/
98
99 /* screen character codes */
100
101 #define SC_BKSP           8
102 #define SC_TAB            9
103 #define SC_BLANK        ' '
104
105 #define SC_TOP_LEFT     218
106 #define SC_TOP_RIGHT    191
107 #define SC_BOTT_LEFT    192
108 #define SC_BOTT_RIGHT   217
109 #define SC_HORIZ        196
110 #define SC_VERTICAL     179
111
112
113 #define WAITKEY()       {cio_kb_clr(); while (cio_kb_read() == 0);}
114
115 /* biosf.c */
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);
120 /* c_save.c */
121 int crt_save(const char *fname);
122 /* center.c */
123 int crt_center_line(const char *str);
124 /* clreol.c */
125 void crt_clreol(void);
126 /* clrline.c */
127 void crt_clrline(unsigned int line);
128 /* clrscrn.c */
129 void crt_clrscrn(void);
130 /* cpos.c */
131 void crt_tab(unsigned int n);
132 void crt_save_cpos(void);
133 void crt_restore_cpos(void);
134 /* ctype.c */
135 void crt_set_ctype(int start, int end);
136 void crt_cursor_off(void);
137 void crt_cursor_on(void);
138 /* fill_eol.c */
139 void crt_fill_eol(int c, int attr);
140 /* get_ca.c */
141 void crt_get_ca(int *c, int *attr);
142 void crt_set_mon(int mon);
143 /* getstate.c */
144 void crt_get_state(void);
145 /* put_ca.c */
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);
159 /* scrollup.c */
160 void crt_scrollup(int xmin, int ymin, int xmax, int ymax, int nline, int attr);
161 /* setcpos.c */
162 void crt_set_cpos(int col, int row);
163 void crt_get_cpos(int *col, int *row);
164 /* setpal.c */
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);
170 /* beep.c */
171 void cio_beep(void);
172 /* kb_chk.c */
173 int cio_kb_chk(void);
174 /* kb_clr.c */
175 void cio_kb_clr(void);
176 /* kb_getc.c */
177 unsigned int cio_kb_getc(void);
178 void cio_kb_ungetc(unsigned int c);
179 /* kb_gets.c */
180 char *cio_kb_gets(char *str, int maxlen);
181 /* kb_read.c */
182 unsigned int cio_kb_read(void);
183 void cio_kb_unread(unsigned int c);
184 /* kb_waitc.c */
185 unsigned int cio_kb_waitc(const char *astr, const char *estr, int beep_on_error);
186 /* tone.c */
187 void cio_tone(double freq, double length);
188 /* check_kb */
189 int cio_check_kb_escape(void);
190
191 #endif