2016-01-18 21:46:41 +00:00
|
|
|
//
|
|
|
|
// TapeUEF.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 18/01/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef TapeUEF_hpp
|
|
|
|
#define TapeUEF_hpp
|
|
|
|
|
|
|
|
#include "../Tape.hpp"
|
2016-01-18 23:06:09 +00:00
|
|
|
#include <zlib.h>
|
2016-09-08 11:41:26 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
2016-01-18 21:46:41 +00:00
|
|
|
|
2016-01-18 23:06:09 +00:00
|
|
|
namespace Storage {
|
2016-08-27 21:09:45 +00:00
|
|
|
namespace Tape {
|
2016-01-18 23:06:09 +00:00
|
|
|
|
2016-08-01 10:04:55 +00:00
|
|
|
/*!
|
2016-08-01 10:54:57 +00:00
|
|
|
Provides a @c Tape containing a UEF tape image, a slightly-convoluted description of pulses.
|
2016-08-01 10:04:55 +00:00
|
|
|
*/
|
2016-08-27 21:09:45 +00:00
|
|
|
class UEF : public Tape {
|
2016-01-18 21:46:41 +00:00
|
|
|
public:
|
2016-08-01 10:04:55 +00:00
|
|
|
/*!
|
|
|
|
Constructs a @c UEF containing content from the file with name @c file_name.
|
|
|
|
|
|
|
|
@throws ErrorNotUEF if this file could not be opened and recognised as a valid UEF.
|
|
|
|
*/
|
2016-08-27 21:09:45 +00:00
|
|
|
UEF(const char *file_name);
|
|
|
|
~UEF();
|
2016-01-18 23:06:09 +00:00
|
|
|
|
2016-01-20 03:05:34 +00:00
|
|
|
enum {
|
|
|
|
ErrorNotUEF
|
|
|
|
};
|
|
|
|
|
2016-08-01 10:04:55 +00:00
|
|
|
// implemented to satisfy @c Tape
|
2016-08-30 01:53:06 +00:00
|
|
|
bool is_at_end();
|
2016-08-01 10:04:55 +00:00
|
|
|
|
2016-01-18 21:46:41 +00:00
|
|
|
private:
|
2016-09-11 21:09:00 +00:00
|
|
|
void virtual_reset();
|
|
|
|
Pulse virtual_get_next_pulse();
|
|
|
|
|
2016-11-21 12:14:09 +00:00
|
|
|
gzFile file_;
|
|
|
|
unsigned int time_base_;
|
|
|
|
bool is_at_end_;
|
|
|
|
bool is_300_baud_;
|
2016-01-19 01:37:36 +00:00
|
|
|
|
2016-11-21 12:14:09 +00:00
|
|
|
std::vector<Pulse> queued_pulses_;
|
|
|
|
size_t pulse_pointer_;
|
2016-03-13 04:19:10 +00:00
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
void parse_next_tape_chunk();
|
2016-09-05 22:28:43 +00:00
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
void queue_implicit_bit_pattern(uint32_t length);
|
|
|
|
void queue_explicit_bit_pattern(uint32_t length);
|
2016-01-18 23:06:09 +00:00
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
void queue_integer_gap();
|
|
|
|
void queue_floating_point_gap();
|
2016-01-19 01:37:36 +00:00
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
void queue_carrier_tone();
|
|
|
|
void queue_carrier_tone_with_dummy();
|
2016-01-19 01:45:14 +00:00
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
void queue_security_cycles();
|
|
|
|
void queue_defined_data(uint32_t length);
|
2016-02-21 03:18:00 +00:00
|
|
|
|
2016-09-08 11:41:26 +00:00
|
|
|
void queue_bit(int bit);
|
|
|
|
void queue_implicit_byte(uint8_t byte);
|
2016-01-18 21:46:41 +00:00
|
|
|
};
|
|
|
|
|
2016-08-27 21:09:45 +00:00
|
|
|
}
|
2016-01-18 23:06:09 +00:00
|
|
|
}
|
|
|
|
|
2016-01-18 21:46:41 +00:00
|
|
|
#endif /* TapeUEF_hpp */
|