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
|
|
|
|
|
2017-07-17 02:04:40 +00:00
|
|
|
#include "../PulseQueuedTape.hpp"
|
2017-08-27 19:43:09 +00:00
|
|
|
|
|
|
|
#include "../../TargetPlatforms.hpp"
|
|
|
|
|
2016-01-18 23:06:09 +00:00
|
|
|
#include <zlib.h>
|
2016-09-08 11:41:26 +00:00
|
|
|
#include <cstdint>
|
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
|
|
|
*/
|
2017-08-27 19:43:09 +00:00
|
|
|
class UEF : public PulseQueuedTape, public TargetPlatform::TypeDistinguisher {
|
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-01-18 21:46:41 +00:00
|
|
|
private:
|
2016-09-11 21:09:00 +00:00
|
|
|
void virtual_reset();
|
|
|
|
|
2017-08-27 19:43:09 +00:00
|
|
|
void set_platform_type();
|
|
|
|
TargetPlatform::Type target_platform_type();
|
2017-11-11 03:47:10 +00:00
|
|
|
TargetPlatform::Type platform_type_ = TargetPlatform::Acorn;
|
2017-08-27 19:43:09 +00:00
|
|
|
|
2016-11-21 12:14:09 +00:00
|
|
|
gzFile file_;
|
2017-11-11 03:47:10 +00:00
|
|
|
unsigned int time_base_ = 1200;
|
|
|
|
bool is_300_baud_ = false;
|
2016-01-19 01:37:36 +00:00
|
|
|
|
2017-08-27 19:43:09 +00:00
|
|
|
struct Chunk {
|
|
|
|
uint16_t id;
|
|
|
|
uint32_t length;
|
|
|
|
z_off_t start_of_next_chunk;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool get_next_chunk(Chunk &);
|
2017-07-17 02:04:40 +00:00
|
|
|
void get_next_pulses();
|
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 */
|