Skip to content

Fix USCF Chess and Land Battle: enable $D000-$D3FF RAM 8#97

Merged
LibretroAdmin merged 2 commits intolibretro:masterfrom
jcarr71:fix-d000-ram-uscf-chess
Feb 24, 2026
Merged

Fix USCF Chess and Land Battle: enable $D000-$D3FF RAM 8#97
LibretroAdmin merged 2 commits intolibretro:masterfrom
jcarr71:fix-d000-ram-uscf-chess

Conversation

@jcarr71
Copy link
Contributor

@jcarr71 jcarr71 commented Feb 20, 2026

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-$D3FF should be RAM 8 — but the RAM was never actually enabled. In writeMem(), the entire $D000-$D7FF range 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

  • Added a d000_ram flag to memory.h / memory.c
  • load4() in cart.c now sets d000_ram = 1 instead of the TODO comment
  • writeMem() allows 8-bit writes to $D000-$D3FF when the flag is set
  • readMem() masks reads from that range to 8 bits when the flag is set
  • MemoryInit() resets the flag at the start of each cart load

Testing

  • USCF Chess: Board now renders correctly with all chess pieces visible and correctly positioned. Game is fully playable.
  • Astrosmash: Confirmed unaffected (does not use load method 4).

Fixes #96 (USCF Chess).

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
@LibretroAdmin LibretroAdmin merged commit 0e0e585 into libretro:master Feb 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A couple more games with issues

2 participants