7057bd43d055064528b2e364f55f2e1d7961728a
[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.5 2000/05/07 12:46:19 kevin Exp $
6 **  $Log: cio.h,v $
7 **  Revision 1.5  2000/05/07 12:46:19  kevin
8 **  made c++ compatible
9 **
10 **  Revision 1.4  2000/04/28 18:18:59  kevin
11 **  removed unused files
12 **
13 **  Revision 1.3  2000/04/28 14:14:16  kevin
14 **  *** empty log message ***
15 **
16 **
17 **  This program is free software; you can redistribute it and/or modify
18 **  it under the terms of the GNU General Public License (version 2) as
19 **  published by the Free Software Foundation.
20 **
21 **  This program is distributed in the hope that it will be useful,
22 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
23 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 **  GNU General Public License for more details.
25 **
26 **  You should have received a copy of the GNU General Public License
27 **  along with this program; if not, write to the Free Software
28 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29 ******************************************************************************/
30 #ifndef __CIO_H
31 #define __CIO_H
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36
37
38 struct crtv_st {
39     int init;           /* True if initialized */
40     int bios_mode;      /* Current BIOS crt mode */
41     int text_attr;      /* Current text attribute */
42     int act_page;       /* Active page */
43     int tcols, trows;   /* Maximum text coords */
44     int xmax, ymax;     /* Maximum x, y for both text & graphic modes */
45     int cx, cy;         /* Current x, y position */
46 }; 
47
48 #ifndef DEFINE_CRTV
49    extern struct crtv_st crtv;
50 #endif
51
52 /*----------------------------------------------------------------------*/
53
54 #define CRT_ROWS  25
55 #define CRT_COLS  80
56
57 /*----------------------------------------------------------------------*/
58
59 #define  ATTR_NORMAL     7
60 #define  ATTR_REVERSE   14
61 #define  ATTR_HIGHLIGHT 15
62
63 #define C_BLACK      0                  /* color codes */
64 #define C_BLUE       1
65 #define C_GREEN      2
66 #define C_CYAN       3
67 #define C_RED        4
68 #define C_MAGENTA    5
69 #define C_BROWN      6
70 #define C_WHITE      7
71 #define C_GREY       8
72 #define C_LTBLUE     9
73 #define C_LTGREEN   10
74 #define C_LTCYAN    11
75 #define C_LTRED     12
76 #define C_LTMAGENTA 13
77 #define C_YELLOW    14
78 #define C_LTWHITE   15
79
80 /*----------------------------------------------------------------------*/
81
82 /* screen character codes */
83
84 #define SC_BKSP           8
85 #define SC_TAB            9
86 #define SC_BLANK        ' '
87
88
89 #define WAITKEY()       {cio_kb_clr(); while (cio_kb_read() == 0);}
90
91 /* c_save.c */
92 int crt_save(const char *fname);
93 /* center.c */
94 void crt_center_line(const char *str);
95 /* clreol.c */
96 void crt_clreol(void);
97 /* clrline.c */
98 void crt_clrline(unsigned int line);
99 /* clrscrn.c */
100 void crt_clrscrn(void);
101 /* cpos.c */
102 void crt_tab(unsigned int n);
103 void crt_save_cpos(void);
104 void crt_restore_cpos(void);
105 /* fill_eol.c */
106 void crt_fill_eol(int c, int attr);
107 /* getstate.c */
108 void crt_get_state(void);
109 /* put_ca.c */
110 void crt_set_text_clr(int fclr, int bclr);
111 int crt_get_texta(void);
112 void crt_set_texta(int a);
113 int crt_blank_attr(void);
114 void crt_put_ca(int c, int attr);
115 void crt_put_c(int c);
116 void crt_put_cc(int c, int count);
117 void crt_put_cca(int c, int attr, int count);
118 void crt_put_str(const char *str);
119 void crt_put_stra(const char *str, int attr);
120 void crt_inc_col(int count);
121 void crt_dec_col(int count);
122 void crt_dec_row(int count);
123 /* scrollup.c */
124 void crt_scrollup(int xmin, int ymin, int xmax, int ymax, int nline, int attr);
125 /* setcpos.c */
126 void crt_set_cpos(int col, int row);
127 void crt_get_cpos(int *col, int *row);
128 /* beep.c */
129 void cio_beep(void);
130 /* kb_chk.c */
131 int cio_kb_chk(void);
132 /* kb_clr.c */
133 void cio_kb_clr(void);
134 /* kb_getc.c */
135 unsigned int cio_kb_getc(void);
136 void cio_kb_ungetc(unsigned int c);
137 /* kb_gets.c */
138 char *cio_kb_gets(char *str, int maxlen);
139 /* kb_read.c */
140 unsigned int cio_kb_read(void);
141 void cio_kb_unread(unsigned int c);
142 /* kb_waitc.c */
143 unsigned int cio_kb_waitc(const char *astr, const char *estr, int beep_on_error);
144 /* tone.c */
145 void cio_tone(double freq, double length);
146 /* check_kb */
147 int cio_check_kb_escape(void);
148
149 #ifdef __cplusplus
150 }
151 #endif /* __cplusplus */
152
153 #endif