GBDK 2020 Docs 4.4.0 API Documentation for GBDK 2020

sms.h
Go to the documentation of this file.
1
4 #ifndef _SMS_H
5 #define _SMS_H
6
7 #include <types.h>
8 #include <stdint.h>
9 #include <gbdk/version.h>
10 #include <sms/hardware.h>
11
12 #define SEGA
13
14 // Here NINTENDO means Game Boy & related clones
15 #ifdef NINTENDO
16 #undef NINTENDO
17 #endif
18
19 #ifdef NINTENDO_NES
20 #undef NINTENDO_NES
21 #endif
22
23 #ifdef MSX
24 #undef MSX
25 #endif
26
27 #if defined(__TARGET_sms)
28 #define MASTERSYSTEM
29 #elif defined(__TARGET_gg)
30 #define GAMEGEAR
31 #endif
32
33
34 extern const UBYTE _BIOS;
35
36 extern const uint8_t _SYSTEM;
37
38 #define SYSTEM_60HZ 0x00
39 #define SYSTEM_50HZ 0x01
40
41 #define VBK_REG VDP_ATTR_SHIFT
42
56 #define J_UP 0b00000001
57 #define J_DOWN 0b00000010
58 #define J_LEFT 0b00000100
59 #define J_RIGHT 0b00001000
60 #define J_B 0b00010000
61 #define J_A 0b00100000
62 #define J_START 0b01000000
63 #define J_SELECT 0b10000000
64
69 #define M_TEXT_OUT 0x02U
70 #define M_TEXT_INOUT 0x03U
76 #define M_NO_SCROLL 0x04U
80 #define M_NO_INTERP 0x08U
81
84 #define S_BANK 0x01U
87 #define S_FLIPX 0x02U
90 #define S_FLIPY 0x04U
93 #define S_PALETTE 0x08U
96 #define S_PRIORITY 0x10U
100 #define S_PAL(n) (((n) & 0x01U) << 3)
101
102 // VDP helper macros
103 #define __WRITE_VDP_REG_UNSAFE(REG, v) shadow_##REG=(v),VDP_CMD=(shadow_##REG),VDP_CMD=REG
104 #define __WRITE_VDP_REG(REG, v) shadow_##REG=(v);__asm__("di");VDP_CMD=(shadow_##REG);VDP_CMD=REG;__asm__("ei")
105 #define __READ_VDP_REG(REG) shadow_##REG
106
107 void WRITE_VDP_CMD(uint16_t cmd) Z88DK_FASTCALL PRESERVES_REGS(b, c, d, e, iyh, iyl);
108 void WRITE_VDP_DATA(uint16_t data) Z88DK_FASTCALL PRESERVES_REGS(b, c, d, e, iyh, iyl);
109
116 void mode(uint8_t m) OLDCALL;
117
122 uint8_t get_mode(void) OLDCALL;
123
127 inline uint8_t get_system(void) {
128 return _SYSTEM;
129 }
130
131 /* Interrupt flags */
134 #define EMPTY_IFLAG 0x00U
140 #define VBL_IFLAG 0x01U
144 #define LCD_IFLAG 0x02U
147 #define TIM_IFLAG 0x04U
150 #define SIO_IFLAG 0x08U
153 #define JOY_IFLAG 0x10U
154
155 void set_interrupts(uint8_t flags) Z88DK_FASTCALL;
156
157 /* Limits */
160 #define SCREENWIDTH DEVICE_SCREEN_PX_WIDTH
163 #define SCREENHEIGHT DEVICE_SCREEN_PX_HEIGHT
166 #define MINWNDPOSX 0x00U
169 #define MINWNDPOSY 0x00U
172 #define MAXWNDPOSX 0x00U
175 #define MAXWNDPOSY 0x00U
176
177
180 typedef void (*int_handler)(void) NONBANKED;
181
185 void remove_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(iyh, iyl);
186
190 void remove_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b, c, iyh, iyl);
191
192 void remove_TIM(int_handler h) Z88DK_FASTCALL;
193 void remove_SIO(int_handler h) Z88DK_FASTCALL;
194 void remove_JOY(int_handler h) Z88DK_FASTCALL;
195
198 void add_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(d, e, iyh, iyl);
199
202 void add_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b, c, iyh, iyl);
203
206 void add_TIM(int_handler h) Z88DK_FASTCALL;
207
210 void add_SIO(int_handler h) Z88DK_FASTCALL;
211
214 void add_JOY(int_handler h) Z88DK_FASTCALL;
215
218 inline uint8_t cancel_pending_interrupts(void) {
219 return VDP_STATUS;
220 }
221
222 inline void move_bkg(uint8_t x, uint8_t y) {
223 __WRITE_VDP_REG(VDP_RSCX, -x);
224 __WRITE_VDP_REG(VDP_RSCY, y);
225 }
226
227 inline void scroll_bkg(int8_t x, int8_t y) {
228 __WRITE_VDP_REG(VDP_RSCX, __READ_VDP_REG(VDP_RSCX) - x);
229 int16_t tmp = __READ_VDP_REG(VDP_RSCY) + y;
230 __WRITE_VDP_REG(VDP_RSCY, (tmp < 0) ? 224 + tmp : tmp % 224u);
231 }
232
243 void vsync(void) PRESERVES_REGS(b, c, d, e, h, l, iyh, iyl);
244
247 void wait_vbl_done(void) PRESERVES_REGS(b, c, d, e, h, l, iyh, iyl);
248
253 inline void display_off(void) {
254 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) &= (~R1_DISP_ON));
255 }
256
260 #define DISPLAY_ON \
261 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_DISP_ON)
262
266 #define DISPLAY_OFF \
267 display_off();
268
271 void refresh_OAM(void);
272
276 #define HIDE_LEFT_COLUMN \
277 __WRITE_VDP_REG(VDP_R0, __READ_VDP_REG(VDP_R0) |= R0_LCB)
278
282 #define SHOW_LEFT_COLUMN \
283 __WRITE_VDP_REG(VDP_R0, __READ_VDP_REG(VDP_R0) &= (~R0_LCB))
284
287 #define SET_BORDER_COLOR(C) __WRITE_VDP_REG(VDP_R7, ((C) | 0xf0u))
288
292 #define SHOW_BKG
293
297 #define HIDE_BKG
298
302 #define SHOW_WIN
303
307 #define HIDE_WIN
308
311 #define SHOW_SPRITES \
312 (_sprites_OFF = 0)
313
316 #define HIDE_SPRITES \
317 (_sprites_OFF = 1)
318
321 #define SPRITES_8x16 \
322 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) |= R1_SPR_8X16)
323
326 #define SPRITES_8x8 \
327 __WRITE_VDP_REG(VDP_R1, __READ_VDP_REG(VDP_R1) &= (~R1_SPR_8X16))
328
332 #define DEVICE_SUPPORTS_COLOR (TRUE)
333
340 extern volatile uint16_t sys_time;
341
347 extern volatile uint8_t _vbl_done;
348 #define VBL_DONE _vbl_done
349
350
356 uint8_t get_r_reg(void) PRESERVES_REGS(b, c, d, e, h, l, iyh, iyl);
357
358 #define DIV_REG get_r_reg()
359
362 #define _current_bank MAP_FRAME1
363 #define CURRENT_BANK MAP_FRAME1
364
374 #ifndef BANK
375 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
376 #endif
377
390 #define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
391 __asm \
392 .local b___func_ ## VARNAME \
393 ___bank_ ## VARNAME = b___func_ ## VARNAME \
394 .globl ___bank_ ## VARNAME \
395 __endasm; \
396 }
397
407 #define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
408
409
414 #define SWITCH_ROM(b) MAP_FRAME1=(b)
415 #define SWITCH_ROM1 SWITCH_ROM
416
421 #define SWITCH_ROM2(b) MAP_FRAME2=(b)
422
427 #define SWITCH_RAM(b) RAM_CONTROL=((b)&1)?RAM_CONTROL|RAMCTL_BANK:RAM_CONTROL&(~RAMCTL_BANK)
428
432 #define ENABLE_RAM RAM_CONTROL|=RAMCTL_RAM
433
437 #define DISABLE_RAM RAM_CONTROL&=(~RAMCTL_RAM)
438
439
444 void delay(uint16_t d) Z88DK_FASTCALL;
445
446
449 uint8_t joypad(void) OLDCALL PRESERVES_REGS(b, c, d, e, iyh, iyl);
450
453 uint8_t waitpad(uint8_t mask) Z88DK_FASTCALL PRESERVES_REGS(d, e, iyh, iyl);
454
460 void waitpadup(void) PRESERVES_REGS(d, e, iyh, iyl);
461
467 typedef struct {
468 uint8_t npads;
469 union {
470 struct {
471 uint8_t joy0, joy1, joy2, joy3;
472 };
473 uint8_t joypads[4];
474 };
475 } joypads_t;
476
485 uint8_t joypad_init(uint8_t npads, joypads_t * joypads) Z88DK_CALLEE;
486
493 void joypad_ex(joypads_t * joypads) Z88DK_FASTCALL PRESERVES_REGS(iyh, iyl);
494
503 inline void enable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l, iyh, iyl) {
504 __asm__("ei");
505 }
506
519 inline void disable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l, iyh, iyl) {
520 __asm__("di");
521 }
522
523
524 #if defined(__TARGET_sms)
525
526 #define RGB(r,g,b) ((r) | ((g) << 2) | ((b) << 4))
527 #define RGB8(r,g,b) (((r) >> 6) | (((g) >> 6) << 2) | (((b) >> 6) << 4))
528 #define RGBHTML(RGB24bit) (((RGB24bit) >> 22) | ((((RGB24bit) & 0xFFFF) >> 14) << 2) | ((((RGB24bit) & 0xFF) >> 6) << 4))
529
532 #define RGB_RED RGB( 3, 0, 0)
533 #define RGB_DARKRED RGB( 2, 0, 0)
534 #define RGB_GREEN RGB( 0, 3, 0)
535 #define RGB_DARKGREEN RGB( 0, 2, 0)
536 #define RGB_BLUE RGB( 0, 0, 3)
537 #define RGB_DARKBLUE RGB( 0, 0, 2)
538 #define RGB_YELLOW RGB( 3, 3, 0)
539 #define RGB_DARKYELLOW RGB( 2, 2, 0)
540 #define RGB_CYAN RGB( 0, 3, 3)
541 #define RGB_AQUA RGB( 3, 1, 2)
542 #define RGB_PINK RGB( 3, 0, 3)
543 #define RGB_PURPLE RGB( 2, 0, 2)
544 #define RGB_BLACK RGB( 0, 0, 0)
545 #define RGB_DARKGRAY RGB( 1, 1, 1)
546 #define RGB_LIGHTGRAY RGB( 2, 2, 2)
547 #define RGB_WHITE RGB( 3, 3, 3)
548
549 typedef uint8_t palette_color_t;
550
551 #elif defined(__TARGET_gg)
552
553 #define RGB(r,g,b) ((uint16_t)(r) | (uint16_t)((g) << 4) | (uint16_t)((b) << 8))
554 #define RGB8(r,g,b) ((uint16_t)((r) >> 4) | ((uint16_t)((g) >> 4) << 4) | ((uint16_t)((b) >> 4) << 8))
555 #define RGBHTML(RGB24bit) (((RGB24bit) >> 20) | ((((RGB24bit) & 0xFFFF) >> 12) << 4)|((((RGB24bit) & 0xFF) >> 4) << 8))
556
559 #define RGB_RED RGB(15, 0, 0)
560 #define RGB_DARKRED RGB( 7, 0, 0)
561 #define RGB_GREEN RGB( 0, 15, 0)
562 #define RGB_DARKGREEN RGB( 0, 7, 0)
563 #define RGB_BLUE RGB( 0, 0, 15)
564 #define RGB_DARKBLUE RGB( 0, 0, 7)
565 #define RGB_YELLOW RGB(15, 15, 0)
566 #define RGB_DARKYELLOW RGB( 7, 7, 0)
567 #define RGB_CYAN RGB( 0, 15, 15)
568 #define RGB_AQUA RGB(14, 2, 11)
569 #define RGB_PINK RGB(15, 0, 15)
570 #define RGB_PURPLE RGB(10, 0, 10)
571 #define RGB_BLACK RGB( 0, 0, 0)
572 #define RGB_DARKGRAY RGB( 5, 5, 5)
573 #define RGB_LIGHTGRAY RGB(10, 10, 10)
574 #define RGB_WHITE RGB(15, 15, 15)
575
576 #define RGB_LIGHTFLESH RGB(15, 10, 7)
577 #define RGB_BROWN RGB( 5, 5, 0)
578 #define RGB_ORANGE RGB(15, 10, 0)
579 #define RGB_TEAL RGB( 7, 7, 0)
580
581 typedef uint16_t palette_color_t;
582
583 #else
584 #error Unrecognized port
585 #endif
586
587 void set_default_palette(void);
588 inline void cgb_compatibility(void) {
589 set_default_palette();
590 }
591
592 inline void cpu_fast(void) {}
593
594 void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
595 #define set_bkg_palette_entry set_palette_entry
596 #define set_sprite_palette_entry(palette,entry,rgb_data) set_palette_entry(1,entry,rgb_data)
597
598
623 void set_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) Z88DK_CALLEE;
624 #define set_bkg_palette set_palette
625 #define set_sprite_palette(first_palette,nb_palettes,rgb_data) set_palette(1,1,rgb_data)
626
627 void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
628 void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
629 void set_bkg_native_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
630
631 void set_sprite_4bpp_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
632 void set_sprite_native_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
633
634 #define COMPAT_PALETTE(C0,C1,C2,C3) (((uint16_t)(C3) << 12) | ((uint16_t)(C2) << 8) | ((uint16_t)(C1) << 4) | (uint16_t)(C0))
635 extern uint16_t _current_2bpp_palette;
636 inline void set_2bpp_palette(uint16_t palette) {
637 _current_2bpp_palette = palette;
638 }
639 void set_tile_2bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t palette) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
640 inline void set_bkg_data(uint16_t start, uint16_t ntiles, const void *src) {
641 set_tile_2bpp_data(start, ntiles, src, _current_2bpp_palette);
642 }
643 inline void set_sprite_data(uint16_t start, uint16_t ntiles, const void *src) {
644 set_tile_2bpp_data((uint8_t)(start) + 0x100u, ntiles, src, _current_2bpp_palette);
645 }
646 inline void set_bkg_2bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
647 set_tile_2bpp_data(start, ntiles, src, _current_2bpp_palette);
648 }
649 inline void set_sprite_2bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
650 set_tile_2bpp_data((uint8_t)(start) + 0x100u, ntiles, src, _current_2bpp_palette);
651 }
652
653 extern uint16_t _current_1bpp_colors;
654 inline void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor) {
655 _current_1bpp_colors = ((uint16_t)bgcolor << 8) | fgcolor;
656 }
657 void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
658 inline void set_bkg_1bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
659 set_tile_1bpp_data(start, ntiles, src, _current_1bpp_colors);
660 }
661 inline void set_sprite_1bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
662 set_tile_1bpp_data((uint8_t)(start) + 0x100u, ntiles, src, _current_1bpp_colors);
663 }
664
665
674 void set_data(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
675 void vmemcpy(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
676
677 void set_tile_map(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE;
678 void set_tile_map_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE;
679 #define set_bkg_tiles set_tile_map_compat
680 #define set_win_tiles set_tile_map_compat
681
682 extern uint8_t _map_tile_offset;
683 inline void set_bkg_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile) {
684 _map_tile_offset = base_tile;
685 set_tile_map_compat(x, y, w, h, tiles);
686 _map_tile_offset = 0;
687 }
688 inline void set_win_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile) {
689 _map_tile_offset = base_tile;
690 set_tile_map_compat(x, y, w, h, tiles);
691 _map_tile_offset = 0;
692 }
693
694 inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
695 {
696 VBK_REG = VBK_ATTRIBUTES;
697 set_bkg_tiles(x, y, w, h, tiles);
698 VBK_REG = VBK_TILES;
699 }
700
701 void set_tile_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE;
702 void set_tile_submap_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE;
703 inline void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) {
704 set_tile_submap_compat(x, y, w, h, map_w, map);
705 }
706 inline void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) {
707 set_tile_submap_compat(x, y, w, h, map_w, map);
708 }
709
710 extern uint8_t _submap_tile_offset;
711 inline void set_bkg_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile) {
712 _submap_tile_offset = base_tile;
713 set_tile_submap_compat(x, y, w, h, map_w, map);
714 _submap_tile_offset = 0;
715 }
716 inline void set_win_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile) {
717 _submap_tile_offset = base_tile;
718 set_tile_submap_compat(x, y, w, h, map_w, map);
719 _submap_tile_offset = 0;
720 }
721
722 inline void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
723 {
724 VBK_REG = VBK_ATTRIBUTES;
725 set_bkg_submap(x, y, w, h, map, map_w);
726 VBK_REG = VBK_TILES;
727 }
728
729 void fill_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE;
730 void fill_rect_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE;
731 #define fill_bkg_rect fill_rect_compat
732 #define fill_win_rect fill_rect_compat
733
736 extern volatile uint8_t shadow_OAM[];
737
740 extern volatile uint8_t _shadow_OAM_base;
741
766 extern volatile uint8_t _shadow_OAM_OFF;
767
768 extern volatile uint8_t _sprites_OFF;
769
772 #define DISABLE_VBL_TRANSFER \
773 _shadow_OAM_base = 0
774
777 #define ENABLE_VBL_TRANSFER \
778 _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
779
782 #define MAX_HARDWARE_SPRITES 64
783
786 #define HARDWARE_SPRITE_CAN_FLIP_X 0
787
790 #define HARDWARE_SPRITE_CAN_FLIP_Y 0
791
794 inline void SET_SHADOW_OAM_ADDRESS(void * address) {
795 _shadow_OAM_base = (uint8_t)((uint16_t)address >> 8);
796 }
797
814 inline void set_sprite_tile(uint8_t nb, uint8_t tile) {
815 shadow_OAM[0x41+(nb << 1)] = tile;
816 }
817
818
825 inline uint8_t get_sprite_tile(uint8_t nb) {
826 return shadow_OAM[0x41+(nb << 1)];
827 }
828
834 inline void set_sprite_prop(uint8_t nb, uint8_t prop) {
835 nb; prop;
836 }
837
838 inline uint8_t get_sprite_prop(uint8_t nb) {
839 nb;
840 return 0;
841 }
842
855 inline void move_sprite(uint8_t nb, uint8_t x, uint8_t y) {
856 shadow_OAM[nb] = (y < VDP_SAT_TERM) ? y : 0xC0;
857 shadow_OAM[0x40+(nb << 1)] = x;
858 }
859
860
871 inline void scroll_sprite(uint8_t nb, int8_t x, int8_t y) {
872 uint8_t new_y = shadow_OAM[nb] + y;
873 shadow_OAM[nb] = (new_y < VDP_SAT_TERM) ? new_y : 0xC0;
874 shadow_OAM[0x40+(nb << 1)] += x;
875 }
876
877
882 inline void hide_sprite(uint8_t nb) {
883 shadow_OAM[nb] = 0xC0;
884 }
885
892 void set_vram_byte(uint8_t * addr, uint8_t v) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
893
901 uint8_t * set_attributed_tile_xy(uint8_t x, uint8_t y, uint16_t t) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
902
910 uint8_t * set_tile_xy(uint8_t x, uint8_t y, uint8_t t) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
911 #define set_bkg_tile_xy set_tile_xy
912 #define set_win_tile_xy set_tile_xy
913
921 inline uint8_t * set_attribute_xy(uint8_t x, uint8_t y, uint8_t a) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
922 #define set_bkg_attribute_xy set_attribute_xy
923 #define set_win_attribute_xy set_attribute_xy
924
928 uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
929 #define get_win_xy_addr get_bkg_xy_addr
930
931 #endif /* _SMS_H */
OLDCALL
#define OLDCALL
Definition: types.h:21
UBYTE
UINT8 UBYTE
Definition: types.h:62
NONBANKED
#define NONBANKED
Definition: types.h:40
PRESERVES_REGS
#define PRESERVES_REGS(...)
Definition: types.h:32
Z88DK_CALLEE
#define Z88DK_CALLEE
Definition: types.h:46
Z88DK_FASTCALL
#define Z88DK_FASTCALL
Definition: types.h:47
palette_color_t
uint16_t palette_color_t
Definition: cgb.h:85
VBK_ATTRIBUTES
#define VBK_ATTRIBUTES
Definition: hardware.h:338
VBK_TILES
#define VBK_TILES
Definition: hardware.h:336
VDP_RSCY
#define VDP_RSCY
Definition: hardware.h:113
VDP_R1
#define VDP_R1
Definition: hardware.h:53
VDP_RSCX
#define VDP_RSCX
Definition: hardware.h:108
VDP_SAT_TERM
#define VDP_SAT_TERM
Definition: hardware.h:141
R1_DISP_ON
#define R1_DISP_ON
Definition: hardware.h:58
hardware.h
set_sprite_tile
void set_sprite_tile(uint8_t nb, uint8_t tile)
Definition: sms.h:814
d
void d
Definition: sms.h:107
c
void c
Definition: sms.h:107
set_bkg_attributes
void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
Definition: sms.h:694
set_bkg_submap
void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
Definition: sms.h:703
set_sprite_2bpp_data
void set_sprite_2bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:649
fill_rect_compat
void fill_rect_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE
set_win_based_submap
void set_win_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile)
Definition: sms.h:716
set_bkg_submap_attributes
void set_bkg_submap_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
Definition: sms.h:722
joypad_ex
void joypad_ex(joypads_t *joypads) Z88DK_FASTCALL PRESERVES_REGS(iyh
set_bkg_native_data
void set_bkg_native_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
scroll_bkg
void scroll_bkg(int8_t x, int8_t y)
Definition: sms.h:227
set_sprite_data
void set_sprite_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:643
delay
void delay(uint16_t d) Z88DK_FASTCALL
_current_2bpp_palette
uint16_t _current_2bpp_palette
_current_1bpp_colors
uint16_t _current_1bpp_colors
set_default_palette
void set_default_palette(void)
set_palette_entry
void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) Z88DK_CALLEE PRESERVES_REGS(iyh
set_sprite_1bpp_data
void set_sprite_1bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:661
add_SIO
void add_SIO(int_handler h) Z88DK_FASTCALL
vmemcpy
void vmemcpy(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh
set_native_tile_data
void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
remove_JOY
void remove_JOY(int_handler h) Z88DK_FASTCALL
_vbl_done
volatile uint8_t _vbl_done
Definition: gb.h:476
_shadow_OAM_OFF
volatile uint8_t _shadow_OAM_OFF
mode
void mode(uint8_t m) OLDCALL
set_sprite_native_data
void set_sprite_native_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
get_system
uint8_t get_system(void)
Definition: sms.h:127
set_attributed_tile_xy
uint8_t * set_attributed_tile_xy(uint8_t x, uint8_t y, uint16_t t) Z88DK_CALLEE PRESERVES_REGS(iyh
add_JOY
void add_JOY(int_handler h) Z88DK_FASTCALL
WRITE_VDP_CMD
void WRITE_VDP_CMD(uint16_t cmd) Z88DK_FASTCALL PRESERVES_REGS(b
b
void b
Definition: sms.h:503
set_bkg_1bpp_data
void set_bkg_1bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:658
set_tile_map
void set_tile_map(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE
add_LCD
void add_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b
_sprites_OFF
volatile uint8_t _sprites_OFF
_shadow_OAM_base
volatile uint8_t _shadow_OAM_base
Definition: gb.h:1836
set_bkg_4bpp_data
void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
set_tile_xy
uint8_t * set_tile_xy(uint8_t x, uint8_t y, uint8_t t) Z88DK_CALLEE PRESERVES_REGS(iyh
joypad
uint8_t joypad(void) OLDCALL PRESERVES_REGS(b
move_bkg
void move_bkg(uint8_t x, uint8_t y)
Definition: sms.h:222
get_bkg_xy_addr
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh
set_tile_submap
void set_tile_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE
cgb_compatibility
void cgb_compatibility(void)
Definition: sms.h:588
get_sprite_prop
uint8_t get_sprite_prop(uint8_t nb)
Definition: sms.h:838
VBK_REG
#define VBK_REG
Definition: sms.h:41
scroll_sprite
void scroll_sprite(uint8_t nb, int8_t x, int8_t y)
Definition: sms.h:871
add_TIM
void add_TIM(int_handler h) Z88DK_FASTCALL
get_mode
uint8_t get_mode(void) OLDCALL
set_tile_map_compat
void set_tile_map_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE
_BIOS
const UBYTE _BIOS
set_win_based_tiles
void set_win_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile)
Definition: sms.h:688
set_tile_1bpp_data
void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) Z88DK_CALLEE PRESERVES_REGS(iyh
set_tile_submap_compat
void set_tile_submap_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t map_w, const uint8_t *map) Z88DK_CALLEE
sys_time
volatile uint16_t sys_time
_SYSTEM
const uint8_t _SYSTEM
SET_SHADOW_OAM_ADDRESS
void SET_SHADOW_OAM_ADDRESS(void *address)
Definition: sms.h:794
set_bkg_based_tiles
void set_bkg_based_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles, uint8_t base_tile)
Definition: sms.h:683
set_bkg_data
void set_bkg_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:640
wait_vbl_done
void wait_vbl_done(void) PRESERVES_REGS(b
cpu_fast
void cpu_fast(void)
Definition: sms.h:592
get_r_reg
uint8_t get_r_reg(void) PRESERVES_REGS(b
set_attribute_xy
uint8_t * set_attribute_xy(uint8_t x, uint8_t y, uint8_t a) Z88DK_CALLEE PRESERVES_REGS(iyh
set_data
void set_data(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh
int_handler
void(* int_handler)(void) NONBANKED
Definition: sms.h:180
__READ_VDP_REG
#define __READ_VDP_REG(REG)
Definition: sms.h:105
remove_TIM
void remove_TIM(int_handler h) Z88DK_FASTCALL
remove_SIO
void remove_SIO(int_handler h) Z88DK_FASTCALL
remove_VBL
void remove_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(iyh
set_sprite_prop
void set_sprite_prop(uint8_t nb, uint8_t prop)
Definition: sms.h:834
set_bkg_tiles
#define set_bkg_tiles
Definition: sms.h:679
fill_rect
void fill_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE
set_2bpp_palette
void set_2bpp_palette(uint16_t palette)
Definition: sms.h:636
WRITE_VDP_DATA
void WRITE_VDP_DATA(uint16_t data) Z88DK_FASTCALL PRESERVES_REGS(b
__WRITE_VDP_REG
#define __WRITE_VDP_REG(REG, v)
Definition: sms.h:104
set_bkg_2bpp_data
void set_bkg_2bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:646
_map_tile_offset
uint8_t _map_tile_offset
remove_LCD
void remove_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b
enable_interrupts
void enable_interrupts(void) PRESERVES_REGS(a
iyh
void iyh
Definition: sms.h:107
move_sprite
void move_sprite(uint8_t nb, uint8_t x, uint8_t y)
Definition: sms.h:855
_submap_tile_offset
uint8_t _submap_tile_offset
set_tile_2bpp_data
void set_tile_2bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t palette) Z88DK_CALLEE PRESERVES_REGS(iyh
h
void h
Definition: sms.h:243
set_win_submap
void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w)
Definition: sms.h:706
set_bkg_based_submap
void set_bkg_based_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w, uint8_t base_tile)
Definition: sms.h:711
joypad_init
uint8_t joypad_init(uint8_t npads, joypads_t *joypads) Z88DK_CALLEE
refresh_OAM
void refresh_OAM(void)
waitpad
uint8_t waitpad(uint8_t mask) Z88DK_FASTCALL PRESERVES_REGS(d
hide_sprite
void hide_sprite(uint8_t nb)
Definition: sms.h:882
set_sprite_4bpp_data
void set_sprite_4bpp_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
set_1bpp_colors
void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
Definition: sms.h:654
cancel_pending_interrupts
uint8_t cancel_pending_interrupts(void)
Definition: sms.h:218
disable_interrupts
void disable_interrupts(void) PRESERVES_REGS(a
add_VBL
void add_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(d
waitpadup
void waitpadup(void) PRESERVES_REGS(d
e
void e
Definition: sms.h:107
set_interrupts
void set_interrupts(uint8_t flags) Z88DK_FASTCALL
shadow_OAM
volatile uint8_t shadow_OAM[]
iyl
void iyl
Definition: sms.h:107
set_palette
void set_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) Z88DK_CALLEE
vsync
void vsync(void) PRESERVES_REGS(b
get_sprite_tile
uint8_t get_sprite_tile(uint8_t nb)
Definition: sms.h:825
l
void l
Definition: sms.h:243
set_vram_byte
void set_vram_byte(uint8_t *addr, uint8_t v) Z88DK_CALLEE PRESERVES_REGS(iyh
display_off
void display_off(void)
Definition: sms.h:253
stdint.h
int16_t
short int int16_t
Definition: stdint.h:44
uint8_t
unsigned char uint8_t
Definition: stdint.h:51
uint16_t
unsigned short int uint16_t
Definition: stdint.h:52
int8_t
signed char int8_t
Definition: stdint.h:43
joypads_t
Definition: gb.h:755
version.h