git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit 206f7fd116c842bacdcded2c6352d0c1b981c28f
parent caf8e51f211b6c50a8d977e3a9413c4d694d4e0f
Author: bbbbbr <bbbbbr@users.noreply.github.com>
Date:   Mon, 21 Apr 2025 02:46:12 -0700

Merge pull request #761 from bbbbbr/docs_4_4_0

Docs: start of 4.4.0 release and migration notes, toolchain settings
Diffstat:
Mdocs/pages/02_links_and_tools.md4++++
Mdocs/pages/09_migrating_new_versions.md18+++++++++++++++---
Mdocs/pages/10_release_notes.md81++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mdocs/pages/20_toolchain_settings.md80++++++++++++++++++++++++++++++++++++++++++++-----------------------------------
Mgbdk-support/lcc/lcc.c4++--
5 files changed, 144 insertions(+), 43 deletions(-)

diff --git a/docs/pages/02_links_and_tools.md b/docs/pages/02_links_and_tools.md @@ -144,6 +144,10 @@ This is a brief list of useful tools and information. It is not meant to be comp __BGB__ Accurate emulator, has useful debugging tools. http://bgb.bircd.org/ + - @anchor superjuniorsameduck + __Super Junior SameDuck__ + The only MegaDuck emulator with support for the Mega Duck Laptop models (Quique and Junior Super Computer) + https://github.com/bbbbbr/SuperJuniorSameDuck @anchor code_editors_hinting Intellisense in VSCode may have trouble identifying some GBDK types or functions, and therefore flag them as warnings or unidentified. diff --git a/docs/pages/09_migrating_new_versions.md b/docs/pages/09_migrating_new_versions.md @@ -5,10 +5,22 @@ This section contains information that may be useful to know or important when u # 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 + - 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 @ref utility_makenes "makenes" utility for finalizing NES rom headers (called automatically by @ref 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 @ref 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 - - NES LCD bkg_scroll_y is now relative to the current scanline - - This change creates higher compatibility with GB's SCY_REG and makes it easier to re-use GB LCD handlers. - - This behaves differently to 4.3.0 and affects LCD handlers that change the y scrolling coordinate mid-frame. ## 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 diff --git a/docs/pages/10_release_notes.md b/docs/pages/10_release_notes.md @@ -7,7 +7,82 @@ https://github.com/gbdk-2020/gbdk-2020/releases # GBDK-2020 Release Notes ## GBDK-2020 4.3.0 - ~2024/05 + 2025/... + - Includes SDCC version ~4.5.0 (15267) with GBDK-2020 patches for Z80 and NES + - [Patched SDCC Builds](https://github.com/gbdk-2020/gbdk-2020-sdcc/releases) with support for Sega GG/SMS and the Nintendo NES are used. + - See the [github workflow](https://github.com/gbdk-2020/gbdk-2020-sdcc/tree/main/.github/workflows) for details. + - Building GBDK + - Added native GBDK build for ARM 64 Linux + - Changed from building on MacOS 11 to MacOS 13 (may reduce compatibility with older OS versions) + - SDCC + - Changed to using the `-N` flag with sdas since the the `-n` flag was removed + - Library + - Added export of `_vbl_done` (@ref VBL_DONE), a flag indicating the VBlank ISR has run + - Game Boy + - Added MBC7 related register and flag definitions + - @ref rMBC7_SRAM_ENABLE_1, @ref rMBC7_SRAM_ENABLE_2, @ref rMBC7_LATCH_1, @ref rMBC7_LATCH_2, @ref rMBC7_ACCEL_X_LO, @ref rMBC7_ACCEL_X_HI, @ref rMBC7_ACCEL_Y_LO, @ref rMBC7_ACCEL_Y_HI + - @ref MBC7_LATCH_ERASE, @ref MBC7_LATCH_CAPTURE, @ref MBC7_SRAM_ENABLE_KEY_1, @ref MBC7_SRAM_ENABLE_KEY_2 + - Fixed possible halt bug when using @ref hblank_copy_vram() + - NES + - Added delay() and reset() functions for compatibility + - Added Timer interrupt emulation: @ref add_TIM() , @ref remove_TIM() + - Improved LCD ISR support for less graphics glitches + - Improved palette function code size (smaller) + - Changed LCD bkg_scroll_y to be relative to the current scanline for higher compatibility with Game Boy SCY_REG and LCD handlers + - NES: Align coordinates and scanline counting in LCD ISR implementation with GB, add SCX / SCY / LYC defines + - Fixed bug with @ref set_bkg_1bpp_data() not working in buffered mode + - Fixed bug with multiple column attribute updates + - Fixed bugs with non-multiple-of-2 (/4) map width in @ref set_bkg_submap_attributes() + - SMS/GG + - Added Timer interrupt emulation: @ref add_TIM() , @ref remove_TIM() + - Improved metasprite Y clipping + - Changed from unsigned (`uint16_t`) to signed int16 (`int16_t`) for coordinates with the family of `...metasprite...()` functions + - MegaDuck + - Added header files: @ref duck/laptop_io.h, @ref duck/model.h, @ref duck/laptop_keycodes.h + - Toolchain / Utilities + - Added @ref utility_makenes "makenes" utility for finalizing NES rom headers (called automatically by @ref lcc) + - @ref 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` + - @ref utility_png2asset "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 + - @ref bankpack + - Added support for MBC7 + - @ref utility_romusage "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 + - @ref utility_png2hicolorgb "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 + - @ref 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/06 - Includes SDCC version ~4.4.0 (14650) with GBDK-2020 patches for Z80 and NES - [Patched SDCC Builds](https://github.com/gbdk-2020/gbdk-2020-sdcc/releases) with support for Sega GG/SMS and the Nintendo NES are used. - See the [github workflow](https://github.com/gbdk-2020/gbdk-2020-sdcc/tree/main/.github/workflows) for details. @@ -32,7 +107,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Fixed VRAM transfer buffer bug (ensure stack page cleared on reset) - Fixed support for 4-player controllers using fourscore - Fixed @ref set_sprite_palette() to index from `0..3` instead of `4..7` - - Fixed @ref __move_metasprite to initialize Y index register to zero + - Fixed @ref move_metasprite to initialize Y index register to zero - Fixed @ref waitpadup to wait for button release instead of press - Updated libc to latest from sdcc 4.4.0 - SMS/GG @@ -53,7 +128,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - `GG_SIO_CTL`: @ref SIOCTL_TXFL, @ref SIOCTL_RXRD, @ref SIOCTL_FRER, @ref SIOCTL_INT, @ref SIOCTL_TON, @ref SIOCTL_RON, @ref SIOCTL_BS0, @ref SIOCTL_BS1 - `GG_SOUND_PAN`: @ref SOUNDPAN_TN1R, @ref SOUNDPAN_TN2R, @ref SOUNDPAN_TN3R, @ref SOUNDPAN_NOSR, @ref SOUNDPAN_TN1L, @ref SOUNDPAN_TN2L, @ref SOUNDPAN_TN3L, @ref SOUNDPAN_NOSL - Optimized native tile data loading routines - - Improved @ref VDP_WRITE_DATA macro so it does not need `di`/`ei` protection + - Improved @ref 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 @ref scroll_sprite() diff --git a/docs/pages/20_toolchain_settings.md b/docs/pages/20_toolchain_settings.md @@ -5,46 +5,33 @@ ./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 ``` @anchor sdcc-settings # 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 :- @@ -79,7 +66,7 @@ General options: --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 @@ -228,7 +215,7 @@ Assembly: 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 @@ -273,7 +260,7 @@ Assembly: 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 @@ -318,7 +305,7 @@ Assembly: 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 @@ -543,6 +530,18 @@ Arguments: makecom image.rom image.noi output.com Use: convert a binary .rom file to .msxdos com format. ``` +@anchor makenes-settings +# 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) +``` @anchor gbcompress-settings # gbcompress settings ``` @@ -578,11 +577,12 @@ usage: png2asset <file>.png [options] -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 @@ -613,28 +613,35 @@ decoder error empty input buffer given to decoder. Maybe caused by non-existing ``` 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 @@ -651,11 +658,11 @@ Historical credits and info: # 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) @@ -666,6 +673,7 @@ Options -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 @@ -679,10 +687,11 @@ Options -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" @@ -691,6 +700,7 @@ Example 3: "romusage build/MyProject.ihx -g" 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/gbdk-support/lcc/lcc.c b/gbdk-support/lcc/lcc.c @@ -1038,8 +1038,8 @@ static void opt(char *arg) { // ----------------------------------------- case 'A': // -A warn about nonANSI usage; 2nd -A warns more case 'b': // -b emit expression-level profiling code; see bprint(1) - case 'g': // -Bdir/ use the compiler named `dir/rcc' - case 'G': // -g produce symbol table information for debuggers + case 'g': // -g produce symbol table information for debuggers + case 'G': // -G append("-g3", clist); append("-N", llist[L_ARGS]); case 'n': // -n emit code to check for dereferencing zero pointers case 'O': // -O is ignored case 'P': // -P print ANSI-style declarations for globals

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.