From 7ef42347caa08f45139a105f413521eed138f318 Mon Sep 17 00:00:00 2001 From: Solra Bizna Date: Thu, 5 Oct 2017 02:05:15 -0600 Subject: [PATCH] Don't forget to actually support expansion hardware --- src/cartridge.cc | 2 ++ src/expansions.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cartridge.cc b/src/cartridge.cc index 86f2bec..2b57920 100644 --- a/src/cartridge.cc +++ b/src/cartridge.cc @@ -3,6 +3,7 @@ #include "cartridge.hh" #include "mappers.hh" #include "localquery.hh" +#include "expansions.hh" using namespace ARS; @@ -127,6 +128,7 @@ std::unique_ptr Cartridge::load(GameFolder& gamefolder, throw sn.Get("BOARD_EXPANSION_ADDRESS_INVALID"_Key); } else addr = 0; // will be interpreted as "use default address" + ARS::map_expansion(addr, expansion.data()); } // Mapper auto mapper_tag = *LocalizedQuery(board->query("mapper")); diff --git a/src/expansions.cc b/src/expansions.cc index 80a7e37..e5dcf9b 100644 --- a/src/expansions.cc +++ b/src/expansions.cc @@ -68,7 +68,7 @@ namespace { } void ARS::map_expansion(uint16_t addr, const std::string& type) { - if(addr < 0x240 || addr > 0x247) + if(addr != 0 && (addr < 0x240 || addr > 0x247)) die("INTERNAL ERROR: Expansion IO address out of range"); if(type == "debug") { if(addr == 0) addr = 0x247;