$ show pret/pokered
This repository is a complete, annotated disassembly of the original Game Boy PokΓ©mon Red and Blue games. It faithfully reproduces the exact ROM images (verified by SHA1 hashes) using the RGBDS assembler toolchain. The codebase is organized into modular subsystems: engine (battle, overworld, events, items, menus), data (maps, PokΓ©mon stats, moves, items, trainers, wild encounters), audio (music and SFX with a macro-based composition language), graphics (sprites, tilesets, fonts), and scripts (map-specific event scripts). It includes custom C tools for graphics optimization, compression, and Virtual Console patch generation. The architecture is a monolithic ROM image with bank switching, using a predef dispatch system for cross-bank calls. Key entry points include the game start routine in home/start.asm and the VBlank handler in home/vblank.asm. This is a high-quality reverse engineering project with extensive comments, consistent coding patterns, and a robust build system, making it an invaluable resource for ROM hacking, retro game development, and studying Game Boy internals.
The LLM identified 5 files worth highlighting for reuse:
Implements a differential bitstream decompression algorithm for Game Boy sprite data. Uses run-length encoding, XOR merging, and flip support. This is a self-contained, reusable routine for any retro game project needing compressed sprite data.
Provides generic assembly macros for defining data tables with automatic width tracking and length assertions. Includes table_width, assert_table_length, list_start, nybble_array, and bit_array. Can be extracted and used in any RGBDS project to enforce data structure integrity.
Implements a weighted move selection AI for turn-based battles. Includes per-trainer AI routines, item usage logic, and switching heuristics. The modular structure allows adaptation to other turn-based games with similar decision-making needs.
Handles save/load to SRAM with checksum verification, box management, and Hall of Fame rotation. Demonstrates a robust pattern for battery-backed save data in Game Boy games. Reusable for any GB/GBC project requiring persistent storage.
Implements a serial communication protocol for two-player battles and trades over Game Boy link cable. Includes synchronization, data exchange, and patch list handling for missing bytes. A reusable pattern for any multiplayer Game Boy game.