mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-27 22:30:49 +00:00
Neither cartridge machine should be a media target; their media can't be changed at runtime.
This commit is contained in:
parent
7e58a44771
commit
0897210969
@ -11,7 +11,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "../MediaTarget.hpp"
|
|
||||||
#include "../CRTMachine.hpp"
|
#include "../CRTMachine.hpp"
|
||||||
#include "../JoystickMachine.hpp"
|
#include "../JoystickMachine.hpp"
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "../../Components/AY38910/AY38910.hpp" // For the Super Game Module.
|
#include "../../Components/AY38910/AY38910.hpp" // For the Super Game Module.
|
||||||
#include "../../Components/SN76489/SN76489.hpp"
|
#include "../../Components/SN76489/SN76489.hpp"
|
||||||
|
|
||||||
#include "../MediaTarget.hpp"
|
|
||||||
#include "../CRTMachine.hpp"
|
#include "../CRTMachine.hpp"
|
||||||
#include "../JoystickMachine.hpp"
|
#include "../JoystickMachine.hpp"
|
||||||
|
|
||||||
@ -108,7 +107,6 @@ class ConcreteMachine:
|
|||||||
public Machine,
|
public Machine,
|
||||||
public CPU::Z80::BusHandler,
|
public CPU::Z80::BusHandler,
|
||||||
public CRTMachine::Machine,
|
public CRTMachine::Machine,
|
||||||
public MediaTarget::Machine,
|
|
||||||
public JoystickMachine::Machine {
|
public JoystickMachine::Machine {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -134,7 +132,24 @@ class ConcreteMachine:
|
|||||||
bios_ = *roms[0];
|
bios_ = *roms[0];
|
||||||
bios_.resize(8192);
|
bios_.resize(8192);
|
||||||
|
|
||||||
insert_media(target.media);
|
if(!target.media.cartridges.empty()) {
|
||||||
|
const auto &segment = target.media.cartridges.front()->get_segments().front();
|
||||||
|
cartridge_ = segment.data;
|
||||||
|
if(cartridge_.size() >= 32768)
|
||||||
|
cartridge_address_limit_ = 0xffff;
|
||||||
|
else
|
||||||
|
cartridge_address_limit_ = static_cast<uint16_t>(0x8000 + cartridge_.size() - 1);
|
||||||
|
|
||||||
|
if(cartridge_.size() > 32768) {
|
||||||
|
cartridge_pages_[0] = &cartridge_[cartridge_.size() - 16384];
|
||||||
|
cartridge_pages_[1] = cartridge_.data();
|
||||||
|
is_megacart_ = true;
|
||||||
|
} else {
|
||||||
|
cartridge_pages_[0] = cartridge_.data();
|
||||||
|
cartridge_pages_[1] = cartridge_.data() + 16384;
|
||||||
|
is_megacart_ = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~ConcreteMachine() {
|
~ConcreteMachine() {
|
||||||
@ -166,29 +181,6 @@ class ConcreteMachine:
|
|||||||
z80_.run_for(cycles);
|
z80_.run_for(cycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool insert_media(const Analyser::Static::Media &media) override {
|
|
||||||
if(!media.cartridges.empty()) {
|
|
||||||
const auto &segment = media.cartridges.front()->get_segments().front();
|
|
||||||
cartridge_ = segment.data;
|
|
||||||
if(cartridge_.size() >= 32768)
|
|
||||||
cartridge_address_limit_ = 0xffff;
|
|
||||||
else
|
|
||||||
cartridge_address_limit_ = static_cast<uint16_t>(0x8000 + cartridge_.size() - 1);
|
|
||||||
|
|
||||||
if(cartridge_.size() > 32768) {
|
|
||||||
cartridge_pages_[0] = &cartridge_[cartridge_.size() - 16384];
|
|
||||||
cartridge_pages_[1] = cartridge_.data();
|
|
||||||
is_megacart_ = true;
|
|
||||||
} else {
|
|
||||||
cartridge_pages_[0] = cartridge_.data();
|
|
||||||
cartridge_pages_[1] = cartridge_.data() + 16384;
|
|
||||||
is_megacart_ = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Z80::BusHandler
|
// MARK: Z80::BusHandler
|
||||||
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
forceinline HalfCycles perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
|
||||||
// The SN76489 will use its ready line to trigger the Z80's wait for three
|
// The SN76489 will use its ready line to trigger the Z80's wait for three
|
||||||
|
Loading…
x
Reference in New Issue
Block a user