From 90044bba6253a228a8cd1c09a288d7c82e9517a3 Mon Sep 17 00:00:00 2001 From: rainwarrior Date: Mon, 5 Sep 2016 21:03:11 +0000 Subject: [PATCH] cheapocabra: revised mirroring in Software ID mode --- trunk/src/boards/cheapocabra.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/trunk/src/boards/cheapocabra.cpp b/trunk/src/boards/cheapocabra.cpp index ffd61743..c018fd0a 100644 --- a/trunk/src/boards/cheapocabra.cpp +++ b/trunk/src/boards/cheapocabra.cpp @@ -86,9 +86,17 @@ static DECLFW(M111Write) { static DECLFR(M111FlashID) { - uint32 a0 = A & 1; - if (a0 == 0) return 0xBF; - else return 0xB7; + // Software ID mode is undefined by the datasheet for all but the lowest 2 addressable bytes, + // but some tests of the chip currently being used found it repeats in 512-byte patterns. + // http://forums.nesdev.com/viewtopic.php?p=178728#p178728 + + uint32 aid = A & 0x1FF; + switch (aid) + { + case 0: return 0xBF; + case 1: return 0xB7; + default: return 0xFF; + } } void M111FlashIDEnter()