GBDK 2020 Docs  4.3.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 
109 
117 
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 
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 
186 
191 
195 
199 
203 
207 
211 
215 
219  return VDP_STATUS;
220 }
221 
222 inline void move_bkg(uint8_t x, uint8_t y) {
225 }
226 
227 inline void scroll_bkg(int8_t x, int8_t y) {
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) {
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 
342 
349 
350 #define DIV_REG get_r_reg()
351 
354 #define _current_bank MAP_FRAME1
355 #define CURRENT_BANK MAP_FRAME1
356 
366 #ifndef BANK
367 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
368 #endif
369 
382 #define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
383 __asm \
384  .local b___func_ ## VARNAME \
385  ___bank_ ## VARNAME = b___func_ ## VARNAME \
386  .globl ___bank_ ## VARNAME \
387 __endasm; \
388 }
389 
399 #define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
400 
401 
406 #define SWITCH_ROM(b) MAP_FRAME1=(b)
407 #define SWITCH_ROM1 SWITCH_ROM
408 
413 #define SWITCH_ROM2(b) MAP_FRAME2=(b)
414 
419 #define SWITCH_RAM(b) RAM_CONTROL=((b)&1)?RAM_CONTROL|RAMCTL_BANK:RAM_CONTROL&(~RAMCTL_BANK)
420 
424 #define ENABLE_RAM RAM_CONTROL|=RAMCTL_RAM
425 
429 #define DISABLE_RAM RAM_CONTROL&=(~RAMCTL_RAM)
430 
431 
437 
438 
442 
446 
453 
459 typedef struct {
460  uint8_t npads;
461  union {
462  struct {
463  uint8_t joy0, joy1, joy2, joy3;
464  };
465  uint8_t joypads[4];
466  };
467 } joypads_t;
468 
478 
486 
495 inline void enable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l, iyh, iyl) {
496  __asm__("ei");
497 }
498 
511 inline void disable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l, iyh, iyl) {
512  __asm__("di");
513 }
514 
515 
516 #if defined(__TARGET_sms)
517 
518 #define RGB(r,g,b) ((r) | ((g) << 2) | ((b) << 4))
519 #define RGB8(r,g,b) (((r) >> 6) | (((g) >> 6) << 2) | (((b) >> 6) << 4))
520 #define RGBHTML(RGB24bit) (((RGB24bit) >> 22) | ((((RGB24bit) & 0xFFFF) >> 14) << 2) | ((((RGB24bit) & 0xFF) >> 6) << 4))
521 
524 #define RGB_RED RGB( 3, 0, 0)
525 #define RGB_DARKRED RGB( 2, 0, 0)
526 #define RGB_GREEN RGB( 0, 3, 0)
527 #define RGB_DARKGREEN RGB( 0, 2, 0)
528 #define RGB_BLUE RGB( 0, 0, 3)
529 #define RGB_DARKBLUE RGB( 0, 0, 2)
530 #define RGB_YELLOW RGB( 3, 3, 0)
531 #define RGB_DARKYELLOW RGB( 2, 2, 0)
532 #define RGB_CYAN RGB( 0, 3, 3)
533 #define RGB_AQUA RGB( 3, 1, 2)
534 #define RGB_PINK RGB( 3, 0, 3)
535 #define RGB_PURPLE RGB( 2, 0, 2)
536 #define RGB_BLACK RGB( 0, 0, 0)
537 #define RGB_DARKGRAY RGB( 1, 1, 1)
538 #define RGB_LIGHTGRAY RGB( 2, 2, 2)
539 #define RGB_WHITE RGB( 3, 3, 3)
540 
541 typedef uint8_t palette_color_t;
542 
543 #elif defined(__TARGET_gg)
544 
545 #define RGB(r,g,b) ((uint16_t)(r) | (uint16_t)((g) << 4) | (uint16_t)((b) << 8))
546 #define RGB8(r,g,b) ((uint16_t)((r) >> 4) | ((uint16_t)((g) >> 4) << 4) | ((uint16_t)((b) >> 4) << 8))
547 #define RGBHTML(RGB24bit) (((RGB24bit) >> 20) | ((((RGB24bit) & 0xFFFF) >> 12) << 4)|((((RGB24bit) & 0xFF) >> 4) << 8))
548 
551 #define RGB_RED RGB(15, 0, 0)
552 #define RGB_DARKRED RGB( 7, 0, 0)
553 #define RGB_GREEN RGB( 0, 15, 0)
554 #define RGB_DARKGREEN RGB( 0, 7, 0)
555 #define RGB_BLUE RGB( 0, 0, 15)
556 #define RGB_DARKBLUE RGB( 0, 0, 7)
557 #define RGB_YELLOW RGB(15, 15, 0)
558 #define RGB_DARKYELLOW RGB( 7, 7, 0)
559 #define RGB_CYAN RGB( 0, 15, 15)
560 #define RGB_AQUA RGB(14, 2, 11)
561 #define RGB_PINK RGB(15, 0, 15)
562 #define RGB_PURPLE RGB(10, 0, 10)
563 #define RGB_BLACK RGB( 0, 0, 0)
564 #define RGB_DARKGRAY RGB( 5, 5, 5)
565 #define RGB_LIGHTGRAY RGB(10, 10, 10)
566 #define RGB_WHITE RGB(15, 15, 15)
567 
568 #define RGB_LIGHTFLESH RGB(15, 10, 7)
569 #define RGB_BROWN RGB( 5, 5, 0)
570 #define RGB_ORANGE RGB(15, 10, 0)
571 #define RGB_TEAL RGB( 7, 7, 0)
572 
573 typedef uint16_t palette_color_t;
574 
575 #else
576 #error Unrecognized port
577 #endif
578 
580 inline void cgb_compatibility(void) {
582 }
583 
584 inline void cpu_fast(void) {}
585 
587 #define set_bkg_palette_entry set_palette_entry
588 #define set_sprite_palette_entry(palette,entry,rgb_data) set_palette_entry(1,entry,rgb_data)
589 
590 
615 void set_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) Z88DK_CALLEE;
616 #define set_bkg_palette set_palette
617 #define set_sprite_palette(first_palette,nb_palettes,rgb_data) set_palette(1,1,rgb_data)
618 
619 void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
620 void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
621 void set_bkg_native_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
622 
623 void set_sprite_4bpp_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
624 void set_sprite_native_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh, iyl);
625 
626 #define COMPAT_PALETTE(C0,C1,C2,C3) (((uint16_t)(C3) << 12) | ((uint16_t)(C2) << 8) | ((uint16_t)(C1) << 4) | (uint16_t)(C0))
628 inline void set_2bpp_palette(uint16_t palette) {
629  _current_2bpp_palette = palette;
630 }
631 void set_tile_2bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t palette) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
632 inline void set_bkg_data(uint16_t start, uint16_t ntiles, const void *src) {
633  set_tile_2bpp_data(start, ntiles, src, _current_2bpp_palette);
634 }
635 inline void set_sprite_data(uint16_t start, uint16_t ntiles, const void *src) {
636  set_tile_2bpp_data((uint8_t)(start) + 0x100u, ntiles, src, _current_2bpp_palette);
637 }
638 inline void set_bkg_2bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
639  set_tile_2bpp_data(start, ntiles, src, _current_2bpp_palette);
640 }
641 inline void set_sprite_2bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
642  set_tile_2bpp_data((uint8_t)(start) + 0x100u, ntiles, src, _current_2bpp_palette);
643 }
644 
646 inline void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor) {
647  _current_1bpp_colors = ((uint16_t)bgcolor << 8) | fgcolor;
648 }
649 void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
650 inline void set_bkg_1bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
651  set_tile_1bpp_data(start, ntiles, src, _current_1bpp_colors);
652 }
653 inline void set_sprite_1bpp_data(uint16_t start, uint16_t ntiles, const void *src) {
654  set_tile_1bpp_data((uint8_t)(start) + 0x100u, ntiles, src, _current_1bpp_colors);
655 }
656 
657 
666 void set_data(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
667 void vmemcpy(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl);
668 
671 #define set_bkg_tiles set_tile_map_compat
672 #define set_win_tiles set_tile_map_compat
673 
675 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) {
676  _map_tile_offset = base_tile;
677  set_tile_map_compat(x, y, w, h, tiles);
678  _map_tile_offset = 0;
679 }
680 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) {
681  _map_tile_offset = base_tile;
682  set_tile_map_compat(x, y, w, h, tiles);
683  _map_tile_offset = 0;
684 }
685 
686 inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
687 {
689  set_bkg_tiles(x, y, w, h, tiles);
690  VBK_REG = VBK_TILES;
691 }
692 
695 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) {
696  set_tile_submap_compat(x, y, w, h, map_w, map);
697 }
698 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) {
699  set_tile_submap_compat(x, y, w, h, map_w, map);
700 }
701 
703 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) {
704  _submap_tile_offset = base_tile;
705  set_tile_submap_compat(x, y, w, h, map_w, map);
707 }
708 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) {
709  _submap_tile_offset = base_tile;
710  set_tile_submap_compat(x, y, w, h, map_w, map);
712 }
713 
714 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)
715 {
717  set_bkg_submap(x, y, w, h, map, map_w);
718  VBK_REG = VBK_TILES;
719 }
720 
723 #define fill_bkg_rect fill_rect_compat
724 #define fill_win_rect fill_rect_compat
725 
728 extern volatile uint8_t shadow_OAM[];
729 
732 extern volatile uint8_t _shadow_OAM_base;
733 
758 extern volatile uint8_t _shadow_OAM_OFF;
759 
760 extern volatile uint8_t _sprites_OFF;
761 
764 #define DISABLE_VBL_TRANSFER \
765  _shadow_OAM_base = 0
766 
769 #define ENABLE_VBL_TRANSFER \
770  _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
771 
774 #define MAX_HARDWARE_SPRITES 64
775 
778 #define HARDWARE_SPRITE_CAN_FLIP_X 0
779 
782 #define HARDWARE_SPRITE_CAN_FLIP_Y 0
783 
786 inline void SET_SHADOW_OAM_ADDRESS(void * address) {
787  _shadow_OAM_base = (uint8_t)((uint16_t)address >> 8);
788 }
789 
806 inline void set_sprite_tile(uint8_t nb, uint8_t tile) {
807  shadow_OAM[0x41+(nb << 1)] = tile;
808 }
809 
810 
818  return shadow_OAM[0x41+(nb << 1)];
819 }
820 
826 inline void set_sprite_prop(uint8_t nb, uint8_t prop) {
827  nb; prop;
828 }
829 
831  nb;
832  return 0;
833 }
834 
847 inline void move_sprite(uint8_t nb, uint8_t x, uint8_t y) {
848  shadow_OAM[nb] = (y < VDP_SAT_TERM) ? y : 0xC0;
849  shadow_OAM[0x40+(nb << 1)] = x;
850 }
851 
852 
863 inline void scroll_sprite(uint8_t nb, int8_t x, int8_t y) {
864  uint8_t new_y = shadow_OAM[nb] + y;
865  shadow_OAM[nb] = (new_y < VDP_SAT_TERM) ? new_y : 0xC0;
866  shadow_OAM[0x40+(nb << 1)] += x;
867 }
868 
869 
874 inline void hide_sprite(uint8_t nb) {
875  shadow_OAM[nb] = 0xC0;
876 }
877 
885 
894 
903 #define set_bkg_tile_xy set_tile_xy
904 #define set_win_tile_xy set_tile_xy
905 
914 #define set_bkg_attribute_xy set_attribute_xy
915 #define set_win_attribute_xy set_attribute_xy
916 
921 #define get_win_xy_addr get_bkg_xy_addr
922 
923 #endif /* _SMS_H */
#define OLDCALL
Definition: types.h:21
UINT8 UBYTE
Definition: types.h:62
#define NONBANKED
Definition: types.h:40
#define PRESERVES_REGS(...)
Definition: types.h:32
#define Z88DK_CALLEE
Definition: types.h:46
#define Z88DK_FASTCALL
Definition: types.h:47
uint16_t palette_color_t
Definition: cgb.h:85
#define VBK_ATTRIBUTES
Definition: hardware.h:322
#define VBK_TILES
Definition: hardware.h:320
#define VDP_RSCY
Definition: hardware.h:113
#define VDP_R1
Definition: hardware.h:53
#define VDP_RSCX
Definition: hardware.h:108
#define VDP_SAT_TERM
Definition: hardware.h:141
#define R1_DISP_ON
Definition: hardware.h:58
void set_sprite_tile(uint8_t nb, uint8_t tile)
Definition: sms.h:806
void d
Definition: sms.h:107
void c
Definition: sms.h:107
void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
Definition: sms.h:686
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:695
void set_sprite_2bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:641
void fill_rect_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE
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:708
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:714
void joypad_ex(joypads_t *joypads) Z88DK_FASTCALL PRESERVES_REGS(iyh
void set_bkg_native_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
void scroll_bkg(int8_t x, int8_t y)
Definition: sms.h:227
void set_sprite_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:635
void delay(uint16_t d) Z88DK_FASTCALL
uint16_t _current_2bpp_palette
uint16_t _current_1bpp_colors
void set_default_palette(void)
void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) Z88DK_CALLEE PRESERVES_REGS(iyh
void set_sprite_1bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:653
void add_SIO(int_handler h) Z88DK_FASTCALL
void vmemcpy(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh
void set_native_tile_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
void remove_JOY(int_handler h) Z88DK_FASTCALL
volatile uint8_t _shadow_OAM_OFF
void mode(uint8_t m) OLDCALL
void set_sprite_native_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
uint8_t get_system(void)
Definition: sms.h:127
uint8_t * set_attributed_tile_xy(uint8_t x, uint8_t y, uint16_t t) Z88DK_CALLEE PRESERVES_REGS(iyh
void add_JOY(int_handler h) Z88DK_FASTCALL
void WRITE_VDP_CMD(uint16_t cmd) Z88DK_FASTCALL PRESERVES_REGS(b
void b
Definition: sms.h:495
void set_bkg_1bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:650
void set_tile_map(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE
void add_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b
volatile uint8_t _sprites_OFF
volatile uint8_t _shadow_OAM_base
Definition: gb.h:1824
void set_bkg_4bpp_data(uint16_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
uint8_t * set_tile_xy(uint8_t x, uint8_t y, uint8_t t) Z88DK_CALLEE PRESERVES_REGS(iyh
uint8_t joypad(void) OLDCALL PRESERVES_REGS(b
void move_bkg(uint8_t x, uint8_t y)
Definition: sms.h:222
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) Z88DK_CALLEE PRESERVES_REGS(iyh
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
void cgb_compatibility(void)
Definition: sms.h:580
uint8_t get_sprite_prop(uint8_t nb)
Definition: sms.h:830
#define VBK_REG
Definition: sms.h:41
void scroll_sprite(uint8_t nb, int8_t x, int8_t y)
Definition: sms.h:863
void add_TIM(int_handler h) Z88DK_FASTCALL
uint8_t get_mode(void) OLDCALL
void set_tile_map_compat(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) Z88DK_CALLEE
const UBYTE _BIOS
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:680
void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) Z88DK_CALLEE PRESERVES_REGS(iyh
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
volatile uint16_t sys_time
const uint8_t _SYSTEM
void SET_SHADOW_OAM_ADDRESS(void *address)
Definition: sms.h:786
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:675
void set_bkg_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:632
void wait_vbl_done(void) PRESERVES_REGS(b
void cpu_fast(void)
Definition: sms.h:584
uint8_t get_r_reg(void) PRESERVES_REGS(b
uint8_t * set_attribute_xy(uint8_t x, uint8_t y, uint8_t a) Z88DK_CALLEE PRESERVES_REGS(iyh
void set_data(uint16_t dst, const void *src, uint16_t size) Z88DK_CALLEE PRESERVES_REGS(iyh
void(* int_handler)(void) NONBANKED
Definition: sms.h:180
#define __READ_VDP_REG(REG)
Definition: sms.h:105
void remove_TIM(int_handler h) Z88DK_FASTCALL
void remove_SIO(int_handler h) Z88DK_FASTCALL
void remove_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(iyh
void set_sprite_prop(uint8_t nb, uint8_t prop)
Definition: sms.h:826
#define set_bkg_tiles
Definition: sms.h:671
void fill_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint16_t tile) Z88DK_CALLEE
void set_2bpp_palette(uint16_t palette)
Definition: sms.h:628
void WRITE_VDP_DATA(uint16_t data) Z88DK_FASTCALL PRESERVES_REGS(b
#define __WRITE_VDP_REG(REG, v)
Definition: sms.h:104
void set_bkg_2bpp_data(uint16_t start, uint16_t ntiles, const void *src)
Definition: sms.h:638
uint8_t _map_tile_offset
void remove_LCD(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(b
void enable_interrupts(void) PRESERVES_REGS(a
void iyh
Definition: sms.h:107
void move_sprite(uint8_t nb, uint8_t x, uint8_t y)
Definition: sms.h:847
uint8_t _submap_tile_offset
void set_tile_2bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t palette) Z88DK_CALLEE PRESERVES_REGS(iyh
void h
Definition: sms.h:243
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:698
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:703
uint8_t joypad_init(uint8_t npads, joypads_t *joypads) Z88DK_CALLEE
void refresh_OAM(void)
uint8_t waitpad(uint8_t mask) Z88DK_FASTCALL PRESERVES_REGS(d
void hide_sprite(uint8_t nb)
Definition: sms.h:874
void set_sprite_4bpp_data(uint8_t start, uint16_t ntiles, const void *src) PRESERVES_REGS(iyh
void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
Definition: sms.h:646
uint8_t cancel_pending_interrupts(void)
Definition: sms.h:218
void disable_interrupts(void) PRESERVES_REGS(a
void add_VBL(int_handler h) Z88DK_FASTCALL PRESERVES_REGS(d
void waitpadup(void) PRESERVES_REGS(d
void e
Definition: sms.h:107
void set_interrupts(uint8_t flags) Z88DK_FASTCALL
volatile uint8_t shadow_OAM[]
void iyl
Definition: sms.h:107
void set_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) Z88DK_CALLEE
void vsync(void) PRESERVES_REGS(b
uint8_t get_sprite_tile(uint8_t nb)
Definition: sms.h:817
void l
Definition: sms.h:243
void set_vram_byte(uint8_t *addr, uint8_t v) Z88DK_CALLEE PRESERVES_REGS(iyh
void display_off(void)
Definition: sms.h:253
short int int16_t
Definition: stdint.h:44
unsigned char uint8_t
Definition: stdint.h:51
unsigned short int uint16_t
Definition: stdint.h:52
signed char int8_t
Definition: stdint.h:43
Definition: gb.h:743