2017-07-17 01:33:11 +00:00
|
|
|
//
|
|
|
|
// TZX.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 16/07/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-07-17 01:33:11 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2017-07-17 01:33:11 +00:00
|
|
|
|
2017-07-17 02:06:56 +00:00
|
|
|
#include "../PulseQueuedTape.hpp"
|
2017-07-17 01:33:11 +00:00
|
|
|
#include "../../FileHolder.hpp"
|
|
|
|
|
2018-04-06 21:42:24 +00:00
|
|
|
#include <string>
|
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Storage::Tape {
|
2017-07-17 01:33:11 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides a @c Tape containing a CSW tape image, which is a compressed 1-bit sampling.
|
|
|
|
*/
|
2017-11-03 02:32:00 +00:00
|
|
|
class TZX: public PulseQueuedTape {
|
2017-07-17 01:33:11 +00:00
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
Constructs a @c TZX containing content from the file with name @c file_name.
|
|
|
|
|
|
|
|
@throws ErrorNotTZX if this file could not be opened and recognised as a valid TZX file.
|
|
|
|
*/
|
2018-04-06 21:42:24 +00:00
|
|
|
TZX(const std::string &file_name);
|
2017-07-17 01:33:11 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
ErrorNotTZX
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2017-11-03 02:32:00 +00:00
|
|
|
Storage::FileHolder file_;
|
|
|
|
|
2017-07-17 01:33:11 +00:00
|
|
|
void virtual_reset();
|
2017-07-17 02:06:56 +00:00
|
|
|
void get_next_pulses();
|
2017-07-17 01:33:11 +00:00
|
|
|
|
2017-07-21 22:21:12 +00:00
|
|
|
bool current_level_;
|
2017-07-17 02:40:38 +00:00
|
|
|
|
2017-07-17 23:38:15 +00:00
|
|
|
void get_standard_speed_data_block();
|
|
|
|
void get_turbo_speed_data_block();
|
|
|
|
void get_pure_tone_data_block();
|
|
|
|
void get_pulse_sequence();
|
2017-08-03 16:13:41 +00:00
|
|
|
void get_pure_data_block();
|
2018-02-23 02:28:12 +00:00
|
|
|
void get_direct_recording_block();
|
|
|
|
void get_csw_recording_block();
|
2017-07-17 02:40:38 +00:00
|
|
|
void get_generalised_data_block();
|
2017-08-02 18:12:34 +00:00
|
|
|
void get_pause();
|
2017-08-03 16:13:41 +00:00
|
|
|
|
|
|
|
void ignore_group_start();
|
|
|
|
void ignore_group_end();
|
|
|
|
void ignore_jump_to_block();
|
|
|
|
void ignore_loop_start();
|
|
|
|
void ignore_loop_end();
|
|
|
|
void ignore_call_sequence();
|
|
|
|
void ignore_return_from_sequence();
|
|
|
|
void ignore_select_block();
|
2018-02-23 02:28:12 +00:00
|
|
|
void ignore_stop_tape_if_in_48kb_mode();
|
|
|
|
|
|
|
|
void get_set_signal_level();
|
|
|
|
|
2017-08-03 16:13:41 +00:00
|
|
|
void ignore_text_description();
|
|
|
|
void ignore_message_block();
|
2018-02-23 02:28:12 +00:00
|
|
|
void ignore_archive_info();
|
|
|
|
void get_hardware_type();
|
|
|
|
void ignore_custom_info_block();
|
|
|
|
|
|
|
|
void get_kansas_city_block();
|
|
|
|
void ignore_glue_block();
|
2017-08-03 16:13:41 +00:00
|
|
|
|
|
|
|
struct Data {
|
2017-08-02 18:36:47 +00:00
|
|
|
unsigned int length_of_zero_bit_pulse;
|
|
|
|
unsigned int length_of_one_bit_pulse;
|
|
|
|
unsigned int number_of_bits_in_final_byte;
|
|
|
|
unsigned int pause_after_block;
|
2020-07-25 01:55:33 +00:00
|
|
|
uint32_t data_length;
|
2017-08-02 18:36:47 +00:00
|
|
|
};
|
|
|
|
|
2017-08-03 16:13:41 +00:00
|
|
|
struct DataBlock {
|
|
|
|
unsigned int length_of_pilot_pulse;
|
|
|
|
unsigned int length_of_sync_first_pulse;
|
|
|
|
unsigned int length_of_sync_second_pulse;
|
|
|
|
unsigned int length_of_pilot_tone;
|
|
|
|
Data data;
|
|
|
|
};
|
|
|
|
|
2017-07-17 11:34:10 +00:00
|
|
|
void get_generalised_segment(uint32_t output_symbols, uint8_t max_pulses_per_symbol, uint8_t number_of_symbols, bool is_data);
|
2017-08-02 18:36:47 +00:00
|
|
|
void get_data_block(const DataBlock &);
|
2017-08-03 16:13:41 +00:00
|
|
|
void get_data(const Data &);
|
2017-07-17 23:38:15 +00:00
|
|
|
|
2017-12-20 02:53:04 +00:00
|
|
|
void post_pulses(unsigned int count, unsigned int length);
|
2017-07-17 23:38:15 +00:00
|
|
|
void post_pulse(unsigned int length);
|
2017-07-21 22:21:12 +00:00
|
|
|
void post_gap(unsigned int milliseconds);
|
|
|
|
|
|
|
|
void post_pulse(const Storage::Time &time);
|
2017-07-17 01:33:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|