1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-03 22:33:29 +00:00

Alter motor control detection.

This commit is contained in:
Thomas Harte 2024-12-29 22:21:02 -05:00
parent cb98297bb5
commit 33c2353107

View File

@ -200,8 +200,8 @@ public:
// Perform actual access. // Perform actual access.
if(address < 0x0002) { if(address < 0x0002) {
// TODO: 0x0000: data directions for parallel IO; 1 = output. // 0x0000: data directions for parallel IO; 1 = output.
// TODO: 0x0001: // 0x0001:
// b7 = serial data in; // b7 = serial data in;
// b6 = serial clock in and cassette write; // b6 = serial clock in and cassette write;
// b5 = [unconnected]; // b5 = [unconnected];
@ -221,22 +221,17 @@ public:
(serial_port_.level(Commodore::Serial::Line::Clock) ? 0x40 : 0x00); (serial_port_.level(Commodore::Serial::Line::Clock) ? 0x40 : 0x00);
*value = *value =
(io_direction_ & io_output_) | (io_direction_ & io_output_) |
((~io_direction_) & all_inputs); (~io_direction_ & all_inputs);
// printf("[%04x] In: %02x\n", m6502_.value_of(CPU::MOS6502::Register::ProgramCounter), *value);
// printf("Input: %02x\n", *value);
} }
} else { } else {
if(!address) { if(!address) {
io_direction_ = *value; io_direction_ = *value;
// printf("Direction: %02x\n", io_direction_);
} else { } else {
io_output_ = *value; io_output_ = *value;
// printf("'Output': %02x\n", io_output_);
} }
const auto output = io_output_ | ~io_direction_; const auto output = io_output_ | ~io_direction_;
// printf("Visible output: %02x\n\n", uint8_t(output)); // tape_player_->set_motor_control(~output & 0x08);
tape_player_->set_motor_control(~output & 0x08);
serial_port_.set_output( serial_port_.set_output(
Commodore::Serial::Line::Data, Commodore::Serial::LineLevel(~output & 0x01)); Commodore::Serial::Line::Data, Commodore::Serial::LineLevel(~output & 0x01));
serial_port_.set_output( serial_port_.set_output(
@ -257,6 +252,7 @@ public:
if(isReadOperation(operation)) { if(isReadOperation(operation)) {
// printf("TODO: read @ %04x\n", address); // printf("TODO: read @ %04x\n", address);
if((address & 0xfff0) == 0xfd10) { if((address & 0xfff0) == 0xfd10) {
tape_player_->set_motor_control(true);
*value = 0xff ^ 0x4; // Seems to detect the play button. *value = 0xff ^ 0x4; // Seems to detect the play button.
} else { } else {
*value = 0xff; *value = 0xff;
@ -372,12 +368,12 @@ public:
} }
private: private:
CPU::MOS6502::Processor<CPU::MOS6502::Personality::P6502, ConcreteMachine, true> m6502_;
void set_activity_observer(Activity::Observer *const observer) final { void set_activity_observer(Activity::Observer *const observer) final {
if(c1541_) c1541_->set_activity_observer(observer); if(c1541_) c1541_->set_activity_observer(observer);
} }
CPU::MOS6502::Processor<CPU::MOS6502::Personality::P6502, ConcreteMachine, true> m6502_;
void set_irq_line(bool active) override { void set_irq_line(bool active) override {
m6502_.set_irq_line(active); m6502_.set_irq_line(active);
} }