GBDK 2020 Docs 4.4.0 API Documentation for GBDK 2020

gb.h
Go to the documentation of this file.
1
4 #ifndef _GB_H
5 #define _GB_H
6
7 #include <types.h>
8 #include <stdint.h>
9 #include <gbdk/version.h>
10 #include <gb/hardware.h>
11
12 // Here NINTENDO means Game Boy & related clones
13 #define NINTENDO
14
15 #ifdef SEGA
16 #undef SEGA
17 #endif
18
19 #ifdef NINTENDO_NES
20 #undef NINTENDO_NES
21 #endif
22
23 #ifdef MSX
24 #undef MSX
25 #endif
26
27 #define SYSTEM_60HZ 0x00
28 #define SYSTEM_50HZ 0x01
29
30 #if defined(__TARGET_ap)
31 #define ANALOGUEPOCKET
32 #elif defined(__TARGET_gb)
33 #define GAMEBOY
34 #elif defined(__TARGET_duck)
35 #define MEGADUCK
36 #endif
37
38
52 #define J_UP 0x04U
53 #define J_DOWN 0x08U
54 #define J_LEFT 0x02U
55 #define J_RIGHT 0x01U
56 #define J_A 0x10U
57 #define J_B 0x20U
58 #define J_SELECT 0x40U
59 #define J_START 0x80U
60
65 #define M_DRAWING 0x01U
66 #define M_TEXT_OUT 0x02U
67 #define M_TEXT_INOUT 0x03U
73 #define M_NO_SCROLL 0x04U
77 #define M_NO_INTERP 0x08U
78
83 #define S_BANK 0x08U
88 #define S_PALETTE 0x10U
92 #define S_FLIPX 0x20U
96 #define S_FLIPY 0x40U
101 #define S_PRIORITY 0x80U
105 #define S_PAL(n) n
106
107 /* Interrupt flags */
110 #define EMPTY_IFLAG 0x00U
116 #define VBL_IFLAG 0x01U
120 #define LCD_IFLAG 0x02U
124 #define TIM_IFLAG 0x04U
128 #define SIO_IFLAG 0x08U
132 #define JOY_IFLAG 0x10U
133
134
135 /* DMG Palettes */
136 #define DMG_BLACK 0x03
137 #define DMG_DARK_GRAY 0x02
138 #define DMG_LITE_GRAY 0x01
139 #define DMG_WHITE 0x00
159 #define DMG_PALETTE(C0, C1, C2, C3) ((uint8_t)((((C3) & 0x03) << 6) | (((C2) & 0x03) << 4) | (((C1) & 0x03) << 2) | ((C0) & 0x03)))
160
161 /* Limits */
164 #define SCREENWIDTH DEVICE_SCREEN_PX_WIDTH
167 #define SCREENHEIGHT DEVICE_SCREEN_PX_HEIGHT
170 #define MINWNDPOSX DEVICE_WINDOW_PX_OFFSET_X
173 #define MINWNDPOSY DEVICE_WINDOW_PX_OFFSET_Y
176 #define MAXWNDPOSX (DEVICE_WINDOW_PX_OFFSET_X + DEVICE_SCREEN_PX_WIDTH - 1)
179 #define MAXWNDPOSY (DEVICE_WINDOW_PX_OFFSET_Y + DEVICE_SCREEN_PX_HEIGHT - 1)
180
181
184 typedef void (*int_handler)(void) NONBANKED;
185
193 void remove_VBL(int_handler h);
194
198 void remove_LCD(int_handler h);
199
203 void remove_TIM(int_handler h);
204
216 void remove_SIO(int_handler h);
217
221 void remove_JOY(int_handler h);
222
246 void add_VBL(int_handler h);
247
286 void add_LCD(int_handler h);
287
306 void add_TIM(int_handler h);
307
323 void add_low_priority_TIM(int_handler h);
324
340 void add_SIO(int_handler h);
341
342
366 void add_JOY(int_handler h);
367
368
384 void nowait_int_handler(void);
385
386
399 void wait_int_handler(void);
400
403 inline uint8_t cancel_pending_interrupts(void) {
404 return IF_REG = 0;
405 }
406
413 void mode(uint8_t m);
414
419 uint8_t get_mode(void) PRESERVES_REGS(b, c, d, e, h, l);
420
426 inline uint8_t get_system(void) {
427 return SYSTEM_60HZ;
428 }
429
434 extern uint8_t _cpu;
435
438 #define DMG_TYPE 0x01
441 #define MGB_TYPE 0xFF
444 #define CGB_TYPE 0x11
445
450 extern uint8_t _is_GBA;
451
454 #define GBA_NOT_DETECTED 0x00
457 #define GBA_DETECTED 0x01
458
461 #define DEVICE_SUPPORTS_COLOR (_cpu == CGB_TYPE)
462
469 extern volatile uint16_t sys_time;
470
476 __REG _vbl_done;
477 #define VBL_DONE _vbl_done
478
479
487 void send_byte(void);
488
496 void receive_byte(void);
497
499 extern volatile uint8_t _io_status;
500
503 extern volatile uint8_t _io_in;
504
507 extern volatile uint8_t _io_out;
508
509 /* Status codes */
511 #define IO_IDLE 0x00U
513 #define IO_SENDING 0x01U
515 #define IO_RECEIVING 0x02U
517 #define IO_ERROR 0x04U
518
519
520
534 __REG _current_bank;
535 #define CURRENT_BANK _current_bank
536
546 #ifndef BANK
547 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
548 #endif
549
562 #define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
563 __asm \
564 .local b___func_ ## VARNAME \
565 ___bank_ ## VARNAME = b___func_ ## VARNAME \
566 .globl ___bank_ ## VARNAME \
567 __endasm; \
568 }
569
579 #define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
580
596 #define SWITCH_ROM(b) (_current_bank = (b), rROMB0 = (b))
597
598 #if defined(__TARGET_duck)
599
600 #define SWITCH_RAM(b) (0)
601
602 #define ENABLE_RAM
603
604 #define DISABLE_RAM
605
606 #else
607
615 #define SWITCH_RAM(b) (rRAMB = (b))
616
619 #define ENABLE_RAM (rRAMG = 0x0A)
620
623 #define DISABLE_RAM (rRAMG = 0x00)
624
625 #endif
626
630 #define SWITCH_ROM_MEGADUCK(b) SWITCH_ROM(b)
631
640 #define SWITCH_ROM_MBC1(b) SWITCH_ROM(b)
641
649 #define SWITCH_RAM_MBC1(b) SWITCH_RAM(b)
650
653 #define ENABLE_RAM_MBC1 ENABLE_RAM
654
657 #define DISABLE_RAM_MBC1 DISABLE_RAM
658
659 #define SWITCH_16_8_MODE_MBC1 (*(volatile uint8_t *)0x6000 = 0x00)
660
661 #define SWITCH_4_32_MODE_MBC1 (*(volatile uint8_t *)0x6000 = 0x01)
662
675 #define SWITCH_ROM_MBC5(b) (_current_bank = (b), rROMB1 = 0, rROMB0 = (b))
676
690 #define SWITCH_ROM_MBC5_8M(b) (rROMB1 = ((uint16_t)(b) >> 8), rROMB0 = (b))
691
697 #define SWITCH_RAM_MBC5(b) SWITCH_RAM(b)
698
701 #define ENABLE_RAM_MBC5 ENABLE_RAM
702
705 #define DISABLE_RAM_MBC5 DISABLE_RAM
706
707
708
713 void delay(uint16_t d) PRESERVES_REGS(h, l);
714
715
716
727 uint8_t joypad(void) PRESERVES_REGS(b, c, h, l);
728
741 uint8_t waitpad(uint8_t mask) PRESERVES_REGS(b, c, h, l);
742
748 void waitpadup(void) PRESERVES_REGS(a, b, c, d, e, h, l);
749
755 typedef struct {
756 uint8_t npads;
757 union {
758 struct {
759 uint8_t joy0, joy1, joy2, joy3;
760 };
761 uint8_t joypads[4];
762 };
763 } joypads_t;
764
774 uint8_t joypad_init(uint8_t npads, joypads_t * joypads) OLDCALL;
775
782 void joypad_ex(joypads_t * joypads) PRESERVES_REGS(b, c);
783
784
785
794 inline void enable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l) {
795 __asm__("ei");
796 }
797
810 inline void disable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l) {
811 __asm__("di");
812 }
813
824 void set_interrupts(uint8_t flags) PRESERVES_REGS(b, c, d, e, h, l);
825
837 void reset(void);
838
850 void vsync(void) PRESERVES_REGS(b, c, d, e, h, l);
851
855 void wait_vbl_done(void) PRESERVES_REGS(b, c, d, e, h, l);
856
862 void display_off(void) PRESERVES_REGS(b, c, d, e, h, l);
863
866 void refresh_OAM(void) PRESERVES_REGS(b, c, d, e, h, l);
867
868
874 void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL PRESERVES_REGS(b, c);
875
876
880 #define DISPLAY_ON \
881 LCDC_REG|=LCDCF_ON
882
888 #define DISPLAY_OFF \
889 display_off();
890
893 #define HIDE_LEFT_COLUMN
894
897 #define SHOW_LEFT_COLUMN
898
901 #define SET_BORDER_COLOR(C)
902
912 #define SHOW_BKG \
913 LCDC_REG|=LCDCF_BGON
914
924 #define HIDE_BKG \
925 LCDC_REG&=~LCDCF_BGON
926
936 #define SHOW_WIN \
937 LCDC_REG|=LCDCF_WINON
938
942 #define HIDE_WIN \
943 LCDC_REG&=~LCDCF_WINON
944
948 #define SHOW_SPRITES \
949 LCDC_REG|=LCDCF_OBJON
950
956 #define HIDE_SPRITES \
957 LCDC_REG&=~LCDCF_OBJON
958
962 #define SPRITES_8x16 \
963 LCDC_REG|=LCDCF_OBJ16
964
968 #define SPRITES_8x8 \
969 LCDC_REG&=~LCDCF_OBJ16
970
971
972
979 void set_vram_byte(uint8_t * addr, uint8_t v) PRESERVES_REGS(b, c);
980
992 uint8_t get_vram_byte(uint8_t * addr) PRESERVES_REGS(b, c, h, l);
993
994
998 uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
999
1000 #define COMPAT_PALETTE(C0,C1,C2,C3) ((uint8_t)(((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0)))
1001
1004 inline void set_2bpp_palette(uint16_t palette) {
1005 palette;
1006 }
1007
1008 extern uint16_t _current_1bpp_colors;
1009
1017 void set_1bpp_colors_ex(uint8_t fgcolor, uint8_t bgcolor, uint8_t mode) OLDCALL;
1018
1038 inline void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor) {
1039 set_1bpp_colors_ex(fgcolor, bgcolor, 0);
1040 }
1041
1059 void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1060 #define set_bkg_2bpp_data set_bkg_data
1061
1080 void set_bkg_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1081
1102 void get_bkg_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1103
1104
1157 void set_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
1158 #define set_tile_map set_bkg_tiles
1159
1160
1161 extern uint8_t _map_tile_offset;
1162
1181 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) {
1182 _map_tile_offset = base_tile;
1183 set_bkg_tiles(x, y, w, h, tiles);
1184 _map_tile_offset = 0;
1185 }
1186
1187
1236 inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
1237 {
1238 VBK_REG = VBK_ATTRIBUTES;
1239 set_bkg_tiles(x, y, w, h, tiles);
1240 VBK_REG = VBK_TILES;
1241 }
1242
1243
1289 void set_bkg_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL;
1290 #define set_tile_submap set_bkg_submap
1291
1292
1293 extern uint8_t _submap_tile_offset;
1294
1314 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) {
1315 _submap_tile_offset = base_tile;
1316 set_bkg_submap(x, y, w, h, map, map_w);
1317 _submap_tile_offset = 0;
1318 }
1319
1320
1368 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)
1369 {
1370 VBK_REG = VBK_ATTRIBUTES;
1371 set_bkg_submap(x, y, w, h, map, map_w);
1372 VBK_REG = VBK_TILES;
1373 }
1374
1375
1399 void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
1400
1401
1409 uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t);
1410 #define set_tile_xy set_bkg_tile_xy
1411
1420 inline uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
1421 {
1422 uint8_t* addr;
1423 VBK_REG = VBK_ATTRIBUTES;
1424 addr = set_bkg_tile_xy(x, y, a);
1425 VBK_REG = VBK_TILES;
1426 return addr;
1427 }
1428 #define set_attribute_xy set_bkg_attribute_xy
1429
1444 uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
1445
1446
1460 inline void move_bkg(uint8_t x, uint8_t y) {
1461 SCX_REG=x, SCY_REG=y;
1462 }
1463
1464
1474 inline void scroll_bkg(int8_t x, int8_t y) {
1475 SCX_REG+=x, SCY_REG+=y;
1476 }
1477
1478
1479
1483 uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
1484
1498 void set_win_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1499
1500
1519 void set_win_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1520
1521
1539 void get_win_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1540
1541
1573 void set_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
1574
1575
1594 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) {
1595 _map_tile_offset = base_tile;
1596 set_win_tiles(x, y, w, h, tiles);
1597 _map_tile_offset = 0;
1598 }
1599
1647 void set_win_submap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, uint8_t map_w) OLDCALL;
1648
1649
1669 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) {
1670 _submap_tile_offset = base_tile;
1671 set_win_submap(x, y, w, h, map, map_w);
1672 _submap_tile_offset = 0;
1673 }
1674
1675
1699 void get_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
1700
1701
1709 uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t);
1710
1711
1724 uint8_t get_win_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
1725
1726
1738 inline void move_win(uint8_t x, uint8_t y) {
1739 WX_REG=x, WY_REG=y;
1740 }
1741
1742
1752 inline void scroll_win(int8_t x, int8_t y) {
1753 WX_REG+=x, WY_REG+=y;
1754 }
1755
1756
1757
1773 void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1774 #define set_sprite_2bpp_data set_sprite_data
1775
1794 void set_sprite_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1795
1814 void get_sprite_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
1815
1816
1823 typedef struct OAM_item_t {
1824 uint8_t y, x; //< X, Y Coordinates of the sprite on screen
1825 uint8_t tile; //< Sprite tile number
1826 uint8_t prop; //< OAM Property Flags
1827 } OAM_item_t;
1828
1829
1832 extern volatile struct OAM_item_t shadow_OAM[];
1833
1836 __REG _shadow_OAM_base;
1837
1838 #define DISABLE_OAM_DMA \
1839 _shadow_OAM_base = 0
1840
1843 #define DISABLE_VBL_TRANSFER DISABLE_OAM_DMA
1844
1845 #define ENABLE_OAM_DMA \
1846 _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
1847
1850 #define ENABLE_VBL_TRANSFER ENABLE_OAM_DMA
1851
1854 #define MAX_HARDWARE_SPRITES 40
1855
1858 #define HARDWARE_SPRITE_CAN_FLIP_X 1
1859
1862 #define HARDWARE_SPRITE_CAN_FLIP_Y 1
1863
1866 inline void SET_SHADOW_OAM_ADDRESS(void * address) {
1867 _shadow_OAM_base = (uint8_t)((uint16_t)address >> 8);
1868 }
1869
1886 inline void set_sprite_tile(uint8_t nb, uint8_t tile) {
1887 shadow_OAM[nb].tile=tile;
1888 }
1889
1890
1897 inline uint8_t get_sprite_tile(uint8_t nb) {
1898 return shadow_OAM[nb].tile;
1899 }
1900
1901
1945 inline void set_sprite_prop(uint8_t nb, uint8_t prop) {
1946 shadow_OAM[nb].prop=prop;
1947 }
1948
1949
1955 inline uint8_t get_sprite_prop(uint8_t nb) {
1956 return shadow_OAM[nb].prop;
1957 }
1958
1959
1972 inline void move_sprite(uint8_t nb, uint8_t x, uint8_t y) {
1973 OAM_item_t * itm = &shadow_OAM[nb];
1974 itm->y=y, itm->x=x;
1975 }
1976
1977
1988 inline void scroll_sprite(uint8_t nb, int8_t x, int8_t y) {
1989 OAM_item_t * itm = &shadow_OAM[nb];
1990 itm->y+=y, itm->x+=x;
1991 }
1992
1993
2000 inline void hide_sprite(uint8_t nb) {
2001 shadow_OAM[nb].y = 0;
2002 }
2003
2004
2005
2021 void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len);
2022
2023
2045 void get_data(uint8_t *data, uint8_t *vram_addr, uint16_t len);
2046
2059 void vmemcpy(uint8_t *dest, uint8_t *sour, uint16_t len);
2060
2061
2062
2086 void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) OLDCALL;
2087
2098 void set_tile_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t base) OLDCALL PRESERVES_REGS(b, c);
2099
2127 void get_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, uint8_t *tiles) OLDCALL;
2128
2129
2144 inline void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
2145 if (first_tile < 256) {
2146 set_bkg_data(first_tile, nb_tiles, data);
2147 } else {
2148 set_sprite_data(first_tile - 256, nb_tiles, data);
2149 }
2150 }
2151
2167 inline void set_bkg_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
2168 set_bkg_data(first_tile, nb_tiles, data);
2169 }
2170
2184 inline void set_sprite_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
2185 set_sprite_data(first_tile, nb_tiles, data);
2186 }
2187
2193 void init_win(uint8_t c) OLDCALL PRESERVES_REGS(b, c);
2194
2200 void init_bkg(uint8_t c) OLDCALL PRESERVES_REGS(b, c);
2201
2209 void vmemset (void *s, uint8_t c, size_t n) OLDCALL PRESERVES_REGS(b, c);
2210
2211
2212
2221 void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b, c);
2222 #define fill_rect fill_bkg_rect
2223
2232 void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b, c);
2233
2234 #endif /* _GB_H */
OLDCALL
#define OLDCALL
Definition: types.h:21
NONBANKED
#define NONBANKED
Definition: types.h:40
PRESERVES_REGS
#define PRESERVES_REGS(...)
Definition: types.h:32
hardware.h
__REG
#define __REG
Definition: hardware.h:14
WY_REG
__REG WY_REG
Definition: hardware.h:321
SCY_REG
__REG SCY_REG
Definition: hardware.h:305
WX_REG
__REG WX_REG
Definition: hardware.h:323
VBK_ATTRIBUTES
#define VBK_ATTRIBUTES
Definition: hardware.h:338
IF_REG
__REG IF_REG
Definition: hardware.h:104
VBK_REG
__REG VBK_REG
Definition: hardware.h:332
VBK_TILES
#define VBK_TILES
Definition: hardware.h:336
SCX_REG
__REG SCX_REG
Definition: hardware.h:307
_io_in
volatile uint8_t _io_in
set_sprite_tile
void set_sprite_tile(uint8_t nb, uint8_t tile)
Definition: gb.h:1886
d
uint8_t d
Definition: gb.h:419
c
uint8_t c
Definition: gb.h:419
set_bkg_attributes
void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
Definition: gb.h:1236
send_byte
void send_byte(void)
scroll_win
void scroll_win(int8_t x, int8_t y)
Definition: gb.h:1752
refresh_OAM
void refresh_OAM(void) PRESERVES_REGS(b
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: gb.h:1669
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: gb.h:1368
set_1bpp_colors_ex
void set_1bpp_colors_ex(uint8_t fgcolor, uint8_t bgcolor, uint8_t mode) OLDCALL
set_bkg_data
void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
scroll_bkg
void scroll_bkg(int8_t x, int8_t y)
Definition: gb.h:1474
_current_1bpp_colors
uint16_t _current_1bpp_colors
set_vram_byte
void set_vram_byte(uint8_t *addr, uint8_t v) PRESERVES_REGS(b
vmemcpy
void vmemcpy(uint8_t *dest, uint8_t *sour, uint16_t len)
get_win_tile_xy
uint8_t get_win_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b
_io_status
volatile uint8_t _io_status
remove_SIO
void remove_SIO(int_handler h)
receive_byte
void receive_byte(void)
shadow_OAM
volatile struct OAM_item_t shadow_OAM[]
reset
void reset(void)
Definition: nes.h:534
set_bkg_attribute_xy
uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
Definition: gb.h:1420
get_system
uint8_t get_system(void)
Definition: gb.h:426
joypad
uint8_t joypad(void) PRESERVES_REGS(b
init_bkg
void init_bkg(uint8_t c) OLDCALL PRESERVES_REGS(b
b
void b
Definition: gb.h:748
wait_int_handler
void wait_int_handler(void)
nowait_int_handler
void nowait_int_handler(void)
_is_GBA
uint8_t _is_GBA
get_bkg_tile_xy
uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b
get_bkg_data
void get_bkg_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b
set_win_tiles
void set_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b
set_data
void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len)
add_low_priority_TIM
void add_low_priority_TIM(int_handler h)
set_tiles
void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) OLDCALL
remove_TIM
void remove_TIM(int_handler h)
move_bkg
void move_bkg(uint8_t x, uint8_t y)
Definition: gb.h:1460
remove_JOY
void remove_JOY(int_handler h)
remove_LCD
void remove_LCD(int_handler h)
set_native_tile_data
void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: gb.h:2144
get_sprite_prop
uint8_t get_sprite_prop(uint8_t nb)
Definition: gb.h:1955
scroll_sprite
void scroll_sprite(uint8_t nb, int8_t x, int8_t y)
Definition: gb.h:1988
set_bkg_tiles
void set_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles) OLDCALL PRESERVES_REGS(b
set_bkg_1bpp_data
void set_bkg_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
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: gb.h:1594
fill_bkg_rect
void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b
get_data
void get_data(uint8_t *data, uint8_t *vram_addr, uint16_t len)
sys_time
volatile uint16_t sys_time
delay
void delay(uint16_t d) PRESERVES_REGS(h
_shadow_OAM_base
__REG _shadow_OAM_base
Definition: gb.h:1836
SET_SHADOW_OAM_ADDRESS
void SET_SHADOW_OAM_ADDRESS(void *address)
Definition: gb.h:1866
get_win_data
void get_win_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b
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: gb.h:1181
wait_vbl_done
void wait_vbl_done(void) PRESERVES_REGS(b
add_VBL
void add_VBL(int_handler h)
_cpu
uint8_t _cpu
get_win_tiles
void get_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b
OAM_item_t
struct OAM_item_t OAM_item_t
get_bkg_xy_addr
uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b
int_handler
void(* int_handler)(void) NONBANKED
Definition: gb.h:184
hiramcpy
void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL PRESERVES_REGS(b
vmemset
void vmemset(void *s, uint8_t c, size_t n) OLDCALL PRESERVES_REGS(b
_current_bank
__REG _current_bank
Definition: gb.h:534
SYSTEM_60HZ
#define SYSTEM_60HZ
Definition: gb.h:27
set_sprite_prop
void set_sprite_prop(uint8_t nb, uint8_t prop)
Definition: gb.h:1945
add_TIM
void add_TIM(int_handler h)
get_mode
uint8_t get_mode(void) PRESERVES_REGS(b
set_2bpp_palette
void set_2bpp_palette(uint16_t palette)
Definition: gb.h:1004
get_bkg_tiles
void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b
get_win_xy_addr
uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b
_map_tile_offset
uint8_t _map_tile_offset
set_sprite_native_data
void set_sprite_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: gb.h:2184
set_bkg_tile_xy
uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t)
enable_interrupts
void enable_interrupts(void) PRESERVES_REGS(a
display_off
void display_off(void) PRESERVES_REGS(b
set_sprite_1bpp_data
void set_sprite_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
move_sprite
void move_sprite(uint8_t nb, uint8_t x, uint8_t y)
Definition: gb.h:1972
_submap_tile_offset
uint8_t _submap_tile_offset
joypad_ex
void joypad_ex(joypads_t *joypads) PRESERVES_REGS(b
joypad_init
uint8_t joypad_init(uint8_t npads, joypads_t *joypads) OLDCALL
h
uint8_t h
Definition: gb.h:419
waitpad
uint8_t waitpad(uint8_t mask) PRESERVES_REGS(b
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: gb.h:1314
set_tile_data
void set_tile_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t base) OLDCALL PRESERVES_REGS(b
set_win_data
void set_win_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
set_win_tile_xy
uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t)
remove_VBL
void remove_VBL(int_handler h)
_io_out
volatile uint8_t _io_out
set_bkg_native_data
void set_bkg_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data)
Definition: gb.h:2167
set_win_1bpp_data
void set_win_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
hide_sprite
void hide_sprite(uint8_t nb)
Definition: gb.h:2000
fill_win_rect
void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b
waitpadup
void waitpadup(void) PRESERVES_REGS(a
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) OLDCALL
Definition: msx.h:627
set_1bpp_colors
void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
Definition: gb.h:1038
get_sprite_data
void get_sprite_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b
cancel_pending_interrupts
uint8_t cancel_pending_interrupts(void)
Definition: gb.h:403
add_LCD
void add_LCD(int_handler h)
get_vram_byte
uint8_t get_vram_byte(uint8_t *addr) PRESERVES_REGS(b
add_JOY
void add_JOY(int_handler h)
disable_interrupts
void disable_interrupts(void) PRESERVES_REGS(a
set_sprite_data
void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b
add_SIO
void add_SIO(int_handler h)
set_interrupts
void set_interrupts(uint8_t flags) PRESERVES_REGS(b
e
uint8_t e
Definition: gb.h:419
move_win
void move_win(uint8_t x, uint8_t y)
Definition: gb.h:1738
vsync
void vsync(void) PRESERVES_REGS(b
get_sprite_tile
uint8_t get_sprite_tile(uint8_t nb)
Definition: gb.h:1897
init_win
void init_win(uint8_t c) OLDCALL PRESERVES_REGS(b
l
uint8_t l
Definition: gb.h:419
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) OLDCALL
Definition: msx.h:630
get_tiles
void get_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, uint8_t *tiles) OLDCALL
mode
void mode(uint8_t m)
_vbl_done
__REG _vbl_done
Definition: gb.h:476
stdint.h
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
OAM_item_t
Definition: gb.h:1823
OAM_item_t::x
uint8_t x
Definition: gb.h:1824
OAM_item_t::prop
uint8_t prop
Definition: gb.h:1826
OAM_item_t::tile
uint8_t tile
Definition: gb.h:1825
OAM_item_t::y
uint8_t y
Definition: gb.h:1824
joypads_t
Definition: gb.h:755
joypads_t::joy0
uint8_t joy0
Definition: gb.h:759
joypads_t::npads
uint8_t npads
Definition: gb.h:756
version.h