1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-27 18:55:48 +00:00

Adds a couple of hard-stop conditions to the MSX, and respect for hard stops.

This commit is contained in:
Thomas Harte 2018-02-09 09:10:56 -05:00
parent 4e720d57b2
commit d63a95983d
6 changed files with 16 additions and 1 deletions

View File

@ -46,7 +46,7 @@ Outputs::Speaker::Speaker *MultiCRTMachine::get_speaker() {
void MultiCRTMachine::run_for(const Cycles cycles) {
for(const auto &machine: machines_) {
CRTMachine::Machine *crt_machine = machine->crt_machine();
if(crt_machine) crt_machine->run_for(cycles);
if(crt_machine && crt_machine->get_confidence() >= 0.01f) crt_machine->run_for(cycles);
}
if(delegate_) delegate_->multi_crt_did_run_machines();

View File

@ -20,6 +20,7 @@ class ASCII16kbROMSlotHandler: public ROMSlotHandler {
map_(map), slot_(slot) {}
void write(uint16_t address, uint8_t value) override {
// printf("A16 %04x ", address);
switch(address >> 11) {
default:
confidence_counter_.add_miss();

View File

@ -20,6 +20,7 @@ class ASCII8kbROMSlotHandler: public ROMSlotHandler {
map_(map), slot_(slot) {}
void write(uint16_t address, uint8_t value) override {
// printf("A8 %04x ", address);
switch(address >> 11) {
default:
confidence_counter_.add_miss();

View File

@ -20,6 +20,7 @@ class KonamiROMSlotHandler: public ROMSlotHandler {
map_(map), slot_(slot) {}
void write(uint16_t address, uint8_t value) override {
// printf("K %04x ", address);
switch(address >> 13) {
default:
confidence_counter_.add_miss();

View File

@ -21,6 +21,7 @@ class KonamiWithSCCROMSlotHandler: public ROMSlotHandler {
map_(map), slot_(slot), scc_(scc) {}
void write(uint16_t address, uint8_t value) override {
// printf("KSCC %04x ", address);
switch(address >> 11) {
default:
confidence_counter_.add_miss();

View File

@ -158,6 +158,7 @@ class ConcreteMachine:
}
float get_confidence() override {
if(performed_unmapped_access_ || pc_zero_accesses_ > 1) return 0.0f;
if(memory_slots_[1].handler) {
return memory_slots_[1].handler->get_confidence();
}
@ -340,6 +341,13 @@ class ConcreteMachine:
break;
}
}
if(!address) {
pc_zero_accesses_++;
}
if(read_pointers_[address >> 13] == unpopulated_) {
performed_unmapped_access_ = true;
}
case CPU::Z80::PartialMachineCycle::Read:
if(read_pointers_[address >> 13]) {
*cycle.value = read_pointers_[address >> 13][address & 8191];
@ -653,6 +661,9 @@ class ConcreteMachine:
std::string input_text_;
MSX::KeyboardMapper keyboard_mapper_;
int pc_zero_accesses_ = 0;
bool performed_unmapped_access_ = false;
};
}