From 5c55cc2c94ae9f38d8313261d79c23a437ccb059 Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Wed, 21 Feb 2018 20:53:49 +1100 Subject: [PATCH] Update to v106r08 release. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit byuu says: Changelog: - Game Boy: fixed RAM/RTC saving¹ - Super Famicom: ICD2 renamed to ICD (there exists an SGB prototype with a functionally identical ICD1) - Sufami Turbo: removed short-circuiting when loading an unlinkable cartridge into slot A² - Super Game Boy: the 20971520hz clock of the SGB2 is now emulated - Super Famicom: BSC-1Lxx (SA1) boards now prompt for BS memory cartridges; and can make use of them³ - Super Famicom: fixed a potential for out-of-bounds reads with BS Memory flash carts ¹: I'm using a gross hack of replacing `type: ` with `type:` so that `memory(type=...)` will match without the extra spaces. I need to think about whether I want the BPath query syntax to strip whitespace or not. But longer term, I want to finalize game/memory's design, and build a higan/emulation/manifest parser that produces a nicer interface to reading manifests for all cores, which will make this irrelevant for higan anyway. ²: I don't think it's appropriate for higan to enforce this. Nothing stops you from inserting games that can't be linked into a real Sufami Turbo. I do short-circuit if you cancel the first load, but I may allow loading an empty slot A with a populated slot B. I think the BIOS does something when you do that. Probably just yells at you. ³: I know it's emulated correctly now, but I still don't know what the heck changes when you load the SD Gundam G Next - Unit & Map Collection BS Memory cartridge with SD Gundam G Next to actually test it. --- higan/emulator/emulator.hpp | 2 +- higan/gb/cartridge/cartridge.cpp | 15 +-- higan/sfc/GNUmakefile | 4 +- higan/sfc/cartridge/cartridge.cpp | 14 +-- higan/sfc/cartridge/cartridge.hpp | 6 +- higan/sfc/cartridge/load.cpp | 37 +++--- higan/sfc/cartridge/save.cpp | 4 +- higan/sfc/coprocessor/coprocessor.hpp | 2 +- .../{icd2/icd2.cpp => icd/icd.cpp} | 21 ++-- .../{icd2/icd2.hpp => icd/icd.hpp} | 12 +- .../coprocessor/{icd2 => icd}/interface.cpp | 6 +- higan/sfc/coprocessor/{icd2 => icd}/io.cpp | 4 +- .../coprocessor/{icd2 => icd}/platform.cpp | 4 +- .../{icd2 => icd}/serialization.cpp | 2 +- higan/sfc/coprocessor/sa1/memory.cpp | 1 + higan/sfc/interface/interface.cpp | 2 +- higan/sfc/slot/bsmemory/bsmemory.cpp | 2 +- higan/sfc/system/serialization.cpp | 2 +- higan/sfc/system/system.cpp | 8 +- higan/systems/Super Famicom.sys/boards.bml | 117 +++++++++++++++--- 20 files changed, 179 insertions(+), 86 deletions(-) rename higan/sfc/coprocessor/{icd2/icd2.cpp => icd/icd.cpp} (81%) rename higan/sfc/coprocessor/{icd2/icd2.hpp => icd/icd.hpp} (89%) rename higan/sfc/coprocessor/{icd2 => icd}/interface.cpp (93%) rename higan/sfc/coprocessor/{icd2 => icd}/io.cpp (94%) rename higan/sfc/coprocessor/{icd2 => icd}/platform.cpp (85%) rename higan/sfc/coprocessor/{icd2 => icd}/serialization.cpp (93%) diff --git a/higan/emulator/emulator.hpp b/higan/emulator/emulator.hpp index feefb40f..5f4b5095 100644 --- a/higan/emulator/emulator.hpp +++ b/higan/emulator/emulator.hpp @@ -12,7 +12,7 @@ using namespace nall; namespace Emulator { static const string Name = "higan"; - static const string Version = "106.07"; + static const string Version = "106.08"; static const string Author = "byuu"; static const string License = "GPLv3"; static const string Website = "https://byuu.org/"; diff --git a/higan/gb/cartridge/cartridge.cpp b/higan/gb/cartridge/cartridge.cpp index 831e469d..2cfcc95d 100644 --- a/higan/gb/cartridge/cartridge.cpp +++ b/higan/gb/cartridge/cartridge.cpp @@ -48,7 +48,8 @@ auto Cartridge::load() -> bool { information.manifest = fp->reads(); } else return false; - auto document = BML::unserialize(information.manifest); + //todo: temporary hack so (type=) node lookup works; replace with a proper game/memory parser + auto document = BML::unserialize(string{information.manifest}.replace("type: ", "type:")); information.title = document["game/label"].text(); auto mapperID = document["game/board"].text(); @@ -68,7 +69,7 @@ auto Cartridge::load() -> bool { accelerometer = (bool)document["game/board/accelerometer"]; rumble = (bool)document["game/board/rumble"]; - if(auto node = document["game/memory[type=ROM]"]) { + if(auto node = document["game/memory(type=ROM)"]) { rom.size = max(0x4000, node["size"].natural()); rom.data = (uint8*)memory::allocate(rom.size, 0xff); if(auto name = node["name"].text()) { @@ -78,7 +79,7 @@ auto Cartridge::load() -> bool { } } - if(auto node = document["game/memory[type=NVRAM]"]) { + if(auto node = document["game/memory(type=NVRAM)"]) { ram.size = node["size"].natural(); ram.data = (uint8*)memory::allocate(ram.size, 0xff); if(auto name = node["name"].text()) { @@ -88,7 +89,7 @@ auto Cartridge::load() -> bool { } } - if(auto node = document["game/memory[type=RTC]"]) { + if(auto node = document["game/memory(type=RTC)"]) { rtc.size = node["size"].natural(); rtc.data = (uint8*)memory::allocate(rtc.size, 0xff); if(auto name = node["name"].text()) { @@ -103,9 +104,9 @@ auto Cartridge::load() -> bool { } auto Cartridge::save() -> void { - auto document = BML::unserialize(information.manifest); + auto document = BML::unserialize(string{information.manifest}.replace("type: ", "type:")); - if(auto node = document["game/memory[type=NVRAM]"]) { + if(auto node = document["game/memory(type=NVRAM)"]) { if(auto name = node["name"].text()) { if(auto fp = platform->open(pathID(), name, File::Write)) { fp->write(ram.data, ram.size); @@ -113,7 +114,7 @@ auto Cartridge::save() -> void { } } - if(auto node = document["game/memory[type=RTC]"]) { + if(auto node = document["game/memory(type=RTC)"]) { if(auto name = node["name"].text()) { if(auto fp = platform->open(pathID(), name, File::Write)) { fp->write(rtc.data, rtc.size); diff --git a/higan/sfc/GNUmakefile b/higan/sfc/GNUmakefile index 82c7ce42..2cb4a2fa 100644 --- a/higan/sfc/GNUmakefile +++ b/higan/sfc/GNUmakefile @@ -4,7 +4,7 @@ objects += sfc-interface sfc-system sfc-controller objects += sfc-cartridge sfc-memory objects += sfc-cpu sfc-smp sfc-dsp sfc-ppu objects += sfc-expansion sfc-satellaview sfc-21fx -objects += sfc-icd2 sfc-mcc sfc-nss sfc-event +objects += sfc-icd sfc-mcc sfc-nss sfc-event objects += sfc-sa1 sfc-superfx objects += sfc-armdsp sfc-hitachidsp sfc-necdsp objects += sfc-epsonrtc sfc-sharprtc @@ -27,7 +27,7 @@ obj/sfc-expansion.o: sfc/expansion/expansion.cpp $(call rwildcard,sfc/expansio obj/sfc-satellaview.o: sfc/expansion/satellaview/satellaview.cpp $(call rwildcard,sfc/expansion/satellaview/) obj/sfc-21fx.o: sfc/expansion/21fx/21fx.cpp $(call rwildcard,sfc/expansion/21fx/) -obj/sfc-icd2.o: sfc/coprocessor/icd2/icd2.cpp $(call rwildcard,sfc/coprocessor/icd2/) +obj/sfc-icd.o: sfc/coprocessor/icd/icd.cpp $(call rwildcard,sfc/coprocessor/icd/) obj/sfc-mcc.o: sfc/coprocessor/mcc/mcc.cpp $(call rwildcard,sfc/coprocessor/mcc/) obj/sfc-nss.o: sfc/coprocessor/nss/nss.cpp $(call rwildcard,sfc/coprocessor/nss/) obj/sfc-event.o: sfc/coprocessor/event/event.cpp $(call rwildcard,sfc/coprocessor/event/) diff --git a/higan/sfc/cartridge/cartridge.cpp b/higan/sfc/cartridge/cartridge.cpp index 89781b1c..10c9ed5c 100644 --- a/higan/sfc/cartridge/cartridge.cpp +++ b/higan/sfc/cartridge/cartridge.cpp @@ -41,7 +41,7 @@ auto Cartridge::load() -> bool { loadCartridge(document); //Game Boy - if(cartridge.has.ICD2) { + if(cartridge.has.ICD) { information.sha256 = ""; //Game Boy cartridge not loaded yet: set later via loadGameBoy() } @@ -89,7 +89,7 @@ auto Cartridge::load() -> bool { auto Cartridge::loadGameBoy() -> bool { #if defined(SFC_SUPERGAMEBOY) - //invoked from ICD2::load() + //invoked from ICD::load() information.sha256 = GameBoy::cartridge.sha256(); information.manifest.gameBoy = GameBoy::cartridge.manifest(); information.title.gameBoy = GameBoy::cartridge.title(); @@ -103,7 +103,7 @@ auto Cartridge::loadBSMemory() -> bool { if(auto fp = platform->open(bsmemory.pathID, "manifest.bml", File::Read, File::Required)) { information.manifest.bsMemory = fp->reads(); } else return false; - loadBSMemory(BML::unserialize(information.manifest.bsMemory)); + loadBSMemory(BML::unserialize(string{information.manifest.bsMemory}.replace("type: ", "type:"))); return true; } @@ -111,7 +111,7 @@ auto Cartridge::loadSufamiTurboA() -> bool { if(auto fp = platform->open(sufamiturboA.pathID, "manifest.bml", File::Read, File::Required)) { information.manifest.sufamiTurboA = fp->reads(); } else return false; - loadSufamiTurboA(BML::unserialize(information.manifest.sufamiTurboA)); + loadSufamiTurboA(BML::unserialize(string{information.manifest.sufamiTurboA}.replace("type: ", "type:"))); return true; } @@ -119,7 +119,7 @@ auto Cartridge::loadSufamiTurboB() -> bool { if(auto fp = platform->open(sufamiturboB.pathID, "manifest.bml", File::Read, File::Required)) { information.manifest.sufamiTurboB = fp->reads(); } else return false; - loadSufamiTurboB(BML::unserialize(information.manifest.sufamiTurboB)); + loadSufamiTurboB(BML::unserialize(string{information.manifest.sufamiTurboB}.replace("type: ", "type:"))); return true; } @@ -127,8 +127,8 @@ auto Cartridge::save() -> void { saveCartridge(BML::unserialize(information.manifest.cartridge)); saveGameBoy(BML::unserialize(information.manifest.gameBoy)); saveBSMemory(BML::unserialize(information.manifest.bsMemory)); - saveSufamiTurboA(BML::unserialize(information.manifest.sufamiTurboA)); - saveSufamiTurboB(BML::unserialize(information.manifest.sufamiTurboB)); + saveSufamiTurboA(BML::unserialize(string{information.manifest.sufamiTurboA}.replace("type: ", "type:"))); + saveSufamiTurboB(BML::unserialize(string{information.manifest.sufamiTurboB}.replace("type: ", "type:"))); } auto Cartridge::unload() -> void { diff --git a/higan/sfc/cartridge/cartridge.hpp b/higan/sfc/cartridge/cartridge.hpp index aca25230..a0225f66 100644 --- a/higan/sfc/cartridge/cartridge.hpp +++ b/higan/sfc/cartridge/cartridge.hpp @@ -37,7 +37,7 @@ struct Cartridge { } information; struct Has { - boolean ICD2; + boolean ICD; boolean MCC; boolean NSSDIP; boolean Event; @@ -75,7 +75,7 @@ private: auto loadROM(Markup::Node) -> void; auto loadRAM(Markup::Node) -> void; - auto loadICD2(Markup::Node) -> void; + auto loadICD(Markup::Node) -> void; auto loadMCC(Markup::Node) -> void; auto loadBSMemoryPack(Markup::Node) -> void; auto loadSufamiTurbo(Markup::Node, bool slot) -> void; @@ -121,7 +121,7 @@ private: auto saveMemory(MappedRAM&, Markup::Node, maybe = nothing) -> void; friend class Interface; - friend class ICD2; + friend class ICD; }; extern Cartridge cartridge; diff --git a/higan/sfc/cartridge/load.cpp b/higan/sfc/cartridge/load.cpp index d4e7fb0a..7cf35d03 100644 --- a/higan/sfc/cartridge/load.cpp +++ b/higan/sfc/cartridge/load.cpp @@ -3,7 +3,7 @@ auto Cartridge::loadBoard(Markup::Node node) -> Markup::Node { auto region = node["game/region"].text(); auto board = node["game/board"].text(); - board.trimLeft("SHVC-", 1L); + if(board != "SHVC-SGB2-01") board.trimLeft("SHVC-", 1L); board.trimLeft("SNSP-", 1L); board.trimLeft("MAXI-", 1L); board.trimLeft("MJSC-", 1L); @@ -80,7 +80,7 @@ auto Cartridge::loadCartridge(Markup::Node node) -> void { if(board["region"].text() == "pal") information.region = "PAL"; } - if(board["mcc"] || board["bsmemory"]) { + if(board["bsmemory"] || board["mcc/bsmemory"] || board["sa1/bsmemory"]) { if(auto loaded = platform->load(ID::BSMemory, "BS Memory", "bs")) { bsmemory.pathID = loaded.pathID(); loadBSMemory(); @@ -95,7 +95,7 @@ auto Cartridge::loadCartridge(Markup::Node node) -> void { if(auto node = board["rom"]) loadROM(node); if(auto node = board["ram"]) loadRAM(node); - if(auto node = board["icd2"]) loadICD2(node); + if(auto node = board["icd"]) loadICD(node); if(auto node = board["mcc"]) loadMCC(node); if(auto node = board["bsmemory"]) loadBSMemoryPack(node); if(auto node = board.find("sufamiturbo")) if(node(0)) loadSufamiTurbo(node(0), 0); @@ -120,30 +120,28 @@ auto Cartridge::loadGameBoy(Markup::Node node) -> void { auto Cartridge::loadBSMemory(Markup::Node node) -> void { information.title.bsMemory = node["game/label"].text(); - bsmemory.readonly = (node["board/rom/type"].text() == "mrom"); + bsmemory.readonly = node["game/memory/type"].text() == "ROM"; - loadMemory(bsmemory.memory, node["board/rom"], File::Required, bsmemory.pathID); + loadMemory(bsmemory.memory, node["game/memory"], File::Required, bsmemory.pathID); } auto Cartridge::loadSufamiTurboA(Markup::Node node) -> void { information.title.sufamiTurboA = node["game/label"].text(); - loadMemory(sufamiturboA.rom, node["board/rom"], File::Required, sufamiturboA.pathID); - loadMemory(sufamiturboA.ram, node["board/ram"], File::Optional, sufamiturboA.pathID); + loadMemory(sufamiturboA.rom, node["game/memory(type=ROM)" ], File::Required, sufamiturboA.pathID); + loadMemory(sufamiturboA.ram, node["game/memory(type=NVRAM)"], File::Optional, sufamiturboA.pathID); - if(node["board/linkable"]) { - if(auto loaded = platform->load(ID::SufamiTurboB, "Sufami Turbo", "st")) { - sufamiturboB.pathID = loaded.pathID(); - loadSufamiTurboB(); - } + if(auto loaded = platform->load(ID::SufamiTurboB, "Sufami Turbo", "st")) { + sufamiturboB.pathID = loaded.pathID(); + loadSufamiTurboB(); } } auto Cartridge::loadSufamiTurboB(Markup::Node node) -> void { information.title.sufamiTurboB = node["game/label"].text(); - loadMemory(sufamiturboB.rom, node["board/rom"], File::Required, sufamiturboB.pathID); - loadMemory(sufamiturboB.ram, node["board/ram"], File::Optional, sufamiturboB.pathID); + loadMemory(sufamiturboB.rom, node["game/memory(type=ROM)" ], File::Required, sufamiturboB.pathID); + loadMemory(sufamiturboB.ram, node["game/memory(type=NVRAM)"], File::Optional, sufamiturboB.pathID); } // @@ -158,13 +156,14 @@ auto Cartridge::loadRAM(Markup::Node node) -> void { for(auto leaf : node.find("map")) loadMap(leaf, ram); } -auto Cartridge::loadICD2(Markup::Node node) -> void { +auto Cartridge::loadICD(Markup::Node node) -> void { has.GameBoySlot = true; - has.ICD2 = true; - icd2.revision = max(1, node["revision"].natural()); + has.ICD = true; + icd.Revision = node["revision"].natural(); + icd.Frequency = node["frequency"].natural(); - //Game Boy core loads data through ICD2 interface - for(auto leaf : node.find("map")) loadMap(leaf, {&ICD2::readIO, &icd2}, {&ICD2::writeIO, &icd2}); + //Game Boy core loads data through ICD interface + for(auto leaf : node.find("map")) loadMap(leaf, {&ICD::readIO, &icd}, {&ICD::writeIO, &icd}); } auto Cartridge::loadMCC(Markup::Node node) -> void { diff --git a/higan/sfc/cartridge/save.cpp b/higan/sfc/cartridge/save.cpp index a2b57668..a72e14db 100644 --- a/higan/sfc/cartridge/save.cpp +++ b/higan/sfc/cartridge/save.cpp @@ -23,11 +23,11 @@ auto Cartridge::saveBSMemory(Markup::Node node) -> void { } auto Cartridge::saveSufamiTurboA(Markup::Node node) -> void { - saveMemory(sufamiturboA.ram, node["board/ram"], sufamiturboA.pathID); + saveMemory(sufamiturboA.ram, node["game/memory(type=NVRAM)"], sufamiturboA.pathID); } auto Cartridge::saveSufamiTurboB(Markup::Node node) -> void { - saveMemory(sufamiturboB.ram, node["board/ram"], sufamiturboB.pathID); + saveMemory(sufamiturboB.ram, node["game/memory(type=NVRAM)"], sufamiturboB.pathID); } // diff --git a/higan/sfc/coprocessor/coprocessor.hpp b/higan/sfc/coprocessor/coprocessor.hpp index d240f6b0..bd38403e 100644 --- a/higan/sfc/coprocessor/coprocessor.hpp +++ b/higan/sfc/coprocessor/coprocessor.hpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/higan/sfc/coprocessor/icd2/icd2.cpp b/higan/sfc/coprocessor/icd/icd.cpp similarity index 81% rename from higan/sfc/coprocessor/icd2/icd2.cpp rename to higan/sfc/coprocessor/icd/icd.cpp index dfa0b2a3..e3e0de3c 100644 --- a/higan/sfc/coprocessor/icd2/icd2.cpp +++ b/higan/sfc/coprocessor/icd/icd.cpp @@ -2,7 +2,7 @@ namespace SuperFamicom { -ICD2 icd2; +ICD icd; #if defined(SFC_SUPERGAMEBOY) @@ -11,15 +11,15 @@ ICD2 icd2; #include "io.cpp" #include "serialization.cpp" -auto ICD2::Enter() -> void { +auto ICD::Enter() -> void { while(true) { if(scheduler.synchronizing()) GameBoy::system.runToSave(); scheduler.synchronize(); - icd2.main(); + icd.main(); } } -auto ICD2::main() -> void { +auto ICD::main() -> void { if(r6003 & 0x80) { GameBoy::system.run(); step(GameBoy::system._clocksExecuted); @@ -31,19 +31,20 @@ auto ICD2::main() -> void { synchronize(cpu); } -auto ICD2::load() -> bool { +auto ICD::load() -> bool { GameBoy::superGameBoy = this; GameBoy::system.load(&gameBoyInterface, GameBoy::System::Model::SuperGameBoy, cartridge.pathID()); return cartridge.loadGameBoy(); } -auto ICD2::unload() -> void { +auto ICD::unload() -> void { GameBoy::system.save(); GameBoy::system.unload(); } -auto ICD2::power() -> void { - create(ICD2::Enter, system.cpuFrequency() / 5.0); +auto ICD::power() -> void { + //SGB1 uses CPU oscillator; SGB2 uses dedicated oscillator + create(ICD::Enter, (Frequency ? Frequency : system.cpuFrequency()) / 5.0); stream = Emulator::audio.createStream(2, frequency() / 2.0); stream->addFilter(Emulator::Filter::Order::First, Emulator::Filter::Type::HighPass, 20.0); stream->addFilter(Emulator::Filter::Order::Second, Emulator::Filter::Type::LowPass, 20000.0, 3); @@ -72,8 +73,8 @@ auto ICD2::power() -> void { GameBoy::system.power(); } -auto ICD2::reset() -> void { - create(ICD2::Enter, system.cpuFrequency() / 5.0); +auto ICD::reset() -> void { + create(ICD::Enter, (Frequency ? Frequency : system.cpuFrequency()) / 5.0); r6003 = 0x00; r6004 = 0xff; diff --git a/higan/sfc/coprocessor/icd2/icd2.hpp b/higan/sfc/coprocessor/icd/icd.hpp similarity index 89% rename from higan/sfc/coprocessor/icd2/icd2.hpp rename to higan/sfc/coprocessor/icd/icd.hpp index fea9661c..3124a01b 100644 --- a/higan/sfc/coprocessor/icd2/icd2.hpp +++ b/higan/sfc/coprocessor/icd/icd.hpp @@ -1,6 +1,6 @@ #if defined(SFC_SUPERGAMEBOY) -struct ICD2 : Emulator::Platform, GameBoy::SuperGameBoyInterface, Thread { +struct ICD : Emulator::Platform, GameBoy::SuperGameBoyInterface, Thread { shared_pointer stream; static auto Enter() -> void; @@ -27,7 +27,8 @@ struct ICD2 : Emulator::Platform, GameBoy::SuperGameBoyInterface, Thread { //serialization.cpp auto serialize(serializer&) -> void; - uint revision; + uint Revision = 0; + uint Frequency = 0; private: struct Packet { @@ -66,7 +67,7 @@ private: #else -struct ICD2 : Thread { +struct ICD : Thread { auto init() -> void {} auto load() -> void {} auto unload() -> void {} @@ -78,9 +79,10 @@ struct ICD2 : Thread { auto serialize(serializer&) -> void {} - uint revision; + uint Revision = 0; + uint Frequency = 0; }; #endif -extern ICD2 icd2; +extern ICD icd; diff --git a/higan/sfc/coprocessor/icd2/interface.cpp b/higan/sfc/coprocessor/icd/interface.cpp similarity index 93% rename from higan/sfc/coprocessor/icd2/interface.cpp rename to higan/sfc/coprocessor/icd/interface.cpp index c453fc79..b05d8881 100644 --- a/higan/sfc/coprocessor/icd2/interface.cpp +++ b/higan/sfc/coprocessor/icd/interface.cpp @@ -1,4 +1,4 @@ -auto ICD2::lcdScanline() -> void { +auto ICD::lcdScanline() -> void { if(GameBoy::ppu.status.ly > 143) return; //Vblank if((GameBoy::ppu.status.ly & 7) == 0) { writeBank = (writeBank + 1) & 3; @@ -6,7 +6,7 @@ auto ICD2::lcdScanline() -> void { } } -auto ICD2::lcdOutput(uint2 color) -> void { +auto ICD::lcdOutput(uint2 color) -> void { uint y = writeAddress / 160; uint x = writeAddress % 160; uint addr = writeBank * 512 + y * 2 + x / 8 * 16; @@ -15,7 +15,7 @@ auto ICD2::lcdOutput(uint2 color) -> void { writeAddress = (writeAddress + 1) % 1280; } -auto ICD2::joypWrite(bool p15, bool p14) -> void { +auto ICD::joypWrite(bool p15, bool p14) -> void { //joypad handling if(p15 == 1 && p14 == 1) { if(joyp15Lock == 0 && joyp14Lock == 0) { diff --git a/higan/sfc/coprocessor/icd2/io.cpp b/higan/sfc/coprocessor/icd/io.cpp similarity index 94% rename from higan/sfc/coprocessor/icd2/io.cpp rename to higan/sfc/coprocessor/icd/io.cpp index 3ad1841b..bf2df6fc 100644 --- a/higan/sfc/coprocessor/icd2/io.cpp +++ b/higan/sfc/coprocessor/icd/io.cpp @@ -1,4 +1,4 @@ -auto ICD2::readIO(uint24 addr, uint8 data) -> uint8 { +auto ICD::readIO(uint24 addr, uint8 data) -> uint8 { addr &= 0x40ffff; //LY counter @@ -38,7 +38,7 @@ auto ICD2::readIO(uint24 addr, uint8 data) -> uint8 { return 0x00; } -auto ICD2::writeIO(uint24 addr, uint8 data) -> void { +auto ICD::writeIO(uint24 addr, uint8 data) -> void { addr &= 0xffff; //VRAM port diff --git a/higan/sfc/coprocessor/icd2/platform.cpp b/higan/sfc/coprocessor/icd/platform.cpp similarity index 85% rename from higan/sfc/coprocessor/icd2/platform.cpp rename to higan/sfc/coprocessor/icd/platform.cpp index 625b71d8..d07f8021 100644 --- a/higan/sfc/coprocessor/icd2/platform.cpp +++ b/higan/sfc/coprocessor/icd/platform.cpp @@ -1,8 +1,8 @@ -auto ICD2::audioSample(const double* samples, uint channels) -> void { +auto ICD::audioSample(const double* samples, uint channels) -> void { stream->write(samples); } -auto ICD2::inputPoll(uint port, uint device, uint id) -> int16 { +auto ICD::inputPoll(uint port, uint device, uint id) -> int16 { GameBoy::cpu.status.mltReq = joypID & mltReq; uint data = 0x00; diff --git a/higan/sfc/coprocessor/icd2/serialization.cpp b/higan/sfc/coprocessor/icd/serialization.cpp similarity index 93% rename from higan/sfc/coprocessor/icd2/serialization.cpp rename to higan/sfc/coprocessor/icd/serialization.cpp index 10e0f673..36edfacf 100644 --- a/higan/sfc/coprocessor/icd2/serialization.cpp +++ b/higan/sfc/coprocessor/icd/serialization.cpp @@ -1,4 +1,4 @@ -auto ICD2::serialize(serializer& s) -> void { +auto ICD::serialize(serializer& s) -> void { Thread::serialize(s); GameBoy::system.serializeAll(s); diff --git a/higan/sfc/coprocessor/sa1/memory.cpp b/higan/sfc/coprocessor/sa1/memory.cpp index e59b94c9..6050a8eb 100644 --- a/higan/sfc/coprocessor/sa1/memory.cpp +++ b/higan/sfc/coprocessor/sa1/memory.cpp @@ -137,6 +137,7 @@ auto SA1::mmcromRead(uint24 addr, uint8) -> uint8 { } static auto read = [](uint addr) { + if((addr & 0x400000) && bsmemory.size()) return bsmemory.read(addr, 0x00); return sa1.rom.read(bus.mirror(addr, sa1.rom.size())); }; diff --git a/higan/sfc/interface/interface.cpp b/higan/sfc/interface/interface.cpp index 0f7d3fd9..842d1dfb 100644 --- a/higan/sfc/interface/interface.cpp +++ b/higan/sfc/interface/interface.cpp @@ -227,7 +227,7 @@ auto Interface::unserialize(serializer& s) -> bool { auto Interface::cheatSet(const string_vector& list) -> void { cheat.reset(); #if defined(SFC_SUPERGAMEBOY) - if(cartridge.has.ICD2) return GameBoy::cheat.assign(list); + if(cartridge.has.ICD) return GameBoy::cheat.assign(list); #endif cheat.assign(list); } diff --git a/higan/sfc/slot/bsmemory/bsmemory.cpp b/higan/sfc/slot/bsmemory/bsmemory.cpp index cd28d702..46727600 100644 --- a/higan/sfc/slot/bsmemory/bsmemory.cpp +++ b/higan/sfc/slot/bsmemory/bsmemory.cpp @@ -55,7 +55,7 @@ auto BSMemory::read(uint24 addr, uint8 data) -> uint8 { } } - return memory.read(addr, data); + return memory.read(bus.mirror(addr, memory.size()), data); } auto BSMemory::write(uint24 addr, uint8 data) -> void { diff --git a/higan/sfc/system/serialization.cpp b/higan/sfc/system/serialization.cpp index 5b94abc0..7b552569 100644 --- a/higan/sfc/system/serialization.cpp +++ b/higan/sfc/system/serialization.cpp @@ -50,7 +50,7 @@ auto System::serializeAll(serializer& s) -> void { ppu.serialize(s); dsp.serialize(s); - if(cartridge.has.ICD2) icd2.serialize(s); + if(cartridge.has.ICD) icd.serialize(s); if(cartridge.has.MCC) mcc.serialize(s); if(cartridge.has.Event) event.serialize(s); if(cartridge.has.SA1) sa1.serialize(s); diff --git a/higan/sfc/system/system.cpp b/higan/sfc/system/system.cpp index 29d9068d..8dbbab66 100644 --- a/higan/sfc/system/system.cpp +++ b/higan/sfc/system/system.cpp @@ -48,7 +48,7 @@ auto System::load(Emulator::Interface* interface) -> bool { information.cpuFrequency = Emulator::Constants::Colorburst::PAL * 4.8; } - if(cartridge.has.ICD2) icd2.load(); + if(cartridge.has.ICD) icd.load(); if(cartridge.has.BSMemorySlot) bsmemory.load(); serializeInit(); @@ -70,7 +70,7 @@ auto System::unload() -> void { controllerPort2.unload(); expansionPort.unload(); - if(cartridge.has.ICD2) icd2.unload(); + if(cartridge.has.ICD) icd.unload(); if(cartridge.has.MCC) mcc.unload(); if(cartridge.has.Event) event.unload(); if(cartridge.has.SA1) sa1.unload(); @@ -104,7 +104,7 @@ auto System::power(bool reset) -> void { dsp.power(reset); ppu.power(reset); - if(cartridge.has.ICD2) icd2.power(); + if(cartridge.has.ICD) icd.power(); if(cartridge.has.MCC) mcc.power(); if(cartridge.has.NSSDIP) nss.power(); if(cartridge.has.Event) event.power(); @@ -122,7 +122,7 @@ auto System::power(bool reset) -> void { if(cartridge.has.BSMemorySlot) bsmemory.power(); if(cartridge.has.SufamiTurboSlots) sufamiturboA.power(), sufamiturboB.power(); - if(cartridge.has.ICD2) cpu.coprocessors.append(&icd2); + if(cartridge.has.ICD) cpu.coprocessors.append(&icd); if(cartridge.has.Event) cpu.coprocessors.append(&event); if(cartridge.has.SA1) cpu.coprocessors.append(&sa1); if(cartridge.has.SuperFX) cpu.coprocessors.append(&superfx); diff --git a/higan/systems/Super Famicom.sys/boards.bml b/higan/systems/Super Famicom.sys/boards.bml index 83ae8f0e..bd42192b 100644 --- a/higan/systems/Super Famicom.sys/boards.bml +++ b/higan/systems/Super Famicom.sys/boards.bml @@ -1,10 +1,10 @@ database - revision: 2018-02-15 + revision: 2018-02-21 //Boards (Production) database - revision: 2018-02-11 + revision: 2018-02-21 board: 1A0N-(01,02,10,20,30) rom @@ -152,10 +152,9 @@ board: 1CB7B-01 board: 1DC0N-01 hitachidsp model=HG51B169 frequency=20000000 map address=00-3f,80-bf:6c00-6fff,7c00-7fff + map address=70-77:0000-7fff rom map address=00-3f,80-bf:8000-ffff mask=0x8000 - ram - map address=70-77:0000-7fff mask=0x8000 drom dram map address=00-3f,80-bf:6000-6bff,7000-7bff mask=0xf000 @@ -196,7 +195,7 @@ board: 1J3M-(01,11,20) ram map address=20-3f,a0-bf:6000-7fff mask=0xe000 -board: 1J5M-(11,20) +board: 1J5M-(01,11,20) rom map address=00-3f,80-bf:8000-ffff map address=40-7d,c0-ff:0000-ffff @@ -317,10 +316,9 @@ board: 2B3B-01 board: 2DC0N-01 hitachidsp model=HG51B169 frequency=20000000 map address=00-3f,80-bf:6c00-6fff,7c00-7fff + map address=70-77:0000-7fff rom map address=00-3f,80-bf:8000-ffff mask=0x8000 - ram - map address=70-77:0000-7fff mask=0x8000 drom dram map address=00-3f,80-bf:6000-6bff,7000-7bff mask=0xf000 @@ -374,6 +372,20 @@ board: BA3M-(01,10) ram map address=70-7d,f0-ff:0000-7fff mask=0x8000 +board: BANDAI-PT-923 + rom + map address=00-1f,80-9f:8000-ffff mask=0x8000 + sufamiturbo + rom + map address=20-3f,a0-bf:8000-ffff mask=0x8000 + ram + map address=60-6f,e0-ef:0000-ffff + sufamiturbo + rom + map address=40-5f,c0-df:0000-ffff mask=0x8000 + ram + map address=70-7d,f0-ff:0000-ffff + board: BJ0N-(01,20) rom map address=00-3f,80-bf:8000-ffff @@ -393,13 +405,91 @@ board: BJ3M-10 ram map address=20-3f,a0-bf:6000-7fff mask=0xe000 +board: BSC-1A5M-02 + rom + map address=00-1f:8000-ffff mask=0x8000 base=0x000000 + map address=20-3f:8000-ffff mask=0x8000 base=0x100000 + map address=80-9f:8000-ffff mask=0x8000 base=0x200000 + map address=a0-bf:8000-ffff mask=0x8000 base=0x100000 + ram + map address=70-7d,f0-ff:0000-7fff mask=0x8000 + bsmemory + map address=c0-ef:0000-ffff + +board: BSC-1A7M-01 + rom + map address=00-1f:8000-ffff mask=0x8000 base=0x000000 + map address=20-3f:8000-ffff mask=0x8000 base=0x100000 + map address=80-9f:8000-ffff mask=0x8000 base=0x200000 + map address=a0-bf:8000-ffff mask=0x8000 base=0x100000 + ram + map address=70-7d,f0-ff:0000-7fff mask=0x8000 + bsmemory + map address=c0-ef:0000-ffff + +board: BSC-1J3M-01 + rom + map address=00-1f,80-9f:8000-ffff + map address=40-5f,c0-df:0000-ffff + ram + map address=20-3f,a0-bf:6000-7fff mask=0xe000 + bsmemory + map address=20-3f,a0-bf:8000-ffff + map address=60-7d,e0-ff:0000-ffff + +board: BSC-1J5M-01 + rom + map address=00-1f,80-9f:8000-ffff + map address=40-5f,c0-df:0000-ffff + ram + map address=20-3f,a0-bf:6000-7fff mask=0xe000 + bsmemory + map address=20-3f,a0-bf:8000-ffff + map address=60-7d,e0-ff:0000-ffff + +board: BSC-1L3B-01 + sa1 + map address=00-3f,80-bf:2200-23ff + rom + map address=00-3f,80-bf:8000-ffff mask=0x408000 + map address=c0-ff:0000-ffff + bwram + map address=00-3f,80-bf:6000-7fff size=0x2000 + map address=40-4f:0000-ffff + iram + map address=00-3f,80-bf:3000-37ff size=0x800 + bsmemory + +board: BSC-1L5B-01 + sa1 + map address=00-3f,80-bf:2200-23ff + rom + map address=00-3f,80-bf:8000-ffff mask=0x408000 + map address=c0-ff:0000-ffff + bwram + map address=00-3f,80-bf:6000-7fff size=0x2000 + map address=40-4f:0000-ffff + iram + map address=00-3f,80-bf:3000-37ff size=0x800 + bsmemory + board: SGB-R-10 rom map address=00-7d,80-ff:8000-ffff mask=0x8000 map address=40-7d,c0-ff:0000-7fff mask=0x8000 - icd2 revision=1 + icd revision=2 map address=00-3f,80-bf:6000-67ff,7000-7fff rom + gameboy + +board: SHVC-SGB2-01 + rom + map address=00-7d,80-ff:8000-ffff mask=0x8000 + map address=40-7d,c0-ff:0000-7fff mask=0x8000 + icd revision=2 frequency=20971520 + map address=00-3f,80-bf:6000-67ff,7000-7fff + rom + gameboy board: YA0N-01 rom @@ -414,7 +504,7 @@ board: YJ0N-01 //Boards (Generic) database - revision: 2018-02-15 + revision: 2018-02-21 board: ARM-LOROM-RAM rom @@ -472,8 +562,7 @@ board: BS-SA1-RAM map address=40-4f:0000-ffff iram map address=00-3f,80-bf:3000-37ff size=0x800 - bsmemory - map + bsmemory board: HIROM rom @@ -650,9 +739,10 @@ board: SGB-LOROM rom map address=00-7d,80-ff:8000-ffff mask=0x8000 map address=40-7d,c0-ff:0000-7fff mask=0x8000 - icd2 revision=1 + icd revision=2 map address=00-3f,80-bf:6000-67ff,7000-7fff rom + gameboy board: SPC7110-RAM spc7110 @@ -689,8 +779,7 @@ board: ST-LOROM map address=60-6f,e0-ef:0000-ffff sufamiturbo rom - map address=40-5f,c0-df:0000-7fff mask=0x8000 - map address=40-5f,c0-df:8000-ffff mask=0x8000 + map address=40-5f,c0-df:0000-ffff mask=0x8000 ram map address=70-7d,f0-ff:0000-ffff