diff --git a/docs/api/01__getting__started_8md.html b/docs/api/01__getting__started_8md.html index 4953e2ba..f2428d2d 100644 --- a/docs/api/01__getting__started_8md.html +++ b/docs/api/01__getting__started_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/02__links__and__tools_8md.html b/docs/api/02__links__and__tools_8md.html index 0ef903f0..294753d5 100644 --- a/docs/api/02__links__and__tools_8md.html +++ b/docs/api/02__links__and__tools_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/03__using__gbdk_8md.html b/docs/api/03__using__gbdk_8md.html index 6e2f9635..e8316fa1 100644 --- a/docs/api/03__using__gbdk_8md.html +++ b/docs/api/03__using__gbdk_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/04__coding__guidelines_8md.html b/docs/api/04__coding__guidelines_8md.html index d5fc54ed..99d32289 100644 --- a/docs/api/04__coding__guidelines_8md.html +++ b/docs/api/04__coding__guidelines_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/05__banking__mbcs_8md.html b/docs/api/05__banking__mbcs_8md.html index 95a4f7b4..ff2c5298 100644 --- a/docs/api/05__banking__mbcs_8md.html +++ b/docs/api/05__banking__mbcs_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/06__toolchain_8md.html b/docs/api/06__toolchain_8md.html index d44a6642..51a31136 100644 --- a/docs/api/06__toolchain_8md.html +++ b/docs/api/06__toolchain_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/06b__supported__consoles_8md.html b/docs/api/06b__supported__consoles_8md.html index 582fd296..c11ea08e 100644 --- a/docs/api/06b__supported__consoles_8md.html +++ b/docs/api/06b__supported__consoles_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/07__sample__programs_8md.html b/docs/api/07__sample__programs_8md.html index 3685c1de..af779a67 100644 --- a/docs/api/07__sample__programs_8md.html +++ b/docs/api/07__sample__programs_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/08__faq_8md.html b/docs/api/08__faq_8md.html index a0062d16..09c9faed 100644 --- a/docs/api/08__faq_8md.html +++ b/docs/api/08__faq_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/09__migrating__new__versions_8md.html b/docs/api/09__migrating__new__versions_8md.html index bfc3114f..d45d2130 100644 --- a/docs/api/09__migrating__new__versions_8md.html +++ b/docs/api/09__migrating__new__versions_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/10__release__notes_8md.html b/docs/api/10__release__notes_8md.html index a03c415f..860cce03 100644 --- a/docs/api/10__release__notes_8md.html +++ b/docs/api/10__release__notes_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/20__toolchain__settings_8md.html b/docs/api/20__toolchain__settings_8md.html index d0ebb89b..0732c495 100644 --- a/docs/api/20__toolchain__settings_8md.html +++ b/docs/api/20__toolchain__settings_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/annotated.html b/docs/api/annotated.html index 304b5c43..5107fed5 100644 --- a/docs/api/annotated.html +++ b/docs/api/annotated.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2mos6502_2stdarg_8h.html b/docs/api/asm_2mos6502_2stdarg_8h.html index 7aed3661..4c42a533 100644 --- a/docs/api/asm_2mos6502_2stdarg_8h.html +++ b/docs/api/asm_2mos6502_2stdarg_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2mos6502_2stdarg_8h_source.html b/docs/api/asm_2mos6502_2stdarg_8h_source.html index 103ddea9..8b8ad4ca 100644 --- a/docs/api/asm_2mos6502_2stdarg_8h_source.html +++ b/docs/api/asm_2mos6502_2stdarg_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2mos6502_2string_8h.html b/docs/api/asm_2mos6502_2string_8h.html index 4c4460a3..3184027c 100644 --- a/docs/api/asm_2mos6502_2string_8h.html +++ b/docs/api/asm_2mos6502_2string_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2mos6502_2string_8h_source.html b/docs/api/asm_2mos6502_2string_8h_source.html index 62d94330..aabfebde 100644 --- a/docs/api/asm_2mos6502_2string_8h_source.html +++ b/docs/api/asm_2mos6502_2string_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2mos6502_2types_8h.html b/docs/api/asm_2mos6502_2types_8h.html index 93a67db1..0982339b 100644 --- a/docs/api/asm_2mos6502_2types_8h.html +++ b/docs/api/asm_2mos6502_2types_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2mos6502_2types_8h_source.html b/docs/api/asm_2mos6502_2types_8h_source.html index b9656bd0..253c7736 100644 --- a/docs/api/asm_2mos6502_2types_8h_source.html +++ b/docs/api/asm_2mos6502_2types_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2sm83_2stdarg_8h.html b/docs/api/asm_2sm83_2stdarg_8h.html index 7f437fc9..5242bada 100644 --- a/docs/api/asm_2sm83_2stdarg_8h.html +++ b/docs/api/asm_2sm83_2stdarg_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2sm83_2stdarg_8h_source.html b/docs/api/asm_2sm83_2stdarg_8h_source.html index 8fc55f79..9feacd82 100644 --- a/docs/api/asm_2sm83_2stdarg_8h_source.html +++ b/docs/api/asm_2sm83_2stdarg_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2sm83_2string_8h.html b/docs/api/asm_2sm83_2string_8h.html index 08232d27..5d2efda7 100644 --- a/docs/api/asm_2sm83_2string_8h.html +++ b/docs/api/asm_2sm83_2string_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2sm83_2string_8h_source.html b/docs/api/asm_2sm83_2string_8h_source.html index dc4b3489..2a9e7b4e 100644 --- a/docs/api/asm_2sm83_2string_8h_source.html +++ b/docs/api/asm_2sm83_2string_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
@@ -136,7 +136,7 @@ $(document).ready(function(){initNavTree('asm_2sm83_2string_8h_source.html','');
memcpy
void * memcpy(void *dest, const void *src, size_t len)
OLDCALL
#define OLDCALL
Definition: types.h:21
PRESERVES_REGS
#define PRESERVES_REGS(...)
Definition: types.h:32
-
b
void b
Definition: gb.h:736
+
b
void b
Definition: gb.h:748
types.h
diff --git a/docs/api/asm_2sm83_2types_8h.html b/docs/api/asm_2sm83_2types_8h.html index 74eb8576..5d47cb84 100644 --- a/docs/api/asm_2sm83_2types_8h.html +++ b/docs/api/asm_2sm83_2types_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2sm83_2types_8h_source.html b/docs/api/asm_2sm83_2types_8h_source.html index c7ae8f99..2b4b5567 100644 --- a/docs/api/asm_2sm83_2types_8h_source.html +++ b/docs/api/asm_2sm83_2types_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2types_8h.html b/docs/api/asm_2types_8h.html index 33e0ea6d..25b8845c 100644 --- a/docs/api/asm_2types_8h.html +++ b/docs/api/asm_2types_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2types_8h_source.html b/docs/api/asm_2types_8h_source.html index b6ac1549..10d314cd 100644 --- a/docs/api/asm_2types_8h_source.html +++ b/docs/api/asm_2types_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2z80_2stdarg_8h.html b/docs/api/asm_2z80_2stdarg_8h.html index d0f75e49..72528db3 100644 --- a/docs/api/asm_2z80_2stdarg_8h.html +++ b/docs/api/asm_2z80_2stdarg_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2z80_2stdarg_8h_source.html b/docs/api/asm_2z80_2stdarg_8h_source.html index da616d45..3171f194 100644 --- a/docs/api/asm_2z80_2stdarg_8h_source.html +++ b/docs/api/asm_2z80_2stdarg_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2z80_2string_8h.html b/docs/api/asm_2z80_2string_8h.html index cd7dbbdd..32a7eb81 100644 --- a/docs/api/asm_2z80_2string_8h.html +++ b/docs/api/asm_2z80_2string_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2z80_2string_8h_source.html b/docs/api/asm_2z80_2string_8h_source.html index 5bc08741..61b06b5c 100644 --- a/docs/api/asm_2z80_2string_8h_source.html +++ b/docs/api/asm_2z80_2string_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2z80_2types_8h.html b/docs/api/asm_2z80_2types_8h.html index ee1e5959..e7426bcf 100644 --- a/docs/api/asm_2z80_2types_8h.html +++ b/docs/api/asm_2z80_2types_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/asm_2z80_2types_8h_source.html b/docs/api/asm_2z80_2types_8h_source.html index 769aad5e..f361c690 100644 --- a/docs/api/asm_2z80_2types_8h_source.html +++ b/docs/api/asm_2z80_2types_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/assert_8h.html b/docs/api/assert_8h.html index a978bf2a..80b1ec2b 100644 --- a/docs/api/assert_8h.html +++ b/docs/api/assert_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/assert_8h_source.html b/docs/api/assert_8h_source.html index e7eebb94..fe2cdd2b 100644 --- a/docs/api/assert_8h_source.html +++ b/docs/api/assert_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/bgb__emu_8h.html b/docs/api/bgb__emu_8h.html index 5da29b47..dd8f29b9 100644 --- a/docs/api/bgb__emu_8h.html +++ b/docs/api/bgb__emu_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/bgb__emu_8h_source.html b/docs/api/bgb__emu_8h_source.html index 7acee94c..5bd04327 100644 --- a/docs/api/bgb__emu_8h_source.html +++ b/docs/api/bgb__emu_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/cgb_8h.html b/docs/api/cgb_8h.html index 66bf5cbd..02ca3fa5 100644 --- a/docs/api/cgb_8h.html +++ b/docs/api/cgb_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/cgb_8h_source.html b/docs/api/cgb_8h_source.html index ac84291b..23d6b9af 100644 --- a/docs/api/cgb_8h_source.html +++ b/docs/api/cgb_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
@@ -147,9 +147,9 @@ $(document).ready(function(){initNavTree('cgb_8h_source.html',''); initResizable
set_bkg_palette
void set_bkg_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) OLDCALL
set_default_palette
void set_default_palette(void)
cpu_slow
void cpu_slow(void)
-
cgb_compatibility
void cgb_compatibility(void)
Definition: sms.h:580
+
cgb_compatibility
void cgb_compatibility(void)
Definition: sms.h:588
set_sprite_palette
void set_sprite_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) OLDCALL
-
cpu_fast
void cpu_fast(void)
Definition: msx.h:543
+
cpu_fast
void cpu_fast(void)
Definition: msx.h:551
set_bkg_palette_entry
void set_bkg_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL
set_sprite_palette_entry
void set_sprite_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) OLDCALL
palette_color_t
uint16_t palette_color_t
Definition: cgb.h:85
diff --git a/docs/api/classes.html b/docs/api/classes.html index c99768a5..55859bdb 100644 --- a/docs/api/classes.html +++ b/docs/api/classes.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/console_8h.html b/docs/api/console_8h.html index af932a6e..61ddb8c3 100644 --- a/docs/api/console_8h.html +++ b/docs/api/console_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/console_8h_source.html b/docs/api/console_8h_source.html index fc9b3296..536f7d34 100644 --- a/docs/api/console_8h_source.html +++ b/docs/api/console_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/crash__handler_8h.html b/docs/api/crash__handler_8h.html index af5a7dee..e378e493 100644 --- a/docs/api/crash__handler_8h.html +++ b/docs/api/crash__handler_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/crash__handler_8h_source.html b/docs/api/crash__handler_8h_source.html index 985e0157..8c36b2ad 100644 --- a/docs/api/crash__handler_8h_source.html +++ b/docs/api/crash__handler_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/ctype_8h.html b/docs/api/ctype_8h.html index cc37572b..0286fbc0 100644 --- a/docs/api/ctype_8h.html +++ b/docs/api/ctype_8h.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/ctype_8h_source.html b/docs/api/ctype_8h_source.html index e4d4f0b4..9e25d337 100644 --- a/docs/api/ctype_8h_source.html +++ b/docs/api/ctype_8h_source.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_0a499b1b991479a5f341a18a1dd374d9.html b/docs/api/dir_0a499b1b991479a5f341a18a1dd374d9.html new file mode 100644 index 00000000..beb11a86 --- /dev/null +++ b/docs/api/dir_0a499b1b991479a5f341a18a1dd374d9.html @@ -0,0 +1,110 @@ + + + + + + + + + +GBDK 2020 Docs: gbdk-lib/include/duck Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
GBDK 2020 Docs +  4.4.0 +
+
API Documentation for GBDK 2020
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
duck Directory Reference
+
+
+ + + + + + + + +

+Files

file  laptop_io.h [code]
 
file  laptop_keycodes.h [code]
 
file  model.h [code]
 
+
+
+ + + + + diff --git a/docs/api/dir_0a499b1b991479a5f341a18a1dd374d9.js b/docs/api/dir_0a499b1b991479a5f341a18a1dd374d9.js new file mode 100644 index 00000000..e5937485 --- /dev/null +++ b/docs/api/dir_0a499b1b991479a5f341a18a1dd374d9.js @@ -0,0 +1,6 @@ +var dir_0a499b1b991479a5f341a18a1dd374d9 = +[ + [ "laptop_io.h", "laptop__io_8h.html", "laptop__io_8h" ], + [ "laptop_keycodes.h", "laptop__keycodes_8h.html", "laptop__keycodes_8h" ], + [ "model.h", "model_8h.html", "model_8h" ] +]; \ No newline at end of file diff --git a/docs/api/dir_46372ec5b7e6c755551a07954725bbf5.html b/docs/api/dir_46372ec5b7e6c755551a07954725bbf5.html index ab031471..7afdabeb 100644 --- a/docs/api/dir_46372ec5b7e6c755551a07954725bbf5.html +++ b/docs/api/dir_46372ec5b7e6c755551a07954725bbf5.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_49e56c817e5e54854c35e136979f97ca.html b/docs/api/dir_49e56c817e5e54854c35e136979f97ca.html index 1cf57af1..700eb791 100644 --- a/docs/api/dir_49e56c817e5e54854c35e136979f97ca.html +++ b/docs/api/dir_49e56c817e5e54854c35e136979f97ca.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_68ce43fa3f06453c3f79ef8becebb3b2.html b/docs/api/dir_68ce43fa3f06453c3f79ef8becebb3b2.html index 5940b752..eea2d466 100644 --- a/docs/api/dir_68ce43fa3f06453c3f79ef8becebb3b2.html +++ b/docs/api/dir_68ce43fa3f06453c3f79ef8becebb3b2.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_71c6fbf9500dd05f2fc30c566388269f.html b/docs/api/dir_71c6fbf9500dd05f2fc30c566388269f.html index f30a24f3..7d0f577e 100644 --- a/docs/api/dir_71c6fbf9500dd05f2fc30c566388269f.html +++ b/docs/api/dir_71c6fbf9500dd05f2fc30c566388269f.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_7a84f275fead463a4aefdc90fba00235.html b/docs/api/dir_7a84f275fead463a4aefdc90fba00235.html index 3e81b1c0..f7f79b1a 100644 --- a/docs/api/dir_7a84f275fead463a4aefdc90fba00235.html +++ b/docs/api/dir_7a84f275fead463a4aefdc90fba00235.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_7b7dd73d07fe37f50e5dcce289386fb1.html b/docs/api/dir_7b7dd73d07fe37f50e5dcce289386fb1.html index 385fcfa0..a9c46300 100644 --- a/docs/api/dir_7b7dd73d07fe37f50e5dcce289386fb1.html +++ b/docs/api/dir_7b7dd73d07fe37f50e5dcce289386fb1.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_8bd3092e915ccc8a773a74e0a10d4d15.html b/docs/api/dir_8bd3092e915ccc8a773a74e0a10d4d15.html index fe057070..692ec80a 100644 --- a/docs/api/dir_8bd3092e915ccc8a773a74e0a10d4d15.html +++ b/docs/api/dir_8bd3092e915ccc8a773a74e0a10d4d15.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_9a64cddab8e5f6fe5be80d8f39cb6a1f.html b/docs/api/dir_9a64cddab8e5f6fe5be80d8f39cb6a1f.html index 7ebd52f8..96e6f6e1 100644 --- a/docs/api/dir_9a64cddab8e5f6fe5be80d8f39cb6a1f.html +++ b/docs/api/dir_9a64cddab8e5f6fe5be80d8f39cb6a1f.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_a9f896cff747ba031115e41245385c17.html b/docs/api/dir_a9f896cff747ba031115e41245385c17.html index f389d1b6..2cdbf232 100644 --- a/docs/api/dir_a9f896cff747ba031115e41245385c17.html +++ b/docs/api/dir_a9f896cff747ba031115e41245385c17.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
@@ -95,6 +95,8 @@ $(document).ready(function(){initNavTree('dir_a9f896cff747ba031115e41245385c17.h Directories directory  asm   +directory  duck +  directory  gb   directory  gbdk diff --git a/docs/api/dir_a9f896cff747ba031115e41245385c17.js b/docs/api/dir_a9f896cff747ba031115e41245385c17.js index 1836e61e..b663697e 100644 --- a/docs/api/dir_a9f896cff747ba031115e41245385c17.js +++ b/docs/api/dir_a9f896cff747ba031115e41245385c17.js @@ -1,6 +1,7 @@ var dir_a9f896cff747ba031115e41245385c17 = [ [ "asm", "dir_9a64cddab8e5f6fe5be80d8f39cb6a1f.html", "dir_9a64cddab8e5f6fe5be80d8f39cb6a1f" ], + [ "duck", "dir_0a499b1b991479a5f341a18a1dd374d9.html", "dir_0a499b1b991479a5f341a18a1dd374d9" ], [ "gb", "dir_bdfe001eb73b667f67d57fb851301eb1.html", "dir_bdfe001eb73b667f67d57fb851301eb1" ], [ "gbdk", "dir_aedcfcf321a7f13aa34b51e3093299b2.html", "dir_aedcfcf321a7f13aa34b51e3093299b2" ], [ "msx", "dir_71c6fbf9500dd05f2fc30c566388269f.html", "dir_71c6fbf9500dd05f2fc30c566388269f" ], diff --git a/docs/api/dir_aedcfcf321a7f13aa34b51e3093299b2.html b/docs/api/dir_aedcfcf321a7f13aa34b51e3093299b2.html index 12224d4e..ea092088 100644 --- a/docs/api/dir_aedcfcf321a7f13aa34b51e3093299b2.html +++ b/docs/api/dir_aedcfcf321a7f13aa34b51e3093299b2.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_af92cb28f7f9115544c8de6a3c7e6d6b.html b/docs/api/dir_af92cb28f7f9115544c8de6a3c7e6d6b.html index 272d74ca..d1b1c351 100644 --- a/docs/api/dir_af92cb28f7f9115544c8de6a3c7e6d6b.html +++ b/docs/api/dir_af92cb28f7f9115544c8de6a3c7e6d6b.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_bdfe001eb73b667f67d57fb851301eb1.html b/docs/api/dir_bdfe001eb73b667f67d57fb851301eb1.html index fff45200..5edf1ede 100644 --- a/docs/api/dir_bdfe001eb73b667f67d57fb851301eb1.html +++ b/docs/api/dir_bdfe001eb73b667f67d57fb851301eb1.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/dir_ef3b2545113449f8f25e623a543d64e3.html b/docs/api/dir_ef3b2545113449f8f25e623a543d64e3.html index fe45e4f7..8a17a8b7 100644 --- a/docs/api/dir_ef3b2545113449f8f25e623a543d64e3.html +++ b/docs/api/dir_ef3b2545113449f8f25e623a543d64e3.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/docs__index_8md.html b/docs/api/docs__index_8md.html index 077ecded..d91efbf7 100644 --- a/docs/api/docs__index_8md.html +++ b/docs/api/docs__index_8md.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
diff --git a/docs/api/docs_coding_guidelines.html b/docs/api/docs_coding_guidelines.html index a6b9cecf..1dc45d1b 100644 --- a/docs/api/docs_coding_guidelines.html +++ b/docs/api/docs_coding_guidelines.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
@@ -90,50 +90,50 @@ $(document).ready(function(){initNavTree('docs_coding_guidelines.html',''); init
Coding Guidelines
-

+

Learning C / C fundamentals

Writing games and other programs with GBDK will be much easier with a basic understanding of the C language. In particular, understanding how to use C on "Embedded Platforms" (small computing systems, such as the Game Boy) can help you write better code (smaller, faster, less error prone) and avoid common pitfalls.

-

+

General C tutorials

-

+

Embedded C introductions

-

+

Game Boy games in C

-

+

Understanding the hardware

In addition to understanding the C language it's important to learn how the Game Boy hardware works. What it is capable of doing, what it isn't able to do, and what resources are available to work with. A good way to do this is by reading the Pandocs and checking out the awesome_gb list.

-

+

Writing optimal C code for the Game Boy and SDCC

The following guidelines can result in better code for the Game Boy, even though some of the guidance may be contrary to typical advice for general purpose computers that have more resources and speed.

-

+

Tools

-

+

GBTD / GBMB, Arrays and the "const" keyword

Important: The old GBTD/GBMB fails to include the const keyword when exporting to C source files for GBDK. That causes arrays to be created in RAM instead of ROM, which wastes RAM, uses a lot of ROM to initialize the RAM arrays and slows the compiler down a lot.

__Use of toxa's updated GBTD/GBMB is highly recommended.__

If you wish to use the original tools, you must add the const keyword every time the graphics are re-exported to C source files.

-

+

Avoid Reading from VRAM

In general avoid reading from VRAM since that memory is not accessible at all times. If GBDK a API function which reads from VRAM (such as get_bkg_tile_xy()) is called during a video mode when VRAM is not accessible, then that function call will delay until VRAM becomes accessible again. This can cause unnecessary slowdowns when running programs on the Game Boy. It is also not supported by GBDK on the NES platform.

Instead it is better to store things such as map data in general purpose RAM which does not have video mode access limitations.

For more information about video modes and VRAM access see the pan docs:

https://gbdev.io/pandocs/STAT.html#stat-modes

-

+

Variables

  • Use 8-bit values as much as possible. They will be much more efficient and compact than 16 and 32 bit types.
  • @@ -177,7 +177,7 @@ Variables

... // Use only the upper 8 bits for setting the sprite position move_sprite(0, player[0].h ,player[1].h); -

+

Code structure

-

+

GBDK API/Library

-

+

Toolchain

-

+

Constants, Signed-ness and Overflows

There are a some scenarios where the compiler will warn about overflows with constants. They often have to do with mixed signedness between constants and variables. To avoid problems use care about whether or not constants are explicitly defined as unsigned and what type of variables they are used with.

WARNING: overflow in implicit constant conversion

@@ -249,7 +249,7 @@ Constants, Signed-ness and Overflows

-

+

Chars and vararg functions

Parameters (chars, ints, etc) to printf / sprintf should always be explicitly cast to avoid type related parameter passing issues.

For example, below will result in the likely unintended output:

printf(str_temp, "%u, %d, %x\n", UINT16_MAX, INT16_MIN, UINT16_MAX);
@@ -263,7 +263,7 @@ Chars and vararg functions
// Will output: "65535, -32768, FFFF"
short int int16_t
Definition: stdint.h:44
unsigned short int uint16_t
Definition: stdint.h:52
-

+

Chars

In standard C when chars are passed to a function with variadic arguments (varargs, those declared with ... as a parameter), such as printf(), those chars get automatically promoted to ints. For an 8 bit CPU such as the Game Boy's, this is not as efficient or desirable in most cases. So the default SDCC behavior, which GBDK-2020 expects, is that chars will remain chars and not get promoted to ints when explicitly cast as chars while calling a varargs function.

-

+

Banked Calling Convention

The following is primarily oriented toward the Game Boy and related clones (sm83 devices), other targets such as sms/gg may vary.

Key Points:

GBDK includes several example programs both in C and in assembly. They are located in the examples directory, and in its subdirectories. They can be built by typing make in the correnponding directory.

-

+

banks (various projects)

There are several different projects showing how to use ROM banking with GBDK.

-

+

comm

Illustrates how to use communication routines.

-

+

crash

Demonstrates how to use the optional GBDK crash handler which dumps debug info to the Game Boy screen in the event of a program crash.

-

+

colorbar

The colorbar program, written by Mr. N.U. of TeamKNOx, illustrates the use of colors on a Color GameBoy.

-

+

dscan

Deep Scan is a game written by Mr. N.U. of TeamKNOx that supports the Color GameBoy. Your aim is to destroy the submarines from your boat, and to avoid the projectiles that they send to you. The game should be self-explanatory. The following keys are used:

RIGHT/LEFT   : Move your boat
 A/B          : Send a bomb from one side of your boat
@@ -114,28 +114,28 @@ When game is paused:
 SELECT       : Invert A and B buttons
 RIGHT/LEFT   : Change speed
 UP/DOWN      : Change level
-

+

filltest

Demonstrates various graphics routines.

-

+

fonts

Examples of how to work with the built in font and printing features.

-

+

galaxy

A C translation of the space.s assembly program.

-

+

gb-dtmf

The gb-dtmf, written by Osamu Ohashi, is a Dual Tone Multi-Frequency (DTMF) generator.

-

+

gbdecompress

Demonstrates using gbdecompress to load a compressed tile set into VRAM.

-

+

irq

Illustrates how to install interrupt handlers.

-

+

large map

Shows how to scroll with maps larger than 32 x 32 tiles using set_bkg_submap(). It fills rows and columns at the edges of the visible viewport (of the hardware Background Map) with the desired sub-region of the large map as it scrolls.

-

+

metasprites

Demonstrates using the metasprite features to move and animate a large sprite.

-

+

lcd isr wobble

An example of how to use the LCD ISR for visual special effects.

-

+

paint

The paint example is a painting program. It supports different painting tools, drawing modes, and colors. At the moment, it only paints individual pixels. This program illustrates the use of the full-screen drawing library. It also illustrates the use of generic structures and big sprites.

Arrow keys : Move the cursor
 SELECT     : Display/hide the tools palette
 A          : Select tool
-

+

rand

The rand program, written by Luc Van den Borre, illustrates the use of the GBDK random generator.

-

+

ram_fn

The ram_fn example illustrates how to copy functions to RAM or HIRAM, and how to call them from C.

-

+

rpn

A basic RPN calculator. Try entering expressions like 12 134* and then 1789+.

-

+

samptest

Demonstration of playing a sound sample.

-

+

sgb (various)

A collection of examples showing how to use the Super Game Boy API features.

-

+

sound

The sound example is meant for experimenting with the sound generator of the GameBoy (to use on a real GameBoy). The four different sound modes of the GameBoy are available. It also demonstrates the use of bit fields in C (it's a quick hack, so don't expect too much from the code). The following keys are used:

UP/DOWN      : Move the cursor
 RIGHT/LEFT   : Increment/decrement the value
@@ -177,14 +177,14 @@ START        : Play the current mode's sound (or all modes if in control screen)
 START+A      : Play a little music with the current mode's sound
 SELECT       : Change the sound mode (1, 2, 3, 4 and control)
 SELECT+A     : Dump the sound registers to the screen
-

+

space

The space example is an assembly program that demonstrates the use of sprites, window, background, fixed-point values and more. The following keys are used:

Arrow keys     : Change the speed (and direction) of the sprite
 Arrow keys + A : Change the speed (and direction) of the window
 Arrow keys + B : Change the speed (and direction) of the background
 START          : Open/close the door
 SELECT         : Basic fading effect
-

+

templates

Two basic template examples are provided as a starting place for writing your GBDK programs.

diff --git a/docs/api/docs_faq.html b/docs/api/docs_faq.html index 864c64bc..0311bcff 100644 --- a/docs/api/docs_faq.html +++ b/docs/api/docs_faq.html @@ -29,7 +29,7 @@
GBDK 2020 Docs -  4.3.0 +  4.4.0
API Documentation for GBDK 2020
@@ -91,7 +91,7 @@ $(document).ready(function(){initNavTree('docs_faq.html',''); initResizable(); }

-

+

General

-

+

Licensing

-

+

Graphics and Resources

-

+

ROM Header Settings

-

+

Editors

-

+

Errors and Warnings

-

+

Debugging / Compiling / Toolchain

-

+

API / Utilities

Follow the steps in this section to start using GBDK-2020.

-

+

1. Download a Release and unzip it

You can get the latest releases from here: https://github.com/gbdk-2020/gbdk-2020/releases

-

+

Known Issue: Windows and folder names with spaces on non-C drives

There is a known issue on Windows where sdcc will fail when run from folder names with spaces on non-C drives.

For the time being the workaround is as follows (with D:\My Stuff\ as an example folder):

    @@ -117,26 +117,26 @@ Known Issue: Windows and folder names with spaces on non-C drives
-

+

2. Compile Example projects

Make sure your GBDK-2020 installation is working correctly by compiling some of the included example projects.

If everything works in the steps below and there are no errors reported then each project that was built should have its own .gb ROM file (or suitable extension for the other supported targets).

-

+

Windows (without Make installed):

Navigate to a project within the example projects folder ("examples\gb\" under your GBDK-2020 install folder) and open a command line. Then type:

compile
 

or

compile.bat
 

This should build the example project. You can also navigate into other example project folders and build in the same way.

-

+

Linux / macOS / Windows with Make installed:

Navigate to the example projects folder ("examples/gb/" under your GBDK-2020 install folder) and open a command line. Then type:

make
 

This should build all of the examples sequentially. You can also navigate into an individual example project's folder and build it by typing make.

-

+

macOS security warnings

If you get a security warning on macOS that says ("`... developer cannot be verified, macOS cannot verify that this app is free from malware`"), it does not mean that GBDK is malware. It just means the GBDK toolchain binaries are not signed by Apple, so it won't run them without an additional step.

You will need to unquarrantine the files in the bin folder in order to run them. This can be fixed using the following steps.

Open a terminal and navigate to the gbdk bin folder ("bin/" under your GBDK-2020 install folder). Then type:

xattr -d com.apple.quarantine *
-

+

3. Use a Template

To create a new project use a template!

There are template projects included in the GBDK example projects to help you get up and running. Their folder names start with template_.

@@ -146,14 +146,14 @@ macOS security warnings
  • Type make on the command line in that folder to verify it still builds.
  • Open main.c to start making changes.
  • -

    +

    4. If you use GBTD / GBMB, get the fixed version

    If you plan to use GBTD / GBMB for making graphics, make sure to get the version with the const fix and other improvements. See const_gbtd_gbmb.

    -

    +

    5. Review Coding Guidelines

    Take a look at the coding guidelines, even if you have experience writing software for other platforms. There is important information to help you get good results and performance on the Game Boy.

    If you haven't written programs in C before, check the C tutorials section.

    -

    +

    6. Hardware and Resources

    If you have a specific project in mind, consider what hardware you want to target. It isn't something that has to be decided up front, but it can influence design and implementation.

    What size will your game or program be?

    -

    +

    7. Set up C Source debugging

    Tracking down problems in code is easier with a debugger. Emulicious has a debug adapter that provides C source debugging with GBDK-2020.

    -

    +

    8. Try a GBDK Tutorial

    You might want to start off with a guided GBDK tutorial from the GBDK Tutorials section.

    • Note: Tutorials (or parts of them) may be based on the older GBDK from the 2000's before it was updated to be GBDK-2020. The general principles are all the same, but the setup and parts of the toolchain (compiler/etc) may be somewhat different and some links may be outdated (pointing to the old GBDK or old tools).
    -

    +

    9. Read up!

    -

    +

    10. Need help?

    Check out the links for online community and support and read the FAQ.

    -

    +

    Migrating From Pre-GBDK-2020 Tutorials

    Several popular GBDK Tutorials, Videos and How-to's were made before GBDK-2020 was available, as a result some information they include is outdated or incompatible. The following summarizes changes that should be made for best results.

    -

    +

    Also see:

    -

    +

    Use auto-banking

    GBDK-2020 now supports auto-banking (rom_autobanking). In most cases using auto-banking will be easier and less error prone than manually assigning source and assets to banks.

    • There is a source example banks_autobank project.
    -

    +

    Non-standard types (UINT8, etc)

    The old GBDK types UINT8, INT8, UINT16, INT16 are non-standard and less portable.

    The following should be used instead: uint8_t, int16_t, uint16_t, int32_t, uint32_t and bool.

    These are standard types defined in stdint.h (#include <stdint.h>) and stdbool.h (#include <stdbool.h>).

    -

    +

    If using GBTD / GBMB, get the fixed version

    If you plan to use GBTD / GBMB for making graphics, make sure to get the version with the const fix and other improvements. See const_gbtd_gbmb.

    -

    +

    LCC and SDCC flags that are not needed

    The following flag is no longer needed with lcc and sdcc, it can be removed without any loss of performance.

    • -DUSE_SFR
        @@ -224,23 +224,23 @@ LCC and SDCC flags that are not needed
    -

    +

    ROM Header Settings (such as Color, SGB, etc)

    Setting ROM bytes directly with -Wl-yp0x<address>=0x<value> is no longer supported. Instead use makebin flags. For example, use -Wm-yC instead of -Wl-yp0x143=0xC0. See faq_gb_type_header_setting.

    -

    +

    GBDK Header include changes

    The following header files which are now cross platform were moved from gb/ to gbdk/: bcd.h, console.h, far_ptr.h, font.h, gbdecompress.h, gbdk-lib.h, incbin.h, metasprites.h, platform.h, version.h

    • When including them use #include <gbdk/...> instead of #include <gb/>
    -

    +

    Include .h headers, not .c source files

    Do not #include .c source files into other .c source files. Instead create .h header files for them and include those.

    -

    +

    Use the Template Projects

    Modern project templates are included with GBDK-2020. Using them (and their Makefile or compile.bat) as a starting point for projects is recommended and can help ensure better default settings and project organization.

    -

    +

    Use hUGEtracker instead of gbt_player

    hUGEtracker and its driver hUGEdriver are smaller, more efficient and more versatile than gbt_player.

    diff --git a/docs/api/docs_links_and_tools.html b/docs/api/docs_links_and_tools.html index 59dd2398..f3d8a930 100644 --- a/docs/api/docs_links_and_tools.html +++ b/docs/api/docs_links_and_tools.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -92,7 +92,7 @@ $(document).ready(function(){initNavTree('docs_links_and_tools.html',''); initRe

    This is a brief list of useful tools and information. It is not meant to be complete or exhaustive, for a larger list see the Awesome Game Boy Development list.

    -

    +

    SDCC Compiler Suite User Manual

    -

    +

    Getting Help

    -

    +

    Game Boy Documentation

    -

    +

    Sega Master System / Game Gear Documentation

    • SMS Power!
      Community site with technical documentation, reviews and other content related to the Sega 8-bit systems.
      https://www.smspower.org/
    +

    +

    +Mega Duck / Cougar Boy Documentation

    +
      +
    • MegaDuck.dev
      + A collection of technical information and resources for the Mega Duck / Cougar Boy console.
      + https://megaduck.dev/
    • +

    -

    +

    Tutorials

    -

    +

    Example code

    -

    +

    Graphics Tools

    -

    -Music And Sound Effects

    +

    +Music And Sound Effects for the Game Boy

    +

    +Music And Sound Effects for the SMS/Game Gear

    +

    -

    +

    Emulators

    Intellisense in VSCode may have trouble identifying some GBDK types or functions, and therefore flag them as warnings or unidentified.

    GBDK platform constants can be declared so that header files are parsed more completely in VSCode. The following c_cpp_properties.json example may be adapted for your own project.

        {
    @@ -220,7 +241,7 @@ Emulators
             "version": 4
         }
     

    -

    +

    Debugging tools

    • Emulicious debug adapter
      @@ -245,14 +266,14 @@ Debugging tools Add line-by-line C source code to the main symbol file in a BGB compatible format. This allows for C source-like debugging in BGB in a limited way. https://gbdev.gg8.se/forums/viewtopic.php?id=710

    -

    +

    Optimizing Assembly

    -

    +

    Continuous Integration and Deployment

    • GBDK GitHub Action Builder
      diff --git a/docs/api/docs_migrating_versions.html b/docs/api/docs_migrating_versions.html index 945f573a..3b9f4f29 100644 --- a/docs/api/docs_migrating_versions.html +++ b/docs/api/docs_migrating_versions.html @@ -29,7 +29,7 @@
      GBDK 2020 Docs -  4.3.0 +  4.4.0
      API Documentation for GBDK 2020
      @@ -91,9 +91,41 @@ $(document).ready(function(){initNavTree('docs_migrating_versions.html',''); ini

    This section contains information that may be useful to know or important when upgrading to a newer GBDK release.

    -

    +

    GBDK-2020 versions

    -

    +

    +Porting to GBDK-2020 4.4.0

    +
      +
    • GBDK now requires ~SDCC 4.5.0 or higher with GBDK-2020 patches for the z80 and NES
    • +
    • Build Host:
        +
      • Changed from building on MacOS 11 to MacOS 13 for 64 bit Intel
      • +
      • Changed from building on Ubuntu Linux 20.04 to 22.04 for 64 bit Intel
      • +
      +
    • +
    • NES
        +
      • LCD bkg_scroll_y is now relative to the current scanline
          +
        • This change creates higher compatibility with the Game Boy SCY_REG and makes it easier to re-use Game Boy LCD handlers
        • +
        • This behaves differently to 4.3.0 and affects LCD handlers that change the y scrolling coordinate mid-frame
        • +
        +
      • +
      • Added makenes utility for finalizing NES rom headers (called automatically by lcc)
      • +
      +
    • +
    • SMS/GG
        +
      • Changed from unsigned (uint16_t) to signed int16 (int16_t) for coordinates with the family of ...metasprite...() functions
      • +
      +
    • +
    • SDCC
        +
      • Changed to using the -N flag with sdas since the the -n flag was removed
      • +
      +
    • +
    • Changed lcc to use --no-optsdcc-in-asm for building user programs and the GBDK library
        +
      • This removes some "O line" meta-data from object files to avoid false-positive linker errors
      • +
      • It is a workaround for SDCC now appending the calling convention to the "O Line" in the object files by default
      • +
      +
    • +
    +

    Porting to GBDK-2020 4.3.0

    • GBDK now requires ~SDCC 4.4.0 or higher with GBDK-2020 patches for the z80 and NES
    • @@ -115,7 +147,7 @@ Porting to GBDK-2020 4.3.0
    -

    +

    Porting to GBDK-2020 4.2.0

    • GBDK now requires ~SDCC 4.3 or higher with GBDK-2020 patches for the z80 and NES
    • @@ -136,12 +168,12 @@ Porting to GBDK-2020 4.2.0
    -

    +

    Porting to GBDK-2020 4.1.1

    • No significant changes required
    -

    +

    Porting to GBDK-2020 4.1.0

    • GBDK now requires SDCC 4.2 or higher with GBDK-2020 patches for the z80 linker
    • @@ -171,7 +203,7 @@ Porting to GBDK-2020 4.1.0
    -

    +

    Porting to GBDK-2020 4.0.6

    • Renamed bgb_emu.h to emu_debug.h and BGB_* functions to EMU_*
        @@ -179,7 +211,7 @@ Porting to GBDK-2020 4.0.6
    -

    +

    Porting to GBDK-2020 4.0.5

    • GBDK now requires SDCC 12259 or higher with GBDK-2020 patches
    • @@ -196,18 +228,18 @@ Porting to GBDK-2020 4.0.5
    -

    +

    Porting to GBDK-2020 4.0.4

    • GBDK now requires SDCC 12238 or higher
    • Made sample.h, cgb.h and sgb.h independent from gb.h
    -

    +

    Porting to GBDK-2020 4.0.3

    • No significant changes required
    -

    +

    Porting to GBDK-2020 4.0.2

    • The default font has been reduced from 256 to 96 characters.
        @@ -216,7 +248,7 @@ Porting to GBDK-2020 4.0.2
    -

    +

    Porting to GBDK-2020 4.0.1

    • Important! : The WRAM memory region is no longer automatically initialized to zeros during startup.
        @@ -228,7 +260,7 @@ Porting to GBDK-2020 4.0.1
      • In .ihx files, multiple writes to the same ROM address are now warned about using ihxcheck.
      • set_*_tiles() now wrap maps around horizontal and vertical boundaries correctly. Code relying on it not wrapping correctly may be affected.
      -

      +

      Porting to GBDK-2020 4.0

      • GBDK now requires SDCC 4.0.3 or higher
      • @@ -240,22 +272,22 @@ Porting to GBDK-2020 4.0
      • Setting ROM bytes directly with -Wl-yp0x<address>=0x<value> is no longer supported. Instead use makebin flags. For example, use -Wm-yC instead of -Wl-yp0x143=0xC0. See faq_gb_type_header_setting.
      • OAM symbol has been renamed to _shadow_OAM, that allows accessing shadow OAM directly from C code
      -

      +

      Porting to GBDK-2020 3.2

      • No significant changes required
      -

      +

      Porting to GBDK-2020 3.1.1

      • No significant changes required
      -

      +

      Porting to GBDK-2020 3.1

      -

      +

      Porting to GBDK-2020 3.0.1

      • LCC was upgraded to use SDCC v4.0. Makefile changes may be required
          @@ -272,9 +304,9 @@ Porting to GBDK-2020 3.0.1

        -

        +

        Historical GBDK versions

        -

        +

        GBDK 1.1 to GBDK 2.0

        • Change your int variables to long if they have to be bigger than 255. If they should only contain values between 0 and 255, use an unsigned int.
        • diff --git a/docs/api/docs_releases.html b/docs/api/docs_releases.html index 9ed5d124..ff67fca9 100644 --- a/docs/api/docs_releases.html +++ b/docs/api/docs_releases.html @@ -29,7 +29,7 @@
          GBDK 2020 Docs -  4.3.0 +  4.4.0
          API Documentation for GBDK 2020
          @@ -91,11 +91,132 @@ $(document).ready(function(){initNavTree('docs_releases.html',''); initResizable

    The GBDK-2020 releases can be found on Github: https://github.com/gbdk-2020/gbdk-2020/releases

    -

    +

    GBDK-2020 Release Notes

    -

    +

    +GBDK-2020 4.4.0

    +

    2025/...

      +
    • Includes SDCC version ~4.5.0 (15267) with GBDK-2020 patches for Z80 and NES +
    • +
    • Building GBDK
        +
      • Added native GBDK build for ARM 64 Linux
      • +
      • Changed from building on MacOS 11 to MacOS 13 for 64 bit Intel
      • +
      • Changed from building on Ubuntu Linux 20.04 to 22.04 for 64 bit Intel
      • +
      +
    • +
    • SDCC
        +
      • Changed to using the -N flag with sdas since the the -n flag was removed
      • +
      +
    • +
    • Library +
    • +
    • Toolchain / Utilities
        +
      • Added makenes utility for finalizing NES rom headers (called automatically by lcc)
      • +
      • lcc
          +
        • Changed use --no-optsdcc-in-asm for building user programs and the GBDK library
            +
          • This removes some "O line" meta-data from object files to avoid false-positive linker errors
          • +
          • It is a workaround for SDCC now appending the calling convention to the "O Line" in the object files by default
          • +
          +
        • +
        • Changed to warn about some deprecated flags: A,b, B, -dn, -g, -n, -O, P, -p, -static, -t, -w
        • +
        +
      • +
      • png2asset
          +
        • Added -area option to specify linker area name (such as -area LIT for SMS/GG)
        • +
        • Added support for 512 tiles via alternate tile bank on GBC
        • +
        • Fixed Palette Generation broken when using -source_tileset option
        • +
        +
      • +
      • bankpack
          +
        • Added support for MBC7
        • +
        • Fixed bugs with large number of object files
        • +
        +
      • +
      • romusage
          +
        • Added Set hex bytes treated as Empty in ROM files (.gb/etc) -b:HEXVAL:[...]
        • +
        • Added option to Hide memory regions (ex hide all RAM: -nMEM:RAM)
        • +
        • Added support NES (-p:NES1) .noi/.map files
        • +
        • Changed to allow filename at any location in option arguments
        • +
        • Changed to improve error messaging
        • +
        • Fixed detecting areas with leading underscores for .noi/.map files
        • +
        • Fixed Brief/summarized mode counting overlapped header areas multiple times
        • +
        +
      • +
      • png2hicolorgb
          +
        • Added --palendbit for indicating end of data
        • +
        • Added --addendcolor=N for appending color to clear the background on non-full height images
        • +
        • Added --precompiled mode
        • +
        • Added -s to specify variable/symbol name in C output
        • +
        +
      • +
      • ihxcheck
          +
        • Fixed check on max bank to prevent crash
        • +
        +
      • +
      +
    • +
    • Examples
        +
      • Added Text and Dialog example
      • +
      • Changed irq example to be cross-platform
      • +
      • Improved emu_debug example
      • +
      • Improved Logo example Readme
      • +
      • Game Boy
          +
        • Added MBC3 Real Time Clock (RTC) example
        • +
        • Added MBC7 Accelerometer example
        • +
        +
      • +
      • MegaDuck
          +
        • Added MegaDuck Laptop model examples for keyboard, RTC and speech
        • +
        +
      • +
      +
    • +
    • Docs:
        +
      • Added Cart SRAM Max Size to MBC Chart and clarify battery/save meaning
      • +
      +
    • +
    +

    GBDK-2020 4.3.0

    -

    ~2024/05

      +

      2024/06

      • Includes SDCC version ~4.4.0 (14650) with GBDK-2020 patches for Z80 and NES
        • Patched SDCC Builds with support for Sega GG/SMS and the Nintendo NES are used.
        • See the github workflow for details.
        • @@ -126,7 +247,7 @@ GBDK-2020 4.3.0
        • Fixed VRAM transfer buffer bug (ensure stack page cleared on reset)
        • Fixed support for 4-player controllers using fourscore
        • Fixed set_sprite_palette() to index from 0..3 instead of 4..7
        • -
        • Fixed __move_metasprite to initialize Y index register to zero
        • +
        • Fixed move_metasprite to initialize Y index register to zero
        • Fixed waitpadup to wait for button release instead of press
        • Updated libc to latest from sdcc 4.4.0
        @@ -153,7 +274,7 @@ GBDK-2020 4.3.0
    • Optimized native tile data loading routines
    • -
    • Improved VDP_WRITE_DATA macro so it does not need di/ei protection
    • +
    • Improved WRITE_VDP_DATA macro so it does not need di/ei protection
    • Improved palette initialization in crt0
    • Fixed tilemap wrapping over the low bound of the VDP name table
    • Fixed scroll_sprite()
    • @@ -257,7 +378,7 @@ GBDK-2020 4.3.0
    -

    +

    GBDK-2020 4.2.0

    2023/08

    • Includes SDCC version ~4.3 with GBDK-2020 patches for Z80 and NES
        @@ -355,7 +476,7 @@ GBDK-2020 4.2.0
    -

    +

    GBDK-2020 4.1.1

    2022/11

    • Includes SDCC version 13350 with GBDK-2020 patches for Z80
    • @@ -364,7 +485,7 @@ GBDK-2020 4.1.1
    -

    +

    GBDK-2020 4.1.0

    2022/10

    • Includes SDCC version 13350 with GBDK-2020 patches for Z80
    • @@ -483,7 +604,7 @@ GBDK-2020 4.1.0
    -

    +

    GBDK-2020 4.0.6

    2022/02

    • Includes SDCC version 12539 with GBDK-2020 patches for Z80
    • @@ -512,7 +633,7 @@ GBDK-2020 4.0.6
  • Changed headers to wrap SDCC specific features (such as NONBANKED) with #ifdef __SDCC
  • -
  • Changed rand() and arand() to return uint8_t instead of int8_t (closer to the standard)
  • +
  • Changed rand() and arand() to return uint8_t instead of int8_t (closer to the standard)
  • Fixed declaration for PCM_SAMPLE and definition for AUD3WAVE
  • Fixed definition of size_t to be unsigned int instead of int
  • Fixed vmemcpy() and memmove() for SMS/GG
  • @@ -555,7 +676,7 @@ GBDK-2020 4.0.6 -

    +

    GBDK-2020 4.0.5

    2021/09

    • Includes SDCC version 12539 with GBDK-2020 patches for Z80
    • @@ -640,7 +761,7 @@ GBDK-2020 4.0.5
    -

    +

    GBDK-2020 4.0.4

    2021/06

    • Library
        @@ -693,7 +814,7 @@ GBDK-2020 4.0.4
    -

    +

    GBDK-2020 4.0.3

    2021/03

    • Library
        @@ -729,7 +850,7 @@ GBDK-2020 4.0.3
    -

    +

    GBDK-2020 4.0.2

    2021/01/17

    • Includes SDCC snapshot build version 12016 (has a fix for duplicate debug symbols generated from inlined header functions which GBDK 4.0+ uses)
    • @@ -753,7 +874,7 @@ GBDK-2020 4.0.2
    • Examples: Added bgb debug example
    -

    +

    GBDK-2020 4.0.1

    2020/11/14

    • Updated API documentation
    • @@ -779,7 +900,7 @@ GBDK-2020 4.0.1
    -

    +

    GBDK-2020 4.0

    2020/10/01

    • GBDK now requires SDCC 4.0.3 or higher, that has fully working toolchain. Old link-gbz80 linker is not used anymore, sdldgb and makebin are used to link objects and produce binary roms; maccer tool is no longer needed either
        @@ -808,19 +929,19 @@ GBDK-2020 4.0
    -

    +

    GBDK-2020 3.2

    2020/06/05

    • Fixed OAM initialization that was causing a bad access to VRAM
    • Interrupt handlers now wait for lcd controller mode 0 or 1 by default to prevent access to inaccessible VRAM in several functions (like set_bkg_tiles)
    • Several optimizations here and there
    -

    +

    GBDK-2020 3.1.1

    2020/05/17

    • Fixed issues with libgcc_s_dw2-1.dll
    -

    +

    GBDK-2020 3.1

    2020/05/16

    • Banked functions are working! The patcher is fully integrated in link-gbz80, no extra tools are needed. It is based on Toxa's work
        @@ -838,20 +959,20 @@ GBDK-2020 3.1
    -

    +

    GBDK-2020 3.0.1

    2020/04/12

    • Updated SDCC to v.4.0
    • Updated LCC to work with the new compiler
    -

    +

    GBDK-2020 3.0

    2020/04/12

    • Initial GBDK-2020 release Updated SDCC to v4.0 The new linker is not working so the old version is still there There is an issue with sdagb compiling drawing.s (the JP in line 32 after ".org .MODE_TABLE+4*.G_MODE" it's writing more than 4 bytes invading some addresses required by input.s:41) Because of this, all .s files in libc have been assembled with the old as-gbz80 and that's why it is still included
    -

    +

    Historical GBDK Release Notes

    -

    +

    GBDK 2.96

    17 April, 2000 Many changes.

    • Code generated is now much more reliable and passes all of sdcc's regression suite.
    • @@ -859,7 +980,7 @@ GBDK 2.96
    • Added full 32 bit long support.
    • Still no floating pt support.
    -

    +

    GBDK 2.95-3

    19th August, 2000

      @@ -869,7 +990,7 @@ GBDK 2.95-3

    This is an experimental release for those who feel keen. The main change is a new lexer (the first part in the compilation process which recognises words and symbols like '!=' and 'char' and turns them into a token number) which speeds up compilation of large initialised arrays like tile data by a factor of three. Please report any bugs that show up - this is a big change.

    I have also included a 'minimal' release for win32 users which omits the documentation, library sources, and examples. If this is useful I will keep doing it.

    -

    +

    GBDK 2.95-2

    5th August, 2000 Just a small update. From the README:

      @@ -878,7 +999,7 @@ GBDK 2.95-2
    • Changed the ways globals are exported, reducing the amount of extra junk linked in.
    • Turned on the optimisations in flex. Large constant arrays like tile data should compile a bit faster.
    -

    +

    GBDK 2.95

    22nd July, 2000

    • Fixed 'a << c' for c = [9..15]
    • @@ -898,7 +1019,7 @@ GBDK 2.95

      Decent rgbds support. All the libraries and most of the examples can now compile with rgbds as the assembler. Banked function support. It is now easier to break the 32k barrier from within C. Functions can live in and be called transparently from any bank. Only works with rgbds Fixed some decent bugs with RSH, LSH, and a nasty bug with + and - for int's and pointers. Various optimisations in the code generator.

      7th July, 2000 Information on float and long support. Someone asked about the state of float/long support recently. Heres my reply:

      long support is partly there, as is float support. The compiler will correctly recognise the long and float keywords, and will generate the code for most basic ops (+, -, &, | etc) for longs correctly and will generate the function calls for floats and hard long operations (*, /, %) correctly. However it wont generate float constants in the correct format, nor will it 'return' a long or float - gbdk doesn't yet support returning types of 4 bytes. Unfortunately its not going to make it into 2.95 as there's too much else to do, but I should be able to complete long support for 2.96

      -

      +

      GBDK 2.94

      7th May, 2000 Many fixes - see the README for more.

      7th May - Library documentation up. A good size part of the libraries that go with gbdk have been documented - follow the HTML link above to have a look. Thanks to quang for a good chunk of the gb.h documentation. Please report any errors :)

        @@ -914,7 +1035,7 @@ GBDK 2.94
    -

    +

    GBDK 2.93

    6th April, 2000 From the README

      @@ -926,7 +1047,7 @@ GBDK 2.93
    • The dscan demo now fully works (with a hack :)
    • There is a bug with cached computed values which are later used as pointers. When the value is first used as a BYTE arg, then later as a pointer the pointer fails as the high byte was never computed and is now missing. A temporary fix is to declare something appropriate as 'volatile' to stop the value being cached. See dscan.c/bombs() for an example.
    -

    +

    GBDK 2.92-2 for win32

    26th March, 2000 This is a maintenance release for win32 which fixes some of the niggly install problems, especially:

    • win32 only. Takes care of some of the install bugs, including:
        @@ -942,7 +1063,7 @@ GBDK 2.92-2 for win32

        See the ChangeLog section in the README for more information.

        21st March, 2000 Problems with the installer. It seems that the demo of InstallVISE has an unreasonably short time limit. I had planed to use the demo until the license key came through, but there's no sign of the key yet and the 3 day evaluation is up. If anyone knows of a free Windows installer with the ability to modify environment variables, please contact me. I hear that temporarily setting you clock back to the 15th works...

        18th March, 2000 libc5 version available / "Error creating temp file" Thanks to Rodrigo Couto there is now a Linux/libc5 version of gbdk3-2.92 available - follow the download link above. At least it will be there when the main sourceforge site comes back up... Also some people have reported a bug where the compiler reports '*** Error creating temp file'. Try typing "mkdir c: tmp" from a DOS prompt and see if that helps.

        -

        +

        GBDK 2.92

        8th March, 2000 Better than 2.91 :). Can now be installed anywhere. All the demos work. See the README for more.

        • All the examples now work (with a little bit of patching :)
            @@ -955,7 +1076,7 @@ GBDK 2.92
        -

        +

        GBDK 2.91

        27th Feb, 2000 Better than 2.90 and includes Linux, win32 and a source tar ball. Some notes:

        Read the README first Linux users need libgc-4 or above. Debian users try apt-get install libgc5. All the types have changed. Again, please read the README first. I prefer release early, release often. The idea is to get the bugs out there so that they can be squashed quickly. I've split up the libs so that they can be used on other platforms and so that the libs can be updated without updating the compiler. One side effect is that gb specific files have been shifted into their own directory i.e. gb.h is now gb/gb.h.

        @@ -964,27 +1085,27 @@ GBDK 2.91

        8th Jan, 2000 Moved over to sourceforge.net. Thanks must go to David Pfeffer for gbdk's previous resting place, www.gbdev.org. The transition is not complete, but cvs and web have been shifted. Note that the cvs download instructions are stale - you should now look to cvs.gbdk.sourceforge.net. I am currently working on porting sdcc over to the Z80. David Nathan is looking at porting it to the GB.

        6th Jan, 2000 Icehawk wrote "I did write some rumble pack routines. Just make sure to remind people to add -Wl-yt0x1C or -Wl-yt0x1D or -Wl-yt0x1E depending on sram and battery usage. Find the routines on my site (as usual). =)"

        18th Oct, 1999 Bug tracking / FAQ up. Try the link on the left to report any bugs with GBDK. It's also the first place to look if your having problems.

        -

        +

        GBDK 2.1.5

        17th Oct, 1999

        The compiler is the same, but some of the libraries have been improved. memset() and memcpy() are much faster, malloc() is fixed, and a high speed fixed block alternative malloc() was added.

        -

        +

        GBDK 2.0b11 (DOS binary only) - 24 November 1997

        • Fixed another bug in code generation, that could happen when performing logical operations on 1-byte variables.
        -

        +

        GBDK 2.0b10 (DOS binary only) - 6 November 1997

        • Fixed a nasty bug in code generation, that could happen when performing arithmetic operations on 1-byte variables.
        • Changed the name of same files of the gb-dtmf example so that it compiles on DOS.
        -

        +

        GBDK 2.0b9 (DOS binary only)

        • Several bug fixes in the compiler and in the libraries.
        -

        +

        GBDK 2.0b8 (DOS binary only)

        • Limited all file names to 8 characters to solve problems on DOS.
        • @@ -993,14 +1114,14 @@ GBDK 2.0b8 (DOS binary only)
        • It is possible to specify the name of the program (to be written in the image header) at link time using the -Wl-yn="XXX" flag (where X is the name of the program, which can contain up to 16 characters in quotes, including spaces; on Unix, depending on your shell, you must add backslashes before quotes and spaces like in -Wl-yn="My\ Game").
        • Several bug fixes in the compiler.
        -

        +

        GBDK 2.0b7 (DOS binary only)

        • GBDK now uses a pre-release of lcc 4.1 (DOS binary only), that fixes a couple of problems in code generation.
        • A couple of important points have been documented in the GBDK Programming Guidelines and Known Problems sections.
        • Several improvements and optimizations to the code generator.
        -

        +

        GBDK 2.0b6

        • Added a peephole optimizer (with few rules at the moment).
        • @@ -1012,7 +1133,7 @@ GBDK 2.0b6
        • Added RAM banks support (switch_ram_bank() function). The switch_bank() function has been renamed to switch_rom_bank(). The banks.c example has been updated. The flags for generating multiple bank images have been modified.
        • It is possible to set the sprite ram location at link time using the -Wl-g.OAM=# flag (where # is the address of the sprite ram). The sprite ram address must begin at an address multiple of 0x100, and is 0xA0 bytes long.
        -

        +

        GBDK 2.0b5

        • New documentation (not finished yet).
        • @@ -1022,26 +1143,26 @@ GBDK 2.0b5
        • Added a game (Deep Scan) written by a friend of Osamu.
        • Modified the delay() function so that it takes a long parameter. It can be used to wait between 1 and 65536 milliseconds (0 = 65536). The pause() function has been removed.
        -

        +

        GBDK 2.0b4

        • Fixed a bug that could generate wrong code when using hexadecimal constants.
        • A new example (galaxy.c) has been added. It is the C version of the space.s example. sprite.c has been removed.
        • Most of the libraries have been split into small modules for reducing final code size.
        -

        +

        GBDK 2.0b3

        • GBDK can generate multiple-banks images, i.e. images greater than 32kB (see the banks example).
        • It is possible to set the stack pointer at link time using the -Wl-g.STACK=# flag (where # is the address of the stack pointer). Several functions (e.g. show_bkg()) have been changed into macros (e.g. SHOW_BKG). The delay() function waits exactly 1 millisecond, and the pause() waits 256 milliseconds. Linking with the standard libraries is no more required. The lib/gb.lib (lib\gb.lib on DOS) text file contains a list of modules in which to look for undefined symbols. The linker will parse this file, and link your code with the required modules only. The stdio library has been split in several object files, and only necessary modules will be added to your code, thus reducing its size. The GBDK distribution can be located anywhere in your system if you use the -Wo-lccdir=GBDK-DIR flag when invoking lcc. Bug fixes.
        -

        +

        GBDK 2.0b2

        • Lots of bug fixes.
        • GBDK has to be in the \GBDK-2.0 directory on DOS machines.
        -

        +

        GBDK 2.0b1

        • The code generator has been completely rewritten with the new version of lcc. It produces much smaller and more efficient code. The size of the code is generally between 20 and 50% smaller. A number of small optimizations are still to be done.
        • @@ -1054,7 +1175,7 @@ GBDK 2.0b1
        • The linker generates the complement checksum correctly now.
        • The libraries and example programs have been modified for the new code generator.
        -

        +

        GBDK 1.1

        • Removed Xloadimage from the GBDK distribution. It is now available as a separate archive.
        • @@ -1063,7 +1184,7 @@ GBDK 1.1
        • The make script has been improved. Compiling on UNIX should be easier.
        • Many bugfixes.
        -

        +

        GBDK 1.0-1 1996

    diff --git a/docs/api/docs_rombanking_mbcs.html b/docs/api/docs_rombanking_mbcs.html index c8951a29..59170136 100644 --- a/docs/api/docs_rombanking_mbcs.html +++ b/docs/api/docs_rombanking_mbcs.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -90,14 +90,14 @@ $(document).ready(function(){initNavTree('docs_rombanking_mbcs.html',''); initRe
    ROM/RAM Banking and MBCs
    -

    +

    ROM/RAM Banking and MBCs (Memory Bank Controllers)

    The standard Game Boy cartridge with no MBC has a fixed 32K bytes of ROM. In order to make cartridges with larger ROM sizes (to store more code and graphics) MBCs can be used. They allow switching between multiple ROM banks that use the same memory region. Only one of the banks can be selected as active at a given time, while all the other banks are inactive (and so, inaccessible).

    The majority of this section about banking is focused on the Game Boy since that is the original GBDK platform. Much of it still applies for the Game Gear(GG) and Sega Master System(SMS). For additional details about banking specifically related to these two systems see the SMS/GG Banking section.

    -

    +

    Non-banked cartridges

    Cartridges with no MBC controller are non-banked, they have 32K bytes of fixed ROM space and no switchable banks. For these cartridges the ROM space between 0000h and 7FFFh can be treated as a single large bank of 32K bytes, or as two contiguous banks of 16K bytes in Bank 0 at 0000h - 3FFFh and Bank 1 at 4000h to 7FFFh.

    -

    +

    MBC Banked cartridges (Memory Bank Controllers)

    Cartridges with MBCs allow the the Game Boy to work with ROMS up to 8MB in size and with RAM up to 128kB. Each bank is 16K Bytes. The following are usually true, with some exceptions:

    • Bank 0 of the ROM is located in the region at 0000h - 3FFFh. It is fixed (non-banked) and cannot be switched out for another bank.
    • @@ -105,20 +105,20 @@ MBC Banked cartridges (Memory Bank Controllers)

  • It is not necessary to manually assign Bank 0 for source files, that will happen by default if no bank is specified.
  • See the Pandocs for more details about the individual MBCs and their capabilities.

    -

    +

    Recommended MBC type

    For most projects we recommend MBC5.

    -

    +

    Bank 0 Size Limit and Overflows When Using MBCs

    When using MBCs and bank switching the space used in the lower fixed Bank 0 must be <= 16K bytes. Otherwise it's data will overflow into Bank 1 and may be overwriten or overwrite other data, and can get switched out when banks are changed.

    See the FAQ entry about bank overflow errors.

    -

    +

    Conserving Bank 0 for Important Functions and Data

    When using MBCs, Bank 0 is the only bank which is always active and it's code can run regardless of what other banks are active. This means it is a limited resource and should be prioritized for data and functions which must be accessible regardless of which bank is currently active.

    -

    +

    Working with Banks

    To assign code and constant data (such as graphics) to a ROM bank and use it:

    -

    +

    Setting the ROM bank for a Source file

    The ROM and RAM bank for a source file can be set in a couple different ways. Multiple different banks cannot be assigned inside the same source file (unless the __addressmod method is used), but multiple source files can share the same bank.

    If no ROM and RAM bank are specified for a file then the default _CODE, _BSS and _DATA segments are used.

    @@ -136,13 +136,13 @@ Setting the ROM bank for a Source file
  • Using rom_autobanking
  • Note: You can use the NONBANKED keyword to define a function as non-banked if it resides in a source file which has been assigned a bank.

    -

    +

    Setting the RAM bank for a Source file

    -

    +

    Setting the MBC and number of ROM & RAM banks available

    At the link stage this is done with lcc using pass-through switches for makebin.

    -

    +

    Currently active bank: CURRENT_BANK

    The global variable CURRENT_BANK (a macro for _current_bank) is updated automatically when calling SWITCH_ROM(), SWITCH_ROM_MBC1() and SWITCH_ROM_MBC5, or when a BANKED function is called.

    Normaly banked calls are used and the active bank does not need to be directly managed, but in the case that it does the following shows how to save and restore it.

    @@ -364,7 +369,7 @@ Currently active bank: CURRENT_BANK
    // And then restored if needed
    SWITCH_ROM(_saved_bank);

    -

    +

    Auto-Banking

    A ROM bank auto-assignment feature was added in GBDK 2020 4.0.2.

    Instead of having to manually specify which bank a source file will reside in, the banks can be assigned automatically to make the best use of space. The bank assignment operates on object files, after compiling/assembling and before linking.

    @@ -386,13 +391,13 @@ Auto-Banking
    BANKREF(level_1_map)
    ...
    const uint8_t level_1_map[] = {... some map data here ...};
    -
    BANKREF
    #define BANKREF(VARNAME)
    Definition: gb.h:550
    +
    BANKREF
    #define BANKREF(VARNAME)
    Definition: gb.h:562

    Accessing that data: main.c

    BANKREF_EXTERN(level_1_map)
    ...
    SWITCH_ROM( BANK(level_1_map) );
    // Do something with level_1_map[]
    -
    #define BANKREF_EXTERN(VARNAME)
    Definition: gb.h:567
    +
    #define BANKREF_EXTERN(VARNAME)
    Definition: gb.h:579

    Features and Notes:

    @@ -404,20 +409,20 @@ Auto-Banking
  • For example consider a fixed-bank source file growing too large to share a bank with an auto-banked source file that was previously assigned to it. To avoid a bank overflow it would be important to have the auto-banked file check every time whether it can share that bank or not.
  • See bankpack for more options and settings.
  • -

    +

    Errors related to banking (overflow, multiple writes to same location)

    A bank overflow during compile/link time (in makebin) is when more code and data are allocated to a ROM bank than it has capacity for. The address for any overflowed data will be incorrect and the data is potentially unreachable since it now resides at the start of a different bank instead of the end of the expected bank.

    See the FAQ entry about bank overflow errors.

    The current toolchain can only detect and warn (using ihxcheck) when one bank overflows into another bank that has data at its start. It cannot warn if a bank overflows into an empty one. For more complete detection, you can use the romusage tool.

    -

    +

    Bank space usage

    In order to see how much space is used or remains available in a bank you can use the romusage tool.

    -

    +

    Other important notes

    -

    +

    Banking example projects

    There are several projects in the GBDK 2020 examples folder which demonstrate different ways to use banking.

    "SMS/GG Banking" section.

    -

    +

    SMS/Game Gear Banking

    The memory banking setup for SMS and Game Gear in GBDK is different than it is for the Game Boy. Instead of a single switchable bank in the 0x4000 - 0x7FFF range, there are two switchable frames at different address ranges. The configuration is as follows:

    Banked code and any pointers associated with it will only work correctly when active in Frame 1 (at 0x4000), so it must use CODE_<N>. Graphics and other assets may go in either Frame 1 (at 0x4000) or, if designed for it then Frame 2 (at 0x8000).

    -

    +

    Auto-Banking

    CODE and LIT cannot share the same bank number. For example, if CODE is assigned to bank 3 then LIT cannot be in bank 3 as well.

    bankpack is aware of this requirement and will group CODE and LIT separately when packing for autobanking. It's process is as follows:

      diff --git a/docs/api/docs_supported_consoles.html b/docs/api/docs_supported_consoles.html index 46146c39..940f9f2e 100644 --- a/docs/api/docs_supported_consoles.html +++ b/docs/api/docs_supported_consoles.html @@ -29,7 +29,7 @@
      GBDK 2020 Docs -  4.3.0 +  4.4.0
      API Documentation for GBDK 2020
      @@ -91,7 +91,7 @@ $(document).ready(function(){initNavTree('docs_supported_consoles.html',''); ini

      -

      +

      Consoles Supported by GBDK

      As of version 4.2.0 GBDK includes support for other consoles in addition to the Game Boy.

        @@ -111,12 +111,12 @@ Consoles Supported by GBDK

      While the GBDK API has many convenience functions that work the same or similar across different consoles, it's important to keep their different capabilities in mind when writing code intended to run on more than one. Some (but not all) of the differences are screen sizes, color capabilities, memory layouts, processor type (z80 vs gbz80/sm83) and speed.

      -

      +

      Cross Compiling for Different Consoles

      -

      +

      lcc

      When compiling and building through lcc use the -m<port>:<plat> flag to select the desired console via its port and platform combination. See below for available settings.

      -

      +

      sdcc

      When building directly with the sdcc toolchain, the following must be specified manually (when using lcc it will populate these automatically based on -m<port>:<plat>).

      When compiling with sdcc:

        @@ -142,7 +142,7 @@ sdcc
      • makecom <image.bin> [<image.noi>] <output.com>

      -

      +

      Console Port and Platform Settings

      Note: Starting with GBDK-2020 4.1.0 and SDCC 4.2, the Game Boy and related clones use sm83 for the port instead of gbz80

        @@ -183,10 +183,10 @@ Console Port and Platform Settings
      -

      +

      Cross-Platform Constants

      There are several constant #defines that can be used to help select console specific code during compile time (with #ifdef, #ifndef) .

      -

      +

      Console Identifiers

      • When <gb/gb.h> is included (either directly or through <gbdk/platform.h>)
          @@ -229,7 +229,7 @@ Console Identifiers
      -

      +

      Console Hardware Properties

      Constants that describe properties of the console hardware are listed below. Their values will change to reflect the current console target that is being built.

      -

      +

      Using <gbdk/...> headers

      Some include files under <gbdk/..> are cross platform and others allow the build process to auto-select the correct include file for the current target port and platform (console).

      For example, the following can be used

      #include <gbdk/platform.h>
      @@ -252,15 +252,15 @@ Using <gbdk/...> headers
       

      and

      #include <sms/sms.h>
       #include <sms/metasprites.h>
       

      -

      +

      Cross Platform Example Projects

      GBDK includes an number of cross platform example projects. These projects show how to write code that can be compiled and run on multiple different consoles (for example Game Boy and Game Gear) with, in some cases, minimal differences.

      They also show how to build for multiple target consoles with a single build command and Makefile. The Makefile.targets allows selecting different port and plat settings when calling the build stages.

      -

      +

      Cross Platform Asset Example

      The cross-platform Logo example project shows how assets can be managed for multiple different console targets together.

      In the example utility_png2asset is used to generate assets in the native format for each console at compile-time from separate source PNG images. The Makefile is set to use the source PNG folder which matches the current console being compiled, and the source code uses set_bkg_native_data() to load the assets tiles in native format to the tile memory used for background tiles on that platform.

      -

      +

      Hardware Summaries

      The specs below reflect the typical configuration of hardware when used with GBDK and is not meant as a complete list of their capabilities.

      GB/AP/DUCK

        @@ -336,7 +336,7 @@ Hardware Summaries

      -

      +

      Safe VRAM / Display Controller Access

      GB/AP

      • VRAM / Display Controller (PPU)

        -

        +

        Using Game Boy Color (GBC/CGB) Features

        -

        +

        Differences Versus the Regular Game Boy (DMG/GBP/SGB)

        These are some of the main hardware differences between the Regular Game Boy and the Game Boy Color.

          @@ -380,7 +380,7 @@ Differences Versus the Regular Game Boy (DMG/GBP/SGB)
        • WRAM: 8 x 4K WRAM banks in the 0xD000 - 0xDFFF region
        • LCD VRAM DMA
        -

        +

        Game Boy Color features in GBDK

        These are some of the main GBDK API features for the CGB. Many of the items listed below link to additional information.

          @@ -403,17 +403,17 @@ Game Boy Color features in GBDK
        • Detect and change CPU speed: if (_cpu == CGB_TYPE), cpu_fast()
        • More details in cgb.h (#include <gb/cgb.h>)
        -

        +

        CGB Examples

        Several examples in GBDK show how to use CGB features, including the following:

        • gb/colorbar, gb/dscan, cross-platform/large_map, cross-platform/logo, cross-platform/metasprites
        -

        +

        Porting Between Supported Consoles

        -

        +

        From Game Boy to Analogue Pocket

        The Analogue Pocket operating in .pocket mode is (for practical purposes) functionally identical to the Game Boy / Color though it has a couple changes listed below. These are handled automatically in GBDK as long as the practices outlined below are followed.

        -

        +

        Official differences:

        • Altered register flag and address definitions
            @@ -430,7 +430,7 @@ Official differences:
        -

        +

        Observed differences:

        • MBC1 and MBC5 are supported, MBC3 won't save and RTC doesn't progress when game is not running, the HuC3 isn't supported at all (via JoseJX and sg).
        • @@ -438,7 +438,7 @@ Observed differences:
        • The IR port in CGB mode does not work as reliably as the Game Boy Color

        In order for software to be easily ported to the Analogue Pocket, or to run on both, use the following practices.

        -

        +

        Registers and Flags

        Use API defined registers and register flags instead of hardwired ones.

        • LCDC register: LCDC_REG or rLCDC
        • @@ -446,12 +446,12 @@ Registers and Flags
        • LCDC flags: -> LCDCF_... (example: LCDCF_ON)
        • STAT flags: -> STATF_... (example: STATF_LYC)
        -

        +

        Boot logo

        As long as the target console is set during build time then the correct boot logo will be automatically selected.

        -

        +

        From Game Boy to SMS/GG

        -

        +

        RAM Banks

        • The SMS/GG ROM file size must be at least 64K to enable mapper support for RAM banks in emulators.
            @@ -459,16 +459,16 @@ RAM Banks
        -

        +

        Tile Data and Tile Map loading

        -

        +

        Tile and Map Data in 2bpp Game Boy Format

        • set_bkg_data() and set_sprite_data() will load 2bpp tile data in "Game Boy" format on both GB and SMS/GG.
        • On the SMS/GG set_2bpp_palette() sets 4 colors that will be used when loading 2bpp assets with set_bkg_data(). This allows GB assets to be easily colorized without changing the asset format. There is some performance penalty for using the conversion.
        • set_bkg_tiles() loads 1-byte-per-tile tilemaps both for the GB and SMS/GG.
        -

        +

        Tile and Map Data in Native Format

        Use the following api calls when assets are avaialble in the native format for each platform.

        set_native_tile_data()

        -

        +

        Colors and Palettes

        The SMS/GG have 2 x 16 color palettes:

        -

        +

        Emulated Game Boy Color map attributes on the SMS/Game Gear

        On the Game Boy Color, VBK_REG is used to select between the regular background tile map and the background attribute tile map (for setting tile color palette and other properties).

        This behavior is emulated for the SMS/GG when using set_bkg_tiles() and VBK_REG. It allows writing a 1-byte tile map separately from a 1-byte attributes map.

        Note
        Tile map attributes on SMS/Game Gear use different control bits than the Game Boy Color, so a modified attribute map must be used.

        -

        +

        From Game Boy to NES

        The NES graphics architecture is similar to the GB's. However, there are a number of design choices in the NES hardware that make the NES a particularly cumbersome platform to develop for, and that will require special attention.

        Most notably:

          @@ -533,10 +533,10 @@ From Game Boy to NES

        To provide an easier experience, gbdk-nes attempts to hide most of these quirks so that in theory the programming experience for gbdk-nes should be as close as possible to that of the GB/GBC. However, to avoid surprises it is recommended to familiarize yourself with the NES-specific quirks and implementation choices mentioned here.

        This entire section is written as a guide on porting GB projects to NES. If you are new to GBDK, you may wish to familiarize yourself with using GBDK for GB development first as the topics covered will make a lot more sense after gaining experience with GB development.

        -

        +

        Mapper

        Currently the NES support in GBDK uses UNROM-512 (Mapper30) with single-screen mirroring.

        -

        +

        Buffered mode vs direct mode

        On the GB, the vblank period serves as an optimal time to write data to PPU memory, and PPU memory can also be written efficiently with VRAM DMA.

        On the NES, writing PPU memory during the vblank period is not optional. Whenever rendering is turned on the PPU is in a state where accessing PPU memory results in undefined behavior outside the short vblank period. The NES also has no VRAM DMA hardware to help with data writes. This makes the vblank period not only more precious, but important to never exceed to avoid glitched games.

        @@ -547,7 +547,7 @@ Buffered mode vs direct mode
      • DISPLAY_OFF will switch the system into direct mode, allowing much larger/faster transfers while the screen is blanked

      The following sections describe how the buffered / direct modes work in more detail. As buffered / direct mode is mostly hidden by the API calls, feel free to skip these sections if you wish.

      -

      +

      Buffered mode implementation details

      To take maximum advantage of the short vblank period, gbdk-nes implements a popular optimization: An unrolled loop that pulls prepared data bytes from the stack.

      PLA
       STA PPUDATA
      @@ -561,15 +561,13 @@ RTS
       

      By doing writes to this buffer during game logic, your game will effectively keep writing data transfer commands for the vblank NMI handler to process in the next vblank period, without having to wait until the vblank.

      Given that the transfer buffer only has space for around 100 data bytes, it is important to not overfill the buffer, as this will bring code execution to a screeching halt, until the NMI handler empties the old contents of the buffer to free up space and allow new commands to be written.

      Buffered mode is typically used for scrolling updates or dynamically animated tiles, where only a small amount of bytes need updating per frame.

      -

      +

      Direct mode implementation details

      During direct mode, all graphics routines will write directly to the PPUADDR / PPUDATA ports and the transfer buffer limit is never a concern because the transfer buffer is effectively bypassed.

      Direct mode is typically used for initializing large amounts of tile data at boot and/or level loading time. Unless you plan to have an animated loading screen and decompress a lot of data, it makes more sense to just fade the screen to black and allow direct mode to write data as fast as possible.

      -

      -Caveat: Make sure the transfer buffer is emptied before switching to direct mode

      -

      Because the switch to direct mode is instant and doesn't wait for the next invocation of the vblank, it is possible to create situations where there is still remaining data in the transfer buffer that would only get written once the system is switched back to buffered mode.

      -

      To avoid this situation, make sure to always "drain" the buffer by doing a call to vsync when you expect your code to finish.

      -

      +

      Direct mode also affects how (fake) interrupt handlers are processed. As long as vsync() is called on each frame, the VBL and LCD handlers will still be executed in direct mode - but no graphics registers will be written.

      +

      The TIM handler will still be executed as normal.

      +

      Caveat: Only update the PPU palette during buffered mode

      The oddity that PPU palette values are accessed through the same mechanism as other PPU memory bytes comes with the side effect that the vblank NMI handler will only write the palette values in buffered mode.

      The reason for this design choice is two-fold:

        @@ -577,52 +575,78 @@ Caveat: Only update the PPU palette during buffered mode
      • Having the palette updates also switch to direct mode would run into another quirk of the system: Pointing PPUADDR at palette registers when display is turned off will make the display output that palette color instead of the common background color. The result would be glitchy artifacts on screen when updating the palette, leading to a slightly-glitchy looking game whenever the palette is updated with the screen off

      To work around this, you are advised to never fully turn the display off during a palette fade. If you don't follow this advice all your palette updates will get delayed until the screen is turned back on.

      -

      +

      Shadow PPU registers

      Like the SMS, the NES hardware is designed to only allow loading the full X/Y scroll on the very first scanline. i.e., under normal operation you are only allowed to change the Y-scroll once.

      In contrast to the SMS, this limitation can be circumvented with a specific set of out-of-order writes to the PPUSCROLL/PPUADDR registers, taking advantage of the quirk that the PPUADDR and PPUSCROLL share register bits. But this write sequence is very timing-sensitive as the writes need to fall into (a smaller portion of) the hblank period in order to avoid race conditions when the CPU and PPU both try to update the same register during scanline rendering.

      To simplify the programming interface, gbdk-nes functions like move_bkg / scroll_bkg only ever update shadow registers in RAM. The vblank NMI handler will later pick these values up and write them to the actual PPU registers registers.

      -

      +

      Implementation of (fake) vbl / lcd handlers

      GBDK provides an API for installing Interrupt Service Routines that execute on start of vblank (VBL handler), or on a specific scanline (LCD handler).

      -

      But the base NES system has no suitable scanline interrupts that can provide such functionality. So instead, gbdk-nes API allows fake handlers to be installed in the goal of keeping code compatible with other platforms.

      +

      But the base NES system has no suitable scanline interrupts that can provide the exact equivalent functionality. So instead, gbdk-nes API allows fake handlers to be installed in the goal of keeping code compatible with other platforms.

        -
      • An installed VBL handler will be called immediately when calling vsync. This handler should only update PPU shadow registers.
      • +
      • An installed VBL handler will be called immediately when calling vsync. This handler should only update PPU shadow registers. After each invocation, shadow registers are stored into a buffer.
      • An installed LCD handler for a specific scanline will then be called repeatedly until the value of _lcd_scanline is either set to an earlier scanline or >= 240. After each invocation, shadow registers are stored into a buffer.
      • -
      • After the vblank NMI handler has finished palette updates, OAM DMA, VRAM updates and scroll updates it will then manually run a delay loop to reach the particular scanlines that the installed LCD handler was pre-called for, and use the contents of the buffer to update registers.
      • +
      • After the built-in vblank NMI handler has finished palette updates, OAM DMA, VRAM updates it will then use the buffered VBL shadow registers to write the real registers. If LCD handlers are enabled it will then manually run a delay loop to reach the particular scanlines that the installed LCD handler was pre-called for, and use the contents of the buffer to update registers.

      Because the LCD "ISR" is actually implemented with a delay loop, it will burn a lot of CPU cycles in the frame - the further down the requested scanline is the larger the CPU cycle loss. In practice this makes this faked-LCD-ISR functionality mostly suitable for status bars at the top of the screen screen. Or for simple parallax cutscenes where the CPU has little else to do.

      -
      Note
      The support for VBL and LCD handlers is currently under consideration and subject to change in newer versions of gbdk-nes.
      -

      +

      To make porting between user VBL / LCD handlers written in C easier, gbdk-nes also provides aliases for the shadow registers that correspond to the GB hardware registers.

      + +

      Because these are shadow registers that are interpreted by the GBDK library to mimick GB behaviour, they won't behave exactly how the GB hardware registers do under all conditions. However, for most practical purposes they allow writing portable VBL / LCD handlers in C.

      +
      Note
      The bkg_scroll_y shadow register functions the same as SCY_REG GB, with its value added to _lcd_scanline to determine the final Y scrolling coordinate. However, its range is different due to tilemaps being 32x30 instead 32x32.
      +

      Negative coordinates won't work correctly due to the wrapping from 239 to 0. Instead, they need to be corrected with this wrapping in mind. i.e. a negative coordinate of -1 needs to be converted to 239 before being written to bkg_scroll_y.

      +

      A portable way to do this is to check for a negative offset, and use the screen height define:

      +

      SCY_REG = offset < 0 ? (uint8_t)(DEVICE_SCREEN_BUFFER_HEIGHT*8 + offset) : offset;

      +

      Caveat: Make sure to call vsync on every frame

      On the GB, the call to vsync is an optional call that serves two purposes:

      1. It provides a consistent frame timing for your game
      2. It allows future register writes to be synchronized to the screen
      -

      On gbdk-nes the second point is no longer true, because writes need to be made to the shadow registers before vsync is called.

      +

      On gbdk-nes the second point is no longer true, because writes need to be made to the shadow registers either before vsync is called, or in a user VBL isr handler.

      But the vsync call serves three other very important purposes:

      A. It calls the optional VBL handler, where shadow registers can be written (and will later be picked up by the actual vblank NMI handler) B. It repeatedly calls the optional LCD handler up to MAX_LCD_ISR_CALLS times. After each call, PPU shadow registers are stored into a buffer that will later be used by timed code in the NMI to handle mid-frame changes for screen splits / sprite hiding / etc. C. It calls flush_shadow_attributes so that updates to background attributes actually get written to PPU memory

      For these reasons you should always include a call to vsync if you expect to see any graphical updates on the screen.

      -

      -Caveat: Do all status bar scroll movement in LCD handlers to mitigate glitches

      -

      The fake LCD ISR system is not bullet-proof. In particular, it has a problem where lag frames can cause the shadow register updates in LCD handlers not to be ready in time for when the timed code in the NMI handler would be called. This will effectively cause all those updates to be missing for one frame, and result in glitched scroll updates.

      -

      There is currently no complete work-around for this problem other than avoiding lag frames altogether. But the glitch can be made less distracting by making sure only the status bar glitches rather than the main background.

      -

      If you are using LCD handlers to achieve a top-screen stationary status bar, it is recommended that you follow the following guidelines to make sure the background itself has consistent scrolling:

        -
      • Use move_bkg either in your main loop or in the VBL handler, to set the level scrolling
      • -
      • Use move_bkg in the first invocation of the LCD handler, to set the (stationary) status bar scroll position
      • -
      • Use move_bkg in the second invocation of the LCD handler, to reset the background scrolling
      • +

        +Implementation of timer handler

        +

        The nature of the deferred handling for fake VBL and LCD handlers in gbdk-nes means that lag frames will cause these handlers to be called at delayed irregular times.

        +

        For graphics updates this is the behaviour you usually want. But for non-graphics tasks like music playback it will cause distracting stutter.

        +

        The timer overflow handler (TIM) provides an alternative method that is guaranteed to be stutter-free. The TIM handler is always called if timer overflow occurs at the end of the NMI handler in both buffered and direct mode.

        +

        The TMA_REG and TAC_REG hardware registers are emulated via RAM variable with the same names. The timer emulation matches the values of these registers for a GBC running in double-speed mode. But there will be a small variation in exact frequency compared to real GBC hardware, and the nature of the timer emulation via vblank means the execution is not as evenly paced as on GBC hardware.

        +

        The TIMA_REG should not be written or read in gbdk-nes, as the emulation does not handle its contents exactly as on GB.

        +

        At reset, TAC_REG is set to clock rate 00 and timer enabled, and TMA_REG is set to either of two values, depending on the detected system:

        +
          +
        • TIMER_VBLANK_PARITY_MODE_SYSTEM_60HZ for a Famicom / US NES
        • +
        • TIMER_VBLANK_PARITY_MODE_SYSTEM_50Hz for a PAL NES / PAL Famiclone
        -

        In short: Ensuring that the last called LCD handler sets the scroll back to the original value means the PPU rendering keeps rendering the background from the same scrolling position even when the NMI handling was missed.

        -

        +

        These default values ensure that the TIM emulation will always call the TIM handler exactly once for every vblank, resulting in 60Hz vs 50Hz depending on the system.

        +

        Changing TMA_REG allows setting a slower or faster frequency for this emulated timer overflow interrupt if your GB game uses the timer overflow hardware for regular events like music that are slower or faster than 60Hz (50Hz for PAL).

        +

        If you are porting a GB game to gbdk-nes where the music handler is called in the VBL or LCD handler then it is advisable to move this call to the timer handler, in order to achieve reliable music playback at 60Hz (50Hz for PAL).

        +

        Keep in mind that you should NOT write any graphics registers in the TIM handler. This will likely not do what you want, and it may result in bad graphical glitches.

        +

        Tweaking the playback rate by setting TMA_REG / TAC_REG is a decent way to achieve the same average playback rate as on a GB game that uses a different rate than the vblank tick rate and allow similar music speed for different regions.

        +

        However, it is recommended to use the default vblank parity mode whenever remaking the music specifically for 60Hz / 50Hz is an option, as keeping the music tick rate steady will give more pleasant sound playback for rates that are already close to native vblank rate of 60Hz / 50Hz.

        +

        Note
        Because the TIM handler will be called from the vblank NMI, this function and all functions it calls need to use the #pragma nooverlay command. This makes memory for local variables and function parameters unique to this function instead of being shared with other functions' allocations in the reusable overlay segment.
        #pragma save
        +#pragma nooverlay
        +void tim_isr(void)
        +{
        +    // Do TIM isr things
        +}
        +#pragma restore
        +
        Without this pragma the calls in your TIM handler could end up overwriting local variables or function parameters that the main program was using when it was interrupted. You should also avoid calls to the standard library, and even multiplications and division / modulo operations in your TIM handlers. These more expensive math operations in SDCC are currently implemented with functions that use the overlay segment and would cause similar conflicts. For more details on overlay segment and interrupts, please see section 3.7 in the SDCC manual.
        +

        Tile Data and Tile Map loading

        -

        +

        Tile and Map Data in 2bpp Game Boy Format

        -

        +

        Tile and Map Data in Native Format

        Use the following api calls when assets are available in the native format for each platform.

        set_native_tile_data()

          @@ -640,7 +664,7 @@ Tile and Map Data in Native Format

          Platform specific API calls:

          -

          +

          Game Boy Color map attributes on the NES

          On the Game Boy Color, VBK_REG is used to select between the regular background tile map and the background attribute tile map (for setting tile color palette and other properties).

          This behavior of setting VBK_REG to specify tile indices/attributes is not supported on the NES platform. Instead the dedicated functions for attribute setting should be used. These will work on other platforms as well and are the preferred way to set attributes.

          @@ -663,10 +687,10 @@ Game Boy Color map attributes on the NES
        -

        +

        From Game Boy to Mega Duck / Cougar Boy

        The Mega Duck is (for practical purposes) functionally identical to the Original Game Boy though it has a couple changes listed below.

        -

        +

        Summary of Hardware changes:

        • Cartridge Boot Logo: not present on Mega Duck
        • @@ -675,8 +699,9 @@ Summary of Hardware changes:
        • Display registers and flag definitions: Some changed
        • Audio registers and flag definitions: Some changed
        • MBC ROM bank switching register address: 0x0001 (many Game Boy MBCs use 0x2000 - 0x3FFF)
        • +
        • Also see links for megaduck development
        -

        +

        Best Practices

        In order for software to be easily ported to the Mega Duck, or to run on both, use these practices. That will allow GBDK to automatically handle most of the differences (for the exceptions see Sound Register Value Changes).

        -

        +

        Sound Register Value Changes

        There are two hardware changes which will not be handled automatically when following the practices mentioned above.

        These changes may be required when using existing Sound Effects and Music Drivers written for the Game Boy.

        @@ -704,7 +729,7 @@ Sound Register Value Changes
    -

    +

    Graphics Register Bit Changes

    These changes are handled automatically when their GBDK definitions are used.

    @@ -727,7 +752,7 @@ Graphics Register Bit Changes
    LCDCF_B_BGON .0 .6 Bit for Background Display Visible Hidden Select
    -

    +

    Detailed Register Address Changes

    These changes are handled automatically when their GBDK definitions are used.

    diff --git a/docs/api/docs_toolchain.html b/docs/api/docs_toolchain.html index 7c3e2192..d99909dc 100644 --- a/docs/api/docs_toolchain.html +++ b/docs/api/docs_toolchain.html @@ -29,7 +29,7 @@ @@ -91,7 +91,7 @@ $(document).ready(function(){initNavTree('docs_toolchain.html',''); initResizabl

    -

    +

    Overview

    GBDK 2020 uses the SDCC compiler along with some custom tools to build Game Boy ROMs.

    To see individual arguments and options for a tool, run that tool from the command line with either no arguments or with -h.

    -

    +

    Data Types

    For data types and special C keywords, see asm/sm83/types.h and asm/types.h.

    Also see the SDCC manual (scroll down a little on the linked page): http://sdcc.sourceforge.net/doc/sdccman.pdf#section.1.1

    -

    +

    Changing Important Addresses

    It is possible to change some of the important addresses used by the toolchain at link time using the -Wl-g XXX=YYY and =Wl-b XXX=YYY flags (where XXX is the name of the data, and YYY is the new address).

    lcc will include the following linker defaults for sdldgb if they are not defined by the user.

    @@ -142,7 +142,7 @@ Changing Important Addresses

    -

    +

    Compiling programs

    The lcc program is the front end compiler driver for the actual compiler, assembler and linker. It works out what you want to do based on command line options and the extensions of the files you give it, computes the order in which the various programs must be called and then executes them in order. Some examples are:

    Makefiles

    -

    +

    Using Makefiles

    Please see the sample projects included with GBDK-2020 for a couple different examples of how to use Makefiles.

    You may also want to read a tutorial on Makefiles. For example:
    https://makefiletutorial.com/
    https://www.tutorialspoint.com/makefile/index.htm

    -

    +

    Linker Files and ROM Auto Banking

    When bankpack is called through lcc it will now always use linkerfile output (-lkout=) for passing files to the linker (all input object files and linkerfiles will get get consolidated to a single linkerfile).

    Bankpack:

    Also see the linkerfile example project.

    -

    +

    Build Tools

    -

    +

    lcc

    lcc is the compiler driver (front end) for the GBDK/sdcc toolchain.

    For detailed settings see lcc-settings

    @@ -208,7 +208,7 @@ lcc

    -

    +

    sdcc

    SDCC C Source compiler.

    For detailed settings see sdcc-settings

    @@ -216,7 +216,7 @@ sdcc
  • Arguments can be passed to it through lcc using -Wf-<argument> and -Wp-<argument> (pre-processor)
  • -

    +

    sdasgb

    SDCC Assembler for the Game Boy.

    For detailed settings see sdasgb-settings

    @@ -224,7 +224,7 @@ sdasgb
  • Arguments can be passed to it through lcc using -Wa-<argument>
  • -

    +

    bankpack

    Automatic Bank packer.

    For detailed settings see bankpack-settings

    @@ -234,7 +234,7 @@ bankpack
  • Arguments can be passed to it through lcc using -Wb-<argument>
  • -

    +

    sdldgb

    The SDCC linker for the gameboy.

    For detailed settings see sdldgb-settings

    @@ -242,7 +242,7 @@ sdldgb
  • Arguments can be passed to it through lcc using -Wl-<argument>
  • -

    +

    ihxcheck

    IHX file validator.

    For detailed settings see ihxcheck-settings

    @@ -251,7 +251,7 @@ ihxcheck
  • Arguments can be passed to it through lcc using -Wi-<argument>
  • -

    +

    makebin

    IHX to ROM converter.

    -

    +

    GBDK Utilities

    -

    +

    GBCompress

    Compression utility.

    For detailed settings see gbcompress-settings

    @@ -278,7 +278,7 @@ GBCompress
  • The cross-platform/rle_map example demonstrates how to use this compression
  • -

    +

    png2asset

    Tool for converting PNGs into GBDK format MetaSprites and Tile Maps.

    -

    +

    Meta sprites

    By default the png will be converted to metasprites. The image will be subdivided into meta sprites of -sw x -sh. In this case png2asset will generate:

    +

    Additional Details

    For technical details about the conversion process and rendering, see: https://github.com/bbbbbr/png2hicolorgb

    -

    +

    romusage

    A utility for estimating usage of Game Boy and SMS/GG ROMs from .noi and .map files, binary ROMs and more.

    @@ -91,50 +91,38 @@ $(document).ready(function(){initNavTree('docs_toolchain_settings.html',''); ini

    -

    +

    lcc settings

    ./lcc [ option | file ]...
    except for -l, options are processed left-to-right before files
    unrecognized options are taken to be linker options
    -
    -A warn about nonANSI usage; 2nd -A warns more
    -
    -b emit expression-level profiling code; see bprint(1)
    -
    -Bdir/ use the compiler named `dir/rcc'
    -c compile only
    -
    -dn set switch statement density to `n'
    -debug Turns on --debug for compiler, -y (.cdb), -j (.noi), -w (wide .map format) for linker
    -Wa-l (assembler .lst), -Wl-u (.lst -> .rst address update)
    -Dname=def define the preprocessor symbol `name'
    -E only run preprocessor on named .c and .h files files -> stdout
    --save-preproc Use with -E for output to *.i files instead of stdout
    -
    -g produce symbol table information for debuggers
    -help or -? print this message
    -Idir add `dir' to the beginning of the list of #include directories
    -K don't run ihxcheck test on linker ihx output
    -lx search library `x'
    -m select port and platform: "-m[port]:[plat]" ports:sm83,z80,mos6502 plats:ap,duck,gb,sms,gg,nes
    -N do not search the standard directories for #include files
    -
    -n emit code to check for dereferencing zero pointers
    -no-crt do not auto-include the gbdk crt0.o runtime in linker list
    -no-libs do not auto-include the gbdk libs in linker list
    -
    -O is ignored
    -o file leave the output in `file'
    -
    -P print ANSI-style declarations for globals
    -
    -p -pg emit profiling code; see prof(1) and gprof(1)
    -S compile to assembly language
    -autobank auto-assign banks set to 255 (bankpack)
    -
    -static specify static libraries (default is dynamic)
    -
    -t -tname emit function tracing calls to printf or to `name'
    -
    -target name is ignored
    -
    -tempdir=dir place temporary files in `dir/'; default=/tmp
    +
    -tempdir=dir place temporary files in `dir/'
    -Uname undefine the preprocessor symbol `name'
    -v show commands as they are executed; 2nd -v suppresses execution
    -
    -w suppress warnings
    -Woarg specify system-specific `arg'
    -
    -W[pfablim]arg pass `arg' to the preprocessor, compiler, assembler, bankpack, linker, ihxcheck, or makebin
    +
    -W[pfablimnc]arg pass `arg' to the (p)preprocessor, (f)compiler, (a)assembler, (b)bankpack,
    +
    (l)linker, (i)ihxcheck, (m)makebin, (n)makenes, (c)makecom

    -

    +

    sdcc settings

    -
    SDCC : z80/sm83/mos6502/mos65c02 TD- 4.4.1 #14650 (Linux)
    +
    SDCC : z80/sm83/mos6502/mos65c02 TD- 4.5.1 #15267 (Linux)
    published under GNU General Public License (GPL)
    Usage : sdcc [options] filename
    Options :-
    @@ -169,7 +157,7 @@ sdcc settings
    --Werror Treat the warnings as errors
    --debug Enable debugging symbol output
    --cyclomatic Display complexity of compiled functions
    -
    --std Determine the language standard (c89, c99, c11, c23, sdcc89 etc.)
    +
    --std Determine the language standard (c90, c99, c11, c23, c2y, sdcc89 etc.)
    --fdollars-in-identifiers Permit '$' as an identifier character
    --fsigned-char Make "char" signed by default
    --use-non-free Search / include non-free licensed libraries and header files
    @@ -280,7 +268,7 @@ sdcc settings
    --no-zp-spill place register spills in 16-bit address space
    --no-std-crt0 Do not link default crt0.rel

    -

    +

    sdasgb settings

    sdas Assembler V02.00 + NoICE + SDCC mods (GameBoy)
    @@ -316,13 +304,13 @@ sdasgb settings
    Symbols:
    -a All user symbols made global
    -g Undefined symbols made global
    -
    -n Don't resolve global assigned value symbols
    +
    -N Don't resolve global assigned value symbols
    -z Disable case sensitivity for symbols
    Debugging:
    -j Enable NoICE Debug Symbols
    -y Enable SDCC Debug Symbols

    -

    +

    sdasz80 settings

    sdas Assembler V02.00 + NoICE + SDCC mods (Zilog Z80 / Hitachi HD64180 / ZX-Next / eZ80 / R800)
    @@ -358,13 +346,13 @@ sdasz80 settings
    Symbols:
    -a All user symbols made global
    -g Undefined symbols made global
    -
    -n Don't resolve global assigned value symbols
    +
    -N Don't resolve global assigned value symbols
    -z Disable case sensitivity for symbols
    Debugging:
    -j Enable NoICE Debug Symbols
    -y Enable SDCC Debug Symbols

    -

    +

    sdas6500 settings

    sdas Assembler V02.00 + NoICE + SDCC mods (Rockwell 6502/6510/65C02)
    @@ -400,13 +388,13 @@ sdas6500 settings
    Symbols:
    -a All user symbols made global
    -g Undefined symbols made global
    -
    -n Don't resolve global assigned value symbols
    +
    -N Don't resolve global assigned value symbols
    -z Disable case sensitivity for symbols
    Debugging:
    -j Enable NoICE Debug Symbols
    -y Enable SDCC Debug Symbols

    -

    +

    bankpack settings

    bankalloc [options] objfile1 objfile2 etc
    Use: Read .o files and auto-assign areas with bank=255.
    @@ -448,7 +436,7 @@ bankpack settings
    S ___bank_<const name> Def0000FF
    (Above can be made by: const void __at(255) __bank_<const name>;

    -

    +

    sdldgb settings

    sdld Linker V03.00/V05.40 + sdld
    @@ -485,7 +473,7 @@ sdldgb settings
    End:
    -e or null line terminates input

    -

    +

    sdldz80 settings

    sdld Linker V03.00/V05.40 + sdld
    @@ -522,7 +510,7 @@ sdldz80 settings
    End:
    -e or null line terminates input

    -

    +

    sdld6808 settings

    sdld Linker V03.00/V05.40 + sdld
    @@ -559,7 +547,7 @@ sdld6808 settings
    End:
    -e or null line terminates input

    -

    +

    ihxcheck settings

    ihx_check input_file.ihx [options]
    @@ -570,7 +558,7 @@ ihxcheck settings
    Use: Read a .ihx and warn about overlapped areas.
    Example: "ihx_check build/MyProject.ihx"

    -

    +

    makebin settings

    Also see setting_mbc_and_rom_ram_banks

    makebin: convert a Intel IHX file to binary or GameBoy format binary.
    Usage: makebin [options] [<in_file> [<out_file>]]
    @@ -605,12 +593,23 @@ makebin settings
    <in_file> optional IHX input file, '-' means stdin. (default: stdin)
    <out_file> optional output file, '-' means stdout. (default: stdout)

    -

    +

    makecom settings

    makecom image.rom image.noi output.com
    Use: convert a binary .rom file to .msxdos com format.
    +

    +

    +makenes settings

    +
    makenes: Prepend an iNES header to a binary ROM image file.
    +
    Usage: makenes [options] [<in_file> [<out_file>]]
    +
    Options:
    +
    -m Mapper number (default: 0)
    +
    -n Nametable arrangement:
    +
    0: vertical arrangement / horizontal mirroring
    +
    1: horizontal arrangement / vertical mirroring
    +
    -b Battery bit set (default: 0)

    -

    +

    gbcompress settings

    gbcompress [options] infile outfile
    Use: compress a binary file and write it out.
    @@ -631,7 +630,7 @@ gbcompress settings
    The default compression (gb) is the type used by gbtd/gbmb
    The rle compression is Amiga IFF style

    -

    +

    png2asset settings

    usage: png2asset <file>.png [options]
    -o <filename> ouput file (if not used then default is <png file>.c)
    @@ -643,11 +642,12 @@ png2asset settings
    -py <y coord> metasprites pivot y coordinate (default: metasprites height / 2)
    -pw <width> metasprites collision rect width (default: metasprites width)
    -ph <height> metasprites collision rect height (default: metasprites height)
    -
    -spr8x8 use SPRITES_8x8
    -
    -spr8x16 use SPRITES_8x16 (this is the default)
    -
    -spr16x16msx use SPRITES_16x16
    +
    -spr8x8 for 8x8 hardware sprites (use SPRITES_8x8)
    +
    -spr8x16 for 8x16 hardware sprites (use SPRITES_8x16) (the default)
    +
    -spr16x16msx MSX only: for 16x16 hardware sprites (use SPRITES_16x16)
    -sprite_no_optimize keep empty sprite tiles, do not remove duplicate tiles
    -
    -b <bank> bank (default: fixed bank)
    +
    -b <banknum> Bank number (default: fixed bank)
    +
    -area <area name> Area name. Alters "pragma bank ..." output to constseg style. (Ex: -area LIT)
    -keep_palette_order use png palette
    -repair_indexed_pal try to repair indexed tile palettes (implies "-keep_palette_order")
    -noflip disable tile flip
    @@ -673,31 +673,38 @@ png2asset settings
    -rel_paths paths to tilesets are relative to the input file path
    decoder error empty input buffer given to decoder. Maybe caused by non-existing file?

    -

    +

    png2hicolorgb settings

    png2hicolorgb input_image.png [options]
    -
    version 1.4.1: bbbbbr. Based on Glen Cook's Windows GUI "hicolour.exe" 1.2
    +
    version 1.4.2: bbbbbr. Based on Glen Cook's Windows GUI "hicolour.exe" 1.2
    Convert an image to Game Boy Hi-Color format
    Options
    -h : Show this help
    -v* : Set log level: "-v" verbose, "-vQ" quiet, "-vE" only errors, "-vD" debug
    -o <file> : Set base output filename (otherwise from input image)
    +
    -s <name> : Set output variable/symbol name (otherwise derived from output filename)
    --csource : Export C source format with incbins for data files
    --bank=N : Set bank number for C source output where N is decimal bank number 1-511
    --type=N : Set conversion type where N is one of below
    1: Median Cut - No Dither (*Default*)
    2: Median Cut - With Dither
    -
    3: Wu Quantiser
    +
    3: Wu Quantiser (best quality)
    -p : Show screen attribute pattern options (no processing)
    -
    -L=N : Set Left screen attribute pattern where N is decimal entry (-p to show patterns)
    -
    -R=N : Set Right screen attribute pattern where N is decimal entry (-p to show patterns)
    +
    -L=N : Set Left side of screen palette arrangement where N is name listed below or decimal entry
    +
    -R=N : Set Right side of screen palette arrangement where N is name listed below or decimal entry
    +
    Named options for N: "adaptive-fast", "adaptive-medium", "adaptive-best" (-p for full options)
    +
    --best : Use highest quality conversion settings (--type=3 -L=adaptive-best -R=adaptive-best)
    --vaddrid : Map uses vram id (128->255->0->127) instead of (*Default*) sequential tile order (0->255)
    --nodedupe : Turn off tile pattern deduplication
    +
    --precompiled : Export Palette data as pre-compiled executable loading code
    +
    --palendbit : Set unused bit .15 = 1 for last u16 entry in palette data indicating end (not in precompiled)
    +
    --addendcolor=N : Append 32 x color N (hex BGR555) in pal data to clear BG for shorter images (64 bytes) (not in precompiled)
    Example 1: "png2hicolorgb myimage.png"
    -
    Example 2: "png2hicolorgb myimage.png --csource -o=my_output_filename"
    -
    * Default settings provide good results. Better quality but slower: "--type=3 -L=2 -R=2"
    +
    Example 2: "png2hicolorgb myimage.png --csource -o my_output_filename"
    +
    Example 2: "png2hicolorgb myimage.png --palendbit --addendcolor 0x7FFF -o my_output_filename -s my_variable_name"
    +
    * Default settings provide good results. Better quality but slower: "--type=3 -L=adaptive-best -R=adaptive-best"
    Historical credits and info:
    Original Concept : Icarus Productions
    @@ -709,14 +716,14 @@ png2hicolorgb settings
    Original Quantiser Code : Benny
    Quantiser Conversion : Glen Cook

    -

    +

    romusage settings

    romusage input_file.[map|noi|ihx|cdb|.gb[c]|.pocket|.duck|.gg|.sms] [options]
    -
    version 1.2.8, by bbbbbr
    +
    version 1.3.1, by bbbbbr
    Options
    -h : Show this help
    -
    -p:SMS_GG : Set platform to GBDK SMS/Game Gear (changes memory map templates)
    +
    -p : Set platform (GBDK specific), "-p:SMS_GG" for SMS/Game Gear, "-p:NES1" for NES
    -a : Show Areas in each Bank. Optional sort by, address:"-aA" or size:"-aS"
    -g : Show a small usage graph per bank (-gA for ascii style)
    @@ -727,6 +734,7 @@ romusage settings
    -m : Manually specify an Area -m:NAME:HEXADDR:HEXLENGTH
    -e : Manually specify an Area that should not overlap -e:NAME:HEXADDR:HEXLENGTH
    +
    -b : Set hex bytes treated as Empty in ROM files (.gb/etc) -b:HEXVAL[...] (default FF)
    -E : All areas are exclusive (except HEADERs), warn for any overlaps
    -q : Quiet, no output except warnings and errors
    -Q : Suppress output of warnings and errors
    @@ -740,10 +748,11 @@ romusage settings
    -smROM : Show Merged ROM_0 and ROM_1 output (i.e. bare 32K ROM)
    -smWRAM : Show Merged WRAM_0 and WRAM_1 output (i.e DMG/MGB not CGB)
    -sm* compatible with banked ROM_x or WRAM_x when used with -B
    -
    -sJ : Show JSON output. Some options not applicable. When used, -Q recommended
    -
    -nB : Hide warning banner (for .cdb output)
    -
    -nA : Hide areas (shown by default in .cdb output)
    -
    -z : Hide areas smaller than SIZE -z:DECSIZE
    +
    -sJ : Show JSON output. Some options not applicable. When used, -Q recommended
    +
    -nB : Hide warning banner (for .cdb output)
    +
    -nA : Hide areas (shown by default in .cdb output)
    +
    -z : Hide areas smaller than SIZE -z:DECSIZE
    +
    -nMEM : Hide banks matching case sensitive substring (ex hide all RAM: -nMEM:RAM)
    Use: Read a .map, .noi, .cdb or .ihx file to display area sizes
    Example 1: "romusage build/MyProject.map"
    @@ -752,6 +761,7 @@ romusage settings
    Example 4: "romusage build/MyProject.map -q -R"
    Example 5: "romusage build/MyProject.noi -sR -sP:90:32:90:35:33:36"
    Example 6: "romusage build/MyProject.map -sRp -g -B -F:255:15 -smROM -smWRAM"
    +
    Example 7: "romusage build/MyProject.gb -g -b:FF:00"
    Notes:
    * GBDK / RGBDS map file format detection is automatic.
    diff --git a/docs/api/docs_using_gbdk.html b/docs/api/docs_using_gbdk.html index e2b75249..b017a838 100644 --- a/docs/api/docs_using_gbdk.html +++ b/docs/api/docs_using_gbdk.html @@ -29,7 +29,7 @@
    @@ -90,7 +90,7 @@ $(document).ready(function(){initNavTree('docs_using_gbdk.html',''); initResizab
    Using GBDK
    -

    +

    Interrupts

    Interrupts allow execution to jump to a different part of your code as soon as an external event occurs - for example the LCD entering the vertical blank period, serial data arriving or the timer reaching its end count. For an example see the irq.c sample project.

    Interrupts in GBDK are handled using the functions disable_interrupts(), enable_interrupts(), set_interrupts(uint8_t ier) and the interrupt service routine (ISR) linkers add_VBL(), add_TIM, add_low_priority_TIM, add_LCD, add_SIO and add_JOY which add interrupt handlers for the vertical blank, timer, LCD, serial link and joypad interrupts respectively.

    @@ -98,7 +98,7 @@ Interrupts

    Interrupts should be disabled before adding ISRs. To use multiple interrupts, logical OR the relevant IFLAGs together.

    ISRs should be kept as small and short as possible, do not write an ISR so long that the Game Boy hardware spends all of its time servicing interrupts and has no time spare for the main code.

    For more detail on the Game Boy interrupts consider reading about them in the Pandocs.

    -

    +

    Available Interrupts

    The GameBoy hardware can generate 5 types of interrupts. Custom Interrupt Service Routines (ISRs) can be added in addition to the built-in ones available in GBDK.

    -

    +

    Adding your own interrupt handler

    It is possible to install your own interrupt handlers (in C or in assembly) for any of these interrupts. Up to 4 chained handlers may be added, with the last added being called last. If the remove_VBL() function is to be called, only three may be added for VBL.

    Interrupt handlers are called in sequence. To install a new interrupt handler, do the following:

    @@ -141,7 +141,7 @@ Adding your own interrupt handler
  • Enable interrupts for the IRQ you want to handle, using the set_interrupts() function. Note that the VBL interrupt is already enabled before the main() function is called. If you want to set the interrupts before main() is called, you must install an initialization routine.
  • See the irq example project for additional details for a complete example.

    -

    +

    Using your own Interrupt Dispatcher

    If you want to use your own Interrupt Dispatcher instead of the GBDK chained dispatcher (for improved performance), then don't call the add_...() function for the respective interrupt and its dispatcher won't be installed.

    Then, ISR_VECTOR() or ISR_NESTED_VECTOR() can be used to install a custom ISR handler.

    -

    +

    Returning from Interrupts and STAT mode

    By default when an Interrupt handler completes and is ready to exit it will check STAT_REG and only return at the BEGINNING of either LCD Mode 0 or Mode 1. This helps prevent graphical glitches caused when an ISR interrupts a graphics operation in one mode but returns in a different mode for which that graphics operation is not allowed.

    You can change this behavior using nowait_int_handler() which does not check STAT_REG before returning. Also see wait_int_handler().

    -

    +

    What GBDK does automatically and behind the scenes

    -

    +

    NES console

    For implementation details on the NES console in GBDK, see the NES entry in Supported Consoles & Cross Compiling

    -

    +

    OAM (VRAM Sprite Attribute Table)

    GBDK sets up a Shadow OAM which gets copied automatically to the hardware OAM by the default V-Blank ISR. The Shadow OAM allows updating sprites without worrying about whether it is safe to write to them or not based on the hardware LCD mode.

    -

    +

    Graphics Tile Maps and Data on Startup

    By default for the Game Boy GBDK assigns:

    -

    +

    Font tiles when using stdio.h

    Including stdio.h and using functions such as printf() will use a large number of the background tiles for font characters. If stdio.h is not included then that space will be available for use with other tiles instead.

    -

    +

    Default Interrupt Service Handlers (ISRs)

    -

    +

    Ensuring Safe Access to Graphics Memory

    There are certain times during each video frame when memory and registers relating to graphics are "busy" and should not be read or written to (otherwise there may be corrupt or dropped data). GBDK handles this automatically for most graphics related API calls. It also ensures that ISR handlers return in such a way that if they interrupted a graphics access then it will only resume when access is allowed.

    The ISR return behavior can be turned off using the nowait_int_handler.

    For more details see the related Pandocs section: https://gbdev.io/pandocs/Accessing_VRAM_and_OAM.html

    -

    +

    Compression

    For programs that would benefit from compression GBDK includes the gbcompress utility and companion API functions.

    In addition to the built-in compression unapack is another option:

    Use of 1-bpp tile pattern data may be combined with the compression described above to save even more space, however that approach requires using an intermediary RAM buffer before the tile pattern data can be written to VRAM with the set_*_1bpp_data() functions.

    -

    +

    Copying Functions to RAM and HIRAM

    See the ram_function example project included with GBDK which demonstrates copying functions to RAM and HIRAM.

    Warning! Copying of functions is generally not safe since they may contain jumps to absolute addresses that will not be converted to match the new location.

    @@ -207,13 +207,13 @@ Copying Functions to RAM and HIRAM
  • Declare the function as extern, and set its address at link time using the -Wl-gXXX=# flag (where XXX is the name of the function, and # is its address).
  • The second approach is slightly more efficient. Both approaches are demonstrated in the ram_function.c example.

    -

    +

    Mixing C and Assembly

    The following is primarily oriented toward the Game Boy and related clones (sm83 devices), other targets such as sms/gg may vary.

    You can mix C and assembly (ASM) in two ways as described below.

    -

    +

    Inline ASM within C source files

    diff --git a/docs/api/drawing_8h_source.html b/docs/api/drawing_8h_source.html index 667c48e4..d967250f 100644 --- a/docs/api/drawing_8h_source.html +++ b/docs/api/drawing_8h_source.html @@ -29,7 +29,7 @@ diff --git a/docs/api/far__ptr_8h.html b/docs/api/far__ptr_8h.html index 69439d05..4c2e51e7 100644 --- a/docs/api/far__ptr_8h.html +++ b/docs/api/far__ptr_8h.html @@ -29,7 +29,7 @@ diff --git a/docs/api/far__ptr_8h_source.html b/docs/api/far__ptr_8h_source.html index 7426e67a..3cf7ae1e 100644 --- a/docs/api/far__ptr_8h_source.html +++ b/docs/api/far__ptr_8h_source.html @@ -29,7 +29,7 @@ diff --git a/docs/api/files.html b/docs/api/files.html index 0348f5f5..520aa38f 100644 --- a/docs/api/files.html +++ b/docs/api/files.html @@ -29,7 +29,7 @@ @@ -113,66 +113,70 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); }); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
     string.h
     types.h
     types.h
      gb
     bcd.h
     bgb_emu.h
     cgb.h
     crash_handler.h
     drawing.h
     emu_debug.h
     gb.h
     gbdecompress.h
     hardware.h
     hblankcpy.h
     isr.h
     metasprites.h
     sgb.h
      gbdk
     bcd.h
     console.h
     emu_debug.h
     far_ptr.h
     font.h
     gbdecompress.h
     gbdk-lib.h
     incbin.h
     metasprites.h
     platform.h
     rledecompress.h
     version.h
      msx
     hardware.h
     metasprites.h
     msx.h
      nes
     bcd.h
     hardware.h
     metasprites.h
     nes.h
     rgb_to_nes_macro.h
      sms
     bcd.h
     gbdecompress.h
     hardware.h
     metasprites.h
     sms.h
     assert.h
     ctype.h
     limits.h
     rand.h
     setjmp.h
     stdarg.h
     stdatomic.h
     stdbool.h
     stddef.h
     stdint.h
     stdio.h
     stdlib.h
     stdnoreturn.h
     string.h
     time.h
     typeof.h
     types.h
      duck
     laptop_io.h
     laptop_keycodes.h
     model.h
      gb
     bcd.h
     bgb_emu.h
     cgb.h
     crash_handler.h
     drawing.h
     emu_debug.h
     gb.h
     gbdecompress.h
     hardware.h
     hblankcpy.h
     isr.h
     metasprites.h
     sgb.h
      gbdk
     bcd.h
     console.h
     emu_debug.h
     far_ptr.h
     font.h
     gbdecompress.h
     gbdk-lib.h
     incbin.h
     metasprites.h
     platform.h
     rledecompress.h
     version.h
      msx
     hardware.h
     metasprites.h
     msx.h
      nes
     bcd.h
     hardware.h
     metasprites.h
     nes.h
     rgb_to_nes_macro.h
      sms
     bcd.h
     gbdecompress.h
     hardware.h
     metasprites.h
     sms.h
     assert.h
     ctype.h
     limits.h
     rand.h
     setjmp.h
     stdarg.h
     stdatomic.h
     stdbool.h
     stddef.h
     stdint.h
     stdio.h
     stdlib.h
     stdnoreturn.h
     string.h
     time.h
     typeof.h
     types.h
    diff --git a/docs/api/font_8h.html b/docs/api/font_8h.html index e714cc78..1c3c88dd 100644 --- a/docs/api/font_8h.html +++ b/docs/api/font_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/font_8h_source.html b/docs/api/font_8h_source.html index 77094e87..a078ee52 100644 --- a/docs/api/font_8h_source.html +++ b/docs/api/font_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/functions.html b/docs/api/functions.html index 3ebc33f0..0e3b65bd 100644 --- a/docs/api/functions.html +++ b/docs/api/functions.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/functions_vars.html b/docs/api/functions_vars.html index dfcffd44..7cd58b0a 100644 --- a/docs/api/functions_vars.html +++ b/docs/api/functions_vars.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2bcd_8h.html b/docs/api/gb_2bcd_8h.html index 6ef96082..b01e857d 100644 --- a/docs/api/gb_2bcd_8h.html +++ b/docs/api/gb_2bcd_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2bcd_8h_source.html b/docs/api/gb_2bcd_8h_source.html index b00a886a..1bb1a8a7 100644 --- a/docs/api/gb_2bcd_8h_source.html +++ b/docs/api/gb_2bcd_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2emu__debug_8h.html b/docs/api/gb_2emu__debug_8h.html index 26ee1256..c7366886 100644 --- a/docs/api/gb_2emu__debug_8h.html +++ b/docs/api/gb_2emu__debug_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2emu__debug_8h_source.html b/docs/api/gb_2emu__debug_8h_source.html index cc0b97e9..584a0601 100644 --- a/docs/api/gb_2emu__debug_8h_source.html +++ b/docs/api/gb_2emu__debug_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2gbdecompress_8h.html b/docs/api/gb_2gbdecompress_8h.html index 6274c446..dcbf6c4f 100644 --- a/docs/api/gb_2gbdecompress_8h.html +++ b/docs/api/gb_2gbdecompress_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2gbdecompress_8h_source.html b/docs/api/gb_2gbdecompress_8h_source.html index d871148b..c3cea77f 100644 --- a/docs/api/gb_2gbdecompress_8h_source.html +++ b/docs/api/gb_2gbdecompress_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gb_2hardware_8h.html b/docs/api/gb_2hardware_8h.html index e80dbb99..a6b20b74 100644 --- a/docs/api/gb_2hardware_8h.html +++ b/docs/api/gb_2hardware_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -105,6 +105,14 @@ Macros   #define __REG   extern volatile SFR   +#define MBC7_LATCH_ERASE   0x55u +  +#define MBC7_LATCH_CAPTURE   0xAAu +  +#define MBC7_SRAM_ENABLE_KEY_1   0x0Au +  +#define MBC7_SRAM_ENABLE_KEY_2   0x40u +  #define rP1   P1_REG   #define P1F_5   0b00100000 @@ -153,11 +161,11 @@ Macros   #define rDIV   DIV_REG   -#define rTIMA   TIMA_REG +#define rTIMA   TIMA_REG   -#define rTMA   TMA_REG +#define rTMA   TMA_REG   -#define rTAC   TAC_REG +#define rTAC   TAC_REG   #define TACF_START   0b00000100   @@ -584,6 +592,22 @@ Variables   __BYTE_REG rRAMB   +__BYTE_REG rMBC7_SRAM_ENABLE_1 +  +__BYTE_REG rMBC7_SRAM_ENABLE_2 +  +__BYTE_REG rMBC7_LATCH_1 +  +__BYTE_REG rMBC7_LATCH_2 +  +__BYTE_REG rMBC7_ACCEL_X_LO +  +__BYTE_REG rMBC7_ACCEL_X_HI +  +__BYTE_REG rMBC7_ACCEL_Y_LO +  +__BYTE_REG rMBC7_ACCEL_Y_HI__REG P1_REG   __REG SB_REG @@ -747,6 +771,62 @@ Variables
    +
    + + +

    ◆ MBC7_LATCH_ERASE

    + +
    +
    + + + + +
    #define MBC7_LATCH_ERASE   0x55u
    +
    + +
    +
    + +

    ◆ MBC7_LATCH_CAPTURE

    + +
    +
    + + + + +
    #define MBC7_LATCH_CAPTURE   0xAAu
    +
    + +
    +
    + +

    ◆ MBC7_SRAM_ENABLE_KEY_1

    + +
    +
    + + + + +
    #define MBC7_SRAM_ENABLE_KEY_1   0x0Au
    +
    + +
    +
    + +

    ◆ MBC7_SRAM_ENABLE_KEY_2

    + +
    +
    + + + + +
    #define MBC7_SRAM_ENABLE_KEY_2   0x40u
    +
    +
    @@ -1097,7 +1177,7 @@ Variables
    - +
    #define rTIMA   TIMA_REG#define rTIMA   TIMA_REG
    @@ -1111,7 +1191,7 @@ Variables
    - +
    #define rTMA   TMA_REG#define rTMA   TMA_REG
    @@ -1125,7 +1205,7 @@ Variables
    - +
    #define rTAC   TAC_REG#define rTAC   TAC_REG
    @@ -4252,6 +4332,119 @@ Variables
    +
    +
    + +

    ◆ rMBC7_SRAM_ENABLE_1

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_SRAM_ENABLE_1
    +
    +

    MBC7 registers

    + +
    +
    + +

    ◆ rMBC7_SRAM_ENABLE_2

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_SRAM_ENABLE_2
    +
    + +
    +
    + +

    ◆ rMBC7_LATCH_1

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_LATCH_1
    +
    + +
    +
    + +

    ◆ rMBC7_LATCH_2

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_LATCH_2
    +
    + +
    +
    + +

    ◆ rMBC7_ACCEL_X_LO

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_ACCEL_X_LO
    +
    + +
    +
    + +

    ◆ rMBC7_ACCEL_X_HI

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_ACCEL_X_HI
    +
    + +
    +
    + +

    ◆ rMBC7_ACCEL_Y_LO

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_ACCEL_Y_LO
    +
    + +
    +
    + +

    ◆ rMBC7_ACCEL_Y_HI

    + +
    +
    + + + + +
    __BYTE_REG rMBC7_ACCEL_Y_HI
    +
    +
    diff --git a/docs/api/gb_2hardware_8h.js b/docs/api/gb_2hardware_8h.js index 31db809b..9db2eb5b 100644 --- a/docs/api/gb_2hardware_8h.js +++ b/docs/api/gb_2hardware_8h.js @@ -3,6 +3,10 @@ var gb_2hardware_8h = [ "__BYTES", "gb_2hardware_8h.html#ab2767d5f8f0ad35d8c8ee0bb3f4c51c3", null ], [ "__BYTE_REG", "gb_2hardware_8h.html#a3b39604bdf93a32e9ff965c1a55f0df8", null ], [ "__REG", "gb_2hardware_8h.html#a0b42e4dadd74c927e8b801b4f42c0e44", null ], + [ "MBC7_LATCH_ERASE", "gb_2hardware_8h.html#aa2c85246f3b42c2e140bf58cbd0cec80", null ], + [ "MBC7_LATCH_CAPTURE", "gb_2hardware_8h.html#a5aa863850a6e5fa1a919deac86c33192", null ], + [ "MBC7_SRAM_ENABLE_KEY_1", "gb_2hardware_8h.html#a6e5aa02c219181b3432ae317abfaf122", null ], + [ "MBC7_SRAM_ENABLE_KEY_2", "gb_2hardware_8h.html#ae5bdbf27e6fc9ecee7fcf493ca3907f2", null ], [ "rP1", "gb_2hardware_8h.html#ae7eccdbd4f7b211074591866f515b760", null ], [ "P1F_5", "gb_2hardware_8h.html#a6963ef598339e1163d30e57a962e5278", null ], [ "P1F_4", "gb_2hardware_8h.html#ad215dbfc83c9486ead2f28510366f40b", null ], @@ -241,6 +245,14 @@ var gb_2hardware_8h = [ "rROMB0", "gb_2hardware_8h.html#ae0976a29e341edc6ceb810e6eb0328f1", null ], [ "rROMB1", "gb_2hardware_8h.html#a014f3a9d7ce8f8026c9ac6c0410bb099", null ], [ "rRAMB", "gb_2hardware_8h.html#ac2985dbccb16c4c00381d6fbe9600aff", null ], + [ "rMBC7_SRAM_ENABLE_1", "gb_2hardware_8h.html#a72f13bc5e9d5d2c2bd837566062007a4", null ], + [ "rMBC7_SRAM_ENABLE_2", "gb_2hardware_8h.html#a0f49339112f87fecc29a8e0d7f6636bb", null ], + [ "rMBC7_LATCH_1", "gb_2hardware_8h.html#aee53ec47dc1fcc0b5eb4e8e4e8505a30", null ], + [ "rMBC7_LATCH_2", "gb_2hardware_8h.html#abe4c4490be3e52a9e4096421af3d37e1", null ], + [ "rMBC7_ACCEL_X_LO", "gb_2hardware_8h.html#a9e24325500b1b08daf1fefe60d7dc030", null ], + [ "rMBC7_ACCEL_X_HI", "gb_2hardware_8h.html#a33690469970c7f845600e56902e8bfe0", null ], + [ "rMBC7_ACCEL_Y_LO", "gb_2hardware_8h.html#a16ec6767bce0ca8c46ac6f67727e4640", null ], + [ "rMBC7_ACCEL_Y_HI", "gb_2hardware_8h.html#a1faf3ac761847699c2c60ce044387b39", null ], [ "P1_REG", "gb_2hardware_8h.html#a04f9a36ab04334fcd21d2f50c125d5d0", null ], [ "SB_REG", "gb_2hardware_8h.html#a5f2da0d8200f44b6fd694c4a2bea820e", null ], [ "SC_REG", "gb_2hardware_8h.html#a0fb715973ee3edd1b525eb7f503e3b2a", null ], diff --git a/docs/api/gb_2hardware_8h_source.html b/docs/api/gb_2hardware_8h_source.html index f96f065b..57d62377 100644 --- a/docs/api/gb_2hardware_8h_source.html +++ b/docs/api/gb_2hardware_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -119,473 +119,495 @@ $(document).ready(function(){initNavTree('gb_2hardware_8h_source.html',''); init
    36 __BYTE_REG rROMB1;
    37 __BYTE_REG rRAMB;
    38 
    -
    41 __REG P1_REG;
    -
    42 #define rP1 P1_REG
    -
    43 
    -
    44 #define P1F_5 0b00100000
    -
    45 #define P1F_4 0b00010000
    -
    46 #define P1F_3 0b00001000
    -
    47 #define P1F_2 0b00000100
    -
    48 #define P1F_1 0b00000010
    -
    49 #define P1F_0 0b00000001
    -
    50 
    -
    51 #define P1F_GET_DPAD P1F_5
    -
    52 #define P1F_GET_BTN P1F_4
    -
    53 #define P1F_GET_NONE (P1F_4 | P1F_5)
    +
    41 __BYTE_REG rMBC7_SRAM_ENABLE_1;
    +
    42 __BYTE_REG rMBC7_SRAM_ENABLE_2;
    +
    43 __BYTE_REG rMBC7_LATCH_1;
    +
    44 __BYTE_REG rMBC7_LATCH_2;
    +
    45 __BYTE_REG rMBC7_ACCEL_X_LO;
    +
    46 __BYTE_REG rMBC7_ACCEL_X_HI;
    +
    47 __BYTE_REG rMBC7_ACCEL_Y_LO;
    +
    48 __BYTE_REG rMBC7_ACCEL_Y_HI;
    +
    49 
    +
    50 #define MBC7_LATCH_ERASE 0x55u
    +
    51 #define MBC7_LATCH_CAPTURE 0xAAu
    +
    52 #define MBC7_SRAM_ENABLE_KEY_1 0x0Au
    +
    53 #define MBC7_SRAM_ENABLE_KEY_2 0x40u
    54 
    -
    55 __REG SB_REG;
    -
    56 #define rSB SB_REG
    -
    57 __REG SC_REG;
    -
    58 #define rSC SC_REG
    +
    57 __REG P1_REG;
    +
    58 #define rP1 P1_REG
    59 
    -
    60 #define SIOF_XFER_START 0b10000000
    -
    61 #define SIOF_CLOCK_INT 0b00000001
    -
    62 #define SIOF_CLOCK_EXT 0b00000000
    -
    63 #define SIOF_SPEED_1X 0b00000000
    -
    64 #define SIOF_SPEED_32X 0b00000010
    -
    65 #define SIOF_B_CLOCK 0
    -
    66 #define SIOF_B_SPEED 1
    -
    67 #define SIOF_B_XFER_START 7
    -
    68 #define SCF_START SIOF_XFER_START
    -
    69 #define SCF_SOURCE SIOF_CLOCK_INT
    -
    70 #define SCF_SPEED SIOF_SPEED_32X
    -
    71 
    -
    72 __REG DIV_REG;
    -
    73 #define rDIV DIV_REG
    -
    74 __REG TIMA_REG;
    -
    75 #define rTIMA TIMA_REG
    -
    76 __REG TMA_REG;
    -
    77 #define rTMA TMA_REG
    -
    78 __REG TAC_REG;
    -
    79 #define rTAC TAC_REG
    -
    80 
    -
    81 #define TACF_START 0b00000100
    -
    82 #define TACF_STOP 0b00000000
    -
    83 #define TACF_4KHZ 0b00000000
    -
    84 #define TACF_16KHZ 0b00000011
    -
    85 #define TACF_65KHZ 0b00000010
    -
    86 #define TACF_262KHZ 0b00000001
    +
    60 #define P1F_5 0b00100000
    +
    61 #define P1F_4 0b00010000
    +
    62 #define P1F_3 0b00001000
    +
    63 #define P1F_2 0b00000100
    +
    64 #define P1F_1 0b00000010
    +
    65 #define P1F_0 0b00000001
    +
    66 
    +
    67 #define P1F_GET_DPAD P1F_5
    +
    68 #define P1F_GET_BTN P1F_4
    +
    69 #define P1F_GET_NONE (P1F_4 | P1F_5)
    +
    70 
    +
    71 __REG SB_REG;
    +
    72 #define rSB SB_REG
    +
    73 __REG SC_REG;
    +
    74 #define rSC SC_REG
    +
    75 
    +
    76 #define SIOF_XFER_START 0b10000000
    +
    77 #define SIOF_CLOCK_INT 0b00000001
    +
    78 #define SIOF_CLOCK_EXT 0b00000000
    +
    79 #define SIOF_SPEED_1X 0b00000000
    +
    80 #define SIOF_SPEED_32X 0b00000010
    +
    81 #define SIOF_B_CLOCK 0
    +
    82 #define SIOF_B_SPEED 1
    +
    83 #define SIOF_B_XFER_START 7
    +
    84 #define SCF_START SIOF_XFER_START
    +
    85 #define SCF_SOURCE SIOF_CLOCK_INT
    +
    86 #define SCF_SPEED SIOF_SPEED_32X
    87 
    -
    88 __REG IF_REG;
    -
    89 #define rIF IF_REG
    -
    90 
    -
    91 __REG NR10_REG;
    -
    92 #define rAUD1SWEEP NR10_REG
    -
    93 #define AUD1SWEEP_UP 0b00000000
    -
    94 #define AUD1SWEEP_DOWN 0b00001000
    -
    95 #define AUD1SWEEP_TIME(x) ((x) << 4)
    -
    96 #define AUD1SWEEP_LENGTH(x) (x)
    -
    97 __REG NR11_REG;
    -
    98 #define rAUD1LEN NR11_REG
    -
    99 __REG NR12_REG;
    -
    100 #define rAUD1ENV NR12_REG
    -
    101 __REG NR13_REG;
    -
    102 #define rAUD1LOW NR13_REG
    -
    103 __REG NR14_REG;
    -
    104 #define rAUD1HIGH NR14_REG
    -
    106 __REG NR21_REG;
    -
    107 #define rAUD2LEN NR21_REG
    -
    108 __REG NR22_REG;
    -
    109 #define rAUD2ENV NR22_REG
    -
    110 __REG NR23_REG;
    -
    111 #define rAUD2LOW NR23_REG
    -
    112 __REG NR24_REG;
    -
    113 #define rAUD2HIGH NR24_REG
    -
    115 __REG NR30_REG;
    -
    116 #define rAUD3ENA NR30_REG
    -
    117 __REG NR31_REG;
    -
    118 #define rAUD3LEN NR31_REG
    -
    119 __REG NR32_REG;
    -
    120 #define rAUD3LEVEL NR32_REG
    -
    121 __REG NR33_REG;
    -
    122 #define rAUD3LOW NR33_REG
    -
    123 __REG NR34_REG;
    -
    124 #define rAUD3HIGH NR34_REG
    -
    126 __REG NR41_REG;
    -
    127 #define rAUD4LEN NR41_REG
    -
    128 __REG NR42_REG;
    -
    129 #define rAUD4ENV NR42_REG
    -
    130 __REG NR43_REG;
    -
    131 #define rAUD4POLY NR43_REG
    -
    132 #define AUD4POLY_WIDTH_15BIT 0x00
    -
    133 #define AUD4POLY_WIDTH_7BIT 0x08
    -
    134 __REG NR44_REG;
    -
    135 #define rAUD4GO NR44_REG
    -
    137 __REG NR50_REG;
    -
    138 #define rAUDVOL NR50_REG
    -
    140 #define AUDVOL_VOL_LEFT(x) ((x) << 4)
    -
    141 #define AUDVOL_VOL_RIGHT(x) ((x))
    -
    142 #define AUDVOL_VIN_LEFT 0b10000000
    -
    143 #define AUDVOL_VIN_RIGHT 0b00001000
    -
    145 __REG NR51_REG;
    -
    146 #define rAUDTERM NR51_REG
    -
    148 #define AUDTERM_4_LEFT 0b10000000
    -
    149 #define AUDTERM_3_LEFT 0b01000000
    -
    150 #define AUDTERM_2_LEFT 0b00100000
    -
    151 #define AUDTERM_1_LEFT 0b00010000
    -
    152 #define AUDTERM_4_RIGHT 0b00001000
    -
    153 #define AUDTERM_3_RIGHT 0b00000100
    -
    154 #define AUDTERM_2_RIGHT 0b00000010
    -
    155 #define AUDTERM_1_RIGHT 0b00000001
    -
    157 __REG NR52_REG;
    -
    158 #define rAUDENA NR52_REG
    -
    160 #define AUDENA_ON 0b10000000
    -
    161 #define AUDENA_OFF 0b00000000
    -
    163 __BYTE_REG AUD3WAVE[16];
    -
    164 __BYTE_REG PCM_SAMPLE[16];
    -
    165 
    -
    166 __REG LCDC_REG;
    -
    167 #define rLCDC LCDC_REG
    -
    168 
    -
    169 #if defined(__TARGET_ap)
    -
    170 #define LCDCF_OFF 0b00000000
    -
    171 #define LCDCF_ON 0b00000001
    -
    172 #define LCDCF_WIN9800 0b00000000
    -
    173 #define LCDCF_WIN9C00 0b00000010
    -
    174 #define LCDCF_WINOFF 0b00000000
    -
    175 #define LCDCF_WINON 0b00000100
    -
    176 #define LCDCF_BG8800 0b00000000
    -
    177 #define LCDCF_BG8000 0b00001000
    -
    178 #define LCDCF_BG9800 0b00000000
    -
    179 #define LCDCF_BG9C00 0b00010000
    -
    180 #define LCDCF_OBJ8 0b00000000
    -
    181 #define LCDCF_OBJ16 0b00100000
    -
    182 #define LCDCF_OBJOFF 0b00000000
    -
    183 #define LCDCF_OBJON 0b01000000
    -
    184 #define LCDCF_BGOFF 0b00000000
    -
    185 #define LCDCF_BGON 0b10000000
    -
    186 #define LCDCF_B_ON 0
    -
    187 #define LCDCF_B_WIN9C00 1
    -
    188 #define LCDCF_B_WINON 2
    -
    189 #define LCDCF_B_BG8000 3
    -
    190 #define LCDCF_B_BG9C00 4
    -
    191 #define LCDCF_B_OBJ16 5
    -
    192 #define LCDCF_B_OBJON 6
    -
    193 #define LCDCF_B_BGON 7
    -
    194 #elif defined(__TARGET_duck)
    -
    195 #define LCDCF_OFF 0b00000000
    -
    196 #define LCDCF_ON 0b10000000
    -
    197 #define LCDCF_WIN9800 0b00000000
    -
    198 #define LCDCF_WIN9C00 0b00001000
    -
    199 #define LCDCF_WINOFF 0b00000000
    -
    200 #define LCDCF_WINON 0b00100000
    -
    201 #define LCDCF_BG8800 0b00000000
    -
    202 #define LCDCF_BG8000 0b00010000
    -
    203 #define LCDCF_BG9800 0b00000000
    -
    204 #define LCDCF_BG9C00 0b00000100
    -
    205 #define LCDCF_OBJ8 0b00000000
    -
    206 #define LCDCF_OBJ16 0b00000010
    -
    207 #define LCDCF_OBJOFF 0b00000000
    -
    208 #define LCDCF_OBJON 0b00000001
    -
    209 #define LCDCF_BGOFF 0b00000000
    -
    210 #define LCDCF_BGON 0b01000000
    -
    211 #define LCDCF_B_ON 7
    -
    212 #define LCDCF_B_WIN9C00 3
    -
    213 #define LCDCF_B_WINON 5
    -
    214 #define LCDCF_B_BG8000 4
    -
    215 #define LCDCF_B_BG9C00 2
    -
    216 #define LCDCF_B_OBJ16 1
    -
    217 #define LCDCF_B_OBJON 0
    -
    218 #define LCDCF_B_BGON 6
    -
    219 #else
    -
    220 #define LCDCF_OFF 0b00000000
    -
    221 #define LCDCF_ON 0b10000000
    -
    222 #define LCDCF_WIN9800 0b00000000
    -
    223 #define LCDCF_WIN9C00 0b01000000
    -
    224 #define LCDCF_WINOFF 0b00000000
    -
    225 #define LCDCF_WINON 0b00100000
    -
    226 #define LCDCF_BG8800 0b00000000
    -
    227 #define LCDCF_BG8000 0b00010000
    -
    228 #define LCDCF_BG9800 0b00000000
    -
    229 #define LCDCF_BG9C00 0b00001000
    -
    230 #define LCDCF_OBJ8 0b00000000
    -
    231 #define LCDCF_OBJ16 0b00000100
    -
    232 #define LCDCF_OBJOFF 0b00000000
    -
    233 #define LCDCF_OBJON 0b00000010
    -
    234 #define LCDCF_BGOFF 0b00000000
    -
    235 #define LCDCF_BGON 0b00000001
    -
    236 #define LCDCF_B_ON 7
    -
    237 #define LCDCF_B_WIN9C00 6
    -
    238 #define LCDCF_B_WINON 5
    -
    239 #define LCDCF_B_BG8000 4
    -
    240 #define LCDCF_B_BG9C00 3
    -
    241 #define LCDCF_B_OBJ16 2
    -
    242 #define LCDCF_B_OBJON 1
    -
    243 #define LCDCF_B_BGON 0
    -
    244 #endif
    -
    245 
    -
    246 __REG STAT_REG;
    -
    247 #define rSTAT STAT_REG
    -
    248 
    -
    249 #if defined(__TARGET_ap)
    -
    250 #define STATF_LYC 0b00000010
    -
    251 #define STATF_MODE10 0b00000100
    -
    252 #define STATF_MODE01 0b00001000
    -
    253 #define STATF_MODE00 0b00010000
    -
    254 #define STATF_LYCF 0b00100000
    -
    255 #define STATF_HBL 0b00000000
    -
    256 #define STATF_VBL 0b10000000
    -
    257 #define STATF_OAM 0b01000000
    -
    258 #define STATF_LCD 0b11000000
    -
    259 #define STATF_BUSY 0b01000000
    -
    260 #define STATF_B_LYC 1
    -
    261 #define STATF_B_MODE10 2
    -
    262 #define STATF_B_MODE01 3
    -
    263 #define STATF_B_MODE00 4
    -
    264 #define STATF_B_LYCF 5
    -
    265 #define STATF_B_VBL 7
    -
    266 #define STATF_B_OAM 6
    -
    267 #define STATF_B_BUSY 6
    -
    268 #else
    -
    269 #define STATF_LYC 0b01000000
    -
    270 #define STATF_MODE10 0b00100000
    -
    271 #define STATF_MODE01 0b00010000
    -
    272 #define STATF_MODE00 0b00001000
    -
    273 #define STATF_LYCF 0b00000100
    -
    274 #define STATF_HBL 0b00000000
    -
    275 #define STATF_VBL 0b00000001
    -
    276 #define STATF_OAM 0b00000010
    -
    277 #define STATF_LCD 0b00000011
    -
    278 #define STATF_BUSY 0b00000010
    -
    279 #define STATF_B_LYC 6
    -
    280 #define STATF_B_MODE10 5
    -
    281 #define STATF_B_MODE01 4
    -
    282 #define STATF_B_MODE00 3
    -
    283 #define STATF_B_LYCF 2
    -
    284 #define STATF_B_VBL 0
    -
    285 #define STATF_B_OAM 1
    -
    286 #define STATF_B_BUSY 1
    -
    287 #endif
    -
    288 
    -
    289 __REG SCY_REG;
    -
    290 #define rSCY
    -
    291 __REG SCX_REG;
    -
    292 #define rSCX SCX_REG
    -
    293 __REG LY_REG;
    -
    294 #define rLY LY_REG
    -
    295 __REG LYC_REG;
    -
    296 #define rLYC LYC_REG
    -
    297 __REG DMA_REG;
    -
    298 #define rDMA DMA_REG
    -
    299 __REG BGP_REG;
    -
    300 #define rBGP BGP_REG
    -
    301 __REG OBP0_REG;
    -
    302 #define rOBP0 OBP0_REG
    -
    303 __REG OBP1_REG;
    -
    304 #define rOBP1 OBP1_REG
    -
    305 __REG WY_REG;
    -
    306 #define rWY WY_REG
    -
    307 __REG WX_REG;
    -
    308 #define rWX WX_REG
    -
    309 __REG KEY1_REG;
    -
    310 #define rKEY1 KEY1_REG
    -
    311 #define rSPD KEY1_REG
    -
    312 
    -
    313 #define KEY1F_DBLSPEED 0b10000000
    -
    314 #define KEY1F_PREPARE 0b00000001
    -
    315 
    -
    316 __REG VBK_REG;
    -
    317 #define rVBK VBK_REG
    -
    318 
    -
    319 #define VBK_BANK_0 0
    -
    320 #define VBK_TILES 0
    -
    321 #define VBK_BANK_1 1
    -
    322 #define VBK_ATTRIBUTES 1
    -
    324 #define BKGF_PRI 0b10000000
    -
    325 #define BKGF_YFLIP 0b01000000
    -
    326 #define BKGF_XFLIP 0b00100000
    -
    327 #define BKGF_BANK0 0b00000000
    -
    328 #define BKGF_BANK1 0b00001000
    -
    330 #define BKGF_CGB_PAL0 0b00000000
    -
    331 #define BKGF_CGB_PAL1 0b00000001
    -
    332 #define BKGF_CGB_PAL2 0b00000010
    -
    333 #define BKGF_CGB_PAL3 0b00000011
    -
    334 #define BKGF_CGB_PAL4 0b00000100
    -
    335 #define BKGF_CGB_PAL5 0b00000101
    -
    336 #define BKGF_CGB_PAL6 0b00000110
    -
    337 #define BKGF_CGB_PAL7 0b00000111
    -
    339 __REG HDMA1_REG;
    -
    340 #define rHDMA1 HDMA1_REG
    -
    341 __REG HDMA2_REG;
    -
    342 #define rHDMA2 HDMA2_REG
    -
    343 __REG HDMA3_REG;
    -
    344 #define rHDMA3 HDMA3_REG
    -
    345 __REG HDMA4_REG;
    -
    346 #define rHDMA4 HDMA4_REG
    -
    347 __REG HDMA5_REG;
    -
    348 #define rHDMA5 HDMA5_REG
    -
    349 
    -
    350 #define HDMA5F_MODE_GP 0b00000000
    -
    351 #define HDMA5F_MODE_HBL 0b10000000
    -
    352 
    -
    353 #define HDMA5F_BUSY 0b10000000
    -
    354 
    -
    355 __REG RP_REG;
    -
    356 #define rRP RP_REG
    -
    357 
    -
    358 #define RPF_ENREAD 0b11000000
    -
    359 #define RPF_DATAIN 0b00000010
    -
    360 #define RPF_WRITE_HI 0b00000001
    -
    361 #define RPF_WRITE_LO 0b00000000
    -
    362 
    -
    363 __REG BCPS_REG;
    -
    364 #define rBCPS BCPS_REG
    +
    88 __REG DIV_REG;
    +
    89 #define rDIV DIV_REG
    +
    90 __REG TIMA_REG;
    +
    91 #define rTIMA TIMA_REG
    +
    92 __REG TMA_REG;
    +
    93 #define rTMA TMA_REG
    +
    94 __REG TAC_REG;
    +
    95 #define rTAC TAC_REG
    +
    96 
    +
    97 #define TACF_START 0b00000100
    +
    98 #define TACF_STOP 0b00000000
    +
    99 #define TACF_4KHZ 0b00000000
    +
    100 #define TACF_16KHZ 0b00000011
    +
    101 #define TACF_65KHZ 0b00000010
    +
    102 #define TACF_262KHZ 0b00000001
    +
    103 
    +
    104 __REG IF_REG;
    +
    105 #define rIF IF_REG
    +
    106 
    +
    107 __REG NR10_REG;
    +
    108 #define rAUD1SWEEP NR10_REG
    +
    109 #define AUD1SWEEP_UP 0b00000000
    +
    110 #define AUD1SWEEP_DOWN 0b00001000
    +
    111 #define AUD1SWEEP_TIME(x) ((x) << 4)
    +
    112 #define AUD1SWEEP_LENGTH(x) (x)
    +
    113 __REG NR11_REG;
    +
    114 #define rAUD1LEN NR11_REG
    +
    115 __REG NR12_REG;
    +
    116 #define rAUD1ENV NR12_REG
    +
    117 __REG NR13_REG;
    +
    118 #define rAUD1LOW NR13_REG
    +
    119 __REG NR14_REG;
    +
    120 #define rAUD1HIGH NR14_REG
    +
    122 __REG NR21_REG;
    +
    123 #define rAUD2LEN NR21_REG
    +
    124 __REG NR22_REG;
    +
    125 #define rAUD2ENV NR22_REG
    +
    126 __REG NR23_REG;
    +
    127 #define rAUD2LOW NR23_REG
    +
    128 __REG NR24_REG;
    +
    129 #define rAUD2HIGH NR24_REG
    +
    131 __REG NR30_REG;
    +
    132 #define rAUD3ENA NR30_REG
    +
    133 __REG NR31_REG;
    +
    134 #define rAUD3LEN NR31_REG
    +
    135 __REG NR32_REG;
    +
    136 #define rAUD3LEVEL NR32_REG
    +
    137 __REG NR33_REG;
    +
    138 #define rAUD3LOW NR33_REG
    +
    139 __REG NR34_REG;
    +
    140 #define rAUD3HIGH NR34_REG
    +
    142 __REG NR41_REG;
    +
    143 #define rAUD4LEN NR41_REG
    +
    144 __REG NR42_REG;
    +
    145 #define rAUD4ENV NR42_REG
    +
    146 __REG NR43_REG;
    +
    147 #define rAUD4POLY NR43_REG
    +
    148 #define AUD4POLY_WIDTH_15BIT 0x00
    +
    149 #define AUD4POLY_WIDTH_7BIT 0x08
    +
    150 __REG NR44_REG;
    +
    151 #define rAUD4GO NR44_REG
    +
    153 __REG NR50_REG;
    +
    154 #define rAUDVOL NR50_REG
    +
    156 #define AUDVOL_VOL_LEFT(x) ((x) << 4)
    +
    157 #define AUDVOL_VOL_RIGHT(x) ((x))
    +
    158 #define AUDVOL_VIN_LEFT 0b10000000
    +
    159 #define AUDVOL_VIN_RIGHT 0b00001000
    +
    161 __REG NR51_REG;
    +
    162 #define rAUDTERM NR51_REG
    +
    164 #define AUDTERM_4_LEFT 0b10000000
    +
    165 #define AUDTERM_3_LEFT 0b01000000
    +
    166 #define AUDTERM_2_LEFT 0b00100000
    +
    167 #define AUDTERM_1_LEFT 0b00010000
    +
    168 #define AUDTERM_4_RIGHT 0b00001000
    +
    169 #define AUDTERM_3_RIGHT 0b00000100
    +
    170 #define AUDTERM_2_RIGHT 0b00000010
    +
    171 #define AUDTERM_1_RIGHT 0b00000001
    +
    173 __REG NR52_REG;
    +
    174 #define rAUDENA NR52_REG
    +
    176 #define AUDENA_ON 0b10000000
    +
    177 #define AUDENA_OFF 0b00000000
    +
    179 __BYTE_REG AUD3WAVE[16];
    +
    180 __BYTE_REG PCM_SAMPLE[16];
    +
    181 
    +
    182 __REG LCDC_REG;
    +
    183 #define rLCDC LCDC_REG
    +
    184 
    +
    185 #if defined(__TARGET_ap)
    +
    186 #define LCDCF_OFF 0b00000000
    +
    187 #define LCDCF_ON 0b00000001
    +
    188 #define LCDCF_WIN9800 0b00000000
    +
    189 #define LCDCF_WIN9C00 0b00000010
    +
    190 #define LCDCF_WINOFF 0b00000000
    +
    191 #define LCDCF_WINON 0b00000100
    +
    192 #define LCDCF_BG8800 0b00000000
    +
    193 #define LCDCF_BG8000 0b00001000
    +
    194 #define LCDCF_BG9800 0b00000000
    +
    195 #define LCDCF_BG9C00 0b00010000
    +
    196 #define LCDCF_OBJ8 0b00000000
    +
    197 #define LCDCF_OBJ16 0b00100000
    +
    198 #define LCDCF_OBJOFF 0b00000000
    +
    199 #define LCDCF_OBJON 0b01000000
    +
    200 #define LCDCF_BGOFF 0b00000000
    +
    201 #define LCDCF_BGON 0b10000000
    +
    202 #define LCDCF_B_ON 0
    +
    203 #define LCDCF_B_WIN9C00 1
    +
    204 #define LCDCF_B_WINON 2
    +
    205 #define LCDCF_B_BG8000 3
    +
    206 #define LCDCF_B_BG9C00 4
    +
    207 #define LCDCF_B_OBJ16 5
    +
    208 #define LCDCF_B_OBJON 6
    +
    209 #define LCDCF_B_BGON 7
    +
    210 #elif defined(__TARGET_duck)
    +
    211 #define LCDCF_OFF 0b00000000
    +
    212 #define LCDCF_ON 0b10000000
    +
    213 #define LCDCF_WIN9800 0b00000000
    +
    214 #define LCDCF_WIN9C00 0b00001000
    +
    215 #define LCDCF_WINOFF 0b00000000
    +
    216 #define LCDCF_WINON 0b00100000
    +
    217 #define LCDCF_BG8800 0b00000000
    +
    218 #define LCDCF_BG8000 0b00010000
    +
    219 #define LCDCF_BG9800 0b00000000
    +
    220 #define LCDCF_BG9C00 0b00000100
    +
    221 #define LCDCF_OBJ8 0b00000000
    +
    222 #define LCDCF_OBJ16 0b00000010
    +
    223 #define LCDCF_OBJOFF 0b00000000
    +
    224 #define LCDCF_OBJON 0b00000001
    +
    225 #define LCDCF_BGOFF 0b00000000
    +
    226 #define LCDCF_BGON 0b01000000
    +
    227 #define LCDCF_B_ON 7
    +
    228 #define LCDCF_B_WIN9C00 3
    +
    229 #define LCDCF_B_WINON 5
    +
    230 #define LCDCF_B_BG8000 4
    +
    231 #define LCDCF_B_BG9C00 2
    +
    232 #define LCDCF_B_OBJ16 1
    +
    233 #define LCDCF_B_OBJON 0
    +
    234 #define LCDCF_B_BGON 6
    +
    235 #else
    +
    236 #define LCDCF_OFF 0b00000000
    +
    237 #define LCDCF_ON 0b10000000
    +
    238 #define LCDCF_WIN9800 0b00000000
    +
    239 #define LCDCF_WIN9C00 0b01000000
    +
    240 #define LCDCF_WINOFF 0b00000000
    +
    241 #define LCDCF_WINON 0b00100000
    +
    242 #define LCDCF_BG8800 0b00000000
    +
    243 #define LCDCF_BG8000 0b00010000
    +
    244 #define LCDCF_BG9800 0b00000000
    +
    245 #define LCDCF_BG9C00 0b00001000
    +
    246 #define LCDCF_OBJ8 0b00000000
    +
    247 #define LCDCF_OBJ16 0b00000100
    +
    248 #define LCDCF_OBJOFF 0b00000000
    +
    249 #define LCDCF_OBJON 0b00000010
    +
    250 #define LCDCF_BGOFF 0b00000000
    +
    251 #define LCDCF_BGON 0b00000001
    +
    252 #define LCDCF_B_ON 7
    +
    253 #define LCDCF_B_WIN9C00 6
    +
    254 #define LCDCF_B_WINON 5
    +
    255 #define LCDCF_B_BG8000 4
    +
    256 #define LCDCF_B_BG9C00 3
    +
    257 #define LCDCF_B_OBJ16 2
    +
    258 #define LCDCF_B_OBJON 1
    +
    259 #define LCDCF_B_BGON 0
    +
    260 #endif
    +
    261 
    +
    262 __REG STAT_REG;
    +
    263 #define rSTAT STAT_REG
    +
    264 
    +
    265 #if defined(__TARGET_ap)
    +
    266 #define STATF_LYC 0b00000010
    +
    267 #define STATF_MODE10 0b00000100
    +
    268 #define STATF_MODE01 0b00001000
    +
    269 #define STATF_MODE00 0b00010000
    +
    270 #define STATF_LYCF 0b00100000
    +
    271 #define STATF_HBL 0b00000000
    +
    272 #define STATF_VBL 0b10000000
    +
    273 #define STATF_OAM 0b01000000
    +
    274 #define STATF_LCD 0b11000000
    +
    275 #define STATF_BUSY 0b01000000
    +
    276 #define STATF_B_LYC 1
    +
    277 #define STATF_B_MODE10 2
    +
    278 #define STATF_B_MODE01 3
    +
    279 #define STATF_B_MODE00 4
    +
    280 #define STATF_B_LYCF 5
    +
    281 #define STATF_B_VBL 7
    +
    282 #define STATF_B_OAM 6
    +
    283 #define STATF_B_BUSY 6
    +
    284 #else
    +
    285 #define STATF_LYC 0b01000000
    +
    286 #define STATF_MODE10 0b00100000
    +
    287 #define STATF_MODE01 0b00010000
    +
    288 #define STATF_MODE00 0b00001000
    +
    289 #define STATF_LYCF 0b00000100
    +
    290 #define STATF_HBL 0b00000000
    +
    291 #define STATF_VBL 0b00000001
    +
    292 #define STATF_OAM 0b00000010
    +
    293 #define STATF_LCD 0b00000011
    +
    294 #define STATF_BUSY 0b00000010
    +
    295 #define STATF_B_LYC 6
    +
    296 #define STATF_B_MODE10 5
    +
    297 #define STATF_B_MODE01 4
    +
    298 #define STATF_B_MODE00 3
    +
    299 #define STATF_B_LYCF 2
    +
    300 #define STATF_B_VBL 0
    +
    301 #define STATF_B_OAM 1
    +
    302 #define STATF_B_BUSY 1
    +
    303 #endif
    +
    304 
    +
    305 __REG SCY_REG;
    +
    306 #define rSCY
    +
    307 __REG SCX_REG;
    +
    308 #define rSCX SCX_REG
    +
    309 __REG LY_REG;
    +
    310 #define rLY LY_REG
    +
    311 __REG LYC_REG;
    +
    312 #define rLYC LYC_REG
    +
    313 __REG DMA_REG;
    +
    314 #define rDMA DMA_REG
    +
    315 __REG BGP_REG;
    +
    316 #define rBGP BGP_REG
    +
    317 __REG OBP0_REG;
    +
    318 #define rOBP0 OBP0_REG
    +
    319 __REG OBP1_REG;
    +
    320 #define rOBP1 OBP1_REG
    +
    321 __REG WY_REG;
    +
    322 #define rWY WY_REG
    +
    323 __REG WX_REG;
    +
    324 #define rWX WX_REG
    +
    325 __REG KEY1_REG;
    +
    326 #define rKEY1 KEY1_REG
    +
    327 #define rSPD KEY1_REG
    +
    328 
    +
    329 #define KEY1F_DBLSPEED 0b10000000
    +
    330 #define KEY1F_PREPARE 0b00000001
    +
    331 
    +
    332 __REG VBK_REG;
    +
    333 #define rVBK VBK_REG
    +
    334 
    +
    335 #define VBK_BANK_0 0
    +
    336 #define VBK_TILES 0
    +
    337 #define VBK_BANK_1 1
    +
    338 #define VBK_ATTRIBUTES 1
    +
    340 #define BKGF_PRI 0b10000000
    +
    341 #define BKGF_YFLIP 0b01000000
    +
    342 #define BKGF_XFLIP 0b00100000
    +
    343 #define BKGF_BANK0 0b00000000
    +
    344 #define BKGF_BANK1 0b00001000
    +
    346 #define BKGF_CGB_PAL0 0b00000000
    +
    347 #define BKGF_CGB_PAL1 0b00000001
    +
    348 #define BKGF_CGB_PAL2 0b00000010
    +
    349 #define BKGF_CGB_PAL3 0b00000011
    +
    350 #define BKGF_CGB_PAL4 0b00000100
    +
    351 #define BKGF_CGB_PAL5 0b00000101
    +
    352 #define BKGF_CGB_PAL6 0b00000110
    +
    353 #define BKGF_CGB_PAL7 0b00000111
    +
    355 __REG HDMA1_REG;
    +
    356 #define rHDMA1 HDMA1_REG
    +
    357 __REG HDMA2_REG;
    +
    358 #define rHDMA2 HDMA2_REG
    +
    359 __REG HDMA3_REG;
    +
    360 #define rHDMA3 HDMA3_REG
    +
    361 __REG HDMA4_REG;
    +
    362 #define rHDMA4 HDMA4_REG
    +
    363 __REG HDMA5_REG;
    +
    364 #define rHDMA5 HDMA5_REG
    365 
    -
    366 #define BCPSF_AUTOINC 0b10000000
    -
    367 __REG BCPD_REG;
    -
    368 #define rBCPD BCPD_REG
    -
    369 
    -
    370 __REG OCPS_REG;
    -
    371 #define rOCPS OCPS_REG
    -
    372 
    -
    373 #define OCPSF_AUTOINC 0b10000000
    -
    374 __REG OCPD_REG;
    -
    375 #define rOCPD OCPD_REG
    -
    376 __REG SVBK_REG;
    -
    377 #define rSVBK SVBK_REG
    -
    378 #define rSMBK SVBK_REG
    -
    379 
    -
    380 __REG PCM12_REG;
    -
    381 #define rPCM12 PCM12_REG
    -
    382 
    -
    383 __REG PCM34_REG;
    -
    384 #define rPCM34 PCM34_REG
    +
    366 #define HDMA5F_MODE_GP 0b00000000
    +
    367 #define HDMA5F_MODE_HBL 0b10000000
    +
    368 
    +
    369 #define HDMA5F_BUSY 0b10000000
    +
    370 
    +
    371 __REG RP_REG;
    +
    372 #define rRP RP_REG
    +
    373 
    +
    374 #define RPF_ENREAD 0b11000000
    +
    375 #define RPF_DATAIN 0b00000010
    +
    376 #define RPF_WRITE_HI 0b00000001
    +
    377 #define RPF_WRITE_LO 0b00000000
    +
    378 
    +
    379 __REG BCPS_REG;
    +
    380 #define rBCPS BCPS_REG
    +
    381 
    +
    382 #define BCPSF_AUTOINC 0b10000000
    +
    383 __REG BCPD_REG;
    +
    384 #define rBCPD BCPD_REG
    385 
    -
    386 __REG IE_REG;
    -
    387 #define rIE IE_REG
    +
    386 __REG OCPS_REG;
    +
    387 #define rOCPS OCPS_REG
    388 
    -
    389 #define IEF_HILO 0b00010000
    -
    390 #define IEF_SERIAL 0b00001000
    -
    391 #define IEF_TIMER 0b00000100
    -
    392 #define IEF_STAT 0b00000010
    -
    393 #define IEF_VBLANK 0b00000001
    -
    396 /* Square wave duty cycle */
    -
    397 #define AUDLEN_DUTY_12_5 0b00000000
    -
    398 #define AUDLEN_DUTY_25 0b01000000
    -
    399 #define AUDLEN_DUTY_50 0b10000000
    -
    400 #define AUDLEN_DUTY_75 0b11000000
    -
    401 #define AUDLEN_LENGTH(x) (x)
    -
    402 
    -
    403 /* Audio envelope flags */
    -
    404 #define AUDENV_VOL(x) ((x) << 4)
    -
    405 #define AUDENV_UP 0b00001000
    -
    406 #define AUDENV_DOWN 0b00000000
    -
    407 #define AUDENV_LENGTH(x) (x)
    -
    408 
    -
    409 /* Audio trigger flags */
    -
    410 #define AUDHIGH_RESTART 0b10000000
    -
    411 #define AUDHIGH_LENGTH_ON 0b01000000
    -
    412 #define AUDHIGH_LENGTH_OFF 0b00000000
    -
    413 
    -
    414 /* OAM attributes flags */
    -
    415 #define OAMF_PRI 0b10000000
    -
    416 #define OAMF_YFLIP 0b01000000
    -
    417 #define OAMF_XFLIP 0b00100000
    -
    418 #define OAMF_PAL0 0b00000000
    -
    419 #define OAMF_PAL1 0b00010000
    -
    420 #define OAMF_BANK0 0b00000000
    -
    421 #define OAMF_BANK1 0b00001000
    -
    423 #define OAMF_CGB_PAL0 0b00000000
    -
    424 #define OAMF_CGB_PAL1 0b00000001
    -
    425 #define OAMF_CGB_PAL2 0b00000010
    -
    426 #define OAMF_CGB_PAL3 0b00000011
    -
    427 #define OAMF_CGB_PAL4 0b00000100
    -
    428 #define OAMF_CGB_PAL5 0b00000101
    -
    429 #define OAMF_CGB_PAL6 0b00000110
    -
    430 #define OAMF_CGB_PAL7 0b00000111
    -
    432 #define OAMF_PALMASK 0b00000111
    -
    434 #define DEVICE_SCREEN_X_OFFSET 0
    -
    435 #define DEVICE_SCREEN_Y_OFFSET 0
    -
    436 #define DEVICE_SCREEN_WIDTH 20
    -
    437 #define DEVICE_SCREEN_HEIGHT 18
    -
    438 #define DEVICE_SCREEN_BUFFER_WIDTH 32
    -
    439 #define DEVICE_SCREEN_BUFFER_HEIGHT 32
    -
    440 #define DEVICE_SCREEN_MAP_ENTRY_SIZE 1
    -
    441 #define DEVICE_SPRITE_PX_OFFSET_X 8
    -
    442 #define DEVICE_SPRITE_PX_OFFSET_Y 16
    -
    443 #define DEVICE_WINDOW_PX_OFFSET_X 7
    -
    444 #define DEVICE_WINDOW_PX_OFFSET_Y 0
    -
    445 #define DEVICE_SCREEN_PX_WIDTH (DEVICE_SCREEN_WIDTH * 8)
    -
    446 #define DEVICE_SCREEN_PX_HEIGHT (DEVICE_SCREEN_HEIGHT * 8)
    -
    448 #endif
    +
    389 #define OCPSF_AUTOINC 0b10000000
    +
    390 __REG OCPD_REG;
    +
    391 #define rOCPD OCPD_REG
    +
    392 __REG SVBK_REG;
    +
    393 #define rSVBK SVBK_REG
    +
    394 #define rSMBK SVBK_REG
    +
    395 
    +
    396 __REG PCM12_REG;
    +
    397 #define rPCM12 PCM12_REG
    +
    398 
    +
    399 __REG PCM34_REG;
    +
    400 #define rPCM34 PCM34_REG
    +
    401 
    +
    402 __REG IE_REG;
    +
    403 #define rIE IE_REG
    +
    404 
    +
    405 #define IEF_HILO 0b00010000
    +
    406 #define IEF_SERIAL 0b00001000
    +
    407 #define IEF_TIMER 0b00000100
    +
    408 #define IEF_STAT 0b00000010
    +
    409 #define IEF_VBLANK 0b00000001
    +
    412 /* Square wave duty cycle */
    +
    413 #define AUDLEN_DUTY_12_5 0b00000000
    +
    414 #define AUDLEN_DUTY_25 0b01000000
    +
    415 #define AUDLEN_DUTY_50 0b10000000
    +
    416 #define AUDLEN_DUTY_75 0b11000000
    +
    417 #define AUDLEN_LENGTH(x) (x)
    +
    418 
    +
    419 /* Audio envelope flags */
    +
    420 #define AUDENV_VOL(x) ((x) << 4)
    +
    421 #define AUDENV_UP 0b00001000
    +
    422 #define AUDENV_DOWN 0b00000000
    +
    423 #define AUDENV_LENGTH(x) (x)
    +
    424 
    +
    425 /* Audio trigger flags */
    +
    426 #define AUDHIGH_RESTART 0b10000000
    +
    427 #define AUDHIGH_LENGTH_ON 0b01000000
    +
    428 #define AUDHIGH_LENGTH_OFF 0b00000000
    +
    429 
    +
    430 /* OAM attributes flags */
    +
    431 #define OAMF_PRI 0b10000000
    +
    432 #define OAMF_YFLIP 0b01000000
    +
    433 #define OAMF_XFLIP 0b00100000
    +
    434 #define OAMF_PAL0 0b00000000
    +
    435 #define OAMF_PAL1 0b00010000
    +
    436 #define OAMF_BANK0 0b00000000
    +
    437 #define OAMF_BANK1 0b00001000
    +
    439 #define OAMF_CGB_PAL0 0b00000000
    +
    440 #define OAMF_CGB_PAL1 0b00000001
    +
    441 #define OAMF_CGB_PAL2 0b00000010
    +
    442 #define OAMF_CGB_PAL3 0b00000011
    +
    443 #define OAMF_CGB_PAL4 0b00000100
    +
    444 #define OAMF_CGB_PAL5 0b00000101
    +
    445 #define OAMF_CGB_PAL6 0b00000110
    +
    446 #define OAMF_CGB_PAL7 0b00000111
    +
    448 #define OAMF_PALMASK 0b00000111
    +
    450 #define DEVICE_SCREEN_X_OFFSET 0
    +
    451 #define DEVICE_SCREEN_Y_OFFSET 0
    +
    452 #define DEVICE_SCREEN_WIDTH 20
    +
    453 #define DEVICE_SCREEN_HEIGHT 18
    +
    454 #define DEVICE_SCREEN_BUFFER_WIDTH 32
    +
    455 #define DEVICE_SCREEN_BUFFER_HEIGHT 32
    +
    456 #define DEVICE_SCREEN_MAP_ENTRY_SIZE 1
    +
    457 #define DEVICE_SPRITE_PX_OFFSET_X 8
    +
    458 #define DEVICE_SPRITE_PX_OFFSET_Y 16
    +
    459 #define DEVICE_WINDOW_PX_OFFSET_X 7
    +
    460 #define DEVICE_WINDOW_PX_OFFSET_Y 0
    +
    461 #define DEVICE_SCREEN_PX_WIDTH (DEVICE_SCREEN_WIDTH * 8)
    +
    462 #define DEVICE_SCREEN_PX_HEIGHT (DEVICE_SCREEN_HEIGHT * 8)
    +
    464 #endif
    __BYTE_REG rROMB1
    Definition: hardware.h:36
    -
    __REG NR33_REG
    Definition: hardware.h:121
    -
    __REG NR14_REG
    Definition: hardware.h:103
    -
    __REG P1_REG
    Definition: hardware.h:41
    +
    __REG NR33_REG
    Definition: hardware.h:137
    +
    __REG NR14_REG
    Definition: hardware.h:119
    +
    __REG P1_REG
    Definition: hardware.h:57
    __BYTES _SRAM[]
    Definition: hardware.h:24
    #define __REG
    Definition: hardware.h:14
    -
    __REG SC_REG
    Definition: hardware.h:57
    +
    __BYTE_REG rMBC7_SRAM_ENABLE_2
    Definition: hardware.h:42
    +
    __REG SC_REG
    Definition: hardware.h:73
    __BYTE_REG _IO[]
    Definition: hardware.h:28
    -
    __REG OBP0_REG
    Definition: hardware.h:301
    -
    __REG HDMA5_REG
    Definition: hardware.h:347
    -
    __REG OCPS_REG
    Definition: hardware.h:370
    -
    __REG WY_REG
    Definition: hardware.h:305
    -
    __REG BCPD_REG
    Definition: hardware.h:367
    -
    __REG SCY_REG
    Definition: hardware.h:289
    -
    __REG NR32_REG
    Definition: hardware.h:119
    -
    __BYTE_REG PCM_SAMPLE[16]
    Definition: hardware.h:164
    -
    __REG BCPS_REG
    Definition: hardware.h:363
    +
    __REG OBP0_REG
    Definition: hardware.h:317
    +
    __REG HDMA5_REG
    Definition: hardware.h:363
    +
    __REG OCPS_REG
    Definition: hardware.h:386
    +
    __BYTE_REG rMBC7_ACCEL_Y_LO
    Definition: hardware.h:47
    +
    __REG WY_REG
    Definition: hardware.h:321
    +
    __BYTE_REG rMBC7_ACCEL_Y_HI
    Definition: hardware.h:48
    +
    __REG BCPD_REG
    Definition: hardware.h:383
    +
    __REG SCY_REG
    Definition: hardware.h:305
    +
    __REG NR32_REG
    Definition: hardware.h:135
    +
    __BYTE_REG PCM_SAMPLE[16]
    Definition: hardware.h:180
    +
    __REG BCPS_REG
    Definition: hardware.h:379
    __BYTES _RAMBANK[]
    Definition: hardware.h:26
    -
    __BYTE_REG AUD3WAVE[16]
    Definition: hardware.h:163
    -
    __REG WX_REG
    Definition: hardware.h:307
    -
    __REG TMA_REG
    Definition: hardware.h:76
    -
    __REG HDMA4_REG
    Definition: hardware.h:345
    +
    __BYTE_REG AUD3WAVE[16]
    Definition: hardware.h:179
    +
    __REG WX_REG
    Definition: hardware.h:323
    +
    __BYTE_REG rMBC7_ACCEL_X_HI
    Definition: hardware.h:46
    +
    __REG TMA_REG
    Definition: hardware.h:92
    +
    __REG HDMA4_REG
    Definition: hardware.h:361
    #define __BYTE_REG
    Definition: hardware.h:13
    -
    __REG NR13_REG
    Definition: hardware.h:101
    -
    __REG PCM12_REG
    Definition: hardware.h:380
    +
    __REG NR13_REG
    Definition: hardware.h:117
    +
    __REG PCM12_REG
    Definition: hardware.h:396
    __BYTE_REG _HRAM[]
    Definition: hardware.h:30
    -
    __REG IF_REG
    Definition: hardware.h:88
    -
    __REG NR43_REG
    Definition: hardware.h:130
    -
    __REG NR41_REG
    Definition: hardware.h:126
    -
    __REG HDMA3_REG
    Definition: hardware.h:343
    -
    __REG LYC_REG
    Definition: hardware.h:295
    -
    __REG VBK_REG
    Definition: hardware.h:316
    -
    __REG SB_REG
    Definition: hardware.h:55
    +
    __REG IF_REG
    Definition: hardware.h:104
    +
    __REG NR43_REG
    Definition: hardware.h:146
    +
    __REG NR41_REG
    Definition: hardware.h:142
    +
    __REG HDMA3_REG
    Definition: hardware.h:359
    +
    __REG LYC_REG
    Definition: hardware.h:311
    +
    __REG VBK_REG
    Definition: hardware.h:332
    +
    __REG SB_REG
    Definition: hardware.h:71
    __BYTE_REG rRAMG
    Definition: hardware.h:34
    -
    __REG LCDC_REG
    Definition: hardware.h:166
    -
    __REG TAC_REG
    Definition: hardware.h:78
    -
    __REG NR24_REG
    Definition: hardware.h:112
    +
    __REG LCDC_REG
    Definition: hardware.h:182
    +
    __REG TAC_REG
    Definition: hardware.h:94
    +
    __REG NR24_REG
    Definition: hardware.h:128
    __BYTES _VRAM9000[]
    Definition: hardware.h:21
    -
    __REG NR21_REG
    Definition: hardware.h:106
    +
    __REG NR21_REG
    Definition: hardware.h:122
    __BYTES _OAMRAM[]
    Definition: hardware.h:27
    __BYTE_REG _AUD3WAVERAM[]
    Definition: hardware.h:29
    -
    __REG KEY1_REG
    Definition: hardware.h:309
    +
    __REG KEY1_REG
    Definition: hardware.h:325
    +
    __BYTE_REG rMBC7_SRAM_ENABLE_1
    Definition: hardware.h:41
    __BYTES _VRAM8000[]
    Definition: hardware.h:19
    -
    __REG RP_REG
    Definition: hardware.h:355
    -
    __REG NR12_REG
    Definition: hardware.h:99
    -
    __REG NR23_REG
    Definition: hardware.h:110
    -
    __REG HDMA2_REG
    Definition: hardware.h:341
    -
    __REG NR44_REG
    Definition: hardware.h:134
    -
    __REG NR30_REG
    Definition: hardware.h:115
    -
    __REG SCX_REG
    Definition: hardware.h:291
    -
    __REG NR50_REG
    Definition: hardware.h:137
    -
    __REG TIMA_REG
    Definition: hardware.h:74
    -
    __REG OBP1_REG
    Definition: hardware.h:303
    -
    __REG SVBK_REG
    Definition: hardware.h:376
    -
    __REG IE_REG
    Definition: hardware.h:386
    -
    __REG HDMA1_REG
    Definition: hardware.h:339
    +
    __REG RP_REG
    Definition: hardware.h:371
    +
    __REG NR12_REG
    Definition: hardware.h:115
    +
    __REG NR23_REG
    Definition: hardware.h:126
    +
    __REG HDMA2_REG
    Definition: hardware.h:357
    +
    __REG NR44_REG
    Definition: hardware.h:150
    +
    __REG NR30_REG
    Definition: hardware.h:131
    +
    __REG SCX_REG
    Definition: hardware.h:307
    +
    __REG NR50_REG
    Definition: hardware.h:153
    +
    __REG TIMA_REG
    Definition: hardware.h:90
    +
    __REG OBP1_REG
    Definition: hardware.h:319
    +
    __BYTE_REG rMBC7_ACCEL_X_LO
    Definition: hardware.h:45
    +
    __REG SVBK_REG
    Definition: hardware.h:392
    +
    __REG IE_REG
    Definition: hardware.h:402
    +
    __REG HDMA1_REG
    Definition: hardware.h:355
    #define __BYTES
    Definition: hardware.h:12
    -
    __REG NR51_REG
    Definition: hardware.h:145
    -
    __REG NR34_REG
    Definition: hardware.h:123
    -
    __REG NR42_REG
    Definition: hardware.h:128
    +
    __REG NR51_REG
    Definition: hardware.h:161
    +
    __REG NR34_REG
    Definition: hardware.h:139
    +
    __REG NR42_REG
    Definition: hardware.h:144
    +
    __BYTE_REG rMBC7_LATCH_2
    Definition: hardware.h:44
    __BYTES _RAM[]
    Definition: hardware.h:25
    __BYTE_REG rRAMB
    Definition: hardware.h:37
    -
    __REG NR52_REG
    Definition: hardware.h:157
    +
    __REG NR52_REG
    Definition: hardware.h:173
    __BYTES _SCRN0[]
    Definition: hardware.h:22
    -
    __REG PCM34_REG
    Definition: hardware.h:383
    -
    __REG STAT_REG
    Definition: hardware.h:246
    -
    __REG NR11_REG
    Definition: hardware.h:97
    -
    __REG NR10_REG
    Definition: hardware.h:91
    +
    __REG PCM34_REG
    Definition: hardware.h:399
    +
    __REG STAT_REG
    Definition: hardware.h:262
    +
    __REG NR11_REG
    Definition: hardware.h:113
    +
    __REG NR10_REG
    Definition: hardware.h:107
    __BYTE_REG rROMB0
    Definition: hardware.h:35
    -
    __REG DMA_REG
    Definition: hardware.h:297
    -
    __REG OCPD_REG
    Definition: hardware.h:374
    -
    __REG NR31_REG
    Definition: hardware.h:117
    +
    __REG DMA_REG
    Definition: hardware.h:313
    +
    __REG OCPD_REG
    Definition: hardware.h:390
    +
    __REG NR31_REG
    Definition: hardware.h:133
    __BYTES _VRAM[]
    Definition: hardware.h:18
    -
    __REG LY_REG
    Definition: hardware.h:293
    -
    __REG NR22_REG
    Definition: hardware.h:108
    -
    __REG BGP_REG
    Definition: hardware.h:299
    +
    __REG LY_REG
    Definition: hardware.h:309
    +
    __BYTE_REG rMBC7_LATCH_1
    Definition: hardware.h:43
    +
    __REG NR22_REG
    Definition: hardware.h:124
    +
    __REG BGP_REG
    Definition: hardware.h:315
    __BYTES _VRAM8800[]
    Definition: hardware.h:20
    -
    __REG DIV_REG
    Definition: hardware.h:72
    +
    __REG DIV_REG
    Definition: hardware.h:88
    __BYTES _SCRN1[]
    Definition: hardware.h:23
    diff --git a/docs/api/gb_2metasprites_8h.html b/docs/api/gb_2metasprites_8h.html index b682f38b..b192042c 100644 --- a/docs/api/gb_2metasprites_8h.html +++ b/docs/api/gb_2metasprites_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -157,13 +157,13 @@ Variables

    Detailed Description

    -

    +

    Metasprite support

    A metasprite is a larger sprite made up from a collection of smaller individual hardware sprites. Different frames of the same metasprites can share tile data.

    The api supports metasprites in both SPRITES_8x8 and SPRITES_8x16 mode. If 8x16 mode is used then the height of the metasprite must be a multiple of 16.

    The origin (pivot) for the metasprite is not required to be in the upper left-hand corner as with regular hardware sprites.

    Use the utility_png2asset tool to convert single or multiple frames of graphics into metasprite structured data for use with the ...metasprite...() functions.

    -

    +

    Metasprites composed of variable numbers of sprites

    When using png2asset, it's common for the output of different frames to be composed of different numbers of hardware sprites (since it's trying to create each frame as efficiently as possible). Due to that, it's good practice to clear out (hide) unused sprites in the shadow_OAM that have been set by previous frames.

    // Example:
    @@ -172,9 +172,9 @@ Metasprites composed of variable numbers of sprites
    // (where hiwater == last hardware sprite used + 1)
    void hide_sprites_range(uint8_t from, uint8_t to)
    -
    #define MAX_HARDWARE_SPRITES
    Definition: gb.h:1842
    +
    #define MAX_HARDWARE_SPRITES
    Definition: gb.h:1854

    -

    +

    Metasprites and sprite properties (including cgb palette)

    When the move_metasprite_*() functions are called they update all properties for the affected sprites in the Shadow OAM. This means any existing property flags set for a sprite (CGB palette, BG/WIN priority, Tile VRAM Bank) will get overwritten.

    How to use sprite property flags with metasprites:

    -

    Timer Interrupt when the timer TIMA_REG overflows.

    See also
    set_interrupts(),
    +

    Timer Interrupt when the timer TIMA_REG overflows.

    See also
    set_interrupts(),
    add_TIM
    @@ -1092,7 +1096,7 @@ Variables

    The resulting format is four greyscale colors packed into a single unsigned byte.

    Example:

    -
    __REG BGP_REG
    Definition: hardware.h:299
    +
    __REG BGP_REG
    Definition: hardware.h:315
    #define DMG_WHITE
    Definition: gb.h:139
    #define DMG_DARK_GRAY
    Definition: gb.h:137
    #define DMG_LITE_GRAY
    Definition: gb.h:138
    @@ -1282,6 +1286,20 @@ Variables

    Macro returns TRUE if device supports color

    +
    +
    + +

    ◆ VBL_DONE

    + +
    +
    + + + + +
    #define VBL_DONE   _vbl_done
    +
    +
    @@ -2455,8 +2473,9 @@ Variables

    Adds a timer interrupt handler.

    Can not be used together with add_low_priority_TIM

    -

    This interrupt occurs when the TIMA_REG register ($FF05) changes from $FF to $00.

    +

    This interrupt occurs when the TIMA_REG register ($FF05) changes from $FF to $00.

    Up to 4 handlers may be added, with the last added being called last.

    +
    Note
    For NES make sure to wrap TIM interrupt handlers with a nooverlay pragma. For more details see docs_nes_tim_overlay
    See also
    add_VBL
    set_interrupts() with TIM_IFLAG, ISR_VECTOR()
    @@ -2480,7 +2499,7 @@ Variables

    Adds a timer interrupt handler, that could be interrupted by the other interrupts, as well as itself, if it runs too slow.

    Can not be used together with add_TIM

    -

    This interrupt occurs when the TIMA_REG register ($FF05) changes from $FF to $00.

    +

    This interrupt occurs when the TIMA_REG register ($FF05) changes from $FF to $00.

    Up to 4 handlers may be added, with the last added being called last.

    See also
    add_VBL
    @@ -2970,6 +2989,9 @@ Variables
    + + + + + +
    @@ -2979,6 +3001,11 @@ Variables
    void reset
    +
    +inline

    Performs a soft reset.

    For the Game Boy and related it does this by jumping to address 0x0150 which is in crt0.s (the c-runtime that executes before main() is called).

    @@ -3316,7 +3343,7 @@ Variables

    Example:

    // Use DMG_BLACK as the Foreground color and DMG_LITE_GRAY
    // as the Background color when loading 1bpp tile data.
    -
    void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
    Definition: gb.h:1026
    +
    void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
    Definition: gb.h:1038
    See also
    DMG_BLACK, DMG_DARK_GRAY, DMG_LITE_GRAY, DMG_WHITE
    set_bkg_1bpp_data, set_win_1bpp_data, set_sprite_1bpp_data
    @@ -5320,9 +5347,9 @@ Variables
    // These flags tell the sprite to flip both vertically and horizontally.
    #define S_FLIPY
    Definition: gb.h:96
    -
    void set_sprite_prop(uint8_t nb, uint8_t prop)
    Definition: gb.h:1933
    +
    void set_sprite_prop(uint8_t nb, uint8_t prop)
    Definition: gb.h:1945
    #define S_FLIPX
    Definition: gb.h:92
    -
    #define set_sprite_palette(first_palette, nb_palettes, rgb_data)
    Definition: msx.h:550
    +
    #define set_sprite_palette(first_palette, nb_palettes, rgb_data)
    Definition: msx.h:558
    See also
    S_PALETTE, S_FLIPX, S_FLIPY, S_PRIORITY
    @@ -6363,6 +6390,22 @@ Variables

    Increments once per Frame

    Will wrap around every ~18 minutes (unsigned 16 bits = 65535 / 60 / 60 = 18.2)

    +
    + + +

    ◆ _vbl_done

    + +
    +
    + + + + +
    __REG _vbl_done
    +
    +

    Flag indicating the VBlank ISR has run

    +

    Flag gets cleared at the start of vsync() / wait_vbl_done() and set in the default VBlank ISR handler.

    +
    diff --git a/docs/api/gb_8h.js b/docs/api/gb_8h.js index dac23849..a1591217 100644 --- a/docs/api/gb_8h.js +++ b/docs/api/gb_8h.js @@ -48,6 +48,7 @@ var gb_8h = [ "GBA_NOT_DETECTED", "gb_8h.html#aa311f84dd9fce6e136ba4881e7b0d98d", null ], [ "GBA_DETECTED", "gb_8h.html#a6ccf5d0f34fb0af0b6e73b9df0ccd745", null ], [ "DEVICE_SUPPORTS_COLOR", "gb_8h.html#a231ec05679809190782e61c6e8aaaba4", null ], + [ "VBL_DONE", "gb_8h.html#a559dbd32dba6867c1ee4e481077b62ab", null ], [ "IO_IDLE", "gb_8h.html#a268cc6c704e16f3fa02dd1cf0e17070a", null ], [ "IO_SENDING", "gb_8h.html#ab69a3f7cd2c6b5eb4f518aefee099007", null ], [ "IO_RECEIVING", "gb_8h.html#aee03efddee0f2f6fbcaec789301aaa9b", null ], @@ -203,6 +204,7 @@ var gb_8h = [ "_cpu", "gb_8h.html#a874b9bd95b0a05d6a6072feabc879e45", null ], [ "_is_GBA", "gb_8h.html#a539b7b45b1c2d6b2051553665c76fd36", null ], [ "sys_time", "gb_8h.html#a78d2fd18666afec116f176d46debb4e7", null ], + [ "_vbl_done", "gb_8h.html#afcd1b4a4ad7bab85d0adec8c69d5bec0", null ], [ "_io_status", "gb_8h.html#a2e3415ce2f7fb63427618bd9b9cb6635", null ], [ "_io_in", "gb_8h.html#a02f3a1585ae654444e628c1aa98ef0cf", null ], [ "_io_out", "gb_8h.html#acae13736da20f9fc53e8d38934aa2119", null ], diff --git a/docs/api/gb_8h_source.html b/docs/api/gb_8h_source.html index 33d26599..3f489ce1 100644 --- a/docs/api/gb_8h_source.html +++ b/docs/api/gb_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -189,519 +189,521 @@ $(document).ready(function(){initNavTree('gb_8h_source.html',''); initResizable(
    247 
    286 void add_LCD(int_handler h);
    287 
    -
    301 void add_TIM(int_handler h);
    -
    302 
    -
    318 void add_low_priority_TIM(int_handler h);
    -
    319 
    -
    335 void add_SIO(int_handler h);
    -
    336 
    -
    337 
    -
    361 void add_JOY(int_handler h);
    -
    362 
    -
    363 
    -
    379 void nowait_int_handler(void);
    -
    380 
    -
    381 
    -
    394 void wait_int_handler(void);
    -
    395 
    -
    398 inline uint8_t cancel_pending_interrupts(void) {
    -
    399  return IF_REG = 0;
    -
    400 }
    -
    401 
    -
    408 void mode(uint8_t m);
    -
    409 
    -
    414 uint8_t get_mode(void) PRESERVES_REGS(b, c, d, e, h, l);
    -
    415 
    -
    421 inline uint8_t get_system(void) {
    -
    422  return SYSTEM_60HZ;
    -
    423 }
    -
    424 
    -
    429 extern uint8_t _cpu;
    -
    430 
    -
    433 #define DMG_TYPE 0x01
    -
    436 #define MGB_TYPE 0xFF
    -
    439 #define CGB_TYPE 0x11
    -
    440 
    -
    445 extern uint8_t _is_GBA;
    -
    446 
    -
    449 #define GBA_NOT_DETECTED 0x00
    -
    452 #define GBA_DETECTED 0x01
    -
    453 
    -
    456 #define DEVICE_SUPPORTS_COLOR (_cpu == CGB_TYPE)
    -
    457 
    -
    464 extern volatile uint16_t sys_time;
    -
    465 
    -
    466 
    -
    467 
    -
    475 void send_byte(void);
    -
    476 
    -
    484 void receive_byte(void);
    -
    485 
    -
    487 extern volatile uint8_t _io_status;
    +
    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 
    -
    491 extern volatile uint8_t _io_in;
    -
    492 
    -
    495 extern volatile uint8_t _io_out;
    -
    496 
    -
    497 /* Status codes */
    -
    499 #define IO_IDLE 0x00U
    -
    501 #define IO_SENDING 0x01U
    -
    503 #define IO_RECEIVING 0x02U
    -
    505 #define IO_ERROR 0x04U
    -
    506 
    -
    507 
    +
    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 
    -
    522 __REG _current_bank;
    -
    523 #define CURRENT_BANK _current_bank
    -
    524 
    -
    534 #ifndef BANK
    -
    535 #define BANK(VARNAME) ( (uint8_t) & __bank_ ## VARNAME )
    -
    536 #endif
    -
    537 
    -
    550 #define BANKREF(VARNAME) void __func_ ## VARNAME(void) __banked __naked { \
    -
    551 __asm \
    -
    552  .local b___func_ ## VARNAME \
    -
    553  ___bank_ ## VARNAME = b___func_ ## VARNAME \
    -
    554  .globl ___bank_ ## VARNAME \
    -
    555 __endasm; \
    -
    556 }
    -
    557 
    -
    567 #define BANKREF_EXTERN(VARNAME) extern const void __bank_ ## VARNAME;
    -
    568 
    -
    584 #define SWITCH_ROM(b) (_current_bank = (b), rROMB0 = (b))
    -
    585 
    -
    586 #if defined(__TARGET_duck)
    -
    587 
    -
    588 #define SWITCH_RAM(b) (0)
    -
    589 
    -
    590 #define ENABLE_RAM
    -
    591 
    -
    592 #define DISABLE_RAM
    -
    593 
    -
    594 #else
    -
    595 
    -
    603 #define SWITCH_RAM(b) (rRAMB = (b))
    -
    604 
    -
    607 #define ENABLE_RAM (rRAMG = 0x0A)
    -
    608 
    -
    611 #define DISABLE_RAM (rRAMG = 0x00)
    -
    612 
    -
    613 #endif
    -
    614 
    -
    618 #define SWITCH_ROM_MEGADUCK(b) SWITCH_ROM(b)
    -
    619 
    -
    628 #define SWITCH_ROM_MBC1(b) SWITCH_ROM(b)
    -
    629 
    -
    637 #define SWITCH_RAM_MBC1(b) SWITCH_RAM(b)
    -
    638 
    -
    641 #define ENABLE_RAM_MBC1 ENABLE_RAM
    -
    642 
    -
    645 #define DISABLE_RAM_MBC1 DISABLE_RAM
    -
    646 
    -
    647 #define SWITCH_16_8_MODE_MBC1 (*(volatile uint8_t *)0x6000 = 0x00)
    -
    648 
    -
    649 #define SWITCH_4_32_MODE_MBC1 (*(volatile uint8_t *)0x6000 = 0x01)
    +
    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 
    -
    663 #define SWITCH_ROM_MBC5(b) (_current_bank = (b), rROMB1 = 0, rROMB0 = (b))
    -
    664 
    -
    678 #define SWITCH_ROM_MBC5_8M(b) (rROMB1 = ((uint16_t)(b) >> 8), rROMB0 = (b))
    -
    679 
    -
    685 #define SWITCH_RAM_MBC5(b) SWITCH_RAM(b)
    -
    686 
    -
    689 #define ENABLE_RAM_MBC5 ENABLE_RAM
    -
    690 
    -
    693 #define DISABLE_RAM_MBC5 DISABLE_RAM
    -
    694 
    -
    695 
    -
    696 
    -
    701 void delay(uint16_t d) PRESERVES_REGS(h, l);
    +
    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 
    -
    703 
    -
    704 
    -
    715 uint8_t joypad(void) PRESERVES_REGS(b, c, h, l);
    +
    705 #define DISABLE_RAM_MBC5 DISABLE_RAM
    +
    706 
    +
    707 
    +
    708 
    +
    713 void delay(uint16_t d) PRESERVES_REGS(h, l);
    +
    714 
    +
    715 
    716 
    -
    729 uint8_t waitpad(uint8_t mask) PRESERVES_REGS(b, c, h, l);
    -
    730 
    -
    736 void waitpadup(void) PRESERVES_REGS(a, b, c, d, e, h, l);
    -
    737 
    -
    743 typedef struct {
    -
    744  uint8_t npads;
    -
    745  union {
    -
    746  struct {
    -
    747  uint8_t joy0, joy1, joy2, joy3;
    -
    748  };
    -
    749  uint8_t joypads[4];
    -
    750  };
    -
    751 } joypads_t;
    -
    752 
    -
    762 uint8_t joypad_init(uint8_t npads, joypads_t * joypads) OLDCALL;
    -
    763 
    -
    770 void joypad_ex(joypads_t * joypads) PRESERVES_REGS(b, c);
    -
    771 
    -
    772 
    -
    773 
    -
    782 inline void enable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l) {
    -
    783  __asm__("ei");
    -
    784 }
    +
    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 
    -
    798 inline void disable_interrupts(void) PRESERVES_REGS(a, b, c, d, e, h, l) {
    -
    799  __asm__("di");
    -
    800 }
    -
    801 
    -
    812 void set_interrupts(uint8_t flags) PRESERVES_REGS(b, c, d, e, h, l);
    +
    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 
    -
    825 void reset(void);
    -
    826 
    -
    838 void vsync(void) PRESERVES_REGS(b, c, d, e, h, l);
    -
    839 
    -
    843 void wait_vbl_done(void) PRESERVES_REGS(b, c, d, e, h, l);
    -
    844 
    -
    850 void display_off(void) PRESERVES_REGS(b, c, d, e, h, l);
    +
    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 
    -
    854 void refresh_OAM(void) PRESERVES_REGS(b, c, d, e, h, l);
    -
    855 
    +
    855 void wait_vbl_done(void) PRESERVES_REGS(b, c, d, e, h, l);
    856 
    -
    862 void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL PRESERVES_REGS(b, c);
    +
    862 void display_off(void) PRESERVES_REGS(b, c, d, e, h, l);
    863 
    -
    864 
    -
    868 #define DISPLAY_ON \
    -
    869  LCDC_REG|=LCDCF_ON
    -
    870 
    -
    876 #define DISPLAY_OFF \
    -
    877  display_off();
    -
    878 
    -
    881 #define HIDE_LEFT_COLUMN
    +
    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 
    -
    885 #define SHOW_LEFT_COLUMN
    -
    886 
    -
    889 #define SET_BORDER_COLOR(C)
    +
    888 #define DISPLAY_OFF \
    +
    889  display_off();
    890 
    -
    900 #define SHOW_BKG \
    -
    901  LCDC_REG|=LCDCF_BGON
    +
    893 #define HIDE_LEFT_COLUMN
    +
    894 
    +
    897 #define SHOW_LEFT_COLUMN
    +
    898 
    +
    901 #define SET_BORDER_COLOR(C)
    902 
    -
    912 #define HIDE_BKG \
    -
    913  LCDC_REG&=~LCDCF_BGON
    +
    912 #define SHOW_BKG \
    +
    913  LCDC_REG|=LCDCF_BGON
    914 
    -
    924 #define SHOW_WIN \
    -
    925  LCDC_REG|=LCDCF_WINON
    +
    924 #define HIDE_BKG \
    +
    925  LCDC_REG&=~LCDCF_BGON
    926 
    -
    930 #define HIDE_WIN \
    -
    931  LCDC_REG&=~LCDCF_WINON
    -
    932 
    -
    936 #define SHOW_SPRITES \
    -
    937  LCDC_REG|=LCDCF_OBJON
    +
    936 #define SHOW_WIN \
    +
    937  LCDC_REG|=LCDCF_WINON
    938 
    -
    944 #define HIDE_SPRITES \
    -
    945  LCDC_REG&=~LCDCF_OBJON
    -
    946 
    -
    950 #define SPRITES_8x16 \
    -
    951  LCDC_REG|=LCDCF_OBJ16
    -
    952 
    -
    956 #define SPRITES_8x8 \
    -
    957  LCDC_REG&=~LCDCF_OBJ16
    +
    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 
    -
    959 
    -
    960 
    -
    967 void set_vram_byte(uint8_t * addr, uint8_t v) PRESERVES_REGS(b, c);
    -
    968 
    -
    980 uint8_t get_vram_byte(uint8_t * addr) PRESERVES_REGS(b, c, h, l);
    -
    981 
    -
    982 
    -
    986 uint8_t * get_bkg_xy_addr(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
    -
    987 
    -
    988 #define COMPAT_PALETTE(C0,C1,C2,C3) ((uint8_t)(((C3) << 6) | ((C2) << 4) | ((C1) << 2) | (C0)))
    -
    989 
    -
    992 inline void set_2bpp_palette(uint16_t palette) {
    -
    993  palette;
    -
    994 }
    -
    995 
    -
    996 extern uint16_t _current_1bpp_colors;
    -
    997 
    -
    1005 void set_1bpp_colors_ex(uint8_t fgcolor, uint8_t bgcolor, uint8_t mode) OLDCALL;
    -
    1006 
    -
    1026 inline void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor) {
    -
    1027  set_1bpp_colors_ex(fgcolor, bgcolor, 0);
    -
    1028 }
    -
    1029 
    -
    1047 void set_bkg_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1048 #define set_bkg_2bpp_data set_bkg_data
    -
    1049 
    -
    1068 void set_bkg_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1069 
    -
    1090 void get_bkg_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1091 
    -
    1092 
    -
    1145 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);
    -
    1146 #define set_tile_map set_bkg_tiles
    -
    1147 
    -
    1148 
    -
    1149 extern uint8_t _map_tile_offset;
    -
    1150 
    -
    1169 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) {
    -
    1170  _map_tile_offset = base_tile;
    -
    1171  set_bkg_tiles(x, y, w, h, tiles);
    -
    1172  _map_tile_offset = 0;
    -
    1173 }
    -
    1174 
    -
    1175 
    -
    1224 inline void set_bkg_attributes(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *tiles)
    -
    1225 {
    -
    1226  VBK_REG = VBK_ATTRIBUTES;
    -
    1227  set_bkg_tiles(x, y, w, h, tiles);
    -
    1228  VBK_REG = VBK_TILES;
    -
    1229 }
    -
    1230 
    -
    1231 
    -
    1277 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;
    -
    1278 #define set_tile_submap set_bkg_submap
    -
    1279 
    -
    1280 
    -
    1281 extern uint8_t _submap_tile_offset;
    -
    1282 
    -
    1302 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) {
    -
    1303  _submap_tile_offset = base_tile;
    -
    1304  set_bkg_submap(x, y, w, h, map, map_w);
    -
    1305  _submap_tile_offset = 0;
    -
    1306 }
    -
    1307 
    -
    1308 
    -
    1356 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)
    -
    1357 {
    -
    1358  VBK_REG = VBK_ATTRIBUTES;
    -
    1359  set_bkg_submap(x, y, w, h, map, map_w);
    -
    1360  VBK_REG = VBK_TILES;
    -
    1361 }
    -
    1362 
    -
    1363 
    -
    1387 void get_bkg_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
    -
    1388 
    -
    1389 
    -
    1397 uint8_t * set_bkg_tile_xy(uint8_t x, uint8_t y, uint8_t t);
    -
    1398 #define set_tile_xy set_bkg_tile_xy
    -
    1399 
    -
    1408 inline uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
    -
    1409 {
    -
    1410  uint8_t* addr;
    -
    1411  VBK_REG = VBK_ATTRIBUTES;
    -
    1412  addr = set_bkg_tile_xy(x, y, a);
    -
    1413  VBK_REG = VBK_TILES;
    -
    1414  return addr;
    -
    1415 }
    -
    1416 #define set_attribute_xy set_bkg_attribute_xy
    -
    1417 
    -
    1432 uint8_t get_bkg_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
    -
    1433 
    -
    1434 
    -
    1448 inline void move_bkg(uint8_t x, uint8_t y) {
    -
    1449  SCX_REG=x, SCY_REG=y;
    -
    1450 }
    -
    1451 
    -
    1452 
    -
    1462 inline void scroll_bkg(int8_t x, int8_t y) {
    -
    1463  SCX_REG+=x, SCY_REG+=y;
    -
    1464 }
    -
    1465 
    -
    1466 
    -
    1467 
    -
    1471 uint8_t * get_win_xy_addr(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
    -
    1472 
    -
    1486 void set_win_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1487 
    -
    1488 
    -
    1507 void set_win_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1508 
    -
    1509 
    -
    1527 void get_win_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1528 
    -
    1529 
    -
    1561 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);
    -
    1562 
    -
    1563 
    -
    1582 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) {
    -
    1583  _map_tile_offset = base_tile;
    -
    1584  set_win_tiles(x, y, w, h, tiles);
    -
    1585  _map_tile_offset = 0;
    -
    1586 }
    -
    1587 
    -
    1635 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;
    -
    1636 
    -
    1637 
    -
    1657 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) {
    -
    1658  _submap_tile_offset = base_tile;
    -
    1659  set_win_submap(x, y, w, h, map, map_w);
    -
    1660  _submap_tile_offset = 0;
    -
    1661 }
    -
    1662 
    -
    1663 
    -
    1687 void get_win_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *tiles) OLDCALL PRESERVES_REGS(b, c);
    -
    1688 
    -
    1689 
    -
    1697 uint8_t * set_win_tile_xy(uint8_t x, uint8_t y, uint8_t t);
    -
    1698 
    -
    1699 
    -
    1712 uint8_t get_win_tile_xy(uint8_t x, uint8_t y) OLDCALL PRESERVES_REGS(b, c);
    -
    1713 
    -
    1714 
    -
    1726 inline void move_win(uint8_t x, uint8_t y) {
    -
    1727  WX_REG=x, WY_REG=y;
    -
    1728 }
    -
    1729 
    -
    1730 
    -
    1740 inline void scroll_win(int8_t x, int8_t y) {
    -
    1741  WX_REG+=x, WY_REG+=y;
    -
    1742 }
    -
    1743 
    -
    1744 
    -
    1745 
    -
    1761 void set_sprite_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1762 #define set_sprite_2bpp_data set_sprite_data
    -
    1763 
    -
    1782 void set_sprite_1bpp_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1783 
    -
    1802 void get_sprite_data(uint8_t first_tile, uint8_t nb_tiles, uint8_t *data) OLDCALL PRESERVES_REGS(b, c);
    -
    1803 
    -
    1804 
    -
    1811 typedef struct OAM_item_t {
    -
    1812  uint8_t y, x; //< X, Y Coordinates of the sprite on screen
    -
    1813  uint8_t tile; //< Sprite tile number
    -
    1814  uint8_t prop; //< OAM Property Flags
    -
    1815 } OAM_item_t;
    +
    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 
    -
    1817 
    -
    1820 extern volatile struct OAM_item_t shadow_OAM[];
    -
    1821 
    -
    1824 __REG _shadow_OAM_base;
    -
    1825 
    -
    1826 #define DISABLE_OAM_DMA \
    -
    1827  _shadow_OAM_base = 0
    +
    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 
    -
    1831 #define DISABLE_VBL_TRANSFER DISABLE_OAM_DMA
    -
    1832 
    -
    1833 #define ENABLE_OAM_DMA \
    -
    1834  _shadow_OAM_base = (uint8_t)((uint16_t)&shadow_OAM >> 8)
    -
    1835 
    -
    1838 #define ENABLE_VBL_TRANSFER ENABLE_OAM_DMA
    -
    1839 
    -
    1842 #define MAX_HARDWARE_SPRITES 40
    -
    1843 
    -
    1846 #define HARDWARE_SPRITE_CAN_FLIP_X 1
    +
    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 HARDWARE_SPRITE_CAN_FLIP_Y 1
    +
    1850 #define ENABLE_VBL_TRANSFER ENABLE_OAM_DMA
    1851 
    -
    1854 inline void SET_SHADOW_OAM_ADDRESS(void * address) {
    -
    1855  _shadow_OAM_base = (uint8_t)((uint16_t)address >> 8);
    -
    1856 }
    -
    1857 
    -
    1874 inline void set_sprite_tile(uint8_t nb, uint8_t tile) {
    -
    1875  shadow_OAM[nb].tile=tile;
    -
    1876 }
    -
    1877 
    -
    1878 
    -
    1885 inline uint8_t get_sprite_tile(uint8_t nb) {
    -
    1886  return shadow_OAM[nb].tile;
    -
    1887 }
    -
    1888 
    +
    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 
    -
    1933 inline void set_sprite_prop(uint8_t nb, uint8_t prop) {
    -
    1934  shadow_OAM[nb].prop=prop;
    -
    1935 }
    -
    1936 
    -
    1937 
    -
    1943 inline uint8_t get_sprite_prop(uint8_t nb) {
    -
    1944  return shadow_OAM[nb].prop;
    -
    1945 }
    -
    1946 
    -
    1947 
    -
    1960 inline void move_sprite(uint8_t nb, uint8_t x, uint8_t y) {
    -
    1961  OAM_item_t * itm = &shadow_OAM[nb];
    -
    1962  itm->y=y, itm->x=x;
    -
    1963 }
    -
    1964 
    -
    1965 
    -
    1976 inline void scroll_sprite(uint8_t nb, int8_t x, int8_t y) {
    -
    1977  OAM_item_t * itm = &shadow_OAM[nb];
    -
    1978  itm->y+=y, itm->x+=x;
    -
    1979 }
    -
    1980 
    -
    1981 
    -
    1988 inline void hide_sprite(uint8_t nb) {
    -
    1989  shadow_OAM[nb].y = 0;
    -
    1990 }
    -
    1991 
    +
    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 
    -
    2009 void set_data(uint8_t *vram_addr, const uint8_t *data, uint16_t len);
    -
    2010 
    -
    2011 
    -
    2033 void get_data(uint8_t *data, uint8_t *vram_addr, uint16_t len);
    -
    2034 
    -
    2047 void vmemcpy(uint8_t *dest, uint8_t *sour, uint16_t len);
    -
    2048 
    -
    2049 
    -
    2050 
    -
    2074 void set_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, const uint8_t *tiles) OLDCALL;
    -
    2075 
    -
    2086 void set_tile_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data, uint8_t base) OLDCALL PRESERVES_REGS(b, c);
    +
    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 
    -
    2115 void get_tiles(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t *vram_addr, uint8_t *tiles) OLDCALL;
    -
    2116 
    -
    2117 
    -
    2132 inline void set_native_tile_data(uint16_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
    -
    2133  if (first_tile < 256) {
    -
    2134  set_bkg_data(first_tile, nb_tiles, data);
    -
    2135  } else {
    -
    2136  set_sprite_data(first_tile - 256, nb_tiles, data);
    -
    2137  }
    -
    2138 }
    -
    2139 
    -
    2155 inline void set_bkg_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
    -
    2156  set_bkg_data(first_tile, nb_tiles, data);
    -
    2157 }
    -
    2158 
    -
    2172 inline void set_sprite_native_data(uint8_t first_tile, uint8_t nb_tiles, const uint8_t *data) {
    -
    2173  set_sprite_data(first_tile, nb_tiles, data);
    -
    2174 }
    -
    2175 
    -
    2181 void init_win(uint8_t c) OLDCALL PRESERVES_REGS(b, c);
    -
    2182 
    -
    2188 void init_bkg(uint8_t c) OLDCALL PRESERVES_REGS(b, c);
    -
    2189 
    -
    2197 void vmemset (void *s, uint8_t c, size_t n) OLDCALL PRESERVES_REGS(b, c);
    -
    2198 
    -
    2199 
    -
    2200 
    -
    2209 void fill_bkg_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b, c);
    -
    2210 #define fill_rect fill_bkg_rect
    +
    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 
    -
    2220 void fill_win_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t tile) OLDCALL PRESERVES_REGS(b, c);
    -
    2221 
    -
    2222 #endif /* _GB_H */
    +
    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:305
    -
    SCY_REG
    __REG SCY_REG
    Definition: hardware.h:289
    -
    WX_REG
    __REG WX_REG
    Definition: hardware.h:307
    -
    VBK_ATTRIBUTES
    #define VBK_ATTRIBUTES
    Definition: hardware.h:322
    -
    IF_REG
    __REG IF_REG
    Definition: hardware.h:88
    -
    VBK_REG
    __REG VBK_REG
    Definition: hardware.h:316
    -
    VBK_TILES
    #define VBK_TILES
    Definition: hardware.h:320
    -
    SCX_REG
    __REG SCX_REG
    Definition: hardware.h:291
    +
    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:1874
    -
    d
    uint8_t d
    Definition: gb.h:414
    -
    c
    uint8_t c
    Definition: gb.h:414
    -
    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:1224
    +
    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:1740
    +
    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:1657
    -
    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:1356
    +
    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:1462
    +
    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)
    @@ -710,12 +712,12 @@ $(document).ready(function(){initNavTree('gb_8h_source.html',''); initResizable(
    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)
    -
    set_bkg_attribute_xy
    uint8_t * set_bkg_attribute_xy(uint8_t x, uint8_t y, uint8_t a)
    Definition: gb.h:1408
    -
    get_system
    uint8_t get_system(void)
    Definition: gb.h:421
    +
    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:736
    +
    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
    @@ -726,23 +728,23 @@ $(document).ready(function(){initNavTree('gb_8h_source.html',''); initResizable(
    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:1448
    +
    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:2132
    -
    get_sprite_prop
    uint8_t get_sprite_prop(uint8_t nb)
    Definition: gb.h:1943
    -
    scroll_sprite
    void scroll_sprite(uint8_t nb, int8_t x, int8_t y)
    Definition: gb.h:1976
    +
    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:1582
    +
    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:1824
    -
    SET_SHADOW_OAM_ADDRESS
    void SET_SHADOW_OAM_ADDRESS(void *address)
    Definition: gb.h:1854
    +
    _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:1169
    +
    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
    @@ -752,41 +754,41 @@ $(document).ready(function(){initNavTree('gb_8h_source.html',''); initResizable(
    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:522
    +
    _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:1933
    +
    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:992
    +
    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:2172
    +
    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:1960
    +
    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:414
    +
    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:1302
    +
    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:2155
    +
    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:1988
    +
    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:619
    -
    set_1bpp_colors
    void set_1bpp_colors(uint8_t fgcolor, uint8_t bgcolor)
    Definition: gb.h:1026
    +
    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:398
    +
    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)
    @@ -794,27 +796,28 @@ $(document).ready(function(){initNavTree('gb_8h_source.html',''); initResizable(
    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:414
    -
    move_win
    void move_win(uint8_t x, uint8_t y)
    Definition: gb.h:1726
    +
    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:1885
    +
    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:414
    -
    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:622
    +
    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:1811
    -
    OAM_item_t::x
    uint8_t x
    Definition: gb.h:1812
    -
    OAM_item_t::prop
    uint8_t prop
    Definition: gb.h:1814
    -
    OAM_item_t::tile
    uint8_t tile
    Definition: gb.h:1813
    -
    OAM_item_t::y
    uint8_t y
    Definition: gb.h:1812
    -
    joypads_t
    Definition: gb.h:743
    -
    joypads_t::joy0
    uint8_t joy0
    Definition: gb.h:747
    -
    joypads_t::npads
    uint8_t npads
    Definition: gb.h:744
    +
    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
    diff --git a/docs/api/gbdk-lib_8h.html b/docs/api/gbdk-lib_8h.html index 5901954a..0faa8a0b 100644 --- a/docs/api/gbdk-lib_8h.html +++ b/docs/api/gbdk-lib_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk-lib_8h_source.html b/docs/api/gbdk-lib_8h_source.html index eddac93d..e646b474 100644 --- a/docs/api/gbdk-lib_8h_source.html +++ b/docs/api/gbdk-lib_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk_2bcd_8h.html b/docs/api/gbdk_2bcd_8h.html index 3ad85c67..9bfbe853 100644 --- a/docs/api/gbdk_2bcd_8h.html +++ b/docs/api/gbdk_2bcd_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk_2bcd_8h_source.html b/docs/api/gbdk_2bcd_8h_source.html index 84f2d8d2..84d243b9 100644 --- a/docs/api/gbdk_2bcd_8h_source.html +++ b/docs/api/gbdk_2bcd_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk_2emu__debug_8h.html b/docs/api/gbdk_2emu__debug_8h.html index 744f04a2..a9d69c74 100644 --- a/docs/api/gbdk_2emu__debug_8h.html +++ b/docs/api/gbdk_2emu__debug_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -444,14 +444,23 @@ Variables
  • %hx (char as hex)
  • %hu (unsigned char)
  • %hd (signed char)
  • -
  • %c (character)
  • +
  • %c (character)
    +
  • %u (unsigned int)
  • %d (signed int)
  • %x (unsigned int as hex)
  • %s (string)
  • -

    Warning: to correctly pass chars for printing as chars, they must be explicitly re-cast as such when calling the function. See docs_chars_varargs for more details.

    -

    Currently supported in the Emulicious emulator

    +
    Note
    Variables for the following 8-bit formats MUST be cast to their type when passed to EMU_printf() +However variables for the following 8-bit format MUST NOT be cast to their type when passed to EMU_printf() +This behavior is different than for sprintf(), which does require %c format char variables to be explicitly cast.
    +

    Currently supported in the Emulicious emulator, may be supported by bgb

    diff --git a/docs/api/gbdk_2emu__debug_8h_source.html b/docs/api/gbdk_2emu__debug_8h_source.html index 4e84cb2c..13570d9c 100644 --- a/docs/api/gbdk_2emu__debug_8h_source.html +++ b/docs/api/gbdk_2emu__debug_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -153,29 +153,29 @@ $(document).ready(function(){initNavTree('gbdk_2emu__debug_8h_source.html','');
    140 #define BGB_profiler_message EMU_profiler_message()
    141 #endif // NINTENDO
    142 
    -
    164 void EMU_printf(const char *format, ...) PRESERVES_REGS(a, b, c);
    -
    165 #define BGB_printf(...) EMU_printf(__VA_ARGS__)
    -
    166 
    -
    176 void EMU_fmtbuf(const unsigned char * format, void * data) PRESERVES_REGS(a, b, c);
    -
    177 
    -
    178 #ifdef NINTENDO
    -
    179 static void * __EMU_PROFILER_INIT = &EMU_profiler_message;
    -
    180 #endif // NINTENDO
    -
    181 
    -
    184 #define EMU_BREAKPOINT __asm__("ld b, b");
    -
    185 #define BGB_BREAKPOINT EMU_BREAKPOINT
    +
    173 void EMU_printf(const char *format, ...) PRESERVES_REGS(a, b, c);
    +
    174 #define BGB_printf(...) EMU_printf(__VA_ARGS__)
    +
    175 
    +
    185 void EMU_fmtbuf(const unsigned char * format, void * data) PRESERVES_REGS(a, b, c);
    186 
    -
    187 #elif defined(__TARGET_duck)
    -
    188  #error Not implemented yet
    -
    189 #else
    -
    190  #error Unrecognized port
    -
    191 #endif
    -
    192 
    -
    193 #endif
    +
    187 #ifdef NINTENDO
    +
    188 static void * __EMU_PROFILER_INIT = &EMU_profiler_message;
    +
    189 #endif // NINTENDO
    +
    190 
    +
    193 #define EMU_BREAKPOINT __asm__("ld b, b");
    +
    194 #define BGB_BREAKPOINT EMU_BREAKPOINT
    +
    195 
    +
    196 #elif defined(__TARGET_duck)
    +
    197  #error Not implemented yet
    +
    198 #else
    +
    199  #error Unrecognized port
    +
    200 #endif
    +
    201 
    +
    202 #endif
    PRESERVES_REGS
    #define PRESERVES_REGS(...)
    Definition: types.h:32
    -
    c
    void c
    Definition: emu_debug.h:164
    +
    c
    void c
    Definition: emu_debug.h:173
    EMU_fmtbuf
    void EMU_fmtbuf(const unsigned char *format, void *data) PRESERVES_REGS(a
    -
    b
    void b
    Definition: emu_debug.h:164
    +
    b
    void b
    Definition: emu_debug.h:173
    EMU_printf
    void EMU_printf(const char *format,...) PRESERVES_REGS(a
    EMU_profiler_message
    void EMU_profiler_message(void)
    diff --git a/docs/api/gbdk_2gbdecompress_8h.html b/docs/api/gbdk_2gbdecompress_8h.html index eda1326a..05b54886 100644 --- a/docs/api/gbdk_2gbdecompress_8h.html +++ b/docs/api/gbdk_2gbdecompress_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk_2gbdecompress_8h_source.html b/docs/api/gbdk_2gbdecompress_8h_source.html index d7b348bb..a0f0a28d 100644 --- a/docs/api/gbdk_2gbdecompress_8h_source.html +++ b/docs/api/gbdk_2gbdecompress_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk_2metasprites_8h.html b/docs/api/gbdk_2metasprites_8h.html index b48ae805..8424f820 100644 --- a/docs/api/gbdk_2metasprites_8h.html +++ b/docs/api/gbdk_2metasprites_8h.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/gbdk_2metasprites_8h_source.html b/docs/api/gbdk_2metasprites_8h_source.html index 89a41ab1..8ae7afe0 100644 --- a/docs/api/gbdk_2metasprites_8h_source.html +++ b/docs/api/gbdk_2metasprites_8h_source.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/globals.html b/docs/api/globals.html index 580127ba..90ea81ed 100644 --- a/docs/api/globals.html +++ b/docs/api/globals.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -138,14 +138,14 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); }) : rand.h
  • __READ_VDP_REG -: msx.h -, sms.h +: sms.h +, msx.h
  • __REG : hardware.h
  • __render_shadow_OAM -: metasprites.h +: metasprites.h
  • __setjmp() : setjmp.h @@ -161,12 +161,12 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); }) : stddef.h
  • __WRITE_VDP_REG -: sms.h -, msx.h +: msx.h +, sms.h
  • __WRITE_VDP_REG_UNSAFE -: msx.h -, sms.h +: sms.h +, msx.h
  • _AUD3WAVERAM : hardware.h @@ -188,10 +188,10 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); }) , sms.h
  • _current_bank -: msx.h -, nes.h +: sms.h , gb.h -, sms.h +, msx.h +, nes.h
  • _HRAM : hardware.h @@ -211,12 +211,18 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); })
  • _is_GBA : gb.h
  • +
  • _lcd_scanline +: hardware.h +
  • _map_tile_offset : gb.h , msx.h , nes.h , sms.h
  • +
  • _MEGADUCK_LAPTOP_IO_H +: laptop_io.h +
  • _OAMRAM : hardware.h
  • @@ -249,10 +255,10 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); }) : hardware.h
  • _submap_tile_offset -: gb.h +: nes.h , sms.h -, nes.h , msx.h +, gb.h
  • _switch_prg0() : nes.h @@ -263,6 +269,11 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); }) , nes.h , sms.h
  • +
  • _vbl_done +: gb.h +, msx.h +, sms.h +
  • _VRAM : hardware.h
  • diff --git a/docs/api/globals_a.html b/docs/api/globals_a.html index 463e9e8c..cf462f24 100644 --- a/docs/api/globals_a.html +++ b/docs/api/globals_a.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -114,19 +114,20 @@ $(document).ready(function(){initNavTree('globals_a.html',''); initResizable();
  • add_TIM() : gb.h , msx.h +, nes.h , sms.h
  • add_VBL() -: nes.h +: msx.h , sms.h -, msx.h +, nes.h , gb.h
  • AND : drawing.h
  • arand() -: rand.h +: rand.h
  • assert : assert.h diff --git a/docs/api/globals_b.html b/docs/api/globals_b.html index 2881214a..64b48e44 100644 --- a/docs/api/globals_b.html +++ b/docs/api/globals_b.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    diff --git a/docs/api/globals_c.html b/docs/api/globals_c.html index 87f620fc..c9327388 100644 --- a/docs/api/globals_c.html +++ b/docs/api/globals_c.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -91,20 +91,21 @@ $(document).ready(function(){initNavTree('globals_c.html',''); initResizable();

    - c -

    diff --git a/docs/api/globals_defs_e.html b/docs/api/globals_defs_e.html index da65441c..8e4c5971 100644 --- a/docs/api/globals_defs_e.html +++ b/docs/api/globals_defs_e.html @@ -29,7 +29,7 @@
    GBDK 2020 Docs -  4.3.0 +  4.4.0
    API Documentation for GBDK 2020
    @@ -91,6 +91,7 @@ $(document).ready(function(){initNavTree('globals_defs_e.html',''); initResizabl

    - e -