1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Made a game attempt at automatic motor control and ensured setting is initialised correctly from the user defaults.

This commit is contained in:
Thomas Harte 2017-07-08 19:31:20 -04:00
parent bcb7c27cc4
commit 54efcb7e2f
3 changed files with 13 additions and 1 deletions

View File

@ -23,7 +23,9 @@ Machine::Machine() :
nmi_is_enabled_(false),
tape_player_(ZX8081ClockRate),
use_fast_tape_hack_(false),
tape_advance_delay_(0) {
tape_advance_delay_(0),
tape_is_automatically_playing_(false),
tape_is_playing_(false) {
set_clock_rate(ZX8081ClockRate);
tape_player_.set_motor_control(true);
clear_all_keys();
@ -147,6 +149,9 @@ int Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &cycle) {
tape_player_.get_tape()->seek(time);
}
}
// Check for automatic tape control.
tape_is_automatically_playing_ = use_automatic_tape_motor_control_ && (address >= automatic_tape_motor_start_address_) && (address < automatic_tape_motor_end_address_);
is_opcode_read = true;
case CPU::Z80::PartialMachineCycle::Read:
@ -209,12 +214,16 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target) {
tape_return_address_ = 0x380;
vsync_start_cycle_ = 16;
vsync_end_cycle_ = 32;
automatic_tape_motor_start_address_ = 0x0340;
automatic_tape_motor_end_address_ = 0x03c3;
} else {
rom_ = zx80_rom_;
tape_trap_address_ = 0x220;
tape_return_address_ = 0x248;
vsync_start_cycle_ = 13;
vsync_end_cycle_ = 33;
automatic_tape_motor_start_address_ = 0x0206;
automatic_tape_motor_end_address_ = 0x024d;
}
rom_mask_ = (uint16_t)(rom_.size() - 1);

View File

@ -72,7 +72,9 @@ class Machine:
private:
std::shared_ptr<Video> video_;
std::vector<uint8_t> zx81_rom_, zx80_rom_;
uint16_t tape_trap_address_, tape_return_address_;
uint16_t automatic_tape_motor_start_address_, automatic_tape_motor_end_address_;
std::vector<uint8_t> ram_;
uint16_t ram_mask_, ram_base_;

View File

@ -44,5 +44,6 @@ class ZX8081OptionsPanel: MachinePanel {
let automaticTapeMotorControlIsEnabled = standardUserDefaults.bool(forKey: self.automaticTapeMotorControlDefaultsKey)
self.automaticTapeMotorControlButton.state = automaticTapeMotorControlIsEnabled ? NSOnState : NSOffState
self.playOrPauseTapeButton.isEnabled = !automaticTapeMotorControlIsEnabled
self.zx8081.useAutomaticTapeMotorControl = automaticTapeMotorControlIsEnabled
}
}