1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 00:56:21 +00:00

Performed enough wiring to put the onus back onto OricTAP to do appropriate things.

This commit is contained in:
Thomas Harte 2016-10-15 21:32:59 -04:00
parent 6d7c3f6ac2
commit a608bbebfb
3 changed files with 20 additions and 7 deletions

View File

@ -10,17 +10,23 @@
using namespace Oric;
Machine::Machine() : _cycles_since_video_update(0), _tape(1000000)
Machine::Machine() : _cycles_since_video_update(0)
{
set_clock_rate(1000000);
_via.tape.reset(new Storage::Tape::BinaryTapePlayer(1000000));
_via.set_interrupt_delegate(this);
_keyboard.reset(new Keyboard);
_via.keyboard = _keyboard;
clear_all_keys();
_via.tape->set_delegate(this);
}
void Machine::configure_as_target(const StaticAnalyser::Target &target)
{
if(target.tapes.size())
{
_via.tape->set_tape(target.tapes.front());
}
}
void Machine::set_rom(std::vector<uint8_t> data)
@ -54,6 +60,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
}
_via.run_for_half_cycles(2);
_via.tape->run_for_cycles(1);
_cycles_since_video_update++;
return 1;
}

View File

@ -97,10 +97,7 @@ class Machine:
uint8_t rows[8];
};
// Tape player
Storage::Tape::BinaryTapePlayer _tape;
// VIA
// VIA (which owns the tape and the AY)
class VIA: public MOS::MOS6522<VIA>, public MOS::MOS6522IRQDelegate {
public:
using MOS6522IRQDelegate::set_interrupt_status;
@ -118,6 +115,7 @@ class Machine:
if(port)
{
keyboard->row = value;
tape->set_motor_control(value & 0x40);
}
else
{
@ -145,6 +143,7 @@ class Machine:
}
std::shared_ptr<GI::AY38910> ay8910;
std::shared_ptr<Storage::Tape::BinaryTapePlayer> tape;
std::shared_ptr<Keyboard> keyboard;
inline void synchronise() { update_ay(); }

View File

@ -96,11 +96,17 @@ class TapePlayer: public TimedEventLoop {
class BinaryTapePlayer: public TapePlayer {
public:
BinaryTapePlayer(unsigned int input_clock_rate) : TapePlayer(input_clock_rate) {}
void set_motor_control(bool enabled) {} // TODO
BinaryTapePlayer(unsigned int input_clock_rate) : TapePlayer(input_clock_rate), _motor_is_running(false) {}
void set_motor_control(bool enabled) { _motor_is_running = enabled; }
void set_tape_output(bool set) {} // TODO
inline bool get_input() { return _input_level; }
void run_for_cycles(int number_of_cycles) {
if(_motor_is_running) {
TapePlayer::run_for_cycles(number_of_cycles);
}
}
class Delegate {
public:
virtual void tape_did_change_input(BinaryTapePlayer *tape_player) = 0;
@ -122,6 +128,7 @@ class BinaryTapePlayer: public TapePlayer {
}
}
bool _input_level;
bool _motor_is_running;
};
}