From 9c84b7990afaf3eb84ba88092ff3bb745376dbbf Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 6 Oct 2026 08:52:26 +0200 Subject: [PATCH] fix: give np2kai scsi.rom a read ceiling, not a size --- emulators/np2kai.yml | 10 ++++++---- tests/test_game_data_homonyms.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/emulators/np2kai.yml b/emulators/np2kai.yml index f996af92..dd261bd2 100644 --- a/emulators/np2kai.yml +++ b/emulators/np2kai.yml @@ -151,16 +151,18 @@ files: source_ref: "cbus/ideio.c:1928-1930, cbus/ideio.c:1944-1981" # -- SCSI BIOS ROM -- - # Loaded by scsiio.c:219. 16 KB (0x4000). Falls back to scsibios[] stub. + # Read into a 0x4000 buffer; any non-empty read is kept. Falls back to the + # scsibios[] stub. - name: "scsi.rom" path: "np2kai/scsi.rom" - size: 16384 + max_size: 16384 required: false hle_fallback: true note: > - SCSI controller BIOS ROM (16 KB). The core includes a built-in + SCSI controller BIOS ROM, up to 16 KB: the full-size test is commented + out and a shorter file is used as read. The core includes a built-in SCSI BIOS stub as fallback. - source_ref: "cbus/scsiio.c:214-231" + source_ref: "cbus/scsiio.c:720-732" # -- SASI BIOS ROM -- # Loaded by sasiio.c:455. 4 KB (0x1000). Falls back to sasibios[] stub. diff --git a/tests/test_game_data_homonyms.py b/tests/test_game_data_homonyms.py index 6f6113ac..a54a95fa 100644 --- a/tests/test_game_data_homonyms.py +++ b/tests/test_game_data_homonyms.py @@ -314,5 +314,20 @@ class SwitchKeysAreTheNewestSet(unittest.TestCase): self.assertEqual(newest(REPO_ROOT / path), best) +class Pc98ScsiBiosIsNotTheAppleCard(unittest.TestCase): + """np2kai declared an exact 16 KB its loader never requires; the Apple II + SCSI card ROM of that size won the name tie over the PC-98 BIOS.""" + + def test_np2kai_resolves_the_pc98_rom(self): + db_path = REPO_ROOT / "database.json" + if not db_path.exists(): + self.skipTest("no database.json") + db = load_database(str(db_path)) + profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["np2kai"] + entry = next(e for e in profile["files"] if e["name"] == "scsi.rom") + path, _status = resolve_local_file(entry, db, dest_hint=entry["path"]) + self.assertIn("PC-98", path or "") + + if __name__ == "__main__": unittest.main()