Picture of a GameBoy

Jeff Frohwein's GameBoy Libs Page

Library Guidelines
Fade Out v1.0

Here's code to fade the GBC background & sprite palettes to white or black.

addsub1.inc v1.2 Macro Library

Here's a macro library for RGBDS that supports 16 bit adds / subtracts. Something the GB doesn't have built-in.

Random Numbers

Here's two different methods for doing random numbers on the GB: calculate-as-you-go & table lookup.

Hex Font Set

Here's a font for GB that has every hex number from $00 to $ff each in it's own tile. Each digit is 3x7 pixels to fit two digits per tile. The font itself is in binary format. To convert it to DB or C structure format locate various convertors on the internet.

Set GBC Speed

Here's code for setting the CPU speed on the GBC.

Screen On/Off

Here's code for turning the GB LCD screen on & off.

Setpals

Here's code for setting the GBC palettes.

U161616A code v1.0

Here's unsigned 16 / 16 = 16 bit result, 16 bit remainder division code.

Compression Test Results - Data Test Files

Here are the results I have gotten from testing various compression packages for GB.

RNC v2.14

RNC method 1 now implemented. RNC method 2 for GB is now 7% faster due to optimizations. This is a compression package by Rob Northen Computing. It is free for non-commercial uses. For info on licensing it email Rob at rob@FILTER.markettrader.co.uk. (Remove FILTER.) A compressor for DOS & Amiga is provided and decompression code for GB, SNES, MIPS R4300, 68000, Atari Lynx, and 80286 is provided. This package has been used in commercial game titles for years.

C64Pack v1.0 for GB

Here is a decompressor for GB for the C64Pack compression program. It doesn't quite compress as well as RNC method 2 and takes about 2 times longer for decompression. Use the compressor in this package because the C64Pack compressor on the PuCrunch web page will not compress raw data.

PuCrunch v1.3 for GB

Here is a decompressor for GB for the PuCrunch compression package. It seems to provide better compression than RNC method 2 (on average) but it is about 5 times slower during decompression. Use PUCRUNCH -d -c0 inputfile outputfile. Otherwise Commodore 64 decompression code will be included in the packed data and the GB doesn't need that! NOTE: USE THE WIN95 VERSION. THE DOS VERSION OF PUCRUNCH DOESN"T SUPPORT OPTION -c0 THAT LETS YOU LEAVE OUT THE C64 CODE.

Hardware defines v2.2

Fixed NR42,NR43, & NR44 defines.

Fast Log 8x8 Multiply v1.0

Not extremely accurate but extremely fast 8x8 bit multiply using log/antilog tables.

Hardware defines v2.0

Hardware defines for the GBC added.

Load1.inc v1.0 Macro Library

Here's a macro library for RGBDS that supports 16 bit loads. Something the GB doesn't have built-in.

Sample code v1.2

Here's code for playing raw audio samples on the GB/GBC. First use MM_X's Wave Converter or similar to put .WAV files in a format suitable for playing on the GB.

Memory code v1.1

Here are some memory manipulation routines.

Pan Demo v1.0

Here's demo code for demonstrating the PAN1 code. It shows a partially recreated version of Whomp's Fortress from Mario 64. Use the arrow buttons to pan the scene.

PAN1 code v1.7

Here's code for panning a large map around on the GameBoy screen.

Keypad code v1.2

Here's code for reading the GameBoy buttons.

Library Guidelines v1.3

These guidelines also have a permanent link position above. These are meant to be an organizational structure for me & these archives. Use whatever structure makes you comfortable.

IBMPC font macro v1.2

Here's a macro for adding part or the whole ($00-$ff) IBMPC character set to your code.

16-bit shift macros v1.2

Here are macros for shifting the 16-bit registers left & right. Improved by ideas from Carsten !

U161632A code v1.1

Here's an unsigned 16 x 16 multiply with a 32 bit result.

Sprite Trash defines v1.1

Some of the GameBoy instructions trash Sprite OAM ram. These defines are alternatives to these commands. These are not needed on the GBC, however.