mirror of
https://github.com/TomHarte/CLK.git
synced 2025-09-13 23:24:37 +00:00
Merge pull request #1425 from TomHarte/MoreIndentation
Take another big swing at indentation, some `const`s.
This commit is contained in:
@@ -17,16 +17,16 @@ class Plus3 final : public WD::WD1770 {
|
||||
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:
|
||||
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);
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -15,17 +15,16 @@ namespace Electron {
|
||||
|
||||
class SoundGenerator: public ::Outputs::Speaker::BufferSource<SoundGenerator, false> {
|
||||
public:
|
||||
SoundGenerator(Concurrency::AsyncTaskQueue<false> &audio_queue);
|
||||
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:
|
||||
|
@@ -361,7 +361,6 @@ class Chipset: private ClockingHint::Observer {
|
||||
Chipset &chipset_;
|
||||
DiskDMA &disk_dma_;
|
||||
CIAB &cia_;
|
||||
|
||||
} disk_controller_;
|
||||
friend DiskController;
|
||||
|
||||
|
@@ -100,15 +100,15 @@ class Keyboard {
|
||||
// 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_;
|
||||
|
@@ -31,7 +31,6 @@ class ReactiveDevice: public Bus::Device {
|
||||
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_;
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -26,16 +26,16 @@ class Machine {
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -12,12 +12,16 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class ActivisionStack: public BusExtender {
|
||||
public:
|
||||
ActivisionStack(uint8_t *rom_base, std::size_t rom_size) :
|
||||
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
|
||||
@@ -39,7 +43,7 @@ class ActivisionStack: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t last_opcode_;
|
||||
};
|
||||
|
||||
|
@@ -14,11 +14,15 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class Atari16k: public BusExtender {
|
||||
public:
|
||||
Atari16k(uint8_t *rom_base, std::size_t rom_size) :
|
||||
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;
|
||||
|
||||
@@ -30,16 +34,20 @@ class Atari16k: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
};
|
||||
|
||||
class Atari16kSuperChip: public BusExtender {
|
||||
public:
|
||||
Atari16kSuperChip(uint8_t *rom_base, std::size_t rom_size) :
|
||||
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;
|
||||
|
||||
@@ -54,7 +62,7 @@ class Atari16kSuperChip: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
|
@@ -14,9 +14,14 @@ 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) {}
|
||||
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;
|
||||
|
||||
@@ -28,14 +33,19 @@ class Atari32k: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
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) {}
|
||||
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;
|
||||
|
||||
@@ -50,7 +60,7 @@ class Atari32kSuperChip: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
|
@@ -14,9 +14,14 @@ 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) {}
|
||||
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;
|
||||
|
||||
@@ -29,14 +34,19 @@ class Atari8k: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
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) {}
|
||||
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;
|
||||
|
||||
@@ -52,7 +62,7 @@ class Atari8kSuperChip: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[128];
|
||||
};
|
||||
|
||||
|
@@ -14,9 +14,14 @@ 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) {}
|
||||
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;
|
||||
|
||||
@@ -31,7 +36,7 @@ class CBSRAMPlus: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t ram_[256];
|
||||
};
|
||||
|
||||
|
@@ -15,12 +15,13 @@ 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) {}
|
||||
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_;
|
||||
const uint8_t *rom_base_;
|
||||
std::size_t rom_size_;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -209,7 +214,6 @@ template<class T> class Cartridge:
|
||||
T bus_extender_;
|
||||
int horizontal_counter_resets_ = 0;
|
||||
Cycles cycle_count_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -14,9 +14,13 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class CommaVid: public BusExtender {
|
||||
public:
|
||||
CommaVid(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
||||
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;
|
||||
|
||||
|
@@ -14,14 +14,17 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class MNetwork: public BusExtender {
|
||||
public:
|
||||
MNetwork(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size) {
|
||||
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;
|
||||
|
||||
@@ -56,7 +59,7 @@ class MNetwork: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_[2];
|
||||
const uint8_t *rom_ptr_[2];
|
||||
uint8_t *high_ram_ptr_;
|
||||
uint8_t low_ram_[1024], high_ram_[1024];
|
||||
};
|
||||
|
@@ -14,13 +14,14 @@ 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) {
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -35,7 +36,7 @@ class MegaBoy: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_;
|
||||
const uint8_t *rom_ptr_;
|
||||
uint8_t current_page_;
|
||||
};
|
||||
|
||||
|
@@ -14,15 +14,20 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class ParkerBros: public BusExtender {
|
||||
public:
|
||||
ParkerBros(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size) {
|
||||
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;
|
||||
|
||||
@@ -37,7 +42,7 @@ class ParkerBros: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_[4];
|
||||
const uint8_t *rom_ptr_[4];
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -12,15 +12,19 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class Pitfall2: public BusExtender {
|
||||
public:
|
||||
Pitfall2(uint8_t *rom_base, std::size_t rom_size) :
|
||||
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;
|
||||
|
||||
@@ -89,7 +93,7 @@ class Pitfall2: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
inline uint16_t address_for_counter(int counter) {
|
||||
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;
|
||||
};
|
||||
|
@@ -14,13 +14,16 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class Tigervision: public BusExtender {
|
||||
public:
|
||||
Tigervision(uint8_t *rom_base, std::size_t rom_size) :
|
||||
BusExtender(rom_base, rom_size) {
|
||||
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;
|
||||
@@ -31,7 +34,7 @@ class Tigervision: public BusExtender {
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *rom_ptr_[2];
|
||||
const uint8_t *rom_ptr_[2];
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -14,9 +14,13 @@ namespace Atari2600::Cartridge {
|
||||
|
||||
class Unpaged: public BusExtender {
|
||||
public:
|
||||
Unpaged(uint8_t *rom_base, std::size_t rom_size) : BusExtender(rom_base, rom_size) {}
|
||||
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)];
|
||||
}
|
||||
|
@@ -16,22 +16,19 @@ namespace Atari2600 {
|
||||
|
||||
class PIA: public MOS::MOS6532<PIA> {
|
||||
public:
|
||||
inline uint8_t get_port_input(int port) {
|
||||
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:
|
||||
uint8_t port_values_[2];
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -19,7 +19,7 @@ constexpr int CPUTicksPerAudioTick = 2;
|
||||
|
||||
class TIASound: public Outputs::Speaker::BufferSource<TIASound, false> {
|
||||
public:
|
||||
TIASound(Concurrency::AsyncTaskQueue<false> &audio_queue);
|
||||
TIASound(Concurrency::AsyncTaskQueue<false> &);
|
||||
|
||||
void set_volume(int channel, uint8_t volume);
|
||||
void set_divider(int channel, uint8_t divider);
|
||||
@@ -27,7 +27,7 @@ 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:
|
||||
|
@@ -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;
|
||||
@@ -95,7 +106,8 @@ class FIRFilter {
|
||||
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);
|
||||
};
|
||||
|
||||
|
@@ -74,14 +74,14 @@ 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_;
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,8 @@ namespace Storage::Disk {
|
||||
|
||||
class Disk2MG {
|
||||
public:
|
||||
using DiskOrMassStorageDevice = std::variant<std::nullptr_t, DiskImageHolderBase *, Storage::MassStorage::MassStorageDevice *>;
|
||||
using DiskOrMassStorageDevice =
|
||||
std::variant<std::nullptr_t, DiskImageHolderBase *, Storage::MassStorage::MassStorageDevice *>;
|
||||
static DiskOrMassStorageDevice open(const std::string &file_name);
|
||||
};
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class AcornADF: public MFMSectorDump {
|
||||
int get_head_count() final;
|
||||
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address address) final;
|
||||
long get_file_offset_for_position(Track::Address) final;
|
||||
int head_count_ = 1;
|
||||
uint8_t sector_size_ = 1;
|
||||
int sectors_per_track_ = 16;
|
||||
|
@@ -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:
|
||||
Storage::FileHolder file_;
|
||||
long get_file_offset_for_position(Track::Address address);
|
||||
long get_file_offset_for_position(Track::Address);
|
||||
|
||||
};
|
||||
|
||||
|
@@ -31,8 +31,8 @@ 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:
|
||||
@@ -40,7 +40,7 @@ class AppleDSK: public DiskImage {
|
||||
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);
|
||||
};
|
||||
|
||||
|
@@ -18,10 +18,9 @@ class Shifter {
|
||||
public:
|
||||
Shifter();
|
||||
|
||||
void process_pulse(const Storage::Tape::Tape::Pulse &pulse);
|
||||
void process_pulse(const Storage::Tape::Tape::Pulse &);
|
||||
|
||||
class Delegate {
|
||||
public:
|
||||
struct Delegate {
|
||||
virtual void acorn_shifter_output_bit(int value) = 0;
|
||||
};
|
||||
void set_delegate(Delegate *delegate) {
|
||||
@@ -47,16 +46,16 @@ class Parser: public Storage::Tape::Parser<SymbolType>, public Shifter::Delegate
|
||||
public:
|
||||
Parser();
|
||||
|
||||
int get_next_bit(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
int get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
unsigned int get_next_short(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
unsigned int get_next_word(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
int get_next_bit(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
int get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
unsigned int get_next_short(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
unsigned int get_next_word(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
void reset_crc();
|
||||
uint16_t get_crc() const;
|
||||
|
||||
private:
|
||||
void acorn_shifter_output_bit(int value) override;
|
||||
void process_pulse(const Storage::Tape::Tape::Pulse &pulse) override;
|
||||
void process_pulse(const Storage::Tape::Tape::Pulse &) override;
|
||||
|
||||
bool did_update_shifter(int new_value, int length);
|
||||
CRC::Generator<uint16_t, 0x0000, 0x0000, false, false> crc_;
|
||||
|
@@ -33,14 +33,14 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
/*!
|
||||
Reads and combines the next eight bits. Returns -1 if any errors are encountered.
|
||||
*/
|
||||
int get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
int get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
|
||||
/*!
|
||||
Waits for a long gap, reads all the bytes between that and the next long gap, then
|
||||
attempts to parse those as a valid ZX80 or ZX81 file. If no file is found,
|
||||
returns nullptr.
|
||||
*/
|
||||
std::shared_ptr<Storage::Data::ZX8081::File> get_next_file(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
std::shared_ptr<Storage::Data::ZX8081::File> get_next_file(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
|
||||
private:
|
||||
bool pulse_was_high_;
|
||||
@@ -51,7 +51,7 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
void mark_end() override;
|
||||
void inspect_waves(const std::vector<WaveType> &waves) override;
|
||||
|
||||
std::shared_ptr<std::vector<uint8_t>> get_next_file_data(const std::shared_ptr<Storage::Tape::Tape> &tape);
|
||||
std::shared_ptr<std::vector<uint8_t>> get_next_file_data(const std::shared_ptr<Storage::Tape::Tape> &);
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -143,8 +143,7 @@ class BinaryTapePlayer : public TapePlayer {
|
||||
|
||||
void run_for(const Cycles cycles);
|
||||
|
||||
class Delegate {
|
||||
public:
|
||||
struct Delegate {
|
||||
virtual void tape_did_change_input(BinaryTapePlayer *tape_player) = 0;
|
||||
};
|
||||
void set_delegate(Delegate *delegate);
|
||||
|
Reference in New Issue
Block a user