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 0x80
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 (uint16_t) 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
114uint16_t text_put_string(uint8_t x, uint8_t y, const char __far* str);
115
119uint16_t text_put_substring(uint8_t x, uint8_t y, const char __far* str, uint16_t length);
120
124static inline uint16_t text_put_numeric(uint8_t x, uint8_t y, uint8_t width, uint8_t flags, uint16_t value) {
125 uint16_t result;
126 __asm volatile (
127 "int $0x13"
128 : "=a" (result)
129 : "d" (value), "b" (((y << 8) | x)), "c" (((flags << 8) | width)), "Rah" ((uint8_t) 0x07)
130 : "cc", "memory"
131 );
132 return (uint16_t) result;
133}
134
138uint16_t text_store_numeric(void __far* buffer, uint8_t width, uint8_t flags, uint16_t value);
139
140static inline void text_fill_char(uint8_t x, uint8_t y, uint16_t length, uint16_t ch) {
141 uint16_t result;
142 __asm volatile (
143 "int $0x13"
144 : "=a" (result)
145 : "c" (length), "d" (ch), "b" (((y << 8) | x)), "Rah" ((uint8_t) 0x08)
146 : "cc", "memory"
147 );
148}
149
154static inline void text_set_palette(uint16_t index) {
155 uint16_t result;
156 __asm volatile (
157 "int $0x13"
158 : "=a" (result)
159 : "b" (index), "Rah" ((uint8_t) 0x09)
160 : "cc", "memory"
161 );
162}
163
168static inline uint16_t text_get_palette(void) {
169 uint16_t result;
170 __asm volatile (
171 "int $0x13"
172 : "=a" (result)
173 : "Rah" ((uint8_t) 0x0A)
174 : "cc", "memory"
175 );
176 return (uint16_t) result;
177}
178
185void text_set_ank_font(uint8_t start, uint8_t depth, uint16_t count, const void __far* data);
186
191void text_get_fontdata(uint16_t ch, void __far* data);
192
196static inline void text_set_screen(uint8_t id) {
197 uint16_t result;
198 __asm volatile (
199 "int $0x13"
200 : "=a" (result)
201 : "a" ((uint16_t) (((0x0E) << 8) | (id & 0xFF)))
202 : "cc", "memory"
203 );
204}
205
209static inline uint8_t text_get_screen(void) {
210 uint16_t result;
211 __asm volatile (
212 "int $0x13"
213 : "=a" (result)
214 : "Rah" ((uint8_t) 0x0F)
215 : "cc", "memory"
216 );
217 return (uint8_t) result;
218}
219
223static inline void cursor_display(uint8_t value) {
224 uint16_t result;
225 __asm volatile (
226 "int $0x13"
227 : "=a" (result)
228 : "a" ((uint16_t) (((0x10) << 8) | (value & 0xFF)))
229 : "cc", "memory"
230 );
231}
232
236static inline uint8_t cursor_status(void) {
237 uint16_t result;
238 __asm volatile (
239 "int $0x13"
240 : "=a" (result)
241 : "Rah" ((uint8_t) 0x11)
242 : "cc", "memory"
243 );
244 return (uint8_t) result;
245}
246
247static inline void cursor_set_location(uint8_t x, uint8_t y, uint8_t width, uint8_t height) {
248 uint16_t result;
249 __asm volatile (
250 "int $0x13"
251 : "=a" (result)
252 : "b" (((y << 8) | x)), "c" (((height << 8) | width)), "Rah" ((uint8_t) 0x12)
253 : "cc", "memory"
254 );
255}
256
257static inline uint32_t cursor_get_location(void) {
258 uint32_t result;
259 __asm volatile (
260 "int $0x13"
261 : "=A" (result)
262 : "Rah" ((uint8_t) 0x13)
263 : "cc", "memory"
264 );
265 return (uint32_t) result;
266}
267
272static inline void cursor_set_type(uint8_t palette, uint8_t rate) {
273 uint16_t result;
274 __asm volatile (
275 "int $0x13"
276 : "=a" (result)
277 : "b" (palette), "c" (rate), "Rah" ((uint8_t) 0x14)
278 : "cc", "memory"
279 );
280}
281
282static inline uint16_t cursor_get_type(void) {
283 uint16_t result;
284 __asm volatile (
285 "int $0x13"
286 : "=a" (result)
287 : "Rah" ((uint8_t) 0x15)
288 : "cc", "memory"
289 );
290 return (uint16_t) result;
291}
292
293/* End auto-generated section */
294
295
296#endif /* __LIBWW_SYS_TEXT_H__ */
static uint32_t cursor_get_location(void)
Definition text.h:257
static uint8_t text_get_screen(void)
Definition text.h:209
static void cursor_display(uint8_t value)
Definition text.h:223
static void text_fill_char(uint8_t x, uint8_t y, uint16_t length, uint16_t ch)
Definition text.h:140
static void text_set_palette(uint16_t index)
Definition text.h:154
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
uint16_t text_put_string(uint8_t x, uint8_t y, const char __far *str)
uint16_t text_store_numeric(void __far *buffer, uint8_t width, uint8_t flags, uint16_t value)
static void cursor_set_location(uint8_t x, uint8_t y, uint8_t width, uint8_t height)
Definition text.h:247
static uint16_t cursor_get_type(void)
Definition text.h:282
static void cursor_set_type(uint8_t palette, uint8_t rate)
Definition text.h:272
static uint8_t cursor_status(void)
Definition text.h:236
static uint16_t text_put_numeric(uint8_t x, uint8_t y, uint8_t width, uint8_t flags, uint16_t value)
Definition text.h:124
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:196
static uint16_t text_get_palette(void)
Definition text.h:168
uint16_t text_put_substring(uint8_t x, uint8_t y, const char __far *str, uint16_t length)
void text_get_fontdata(uint16_t ch, void __far *data)