diff --git a/.gitattributes b/.gitattributes index 197f83ee06b..7d4565838a9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2937,6 +2937,8 @@ src/lib/formats/sf7000_dsk.c svneol=native#text/plain src/lib/formats/sf7000_dsk.h svneol=native#text/plain src/lib/formats/smx_dsk.c svneol=native#text/plain src/lib/formats/smx_dsk.h svneol=native#text/plain +src/lib/formats/sorc_cas.c svneol=native#text/plain +src/lib/formats/sorc_cas.h svneol=native#text/plain src/lib/formats/sorc_dsk.c svneol=native#text/plain src/lib/formats/sorc_dsk.h svneol=native#text/plain src/lib/formats/sord_cas.c svneol=native#text/plain diff --git a/src/lib/formats/sorc_cas.c b/src/lib/formats/sorc_cas.c new file mode 100644 index 00000000000..99e9d46f7d9 --- /dev/null +++ b/src/lib/formats/sorc_cas.c @@ -0,0 +1,156 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/******************************************************************** + +Support for Exidy Sorcerer cassette images + + +Sorcerer tapes consist of these sections: +1. A high tone whenever idle +2. A header +3. The data, in blocks of 256 bytes plus a CRC byte +4. The last block may be shorter, depending on the number of bytes + left to save. + +Each byte has 1 start bit, 8 data bits (0-7), 2 stop bits. + +The default speed is 1200 baud, which is what we emulate here. +A high bit is 1 cycle of 1200 Hz, while a low bit is half a cycle +of 600 Hz. + +Formats: +TAPE - this contains a byte for each real byte, including all the +header and leader bytes. + + +********************************************************************/ + +#include "sorc_cas.h" + +#define WAVEENTRY_LOW -32768 +#define WAVEENTRY_HIGH 32767 + +#define SORCERER_WAV_FREQUENCY 4800 + +// image size +static int sorcerer_image_size; +static bool level; + +static int sorcerer_put_samples(INT16 *buffer, int sample_pos, int count) +{ + if (buffer) + { + for (int i=0; i> i) & 1); + + /* stop */ + for (i = 0; i<2; i++) + samples += sorcerer_output_bit (buffer, sample_pos + samples, 1); + + return samples; +} + +static int sorcerer_handle_cassette(INT16 *buffer, const UINT8 *bytes) +{ + UINT32 sample_count = 0; + UINT32 i; + + /* idle */ + for (i=0; i<2000; i++) + sample_count += sorcerer_output_bit(buffer, sample_count, 1); + + /* data */ + for (i=0; i m_maincpu; required_device m_cassette1; required_device m_cassette2; @@ -86,18 +99,6 @@ public: required_device m_ram; required_ioport m_iop_config; required_ioport m_iop_vs; - DECLARE_DRIVER_INIT(sorcerer); - virtual void machine_start(); - virtual void machine_reset(); - DECLARE_MACHINE_START(sorcererd); - TIMER_CALLBACK_MEMBER(sorcerer_serial_tc); - TIMER_CALLBACK_MEMBER(sorcerer_cassette_tc); - TIMER_CALLBACK_MEMBER(sorcerer_reset); - DECLARE_SNAPSHOT_LOAD_MEMBER( sorcerer ); - DECLARE_QUICKLOAD_LOAD_MEMBER( sorcerer); - -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; #endif /* SORCERER_H_ */