Subversion Repositories SvarDOS

Rev

Rev 1661 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1661 Rev 1806
1
/*
1
/*
2
 * Console output
2
 * Console output
3
 *
3
 *
4
 * This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
4
 * This file is part of the Mateusz' DOS Routines (MDR): http://mdr.osdn.io
5
 * Published under the terms of the MIT License, as stated below.
5
 * Published under the terms of the MIT License, as stated below.
6
 *
6
 *
7
 * Copyright (C) 2014-2023 Mateusz Viste
7
 * Copyright (C) 2014-2023 Mateusz Viste
8
 *
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
10
 * of this software and associated documentation files (the "Software"), to
10
 * of this software and associated documentation files (the "Software"), to
11
 * deal in the Software without restriction, including without limitation the
11
 * deal in the Software without restriction, including without limitation the
12
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13
 * sell copies of the Software, and to permit persons to whom the Software is
13
 * sell copies of the Software, and to permit persons to whom the Software is
14
 * furnished to do so, subject to the following conditions:
14
 * furnished to do so, subject to the following conditions:
15
 *
15
 *
16
 * The above copyright notice and this permission notice shall be included in
16
 * The above copyright notice and this permission notice shall be included in
17
 * all copies or substantial portions of the Software.
17
 * all copies or substantial portions of the Software.
18
 *
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25
 * IN THE SOFTWARE.
25
 * IN THE SOFTWARE.
26
 */
26
 */
27
 
27
 
28
#ifndef MDR_COUT
28
#ifndef MDR_COUT
29
#define MDR_COUT
29
#define MDR_COUT
30
 
30
 
31
/* inits the subsystem, fills arguments with:
31
/* inits the subsystem, fills arguments with:
32
 * w = screen width
32
 * w = screen width
33
 * h = screen height
33
 * h = screen height
34
 * Any of these arguments may be passed as NULL
34
 * Any of these arguments may be passed as NULL
35
 * Returns a color flag (0=mono, non-zero=color) */
35
 * Returns a color flag (0=mono, non-zero=color) */
36
unsigned char mdr_cout_init(unsigned char *w, unsigned char *h);
36
unsigned char mdr_cout_init(unsigned char *w, unsigned char *h);
37
 
37
 
38
/* get current attribute value under cursor and returns it */
38
/* get current attribute value under cursor and returns it */
39
int mdr_cout_getcurattr(void);
39
int mdr_cout_getcurattr(void);
40
 
40
 
41
void mdr_cout_close(void);
41
void mdr_cout_close(void);
42
void mdr_cout_cursor_hide(void);
42
void mdr_cout_cursor_hide(void);
43
void mdr_cout_cursor_show(void);
43
void mdr_cout_cursor_show(void);
44
 
44
 
45
/* gets cursor's position on screen (row, column) and shape */
45
/* gets cursor's position on screen (row, column) and shape */
46
void mdr_cursor_getinfo(unsigned char *column, unsigned char *row, unsigned short *shape);
46
void mdr_cursor_getinfo(unsigned char *column, unsigned char *row, unsigned short *shape);
47
 
47
 
48
void mdr_cout_locate(unsigned char row, unsigned char column);
48
void mdr_cout_locate(unsigned char row, unsigned char column);
49
 
49
 
50
/* print a single character on screen */
50
/* print a single character on screen */
51
void mdr_cout_char(unsigned char y, unsigned char x, char c, unsigned char attr);
51
void mdr_cout_char(unsigned char y, unsigned char x, char c, unsigned char attr);
52
 
52
 
53
/* print a single character on screen, repeated count times */
53
/* print a single character on screen, repeated count times */
54
void mdr_cout_char_rep(unsigned char y, unsigned char x, char c, unsigned char attr, unsigned char count);
54
void mdr_cout_char_rep(unsigned char y, unsigned char x, char c, unsigned char attr, unsigned char count);
55
 
55
 
56
/* print a nul-terminated string on screen, up to maxlen characters
56
/* print a nul-terminated string on screen, up to maxlen characters
57
 * returns the number of characters actually displayed */
57
 * returns the number of characters actually displayed */
58
unsigned char mdr_cout_str(unsigned char y, unsigned char x, const char *s, unsigned char attr, unsigned char maxlen);
58
unsigned char mdr_cout_str(unsigned char y, unsigned char x, const char *s, unsigned char attr, unsigned char maxlen);
59
 
59
 
60
/* clears screen, filling it with a single color attribute */
60
/* clears screen, filling it with a single color attribute */
61
void mdr_cout_cls(unsigned char colattr);
61
void mdr_cout_cls(unsigned char colattr);
62
 
62
 
63
void mdr_cout_getconprops(unsigned char *termwidth, unsigned char *termheight, unsigned char *colorflag);
63
void mdr_cout_getconprops(unsigned char *termwidth, unsigned char *termheight, unsigned char *colorflag);
64
 
64
 
65
 
65
 
66
/*****************************************************************************
66
/*****************************************************************************
67
 * functions below do not need mdr_cout_init() initialization, they can be   *
67
 * functions below do not need mdr_cout_init() initialization, they can be   *
68
 * used to output data to console right away, as they use DOS services.      *
68
 * used to output data to console right away, as they use DOS services.      *
69
 *****************************************************************************/
69
 *****************************************************************************/
70
 
70
 
71
/* output a single character to console */
71
/* output a single character to console */
72
void mdr_coutraw_char(char c);
72
void mdr_coutraw_char(char c);
73
 
73
 
74
/* output a nul-terminated string */
74
/* output a nul-terminated string */
75
void mdr_coutraw_str(const char *s);
75
void mdr_coutraw_str(const char *s);
76
 
76
 
77
/* same as above, but followed with a CR/LF line terminator */
77
/* same as above, but followed with a CR/LF line terminator */
78
void mdr_coutraw_puts(const char *s);
78
void mdr_coutraw_puts(const char *s);
79
 
79
 
80
/* outputs a DOS-style (CR/LF) newline to console */
80
/* outputs a DOS-style (CR/LF) newline to console */
81
void mdr_coutraw_crlf(void);
81
void mdr_coutraw_crlf(void);
82
 
82
 
83
#endif
83
#endif
84
 
84