1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-21 20:29:06 +00:00

Decrease indentation.

This commit is contained in:
Thomas Harte 2024-12-06 13:52:42 -05:00
parent e8aa9b9eb2
commit 08f98aa32f
2 changed files with 578 additions and 576 deletions

View File

@ -63,7 +63,7 @@ enum JoystickInput {
state from its serial port. Most of the joystick input is also exposed here.
*/
class UserPortVIA: public MOS::MOS6522::IRQDelegatePortHandler {
public:
public:
UserPortVIA() : port_a_(0xbf) {}
/// Reports the current input to the 6522 port @c port.
@ -120,7 +120,7 @@ class UserPortVIA: public MOS::MOS6522::IRQDelegatePortHandler {
tape_ = tape;
}
private:
private:
uint8_t port_a_;
std::weak_ptr<::Commodore::Serial::Port> serial_port_;
std::shared_ptr<Storage::Tape::BinaryTapePlayer> tape_;
@ -131,7 +131,7 @@ class UserPortVIA: public MOS::MOS6522::IRQDelegatePortHandler {
and for the small portion of joystick input not connected to the user-port VIA.
*/
class KeyboardVIA: public MOS::MOS6522::IRQDelegatePortHandler {
public:
public:
KeyboardVIA() : port_b_(0xff) {
clear_all_keys();
}
@ -194,7 +194,7 @@ class KeyboardVIA: public MOS::MOS6522::IRQDelegatePortHandler {
serial_port_ = serialPort;
}
private:
private:
uint8_t port_b_;
uint8_t columns_[8];
uint8_t activation_mask_;
@ -205,7 +205,7 @@ class KeyboardVIA: public MOS::MOS6522::IRQDelegatePortHandler {
Models the Vic's serial port, providing the receipticle for input.
*/
class SerialPort : public ::Commodore::Serial::Port {
public:
public:
/// Receives an input change from the base serial port class, and communicates it to the user-port VIA.
void set_input(::Commodore::Serial::Line line, ::Commodore::Serial::LineLevel level) {
std::shared_ptr<UserPortVIA> userPortVIA = user_port_via_.lock();
@ -217,15 +217,14 @@ class SerialPort : public ::Commodore::Serial::Port {
user_port_via_ = userPortVIA;
}
private:
private:
std::weak_ptr<UserPortVIA> user_port_via_;
};
/*!
Provides the bus over which the Vic 6560 fetches memory in a Vic-20.
*/
class Vic6560BusHandler {
public:
struct Vic6560BusHandler {
/// Performs a read on behalf of the 6560; in practice uses @c video_memory_map and @c colour_memory to find data.
forceinline void perform_read(uint16_t address, uint8_t *pixel_data, uint8_t *colour_data) {
*pixel_data = video_memory_map[address >> 10] ? video_memory_map[address >> 10][address & 0x3ff] : 0xff; // TODO
@ -241,7 +240,7 @@ class Vic6560BusHandler {
Interfaces a joystick to the two VIAs.
*/
class Joystick: public Inputs::ConcreteJoystick {
public:
public:
Joystick(UserPortVIA &user_port_via_port_handler, KeyboardVIA &keyboard_via_port_handler) :
ConcreteJoystick({
Input(Input::Up),
@ -268,7 +267,7 @@ class Joystick: public Inputs::ConcreteJoystick {
keyboard_via_port_handler_.set_joystick_state(mapped_input, is_active);
}
private:
private:
UserPortVIA &user_port_via_port_handler_;
KeyboardVIA &keyboard_via_port_handler_;
};
@ -288,7 +287,7 @@ class ConcreteMachine:
public Machine,
public ClockingHint::Observer,
public Activity::Source {
public:
public:
ConcreteMachine(const Analyser::Static::Commodore::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
m6502_(*this),
mos6560_(mos6560_bus_handler_),
@ -391,7 +390,7 @@ class ConcreteMachine:
#define set_ram(baseaddr, length) { \
write_to_map(processor_read_memory_map_, &ram_[baseaddr], baseaddr, length); \
write_to_map(processor_write_memory_map_, &ram_[baseaddr], baseaddr, length); \
}
}
// Add 6502-visible RAM as requested.
set_ram(0x0000, 0x0400);
@ -703,7 +702,7 @@ class ConcreteMachine:
if(c1540_) c1540_->set_activity_observer(observer);
}
private:
private:
void update_video() {
mos6560_.run_for(cycles_since_mos6560_update_.flush<Cycles>());
}
@ -762,7 +761,10 @@ class ConcreteMachine:
using namespace Commodore::Vic20;
std::unique_ptr<Machine> Machine::Vic20(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher) {
std::unique_ptr<Machine> Machine::Vic20(
const Analyser::Static::Target *target,
const ROMMachine::ROMFetcher &rom_fetcher
) {
using Target = Analyser::Static::Commodore::Target;
const Target *const commodore_target = dynamic_cast<const Target *>(target);
return std::make_unique<Vic20::ConcreteMachine>(*commodore_target, rom_fetcher);

View File

@ -21,11 +21,11 @@ namespace Commodore::Vic20 {
std::unique_ptr<Reflection::Struct> get_options();
class Machine {
public:
public:
virtual ~Machine() = default;
/// Creates and returns a Vic-20.
static std::unique_ptr<Machine> Vic20(const Analyser::Static::Target *target, const ROMMachine::ROMFetcher &rom_fetcher);
static std::unique_ptr<Machine> Vic20(const Analyser::Static::Target *, const ROMMachine::ROMFetcher &);
class Options: public Reflection::StructImpl<Options>, public Configurable::DisplayOption<Options>, public Configurable::QuickloadOption<Options> {
friend Configurable::DisplayOption<Options>;