Fix USCF Chess and Land Battle: enable $D000-$D3FF RAM 8#97
Merged
LibretroAdmin merged 2 commits intolibretro:masterfrom Feb 24, 2026
Merged
Fix USCF Chess and Land Battle: enable $D000-$D3FF RAM 8#97LibretroAdmin merged 2 commits intolibretro:masterfrom
LibretroAdmin merged 2 commits intolibretro:masterfrom
Conversation
USCF Chess (1981) and Land Battle (1982) both use load method 4, which requires 8-bit RAM at \-\. writeMem() was silently discarding all writes to this range, causing the game's CPU to be unable to store piece positions, BACKTAB data, or working variables. This produced completely garbled graphics (GROM character garbage instead of chess pieces/board tiles). Fix: - Add d000_ram flag to memory.h/memory.c - writeMem: allow 8-bit writes to \-\ when d000_ram is set - readMem: mask reads from \-\ to 8 bits when d000_ram is set - d000_ram is reset at start of MemoryInit() (on each cart load) - load4() in cart.c now sets d000_ram = 1 instead of the TODO comment Also fix C89 compliance in stic.c: replace // comments with /* */ Fixes: libretro#96
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
USCF Chess (#96) and Land Battle render completely garbled graphics. The board fills with corrupted tile data ("VS" repeating pattern) and the games are unplayable.
Root Cause
Both games use load method 4 in the cartridge database, which includes a comment noting that
$D000-$D3FFshould be RAM 8 — but the RAM was never actually enabled. InwriteMem(), the entire$D000-$D7FFrange was silently ignored (treated as ROM). Since USCF Chess and Land Battle use this RAM region to store piece positions, working variables, and BACKTAB setup data, all CPU writes were dropped, leaving the game unable to initialize the display correctly.Fix
d000_ramflag tomemory.h/memory.cload4()incart.cnow setsd000_ram = 1instead of the TODO commentwriteMem()allows 8-bit writes to$D000-$D3FFwhen the flag is setreadMem()masks reads from that range to 8 bits when the flag is setMemoryInit()resets the flag at the start of each cart loadTesting
Fixes #96 (USCF Chess).