FDOSTUI
FreeDOS Text User Interface
cursor.h
Go to the documentation of this file.
1 /*
2  CURSOR.H
3 
4  License CC0 PUBLIC DOMAIN
5 
6  To the extent possible under law, Mark J. Olesen has waived all copyright
7  and related or neighboring rights to FDOSTUI Library. This work is published
8  from: United States.
9 */
10 #ifndef __cursor_h__
11 
12 #if defined(__CURSES__)
13 
14 #include <curses.h>
15 
17 {
18  CURSOR_CAN_HIDE = (1 << 0)
19 };
20 
21 #endif
22 
24 {
27 };
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #if defined(__CURSES__)
34 extern unsigned int _cursor_features;
35 #endif
36 
37 extern enum cursor_mode _cursor_mode;
38 
39 extern void
41  unsigned char const i_row,
42  unsigned char const i_column);
43 
44 extern void
45 cursor_hide();
46 
47 extern void
49 
50 extern void
51 cursor_block();
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #if defined(__DOS__) && !defined(__CURSES__)
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 extern void
65  char const i_scan_start,
66  char const i_scan_end);
67 
68 extern void
70  char*const o_scan_start,
71  char*const o_scan_end,
72  char*const o_row,
73  char*const o_column);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #pragma aux cursor_set_position =\
80  "xor bh, bh"\
81  "mov ah, 02h"\
82  "int 010h"\
83  modify [AH BH]\
84  parm [DL] [DH];
85 
86 #pragma aux cursor_set_type= \
87  "mov ah, 01h"\
88  "int 010h" \
89  modify [ AH ] \
90  parm [CH] [CL] ;
91 
92 #if defined(__FLAT__)
93 
94 #pragma aux cursor_get_position=\
95  "push ebx"\
96  "push eax"\
97  "xor bh,bh"\
98  "mov ah, 03h"\
99  "int 010h"\
100  "pop ebx"\
101  "mov [byte ptr ebx], ch"\
102  "pop ebx"\
103  "mov [byte ptr ebx], cl"\
104  "mov [byte ptr esi], dh"\
105  "mov [byte ptr edi], dl"\
106  modify [ AH ] \
107  parm [AX] [BX] [SI] [DI];
108 
109 #else
110 
111 #pragma aux cursor_get_position=\
112  "push bx"\
113  "push ax"\
114  "xor bh,bh"\
115  "mov ah, 03h"\
116  "int 010h"\
117  "pop bx"\
118  "mov [byte ptr bx], ch"\
119  "pop bx"\
120  "mov [byte ptr bx], cl"\
121  "mov [byte ptr ds:si], dh"\
122  "mov [byte ptr ds:di], dl"\
123  modify [ AH ] \
124  parm [AX] [BX] [SI] [DI];
125 
126 #endif /* #ifdef __FLAT__ */
127 
128 #define CURSOR_MASK_HIDE 0x20
129 
130 #define cursor_hide() cursor_set_type(CURSOR_MASK_HIDE, 0x0)
131 
132 #define cursor_underline() cursor_set_type(0x06, 0x07)
133 
134 #define cursor_block() cursor_set_type(0x00, 0x07)
135 
136 #endif /* #if defined(__DOS__) && !defined(__CURSES__) */
137 
138 #define __cursor_h__
139 #endif
cursor_mode
mode of cursor such as overwrite or insert
Definition: cursor.h:23
void cursor_block()
sets the cursor shape to a solid block
Definition: djgpp/cursor.c:60
cursor_features
cursor features
Definition: cursor.h:16
Definition: cursor.h:26
void cursor_underline()
sets the cursor shape to underline
Definition: djgpp/cursor.c:47
void cursor_get_position(char *const o_scan_start, char *const o_scan_end, char *const o_row, char *const o_column)
get cursor position and type/shape
void cursor_hide()
hide the cursor
Definition: djgpp/cursor.c:34
void cursor_set_position(unsigned char const i_row, unsigned char const i_column)
set cursor position
Definition: djgpp/cursor.c:18
unsigned int _cursor_features
global to hold the cursor features
Definition: ncurses/cursor.c:17
Definition: cursor.h:18
enum cursor_mode _cursor_mode
global to hold the mode of the cursor
Definition: djgpp/cursor.c:15
Definition: cursor.h:25
void cursor_set_type(char const i_scan_start, char const i_scan_end)
set the cursor type/shape