mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Advances to correctly reading bytes.
Something is still amiss though. Maybe I'm supposed to update the checksum?
This commit is contained in:
parent
064fe7658c
commit
a32a2f36be
@ -919,12 +919,21 @@ template <bool has_fdc> class ConcreteMachine:
|
||||
if(address == tape_read_byte_address && read_pointers_[0] == roms_[ROMType::OS].data()) {
|
||||
using Parser = Storage::Tape::ZXSpectrum::Parser;
|
||||
Parser parser(Parser::MachineType::AmstradCPC);
|
||||
parser.set_cpc_read_speed(read_pointers_[tape_speed_value_address >> 14][tape_speed_value_address & 16383]);
|
||||
|
||||
const auto speed = read_pointers_[tape_speed_value_address >> 14][tape_speed_value_address & 16383];
|
||||
parser.set_cpc_read_speed(speed);
|
||||
|
||||
// Seed with the current pulse; the CPC will have finished the
|
||||
// preceding symbol and be a short way into the pulse that should determine the
|
||||
// first bit of this byte.
|
||||
parser.process_pulse(tape_player_.get_current_pulse());
|
||||
const auto byte = parser.get_byte(tape_player_.get_tape());
|
||||
auto flags = z80_.get_value_of_register(CPU::Z80::Register::Flags);
|
||||
|
||||
if(byte) {
|
||||
// In A ROM-esque fashion, begin the first pulse after the final one
|
||||
// that was just consumed.
|
||||
tape_player_.complete_pulse();
|
||||
z80_.set_value_of_register(CPU::Z80::Register::A, *byte);
|
||||
flags |= CPU::Z80::Flag::Carry;
|
||||
} else {
|
||||
|
@ -94,6 +94,12 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
*/
|
||||
void seed_checksum(uint8_t value = 0x00);
|
||||
|
||||
/*!
|
||||
Push a pulse; primarily provided for Storage::Tape::PulseClassificationParser but also potentially useful
|
||||
for picking up fast loading from an ongoing tape.
|
||||
*/
|
||||
void process_pulse(const Storage::Tape::Tape::Pulse &pulse) override;
|
||||
|
||||
private:
|
||||
const MachineType machine_type_;
|
||||
constexpr bool should_flip_bytes() {
|
||||
@ -103,7 +109,6 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
|
||||
return machine_type_ != MachineType::ZXSpectrum;
|
||||
}
|
||||
|
||||
void process_pulse(const Storage::Tape::Tape::Pulse &pulse) override;
|
||||
void inspect_waves(const std::vector<WaveType> &waves) override;
|
||||
|
||||
uint8_t checksum_ = 0;
|
||||
|
@ -97,6 +97,14 @@ void TapePlayer::get_next_pulse() {
|
||||
set_next_event_time_interval(current_pulse_.length);
|
||||
}
|
||||
|
||||
Tape::Pulse TapePlayer::get_current_pulse() {
|
||||
return current_pulse_;
|
||||
}
|
||||
|
||||
void TapePlayer::complete_pulse() {
|
||||
jump_to_next_event();
|
||||
}
|
||||
|
||||
void TapePlayer::run_for(const Cycles cycles) {
|
||||
if(has_tape()) {
|
||||
TimedEventLoop::run_for(cycles);
|
||||
|
@ -110,6 +110,9 @@ class TapePlayer: public TimedEventLoop, public ClockingHint::Source {
|
||||
|
||||
ClockingHint::Preference preferred_clocking() const override;
|
||||
|
||||
Tape::Pulse get_current_pulse();
|
||||
void complete_pulse();
|
||||
|
||||
protected:
|
||||
virtual void process_next_event() override;
|
||||
virtual void process_input_pulse(const Tape::Pulse &pulse) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user