mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
(MESS) fc100 : added support for CAS-format files.
This commit is contained in:
parent
62fdedd01c
commit
67ad2ee836
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3375,6 +3375,8 @@ src/lib/formats/esq16_dsk.c svneol=native#text/plain
|
||||
src/lib/formats/esq16_dsk.h svneol=native#text/plain
|
||||
src/lib/formats/esq8_dsk.c svneol=native#text/plain
|
||||
src/lib/formats/esq8_dsk.h svneol=native#text/plain
|
||||
src/lib/formats/fc100_cas.c svneol=native#text/plain
|
||||
src/lib/formats/fc100_cas.h svneol=native#text/plain
|
||||
src/lib/formats/fdi_dsk.c svneol=native#text/plain
|
||||
src/lib/formats/flopimg.c svneol=native#text/plain
|
||||
src/lib/formats/flopimg.h svneol=native#text/plain
|
||||
|
154
src/lib/formats/fc100_cas.c
Normal file
154
src/lib/formats/fc100_cas.c
Normal file
@ -0,0 +1,154 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Robbbert
|
||||
/********************************************************************
|
||||
|
||||
Support for Goldstar Famicom FC-100 cassette images
|
||||
|
||||
|
||||
We don't actually have any info on the cassette frequencies, so
|
||||
it's all a guess.
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include "fc100_cas.h"
|
||||
|
||||
#define WAVEENTRY_LOW -32768
|
||||
#define WAVEENTRY_HIGH 32767
|
||||
|
||||
#define FC100_WAV_FREQUENCY 9600
|
||||
#define FC100_HEADER_BYTES 16
|
||||
|
||||
// image size
|
||||
static int fc100_image_size;
|
||||
|
||||
static int fc100_put_samples(INT16 *buffer, int sample_pos, int count, int level)
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
for (int i=0; i<count; i++)
|
||||
buffer[sample_pos + i] = level;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static int fc100_output_bit(INT16 *buffer, int sample_pos, bool bit)
|
||||
{
|
||||
int samples = 0;
|
||||
|
||||
if (bit)
|
||||
{
|
||||
samples += fc100_put_samples(buffer, sample_pos + samples, 2, WAVEENTRY_LOW);
|
||||
samples += fc100_put_samples(buffer, sample_pos + samples, 2, WAVEENTRY_HIGH);
|
||||
samples += fc100_put_samples(buffer, sample_pos + samples, 2, WAVEENTRY_LOW);
|
||||
samples += fc100_put_samples(buffer, sample_pos + samples, 2, WAVEENTRY_HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
samples += fc100_put_samples(buffer, sample_pos + samples, 4, WAVEENTRY_LOW);
|
||||
samples += fc100_put_samples(buffer, sample_pos + samples, 4, WAVEENTRY_HIGH);
|
||||
}
|
||||
|
||||
return samples;
|
||||
}
|
||||
|
||||
static int fc100_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
|
||||
{
|
||||
int samples = 0;
|
||||
UINT8 i;
|
||||
|
||||
/* start */
|
||||
samples += fc100_output_bit (buffer, sample_pos + samples, 0);
|
||||
|
||||
/* data */
|
||||
for (i = 0; i<8; i++)
|
||||
samples += fc100_output_bit (buffer, sample_pos + samples, (byte >> i) & 1);
|
||||
|
||||
/* stop */
|
||||
for (i = 0; i<4; i++)
|
||||
samples += fc100_output_bit (buffer, sample_pos + samples, 1);
|
||||
|
||||
return samples;
|
||||
}
|
||||
|
||||
static int fc100_handle_cassette(INT16 *buffer, const UINT8 *bytes)
|
||||
{
|
||||
UINT32 sample_count = 0;
|
||||
UINT32 byte_count = 0;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
/* start */
|
||||
for (i=0; i<2155; i++)
|
||||
sample_count += fc100_output_bit(buffer, sample_count, 1);
|
||||
|
||||
/* header */
|
||||
for (int i=0; i<FC100_HEADER_BYTES; i++)
|
||||
sample_count += fc100_output_byte(buffer, sample_count, bytes[i]);
|
||||
|
||||
byte_count = FC100_HEADER_BYTES;
|
||||
|
||||
/* pause */
|
||||
for (i=0; i<1630; i++)
|
||||
sample_count += fc100_output_bit(buffer, sample_count, 1);
|
||||
|
||||
/* data */
|
||||
for (i=byte_count; i<fc100_image_size; i++)
|
||||
sample_count += fc100_output_byte(buffer, sample_count, bytes[i]);
|
||||
|
||||
return sample_count;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Generate samples for the tape image
|
||||
********************************************************************/
|
||||
|
||||
static int fc100_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
|
||||
{
|
||||
return fc100_handle_cassette(buffer, bytes);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Calculate the number of samples needed for this tape image
|
||||
********************************************************************/
|
||||
|
||||
static int fc100_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
|
||||
{
|
||||
fc100_image_size = length;
|
||||
|
||||
return fc100_handle_cassette(NULL, bytes);
|
||||
}
|
||||
|
||||
static const struct CassetteLegacyWaveFiller fc100_legacy_fill_wave =
|
||||
{
|
||||
fc100_cassette_fill_wave, /* fill_wave */
|
||||
-1, /* chunk_size */
|
||||
0, /* chunk_samples */
|
||||
fc100_cassette_calculate_size_in_samples, /* chunk_sample_calc */
|
||||
FC100_WAV_FREQUENCY, /* sample_frequency */
|
||||
0, /* header_samples */
|
||||
0 /* trailer_samples */
|
||||
};
|
||||
|
||||
static casserr_t fc100_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts)
|
||||
{
|
||||
return cassette_legacy_identify(cassette, opts, &fc100_legacy_fill_wave);
|
||||
}
|
||||
|
||||
static casserr_t fc100_cassette_load(cassette_image *cassette)
|
||||
{
|
||||
return cassette_legacy_construct(cassette, &fc100_legacy_fill_wave);
|
||||
}
|
||||
|
||||
static const struct CassetteFormat fc100_cassette_image_format =
|
||||
{
|
||||
"cas",
|
||||
fc100_cassette_identify,
|
||||
fc100_cassette_load,
|
||||
NULL
|
||||
};
|
||||
|
||||
CASSETTE_FORMATLIST_START(fc100_cassette_formats)
|
||||
CASSETTE_FORMAT(fc100_cassette_image_format)
|
||||
CASSETTE_FORMATLIST_END
|
14
src/lib/formats/fc100_cas.h
Normal file
14
src/lib/formats/fc100_cas.h
Normal file
@ -0,0 +1,14 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Robbbert
|
||||
/*********************************************************************
|
||||
|
||||
fc100_cas.h
|
||||
|
||||
Format code for Goldstar Famicom-100 cassette images (CAS format)
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
#include "cassimg.h"
|
||||
|
||||
CASSETTE_FORMATLIST_EXTERN(fc100_cassette_formats);
|
@ -142,6 +142,7 @@ FORMATSOBJS = \
|
||||
$(LIBOBJ)/formats/ep64_dsk.o \
|
||||
$(LIBOBJ)/formats/esq8_dsk.o \
|
||||
$(LIBOBJ)/formats/esq16_dsk.o \
|
||||
$(LIBOBJ)/formats/fc100_cas.o \
|
||||
$(LIBOBJ)/formats/fdi_dsk.o \
|
||||
$(LIBOBJ)/formats/fm7_cas.o \
|
||||
$(LIBOBJ)/formats/fmsx_cas.o \
|
||||
|
@ -11,7 +11,8 @@ Shift-Run to BREAK out of CLOAD.
|
||||
Cassette uses the uart.
|
||||
|
||||
TODO:
|
||||
- Hookup Graphics modes
|
||||
- Cassette frequencies are guesses, need to be verified
|
||||
- Hookup Graphics modes and colours
|
||||
- Unknown i/o ports
|
||||
- Does it have a cart slot? Yes. What address?
|
||||
- Expansion?
|
||||
@ -29,6 +30,7 @@ TODO:
|
||||
#include "sound/ay8910.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "sound/wave.h"
|
||||
#include "formats/fc100_cas.h"
|
||||
|
||||
|
||||
class fc100_state : public driver_device
|
||||
@ -382,16 +384,15 @@ TIMER_DEVICE_CALLBACK_MEMBER( fc100_state::timer_p)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static const cassette_interface fc100_cassette_interface =
|
||||
{
|
||||
cassette_default_formats,
|
||||
fc100_cassette_formats,
|
||||
NULL,
|
||||
(cassette_state) (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED),
|
||||
"fc100_cass",
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
//******************** MACHINE ******************************
|
||||
|
||||
@ -423,12 +424,12 @@ void fc100_state::machine_reset()
|
||||
|
||||
static MACHINE_CONFIG_START( fc100, fc100_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu",Z80, 9159090/2)
|
||||
MCFG_CPU_ADD("maincpu",Z80, XTAL_7_15909MHz/2)
|
||||
MCFG_CPU_PROGRAM_MAP(fc100_mem)
|
||||
MCFG_CPU_IO_MAP(fc100_io)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_MC6847_ADD("s68047p", S68047, 9159090/3, fc100_mc6847_interface ) // Clock not verified
|
||||
MCFG_MC6847_ADD("s68047p", S68047, XTAL_7_15909MHz/3, fc100_mc6847_interface ) // Clock not verified
|
||||
MCFG_MC6847_FSYNC_CALLBACK(WRITELINE(fc100_state, irq_w))
|
||||
MCFG_SCREEN_MC6847_NTSC_ADD("screen", "s68047p")
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "f4palette", fc100)
|
||||
@ -438,12 +439,12 @@ static MACHINE_CONFIG_START( fc100, fc100_state )
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
MCFG_SOUND_ADD("psg", AY8910, 9159090/3/2) /* AY-3-8910 - clock not verified */
|
||||
MCFG_SOUND_ADD("psg", AY8910, XTAL_7_15909MHz/3/2) /* AY-3-8910 - clock not verified */
|
||||
MCFG_SOUND_CONFIG(ay8910_intf)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.50)
|
||||
|
||||
/* Devices */
|
||||
MCFG_CASSETTE_ADD("cassette", default_cassette_interface) //fc100_cassette_interface)
|
||||
MCFG_CASSETTE_ADD("cassette", fc100_cassette_interface)
|
||||
MCFG_DEVICE_ADD("uart", I8251, 0)
|
||||
MCFG_I8251_TXD_HANDLER(WRITELINE(fc100_state, txdata_callback))
|
||||
MCFG_DEVICE_ADD("uart_clock", CLOCK, XTAL_4_9152MHz/16/16) // gives 19200
|
||||
|
Loading…
Reference in New Issue
Block a user