mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Merge pull request #305 from TomHarte/MacCleanup
Withdraws genericised selection and ROM provision interfaces.
This commit is contained in:
commit
90c4e3726f
@ -24,8 +24,18 @@
|
||||
|
||||
#include "../../ClockReceiver/ForceInline.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace AmstradCPC {
|
||||
|
||||
enum ROMType: int {
|
||||
OS464 = 0, BASIC464,
|
||||
OS664, BASIC664,
|
||||
OS6128, BASIC6128,
|
||||
AMSDOS
|
||||
};
|
||||
|
||||
/*!
|
||||
Models the CPC's interrupt timer. Inputs are vsync, hsync, interrupt acknowledge and reset, and its output
|
||||
is simply yes or no on whether an interupt is currently requested. Internally it uses a counter with a period
|
||||
@ -920,7 +930,7 @@ class ConcreteMachine:
|
||||
}
|
||||
|
||||
// See header; provides the system ROMs.
|
||||
void set_rom(ROMType type, const std::vector<uint8_t> &data) override final {
|
||||
void set_rom(ROMType type, const std::vector<uint8_t> &data) {
|
||||
roms_[static_cast<int>(type)] = data;
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,8 @@
|
||||
#include "../CRTMachine.hpp"
|
||||
#include "../KeyboardMachine.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace AmstradCPC {
|
||||
|
||||
enum ROMType: int {
|
||||
OS464 = 0, BASIC464,
|
||||
OS664, BASIC664,
|
||||
OS6128, BASIC6128,
|
||||
AMSDOS
|
||||
};
|
||||
|
||||
/*!
|
||||
Models an Amstrad CPC.
|
||||
*/
|
||||
@ -37,9 +27,6 @@ class Machine:
|
||||
|
||||
/// Creates and returns an Amstrad CPC.
|
||||
static Machine *AmstradCPC();
|
||||
|
||||
/// Sets the contents of rom @c type to @c data. Assumed to be a setup step; has no effect once a machine is running.
|
||||
virtual void set_rom(ROMType type, const std::vector<uint8_t> &data) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -27,10 +27,18 @@
|
||||
#include "../../../Configurable/StandardOptions.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Commodore {
|
||||
namespace Vic20 {
|
||||
|
||||
enum ROMSlot {
|
||||
Kernel = 0,
|
||||
BASIC,
|
||||
Characters,
|
||||
Drive
|
||||
};
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(Configurable::QuickLoadTape);
|
||||
}
|
||||
@ -304,7 +312,7 @@ class ConcreteMachine:
|
||||
delete[] rom_;
|
||||
}
|
||||
|
||||
void set_rom(ROMSlot slot, const std::vector<uint8_t> &data) override final {
|
||||
void set_rom(ROMSlot slot, const std::vector<uint8_t> &data) {
|
||||
}
|
||||
|
||||
// Obtains the system ROMs.
|
||||
@ -502,7 +510,7 @@ class ConcreteMachine:
|
||||
}
|
||||
}
|
||||
|
||||
void set_use_fast_tape_hack(bool activate) override final {
|
||||
void set_use_fast_tape_hack(bool activate) {
|
||||
use_fast_tape_hack_ = activate;
|
||||
}
|
||||
|
||||
|
@ -15,18 +15,9 @@
|
||||
#include "../../KeyboardMachine.hpp"
|
||||
#include "../../JoystickMachine.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Commodore {
|
||||
namespace Vic20 {
|
||||
|
||||
enum ROMSlot {
|
||||
Kernel = 0,
|
||||
BASIC,
|
||||
Characters,
|
||||
Drive
|
||||
};
|
||||
|
||||
enum MemorySize {
|
||||
Default,
|
||||
ThreeKB,
|
||||
@ -56,17 +47,11 @@ class Machine:
|
||||
/// Creates and returns a Vic-20.
|
||||
static Machine *Vic20();
|
||||
|
||||
/// Sets the contents of the rom in @c slot to the buffer @c data of length @c length.
|
||||
virtual void set_rom(ROMSlot slot, const std::vector<uint8_t> &data) = 0;
|
||||
|
||||
/// Sets the memory size of this Vic-20.
|
||||
virtual void set_memory_size(MemorySize size) = 0;
|
||||
|
||||
/// Sets the region of this Vic-20.
|
||||
virtual void set_region(Region region) = 0;
|
||||
|
||||
/// Enables or disables turbo-speed tape loading.
|
||||
virtual void set_use_fast_tape_hack(bool activate) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class ConcreteMachine:
|
||||
if(is_holding_shift_) set_key_state(KeyShift, true);
|
||||
}
|
||||
|
||||
void set_use_fast_tape_hack(bool activate) override final {
|
||||
void set_use_fast_tape_hack(bool activate) {
|
||||
use_fast_tape_hack_ = activate;
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,6 @@ class Machine:
|
||||
is enabled — it acts as if it were sideways RAM. Otherwise the slot is modelled as containing ROM.
|
||||
*/
|
||||
virtual void set_rom(ROMSlot slot, const std::vector<uint8_t> &data, bool is_writeable) = 0;
|
||||
|
||||
/// Enables or disables turbo-speed tape loading.
|
||||
virtual void set_use_fast_tape_hack(bool activate) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -25,10 +25,16 @@
|
||||
#include "../../ClockReceiver/ForceInline.hpp"
|
||||
#include "../../Configurable/StandardOptions.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace Oric {
|
||||
|
||||
enum ROM {
|
||||
BASIC10 = 0, BASIC11, Microdisc, Colour
|
||||
};
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(
|
||||
static_cast<Configurable::StandardOptions>(Configurable::DisplayRGBComposite | Configurable::QuickLoadTape)
|
||||
@ -198,7 +204,7 @@ class ConcreteMachine:
|
||||
Memory::Fuzz(ram_, sizeof(ram_));
|
||||
}
|
||||
|
||||
void set_rom(ROM rom, const std::vector<uint8_t> &data) override final {
|
||||
void set_rom(ROM rom, const std::vector<uint8_t> &data) {
|
||||
switch(rom) {
|
||||
case BASIC11: basic11_rom_ = std::move(data); break;
|
||||
case BASIC10: basic10_rom_ = std::move(data); break;
|
||||
@ -240,11 +246,11 @@ class ConcreteMachine:
|
||||
keyboard_.clear_all_keys();
|
||||
}
|
||||
|
||||
void set_use_fast_tape_hack(bool activate) override final {
|
||||
void set_use_fast_tape_hack(bool activate) {
|
||||
use_fast_tape_hack_ = activate;
|
||||
}
|
||||
|
||||
void set_output_device(Outputs::CRT::OutputDevice output_device) override final {
|
||||
void set_output_device(Outputs::CRT::OutputDevice output_device) {
|
||||
video_output_->set_output_device(output_device);
|
||||
}
|
||||
|
||||
|
@ -14,15 +14,8 @@
|
||||
#include "../CRTMachine.hpp"
|
||||
#include "../KeyboardMachine.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace Oric {
|
||||
|
||||
enum ROM {
|
||||
BASIC10 = 0, BASIC11, Microdisc, Colour
|
||||
};
|
||||
|
||||
/// @returns The options available for an Oric.
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options();
|
||||
|
||||
@ -39,15 +32,6 @@ class Machine:
|
||||
|
||||
/// Creates and returns an Oric.
|
||||
static Machine *Oric();
|
||||
|
||||
/// Sets the contents of @c rom to @c data. Assumed to be a setup step; has no effect once a machine is running.
|
||||
virtual void set_rom(ROM rom, const std::vector<uint8_t> &data) = 0;
|
||||
|
||||
/// Enables or disables turbo-speed tape loading.
|
||||
virtual void set_use_fast_tape_hack(bool activate) = 0;
|
||||
|
||||
/// Sets the type of display the Oric is connected to.
|
||||
virtual void set_output_device(Outputs::CRT::OutputDevice output_device) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,9 @@
|
||||
#include "Keyboard.hpp"
|
||||
#include "Video.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
// The clock rate is 3.25Mhz.
|
||||
@ -30,6 +32,10 @@ namespace {
|
||||
|
||||
namespace ZX8081 {
|
||||
|
||||
enum ROMType: uint8_t {
|
||||
ZX80 = 0, ZX81
|
||||
};
|
||||
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options() {
|
||||
return Configurable::standard_options(
|
||||
static_cast<Configurable::StandardOptions>(Configurable::AutomaticTapeMotorControl | Configurable::QuickLoadTape)
|
||||
@ -291,7 +297,7 @@ template<bool is_zx81> class ConcreteMachine:
|
||||
Utility::TypeRecipient::set_typer_for_string(string, std::move(mapper));
|
||||
}
|
||||
|
||||
void set_rom(ROMType type, const std::vector<uint8_t> &data) override final {
|
||||
void set_rom(ROMType type, const std::vector<uint8_t> &data) {
|
||||
switch(type) {
|
||||
case ZX80: zx80_rom_ = data; break;
|
||||
case ZX81: zx81_rom_ = data; break;
|
||||
@ -328,11 +334,11 @@ template<bool is_zx81> class ConcreteMachine:
|
||||
}
|
||||
|
||||
// MARK: - Tape control
|
||||
void set_use_fast_tape_hack(bool activate) override final {
|
||||
void set_use_fast_tape_hack(bool activate) {
|
||||
use_fast_tape_hack_ = activate;
|
||||
}
|
||||
|
||||
void set_use_automatic_tape_motor_control(bool enabled) override final {
|
||||
void set_use_automatic_tape_motor_control(bool enabled) {
|
||||
use_automatic_tape_motor_control_ = enabled;
|
||||
if(!enabled) {
|
||||
tape_player_.set_motor_control(false);
|
||||
|
@ -14,15 +14,8 @@
|
||||
#include "../CRTMachine.hpp"
|
||||
#include "../KeyboardMachine.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace ZX8081 {
|
||||
|
||||
enum ROMType: uint8_t {
|
||||
ZX80 = 0, ZX81
|
||||
};
|
||||
|
||||
/// @returns The options available for a ZX80 or ZX81.
|
||||
std::vector<std::unique_ptr<Configurable::Option>> get_options();
|
||||
|
||||
@ -32,14 +25,11 @@ class Machine:
|
||||
public KeyboardMachine::Machine,
|
||||
public Configurable::Device {
|
||||
public:
|
||||
static Machine *ZX8081(const StaticAnalyser::Target &target_hint);
|
||||
virtual ~Machine();
|
||||
|
||||
virtual void set_rom(ROMType type, const std::vector<uint8_t> &data) = 0;
|
||||
static Machine *ZX8081(const StaticAnalyser::Target &target_hint);
|
||||
|
||||
virtual void set_use_fast_tape_hack(bool activate) = 0;
|
||||
virtual void set_tape_is_playing(bool is_playing) = 0;
|
||||
virtual void set_use_automatic_tape_motor_control(bool enabled) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#import "CSElectron.h"
|
||||
|
||||
#include "Electron.hpp"
|
||||
|
||||
#include "StandardOptions.hpp"
|
||||
|
||||
@implementation CSElectron {
|
||||
std::unique_ptr<Electron::Machine> _electron;
|
||||
@ -34,14 +34,20 @@
|
||||
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
|
||||
@synchronized(self) {
|
||||
_useFastLoadingHack = useFastLoadingHack;
|
||||
_electron->set_use_fast_tape_hack(useFastLoadingHack ? true : false);
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false);
|
||||
_electron->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setUseTelevisionOutput:(BOOL)useTelevisionOutput {
|
||||
@synchronized(self) {
|
||||
_useTelevisionOutput = useTelevisionOutput;
|
||||
_electron->get_crt()->set_output_device(useTelevisionOutput ? Outputs::CRT::OutputDevice::Television : Outputs::CRT::OutputDevice::Monitor);
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_display_selection(selection_set, useTelevisionOutput ? Configurable::Display::Composite : Configurable::Display::RGB);
|
||||
_electron->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import "CSOric.h"
|
||||
|
||||
#include "Oric.hpp"
|
||||
#include "StandardOptions.hpp"
|
||||
|
||||
@implementation CSOric {
|
||||
std::unique_ptr<Oric::Machine> _oric;
|
||||
@ -29,14 +30,20 @@
|
||||
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
|
||||
@synchronized(self) {
|
||||
_useFastLoadingHack = useFastLoadingHack;
|
||||
_oric->set_use_fast_tape_hack(useFastLoadingHack ? true : false);
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false);
|
||||
_oric->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setUseCompositeOutput:(BOOL)useCompositeOutput {
|
||||
@synchronized(self) {
|
||||
_useCompositeOutput = useCompositeOutput;
|
||||
_oric->set_output_device(useCompositeOutput ? Outputs::CRT::OutputDevice::Television : Outputs::CRT::OutputDevice::Monitor);
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_display_selection(selection_set, useCompositeOutput ? Configurable::Display::Composite : Configurable::Display::RGB);
|
||||
_oric->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import "CSVic20.h"
|
||||
|
||||
#include "Vic20.hpp"
|
||||
#include "StandardOptions.hpp"
|
||||
|
||||
using namespace Commodore::Vic20;
|
||||
|
||||
@ -47,7 +48,9 @@ using namespace Commodore::Vic20;
|
||||
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
|
||||
_useFastLoadingHack = useFastLoadingHack;
|
||||
@synchronized(self) {
|
||||
_vic20->set_use_fast_tape_hack(useFastLoadingHack ? true : false);
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false);
|
||||
_vic20->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import "CSZX8081.h"
|
||||
|
||||
#include "ZX8081.hpp"
|
||||
#include "StandardOptions.hpp"
|
||||
|
||||
@implementation CSZX8081 {
|
||||
std::unique_ptr<ZX8081::Machine> _zx8081;
|
||||
@ -31,7 +32,10 @@
|
||||
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
|
||||
@synchronized(self) {
|
||||
_useFastLoadingHack = useFastLoadingHack;
|
||||
_zx8081->set_use_fast_tape_hack(useFastLoadingHack ? true : false);
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_quick_load_tape_selection(selection_set, useFastLoadingHack ? true : false);
|
||||
_zx8081->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +49,10 @@
|
||||
- (void)setUseAutomaticTapeMotorControl:(BOOL)useAutomaticTapeMotorControl {
|
||||
@synchronized(self) {
|
||||
_useAutomaticTapeMotorControl = useAutomaticTapeMotorControl;
|
||||
_zx8081->set_use_automatic_tape_motor_control(useAutomaticTapeMotorControl ? true : false);
|
||||
|
||||
Configurable::SelectionSet selection_set;
|
||||
append_automatic_tape_motor_control_selection(selection_set, useAutomaticTapeMotorControl ? true : false);
|
||||
_zx8081->set_selections(selection_set);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user