libww libww
WWitch compatibility library for the Wonderful toolchain
Loading...
Searching...
No Matches
text.h
Go to the documentation of this file.
1#include <sys/types.h>
2
3#ifndef __LIBWW_SYS_TEXT_H__
4#define __LIBWW_SYS_TEXT_H__
5
6/* Begin auto-generated section */
7
8/* text_put_numeric() flags */
9/* Output in hexadecimal instead of decimal */
10#define NUM_HEXA 0x01
11/* Pad using spaces */
12#define NUM_PADSPACE 0x00
13/* Pad using zeroes */
14#define NUM_PADZERO 0x02
15/* Align to right */
16#define NUM_ALIGN_RIGHT 0x00
17/* Align to left */
18#define NUM_ALIGN_LEFT 0x04
19/* Number is signed instead of unsigned */
20#define NUM_SIGNED 0x08
21/* Output to buffer instead of text window */
22#define NUM_STORE 0x30
23
24/* Text modes */
25/* ASCII */
26#define TEXT_MODE_ANK 0
27/* ASCII/Shift-JIS */
28#define TEXT_MODE_ANK_SJIS 1
29/* Shift-JIS */
30#define TEXT_MODE_SJIS 2
31
32/* Useful constants */
33#define TEXT_SCREEN_WIDTH 28
34#define TEXT_SCREEN_HEIGHT 18
35
43static inline void text_screen_init(void) {
44 uint16_t result;
45 __asm volatile (
46 "int $0x13"
47 : "=a" (result)
48 : "Rah" ((uint8_t) 0x00)
49 : "cc", "memory"
50 );
51}
52
64static inline void text_window_init(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t base) {
65 uint16_t result;
66 __asm volatile (
67 "int $0x13"
68 : "=a" (result)
69 : "d" (base), "b" (((y << 8) | x)), "c" (((height << 8) | width)), "Rah" ((uint8_t) 0x01)
70 : "cc", "memory"
71 );
72}
73
77static inline void text_set_mode(uint16_t value) {
78 uint16_t result;
79 __asm volatile (
80 "int $0x13"
81 : "=a" (result)
82 : "b" (value), "Rah" ((uint8_t) 0x02)
83 : "cc", "memory"
84 );
85}
86
90static inline uint16_t text_get_mode(void) {
91 uint16_t result;
92 __asm volatile (
93 "int $0x13"
94 : "=a" (result)
95 : "Rah" ((uint8_t) 0x03)
96 : "cc", "memory"
97 );
98 return result;
99}
100
101static inline void text_put_char(uint8_t x, uint8_t y, uint16_t ch) {
102 uint16_t result;
103 __asm volatile (
104 "int $0x13"
105 : "=a" (result)
106 : "c" (ch), "b" (((y << 8) | x)), "Rah" ((uint8_t) 0x04)
107 : "cc", "memory"
108 );
109}
110
111void text_put_string(uint8_t x, uint8_t y, const char __far* str);
112
113void text_put_substring(uint8_t x, uint8_t y, const char __far* str, uint16_t length);
114
115static inline void text_put_numeric(uint8_t x, uint8_t y, uint8_t width, uint8_t flags, uint16_t value) {
116 uint16_t result;
117 __asm volatile (
118 "int $0x13"
119 : "=a" (result)
120 : "d" (value), "b" (((y << 8) | x)), "c" (((flags << 8) | width)), "Rah" ((uint8_t) 0x07)
121 : "cc", "memory"
122 );
123}
124
125static inline void text_fill_char(uint8_t x, uint8_t y, uint16_t length, uint16_t ch) {
126 uint16_t result;
127 __asm volatile (
128 "int $0x13"
129 : "=a" (result)
130 : "c" (length), "d" (ch), "b" (((y << 8) | x)), "Rah" ((uint8_t) 0x08)
131 : "cc", "memory"
132 );
133}
134
139static inline void text_set_palette(uint16_t index) {
140 uint16_t result;
141 __asm volatile (
142 "int $0x13"
143 : "=a" (result)
144 : "b" (index), "Rah" ((uint8_t) 0x09)
145 : "cc", "memory"
146 );
147}
148
153static inline uint16_t text_get_palette(void) {
154 uint16_t result;
155 __asm volatile (
156 "int $0x13"
157 : "=a" (result)
158 : "Rah" ((uint8_t) 0x0A)
159 : "cc", "memory"
160 );
161 return result;
162}
163
170void text_set_ank_font(uint8_t start, uint8_t depth, uint16_t count, const void __far* data);
171
176void text_get_fontdata(uint16_t ch, void __far* data);
177
181static inline void text_set_screen(uint8_t id) {
182 uint16_t result;
183 __asm volatile (
184 "int $0x13"
185 : "=a" (result)
186 : "a" ((uint16_t) (((0x0E) << 8) | (id & 0xFF)))
187 : "cc", "memory"
188 );
189}
190
194static inline uint8_t text_get_screen(void) {
195 uint16_t result;
196 __asm volatile (
197 "int $0x13"
198 : "=a" (result)
199 : "Rah" ((uint8_t) 0x0F)
200 : "cc", "memory"
201 );
202 return result;
203}
204
208static inline void cursor_display(uint8_t value) {
209 uint16_t result;
210 __asm volatile (
211 "int $0x13"
212 : "=a" (result)
213 : "a" ((uint16_t) (((0x10) << 8) | (value & 0xFF)))
214 : "cc", "memory"
215 );
216}
217
221static inline uint8_t cursor_status(void) {
222 uint16_t result;
223 __asm volatile (
224 "int $0x13"
225 : "=a" (result)
226 : "Rah" ((uint8_t) 0x11)
227 : "cc", "memory"
228 );
229 return result;
230}
231
232static inline void cursor_set_location(uint8_t x, uint8_t y, uint8_t width, uint8_t height) {
233 uint16_t result;
234 __asm volatile (
235 "int $0x13"
236 : "=a" (result)
237 : "b" (((y << 8) | x)), "c" (((height << 8) | width)), "Rah" ((uint8_t) 0x12)
238 : "cc", "memory"
239 );
240}
241
242static inline uint32_t cursor_get_location(void) {
243 uint32_t result;
244 __asm volatile (
245 "int $0x13"
246 : "=A" (result)
247 : "Rah" ((uint8_t) 0x13)
248 : "cc", "memory"
249 );
250 return result;
251}
252
257static inline void cursor_set_type(uint8_t palette, uint8_t rate) {
258 uint16_t result;
259 __asm volatile (
260 "int $0x13"
261 : "=a" (result)
262 : "b" (palette), "c" (rate), "Rah" ((uint8_t) 0x14)
263 : "cc", "memory"
264 );
265}
266
267static inline uint16_t cursor_get_type(void) {
268 uint16_t result;
269 __asm volatile (
270 "int $0x13"
271 : "=a" (result)
272 : "Rah" ((uint8_t) 0x15)
273 : "cc", "memory"
274 );
275 return result;
276}
277
278/* End auto-generated section */
279
280
281#endif /* __LIBWW_SYS_TEXT_H__ */
static uint32_t cursor_get_location(void)
Definition text.h:242
static uint8_t text_get_screen(void)
Definition text.h:194
static void cursor_display(uint8_t value)
Definition text.h:208
static void text_fill_char(uint8_t x, uint8_t y, uint16_t length, uint16_t ch)
Definition text.h:125
static void text_set_palette(uint16_t index)
Definition text.h:139
void text_put_string(uint8_t x, uint8_t y, const char __far *str)
static uint16_t text_get_mode(void)
Definition text.h:90
static void text_put_char(uint8_t x, uint8_t y, uint16_t ch)
Definition text.h:101
static void text_screen_init(void)
Definition text.h:43
static void text_window_init(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t base)
Definition text.h:64
static void cursor_set_location(uint8_t x, uint8_t y, uint8_t width, uint8_t height)
Definition text.h:232
static uint16_t cursor_get_type(void)
Definition text.h:267
static void text_put_numeric(uint8_t x, uint8_t y, uint8_t width, uint8_t flags, uint16_t value)
Definition text.h:115
static void cursor_set_type(uint8_t palette, uint8_t rate)
Definition text.h:257
static uint8_t cursor_status(void)
Definition text.h:221
void text_put_substring(uint8_t x, uint8_t y, const char __far *str, uint16_t length)
void text_set_ank_font(uint8_t start, uint8_t depth, uint16_t count, const void __far *data)
static void text_set_mode(uint16_t value)
Definition text.h:77
static void text_set_screen(uint8_t id)
Definition text.h:181
static uint16_t text_get_palette(void)
Definition text.h:153
void text_get_fontdata(uint16_t ch, void __far *data)