From 6a57b6378f6d54dce01b3dc499dbb410b7c947c6 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 16 Feb 2014 15:15:05 +0000 Subject: [PATCH] (MESS) spc1000 : added TAP cassette format [Robbbert] --- .gitattributes | 2 + src/lib/formats/ace_tap.h | 2 +- src/lib/formats/adam_cas.h | 2 +- src/lib/formats/cassimg.c | 2 +- src/lib/formats/cgen_cas.h | 2 +- src/lib/formats/fmsx_cas.h | 2 +- src/lib/formats/kim1_cas.h | 2 +- src/lib/formats/lviv_lvt.h | 2 +- src/lib/formats/mz_cas.h | 2 +- src/lib/formats/phc25_cas.h | 2 +- src/lib/formats/pmd_cas.h | 2 +- src/lib/formats/primoptp.h | 2 +- src/lib/formats/spc1000_cas.c | 113 ++++++++++++++++++++++++++++++++++ src/lib/formats/spc1000_cas.h | 15 +++++ src/lib/formats/svi_cas.h | 2 +- src/lib/formats/trs_cas.h | 2 +- src/lib/formats/tvc_cas.h | 2 +- src/lib/formats/vt_cas.h | 2 +- src/lib/formats/x07_cas.h | 2 +- src/lib/formats/zx81_p.h | 2 +- src/lib/lib.mak | 1 + src/mess/drivers/spc1000.c | 46 ++++++-------- 22 files changed, 168 insertions(+), 43 deletions(-) create mode 100644 src/lib/formats/spc1000_cas.c create mode 100644 src/lib/formats/spc1000_cas.h diff --git a/.gitattributes b/.gitattributes index 7c0a1d3bdc4..3a4f7490f99 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2932,6 +2932,8 @@ 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 src/lib/formats/sord_cas.h svneol=native#text/plain +src/lib/formats/spc1000_cas.c svneol=native#text/plain +src/lib/formats/spc1000_cas.h svneol=native#text/plain src/lib/formats/st_dsk.c svneol=native#text/plain src/lib/formats/st_dsk.h svneol=native#text/plain src/lib/formats/svi_cas.c svneol=native#text/plain diff --git a/src/lib/formats/ace_tap.h b/src/lib/formats/ace_tap.h index 12ce3b7a8a8..252193204d6 100644 --- a/src/lib/formats/ace_tap.h +++ b/src/lib/formats/ace_tap.h @@ -2,7 +2,7 @@ ace_tap.h - Format code for Jupiter Ace casette files + Format code for Jupiter Ace cassette files *********************************************************************/ diff --git a/src/lib/formats/adam_cas.h b/src/lib/formats/adam_cas.h index 99e8b7bd481..55eea661e0d 100644 --- a/src/lib/formats/adam_cas.h +++ b/src/lib/formats/adam_cas.h @@ -2,7 +2,7 @@ adam_cas.h - Format code for Coleco Adam .ddp casette files. + Format code for Coleco Adam .ddp cassette files. *********************************************************************/ diff --git a/src/lib/formats/cassimg.c b/src/lib/formats/cassimg.c index 76a64e64f14..1594cf6121c 100644 --- a/src/lib/formats/cassimg.c +++ b/src/lib/formats/cassimg.c @@ -1030,7 +1030,7 @@ done: /********************************************************************* cassette_dump - A debugging call to dump a casette image to a disk based wave file + A debugging call to dump a cassette image to a disk based wave file *********************************************************************/ void cassette_dump(cassette_image *image, const char *filename) diff --git a/src/lib/formats/cgen_cas.h b/src/lib/formats/cgen_cas.h index 6dad463c15d..bea550ff8a2 100644 --- a/src/lib/formats/cgen_cas.h +++ b/src/lib/formats/cgen_cas.h @@ -2,7 +2,7 @@ cgen_cas.h - Format code for EACA Colour Genie .cas casette files. + Format code for EACA Colour Genie .cas cassette files. *********************************************************************/ diff --git a/src/lib/formats/fmsx_cas.h b/src/lib/formats/fmsx_cas.h index fe3e3d9d2f6..eb242aeb2fa 100644 --- a/src/lib/formats/fmsx_cas.h +++ b/src/lib/formats/fmsx_cas.h @@ -2,7 +2,7 @@ fmsx_cas.h - Format code for MSX casette files + Format code for MSX cassette files *********************************************************************/ diff --git a/src/lib/formats/kim1_cas.h b/src/lib/formats/kim1_cas.h index 8e971c842bb..ba86def635a 100644 --- a/src/lib/formats/kim1_cas.h +++ b/src/lib/formats/kim1_cas.h @@ -2,7 +2,7 @@ kim1_cas.h - Format code for KIM-1 casette files. + Format code for KIM-1 cassette files. *********************************************************************/ diff --git a/src/lib/formats/lviv_lvt.h b/src/lib/formats/lviv_lvt.h index 9629e1024d0..76e8fb81c83 100644 --- a/src/lib/formats/lviv_lvt.h +++ b/src/lib/formats/lviv_lvt.h @@ -2,7 +2,7 @@ lviv_lvt.h - Format code for Lviv casette files + Format code for Lviv cassette files *********************************************************************/ diff --git a/src/lib/formats/mz_cas.h b/src/lib/formats/mz_cas.h index a06f557a8ec..fac69f69cc3 100644 --- a/src/lib/formats/mz_cas.h +++ b/src/lib/formats/mz_cas.h @@ -2,7 +2,7 @@ mz_cas.h - Format code for MZ700 casette files + Format code for MZ700 cassette files *********************************************************************/ diff --git a/src/lib/formats/phc25_cas.h b/src/lib/formats/phc25_cas.h index 2fe9383568a..e4018911361 100644 --- a/src/lib/formats/phc25_cas.h +++ b/src/lib/formats/phc25_cas.h @@ -4,7 +4,7 @@ phc25_cas.h - Format code for Sanyo PHC25 casette images (phc format) + Format code for Sanyo PHC25 cassette images (phc format) *********************************************************************/ diff --git a/src/lib/formats/pmd_cas.h b/src/lib/formats/pmd_cas.h index f070607dd1e..c2d8a749ef1 100644 --- a/src/lib/formats/pmd_cas.h +++ b/src/lib/formats/pmd_cas.h @@ -4,7 +4,7 @@ pmd_cas.h - Format code for PMD-85 casette files + Format code for PMD-85 cassette files *********************************************************************/ diff --git a/src/lib/formats/primoptp.h b/src/lib/formats/primoptp.h index f934d637819..48577653098 100644 --- a/src/lib/formats/primoptp.h +++ b/src/lib/formats/primoptp.h @@ -2,7 +2,7 @@ primoptp.h - Format code for Primo casette files + Format code for Primo cassette files *********************************************************************/ diff --git a/src/lib/formats/spc1000_cas.c b/src/lib/formats/spc1000_cas.c new file mode 100644 index 00000000000..0218b2499e5 --- /dev/null +++ b/src/lib/formats/spc1000_cas.c @@ -0,0 +1,113 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/******************************************************************** + +Support for Samsung SPC-1000 cassette images + + +********************************************************************/ + +#include "spc1000_cas.h" + +#define WAVEENTRY_LOW -32768 +#define WAVEENTRY_HIGH 32767 + +#define SPC1000_WAV_FREQUENCY 17000 + +// image size +static int spc1000_image_size; + +static int spc1000_put_samples(INT16 *buffer, int sample_pos, int count, int level) +{ + if (buffer) + { + for (int i=0; i(); - return state->m_video_ram[0x1000+(ch&0x7F)*16+line]; + return state->m_p_videoram[0x1000+(ch&0x7F)*16+line]; } + required_shared_ptr m_p_videoram; private: UINT8 m_IPLK; UINT8 m_GMODE; - UINT8 m_video_ram[0x2000]; + UINT16 m_page; virtual void machine_reset(); required_device m_vdg; required_device m_maincpu; @@ -92,18 +95,6 @@ READ8_MEMBER(spc1000_state::spc1000_iplk_r) return 0; } - - -WRITE8_MEMBER(spc1000_state::spc1000_video_ram_w) -{ - m_video_ram[offset] = data; -} - -READ8_MEMBER(spc1000_state::spc1000_video_ram_r) -{ - return m_video_ram[offset]; -} - WRITE8_MEMBER( spc1000_state::cass_w ) { m_cass->output(BIT(data, 0) ? -1.0 : 1.0); @@ -119,6 +110,7 @@ WRITE8_MEMBER(spc1000_state::spc1000_gmode_w) m_vdg->gm0_w(BIT(data, 2)); m_vdg->ag_w(BIT(data, 3)); m_vdg->css_w(BIT(data, 7)); + m_page = ( (BIT(data, 5) << 1) | BIT(data, 4) )*0x200; } READ8_MEMBER(spc1000_state::spc1000_gmode_r) @@ -128,7 +120,7 @@ READ8_MEMBER(spc1000_state::spc1000_gmode_r) static ADDRESS_MAP_START( spc1000_io , AS_IO, 8, spc1000_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0000, 0x1fff) AM_READWRITE(spc1000_video_ram_r, spc1000_video_ram_w) + AM_RANGE(0x0000, 0x1fff) AM_RAM AM_SHARE("videoram") AM_RANGE(0x2000, 0x3fff) AM_READWRITE(spc1000_gmode_r, spc1000_gmode_w) AM_RANGE(0x4000, 0x4000) AM_DEVWRITE("ay8910", ay8910_device, address_w) AM_RANGE(0x4001, 0x4001) AM_DEVREADWRITE("ay8910", ay8910_device, data_r, data_w) @@ -266,16 +258,18 @@ READ8_MEMBER(spc1000_state::spc1000_mc6847_videoram_r) if (offset == ~0) return 0xff; // m_GMODE layout: CSS|NA|PS2|PS1|~A/G|GM0|GM1|NA - // [PS2,PS1] is used to set screen 0/1 pages - if ( !BIT(m_GMODE, 3) ) { // text mode (~A/G set to A) - unsigned int page = (BIT(m_GMODE, 5) << 1) | BIT(m_GMODE, 4); - m_vdg->inv_w(BIT(m_video_ram[offset+page*0x200+0x800], 0)); - m_vdg->css_w(BIT(m_video_ram[offset+page*0x200+0x800], 1)); - m_vdg->as_w(BIT(m_video_ram[offset+page*0x200+0x800], 2)); - m_vdg->intext_w(BIT(m_video_ram[offset+page*0x200+0x800], 3)); - return m_video_ram[offset+page*0x200]; - } else { // graphics mode: uses full 6KB of VRAM - return m_video_ram[offset]; + if ( !BIT(m_GMODE, 3) ) + { // text mode (~A/G set to A) + UINT8 data = m_p_videoram[offset+m_page+0x800]; + m_vdg->inv_w(BIT(data, 0)); + m_vdg->css_w(BIT(data, 1)); + m_vdg->as_w (BIT(data, 2)); + m_vdg->intext_w(BIT(data, 3)); + return m_p_videoram[offset+m_page]; + } + else + { // graphics mode: uses full 6KB of VRAM + return m_p_videoram[offset]; } } @@ -299,7 +293,7 @@ static const ay8910_interface spc1000_ay_interface = static const cassette_interface spc1000_cassette_interface = { - cassette_default_formats, + spc1000_cassette_formats, NULL, (cassette_state)(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED), NULL,