Skip to content

Commit 5a68a88

Browse files
trekawekclaude
andcommitted
Power-on OBP0/OBP1 read 0xff; missing cart RAM reads float to 0xff
Judge_'s gbtests INITREGS samples FF40-FF4F at boot: the object palettes are uninitialized on hardware and read back 0xff (neither boot ROM writes them), and reads from the cartridge RAM window with no RAM present float to 0xff rather than 0. With both fixed the suite passes INITREGS, all TIM*, IRQTIM, LYCSTAT0-3, STATTIM and STATTIMS1-4; only STATTIMS5 remains (one STAT sample where our mode 3 ends a machine cycle earlier than hardware - the known mode-3 boundary tension documented in CLAUDE.md). Refs #64. Full battery green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1wLWscyUGS7CFwc3CjJR8
1 parent fb9f2cd commit 5a68a88

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

core/src/main/java/eu/rekawek/coffeegb/core/gpu/GpuRegisterValues.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public GpuRegisterValues() {
3737
values = new int[GpuRegister.values().length];
3838
java.util.Arrays.fill(mixValues, -1);
3939
java.util.Arrays.fill(pendingMixValues, -1);
40+
// the object palettes are uninitialized at power on and read 0xff; neither
41+
// boot ROM writes them (gbtests INITREGS)
42+
values[GpuRegister.OBP0.ordinal()] = 0xff;
43+
values[GpuRegister.OBP1.ordinal()] = 0xff;
4044
}
4145

4246
public int get(GpuRegister reg) {

core/src/main/java/eu/rekawek/coffeegb/core/memory/cart/type/BasicRom.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ public void setByte(int address, int value) {
2424
@Override
2525
public int getByte(int address) {
2626
if (address >= 0x0000 && address < 0x8000) {
27-
return rom[address];
27+
return address < rom.length ? rom[address] : 0xff;
2828
} else {
29-
return 0;
29+
// no cartridge RAM: reads float to 0xff (gbtests INITREGS)
30+
return 0xff;
3031
}
3132
}
3233

0 commit comments

Comments
 (0)