mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 18:30:21 +00:00
Opens up .bin and .rom to all cartridge platforms, and adds a confidence estimate to the Atari 2600.
This commit is contained in:
parent
f212b18511
commit
1100dc6993
@ -88,7 +88,7 @@ static Media GetMediaAndPlatforms(const char *file_name, TargetPlatform::IntType
|
|||||||
Format("81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81
|
Format("81", result.tapes, Tape::ZX80O81P, TargetPlatform::ZX8081) // 81
|
||||||
Format("a26", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26
|
Format("a26", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // A26
|
||||||
Format("adf", result.disks, Disk::DiskImageHolder<Storage::Disk::AcornADF>, TargetPlatform::Acorn) // ADF
|
Format("adf", result.disks, Disk::DiskImageHolder<Storage::Disk::AcornADF>, TargetPlatform::Acorn) // ADF
|
||||||
Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::Atari2600) // BIN
|
Format("bin", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // BIN
|
||||||
Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS
|
Format("cas", result.tapes, Tape::CAS, TargetPlatform::MSX) // CAS
|
||||||
Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT
|
Format("cdt", result.tapes, Tape::TZX, TargetPlatform::AmstradCPC) // CDT
|
||||||
Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::ColecoVision) // COL
|
Format("col", result.cartridges, Cartridge::BinaryDump, TargetPlatform::ColecoVision) // COL
|
||||||
@ -117,10 +117,7 @@ static Media GetMediaAndPlatforms(const char *file_name, TargetPlatform::IntType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Format( "rom",
|
Format("rom", result.cartridges, Cartridge::BinaryDump, TargetPlatform::AllCartridge) // ROM
|
||||||
result.cartridges,
|
|
||||||
Cartridge::BinaryDump,
|
|
||||||
TargetPlatform::Acorn | TargetPlatform::MSX | TargetPlatform::ColecoVision) // ROM
|
|
||||||
Format("ssd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // SSD
|
Format("ssd", result.disks, Disk::DiskImageHolder<Storage::Disk::SSD>, TargetPlatform::Acorn) // SSD
|
||||||
Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore)
|
Format("tap", result.tapes, Tape::CommodoreTAP, TargetPlatform::Commodore) // TAP (Commodore)
|
||||||
Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric)
|
Format("tap", result.tapes, Tape::OricTAP, TargetPlatform::Oric) // TAP (Oric)
|
||||||
|
@ -74,9 +74,7 @@ class ConcreteMachine:
|
|||||||
public Machine,
|
public Machine,
|
||||||
public Outputs::CRT::Delegate {
|
public Outputs::CRT::Delegate {
|
||||||
public:
|
public:
|
||||||
ConcreteMachine() :
|
ConcreteMachine() {
|
||||||
frame_record_pointer_(0),
|
|
||||||
is_ntsc_(true) {
|
|
||||||
set_clock_rate(NTSC_clock_rate);
|
set_clock_rate(NTSC_clock_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +177,7 @@ class ConcreteMachine:
|
|||||||
|
|
||||||
void run_for(const Cycles cycles) override {
|
void run_for(const Cycles cycles) override {
|
||||||
bus_->run_for(cycles);
|
bus_->run_for(cycles);
|
||||||
|
bus_->apply_confidence(confidence_counter_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// to satisfy Outputs::CRT::Delegate
|
// to satisfy Outputs::CRT::Delegate
|
||||||
@ -219,6 +218,10 @@ class ConcreteMachine:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float get_confidence() override {
|
||||||
|
return confidence_counter_.get_confidence();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// the bus
|
// the bus
|
||||||
std::unique_ptr<Bus> bus_;
|
std::unique_ptr<Bus> bus_;
|
||||||
@ -230,9 +233,12 @@ class ConcreteMachine:
|
|||||||
|
|
||||||
FrameRecord() : number_of_frames(0), number_of_unexpected_vertical_syncs(0) {}
|
FrameRecord() : number_of_frames(0), number_of_unexpected_vertical_syncs(0) {}
|
||||||
} frame_records_[4];
|
} frame_records_[4];
|
||||||
unsigned int frame_record_pointer_;
|
unsigned int frame_record_pointer_ = 0;
|
||||||
bool is_ntsc_;
|
bool is_ntsc_ = true;
|
||||||
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
|
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
|
||||||
|
|
||||||
|
// a confidence counter
|
||||||
|
Analyser::Dynamic::ConfidenceCounter confidence_counter_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "TIA.hpp"
|
#include "TIA.hpp"
|
||||||
#include "TIASound.hpp"
|
#include "TIASound.hpp"
|
||||||
|
|
||||||
|
#include "../../Analyser/Dynamic/ConfidenceCounter.hpp"
|
||||||
#include "../../ClockReceiver/ClockReceiver.hpp"
|
#include "../../ClockReceiver/ClockReceiver.hpp"
|
||||||
#include "../../Outputs/Speaker/Implementation/LowpassSpeaker.hpp"
|
#include "../../Outputs/Speaker/Implementation/LowpassSpeaker.hpp"
|
||||||
|
|
||||||
@ -23,11 +24,10 @@ class Bus {
|
|||||||
public:
|
public:
|
||||||
Bus() :
|
Bus() :
|
||||||
tia_sound_(audio_queue_),
|
tia_sound_(audio_queue_),
|
||||||
speaker_(tia_sound_),
|
speaker_(tia_sound_) {}
|
||||||
tia_input_value_{0xff, 0xff},
|
|
||||||
cycles_since_speaker_update_(0) {}
|
|
||||||
|
|
||||||
virtual void run_for(const Cycles cycles) = 0;
|
virtual void run_for(const Cycles cycles) = 0;
|
||||||
|
virtual void apply_confidence(Analyser::Dynamic::ConfidenceCounter &confidence_counter) = 0;
|
||||||
virtual void set_reset_line(bool state) = 0;
|
virtual void set_reset_line(bool state) = 0;
|
||||||
|
|
||||||
// the RIOT, TIA and speaker
|
// the RIOT, TIA and speaker
|
||||||
@ -39,7 +39,7 @@ class Bus {
|
|||||||
Outputs::Speaker::LowpassSpeaker<TIASound> speaker_;
|
Outputs::Speaker::LowpassSpeaker<TIASound> speaker_;
|
||||||
|
|
||||||
// joystick state
|
// joystick state
|
||||||
uint8_t tia_input_value_[2];
|
uint8_t tia_input_value_[2] = {0xff, 0xff};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// speaker backlog accumlation counter
|
// speaker backlog accumlation counter
|
||||||
|
@ -39,7 +39,23 @@ template<class T> class Cartridge:
|
|||||||
// consider doing something less fragile.
|
// consider doing something less fragile.
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_for(const Cycles cycles) { m6502_.run_for(cycles); }
|
void run_for(const Cycles cycles) {
|
||||||
|
// Horizontal counter resets are used as a proxy for whether this really is an Atari 2600
|
||||||
|
// title. Random memory accesses are likely to trigger random counter resets.
|
||||||
|
horizontal_counter_resets_ = 0;
|
||||||
|
cycle_count_ = cycles;
|
||||||
|
m6502_.run_for(cycles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Adjusts @c confidence_counter according to the results of the most recent run_for.
|
||||||
|
*/
|
||||||
|
void apply_confidence(Analyser::Dynamic::ConfidenceCounter &confidence_counter) {
|
||||||
|
if(cycle_count_.as_int() < 200) return;
|
||||||
|
if(horizontal_counter_resets_ > 10)
|
||||||
|
confidence_counter.add_miss();
|
||||||
|
}
|
||||||
|
|
||||||
void set_reset_line(bool state) { m6502_.set_reset_line(state); }
|
void set_reset_line(bool state) { m6502_.set_reset_line(state); }
|
||||||
|
|
||||||
// to satisfy CPU::MOS6502::Processor
|
// to satisfy CPU::MOS6502::Processor
|
||||||
@ -108,7 +124,11 @@ template<class T> class Cartridge:
|
|||||||
case 0x01: update_video(); tia_->set_blank(*value & 0x02); break;
|
case 0x01: update_video(); tia_->set_blank(*value & 0x02); break;
|
||||||
|
|
||||||
case 0x02: m6502_.set_ready_line(true); break;
|
case 0x02: m6502_.set_ready_line(true); break;
|
||||||
case 0x03: update_video(); tia_->reset_horizontal_counter(); break;
|
case 0x03:
|
||||||
|
update_video();
|
||||||
|
tia_->reset_horizontal_counter();
|
||||||
|
horizontal_counter_resets_++;
|
||||||
|
break;
|
||||||
// TODO: audio will now be out of synchronisation — fix
|
// TODO: audio will now be out of synchronisation — fix
|
||||||
|
|
||||||
case 0x04:
|
case 0x04:
|
||||||
@ -189,6 +209,9 @@ template<class T> class Cartridge:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
T bus_extender_;
|
T bus_extender_;
|
||||||
|
int horizontal_counter_resets_ = 0;
|
||||||
|
Cycles cycle_count_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,9 @@ enum Type: IntType {
|
|||||||
|
|
||||||
Acorn = AcornAtom | AcornElectron | BBCMaster | BBCModelA | BBCModelB,
|
Acorn = AcornAtom | AcornElectron | BBCMaster | BBCModelA | BBCModelB,
|
||||||
ZX8081 = ZX80 | ZX81,
|
ZX8081 = ZX80 | ZX81,
|
||||||
AllTape = Acorn | AmstradCPC | Commodore | Oric | ZX80 | ZX81 | MSX,
|
AllCartridge = Atari2600 | AcornElectron | ColecoVision | MSX,
|
||||||
AllDisk = Acorn | AmstradCPC | Commodore | Oric | MSX,
|
AllDisk = Acorn | AmstradCPC | Commodore | Oric | MSX,
|
||||||
|
AllTape = Acorn | AmstradCPC | Commodore | Oric | ZX80 | ZX81 | MSX,
|
||||||
};
|
};
|
||||||
|
|
||||||
class TypeDistinguisher {
|
class TypeDistinguisher {
|
||||||
|
Loading…
Reference in New Issue
Block a user