2016-06-25 20:09:32 +00:00
|
|
|
//
|
|
|
|
// CommodoreTAP.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 25/06/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CommodoreTAP_hpp
|
|
|
|
#define CommodoreTAP_hpp
|
|
|
|
|
|
|
|
#include "../Tape.hpp"
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
namespace Storage {
|
2016-08-27 21:09:45 +00:00
|
|
|
namespace Tape {
|
2016-06-25 20:09:32 +00:00
|
|
|
|
2016-08-01 10:04:55 +00:00
|
|
|
/*!
|
2016-08-15 23:37:21 +00:00
|
|
|
Provides a @c Tape containing a Commodore-format tape image, which is simply a timed list of downward-going zero crossings.
|
2016-08-01 10:04:55 +00:00
|
|
|
*/
|
2016-06-25 20:09:32 +00:00
|
|
|
class CommodoreTAP: public Tape {
|
|
|
|
public:
|
2016-08-01 10:04:55 +00:00
|
|
|
/*!
|
|
|
|
Constructs a @c CommodoreTAP containing content from the file with name @c file_name.
|
|
|
|
|
|
|
|
@throws ErrorNotCommodoreTAP if this file could not be opened and recognised as a valid Commodore-format TAP.
|
|
|
|
*/
|
2016-06-25 20:09:32 +00:00
|
|
|
CommodoreTAP(const char *file_name);
|
|
|
|
~CommodoreTAP();
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ErrorNotCommodoreTAP
|
|
|
|
};
|
|
|
|
|
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-06-25 20:09:32 +00:00
|
|
|
private:
|
|
|
|
FILE *_file;
|
|
|
|
bool _updated_layout;
|
|
|
|
uint32_t _file_size;
|
|
|
|
|
|
|
|
Pulse _current_pulse;
|
2016-08-30 01:53:06 +00:00
|
|
|
bool _is_at_end;
|
2016-06-25 20:09:32 +00:00
|
|
|
};
|
|
|
|
|
2016-08-27 21:09:45 +00:00
|
|
|
}
|
2016-06-25 20:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CommodoreTAP_hpp */
|