From b5e08ae5e83f3c58948e82b80fb9b349504a9ef7 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 6 Apr 2020 01:37:05 +1000 Subject: H8: added support for H8T tapes. --- src/lib/formats/h8_cas.cpp | 149 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 src/lib/formats/h8_cas.cpp (limited to 'src/lib/formats/h8_cas.cpp') diff --git a/src/lib/formats/h8_cas.cpp b/src/lib/formats/h8_cas.cpp new file mode 100644 index 00000000000..ec92a94b10f --- /dev/null +++ b/src/lib/formats/h8_cas.cpp @@ -0,0 +1,149 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/******************************************************************** + +Support for Heathkit H8 H8T cassette images + + +Standard Kansas City format (300 baud) + +We output a leader, followed by the contents of the H8T file. + +********************************************************************/ + +#include + +#include "h8_cas.h" + +#define WAVEENTRY_LOW -32768 +#define WAVEENTRY_HIGH 32767 + +#define H8_WAV_FREQUENCY 9600 + +// image size +static int h8_image_size; + +static int h8_put_samples(int16_t *buffer, int sample_pos, int count, int level) +{ + if (buffer) + { + for (int i=0; i> i) & 1); + + // stop bits + for (i = 0; i<2; i++) + samples += h8_output_bit (buffer, sample_pos + samples, 1); + + return samples; +} + +static int h8_handle_cassette(int16_t *buffer, const uint8_t *bytes) +{ + uint32_t sample_count = 0; + uint32_t byte_count = 0; + uint32_t i; + + + // leader + for (i=0; i<2000; i++) + sample_count += h8_output_bit(buffer, sample_count, 1); + + // data + for (i=byte_count; i