mirror of
https://github.com/holub/mame
synced 2025-05-22 21:58:57 +03:00
Sync with MESS (no whatsnew)
This commit is contained in:
parent
330fd72c4e
commit
f7a125b8ea
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1583,6 +1583,8 @@ src/lib/formats/primoptp.c svneol=native#text/plain
|
||||
src/lib/formats/primoptp.h svneol=native#text/plain
|
||||
src/lib/formats/rk_cas.c svneol=native#text/plain
|
||||
src/lib/formats/rk_cas.h svneol=native#text/plain
|
||||
src/lib/formats/sc3000_bit.c svneol=native#text/plain
|
||||
src/lib/formats/sc3000_bit.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_dsk.c svneol=native#text/plain
|
||||
|
102
src/lib/formats/sc3000_bit.c
Normal file
102
src/lib/formats/sc3000_bit.c
Normal file
@ -0,0 +1,102 @@
|
||||
/*********************************************************************
|
||||
|
||||
formats/sc3000_bit.c
|
||||
|
||||
Cassette code for Sega SC-3000 *.bit files
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "sc3000_bit.h"
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
***************************************************************************/
|
||||
|
||||
#define LOG 0
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
CassetteModulation sc3000_bit_modulation
|
||||
-------------------------------------------------*/
|
||||
|
||||
static const struct CassetteModulation sc3000_bit_modulation =
|
||||
{
|
||||
CASSETTE_MODULATION_SINEWAVE,
|
||||
1200.0 - 300, 1200.0, 1200.0 + 300,
|
||||
2400.0 - 600, 2400.0, 2400.0 + 600
|
||||
};
|
||||
|
||||
/*-------------------------------------------------
|
||||
sc3000_bit_identify - identify cassette
|
||||
-------------------------------------------------*/
|
||||
|
||||
static casserr_t sc3000_bit_identify(cassette_image *cassette, struct CassetteOptions *opts)
|
||||
{
|
||||
return cassette_modulation_identify( cassette, &sc3000_bit_modulation, opts);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
sc3000_bit_load - load cassette
|
||||
-------------------------------------------------*/
|
||||
|
||||
#define MODULATE(_value) \
|
||||
for (int i = 0; i < (_value ? 2 : 1); i++) { \
|
||||
err = cassette_put_modulated_data_bit(cassette, 0, time_index, _value, &sc3000_bit_modulation, &time_displacement);\
|
||||
if (err) return err;\
|
||||
time_index += time_displacement;\
|
||||
}
|
||||
|
||||
static casserr_t sc3000_bit_load(cassette_image *cassette)
|
||||
{
|
||||
casserr_t err;
|
||||
UINT64 image_size = cassette_image_size(cassette);
|
||||
UINT64 image_pos = 0;
|
||||
double time_index = 0.0;
|
||||
double time_displacement;
|
||||
UINT8 data;
|
||||
|
||||
while (image_pos < image_size)
|
||||
{
|
||||
cassette_image_read(cassette, &data, image_pos, 1);
|
||||
|
||||
switch (data)
|
||||
{
|
||||
case '1':
|
||||
MODULATE(1);
|
||||
break;
|
||||
|
||||
case '0':
|
||||
MODULATE(0);
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
err = cassette_put_sample( cassette, 0, time_index, 1/1200.0, 0);
|
||||
if (err) return err;
|
||||
time_index += 1/1200.0;
|
||||
break;
|
||||
}
|
||||
|
||||
image_pos++;
|
||||
}
|
||||
|
||||
return CASSETTE_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
CassetteFormat sc3000_bit_cassette_format
|
||||
-------------------------------------------------*/
|
||||
|
||||
const struct CassetteFormat sc3000_bit_format =
|
||||
{
|
||||
"bit",
|
||||
sc3000_bit_identify,
|
||||
sc3000_bit_load,
|
||||
NULL
|
||||
};
|
||||
|
||||
CASSETTE_FORMATLIST_START( sc3000_cassette_formats )
|
||||
CASSETTE_FORMAT(sc3000_bit_format)
|
||||
CASSETTE_FORMATLIST_END
|
18
src/lib/formats/sc3000_bit.h
Normal file
18
src/lib/formats/sc3000_bit.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*********************************************************************
|
||||
|
||||
formats/sc3000_bit.h
|
||||
|
||||
Cassette code for Sega SC-3000 *.bit files
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __SC3000_BIT__
|
||||
#define __SC3000_BIT__
|
||||
|
||||
#include "cassimg.h"
|
||||
|
||||
CASSETTE_FORMATLIST_EXTERN( sc3000_cassette_formats );
|
||||
|
||||
#endif
|
@ -144,6 +144,7 @@ FORMATSOBJS = \
|
||||
$(LIBOBJ)/formats/pmd_cas.o \
|
||||
$(LIBOBJ)/formats/primoptp.o \
|
||||
$(LIBOBJ)/formats/rk_cas.o \
|
||||
$(LIBOBJ)/formats/sc3000_bit.o \
|
||||
$(LIBOBJ)/formats/smx_dsk.o \
|
||||
$(LIBOBJ)/formats/sorc_dsk.o \
|
||||
$(LIBOBJ)/formats/sord_cas.o \
|
||||
|
Loading…
Reference in New Issue
Block a user