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
|
|
|
|
Pulse get_next_pulse();
|
|
|
|
void reset();
|
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-01-18 23:06:09 +00:00
|
|
|
gzFile _file;
|
|
|
|
unsigned int _time_base;
|
2016-09-08 11:41:26 +00:00
|
|
|
bool _is_at_end;
|
2016-09-08 11:48:20 +00:00
|
|
|
bool _is_300_baud;
|
2016-01-19 01:37:36 +00:00
|
|
|
|
2016-09-08 11:41:26 +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 */
|