mirror of
https://github.com/TomHarte/CLK.git
synced 2025-09-14 14:24:32 +00:00
Merge pull request #1425 from TomHarte/MoreIndentation
Take another big swing at indentation, some `const`s.
This commit is contained in:
@@ -285,7 +285,7 @@ private:
|
||||
automatically to gain run_for(HalfCycles).
|
||||
*/
|
||||
template <class T> class HalfClockReceiver: public T {
|
||||
public:
|
||||
public:
|
||||
using T::T;
|
||||
|
||||
forceinline void run_for(const HalfCycles half_cycles) {
|
||||
@@ -293,6 +293,6 @@ template <class T> class HalfClockReceiver: public T {
|
||||
T::run_for(half_cycles_.flush<Cycles>());
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
HalfCycles half_cycles_;
|
||||
};
|
||||
|
@@ -98,7 +98,7 @@ private:
|
||||
This list is efficient only for short queues.
|
||||
*/
|
||||
template <typename TimeUnit> class DeferredQueuePerformer: public DeferredQueue<TimeUnit> {
|
||||
public:
|
||||
public:
|
||||
/// Constructs a DeferredQueue that will call target(period) in between deferred actions.
|
||||
constexpr DeferredQueuePerformer(std::function<void(TimeUnit)> &&target) : target_(std::move(target)) {}
|
||||
|
||||
@@ -120,6 +120,6 @@ template <typename TimeUnit> class DeferredQueuePerformer: public DeferredQueue<
|
||||
target_(length);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
std::function<void(TimeUnit)> target_;
|
||||
};
|
||||
|
@@ -192,7 +192,7 @@ constexpr SpriteMode sprite_mode(ScreenMode screen_mode) {
|
||||
// TODO: should this be extended to include Master System sprites?
|
||||
template <Personality personality, SpriteMode mode>
|
||||
class SpriteFetcher {
|
||||
public:
|
||||
public:
|
||||
using AddressT = typename Base<personality>::AddressT;
|
||||
|
||||
// The Yamaha VDP adds an additional table when in Sprite Mode 2, the sprite colour
|
||||
@@ -239,7 +239,7 @@ class SpriteFetcher {
|
||||
base->posit_sprite(sprite, sprite_y, y);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void fetch_xy(int slot) {
|
||||
auto &buffer = *base->fetch_sprite_buffer_;
|
||||
buffer.active_sprites[slot].x =
|
||||
|
@@ -439,7 +439,7 @@ struct Storage<personality, std::enable_if_t<is_yamaha_vdp(personality)>>:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static constexpr auto refresh_events = events<RefreshGenerator>();
|
||||
static constexpr auto no_sprites_events = events<BitmapGenerator<false>>();
|
||||
static constexpr auto sprites_events = events<BitmapGenerator<true>>();
|
||||
|
@@ -20,7 +20,7 @@
|
||||
namespace Yamaha::OPL {
|
||||
|
||||
class OPLL: public OPLBase<OPLL, false> {
|
||||
public:
|
||||
public:
|
||||
/// Creates a new OPLL or VRC7.
|
||||
OPLL(Concurrency::AsyncTaskQueue<false> &task_queue, int audio_divider = 1, bool is_vrc7 = false);
|
||||
|
||||
@@ -37,7 +37,7 @@ class OPLL: public OPLBase<OPLL, false> {
|
||||
/// Reads from the OPL.
|
||||
uint8_t read(uint16_t address);
|
||||
|
||||
private:
|
||||
private:
|
||||
friend OPLBase<OPLL, false>;
|
||||
void write_register(uint8_t address, uint8_t value);
|
||||
|
||||
|
@@ -26,14 +26,14 @@ template <typename Performer> struct TaskQueueStorage {
|
||||
|
||||
Performer performer;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void update() {
|
||||
auto time_now = Time::nanos_now();
|
||||
performer.perform(time_now - last_fired_);
|
||||
last_fired_ = time_now;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Time::Nanos last_fired_;
|
||||
};
|
||||
|
||||
|
@@ -45,7 +45,7 @@ enum class Mode {
|
||||
/// Appropriate prefetch offsets are left to other code to handle.
|
||||
/// This is to try to keep this structure independent of a specific ARM implementation.
|
||||
struct Registers {
|
||||
public:
|
||||
public:
|
||||
// Don't allow copying.
|
||||
Registers(const Registers &) = delete;
|
||||
Registers &operator =(const Registers &) = delete;
|
||||
@@ -366,7 +366,7 @@ struct Registers {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Mode mode_ = Mode::Supervisor;
|
||||
|
||||
uint32_t zero_result_ = 1;
|
||||
|
@@ -233,10 +233,10 @@ private:
|
||||
//
|
||||
// So here's a thin non-templated shim to unblock initial PC Compatible development.
|
||||
class Decoder8086 {
|
||||
public:
|
||||
public:
|
||||
std::pair<int, Instruction<false>> decode(const uint8_t *source, std::size_t length);
|
||||
|
||||
private:
|
||||
private:
|
||||
Decoder<Model::i8086> decoder;
|
||||
};
|
||||
|
||||
|
@@ -563,7 +563,7 @@ constexpr Operation rep_operation(Operation operation, Repetition repetition) {
|
||||
///
|
||||
/// It cannot natively describe a base of ::None.
|
||||
class ScaleIndexBase {
|
||||
public:
|
||||
public:
|
||||
constexpr ScaleIndexBase() noexcept = default;
|
||||
constexpr ScaleIndexBase(uint8_t sib) noexcept : sib_(sib) {}
|
||||
constexpr ScaleIndexBase(int scale, Source index, Source base) noexcept :
|
||||
@@ -614,7 +614,7 @@ class ScaleIndexBase {
|
||||
return sib_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// Data is stored directly as an 80386 SIB byte.
|
||||
uint8_t sib_ = 0;
|
||||
};
|
||||
@@ -632,7 +632,7 @@ static_assert(alignof(ScaleIndexBase) == 1);
|
||||
///
|
||||
/// In all cases, the applicable segment is indicated by the instruction.
|
||||
class DataPointer {
|
||||
public:
|
||||
public:
|
||||
/// Constricts a DataPointer referring to the given source; it shouldn't be ::Indirect.
|
||||
constexpr DataPointer(Source source) noexcept : source_(source) {}
|
||||
|
||||
@@ -692,7 +692,7 @@ class DataPointer {
|
||||
return sib_.base();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Source source_ = Source::Indirect;
|
||||
ScaleIndexBase sib_;
|
||||
};
|
||||
|
@@ -51,7 +51,7 @@ class ConcreteMachine:
|
||||
public Activity::Source,
|
||||
public Configurable::Device
|
||||
{
|
||||
private:
|
||||
private:
|
||||
Log::Logger<Log::Source::Archimedes> logger;
|
||||
|
||||
// This fictitious clock rate just means '24 MIPS, please'; it's divided elsewhere.
|
||||
@@ -110,7 +110,7 @@ class ConcreteMachine:
|
||||
tick_cpu();
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(
|
||||
const Analyser::Static::Acorn::ArchimedesTarget &target,
|
||||
const ROMMachine::ROMFetcher &rom_fetcher
|
||||
@@ -355,7 +355,7 @@ class ConcreteMachine:
|
||||
video_divider_ = executor_.bus.video().clock_divider();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// MARK: - ScanProducer.
|
||||
void set_scan_target(Outputs::Display::ScanTarget *scan_target) override {
|
||||
executor_.bus.video().crt().set_scan_target(scan_target);
|
||||
|
@@ -236,7 +236,7 @@ struct MemoryController {
|
||||
ioc_.set_activity_observer(observer);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Log::Logger<Log::Source::ARMIOC> logger;
|
||||
|
||||
enum class ReadZone {
|
||||
|
@@ -50,7 +50,7 @@ template <bool has_scsi_bus> class ConcreteMachine:
|
||||
public Activity::Source,
|
||||
public SCSI::Bus::Observer,
|
||||
public ClockingHint::Observer {
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::Acorn::ElectronTarget &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
m6502_(*this),
|
||||
scsi_bus_(4'000'000),
|
||||
@@ -621,7 +621,7 @@ template <bool has_scsi_bus> class ConcreteMachine:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
enum class ROM {
|
||||
Slot0 = 0,
|
||||
Slot1, Slot2, Slot3,
|
||||
|
@@ -14,19 +14,19 @@
|
||||
namespace Electron {
|
||||
|
||||
class Plus3 final : public WD::WD1770 {
|
||||
public:
|
||||
public:
|
||||
Plus3();
|
||||
|
||||
void set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive);
|
||||
void set_disk(std::shared_ptr<Storage::Disk::Disk>, size_t drive);
|
||||
void set_control_register(uint8_t control);
|
||||
void set_activity_observer(Activity::Observer *observer);
|
||||
void set_activity_observer(Activity::Observer *);
|
||||
|
||||
private:
|
||||
private:
|
||||
void set_control_register(uint8_t control, uint8_t changes);
|
||||
uint8_t last_control_ = 0;
|
||||
|
||||
void set_motor_on(bool on) override;
|
||||
std::string drive_name(size_t drive);
|
||||
void set_motor_on(bool) override;
|
||||
std::string drive_name(size_t);
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -14,21 +14,20 @@
|
||||
namespace Electron {
|
||||
|
||||
class SoundGenerator: public ::Outputs::Speaker::BufferSource<SoundGenerator, false> {
|
||||
public:
|
||||
SoundGenerator(Concurrency::AsyncTaskQueue<false> &audio_queue);
|
||||
public:
|
||||
SoundGenerator(Concurrency::AsyncTaskQueue<false> &);
|
||||
|
||||
void set_divider(uint8_t divider);
|
||||
|
||||
void set_is_enabled(bool is_enabled);
|
||||
void set_divider(uint8_t);
|
||||
void set_is_enabled(bool);
|
||||
|
||||
static constexpr unsigned int clock_rate_divider = 8;
|
||||
|
||||
// For BufferSource.
|
||||
template <Outputs::Speaker::Action action>
|
||||
void apply_samples(std::size_t number_of_samples, Outputs::Speaker::MonoSample *target);
|
||||
void apply_samples(std::size_t number_of_samples, Outputs::Speaker::MonoSample *);
|
||||
void set_sample_volume_range(std::int16_t range);
|
||||
|
||||
private:
|
||||
private:
|
||||
Concurrency::AsyncTaskQueue<false> &audio_queue_;
|
||||
unsigned int counter_ = 0;
|
||||
unsigned int divider_ = 0;
|
||||
|
@@ -20,7 +20,7 @@ namespace Electron {
|
||||
class Tape:
|
||||
public Storage::Tape::TapePlayer,
|
||||
public Storage::Tape::Acorn::Shifter::Delegate {
|
||||
public:
|
||||
public:
|
||||
Tape();
|
||||
|
||||
void run_for(const Cycles cycles);
|
||||
@@ -45,7 +45,7 @@ class Tape:
|
||||
|
||||
void acorn_shifter_output_bit(int value);
|
||||
|
||||
private:
|
||||
private:
|
||||
void process_input_pulse(const Storage::Tape::Tape::Pulse &pulse);
|
||||
inline void push_tape_bit(uint16_t bit);
|
||||
inline void get_next_tape_pulse();
|
||||
|
@@ -24,7 +24,7 @@ namespace Electron {
|
||||
is accessing it the CPU may not.
|
||||
*/
|
||||
class VideoOutput {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Instantiates a VideoOutput that will read its pixels from @c memory.
|
||||
|
||||
@@ -76,7 +76,7 @@ class VideoOutput {
|
||||
*/
|
||||
unsigned int get_cycles_until_next_ram_availability(int from_time);
|
||||
|
||||
private:
|
||||
private:
|
||||
const uint8_t *ram_ = nullptr;
|
||||
|
||||
// CRT output
|
||||
|
@@ -50,7 +50,7 @@ class ConcreteMachine:
|
||||
public MachineTypes::ScanProducer,
|
||||
public MachineTypes::TimedMachine,
|
||||
public Machine {
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::Amiga::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
mc68000_(*this),
|
||||
memory_(target.chip_ram, target.fast_ram),
|
||||
@@ -175,7 +175,7 @@ class ConcreteMachine:
|
||||
return total_length - cycle.length;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::MC68000::Processor<ConcreteMachine, true, true> mc68000_;
|
||||
|
||||
// MARK: - Memory map.
|
||||
@@ -244,7 +244,7 @@ class ConcreteMachine:
|
||||
void clear_all_keys() {
|
||||
chipset_.get_keyboard().clear_all_keys();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
namespace Amiga {
|
||||
|
||||
class Audio: public DMADevice<4> {
|
||||
public:
|
||||
public:
|
||||
Audio(Chipset &chipset, uint16_t *ram, size_t word_size, float output_rate);
|
||||
|
||||
/// Idiomatic call-in for DMA scheduling; indicates that this class may
|
||||
@@ -61,7 +61,7 @@ class Audio: public DMADevice<4> {
|
||||
return &speaker_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
struct Channel {
|
||||
// The data latch plus a count of unused samples
|
||||
// in the latch, which will always be 0, 1 or 2.
|
||||
|
@@ -31,14 +31,14 @@ struct BitplaneData: public std::array<uint16_t, 6> {
|
||||
};
|
||||
|
||||
class Bitplanes: public DMADevice<6, 2> {
|
||||
public:
|
||||
public:
|
||||
using DMADevice::DMADevice;
|
||||
|
||||
bool advance_dma(int cycle);
|
||||
void do_end_of_line();
|
||||
void set_control(uint16_t);
|
||||
|
||||
private:
|
||||
private:
|
||||
bool is_high_res_ = false;
|
||||
int plane_count_ = 0;
|
||||
|
||||
@@ -55,7 +55,7 @@ template <typename SourceT> constexpr SourceT bitplane_swizzle(SourceT value) {
|
||||
}
|
||||
|
||||
class BitplaneShifter {
|
||||
public:
|
||||
public:
|
||||
/// Installs a new set of output pixels.
|
||||
void set(
|
||||
const BitplaneData &previous,
|
||||
@@ -91,7 +91,7 @@ class BitplaneShifter {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
std::array<uint64_t, 2> data_{};
|
||||
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@ namespace Amiga {
|
||||
and can subsequently be retrieved. This is included for testing purposes.
|
||||
*/
|
||||
template <bool record_bus = false> class Blitter: public DMADevice<4, 4> {
|
||||
public:
|
||||
public:
|
||||
using DMADevice::DMADevice;
|
||||
|
||||
template <int id, int shift> void set_pointer(uint16_t value) {
|
||||
@@ -84,7 +84,7 @@ template <bool record_bus = false> class Blitter: public DMADevice<4, 4> {
|
||||
};
|
||||
std::vector<Transaction> get_and_reset_transactions();
|
||||
|
||||
private:
|
||||
private:
|
||||
int width_ = 0, height_ = 0;
|
||||
int shifts_[2]{};
|
||||
uint16_t a_mask_[2] = {0xffff, 0xffff};
|
||||
|
@@ -19,7 +19,7 @@ namespace Amiga {
|
||||
relying on tables.
|
||||
*/
|
||||
class BlitterSequencer {
|
||||
public:
|
||||
public:
|
||||
enum class Channel {
|
||||
/// Tells the caller to calculate and load a new piece of output
|
||||
/// into the output pipeline.
|
||||
@@ -107,7 +107,7 @@ class BlitterSequencer {
|
||||
return control_ & (8 >> channel);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static constexpr std::array<Channel, 1> pattern0 = { Channel::None };
|
||||
static constexpr std::array<Channel, 2> pattern1 = { Channel::Write, Channel::None };
|
||||
static constexpr std::array<Channel, 2> pattern2 = { Channel::C, Channel::None };
|
||||
|
@@ -37,7 +37,7 @@
|
||||
namespace Amiga {
|
||||
|
||||
class Chipset: private ClockingHint::Observer {
|
||||
public:
|
||||
public:
|
||||
Chipset(MemoryMap &memory_map, int input_clock_rate);
|
||||
|
||||
struct Changes {
|
||||
@@ -111,7 +111,7 @@ class Chipset: private ClockingHint::Observer {
|
||||
return audio_.get_speaker();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class DMADeviceBase;
|
||||
|
||||
// MARK: - Register read/write functions.
|
||||
@@ -236,23 +236,23 @@ class Chipset: private ClockingHint::Observer {
|
||||
uint16_t swizzled_palette_[64]{};
|
||||
|
||||
// MARK: - Mouse.
|
||||
private:
|
||||
private:
|
||||
Mouse mouse_;
|
||||
|
||||
public:
|
||||
public:
|
||||
Inputs::Mouse &get_mouse() {
|
||||
return mouse_;
|
||||
}
|
||||
|
||||
// MARK: - Joystick.
|
||||
private:
|
||||
private:
|
||||
std::vector<std::unique_ptr<Inputs::Joystick>> joysticks_;
|
||||
Joystick &joystick(size_t index) const {
|
||||
return *static_cast<Joystick *>(joysticks_[index].get());
|
||||
}
|
||||
|
||||
// MARK: - CIAs.
|
||||
private:
|
||||
private:
|
||||
class DiskController;
|
||||
|
||||
class CIAAHandler: public MOS::MOS6526::PortHandler {
|
||||
@@ -288,7 +288,7 @@ class Chipset: private ClockingHint::Observer {
|
||||
DiskController &controller_;
|
||||
} cia_b_handler_;
|
||||
|
||||
public:
|
||||
public:
|
||||
using CIAA = MOS::MOS6526::MOS6526<CIAAHandler, MOS::MOS6526::Personality::P8250>;
|
||||
using CIAB = MOS::MOS6526::MOS6526<CIABHandler, MOS::MOS6526::Personality::P8250>;
|
||||
|
||||
@@ -297,7 +297,7 @@ class Chipset: private ClockingHint::Observer {
|
||||
CIAA cia_a;
|
||||
CIAB cia_b;
|
||||
|
||||
private:
|
||||
private:
|
||||
// MARK: - Disk drives.
|
||||
|
||||
class DiskDMA: public DMADevice<1> {
|
||||
@@ -361,7 +361,6 @@ class Chipset: private ClockingHint::Observer {
|
||||
Chipset &chipset_;
|
||||
DiskDMA &disk_dma_;
|
||||
CIAB &cia_;
|
||||
|
||||
} disk_controller_;
|
||||
friend DiskController;
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
namespace Amiga {
|
||||
|
||||
class Copper: public DMADevice<2> {
|
||||
public:
|
||||
public:
|
||||
using DMADevice<2>::DMADevice;
|
||||
|
||||
/// Offers a DMA slot to the Copper, specifying the current beam position and Blitter status.
|
||||
@@ -37,7 +37,7 @@ class Copper: public DMADevice<2> {
|
||||
state_ = State::Stopped;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint32_t address_ = 0;
|
||||
uint16_t control_ = 0;
|
||||
|
||||
|
@@ -32,7 +32,7 @@ class DMADeviceBase {
|
||||
};
|
||||
|
||||
template <size_t num_addresses, size_t num_modulos = 0> class DMADevice: public DMADeviceBase {
|
||||
public:
|
||||
public:
|
||||
using DMADeviceBase::DMADeviceBase;
|
||||
|
||||
/// Writes the word @c value to the address register @c id, shifting it by @c shift (0 or 16) first.
|
||||
@@ -58,13 +58,13 @@ template <size_t num_addresses, size_t num_modulos = 0> class DMADevice: public
|
||||
return uint16_t(source >> shift);
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// These are shifted right one to provide word-indexing pointers;
|
||||
// subclasses should use e.g. ram_[pointer_[0] & ram_mask_] directly.
|
||||
std::array<uint32_t, num_addresses> pointer_{};
|
||||
std::array<uint32_t, num_modulos> modulos_{};
|
||||
|
||||
private:
|
||||
private:
|
||||
std::array<uint32_t, num_addresses> byte_pointer_{};
|
||||
};
|
||||
|
||||
|
@@ -77,7 +77,7 @@ struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMappe
|
||||
};
|
||||
|
||||
class Keyboard {
|
||||
public:
|
||||
public:
|
||||
Keyboard(Serial::Line<true> &output);
|
||||
|
||||
// enum Lines: uint8_t {
|
||||
@@ -94,21 +94,21 @@ class Keyboard {
|
||||
output_.advance_writer(duration);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// enum class ShiftState {
|
||||
// Shifting,
|
||||
// AwaitingHandshake,
|
||||
// Idle,
|
||||
// } shift_state_ = ShiftState::Idle;
|
||||
|
||||
//
|
||||
// enum class State {
|
||||
// Startup,
|
||||
// } state_ = State::Startup;
|
||||
|
||||
//
|
||||
// int bit_phase_ = 0;
|
||||
// uint32_t shift_sequence_ = 0;
|
||||
// int bits_remaining_ = 0;
|
||||
|
||||
//
|
||||
// uint8_t lines_ = 0;
|
||||
|
||||
Serial::Line<true> &output_;
|
||||
|
@@ -17,12 +17,12 @@
|
||||
namespace Amiga {
|
||||
|
||||
class MemoryMap {
|
||||
private:
|
||||
private:
|
||||
static constexpr auto PermitRead = CPU::MC68000::Operation::PermitRead;
|
||||
static constexpr auto PermitWrite = CPU::MC68000::Operation::PermitWrite;
|
||||
static constexpr auto PermitReadWrite = PermitRead | PermitWrite;
|
||||
|
||||
public:
|
||||
public:
|
||||
std::array<uint8_t, 512*1024> kickstart{0xff};
|
||||
std::vector<uint8_t> chip_ram{};
|
||||
|
||||
@@ -170,7 +170,7 @@ class MemoryMap {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
std::vector<uint8_t> fast_ram_{};
|
||||
uint8_t fast_ram_size_ = 0;
|
||||
|
||||
|
@@ -22,11 +22,11 @@ struct MouseJoystickInput {
|
||||
};
|
||||
|
||||
class Mouse: public Inputs::Mouse, public MouseJoystickInput {
|
||||
public:
|
||||
public:
|
||||
uint16_t get_position() final;
|
||||
uint8_t get_cia_button() const final;
|
||||
|
||||
private:
|
||||
private:
|
||||
int get_number_of_buttons() const final;
|
||||
void set_button_pressed(int, bool) final;
|
||||
void reset_all_buttons() final;
|
||||
@@ -38,13 +38,13 @@ class Mouse: public Inputs::Mouse, public MouseJoystickInput {
|
||||
};
|
||||
|
||||
class Joystick: public Inputs::ConcreteJoystick, public MouseJoystickInput {
|
||||
public:
|
||||
public:
|
||||
Joystick();
|
||||
|
||||
uint16_t get_position() final;
|
||||
uint8_t get_cia_button() const final;
|
||||
|
||||
private:
|
||||
private:
|
||||
void did_set_input(const Input &input, bool is_active) final;
|
||||
|
||||
bool inputs_[Joystick::Input::Type::Max]{};
|
||||
|
@@ -15,7 +15,7 @@
|
||||
namespace Amiga {
|
||||
|
||||
class Sprite: public DMADevice<1> {
|
||||
public:
|
||||
public:
|
||||
using DMADevice::DMADevice;
|
||||
|
||||
void set_start_position(uint16_t value);
|
||||
@@ -29,12 +29,12 @@ class Sprite: public DMADevice<1> {
|
||||
bool visible = false;
|
||||
uint16_t h_start = 0;
|
||||
|
||||
private:
|
||||
private:
|
||||
uint16_t v_start_ = 0, v_stop_ = 0;
|
||||
};
|
||||
|
||||
class TwoSpriteShifter {
|
||||
public:
|
||||
public:
|
||||
/// Installs new pixel data for @c sprite (either 0 or 1),
|
||||
/// with @c delay being either 0 or 1 to indicate whether
|
||||
/// output should begin now or in one pixel's time.
|
||||
@@ -58,7 +58,7 @@ class TwoSpriteShifter {
|
||||
return uint8_t(data_ >> 56);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint64_t data_;
|
||||
uint8_t overflow_;
|
||||
};
|
||||
|
@@ -48,7 +48,7 @@ namespace AmstradCPC {
|
||||
Hsync and vsync signals are expected to come directly from the CRTC; they are not decoded from a composite stream.
|
||||
*/
|
||||
class InterruptTimer {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Indicates that a new hsync pulse has been recognised. This should be
|
||||
supplied on the falling edge of the CRTC HSYNC signal, which is the
|
||||
@@ -104,7 +104,7 @@ class InterruptTimer {
|
||||
interrupt_request_ = false;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int reset_counter_ = 0;
|
||||
bool interrupt_request_ = false;
|
||||
bool last_interrupt_request_ = false;
|
||||
@@ -117,7 +117,7 @@ class InterruptTimer {
|
||||
deferred clocking for this component.
|
||||
*/
|
||||
class AYDeferrer {
|
||||
public:
|
||||
public:
|
||||
/// Constructs a new AY instance and sets its clock rate.
|
||||
AYDeferrer() : ay_(GI::AY38910::Personality::AY38910, audio_queue_), speaker_(ay_) {
|
||||
speaker_.set_input_rate(1000000);
|
||||
@@ -155,7 +155,7 @@ class AYDeferrer {
|
||||
return ay_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Concurrency::AsyncTaskQueue<false> audio_queue_;
|
||||
GI::AY38910::AY38910<true> ay_;
|
||||
Outputs::Speaker::PullLowpass<GI::AY38910::AY38910<true>> speaker_;
|
||||
@@ -168,7 +168,7 @@ class AYDeferrer {
|
||||
generation and therefore owns details such as the current palette.
|
||||
*/
|
||||
class CRTCBusHandler {
|
||||
public:
|
||||
public:
|
||||
CRTCBusHandler(const uint8_t *ram, InterruptTimer &interrupt_timer) :
|
||||
crt_(1024, 1, Outputs::Display::Type::PAL50, Outputs::Display::InputDataType::Red2Green2Blue2),
|
||||
ram_(ram),
|
||||
@@ -372,7 +372,7 @@ class CRTCBusHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void output_border(int length) {
|
||||
assert(length >= 0);
|
||||
|
||||
@@ -583,7 +583,7 @@ using CRTC = Motorola::CRTC::CRTC6845<
|
||||
Also owns the joysticks.
|
||||
*/
|
||||
class KeyboardState: public GI::AY38910::PortHandler {
|
||||
public:
|
||||
public:
|
||||
KeyboardState() {
|
||||
joysticks_.emplace_back(new Joystick(rows_[9]));
|
||||
joysticks_.emplace_back(new Joystick(joy2_state_));
|
||||
@@ -627,7 +627,7 @@ class KeyboardState: public GI::AY38910::PortHandler {
|
||||
return joysticks_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t joy2_state_ = 0xff;
|
||||
uint8_t rows_[10] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
size_t row_ = 0;
|
||||
@@ -672,7 +672,7 @@ class KeyboardState: public GI::AY38910::PortHandler {
|
||||
Provides the mechanism of receipt for input and output of the 8255's various ports.
|
||||
*/
|
||||
class i8255PortHandler : public Intel::i8255::PortHandler {
|
||||
public:
|
||||
public:
|
||||
i8255PortHandler(
|
||||
KeyboardState &key_state,
|
||||
const CRTC &crtc,
|
||||
@@ -732,7 +732,7 @@ class i8255PortHandler : public Intel::i8255::PortHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
AYDeferrer &ay_;
|
||||
const CRTC &crtc_;
|
||||
KeyboardState &key_state_;
|
||||
@@ -756,7 +756,7 @@ class ConcreteMachine:
|
||||
public Configurable::Device,
|
||||
public Machine,
|
||||
public Activity::Source {
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::AmstradCPC::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
z80_(*this),
|
||||
crtc_bus_handler_(ram_, interrupt_timer_),
|
||||
@@ -1206,7 +1206,7 @@ class ConcreteMachine:
|
||||
return key_state_.get_joysticks();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
inline void write_to_gate_array(uint8_t value) {
|
||||
switch(value >> 6) {
|
||||
case 0: crtc_bus_handler_.select_pen(value & 0x1f); break;
|
||||
|
@@ -17,10 +17,10 @@ namespace Amstrad {
|
||||
exposes motor control, applying the same value to all drives.
|
||||
*/
|
||||
class FDC: public Intel::i8272::i8272 {
|
||||
private:
|
||||
private:
|
||||
Intel::i8272::BusHandler bus_handler_;
|
||||
|
||||
public:
|
||||
public:
|
||||
FDC(Cycles clock_rate = Cycles(8000000)) :
|
||||
i8272(bus_handler_, clock_rate)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ inline Command decode_command(uint8_t code) {
|
||||
update @c set_device_output.
|
||||
*/
|
||||
class Bus {
|
||||
public:
|
||||
public:
|
||||
Bus(HalfCycles clock_speed);
|
||||
|
||||
/*!
|
||||
@@ -142,7 +142,7 @@ class Bus {
|
||||
*/
|
||||
size_t add_device(Device *);
|
||||
|
||||
private:
|
||||
private:
|
||||
HalfCycles time_in_state_;
|
||||
mutable HalfCycles time_since_get_state_;
|
||||
|
||||
|
@@ -94,13 +94,13 @@ enum class Key: uint16_t {
|
||||
};
|
||||
|
||||
class Keyboard: public ReactiveDevice {
|
||||
public:
|
||||
public:
|
||||
Keyboard(Bus &);
|
||||
|
||||
bool set_key_pressed(Key key, bool is_pressed);
|
||||
void clear_all_keys();
|
||||
|
||||
private:
|
||||
private:
|
||||
void perform_command(const Command &command) override;
|
||||
void did_receive_data(const Command &, const std::vector<uint8_t> &) override;
|
||||
|
||||
|
@@ -14,10 +14,10 @@
|
||||
namespace Apple::ADB {
|
||||
|
||||
class Mouse: public ReactiveDevice, public Inputs::Mouse {
|
||||
public:
|
||||
public:
|
||||
Mouse(Bus &);
|
||||
|
||||
private:
|
||||
private:
|
||||
void perform_command(const Command &command) override;
|
||||
|
||||
void move(int x, int y) override;
|
||||
|
@@ -17,7 +17,7 @@
|
||||
namespace Apple::ADB {
|
||||
|
||||
class ReactiveDevice: public Bus::Device {
|
||||
protected:
|
||||
protected:
|
||||
ReactiveDevice(Bus &bus, uint8_t adb_device_id);
|
||||
|
||||
void post_response(const std::vector<uint8_t> &&response);
|
||||
@@ -27,11 +27,10 @@ class ReactiveDevice: public Bus::Device {
|
||||
virtual void perform_command(const Command &command) = 0;
|
||||
virtual void did_receive_data(const Command &, const std::vector<uint8_t> &) {}
|
||||
|
||||
private:
|
||||
private:
|
||||
void advance_state(double microseconds, bool current_level) override;
|
||||
void adb_bus_did_observe_event(Bus::Event event, uint8_t value) override;
|
||||
|
||||
private:
|
||||
Bus &bus_;
|
||||
const size_t device_id_;
|
||||
|
||||
|
@@ -98,7 +98,7 @@ struct StretchedAYPair:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int phase_ = 0;
|
||||
int subdivider_ = 0;
|
||||
};
|
||||
@@ -120,7 +120,7 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
|
||||
public Configurable::Device,
|
||||
public Activity::Source,
|
||||
public Apple::II::Card::Delegate {
|
||||
private:
|
||||
private:
|
||||
struct VideoBusHandler : public Apple::II::Video::BusHandler {
|
||||
public:
|
||||
VideoBusHandler(uint8_t *ram, uint8_t *aux_ram) : ram_(ram), aux_ram_(aux_ram) {}
|
||||
@@ -567,7 +567,7 @@ template <Analyser::Static::AppleII::Target::Model model, bool has_mockingboard>
|
||||
// MARK: - Joysticks.
|
||||
JoystickPair joysticks_;
|
||||
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::AppleII::Target &target, const ROMMachine::ROMFetcher &rom_fetcher):
|
||||
m6502_(*this),
|
||||
video_bus_handler_(ram_, aux_ram_),
|
||||
|
@@ -22,7 +22,7 @@
|
||||
namespace Apple::II {
|
||||
|
||||
class DiskIICard: public Card, public ClockingHint::Observer {
|
||||
public:
|
||||
public:
|
||||
static ROM::Request rom_request(bool is_16_sector);
|
||||
DiskIICard(ROM::Map &, bool is_16_sector);
|
||||
|
||||
@@ -34,7 +34,7 @@ class DiskIICard: public Card, public ClockingHint::Observer {
|
||||
void set_disk(const std::shared_ptr<Storage::Disk::Disk> &disk, int drive);
|
||||
Storage::Disk::Drive &get_drive(int drive);
|
||||
|
||||
private:
|
||||
private:
|
||||
void set_component_prefers_clocking(ClockingHint::Source *component, ClockingHint::Preference clocking) final;
|
||||
std::vector<uint8_t> boot_;
|
||||
Apple::DiskII diskii_;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
namespace Apple::II {
|
||||
|
||||
class JoystickPair {
|
||||
public:
|
||||
public:
|
||||
JoystickPair() {
|
||||
// Add a couple of joysticks.
|
||||
joysticks_.emplace_back(new Joystick);
|
||||
@@ -82,7 +82,7 @@ class JoystickPair {
|
||||
return joysticks_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// On an Apple II, the programmer strobes 0xc070 and that causes each analogue input
|
||||
// to begin a charge and discharge cycle **if they are not already charging**.
|
||||
// The greater the analogue input, the faster they will charge and therefore the sooner
|
||||
|
@@ -19,7 +19,7 @@ namespace Apple::II {
|
||||
* machine.set_language_card_paging() if the proper mapped state changes.
|
||||
*/
|
||||
template <typename Machine> class LanguageCardSwitches {
|
||||
public:
|
||||
public:
|
||||
struct State {
|
||||
/// When RAM is visible in the range $D000–$FFFF:
|
||||
/// @c true indicates that bank 2 should be used between $D000 and $DFFF;
|
||||
@@ -100,7 +100,7 @@ template <typename Machine> class LanguageCardSwitches {
|
||||
(state_.bank2 ? 0x04 : 0x00);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Machine &machine_;
|
||||
State state_;
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
namespace Apple::II {
|
||||
|
||||
class AYPair {
|
||||
public:
|
||||
public:
|
||||
AYPair(Concurrency::AsyncTaskQueue<false> &queue) :
|
||||
ays_{
|
||||
{GI::AY38910::Personality::AY38910, queue},
|
||||
@@ -47,12 +47,12 @@ class AYPair {
|
||||
return ays_[index];
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
GI::AY38910::AY38910SampleSource<false> ays_[2];
|
||||
};
|
||||
|
||||
class Mockingboard: public Card {
|
||||
public:
|
||||
public:
|
||||
Mockingboard(AYPair &ays) :
|
||||
vias_{ {handlers_[0]}, {handlers_[1]} },
|
||||
handlers_{ {*this, ays.get(0)}, {*this, ays.get(1)}} {
|
||||
@@ -89,7 +89,7 @@ class Mockingboard: public Card {
|
||||
delegate_->card_did_change_interrupt_flags(this);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
struct AYVIA: public MOS::MOS6522::PortHandler {
|
||||
AYVIA(Mockingboard &card, GI::AY38910::AY38910SampleSource<false> &ay) :
|
||||
card(card), ay(ay) {}
|
||||
|
@@ -25,7 +25,7 @@
|
||||
namespace Apple::II {
|
||||
|
||||
class SCSICard: public Card {
|
||||
public:
|
||||
public:
|
||||
static ROM::Request rom_request();
|
||||
SCSICard(ROM::Map &, int clock_rate);
|
||||
|
||||
@@ -39,7 +39,7 @@ class SCSICard: public Card {
|
||||
|
||||
void set_activity_observer(Activity::Observer *observer) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t *ram_pointer_ = nullptr;
|
||||
uint8_t *rom_pointer_ = nullptr;
|
||||
|
||||
|
@@ -116,7 +116,7 @@ class VideoBase: public VideoSwitches<Cycles> {
|
||||
};
|
||||
|
||||
template <class BusHandler, bool is_iie> class Video: public VideoBase {
|
||||
public:
|
||||
public:
|
||||
/// Constructs an instance of the video feed; a CRT is also created.
|
||||
Video(BusHandler &bus_handler) :
|
||||
VideoBase(is_iie, [this] (Cycles cycles) { advance(cycles); }),
|
||||
@@ -254,7 +254,7 @@ template <class BusHandler, bool is_iie> class Video: public VideoBase {
|
||||
return mapped_row < 192;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
/*!
|
||||
Advances time by @c cycles; expects to be fed by the CPU clock.
|
||||
Implicitly adds an extra half a colour clock at the end of
|
||||
|
@@ -29,7 +29,7 @@ constexpr bool is_text_mode(const GraphicsMode m) { return m <= GraphicsMode::Do
|
||||
constexpr bool is_double_mode(const GraphicsMode m) { return int(m) & 1; }
|
||||
|
||||
template <typename TimeUnit> class VideoSwitches {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Constructs a new instance of VideoSwitches in which changes to relevant switches
|
||||
affect the video mode only after @c delay cycles.
|
||||
@@ -251,7 +251,7 @@ template <typename TimeUnit> class VideoSwitches {
|
||||
return !deferrer_.empty();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
GraphicsMode graphics_mode(int row) const {
|
||||
if(
|
||||
internal_.text ||
|
||||
@@ -294,7 +294,7 @@ template <typename TimeUnit> class VideoSwitches {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// Maintain a DeferredQueue for delayed mode switches.
|
||||
const TimeUnit delay_;
|
||||
DeferredQueuePerformer<TimeUnit> deferrer_;
|
||||
@@ -323,7 +323,7 @@ template <typename TimeUnit> class VideoSwitches {
|
||||
return uint8_t((flash_ / flash_length) * 0xff);
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
// Describes the current text mode mapping from in-memory character index
|
||||
// to output character; subclasses should:
|
||||
|
@@ -138,7 +138,7 @@ class ConcreteMachine:
|
||||
}
|
||||
}
|
||||
|
||||
bool get_switch_is_enabled(Atari2600Switch input) final {
|
||||
bool get_switch_is_enabled(Atari2600Switch input) const final {
|
||||
uint8_t port_input = bus_->mos6532_.get_port_input(1);
|
||||
switch(input) {
|
||||
case Atari2600SwitchReset: return !!(port_input & 0x01);
|
||||
|
@@ -22,20 +22,20 @@ namespace Atari2600 {
|
||||
Models an Atari 2600.
|
||||
*/
|
||||
class Machine {
|
||||
public:
|
||||
public:
|
||||
virtual ~Machine() = default;
|
||||
|
||||
/// Creates and returns an Atari 2600 on the heap.
|
||||
static std::unique_ptr<Machine> Atari2600(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
|
||||
static std::unique_ptr<Machine> Atari2600(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &);
|
||||
|
||||
/// Sets the switch @c input to @c state.
|
||||
virtual void set_switch_is_enabled(Atari2600Switch input, bool state) = 0;
|
||||
virtual void set_switch_is_enabled(Atari2600Switch, bool) = 0;
|
||||
|
||||
/// Gets the state of switch @c input.
|
||||
virtual bool get_switch_is_enabled(Atari2600Switch input) = 0;
|
||||
virtual bool get_switch_is_enabled(Atari2600Switch) const = 0;
|
||||
|
||||
// Presses or releases the reset button.
|
||||
virtual void set_reset_switch(bool state) = 0;
|
||||
virtual void set_reset_switch(bool) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
namespace Atari2600 {
|
||||
|
||||
class Bus {
|
||||
public:
|
||||
public:
|
||||
Bus() :
|
||||
tia_sound_(audio_queue_),
|
||||
speaker_(tia_sound_) {}
|
||||
@@ -45,7 +45,7 @@ class Bus {
|
||||
// joystick state
|
||||
uint8_t tia_input_value_[2] = {0xff, 0xff};
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// speaker backlog accumlation counter
|
||||
Cycles cycles_since_speaker_update_;
|
||||
inline void update_audio() {
|
||||
|
@@ -11,13 +11,17 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class ActivisionStack: public BusExtender {
|
||||
public:
|
||||
ActivisionStack(uint8_t *rom_base, std::size_t rom_size) :
|
||||
public:
|
||||
ActivisionStack(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size),
|
||||
rom_ptr_(rom_base),
|
||||
last_opcode_(0x00) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
const uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
// This is a bit of a hack; a real cartridge can't see either the sync or read lines, and can't see
|
||||
@@ -38,8 +42,8 @@ class ActivisionStack: public BusExtender {
|
||||
if(operation == CPU::MOS6502::BusOperation::ReadOpcode) last_opcode_ = *value;
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t last_opcode_;
|
||||
};
|
||||
|
||||
|
@@ -13,12 +13,16 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class Atari16k: public BusExtender {
|
||||
public:
|
||||
Atari16k(uint8_t *rom_base, std::size_t rom_size) :
|
||||
public:
|
||||
Atari16k(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size),
|
||||
rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -29,17 +33,21 @@ class Atari16k: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
};
|
||||
|
||||
class Atari16kSuperChip: public BusExtender {
|
||||
public:
|
||||
Atari16kSuperChip(uint8_t *rom_base, std::size_t rom_size) :
|
||||
public:
|
||||
Atari16kSuperChip(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size),
|
||||
rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -53,8 +61,8 @@ class Atari16kSuperChip: public BusExtender {
|
||||
else if(address < 0x1100 && isReadOperation(operation)) *value = ram_[address & 0x7f];
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
|
@@ -13,10 +13,15 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class Atari32k: public BusExtender {
|
||||
public:
|
||||
Atari32k(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
public:
|
||||
Atari32k(const uint8_t *const rom_base, const std::size_t rom_size)
|
||||
: BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -27,15 +32,20 @@ class Atari32k: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
};
|
||||
|
||||
class Atari32kSuperChip: public BusExtender {
|
||||
public:
|
||||
Atari32kSuperChip(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
public:
|
||||
Atari32kSuperChip(const uint8_t *const rom_base, const std::size_t rom_size)
|
||||
: BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -49,8 +59,8 @@ class Atari32kSuperChip: public BusExtender {
|
||||
else if(address < 0x1100 && isReadOperation(operation)) *value = ram_[address & 0x7f];
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
|
@@ -13,10 +13,15 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class Atari8k: public BusExtender {
|
||||
public:
|
||||
Atari8k(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
public:
|
||||
Atari8k(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -28,15 +33,20 @@ class Atari8k: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
};
|
||||
|
||||
class Atari8kSuperChip: public BusExtender {
|
||||
public:
|
||||
Atari8kSuperChip(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
public:
|
||||
Atari8kSuperChip(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -51,8 +61,8 @@ class Atari8kSuperChip: public BusExtender {
|
||||
else if(address < 0x1100 && isReadOperation(operation)) *value = ram_[address & 0x7f];
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
|
@@ -13,10 +13,15 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class CBSRAMPlus: public BusExtender {
|
||||
public:
|
||||
CBSRAMPlus(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
public:
|
||||
CBSRAMPlus(const uint8_t *const rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size), rom_ptr_(rom_base) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -30,8 +35,8 @@ class CBSRAMPlus: public BusExtender {
|
||||
else if(address < 0x1200 && isReadOperation(operation)) *value = ram_[address & 0xff];
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[256];
|
||||
};
|
||||
|
||||
|
@@ -14,13 +14,14 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class BusExtender: public CPU::MOS6502::BusHandler {
|
||||
public:
|
||||
BusExtender(uint8_t *rom_base, std::size_t rom_size) : rom_base_(rom_base), rom_size_(rom_size) {}
|
||||
public:
|
||||
BusExtender(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
rom_base_(rom_base), rom_size_(rom_size) {}
|
||||
|
||||
void advance_cycles(int) {}
|
||||
|
||||
protected:
|
||||
uint8_t *rom_base_;
|
||||
protected:
|
||||
const uint8_t *rom_base_;
|
||||
std::size_t rom_size_;
|
||||
};
|
||||
|
||||
@@ -28,7 +29,7 @@ template<class T> class Cartridge:
|
||||
public CPU::MOS6502::BusHandler,
|
||||
public Bus {
|
||||
|
||||
public:
|
||||
public:
|
||||
Cartridge(const std::vector<uint8_t> &rom) :
|
||||
m6502_(*this),
|
||||
rom_(rom),
|
||||
@@ -54,10 +55,14 @@ template<class T> class Cartridge:
|
||||
confidence_counter.add_miss();
|
||||
}
|
||||
|
||||
void set_reset_line(bool state) override { m6502_.set_reset_line(state); }
|
||||
void set_reset_line(const bool state) override { m6502_.set_reset_line(state); }
|
||||
|
||||
// to satisfy CPU::MOS6502::Processor
|
||||
Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
Cycles perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
const uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
uint8_t returnValue = 0xff;
|
||||
int cycles_run_for = 3;
|
||||
|
||||
@@ -201,15 +206,14 @@ template<class T> class Cartridge:
|
||||
audio_queue_.perform();
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
CPU::MOS6502::Processor<CPU::MOS6502::Personality::P6502, Cartridge<T>, true> m6502_;
|
||||
std::vector<uint8_t> rom_;
|
||||
|
||||
private:
|
||||
private:
|
||||
T bus_extender_;
|
||||
int horizontal_counter_resets_ = 0;
|
||||
Cycles cycle_count_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -13,10 +13,14 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class CommaVid: public BusExtender {
|
||||
public:
|
||||
CommaVid(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
||||
public:
|
||||
CommaVid(const uint8_t *const rom_base, const std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
if(!(address & 0x1000)) return;
|
||||
address &= 0x1fff;
|
||||
|
||||
@@ -33,7 +37,7 @@ class CommaVid: public BusExtender {
|
||||
if(isReadOperation(operation)) *value = rom_base_[address & 2047];
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t ram_[1024];
|
||||
};
|
||||
|
||||
|
@@ -13,15 +13,18 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class MNetwork: public BusExtender {
|
||||
public:
|
||||
MNetwork(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size) {
|
||||
public:
|
||||
MNetwork(const uint8_t *const rom_base, const std::size_t rom_size) : BusExtender(rom_base, rom_size) {
|
||||
rom_ptr_[0] = rom_base + rom_size_ - 4096;
|
||||
rom_ptr_[1] = rom_ptr_[0] + 2048;
|
||||
high_ram_ptr_ = high_ram_;
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -55,8 +58,8 @@ class MNetwork: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_[2];
|
||||
private:
|
||||
const uint8_t *rom_ptr_[2];
|
||||
uint8_t *high_ram_ptr_;
|
||||
uint8_t low_ram_[1024], high_ram_[1024];
|
||||
};
|
||||
|
@@ -13,14 +13,15 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class MegaBoy: public BusExtender {
|
||||
public:
|
||||
MegaBoy(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size),
|
||||
rom_ptr_(rom_base),
|
||||
current_page_(0) {
|
||||
}
|
||||
public:
|
||||
MegaBoy(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size), rom_ptr_(rom_base), current_page_(0) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -34,8 +35,8 @@ class MegaBoy: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
private:
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t current_page_;
|
||||
};
|
||||
|
||||
|
@@ -13,16 +13,21 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class ParkerBros: public BusExtender {
|
||||
public:
|
||||
ParkerBros(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size) {
|
||||
public:
|
||||
ParkerBros(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size)
|
||||
{
|
||||
rom_ptr_[0] = rom_base + 4096;
|
||||
rom_ptr_[1] = rom_ptr_[0] + 1024;
|
||||
rom_ptr_[2] = rom_ptr_[1] + 1024;
|
||||
rom_ptr_[3] = rom_ptr_[2] + 1024;
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -36,8 +41,8 @@ class ParkerBros: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_[4];
|
||||
private:
|
||||
const uint8_t *rom_ptr_[4];
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -11,16 +11,20 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class Pitfall2: public BusExtender {
|
||||
public:
|
||||
Pitfall2(uint8_t *rom_base, std::size_t rom_size) :
|
||||
public:
|
||||
Pitfall2(const uint8_t *const rom_base, const std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size),
|
||||
rom_ptr_(rom_base) {}
|
||||
|
||||
void advance_cycles(int cycles) {
|
||||
void advance_cycles(const int cycles) {
|
||||
cycles_since_audio_update_ += cycles;
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
uint16_t address,
|
||||
uint8_t *const value)
|
||||
{
|
||||
address &= 0x1fff;
|
||||
if(!(address & 0x1000)) return;
|
||||
|
||||
@@ -88,8 +92,8 @@ class Pitfall2: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
inline uint16_t address_for_counter(int counter) {
|
||||
private:
|
||||
inline uint16_t address_for_counter(const int counter) {
|
||||
uint16_t fetch_address = (featcher_address_[counter] & 2047) ^ 2047;
|
||||
if((featcher_address_[counter] & 0xff) == top_[counter]) mask_[counter] = 0xff;
|
||||
if((featcher_address_[counter] & 0xff) == bottom_[counter]) mask_[counter] = 0x00;
|
||||
@@ -116,7 +120,7 @@ class Pitfall2: public BusExtender {
|
||||
uint16_t featcher_address_[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t top_[8], bottom_[8], mask_[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
uint8_t random_number_generator_ = 0;
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t audio_channel_[3];
|
||||
Cycles cycles_since_audio_update_ = 0;
|
||||
};
|
||||
|
@@ -13,14 +13,17 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class Tigervision: public BusExtender {
|
||||
public:
|
||||
Tigervision(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size) {
|
||||
public:
|
||||
Tigervision(const uint8_t *const rom_base, const std::size_t rom_size) : BusExtender(rom_base, rom_size) {
|
||||
rom_ptr_[0] = rom_base + rom_size - 4096;
|
||||
rom_ptr_[1] = rom_ptr_[0] + 2048;
|
||||
}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
const uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
if((address&0x1fff) == 0x3f) {
|
||||
int offset = ((*value) * 2048) & (rom_size_ - 1);
|
||||
rom_ptr_[0] = rom_base_ + offset;
|
||||
@@ -30,8 +33,8 @@ class Tigervision: public BusExtender {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_[2];
|
||||
private:
|
||||
const uint8_t *rom_ptr_[2];
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -13,10 +13,14 @@
|
||||
namespace Atari2600::Cartridge {
|
||||
|
||||
class Unpaged: public BusExtender {
|
||||
public:
|
||||
Unpaged(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
||||
public:
|
||||
Unpaged(const uint8_t *const rom_base, const std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
||||
|
||||
void perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) {
|
||||
void perform_bus_operation(
|
||||
const CPU::MOS6502::BusOperation operation,
|
||||
const uint16_t address,
|
||||
uint8_t *const value
|
||||
) {
|
||||
if(isReadOperation(operation) && (address & 0x1000)) {
|
||||
*value = rom_base_[address & (rom_size_ - 1)];
|
||||
}
|
||||
|
@@ -15,23 +15,20 @@
|
||||
namespace Atari2600 {
|
||||
|
||||
class PIA: public MOS::MOS6532<PIA> {
|
||||
public:
|
||||
inline uint8_t get_port_input(int port) {
|
||||
public:
|
||||
inline uint8_t get_port_input(const int port) {
|
||||
return port_values_[port];
|
||||
}
|
||||
|
||||
inline void update_port_input(int port, uint8_t mask, bool set) {
|
||||
inline void update_port_input(const int port, const uint8_t mask, const bool set) {
|
||||
if(set) port_values_[port] &= ~mask; else port_values_[port] |= mask;
|
||||
set_port_did_change(port);
|
||||
}
|
||||
|
||||
PIA() :
|
||||
port_values_{0xff, 0xff}
|
||||
{}
|
||||
PIA() : port_values_{0xff, 0xff} {}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t port_values_[2];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
namespace Atari2600 {
|
||||
|
||||
class TIA {
|
||||
public:
|
||||
public:
|
||||
TIA();
|
||||
|
||||
enum class OutputMode {
|
||||
@@ -76,7 +76,7 @@ class TIA {
|
||||
void set_scan_target(Outputs::Display::ScanTarget *);
|
||||
Outputs::Display::ScanStatus get_scaled_scan_status() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
Outputs::CRT::CRT crt_;
|
||||
|
||||
// the master counter; counts from 0 to 228 with all visible pixels being in the final 160
|
||||
@@ -229,7 +229,6 @@ class TIA {
|
||||
output_pixel_position += output_adder;
|
||||
}
|
||||
}
|
||||
|
||||
} player_[2];
|
||||
|
||||
// common actor for things that appear as a horizontal run of pixels
|
||||
|
@@ -18,8 +18,8 @@ namespace Atari2600 {
|
||||
constexpr int CPUTicksPerAudioTick = 2;
|
||||
|
||||
class TIASound: public Outputs::Speaker::BufferSource<TIASound, false> {
|
||||
public:
|
||||
TIASound(Concurrency::AsyncTaskQueue<false> &audio_queue);
|
||||
public:
|
||||
TIASound(Concurrency::AsyncTaskQueue<false> &);
|
||||
|
||||
void set_volume(int channel, uint8_t volume);
|
||||
void set_divider(int channel, uint8_t divider);
|
||||
@@ -27,10 +27,10 @@ class TIASound: public Outputs::Speaker::BufferSource<TIASound, false> {
|
||||
|
||||
// To satisfy ::SampleSource.
|
||||
template <Outputs::Speaker::Action action>
|
||||
void apply_samples(std::size_t number_of_samples, Outputs::Speaker::MonoSample *target);
|
||||
void apply_samples(std::size_t number_of_samples, Outputs::Speaker::MonoSample *);
|
||||
void set_sample_volume_range(std::int16_t range);
|
||||
|
||||
private:
|
||||
private:
|
||||
Concurrency::AsyncTaskQueue<false> &audio_queue_;
|
||||
|
||||
uint8_t volume_[2];
|
||||
|
@@ -34,7 +34,7 @@ namespace Coleco {
|
||||
namespace Vision {
|
||||
|
||||
class Joystick: public Inputs::ConcreteJoystick {
|
||||
public:
|
||||
public:
|
||||
Joystick() :
|
||||
ConcreteJoystick({
|
||||
Input(Input::Up),
|
||||
@@ -100,7 +100,7 @@ class Joystick: public Inputs::ConcreteJoystick {
|
||||
return keypad_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
uint8_t direction_ = 0xff;
|
||||
uint8_t keypad_ = 0x7f;
|
||||
};
|
||||
@@ -114,7 +114,7 @@ class ConcreteMachine:
|
||||
public MachineTypes::AudioProducer,
|
||||
public MachineTypes::JoystickMachine {
|
||||
|
||||
public:
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
z80_(*this),
|
||||
sn76489_(TI::SN76489::Personality::SN76489, audio_queue_, sn76489_divider),
|
||||
@@ -368,7 +368,7 @@ class ConcreteMachine:
|
||||
set_video_signal_configurable(options->output);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
inline void page_megacart(uint16_t address) {
|
||||
const std::size_t selected_start = (size_t(address&63) << 14) % cartridge_.size();
|
||||
cartridge_pages_[1] = &cartridge_[selected_start];
|
||||
|
@@ -112,7 +112,7 @@ class KeyboardMachine: public KeyActions {
|
||||
allowing automatic mapping from keyboard inputs to KeyActions.
|
||||
*/
|
||||
class MappedKeyboardMachine: public Inputs::Keyboard::Delegate, public KeyboardMachine {
|
||||
public:
|
||||
public:
|
||||
MappedKeyboardMachine(const std::set<Inputs::Keyboard::Key> &essential_modifiers = {});
|
||||
|
||||
/*!
|
||||
@@ -145,7 +145,7 @@ class MappedKeyboardMachine: public Inputs::Keyboard::Delegate, public KeyboardM
|
||||
*/
|
||||
virtual Inputs::Keyboard &get_keyboard() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool keyboard_did_change_key(Inputs::Keyboard *keyboard, Inputs::Keyboard::Key key, bool is_pressed) override;
|
||||
void reset_all_keys(Inputs::Keyboard *keyboard) override;
|
||||
Inputs::Keyboard keyboard_;
|
||||
|
@@ -23,7 +23,7 @@ namespace MachineTypes {
|
||||
|
||||
*/
|
||||
class TimedMachine {
|
||||
public:
|
||||
public:
|
||||
/// Runs the machine for @c duration seconds.
|
||||
virtual void run_for(Time::Seconds duration) {
|
||||
const double cycles = (duration * clock_rate_ * speed_multiplier_) + clock_conversion_error_;
|
||||
@@ -73,7 +73,7 @@ class TimedMachine {
|
||||
/// by the bitfield argument, which is comprised of flags from the namespace @c Output.
|
||||
virtual void flush_output(int) {}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/// Runs the machine for @c cycles.
|
||||
virtual void run_for(const Cycles cycles) = 0;
|
||||
|
||||
@@ -87,7 +87,7 @@ class TimedMachine {
|
||||
return clock_rate_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// Give the ScanProducer access to this machine's clock rate.
|
||||
friend class ScanProducer;
|
||||
|
||||
|
@@ -112,7 +112,7 @@ struct TestProcessor: public CPU::MC68000::BusHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int instructions_remaining_;
|
||||
};
|
||||
|
||||
|
@@ -34,7 +34,7 @@ constexpr char TestSuiteHome[] = "/Users/tharte/Projects/ProcessorTests/8088/v1"
|
||||
|
||||
using Flags = InstructionSet::x86::Flags;
|
||||
struct Registers {
|
||||
public:
|
||||
public:
|
||||
// static constexpr bool is_32bit = false;
|
||||
|
||||
uint8_t &al() { return ax_.halves.low; }
|
||||
@@ -89,7 +89,7 @@ struct Registers {
|
||||
ip_ == rhs.ip_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::RegisterPair16 ax_;
|
||||
CPU::RegisterPair16 cx_;
|
||||
CPU::RegisterPair16 dx_;
|
||||
@@ -103,7 +103,7 @@ struct Registers {
|
||||
uint16_t ip_;
|
||||
};
|
||||
class Segments {
|
||||
public:
|
||||
public:
|
||||
Segments(const Registers ®isters) : registers_(registers) {}
|
||||
|
||||
using Source = InstructionSet::x86::Source;
|
||||
@@ -136,11 +136,11 @@ class Segments {
|
||||
ss_base_ == rhs.ss_base_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
const Registers ®isters_;
|
||||
};
|
||||
struct Memory {
|
||||
public:
|
||||
public:
|
||||
using AccessType = InstructionSet::x86::AccessType;
|
||||
|
||||
// Constructor.
|
||||
@@ -254,7 +254,7 @@ struct Memory {
|
||||
*reinterpret_cast<uint16_t *>(&memory[target]) = value;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
enum class Tag {
|
||||
Seeded,
|
||||
AccessExpected,
|
||||
@@ -367,7 +367,7 @@ struct IO {
|
||||
template <typename IntT> IntT in([[maybe_unused]] uint16_t port) { return IntT(~0); }
|
||||
};
|
||||
class FlowController {
|
||||
public:
|
||||
public:
|
||||
FlowController(Registers ®isters, Segments &segments) :
|
||||
registers_(registers), segments_(segments) {}
|
||||
|
||||
@@ -401,7 +401,7 @@ class FlowController {
|
||||
return should_repeat_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Registers ®isters_;
|
||||
Segments &segments_;
|
||||
bool should_repeat_ = false;
|
||||
|
@@ -17,14 +17,14 @@
|
||||
#pragma mark - C++ delegate handlers
|
||||
|
||||
class MachineTrapHandler: public CPU::AllRAMProcessor::TrapHandler {
|
||||
public:
|
||||
public:
|
||||
MachineTrapHandler(CSTestMachine *targetMachine) : target_(targetMachine) {}
|
||||
|
||||
void processor_did_trap(CPU::AllRAMProcessor &, uint16_t address) {
|
||||
[target_ testMachineDidTrapAtAddress:address];
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CSTestMachine *target_;
|
||||
};
|
||||
|
||||
|
@@ -20,14 +20,14 @@
|
||||
#pragma mark - C++ delegate handlers
|
||||
|
||||
class BusOperationHandler: public CPU::Z80::AllRAMProcessor::MemoryAccessDelegate {
|
||||
public:
|
||||
public:
|
||||
BusOperationHandler(CSTestMachineZ80 *targetMachine) : target_(targetMachine) {}
|
||||
|
||||
void z80_all_ram_processor_did_perform_bus_operation(CPU::Z80::AllRAMProcessor &, CPU::Z80::PartialMachineCycle::Operation operation, uint16_t address, uint8_t value, HalfCycles time_stamp) {
|
||||
[target_ testMachineDidPerformBusOperation:operation address:address value:value timeStamp:time_stamp];
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CSTestMachineZ80 *target_;
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#include "68000.hpp"
|
||||
|
||||
class ComparativeBusHandler: public CPU::MC68000::BusHandler {
|
||||
public:
|
||||
public:
|
||||
ComparativeBusHandler(const char *trace_name) {
|
||||
trace = gzopen(trace_name, "rt");
|
||||
}
|
||||
@@ -50,7 +50,7 @@ class ComparativeBusHandler: public CPU::MC68000::BusHandler {
|
||||
|
||||
virtual CPU::MC68000::State get_state() = 0;
|
||||
|
||||
private:
|
||||
private:
|
||||
int line_count = 0;
|
||||
gzFile trace;
|
||||
};
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "CSROMFetcher.hpp"
|
||||
|
||||
class EmuTOS: public ComparativeBusHandler {
|
||||
public:
|
||||
public:
|
||||
EmuTOS(const std::vector<uint8_t> &emuTOS, const char *trace_name) : ComparativeBusHandler(trace_name), m68000_(*this) {
|
||||
assert(!(emuTOS.size() & 1));
|
||||
emuTOS_.resize(emuTOS.size() / 2);
|
||||
@@ -89,7 +89,7 @@ class EmuTOS: public ComparativeBusHandler {
|
||||
return HalfCycles(0);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::MC68000::Processor<EmuTOS, true, true> m68000_;
|
||||
|
||||
std::vector<uint16_t> emuTOS_;
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "CSROMFetcher.hpp"
|
||||
|
||||
class QL: public ComparativeBusHandler {
|
||||
public:
|
||||
public:
|
||||
QL(const std::vector<uint8_t> &rom, const char *trace_name) : ComparativeBusHandler(trace_name), m68000_(*this) {
|
||||
assert(!(rom.size() & 1));
|
||||
rom_.resize(rom.size() / 2);
|
||||
@@ -83,7 +83,7 @@ class QL: public ComparativeBusHandler {
|
||||
return HalfCycles(0);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::MC68000::Processor<QL, true, false, true> m68000_;
|
||||
|
||||
std::vector<uint16_t> rom_;
|
||||
|
@@ -22,7 +22,7 @@ using namespace InstructionSet::M68k;
|
||||
begin execution at 0x0400.
|
||||
*/
|
||||
class RAM68000: public CPU::MC68000::BusHandler {
|
||||
public:
|
||||
public:
|
||||
RAM68000() : m68000_(*this) {}
|
||||
|
||||
uint32_t initial_pc() const {
|
||||
@@ -126,7 +126,7 @@ class RAM68000: public CPU::MC68000::BusHandler {
|
||||
duration_ = HalfCycles(0);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
struct StopException {};
|
||||
|
||||
CPU::MC68000::Processor<RAM68000, true, true, true> m68000_;
|
||||
|
@@ -179,7 +179,7 @@ struct CapturingZ80: public CPU::Z80::BusHandler {
|
||||
return contentions_48k_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::Z80::Processor<CapturingZ80, false, false> z80_;
|
||||
uint8_t ram_[65536];
|
||||
uint16_t code_length_ = 0;
|
||||
|
@@ -93,7 +93,7 @@ struct MachineRunner {
|
||||
std::mutex *machine_mutex;
|
||||
Machine::DynamicMachine *machine;
|
||||
|
||||
private:
|
||||
private:
|
||||
SDL_TimerID timer_ = 0;
|
||||
Time::Nanos last_time_ = 0;
|
||||
std::atomic<Time::Nanos> vsync_time_;
|
||||
@@ -214,7 +214,7 @@ struct SpeakerDelegate: public Outputs::Speaker::Speaker::Delegate {
|
||||
};
|
||||
|
||||
class ActivityObserver: public Activity::Observer {
|
||||
public:
|
||||
public:
|
||||
ActivityObserver(Activity::Source *source, float aspect_ratio) {
|
||||
// Get the suorce to supply all LEDs and drives.
|
||||
source->set_activity_observer(this);
|
||||
@@ -272,7 +272,7 @@ class ActivityObserver: public Activity::Observer {
|
||||
blinking_leds_.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
std::vector<std::string> leds_;
|
||||
void register_led(const std::string &name, uint8_t) final {
|
||||
std::lock_guard lock_guard(mutex);
|
||||
@@ -465,7 +465,7 @@ std::string system_get(const char *command) {
|
||||
Maintains a communicative window title.
|
||||
*/
|
||||
class DynamicWindowTitler {
|
||||
public:
|
||||
public:
|
||||
DynamicWindowTitler(SDL_Window *window) : window_(window), file_name_(SDL_GetWindowTitle(window)) {}
|
||||
|
||||
std::string window_title() {
|
||||
@@ -483,7 +483,7 @@ class DynamicWindowTitler {
|
||||
update_window_title();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void update_window_title() {
|
||||
SDL_SetWindowTitle(window_, window_title().c_str());
|
||||
}
|
||||
@@ -497,7 +497,7 @@ class DynamicWindowTitler {
|
||||
of historic hat values.
|
||||
*/
|
||||
class SDLJoystick {
|
||||
public:
|
||||
public:
|
||||
SDLJoystick(SDL_Joystick *joystick) : joystick_(joystick) {
|
||||
hat_values_.resize(SDL_JoystickNumHats(joystick));
|
||||
}
|
||||
@@ -525,7 +525,7 @@ class SDLJoystick {
|
||||
return value;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
SDL_Joystick *joystick_;
|
||||
std::vector<Uint8> hat_values_;
|
||||
};
|
||||
|
@@ -13,7 +13,7 @@ using namespace CPU::Z80;
|
||||
namespace {
|
||||
|
||||
class ConcreteAllRAMProcessor: public AllRAMProcessor, public BusHandler {
|
||||
public:
|
||||
public:
|
||||
ConcreteAllRAMProcessor() : AllRAMProcessor(), z80_(*this) {}
|
||||
|
||||
inline HalfCycles perform_machine_cycle(const PartialMachineCycle &cycle) {
|
||||
@@ -110,7 +110,7 @@ class ConcreteAllRAMProcessor: public AllRAMProcessor, public BusHandler {
|
||||
z80_.set_wait_line(value);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
CPU::Z80::Processor<ConcreteAllRAMProcessor, false, true> z80_;
|
||||
bool was_m1_ = false;
|
||||
};
|
||||
|
@@ -80,7 +80,7 @@ struct RangeDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
template <bool use_end, typename... Args> static void dispatch(SequencerT &target, int begin, int end, Args&&... args) {
|
||||
#define index(n) \
|
||||
case n: \
|
||||
@@ -140,7 +140,7 @@ struct SubrangeDispatcher {
|
||||
#undef index
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static constexpr int find_begin(int n) {
|
||||
const auto type = ClassifierT::region(n);
|
||||
while(n && ClassifierT::region(n - 1) == type) --n;
|
||||
|
@@ -39,7 +39,7 @@ namespace Reflection {
|
||||
No guarantees of speed or any other kind of efficiency are offered.
|
||||
*/
|
||||
class Enum {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Registers @c name and the entries within @c declaration for the enum type @c Type.
|
||||
|
||||
@@ -160,7 +160,7 @@ class Enum {
|
||||
return int(iterator - entry->second.begin());
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static inline std::unordered_map<std::type_index, std::vector<std::string>> members_by_type_;
|
||||
static inline std::unordered_map<std::type_index, std::string> names_by_type_;
|
||||
static inline const std::string empty_string_;
|
||||
|
@@ -435,7 +435,7 @@ struct ArrayReceiver: public Reflection::Struct {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
Reflection::Struct *target_;
|
||||
const std::type_info *type_;
|
||||
std::string key_;
|
||||
|
@@ -75,7 +75,7 @@ struct Struct {
|
||||
*/
|
||||
virtual bool should_serialise([[maybe_unused]] const std::string &key) const { return true; }
|
||||
|
||||
private:
|
||||
private:
|
||||
void append(std::ostringstream &stream, const std::string &key, const std::type_info *type, size_t offset) const;
|
||||
bool deserialise(const uint8_t *bson, size_t size);
|
||||
};
|
||||
@@ -149,7 +149,7 @@ template <typename Type> bool get(const Struct &target, const std::string &name,
|
||||
template <typename Type> Type get(const Struct &target, const std::string &name, size_t offset = 0);
|
||||
|
||||
template <typename Owner> class StructImpl: public Struct {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
@returns the value of type @c Type that is loaded from the offset registered for the field @c name.
|
||||
It is the caller's responsibility to provide an appropriate type of data.
|
||||
@@ -234,7 +234,7 @@ template <typename Owner> class StructImpl: public Struct {
|
||||
return keys;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/*
|
||||
This interface requires reflective structs to declare all fields;
|
||||
specifically they should call:
|
||||
@@ -323,7 +323,7 @@ template <typename Owner> class StructImpl: public Struct {
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
template <typename Type> bool declare_reflectable([[maybe_unused]] Type *t, const std::string &name) {
|
||||
if constexpr (std::is_base_of<Reflection::Struct, Type>::value) {
|
||||
Reflection::Struct *const str = static_cast<Reflection::Struct *>(t);
|
||||
|
@@ -28,11 +28,11 @@ namespace SignalProcessing {
|
||||
smaller numbers permit a filter that operates more quickly and with less lag but less effectively.
|
||||
*/
|
||||
class FIRFilter {
|
||||
private:
|
||||
private:
|
||||
static constexpr float FixedMultiplier = 32767.0f;
|
||||
static constexpr int FixedShift = 15;
|
||||
|
||||
public:
|
||||
public:
|
||||
/*! A suggested default attenuation value. */
|
||||
constexpr static float DefaultAttenuation = 60.0f;
|
||||
/*!
|
||||
@@ -44,7 +44,13 @@ class FIRFilter {
|
||||
@param high_frequency The highest frequency of signal to retain in the output.
|
||||
@param attenuation The attenuation of the discarded frequencies.
|
||||
*/
|
||||
FIRFilter(std::size_t number_of_taps, float input_sample_rate, float low_frequency, float high_frequency, float attenuation = DefaultAttenuation);
|
||||
FIRFilter(
|
||||
std::size_t number_of_taps,
|
||||
float input_sample_rate,
|
||||
float low_frequency,
|
||||
float high_frequency,
|
||||
float attenuation = DefaultAttenuation
|
||||
);
|
||||
FIRFilter(const std::vector<float> &coefficients);
|
||||
|
||||
/*!
|
||||
@@ -56,7 +62,12 @@ class FIRFilter {
|
||||
inline short apply(const short *src, size_t stride = 1) const {
|
||||
#ifdef USE_ACCELERATE
|
||||
short result;
|
||||
vDSP_dotpr_s1_15(filter_coefficients_.data(), 1, src, vDSP_Stride(stride), &result, filter_coefficients_.size());
|
||||
vDSP_dotpr_s1_15(
|
||||
filter_coefficients_.data(),
|
||||
1,
|
||||
src,
|
||||
vDSP_Stride(stride), &result, filter_coefficients_.size()
|
||||
);
|
||||
return result;
|
||||
#else
|
||||
int outputValue = 0;
|
||||
@@ -92,10 +103,11 @@ class FIRFilter {
|
||||
*/
|
||||
FIRFilter operator-() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
std::vector<short> filter_coefficients_;
|
||||
|
||||
static void coefficients_for_idealised_filter_response(short *filterCoefficients, float *A, float attenuation, std::size_t numberOfTaps);
|
||||
static void coefficients_for_idealised_filter_response(
|
||||
short *filterCoefficients, float *A, float attenuation, std::size_t numberOfTaps);
|
||||
static float ino(float a);
|
||||
};
|
||||
|
||||
|
@@ -23,7 +23,7 @@ namespace SignalProcessing {
|
||||
that converts from an input clock of 1200 to an output clock of 2 will first fire on cycle 600.
|
||||
*/
|
||||
class Stepper {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Establishes a stepper with a one-to-one conversion rate.
|
||||
*/
|
||||
@@ -74,18 +74,18 @@ class Stepper {
|
||||
/*!
|
||||
@returns the output rate.
|
||||
*/
|
||||
inline uint64_t get_output_rate() {
|
||||
inline uint64_t get_output_rate() const {
|
||||
return output_rate_;
|
||||
}
|
||||
|
||||
/*!
|
||||
@returns the input rate.
|
||||
*/
|
||||
inline uint64_t get_input_rate() {
|
||||
inline uint64_t get_input_rate() const {
|
||||
return input_rate_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
int64_t accumulated_error_;
|
||||
uint64_t input_rate_, output_rate_;
|
||||
uint64_t whole_step_;
|
||||
|
@@ -24,7 +24,7 @@ namespace Storage::Cartridge {
|
||||
making the base class 100% descriptive.
|
||||
*/
|
||||
class Cartridge {
|
||||
public:
|
||||
public:
|
||||
struct Segment {
|
||||
Segment(size_t start_address, size_t end_address, std::vector<uint8_t> &&data) :
|
||||
start_address(start_address), end_address(end_address), data(data) {}
|
||||
@@ -75,7 +75,7 @@ class Cartridge {
|
||||
Cartridge() = default;
|
||||
Cartridge(const std::vector<Segment> &segments) : segments_(segments) {}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
std::vector<Segment> segments_;
|
||||
};
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
namespace Storage::Cartridge {
|
||||
|
||||
class BinaryDump : public Cartridge {
|
||||
public:
|
||||
public:
|
||||
BinaryDump(const std::string &file_name);
|
||||
|
||||
enum {
|
||||
|
@@ -15,7 +15,7 @@
|
||||
namespace Storage::Cartridge {
|
||||
|
||||
class PRG : public Cartridge {
|
||||
public:
|
||||
public:
|
||||
PRG(const std::string &file_name);
|
||||
|
||||
enum {
|
||||
|
@@ -30,7 +30,7 @@ class Controller:
|
||||
public ClockingHint::Source,
|
||||
private Drive::EventDelegate,
|
||||
private ClockingHint::Observer {
|
||||
protected:
|
||||
protected:
|
||||
/*!
|
||||
Constructs a @c Controller that will be run at @c clock_rate.
|
||||
*/
|
||||
@@ -139,7 +139,7 @@ class Controller:
|
||||
*/
|
||||
ClockingHint::Preference preferred_clocking() const override;
|
||||
|
||||
private:
|
||||
private:
|
||||
Time bit_length_;
|
||||
Cycles::IntType clock_rate_multiplier_ = 1;
|
||||
Cycles::IntType clock_rate_ = 1;
|
||||
|
@@ -20,10 +20,10 @@ namespace Storage::Disk {
|
||||
being able to post event messages to subclasses.
|
||||
*/
|
||||
class MFMController: public Controller {
|
||||
public:
|
||||
public:
|
||||
MFMController(Cycles clock_rate);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/// Indicates whether the controller should try to decode double-density MFM content, or single-density FM content.
|
||||
void set_is_double_density(bool);
|
||||
|
||||
@@ -143,7 +143,7 @@ class MFMController: public Controller {
|
||||
*/
|
||||
void write_start_of_track();
|
||||
|
||||
private:
|
||||
private:
|
||||
// Storage::Disk::Controller
|
||||
virtual void process_input_bit(int value);
|
||||
virtual void process_index_hole();
|
||||
|
@@ -24,7 +24,7 @@ namespace Storage {
|
||||
@c length_of_history The number of historic pulses to consider in locking to phase.
|
||||
*/
|
||||
template <typename BitHandler, size_t length_of_history = 3> class DigitalPhaseLockedLoop {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Instantiates a @c DigitalPhaseLockedLoop.
|
||||
|
||||
@@ -73,7 +73,7 @@ template <typename BitHandler, size_t length_of_history = 3> class DigitalPhaseL
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
BitHandler &bit_handler_;
|
||||
|
||||
void post_phase_offset(Cycles::IntType new_phase, Cycles::IntType new_offset) {
|
||||
|
@@ -23,7 +23,7 @@ namespace Storage::Disk {
|
||||
Models a flopy disk.
|
||||
*/
|
||||
class Disk {
|
||||
public:
|
||||
public:
|
||||
virtual ~Disk() = default;
|
||||
|
||||
/*!
|
||||
|
@@ -30,7 +30,7 @@ enum class Error {
|
||||
if it matches the media.
|
||||
*/
|
||||
class DiskImage {
|
||||
public:
|
||||
public:
|
||||
virtual ~DiskImage() = default;
|
||||
|
||||
/*!
|
||||
@@ -90,7 +90,7 @@ class DiskImageHolderBase: public Disk {
|
||||
the underlying image doesn't implement TypeDistinguisher, or else to pass the call along.
|
||||
*/
|
||||
template <typename T> class DiskImageHolder: public DiskImageHolderBase, public TargetPlatform::TypeDistinguisher {
|
||||
public:
|
||||
public:
|
||||
template <typename... Ts> DiskImageHolder(Ts&&... args) :
|
||||
disk_image_(args...) {}
|
||||
~DiskImageHolder();
|
||||
@@ -103,7 +103,7 @@ template <typename T> class DiskImageHolder: public DiskImageHolderBase, public
|
||||
bool get_is_read_only();
|
||||
bool tracks_differ(Track::Address lhs, Track::Address rhs);
|
||||
|
||||
private:
|
||||
private:
|
||||
T disk_image_;
|
||||
|
||||
TargetPlatform::Type target_platform_type() final {
|
||||
|
@@ -28,8 +28,9 @@ namespace Storage::Disk {
|
||||
*/
|
||||
|
||||
class Disk2MG {
|
||||
public:
|
||||
using DiskOrMassStorageDevice = std::variant<std::nullptr_t, DiskImageHolderBase *, Storage::MassStorage::MassStorageDevice *>;
|
||||
public:
|
||||
using DiskOrMassStorageDevice =
|
||||
std::variant<std::nullptr_t, DiskImageHolderBase *, Storage::MassStorage::MassStorageDevice *>;
|
||||
static DiskOrMassStorageDevice open(const std::string &file_name);
|
||||
};
|
||||
|
||||
|
@@ -18,7 +18,7 @@ namespace Storage::Disk {
|
||||
Provides a @c Disk containing an ADF disk image: a decoded sector dump of an Acorn ADFS disk.
|
||||
*/
|
||||
class AcornADF: public MFMSectorDump {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct an @c AcornADF containing content from the file with name @c file_name.
|
||||
|
||||
@@ -30,8 +30,8 @@ class AcornADF: public MFMSectorDump {
|
||||
HeadPosition get_maximum_head_position() final;
|
||||
int get_head_count() final;
|
||||
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address address) final;
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address) final;
|
||||
int head_count_ = 1;
|
||||
uint8_t sector_size_ = 1;
|
||||
int sectors_per_track_ = 16;
|
||||
|
@@ -19,7 +19,7 @@ namespace Storage::Disk {
|
||||
but the Amiga doesn't use IBM-style sector demarcation.
|
||||
*/
|
||||
class AmigaADF: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct an @c AmigaADF containing content from the file with name @c file_name.
|
||||
|
||||
@@ -31,11 +31,11 @@ class AmigaADF: public DiskImage {
|
||||
// implemented to satisfy @c Disk
|
||||
HeadPosition get_maximum_head_position() final;
|
||||
int get_head_count() final;
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address address) final;
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::FileHolder file_;
|
||||
long get_file_offset_for_position(Track::Address address);
|
||||
long get_file_offset_for_position(Track::Address);
|
||||
|
||||
};
|
||||
|
||||
|
@@ -20,7 +20,7 @@ namespace Storage::Disk {
|
||||
implicitly numbered and located.
|
||||
*/
|
||||
class AppleDSK: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct an @c AppleDSK containing content from the file with name @c file_name.
|
||||
|
||||
@@ -31,16 +31,16 @@ class AppleDSK: public DiskImage {
|
||||
|
||||
// Implemented to satisfy @c DiskImage.
|
||||
HeadPosition get_maximum_head_position() final;
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address address) final;
|
||||
void set_tracks(const std::map<Track::Address, std::shared_ptr<Track>> &tracks) final;
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address) final;
|
||||
void set_tracks(const std::map<Track::Address, std::shared_ptr<Track>> &) final;
|
||||
bool get_is_read_only() final;
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::FileHolder file_;
|
||||
int sectors_per_track_ = 16;
|
||||
bool is_prodos_ = false;
|
||||
|
||||
long file_offset(Track::Address address);
|
||||
long file_offset(Track::Address);
|
||||
size_t logical_sector_for_physical_sector(size_t physical);
|
||||
};
|
||||
|
||||
|
@@ -21,7 +21,7 @@ namespace Storage::Disk {
|
||||
Provides a @c Disk containing an Amstrad CPC-type disk image: some arrangement of sectors with status bits.
|
||||
*/
|
||||
class CPCDSK: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct a @c CPCDSK containing content from the file with name @c file_name.
|
||||
|
||||
@@ -37,7 +37,7 @@ class CPCDSK: public DiskImage {
|
||||
void set_tracks(const std::map<::Storage::Disk::Track::Address, std::shared_ptr<::Storage::Disk::Track>> &tracks) final;
|
||||
std::shared_ptr<::Storage::Disk::Track> get_track_at_position(::Storage::Disk::Track::Address address) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
struct Track {
|
||||
uint8_t track;
|
||||
uint8_t side;
|
||||
|
@@ -17,7 +17,7 @@ namespace Storage::Disk {
|
||||
Provides a @c Disk containing a D64 disk image: a decoded sector dump of a C1540-format disk.
|
||||
*/
|
||||
class D64: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct a @c D64 containing content from the file with name @c file_name.
|
||||
|
||||
@@ -31,7 +31,7 @@ class D64: public DiskImage {
|
||||
using DiskImage::get_is_read_only;
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address address) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::FileHolder file_;
|
||||
int number_of_tracks_;
|
||||
uint16_t disk_id_;
|
||||
|
@@ -20,7 +20,7 @@ namespace Storage::Disk {
|
||||
a record of IDAM locations.
|
||||
*/
|
||||
class DMK: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct a @c DMK containing content from the file with name @c file_name.
|
||||
|
||||
@@ -35,7 +35,7 @@ class DMK: public DiskImage {
|
||||
|
||||
std::shared_ptr<::Storage::Disk::Track> get_track_at_position(::Storage::Disk::Track::Address address) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
FileHolder file_;
|
||||
long get_file_offset_for_position(Track::Address address);
|
||||
|
||||
|
@@ -19,12 +19,12 @@ namespace Storage::Disk {
|
||||
a sector dump of appropriate proportions.
|
||||
*/
|
||||
class FAT12: public MFMSectorDump {
|
||||
public:
|
||||
public:
|
||||
FAT12(const std::string &file_name);
|
||||
HeadPosition get_maximum_head_position() final;
|
||||
int get_head_count() final;
|
||||
|
||||
private:
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address address) final;
|
||||
|
||||
int head_count_;
|
||||
|
@@ -19,7 +19,7 @@ namespace Storage::Disk {
|
||||
Provides a @c Disk containing a G64 disk image: a raw but perfectly-clocked GCR stream.
|
||||
*/
|
||||
class G64: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct a @c G64 containing content from the file with name @c file_name.
|
||||
|
||||
@@ -34,7 +34,7 @@ class G64: public DiskImage {
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address address) final;
|
||||
using DiskImage::get_is_read_only;
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::FileHolder file_;
|
||||
uint8_t number_of_tracks_;
|
||||
uint16_t maximum_track_size_;
|
||||
|
@@ -19,7 +19,7 @@ namespace Storage::Disk {
|
||||
Provides a @c DiskImage containing an HFE: a bit stream representation of a floppy.
|
||||
*/
|
||||
class HFE: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct an @c HFE containing content from the file with name @c file_name.
|
||||
|
||||
@@ -36,7 +36,7 @@ class HFE: public DiskImage {
|
||||
void set_tracks(const std::map<Track::Address, std::shared_ptr<Track>> &tracks) final;
|
||||
std::shared_ptr<Track> get_track_at_position(Track::Address address) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
Storage::FileHolder file_;
|
||||
uint16_t seek_track(Track::Address address);
|
||||
|
||||
|
@@ -19,7 +19,7 @@ namespace Storage::Disk {
|
||||
*/
|
||||
|
||||
class IMD: public DiskImage {
|
||||
public:
|
||||
public:
|
||||
/*!
|
||||
Construct an @c IMD containing content from the file with name @c file_name.
|
||||
|
||||
@@ -33,7 +33,7 @@ class IMD: public DiskImage {
|
||||
int get_head_count() final;
|
||||
std::shared_ptr<::Storage::Disk::Track> get_track_at_position(::Storage::Disk::Track::Address address) final;
|
||||
|
||||
private:
|
||||
private:
|
||||
FileHolder file_;
|
||||
std::map<Storage::Disk::Track::Address, long> track_locations_;
|
||||
uint8_t cylinders_ = 0, heads_ = 0;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user