git.y1.nz

gbdk-2020

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

commit f9be57c39f543e1294091eb639cc4e02f5763e2c
parent 0b45cdea99a2c15bfa3f9b00c34f80032d254b3b
Author: bbbbbr <bbbbbr@users.noreply.github.com>
Date:   Sun,  3 Mar 2024 04:14:12 -0800

Merge pull request #628 from bbbbbr/docs/4_2_next

Docs: set_palette() for SMS/GG, clarify display_off behavior for GB and NES
Diffstat:
Mdocs/pages/10_release_notes.md161++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
Mgbdk-lib/include/gb/gb.h6++++--
Mgbdk-lib/include/nes/nes.h4+---
Mgbdk-lib/include/sms/sms.h26++++++++++++++++++++++++++
4 files changed, 157 insertions(+), 40 deletions(-)

diff --git a/docs/pages/10_release_notes.md b/docs/pages/10_release_notes.md @@ -37,7 +37,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Increased sgb_transfer() maximum packet length to 7 x 16 bytes - Convert gb_decompress routines to the new calling convention - Convert rle_decompress routines to the new calling convention - - Removed legacy MBC register definitions `.MBC1_ROM_PAGE` and `.MBC_ROM_PAGE` + - Removed legacy MBC register definitions `.MBC1_ROM_PAGE` and `.MBC_ROM_PAGE` - Workaround for possible HALT bug in Crash Handler - Refactored interrupts to use less space - Toolchain / Utilities @@ -143,7 +143,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - @ref ihxcheck - Check and warn for bank overflows under specific conditions - A multiple write to the same address must occur. The address where the overlap ends is used as BANK. - - There must also be a write which spans multiple banks, the ending address of that must match BANK. The starting addresses is the OVERFLOW-FROM BANK. + - There must also be a write which spans multiple banks, the ending address of that must match BANK. The starting addresses is the OVERFLOW-FROM BANK. - Examples - Changed Logo example to use new GBDK logo art from user "Digit" - Added example for APA image mode with more than 256 tiles @@ -151,7 +151,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Changed to new WAV sound example - Docs - Added improved @ref mbc_type_chart "MBC Type chart" - - Include SDCC manual in pdf format + - Include SDCC manual in pdf format - Various doc updates and improvements ## GBDK-2020 4.0.6 @@ -238,7 +238,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Added simple physics sub-pixel / fixed point math example - Added rle decompression example - Changed windows make.bat files to compile.bat - - Bug fixes and updates for existing examples + - Bug fixes and updates for existing examples - Toolchain / Utilities - @ref utility_png2asset "png2asset" - @ref utility_png2asset "png2asset" is the new name for the `png2mtspr` utility @@ -265,7 +265,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Docs - Added @ref docs_supported_consoles section - Various doc updates and improvements - + ## GBDK-2020 4.0.4 2021/06 @@ -330,7 +330,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Docs - Added extensive documentation (some of which is imported and updated from the old gbdk docs) - Added PDF version of docs - + ## GBDK-2020 4.0.2 2021/01/17 @@ -434,21 +434,21 @@ https://github.com/gbdk-2020/gbdk-2020/releases ## GBDK-2020 3.0 2020/04/12 - - Initial GBDK-2020 release + - 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 + 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 + 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. + 17 April, 2000 + Many changes. - Code generated is now much more reliable and passes all of sdcc's regression suite. - Added support for large sets of local variables (>127 bytes). @@ -456,21 +456,21 @@ https://github.com/gbdk-2020/gbdk-2020/releases - Still no floating pt support. ## GBDK 2.95-3 - 19th August, 2000 + 19th August, 2000 * Stopped lcc with sdcc from leaking .cdb files all across /tmp. * Optimised < and > for 16 bit varibles. * Added a new lexer to sdcc. Compiling files with large initalised arrays takes 31% of the time (well, at least - samptest.c does :) + samptest.c does :) 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 + 5th August, 2000 Just a small update. From the README: * Added model switching support @@ -487,7 +487,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases like tile data should compile a bit faster. ## GBDK 2.95 - 22nd July, 2000 + 22nd July, 2000 * Fixed 'a << c' for c = [9..15] * no$gmb doesn't support labels of > 32 chars. The linker now trims all labels to 31 chars long. @@ -501,21 +501,21 @@ https://github.com/gbdk-2020/gbdk-2020/releases and rgbasm. See examples/gb/far/* * bc is now only pushed if the function uses it. i.e. something like: - int silly(int i) + int silly(int i) { return i; - } + } will not have the push bc; pop bc around it. * Better rgbasm support. Basically: o Use "sdcc -mgbz80 --asm=rgbds file.c" for each file.c o Use "sdcc -mgbz80 --asm=rgbds crt0.o gbz80.lib gb.lib file1.o file2.o..." - + to link everything together. The .lib files are generated using astorgb.pl and sdcc to turn the gbdk libraries into something rgbds compatible. The libraries are _not_ fully tested. Trust nothing. But give it a go :) - * Ran a spell checker across the README and ChangeLog + * Ran a spell checker across the README and ChangeLog This is a recommended upgrade. Some of the big features are: @@ -524,17 +524,17 @@ https://github.com/gbdk-2020/gbdk-2020/releases 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 + 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 + 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 :) - * Fixed + * Fixed \#define BLAH 7 // Unterminated ' error in sdcpp * Fixed @@ -559,7 +559,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases * Two dimensional arrays seem to be broken. ## GBDK 2.93 - 6th April, 2000 + 6th April, 2000 From the README * Added multi-bank support into the compiler - The old -Wf-boxx @@ -580,7 +580,7 @@ https://github.com/gbdk-2020/gbdk-2020/releases cached. See dscan.c/bombs() for an example. ## GBDK 2.92-2 for win32 - 26th March, 2000 + 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: - Now auto detects where it is installed. @@ -602,14 +602,14 @@ https://github.com/gbdk-2020/gbdk-2020/releases See the ChangeLog section in the README for more information. - 21st March, 2000 + 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 + 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 + 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 :) * Fixed problem with registers being cached instead of being @@ -619,10 +619,10 @@ https://github.com/gbdk-2020/gbdk-2020/releases * Arrays initialised with constant addresses a'la galaxy.c now work. * Fixed minor bug with 104$: labels in as. - * Up to 167d/s... + * Up to 167d/s... ## GBDK 2.91 - 27th Feb, 2000 + 27th Feb, 2000 Better than 2.90 and includes Linux, win32 and a source tar ball. Some notes: Read the README first @@ -631,24 +631,115 @@ https://github.com/gbdk-2020/gbdk-2020/releases 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. - 23rd Feb, 2000 + 23rd Feb, 2000 First release of gbdk/sdcc. This is an early release - the only binary is for Linux and the source is only available through cvs. If your interested in the source, have a look at the cvs repository gbdk-support first, which will download all the rest of the code. Alternatively, look at gbdk-support and gbdk-lib at cvs.gbdk.sourceforge.net and sdcc at cvs.sdcc.sourceforge.net. I will be working on binaries for Win32 and a source tar ball soon. Please report any bugs through the bugs link above. - 31st Jan, 2000 + 31st Jan, 2000 Added Dermot's far pointer spec. It's mainly here for comment. If sdcc is ported to the Gameboy then I will be looking for some way to do far calls. - 8th Jan, 2000 + 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 + 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 + 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 + 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. +* Added communication routines that enable to send data through the link port of the GameBoy. Unfortunately, these routines do not always work; so use them with care until the next GBDK release. +* Added the comm.c example which illustrates how to use communication routines. +* 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). +* Changed the name of the hardware registers to match the "official" names. +* Added support for copying complete functions to RAM or HIRAM (memcpy() and hiramcpy() functions). The compiler now automatically generates two symbol for the start and the end of each function, named start_X and end_X (where X is the name of the function). This enables to calculate the length of a function when copying it to RAM. +* Added the ram_fn.c example which illustrates how to copy functions to RAM and HIRAM. +* Added support for installing IRQ handlers. +* Added the irq.c example which illustrates how to install IRQ handlers. +* 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). +* Fixed a bug that could generate wrong code in switch statements. +* Fixed a bug in int comparison. +* Added a DTMF program written by Osamu Ohashi. +* 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. +* The size of basic types has been changed: + * An int is 8 bits. + * A long is 16 bits. +* This change was required for the code generator to produce better code, because the Z80 is actually an 8-bit processor. +* 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. +* A compiled DOS version is now available (cross-compiled on my Sun Workstation!). +* The libraries and the example programs have been improved. +* The make script has been improved. Compiling on UNIX should be easier. +* Many bugfixes. + +## GBDK 1.0-1 1996 + diff --git a/gbdk-lib/include/gb/gb.h b/gbdk-lib/include/gb/gb.h @@ -827,7 +827,7 @@ void wait_vbl_done(void) PRESERVES_REGS(b, c, d, e, h, l); /** Turns the display off. - Waits until the VBL interrupt before turning the display off. + Waits until the VBL before turning the display off. @see DISPLAY_ON */ void display_off(void) PRESERVES_REGS(b, c, d, e, h, l); @@ -851,7 +851,9 @@ void hiramcpy(uint8_t dst, const void *src, uint8_t n) OLDCALL PRESERVES_REGS(b, #define DISPLAY_ON \ LCDC_REG|=LCDCF_ON -/** Turns the display off immediately. +/** Turns the display off + + Waits until the VBL before turning the display off. @see display_off, DISPLAY_ON */ #define DISPLAY_OFF \ diff --git a/gbdk-lib/include/nes/nes.h b/gbdk-lib/include/nes/nes.h @@ -467,9 +467,7 @@ void wait_vbl_done(void) NO_OVERLAY_LOCALS; */ void display_on(void) NO_OVERLAY_LOCALS; -/** Turns the display off. - - Waits until the VBL interrupt before turning the display off. +/** Turns the display off immediately. @see DISPLAY_ON */ void display_off(void) NO_OVERLAY_LOCALS; diff --git a/gbdk-lib/include/sms/sms.h b/gbdk-lib/include/sms/sms.h @@ -531,6 +531,32 @@ inline void cpu_fast(void) {} void set_palette_entry(uint8_t palette, uint8_t entry, uint16_t rgb_data) Z88DK_CALLEE PRESERVES_REGS(iyh, iyl); #define set_bkg_palette_entry set_palette_entry #define set_sprite_palette_entry(palette,entry,rgb_data) set_palette_entry(1,entry,rgb_data) + + +/** Set color palette(s) + + @param first_palette Index of the first 16 color palette to write (0-1) + @param nb_palettes Number of palettes to write (1-2, max depends on first_palette) + @param rgb_data Pointer to source palette data + + Writes __nb_palettes__ to palette data starting + at __first_palette__, Palette data is sourced from __rgb_data__. + + \li Palette 0 can be used for the Background. + \li Palette 1 is shared between Background and Sprites. + + On the Game Gear + \li Each Palette is 32 bytes in size: 16 colors x 2 bytes per palette color entry. + \li Each color (16 per palette) is packed as BGR-444 format (x:4:4:4, MSBits [15..12] are unused). + \li Each component (R, G, B) may have values from 0 - 15 (4 bits), 15 is brightest. + + On the SMS + \li On SMS each Palette is 16 bytes in size: 16 colors x 1 byte per palette color entry. + \li Each color (16 per palette) is packed as BGR-222 format (x:2:2:2, MSBits [7..6] are unused). + \li Each component (R, G, B) may have values from 0 - 3 (2 bits), 3 is brightest. + + @see RGB(), set_sprite_palette(), set_bkg_palette(), set_palette_entry(), set_sprite_palette_entry(), set_bkg_palette_entry(), set_sprite_palette() +*/ void set_palette(uint8_t first_palette, uint8_t nb_palettes, const palette_color_t *rgb_data) Z88DK_CALLEE; #define set_bkg_palette set_palette #define set_sprite_palette(first_palette,nb_palettes,rgb_data) set_palette(1,1,rgb_data)

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