Go to the documentation of this file.
46 # error This module may be used only when compiling for the CX16!
58 #define CH_COLOR_SWAP 0x01
59 #define CH_UNDERLINE 0x04
62 #define CH_BACKSPACE 0x08
63 #define CH_ITALIC 0x0B
64 #define CH_OUTLINE 0x0C
65 #define CH_FONT_ISO 0x0F
69 #define CH_ORANGE 0x81
70 #define CH_FONT_PET 0x8F
72 #define CH_ATTR_CLEAR 0x92
75 #define CH_LIGHTRED CH_PINK
78 #define CH_LIGHTGREEN 0x99
79 #define CH_LIGHTBLUE 0x9A
81 #define CH_PURPLE 0x9C
82 #define CH_YELLOW 0x9E
84 #define CH_SHIFT_SPACE 0xA0
87 #define CH_SHIFT_TAB 0x18
103 #define COLOR_BLACK 0x00
104 #define COLOR_WHITE 0x01
105 #define COLOR_RED 0x02
106 #define COLOR_CYAN 0x03
107 #define COLOR_PURPLE 0x04
108 #define COLOR_GREEN 0x05
109 #define COLOR_BLUE 0x06
110 #define COLOR_YELLOW 0x07
111 #define COLOR_ORANGE 0x08
112 #define COLOR_BROWN 0x09
113 #define COLOR_PINK 0x0A
114 #define COLOR_LIGHTRED COLOR_PINK
115 #define COLOR_GRAY1 0x0B
116 #define COLOR_GRAY2 0x0C
117 #define COLOR_LIGHTGREEN 0x0D
118 #define COLOR_LIGHTBLUE 0x0E
119 #define COLOR_GRAY3 0x0F
123 #define JOY_BTN_1_MASK 0x80
124 #define JOY_BTN_2_MASK 0x40
125 #define JOY_BTN_3_MASK 0x20
126 #define JOY_BTN_4_MASK 0x10
127 #define JOY_UP_MASK 0x08
128 #define JOY_DOWN_MASK 0x04
129 #define JOY_LEFT_MASK 0x02
130 #define JOY_RIGHT_MASK 0x01
132 #define JOY_BTN_A_MASK JOY_BTN_1_MASK
133 #define JOY_BTN_B_MASK JOY_BTN_2_MASK
134 #define JOY_SELECT_MASK JOY_BTN_3_MASK
135 #define JOY_START_MASK JOY_BTN_4_MASK
137 #define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
138 #define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
139 #define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
140 #define JOY_START(v) ((v) & JOY_START_MASK)
142 #define JOY_FIRE2_MASK JOY_BTN_2_MASK
143 #define JOY_FIRE2(v) ((v) & JOY_FIRE2_MASK)
146 #define MOUSE_BTN_MIDDLE 0x02
172 #define VIDEOMODE_80x60 0x00
173 #define VIDEOMODE_80x30 0x01
174 #define VIDEOMODE_40x60 0x02
175 #define VIDEOMODE_40x30 0x03
176 #define VIDEOMODE_40x15 0x04
177 #define VIDEOMODE_20x30 0x05
178 #define VIDEOMODE_20x15 0x06
179 #define VIDEOMODE_80COL VIDEOMODE_80x60
180 #define VIDEOMODE_40COL VIDEOMODE_40x30
181 #define VIDEOMODE_320x240 0x80
182 #define VIDEOMODE_SWAP (-1)
221 #define VERA_IRQ_VSYNC 0b00000001
222 #define VERA_IRQ_RASTER 0b00000010
223 #define VERA_IRQ_SPR_COLL 0b00000100
224 #define VERA_IRQ_AUDIO_LOW 0b00001000
228 #define RAM_BANK (*(volatile unsigned char *)0x00)
229 #define ROM_BANK (*(volatile unsigned char *)0x01)
232 #define VIA1 (*(volatile struct __6522 *)0x9F00)
233 #define VIA2 (*(volatile struct __6522 *)0x9F10)
238 unsigned char address_hi;
241 unsigned char control;
242 unsigned char irq_enable;
243 unsigned char irq_flags;
244 unsigned char irq_raster;
248 unsigned char hscale;
249 unsigned char vscale;
250 unsigned char border;
253 unsigned char hstart;
255 unsigned char vstart;
259 unsigned char fxctrl;
260 unsigned char fxtilebase;
261 unsigned char fxmapbase;
262 unsigned char fxmult;
265 unsigned char fxxincrl;
266 unsigned char fxxincrh;
267 unsigned char fxyincrl;
268 unsigned char fxyincrh;
271 unsigned char fxxposl;
272 unsigned char fxxposh;
273 unsigned char fxyposl;
274 unsigned char fxyposh;
277 unsigned char fxxposs;
278 unsigned char fxyposs;
279 unsigned char fxpolyfilll;
280 unsigned char fxpolyfillh;
283 unsigned char fxcachel;
284 unsigned char fxcachem;
285 unsigned char fxcacheh;
286 unsigned char fxcacheu;
289 unsigned char dcver0;
290 unsigned char dcver1;
291 unsigned char dcver2;
292 unsigned char dcver3;
296 unsigned char config;
297 unsigned char mapbase;
298 unsigned char tilebase;
299 unsigned int hscroll;
300 unsigned int vscroll;
303 unsigned char config;
304 unsigned char mapbase;
305 unsigned char tilebase;
306 unsigned int hscroll;
307 unsigned int vscroll;
310 unsigned char control;
316 unsigned char control;
319 #define VERA (*(volatile struct __vera *)0x9F20)
325 unsigned char status;
329 #define YM2151 (*(volatile struct __ym2151 *)0x9F40)
334 unsigned char vera_action;
335 unsigned char keyboard;
337 unsigned char save_on_exit;
338 unsigned char gif_method;
339 unsigned char const unused1[2];
340 unsigned long const cycle_count;
341 unsigned char const unused2[1];
342 unsigned char const keymap;
343 char const detect[2];
345 #define EMULATOR (*(volatile struct __emul *)0x9FB0)
348 #define BANK_RAM ((volatile unsigned char *)0xA000)
357 unsigned char year, mon, day, hour, min, sec, jif;
400 unsigned char cx16_k_bsave(
void *startaddr,
void *endaddr_plusone) __attribute__((leaf));
402 void cx16_k_clock_set_date_time(
unsigned char year,
unsigned char mon,
unsigned char day,
unsigned char hour,
unsigned char min,
unsigned char sec,
unsigned char jif) __attribute__((leaf));
404 void cx16_k_console_init(
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height) __attribute__((leaf));
418 void cx16_k_fb_move_pixels(
unsigned int sx,
unsigned int sy,
unsigned int tx,
unsigned int ty,
unsigned int count) __attribute__((leaf));
420 void cx16_k_fb_set_8_pixels_opaque(
unsigned char pattern,
unsigned char mask,
unsigned char color1,
unsigned char color2) __attribute__((leaf));
423 void cx16_k_graph_draw_image(
unsigned int x,
unsigned int y,
void *imageaddr,
unsigned int width,
unsigned int height) __attribute__((leaf));
425 void cx16_k_graph_draw_oval(
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height,
unsigned int corner_radius,
unsigned char fillflag) __attribute__((leaf));
426 void cx16_k_graph_draw_rect(
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height,
unsigned int corner_radius,
unsigned char fillflag __attribute__((leaf)));
429 void cx16_k_graph_move_rect(
unsigned int sx,
unsigned int sy,
unsigned int tx,
unsigned int ty,
unsigned int width,
unsigned int height) __attribute__((leaf));
431 void cx16_k_graph_set_colors(
unsigned char stroke,
unsigned char fill,
unsigned char background) __attribute__((leaf));
433 void cx16_k_graph_set_window(
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height) __attribute__((leaf));
435 int cx16_k_i2c_write_byte(
unsigned char device,
unsigned char offset,
unsigned char byte) __attribute__((leaf));
443 long cx16_k_macptr(
unsigned char count,
unsigned char noadvance,
void *destaddr) __attribute__((leaf));
444 void cx16_k_memory_copy(
void *source,
void *target,
unsigned int num_bytes) __attribute__((leaf));
445 unsigned int cx16_k_memory_crc(
void *dataaddr,
unsigned int num_bytes) __attribute__((leaf));
447 void cx16_k_memory_fill(
void *addr,
unsigned int num_bytes,
unsigned char value) __attribute__((leaf));
449 void cx16_k_mouse_config(
unsigned char showmouse,
unsigned char xsize8,
unsigned char ysize8) __attribute__((leaf));
456 unsigned char cx16_k_sprite_set_image(
unsigned char num,
unsigned char w,
unsigned char h,
unsigned char maskflag,
void *imageaddr,
void *maskaddr,
unsigned char bpp) __attribute__((leaf));
463 unsigned short get_numbanks(
void) __attribute__((leaf));
470 signed char get_ostype(
void) __attribute__((leaf));
475 unsigned char get_tv(
void) __attribute__((leaf));
481 void set_tv(
unsigned char type) __attribute__((leaf));
498 signed char videomode(
signed char mode) __attribute__((leaf));
501 unsigned char vpeek(
unsigned long addr) __attribute__((leaf));
506 void vpoke(
unsigned char data,
unsigned long addr) __attribute__((leaf));
signed char get_ostype(void) __attribute__((leaf))
unsigned short get_numbanks(void) __attribute__((leaf))
signed char videomode(signed char mode) __attribute__((leaf))
int cx16_k_kbdbuf_peek(unsigned char *index_ptr) __attribute__((leaf))
void cx16_k_joystick_scan(void) __attribute__((leaf))
@ VERA_DEC_64
Definition: cx16.h:193
void cx16_k_memory_decompress(void *inaddr, void *outaddr) __attribute__((leaf))
void cx16_k_graph_draw_oval(unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned int corner_radius, unsigned char fillflag) __attribute__((leaf))
void cx16_k_fb_get_pixels(void *pixeladdr, unsigned int count) __attribute__((leaf))
@ VERA_DEC_160
Definition: cx16.h:199
@ VERA_INC_8
Definition: cx16.h:206
@ VERA_INC_4
Definition: cx16.h:205
void cx16_k_graph_draw_image(unsigned int x, unsigned int y, void *imageaddr, unsigned int width, unsigned int height) __attribute__((leaf))
void cx16_k_monitor(void) __attribute__((noreturn))
unsigned long cx16_k_rdtim(void) __attribute__((leaf))
void cx16_k_kbdbuf_put(unsigned char c) __attribute__((leaf))
char const void * data
Definition: neslib.h:92
@ VERA_INC_256
Definition: cx16.h:211
unsigned char cx16_k_keymap_set(const char *identifier) __attribute__((leaf))
@ VERA_INC_128
Definition: cx16.h:210
unsigned char fb_get_pixel(void) __attribute__((leaf))
@ TV_NTSC_COLOR
Definition: cx16.h:155
void cx16_k_fb_cursor_next_line(unsigned int x) __attribute__((leaf))
@ VERA_DEC_4
Definition: cx16.h:189
void * fb_get_info
Definition: cx16.h:369
@ TV_VGA2_240P
Definition: cx16.h:166
long cx16_k_joystick_get(unsigned char sticknum) __attribute__((leaf))
void cx16_k_graph_put_char(graph_pos_t *pos_ptr, unsigned char c) __attribute__((leaf))
@ VERA_INC_80
Definition: cx16.h:214
void * fb_set_pixel
Definition: cx16.h:375
unsigned char vera_sprites_enable(unsigned char enable) __attribute__((leaf))
@ VERA_DEC_16
Definition: cx16.h:191
@ VERA_INC_2
Definition: cx16.h:204
@ VERA_DEC_640
Definition: cx16.h:201
@ TV_VGA_240P
Definition: cx16.h:162
@ VERA_INC_512
Definition: cx16.h:212
@ VERA_INC_64
Definition: cx16.h:209
void cx16_k_console_set_paging_message(void *msgaddr) __attribute__((leaf))
void * fb_cursor_next_line
Definition: cx16.h:372
unsigned char cx16_k_console_get_char(void) __attribute__((leaf))
int cx16_k_i2c_write_byte(unsigned char device, unsigned char offset, unsigned char byte) __attribute__((leaf))
@ VERA_INC_640
Definition: cx16.h:217
@ TV_NTSC_MONO_240P
Definition: cx16.h:167
@ VERA_INC_32
Definition: cx16.h:208
byte byte byte y1
Definition: api.h:72
byte byte byte byte h
Definition: api.h:27
void cx16_k_fb_set_8_pixels(unsigned char pattern, unsigned char color) __attribute__((leaf))
void cx16_k_graph_set_font(void *fontaddr) __attribute__((leaf))
void * fb_set_palette
Definition: cx16.h:370
@ TV_NTSC_MONO
Definition: cx16.h:159
void cx16_k_graph_move_rect(unsigned int sx, unsigned int sy, unsigned int tx, unsigned int ty, unsigned int width, unsigned int height) __attribute__((leaf))
unsigned char get_tv(void) __attribute__((leaf))
void cx16_k_console_init(unsigned int x, unsigned int y, unsigned int width, unsigned int height) __attribute__((leaf))
@ TV_NTSC_COLOR_240P
Definition: cx16.h:163
void cx16_k_clock_get_date_time(cx16_date_time_t *datetime_ptr) __attribute__((leaf))
unsigned char vpeek(unsigned long addr) __attribute__((leaf))
@ TV_NONE2
Definition: cx16.h:157
unsigned char cx16_k_sprite_set_image(unsigned char num, unsigned char w, unsigned char h, unsigned char maskflag, void *imageaddr, void *maskaddr, unsigned char bpp) __attribute__((leaf))
char index
Definition: nesdoug.h:113
void * fb_cursor_position
Definition: cx16.h:371
void cx16_k_fb_set_8_pixels_opaque(unsigned char pattern, unsigned char mask, unsigned char color1, unsigned char color2) __attribute__((leaf))
int cx16_k_i2c_read_byte(unsigned char device, unsigned char offset) __attribute__((leaf))
void * fb_fill_pixels
Definition: cx16.h:379
@ VERA_DEC_1
Definition: cx16.h:187
@ TV_VGA
Definition: cx16.h:154
void * fb_get_pixels
Definition: cx16.h:374
const void uint16_t count
Definition: memory.h:58
unsigned char year
Definition: cx16.h:357
@ VERA_DEC_0
Definition: cx16.h:186
@ VERA_DEC_32
Definition: cx16.h:192
void * fb_move_pixels
Definition: cx16.h:381
@ VERA_DEC_128
Definition: cx16.h:194
@ VERA_INC_1
Definition: cx16.h:203
byte x
Definition: api.h:26
unsigned char cx16_k_sprite_set_position(unsigned char sprnum, unsigned int xpos, unsigned int ypos) __attribute__((leaf))
void cx16_k_graph_clear(void) __attribute__((leaf))
byte byte x1
Definition: api.h:72
@ VERA_INC_320
Definition: cx16.h:216
long cx16_k_graph_get_char_size(unsigned char c, unsigned char style) __attribute__((leaf))
@ TV_VGA2
Definition: cx16.h:158
byte byte y
Definition: api.h:26
void * fb_init
Definition: cx16.h:368
void cx16_k_fb_cursor_position(unsigned int x, unsigned int y) __attribute__((leaf))
void * fb_get_pixel
Definition: cx16.h:373
@ VERA_DEC_8
Definition: cx16.h:190
void cx16_k_graph_draw_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2) __attribute__((leaf))
@ TV_RGB2
Definition: cx16.h:160
const char * cx16_k_keymap_get_id(void) __attribute__((leaf))
unsigned char cx16_k_bsave(void *startaddr, void *endaddr_plusone) __attribute__((leaf))
@ VERA_DEC_256
Definition: cx16.h:195
void cx16_k_mouse_scan(void) __attribute__((leaf))
@ VERA_DEC_512
Definition: cx16.h:196
unsigned int cx16_k_memory_crc(void *dataaddr, unsigned int num_bytes) __attribute__((leaf))
void cx16_k_fb_fill_pixels(unsigned int count, unsigned int step, unsigned char color) __attribute__((leaf))
@ VERA_INC_0
Definition: cx16.h:202
void cx16_k_mouse_config(unsigned char showmouse, unsigned char xsize8, unsigned char ysize8) __attribute__((leaf))
@ TV_NONE_240P
Definition: cx16.h:161
@ VERA_INC_160
Definition: cx16.h:215
@ TV_RGB
Definition: cx16.h:156
void * fb_set_8_pixels
Definition: cx16.h:377
void vpoke(unsigned char data, unsigned long addr) __attribute__((leaf))
@ VERA_DEC_2
Definition: cx16.h:188
void cx16_k_fb_get_info(cx16_fb_info_t *info_ptr) __attribute__((leaf))
void cx16_k_graph_draw_rect(unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned int corner_radius, unsigned char fillflag __attribute__((leaf)))
byte byte byte w
Definition: api.h:26
unsigned char depth
Definition: cx16.h:363
void cx16_k_graph_set_colors(unsigned char stroke, unsigned char fill, unsigned char background) __attribute__((leaf))
void cx16_k_memory_fill(void *addr, unsigned int num_bytes, unsigned char value) __attribute__((leaf))
void cx16_k_memory_copy(void *source, void *target, unsigned int num_bytes) __attribute__((leaf))
@ VERA_INC_40
Definition: cx16.h:213
void cx16_k_fb_set_palette(void *paladdr, unsigned char index, unsigned char count __attribute__((leaf)))
void * fb_set_8_pixels_opaque
Definition: cx16.h:378
@ VERA_INC_16
Definition: cx16.h:207
void cx16_k_clock_set_date_time(unsigned char year, unsigned char mon, unsigned char day, unsigned char hour, unsigned char min, unsigned char sec, unsigned char jif) __attribute__((leaf))
void * fb_filter_pixels
Definition: cx16.h:380
unsigned int width
Definition: cx16.h:362
unsigned char cx16_k_mouse_get(mouse_pos_t *mouse_pos_ptr) __attribute__((leaf))
void cx16_k_console_put_image(void *imageaddr, unsigned int width, unsigned int height) __attribute__((leaf))
void set_tv(unsigned char type) __attribute__((leaf))
uint8_t uint16_t address
Definition: bios.h:180
int y
Definition: cx16.h:391
void cx16_k_graph_set_window(unsigned int x, unsigned int y, unsigned int width, unsigned int height) __attribute__((leaf))
void cx16_k_enter_basic(unsigned char coldstart) __attribute__((noreturn))
void * fb_set_pixels
Definition: cx16.h:376
@ TV_RGB2_240P
Definition: cx16.h:168
void cx16_k_fb_init(void) __attribute__((leaf))
int y
Definition: cx16.h:386
void cx16_k_fb_filter_pixels(void *filterfunc, unsigned int count) __attribute__((leaf))
@ TV_NONE
Definition: cx16.h:153
@ VERA_DEC_40
Definition: cx16.h:197
void cx16_k_fb_move_pixels(unsigned int sx, unsigned int sy, unsigned int tx, unsigned int ty, unsigned int count) __attribute__((leaf))
@ VERA_DEC_320
Definition: cx16.h:200
@ VERA_DEC_80
Definition: cx16.h:198
unsigned char cx16_k_screen_mode_set(unsigned char mode) __attribute__((leaf))
void cx16_k_graph_init(graph_fb_functions_t *fb_funcs_ptr) __attribute__((leaf))
unsigned char cx16_k_kbdbuf_get_modifiers(void) __attribute__((leaf))
@ TV_NONE2_240P
Definition: cx16.h:165
const void uint16_t uint8_t mode
Definition: memory.h:58
unsigned char vera_layer_enable(unsigned char layers) __attribute__((leaf))
@ TV_RGB_240P
Definition: cx16.h:164
void cx16_k_screen_set_charset(unsigned char charset_type, void *charsetaddr) __attribute__((leaf))
unsigned char rows
Definition: cx16.h:396
void cx16_k_console_put_char(unsigned char c, unsigned char wrapwordflag) __attribute__((leaf))
long cx16_k_macptr(unsigned char count, unsigned char noadvance, void *destaddr) __attribute__((leaf))
byte byte c
Definition: api.h:59
unsigned char cx16_k_screen_mode_get(screen_mode_info_t *info_ptr) __attribute__((leaf))
unsigned long cx16_k_entropy_get(void) __attribute__((leaf))