mirror of
https://github.com/TomHarte/CLK.git
synced 2025-09-12 02:24:31 +00:00
Compare commits
13 Commits
Indentatio
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
cad42beef4 | ||
|
96fd0b7892 | ||
|
6f1db15d7c | ||
|
1854296ee8 | ||
|
515cc5f326 | ||
|
091be7eafe | ||
|
27a19ea417 | ||
|
9a5e9af67c | ||
|
3a493f2428 | ||
|
ca6e34f4b4 | ||
|
e1e68312c4 | ||
|
c7ff2cece4 | ||
|
8e6f4fa36f |
@@ -44,7 +44,7 @@ namespace {
|
||||
Log::Logger<Log::Source::Plus4> logger;
|
||||
|
||||
class Joystick: public Inputs::ConcreteJoystick {
|
||||
public:
|
||||
public:
|
||||
Joystick() :
|
||||
ConcreteJoystick({
|
||||
Input(Input::Up),
|
||||
@@ -73,7 +73,7 @@ class Joystick: public Inputs::ConcreteJoystick {
|
||||
return mask_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t mask_ = 0xff;
|
||||
};
|
||||
|
||||
|
@@ -13,23 +13,23 @@
|
||||
namespace MSX::Cartridge {
|
||||
|
||||
class ASCII16kbROMSlotHandler: public MemorySlotHandler {
|
||||
public:
|
||||
public:
|
||||
ASCII16kbROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
|
||||
|
||||
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
|
||||
void write(const uint16_t address, const uint8_t value, const bool pc_is_outside_bios) final {
|
||||
switch(address >> 11) {
|
||||
default:
|
||||
if(pc_is_outside_bios) confidence_counter_.add_miss();
|
||||
break;
|
||||
case 0xc:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x6000);
|
||||
}
|
||||
slot_.map(value * 0x4000, 0x4000, 0x4000);
|
||||
break;
|
||||
case 0xe:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x7000 || address == 0x77ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x7000 || address == 0x77ff);
|
||||
}
|
||||
slot_.map(value * 0x4000, 0x8000, 0x4000);
|
||||
break;
|
||||
@@ -40,7 +40,7 @@ class ASCII16kbROMSlotHandler: public MemorySlotHandler {
|
||||
return "A16";
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
MSX::MemorySlot &slot_;
|
||||
};
|
||||
|
||||
|
@@ -13,35 +13,35 @@
|
||||
namespace MSX::Cartridge {
|
||||
|
||||
class ASCII8kbROMSlotHandler: public MemorySlotHandler {
|
||||
public:
|
||||
public:
|
||||
ASCII8kbROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
|
||||
|
||||
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
|
||||
void write(const uint16_t address, const uint8_t value, const bool pc_is_outside_bios) final {
|
||||
switch(address >> 11) {
|
||||
default:
|
||||
if(pc_is_outside_bios) confidence_counter_.add_miss();
|
||||
break;
|
||||
case 0xc:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x6000 || address == 0x60ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x6000 || address == 0x60ff);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x4000, 0x2000);
|
||||
break;
|
||||
case 0xd:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x6800 || address == 0x68ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x6800 || address == 0x68ff);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x6000, 0x2000);
|
||||
break;
|
||||
case 0xe:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x7000 || address == 0x70ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x7000 || address == 0x70ff);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x8000, 0x2000);
|
||||
break;
|
||||
case 0xf:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x7800 || address == 0x78ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x7800 || address == 0x78ff);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0xa000, 0x2000);
|
||||
break;
|
||||
@@ -52,7 +52,7 @@ class ASCII8kbROMSlotHandler: public MemorySlotHandler {
|
||||
return "A8";
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
MSX::MemorySlot &slot_;
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
namespace MSX::Cartridge {
|
||||
|
||||
class KonamiROMSlotHandler: public MemorySlotHandler {
|
||||
public:
|
||||
public:
|
||||
KonamiROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
|
||||
|
||||
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
|
||||
@@ -23,19 +23,19 @@ class KonamiROMSlotHandler: public MemorySlotHandler {
|
||||
break;
|
||||
case 3:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x6000);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x6000, 0x2000);
|
||||
break;
|
||||
case 4:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x8000);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x8000, 0x2000);
|
||||
break;
|
||||
case 5:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0xa000);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0xa000, 0x2000);
|
||||
break;
|
||||
@@ -45,7 +45,8 @@ class KonamiROMSlotHandler: public MemorySlotHandler {
|
||||
virtual std::string debug_type() final {
|
||||
return "K";
|
||||
}
|
||||
private:
|
||||
|
||||
private:
|
||||
MSX::MemorySlot &slot_;
|
||||
};
|
||||
|
||||
|
@@ -14,30 +14,30 @@
|
||||
namespace MSX::Cartridge {
|
||||
|
||||
class KonamiWithSCCROMSlotHandler: public MemorySlotHandler {
|
||||
public:
|
||||
public:
|
||||
KonamiWithSCCROMSlotHandler(MSX::MemorySlot &slot, Konami::SCC &scc) :
|
||||
slot_(slot), scc_(scc) {}
|
||||
|
||||
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
|
||||
void write(const uint16_t address, const uint8_t value, const bool pc_is_outside_bios) final {
|
||||
switch(address >> 11) {
|
||||
default:
|
||||
if(pc_is_outside_bios) confidence_counter_.add_miss();
|
||||
break;
|
||||
case 0x0a:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x5000);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x4000, 0x2000);
|
||||
break;
|
||||
case 0x0e:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x7000);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0x6000, 0x2000);
|
||||
break;
|
||||
case 0x12:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0x9000);
|
||||
}
|
||||
if((value&0x3f) == 0x3f) {
|
||||
scc_is_visible_ = true;
|
||||
@@ -57,7 +57,7 @@ class KonamiWithSCCROMSlotHandler: public MemorySlotHandler {
|
||||
break;
|
||||
case 0x16:
|
||||
if(pc_is_outside_bios) {
|
||||
if(address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
|
||||
hit_or_equivocal(address == 0xb000);
|
||||
}
|
||||
slot_.map(value * 0x2000, 0xa000, 0x2000);
|
||||
break;
|
||||
@@ -77,7 +77,7 @@ class KonamiWithSCCROMSlotHandler: public MemorySlotHandler {
|
||||
return "KSCC";
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
MSX::MemorySlot &slot_;
|
||||
Konami::SCC &scc_;
|
||||
bool scc_is_visible_ = false;
|
||||
|
@@ -21,7 +21,7 @@
|
||||
namespace MSX {
|
||||
|
||||
class DiskROM: public MemorySlotHandler, public WD::WD1770 {
|
||||
public:
|
||||
public:
|
||||
DiskROM(MSX::MemorySlot &slot);
|
||||
|
||||
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final;
|
||||
@@ -31,7 +31,7 @@ class DiskROM: public MemorySlotHandler, public WD::WD1770 {
|
||||
void set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive);
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
|
||||
private:
|
||||
private:
|
||||
const std::vector<uint8_t> &rom_;
|
||||
|
||||
long int controller_cycles_ = 0;
|
||||
|
@@ -56,7 +56,7 @@ Log::Logger<Log::Source::MSX> logger;
|
||||
namespace MSX {
|
||||
|
||||
class AYPortHandler: public GI::AY38910::PortHandler {
|
||||
public:
|
||||
public:
|
||||
AYPortHandler(Storage::Tape::BinaryTapePlayer &tape_player) : tape_player_(tape_player) {
|
||||
joysticks_.emplace_back(new Joystick);
|
||||
joysticks_.emplace_back(new Joystick);
|
||||
@@ -91,7 +91,7 @@ class AYPortHandler: public GI::AY38910::PortHandler {
|
||||
return joysticks_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::Tape::BinaryTapePlayer &tape_player_;
|
||||
|
||||
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
|
||||
@@ -190,12 +190,12 @@ class ConcreteMachine:
|
||||
public ClockingHint::Observer,
|
||||
public Activity::Source,
|
||||
public MSX::MemorySlotChangeHandler {
|
||||
private:
|
||||
private:
|
||||
// Provide 512kb of memory for an MSX 2; 64kb for an MSX 1. 'Slightly' arbitrary.
|
||||
static constexpr size_t RAMSize = model == Target::Model::MSX2 ? 512 * 1024 : 64 * 1024;
|
||||
static constexpr int ClockRate = 3579545;
|
||||
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher):
|
||||
z80_(*this),
|
||||
tape_player_(3579545 * 2),
|
||||
@@ -846,7 +846,7 @@ class ConcreteMachine:
|
||||
return ay_port_handler_.get_joysticks();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void update_audio() {
|
||||
speaker_.speaker.run_for(speaker_.audio_queue, time_since_ay_update_.divide_cycles(Cycles(2)));
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ struct MemorySlotChangeHandler {
|
||||
};
|
||||
|
||||
class MemorySlot {
|
||||
public:
|
||||
public:
|
||||
MemorySlot(MemorySlotChangeHandler &);
|
||||
|
||||
/// @returns A pointer to the area of memory currently underneath @c address that
|
||||
@@ -79,7 +79,7 @@ class MemorySlot {
|
||||
uint16_t destination_address,
|
||||
std::size_t length);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::vector<uint8_t> source_;
|
||||
uint8_t *read_pointers_[8];
|
||||
uint8_t *write_pointers_[8];
|
||||
@@ -92,7 +92,7 @@ class MemorySlot {
|
||||
};
|
||||
|
||||
class PrimarySlot {
|
||||
public:
|
||||
public:
|
||||
PrimarySlot(MemorySlotChangeHandler &);
|
||||
|
||||
/// @returns A pointer to the area of memory currently underneath @c address that
|
||||
@@ -114,13 +114,13 @@ class PrimarySlot {
|
||||
/// Provides the subslot at the specified index.
|
||||
MemorySlot &subslot(int);
|
||||
|
||||
private:
|
||||
private:
|
||||
MemorySlot subslots_[4];
|
||||
uint8_t secondary_paging_ = 0;
|
||||
};
|
||||
|
||||
class MemorySlotHandler {
|
||||
public:
|
||||
public:
|
||||
virtual ~MemorySlotHandler() = default;
|
||||
|
||||
/*! Advances time by @c half_cycles. */
|
||||
@@ -141,8 +141,15 @@ class MemorySlotHandler {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
Analyser::Dynamic::ConfidenceCounter confidence_counter_;
|
||||
void hit_or_equivocal(const bool is_hit) {
|
||||
if(is_hit) {
|
||||
confidence_counter_.add_hit();
|
||||
} else {
|
||||
confidence_counter_.add_equivocal();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ namespace Sega {
|
||||
namespace MasterSystem {
|
||||
|
||||
class Joystick: public Inputs::ConcreteJoystick {
|
||||
public:
|
||||
public:
|
||||
Joystick() :
|
||||
ConcreteJoystick({
|
||||
Input(Input::Up),
|
||||
@@ -74,7 +74,7 @@ class Joystick: public Inputs::ConcreteJoystick {
|
||||
return state_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t state_ = 0xff;
|
||||
};
|
||||
|
||||
@@ -90,7 +90,7 @@ template <Analyser::Static::Sega::Target::Model model> class ConcreteMachine:
|
||||
public MachineTypes::ScanProducer,
|
||||
public MachineTypes::TimedMachine {
|
||||
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::Sega::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
region_(target.region),
|
||||
paging_scheme_(target.paging_scheme),
|
||||
@@ -437,7 +437,7 @@ template <Analyser::Static::Sega::Target::Model model> class ConcreteMachine:
|
||||
set_video_signal_configurable(options->output);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static constexpr TI::TMS::Personality tms_personality() {
|
||||
switch(model) {
|
||||
default:
|
||||
|
@@ -23,7 +23,7 @@ namespace Oric {
|
||||
see the thread at https://forum.defence-force.org/viewtopic.php?f=25&t=2055
|
||||
*/
|
||||
class BD500: public DiskController {
|
||||
public:
|
||||
public:
|
||||
BD500();
|
||||
|
||||
void write(int address, uint8_t value);
|
||||
@@ -33,7 +33,7 @@ class BD500: public DiskController {
|
||||
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
|
||||
private:
|
||||
private:
|
||||
void set_head_load_request(bool head_load) final;
|
||||
bool is_loading_head_ = false;
|
||||
Activity::Observer *observer_ = nullptr;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
namespace Oric {
|
||||
|
||||
class DiskController: public WD::WD1770 {
|
||||
public:
|
||||
public:
|
||||
DiskController(WD::WD1770::Personality personality, int clock_rate, Storage::Disk::Drive::ReadyType ready_type) :
|
||||
WD::WD1770(personality), clock_rate_(clock_rate), ready_type_(ready_type) {
|
||||
emplace_drives(4, clock_rate_, 300, 2, ready_type_);
|
||||
@@ -40,7 +40,7 @@ class DiskController: public WD::WD1770 {
|
||||
return paged_item_;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
Delegate *delegate_ = nullptr;
|
||||
|
||||
void set_paged_item(PagedItem item) {
|
||||
@@ -51,7 +51,7 @@ class DiskController: public WD::WD1770 {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
PagedItem paged_item_ = PagedItem::DiskROM;
|
||||
int clock_rate_;
|
||||
Storage::Disk::Drive::ReadyType ready_type_;
|
||||
|
@@ -15,14 +15,14 @@
|
||||
namespace Oric {
|
||||
|
||||
class Jasmin: public DiskController {
|
||||
public:
|
||||
public:
|
||||
Jasmin();
|
||||
|
||||
void write(int address, uint8_t value);
|
||||
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
|
||||
private:
|
||||
private:
|
||||
void set_motor_on(bool on) final;
|
||||
bool motor_on_ = false;
|
||||
uint8_t selected_drives_ = 0;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
namespace Oric {
|
||||
|
||||
class Microdisc: public DiskController {
|
||||
public:
|
||||
public:
|
||||
Microdisc();
|
||||
|
||||
void set_control_register(uint8_t control);
|
||||
@@ -28,7 +28,7 @@ class Microdisc: public DiskController {
|
||||
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
|
||||
private:
|
||||
private:
|
||||
void set_head_load_request(bool head_load) final;
|
||||
|
||||
void set_control_register(uint8_t control, uint8_t changes);
|
||||
|
@@ -47,7 +47,7 @@ namespace {
|
||||
Provides an Altai-style joystick.
|
||||
*/
|
||||
class Joystick: public Inputs::ConcreteJoystick {
|
||||
public:
|
||||
public:
|
||||
Joystick() :
|
||||
ConcreteJoystick({
|
||||
Input(Input::Up),
|
||||
@@ -76,7 +76,7 @@ class Joystick: public Inputs::ConcreteJoystick {
|
||||
return state_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t state_ = 0xff;
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ enum ROM {
|
||||
logical OR of every key selected by the column mask on the active row.
|
||||
*/
|
||||
class Keyboard {
|
||||
public:
|
||||
public:
|
||||
struct SpecialKeyHandler {
|
||||
virtual void perform_special_key(Oric::Key key) = 0;
|
||||
};
|
||||
@@ -145,7 +145,7 @@ class Keyboard {
|
||||
return !!(rows_[row_] & column_mask);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t row_ = 0;
|
||||
uint8_t rows_[8];
|
||||
SpecialKeyHandler *const special_key_handler_;
|
||||
@@ -156,7 +156,7 @@ class Keyboard {
|
||||
an instance of the Oric tape parser, to provide fast-tape loading.
|
||||
*/
|
||||
class TapePlayer: public Storage::Tape::BinaryTapePlayer {
|
||||
public:
|
||||
public:
|
||||
TapePlayer() : Storage::Tape::BinaryTapePlayer(1000000) {}
|
||||
|
||||
/*!
|
||||
@@ -171,7 +171,7 @@ class TapePlayer: public Storage::Tape::BinaryTapePlayer {
|
||||
return uint8_t(parser_.get_next_byte(*serialiser(), use_fast_encoding));
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::Tape::Oric::Parser parser_;
|
||||
};
|
||||
|
||||
@@ -180,7 +180,7 @@ class TapePlayer: public Storage::Tape::BinaryTapePlayer {
|
||||
to the AY, the tape's motor control signal and the keyboard.
|
||||
*/
|
||||
class VIAPortHandler: public MOS::MOS6522::IRQDelegatePortHandler {
|
||||
public:
|
||||
public:
|
||||
VIAPortHandler(Concurrency::AsyncTaskQueue<false> &audio_queue, AY &ay8910, Speaker &speaker, TapePlayer &tape_player, Keyboard &keyboard) :
|
||||
audio_queue_(audio_queue), ay8910_(ay8910), speaker_(speaker), tape_player_(tape_player), keyboard_(keyboard)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ class VIAPortHandler: public MOS::MOS6522::IRQDelegatePortHandler {
|
||||
return joysticks_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void update_ay() {
|
||||
speaker_.run_for(audio_queue_, cycles_since_ay_update_.flush<Cycles>());
|
||||
}
|
||||
@@ -282,7 +282,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface, CPU::MOS
|
||||
public Machine,
|
||||
public Keyboard::SpecialKeyHandler {
|
||||
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::Oric::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
m6502_(*this),
|
||||
video_(ram_.data()),
|
||||
@@ -707,7 +707,7 @@ template <Analyser::Static::Oric::Target::DiskInterface disk_interface, CPU::MOS
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
const uint16_t basic_invisible_ram_top_ = 0xffff;
|
||||
const uint16_t basic_visible_ram_top_ = 0xbfff;
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
namespace Oric {
|
||||
|
||||
class VideoOutput {
|
||||
public:
|
||||
public:
|
||||
VideoOutput(uint8_t *memory);
|
||||
void set_colour_rom(const std::vector<uint8_t> &colour_rom);
|
||||
|
||||
@@ -34,7 +34,7 @@ class VideoOutput {
|
||||
|
||||
void register_crt_frequency_mismatch();
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t *ram_;
|
||||
Outputs::CRT::CRT crt_;
|
||||
Outputs::CRT::CRTFrequencyMismatchWarner<VideoOutput> frequency_mismatch_warner_;
|
||||
|
@@ -37,7 +37,7 @@ enum Key: uint16_t {
|
||||
};
|
||||
|
||||
class Keyboard {
|
||||
public:
|
||||
public:
|
||||
Keyboard(Machine machine);
|
||||
|
||||
void set_key_state(uint16_t key, bool is_pressed);
|
||||
@@ -45,29 +45,29 @@ class Keyboard {
|
||||
|
||||
uint8_t read(uint16_t address);
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t key_states_[8];
|
||||
const Machine machine_;
|
||||
};
|
||||
|
||||
class KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||
public:
|
||||
public:
|
||||
KeyboardMapper(Machine machine);
|
||||
|
||||
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const override;
|
||||
|
||||
private:
|
||||
private:
|
||||
const Machine machine_;
|
||||
};
|
||||
|
||||
class CharacterMapper: public ::Utility::CharacterMapper {
|
||||
public:
|
||||
public:
|
||||
CharacterMapper(Machine machine);
|
||||
const uint16_t *sequence_for_character(char character) const override;
|
||||
|
||||
bool needs_pause_after_key(uint16_t key) const override;
|
||||
|
||||
private:
|
||||
private:
|
||||
const Machine machine_;
|
||||
};
|
||||
|
||||
|
@@ -24,7 +24,7 @@ namespace Sinclair::ZX8081 {
|
||||
and the black level.
|
||||
*/
|
||||
class Video {
|
||||
public:
|
||||
public:
|
||||
/// Constructs an instance of the video feed.
|
||||
Video();
|
||||
|
||||
@@ -46,7 +46,7 @@ class Video {
|
||||
/// Gets the current scan status.
|
||||
Outputs::Display::ScanStatus get_scaled_scan_status() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool sync_ = false;
|
||||
uint8_t *line_data_ = nullptr;
|
||||
uint8_t *line_data_pointer_ = nullptr;
|
||||
|
@@ -61,7 +61,7 @@ template<bool is_zx81> class ConcreteMachine:
|
||||
public Utility::TypeRecipient<CharacterMapper>,
|
||||
public CPU::Z80::BusHandler,
|
||||
public Machine {
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::ZX8081::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
Utility::TypeRecipient<CharacterMapper>(keyboard_machine()),
|
||||
z80_(*this),
|
||||
@@ -397,7 +397,7 @@ template<bool is_zx81> class ConcreteMachine:
|
||||
set_use_fast_tape();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::Z80::Processor<ConcreteMachine, false, is_zx81> z80_;
|
||||
Video video_;
|
||||
|
||||
|
@@ -48,7 +48,7 @@ enum class Timing {
|
||||
*/
|
||||
|
||||
template <Timing timing> class Video {
|
||||
private:
|
||||
private:
|
||||
struct Timings {
|
||||
// Number of cycles per line. Will be 224 or 228.
|
||||
int half_cycles_per_line;
|
||||
@@ -113,7 +113,7 @@ template <Timing timing> class Video {
|
||||
// Interrupt should be held for 32 cycles.
|
||||
static constexpr int interrupt_duration = 64;
|
||||
|
||||
public:
|
||||
public:
|
||||
void run_for(HalfCycles duration) {
|
||||
static constexpr auto timings = get_timings();
|
||||
|
||||
@@ -255,7 +255,7 @@ template <Timing timing> class Video {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static constexpr int half_cycles_per_line() {
|
||||
if constexpr (timing == Timing::FortyEightK) {
|
||||
// TODO: determine real figure here, if one exists.
|
||||
@@ -301,7 +301,7 @@ template <Timing timing> class Video {
|
||||
run_for(frame_duration() - now + time);
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
Video() :
|
||||
crt_(half_cycles_per_line(), 2, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red2Green2Blue2)
|
||||
{
|
||||
@@ -434,7 +434,7 @@ template <Timing timing> class Video {
|
||||
return crt_.get_display_type();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int time_into_frame_ = 0;
|
||||
Outputs::CRT::CRT crt_;
|
||||
const uint8_t *memory_ = nullptr;
|
||||
|
@@ -48,7 +48,7 @@ namespace {
|
||||
Provides a simultaneous Kempston and Interface 2-style joystick.
|
||||
*/
|
||||
class Joystick: public Inputs::ConcreteJoystick {
|
||||
public:
|
||||
public:
|
||||
Joystick() :
|
||||
ConcreteJoystick({
|
||||
Input(Input::Up),
|
||||
@@ -104,7 +104,7 @@ class Joystick: public Inputs::ConcreteJoystick {
|
||||
return uint8_t(sinclair_ >> (port * 8));
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t kempston_ = 0x00;
|
||||
uint16_t sinclair_ = 0xffff;
|
||||
};
|
||||
@@ -131,7 +131,7 @@ template<Model model> class ConcreteMachine:
|
||||
public MachineTypes::ScanProducer,
|
||||
public MachineTypes::TimedMachine,
|
||||
public Utility::TypeRecipient<CharacterMapper> {
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::ZXSpectrum::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
Utility::TypeRecipient<CharacterMapper>(Sinclair::ZX::Keyboard::Machine::ZXSpectrum),
|
||||
z80_(*this),
|
||||
@@ -612,7 +612,7 @@ template<Model model> class ConcreteMachine:
|
||||
return HalfCycles(0);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void advance(HalfCycles duration) {
|
||||
time_since_audio_update_ += duration;
|
||||
|
||||
@@ -649,7 +649,7 @@ template<Model model> class ConcreteMachine:
|
||||
return Utility::TypeRecipient<CharacterMapper>::can_type(c);
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
// MARK: - Typer.
|
||||
HalfCycles get_typer_delay(const std::string &) const override {
|
||||
@@ -756,7 +756,7 @@ template<Model model> class ConcreteMachine:
|
||||
tape_player_.set_activity_observer(observer);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::Z80::Processor<ConcreteMachine, false, false> z80_;
|
||||
|
||||
// MARK: - Memory.
|
||||
@@ -995,7 +995,6 @@ template<Model model> class ConcreteMachine:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@ enum Name {
|
||||
AcornADFS,
|
||||
PRESAdvancedPlus6,
|
||||
Acorn1770DFS,
|
||||
AcornIDEADFS103,
|
||||
|
||||
// Acorn Archimedes.
|
||||
AcornArthur030,
|
||||
@@ -223,8 +224,20 @@ struct Description {
|
||||
|
||||
private:
|
||||
template <typename FileNameT, typename CRC32T> Description(
|
||||
Name name, std::string machine_name, std::string descriptive_name, FileNameT file_names, size_t size, CRC32T crc32s = uint32_t(0)
|
||||
) : name{name}, machine_name{machine_name}, descriptive_name{descriptive_name}, file_names{file_names}, size{size}, crc32s{crc32s} {
|
||||
const Name name,
|
||||
const char *machine_name,
|
||||
const char *descriptive_name,
|
||||
const FileNameT &file_names,
|
||||
const size_t size,
|
||||
const CRC32T crc32s = uint32_t(0)
|
||||
) :
|
||||
name{name},
|
||||
machine_name{machine_name},
|
||||
descriptive_name{descriptive_name},
|
||||
file_names{file_names},
|
||||
size{size},
|
||||
crc32s{crc32s}
|
||||
{
|
||||
// Slightly lazy: deal with the case where the constructor wasn't provided with any
|
||||
// CRCs by spotting that the set has exactly one member, which has value 0. The alternative
|
||||
// would be to provide a partial specialisation that never put anything into the set.
|
||||
@@ -232,6 +245,8 @@ private:
|
||||
this->crc32s.clear();
|
||||
}
|
||||
}
|
||||
|
||||
static const std::vector<Description> &all_roms();
|
||||
};
|
||||
|
||||
/// @returns a vector of all possible instances of ROM::Description — i.e. descriptions of every ROM
|
||||
|
@@ -16,7 +16,7 @@ namespace Numeric {
|
||||
/// keeping the least-significant bit in its original position.
|
||||
///
|
||||
/// i.e. if @c input is abcdefgh then the result is 0a0b0c0d0e0f0g0h
|
||||
constexpr uint16_t spread_bits(uint8_t input) {
|
||||
constexpr uint16_t spread_bits(const uint8_t input) {
|
||||
uint16_t result = uint16_t(input); // 0000 0000 abcd efgh
|
||||
result = (result | (result << 4)) & 0x0f0f; // 0000 abcd 0000 efgh
|
||||
result = (result | (result << 2)) & 0x3333; // 00ab 00cd 00ef 00gh
|
||||
@@ -26,11 +26,12 @@ constexpr uint16_t spread_bits(uint8_t input) {
|
||||
/// Performs the opposite action to @c spread_bits; given the 16-bit input
|
||||
/// @c abcd @c efgh @c ijkl @c mnop, returns the byte value @c bdfhjlnp
|
||||
/// i.e. every other bit is retained, keeping the least-significant bit in place.
|
||||
constexpr uint8_t unspread_bits(uint16_t input) {
|
||||
input &= 0x5555; // 0a0b 0c0d 0e0f 0g0h
|
||||
input = (input | (input >> 1)) & 0x3333; // 00ab 00cd 00ef 00gh
|
||||
input = (input | (input >> 2)) & 0x0f0f; // 0000 abcd 0000 efgh
|
||||
return uint8_t(input | (input >> 4)); // 0000 0000 abcd efgh
|
||||
constexpr uint8_t unspread_bits(const uint16_t input) {
|
||||
uint16_t result = input;
|
||||
result &= 0x5555; // 0a0b 0c0d 0e0f 0g0h
|
||||
result = (result | (result >> 1)) & 0x3333; // 00ab 00cd 00ef 00gh
|
||||
result = (result | (result >> 2)) & 0x0f0f; // 0000 abcd 0000 efgh
|
||||
return uint8_t(result | (result >> 4)); // 0000 0000 abcd efgh
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
An initial value of 0 is invalid.
|
||||
*/
|
||||
LFSR(IntType initial_value) : value_(initial_value) {}
|
||||
LFSR(const IntType initial_value) : value_(initial_value) {}
|
||||
|
||||
/*!
|
||||
Advances the LSFR, returning either an @c IntType of value @c 1 or @c 0,
|
||||
|
@@ -30,13 +30,13 @@ namespace Numeric {
|
||||
template <int... Sizes> class NumericCoder {
|
||||
public:
|
||||
/// Modifies @c target to hold @c value at @c index.
|
||||
template <int index> static void encode(int &target, int value) {
|
||||
template <int index> static void encode(int &target, const int value) {
|
||||
static_assert(index < sizeof...(Sizes), "Index must be within range");
|
||||
NumericEncoder<Sizes...>::template encode<index>(target, value);
|
||||
}
|
||||
|
||||
/// @returns The value from @c source at @c index.
|
||||
template <int index> static int decode(int source) {
|
||||
template <int index> static int decode(const int source) {
|
||||
static_assert(index < sizeof...(Sizes), "Index must be within range");
|
||||
return NumericDecoder<Sizes...>::template decode<index>(source);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
|
||||
template <int size, int... Tail>
|
||||
struct NumericEncoder {
|
||||
template <int index, int i = 0, int divider = 1> static void encode(int &target, int value) {
|
||||
template <int index, int i = 0, int divider = 1> static void encode(int &target, const int value) {
|
||||
if constexpr (i == index) {
|
||||
const int suffix = target % divider;
|
||||
target /= divider;
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
|
||||
template <int size, int... Tail>
|
||||
struct NumericDecoder {
|
||||
template <int index, int i = 0, int divider = 1> static int decode(int source) {
|
||||
template <int index, int i = 0, int divider = 1> static int decode(const int source) {
|
||||
if constexpr (i == index) {
|
||||
return (source / divider) % size;
|
||||
} else {
|
||||
|
@@ -62,7 +62,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
enableASanStackUseAfterReturn = "YES"
|
||||
|
@@ -76,7 +76,7 @@ enum class EnabledLevel {
|
||||
|
||||
constexpr EnabledLevel enabled_level(const Source source) {
|
||||
#ifdef NDEBUG
|
||||
return false;
|
||||
return EnabledLevel::None;
|
||||
#endif
|
||||
|
||||
// Allow for compile-time source-level enabling and disabling of different sources.
|
||||
|
@@ -24,7 +24,7 @@ GLuint Shader::compile_shader(const std::string &source, GLenum type) {
|
||||
test_gl(glShaderSource, shader, 1, &c_str, NULL);
|
||||
test_gl(glCompileShader, shader);
|
||||
|
||||
if constexpr (logger.enabled) {
|
||||
if constexpr (logger.ErrorsEnabled) {
|
||||
GLint isCompiled = 0;
|
||||
test_gl(glGetShaderiv, shader, GL_COMPILE_STATUS, &isCompiled);
|
||||
if(isCompiled == GL_FALSE) {
|
||||
@@ -69,7 +69,7 @@ void Shader::init(const std::string &vertex_shader, const std::string &fragment_
|
||||
for(const auto &binding : attribute_bindings) {
|
||||
test_gl(glBindAttribLocation, shader_program_, binding.index, binding.name.c_str());
|
||||
|
||||
if constexpr (logger.enabled) {
|
||||
if constexpr (logger.ErrorsEnabled) {
|
||||
const auto error = glGetError();
|
||||
switch(error) {
|
||||
case 0: break;
|
||||
@@ -88,7 +88,7 @@ void Shader::init(const std::string &vertex_shader, const std::string &fragment_
|
||||
|
||||
test_gl(glLinkProgram, shader_program_);
|
||||
|
||||
if constexpr (logger.enabled) {
|
||||
if constexpr (logger.ErrorsEnabled) {
|
||||
GLint logLength;
|
||||
test_gl(glGetProgramiv, shader_program_, GL_INFO_LOG_LENGTH, &logLength);
|
||||
if(logLength > 0) {
|
||||
|
@@ -8,7 +8,8 @@ DFS-1770-2.20.rom — used only if the user opens a DFS disk image
|
||||
ADFS-E00_1.rom — used only if the user opens an ADFS disk image
|
||||
ADFS-E00_2.rom
|
||||
AP6v133.rom — used only if the user opens a disk image that makes use of any of the commands given below.
|
||||
adfs.rom - used only if the user opens a hard disk image
|
||||
adfs.rom — used only if the user opens a hard disk image or requests a SCSI interface
|
||||
ELK103.rom — used only if the user requests an IDE interface
|
||||
|
||||
Possibly to be desired in the future:
|
||||
* os300.rom
|
||||
|
Reference in New Issue
Block a user