1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Attempt to offer centralised C8 region decoding.

This commit is contained in:
Thomas Harte 2022-08-23 14:50:44 -04:00
parent 0595773355
commit f4c242d5e9

View File

@ -102,10 +102,12 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
Cycles cycles_since_audio_update_; Cycles cycles_since_audio_update_;
// MARK: - Cards // MARK: - Cards
std::array<std::unique_ptr<Apple::II::Card>, 7> cards_; std::array<std::unique_ptr<Apple::II::Card>, 9> cards_; // The final slot is a sentinel.
Cycles cycles_since_card_update_; Cycles cycles_since_card_update_;
std::vector<Apple::II::Card *> every_cycle_cards_; std::vector<Apple::II::Card *> every_cycle_cards_;
std::vector<Apple::II::Card *> just_in_time_cards_; std::vector<Apple::II::Card *> just_in_time_cards_;
static constexpr size_t NoActiveCard = 8;
size_t active_card_ = NoActiveCard;
int stretched_cycles_since_card_update_ = 0; int stretched_cycles_since_card_update_ = 0;
@ -739,18 +741,32 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
Communication with cards follows. Communication with cards follows.
*/ */
if(!read_pages_[address >> 8] && address >= 0xc090 && address < 0xc800) { if(!read_pages_[address >> 8] && address >= 0xc090 && address < 0xd000) {
// If this is a card access, figure out which card is at play before determining // If this is a card access, figure out which card is at play before determining
// the totality of who needs messaging. // the totality of who needs messaging.
size_t card_number = 0; size_t card_number = 0;
Apple::II::Card::Select select = Apple::II::Card::None; Apple::II::Card::Select select = Apple::II::Card::None;
if(address >= 0xc100) { if(address >= 0xc800) {
/*
Decode the 2kb area used for additional ROMs.
This is shared by all cards.
*/
card_number = active_card_;
select = Apple::II::Card::C8Region;
// An access to $cfff will disable the active card.
if(address == 0xcfff) {
active_card_ = NoActiveCard;
}
} else if(address >= 0xc100) {
/* /*
Decode the area conventionally used by cards for ROMs: Decode the area conventionally used by cards for ROMs:
0xCn00 to 0xCnff: card n. 0xCn00 to 0xCnff: card n.
This also sets the active card for the C8 region.
*/ */
card_number = (address - 0xc100) >> 8; active_card_ = card_number = (address - 0xc100) >> 8;
select = Apple::II::Card::Device; select = Apple::II::Card::Device;
} else { } else {
/* /*