mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-18 16:30:29 +00:00
Updated the Electron's tape class to be a ClockReceiver
.
This commit is contained in:
parent
b7f88e8f61
commit
915f587ef1
@ -319,7 +319,7 @@ unsigned int Machine::perform_bus_operation(CPU::MOS6502::BusOperation operation
|
|||||||
cycles_since_display_update_ += cycles;
|
cycles_since_display_update_ += cycles;
|
||||||
cycles_since_audio_update_ += cycles;
|
cycles_since_audio_update_ += cycles;
|
||||||
if(cycles_since_audio_update_ > 16384) update_audio();
|
if(cycles_since_audio_update_ > 16384) update_audio();
|
||||||
tape_.run_for_cycles(cycles);
|
tape_.run_for(Cycles((int)cycles));
|
||||||
|
|
||||||
cycles_until_display_interrupt_ -= cycles;
|
cycles_until_display_interrupt_ -= cycles;
|
||||||
if(cycles_until_display_interrupt_ < 0) {
|
if(cycles_until_display_interrupt_ < 0) {
|
||||||
|
@ -80,14 +80,14 @@ void Tape::acorn_shifter_output_bit(int value) {
|
|||||||
push_tape_bit((uint16_t)value);
|
push_tape_bit((uint16_t)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tape::run_for_cycles(unsigned int number_of_cycles) {
|
void Tape::run_for(const Cycles &cycles) {
|
||||||
if(is_enabled_) {
|
if(is_enabled_) {
|
||||||
if(is_in_input_mode_) {
|
if(is_in_input_mode_) {
|
||||||
if(is_running_) {
|
if(is_running_) {
|
||||||
TapePlayer::run_for(Cycles((int)number_of_cycles));
|
TapePlayer::run_for(cycles);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
output_.cycles_into_pulse += number_of_cycles;
|
output_.cycles_into_pulse += (unsigned int)cycles.as_int();
|
||||||
while(output_.cycles_into_pulse > 1664) { // 1664 = the closest you can get to 1200 baud if you're looking for something
|
while(output_.cycles_into_pulse > 1664) { // 1664 = the closest you can get to 1200 baud if you're looking for something
|
||||||
output_.cycles_into_pulse -= 1664; // that divides the 125,000Hz clock that the sound divider runs off.
|
output_.cycles_into_pulse -= 1664; // that divides the 125,000Hz clock that the sound divider runs off.
|
||||||
push_tape_bit(1);
|
push_tape_bit(1);
|
||||||
|
@ -12,18 +12,20 @@
|
|||||||
#include "../../Storage/Tape/Tape.hpp"
|
#include "../../Storage/Tape/Tape.hpp"
|
||||||
#include "../../Storage/Tape/Parsers/Acorn.hpp"
|
#include "../../Storage/Tape/Parsers/Acorn.hpp"
|
||||||
#include "Interrupts.hpp"
|
#include "Interrupts.hpp"
|
||||||
|
#include "../../Components/ClockReceiver.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace Electron {
|
namespace Electron {
|
||||||
|
|
||||||
class Tape:
|
class Tape:
|
||||||
|
public ClockReceiver<Tape>,
|
||||||
public Storage::Tape::TapePlayer,
|
public Storage::Tape::TapePlayer,
|
||||||
public Storage::Tape::Acorn::Shifter::Delegate {
|
public Storage::Tape::Acorn::Shifter::Delegate {
|
||||||
public:
|
public:
|
||||||
Tape();
|
Tape();
|
||||||
|
|
||||||
void run_for_cycles(unsigned int number_of_cycles);
|
void run_for(const Cycles &cycles);
|
||||||
|
|
||||||
uint8_t get_data_register();
|
uint8_t get_data_register();
|
||||||
void set_data_register(uint8_t value);
|
void set_data_register(uint8_t value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user