mirror of
https://github.com/holub/mame
synced 2025-05-11 16:48:52 +03:00
Some atari 8bit cassette work, not working yet (nw)
This commit is contained in:
parent
d18d667665
commit
e7f8f57303
@ -45,6 +45,9 @@
|
||||
MCFG_DEVICE_SLOT_INTERFACE(a8sio_cards, _def_slot, false) \
|
||||
a8sio_slot_device::static_set_a8sio_slot(*device, _nbtag, _tag);
|
||||
|
||||
#define MCFG_A8SIO_DATA_IN_CB(_devcb) \
|
||||
devcb = &a8sio_device::set_data_in_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
|
||||
class a8sio_slot_device : public device_t,
|
||||
public device_slot_interface
|
||||
|
@ -26,10 +26,12 @@ TODO:
|
||||
//**************************************************************************
|
||||
|
||||
const device_type A8SIO_CASSETTE = &device_creator<a8sio_cassette_device>;
|
||||
const device_timer_id TIMER_CASSETTE_READ = 1;
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( cassette )
|
||||
MCFG_CASSETTE_ADD("cassette")
|
||||
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
|
||||
//MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
|
||||
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
|
||||
MCFG_CASSETTE_INTERFACE("atari8bit_cass")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
@ -46,6 +48,8 @@ a8sio_cassette_device::a8sio_cassette_device(const machine_config &mconfig, cons
|
||||
: device_t(mconfig, A8SIO_CASSETTE, "Atari 8 bit cassette", tag, owner, clock, "a8sio_cass", __FILE__)
|
||||
, device_a8sio_card_interface(mconfig, *this)
|
||||
, m_cassette(*this, "cassette")
|
||||
, m_old_cass_signal(0)
|
||||
, m_signal_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -53,12 +57,19 @@ a8sio_cassette_device::a8sio_cassette_device(const machine_config &mconfig, devi
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
|
||||
, device_a8sio_card_interface(mconfig, *this)
|
||||
, m_cassette(*this, "cassette")
|
||||
, m_old_cass_signal(0)
|
||||
, m_signal_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_start()
|
||||
{
|
||||
set_a8sio_device();
|
||||
|
||||
save_item(NAME(m_old_cass_signal));
|
||||
save_item(NAME(m_signal_count));
|
||||
|
||||
m_read_timer = timer_alloc(TIMER_CASSETTE_READ);
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_reset()
|
||||
@ -68,5 +79,40 @@ void a8sio_cassette_device::device_reset()
|
||||
WRITE_LINE_MEMBER( a8sio_cassette_device::motor_w )
|
||||
{
|
||||
//printf("a8sio_cassette::motor_w %d\n", state);
|
||||
if (!state)
|
||||
{
|
||||
m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
|
||||
m_read_timer->adjust(attotime::zero, 0, attotime::from_hz(44100));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
|
||||
m_read_timer->reset();
|
||||
}
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_CASSETTE_READ:
|
||||
UINT8 cass_signal = m_cassette->input() < 0 ? 0 : 1;
|
||||
|
||||
if (m_signal_count < 20)
|
||||
{
|
||||
m_signal_count++;
|
||||
}
|
||||
|
||||
if (cass_signal != m_old_cass_signal)
|
||||
{
|
||||
//printf("cass_signal: %d, count: %d, data: %d\n", cass_signal, m_signal_count, m_signal_count < 5 ? 1 : 0);
|
||||
// ~4 kHz -> 0
|
||||
// ~5 kHz -> 1
|
||||
m_a8sio->data_in_w((m_signal_count < 5) ? 1 : 0);
|
||||
m_signal_count = 0;
|
||||
m_old_cass_signal = cass_signal;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,13 @@ public:
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
emu_timer *m_read_timer;
|
||||
|
||||
UINT8 m_old_cass_signal;
|
||||
UINT8 m_signal_count;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -1055,6 +1055,18 @@ void pokey_device::write_internal(offs_t offset, UINT8 data)
|
||||
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( pokey_device::sid_w )
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
m_SKSTAT |= SK_SERIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SKSTAT &= ~SK_SERIN;
|
||||
}
|
||||
}
|
||||
|
||||
void pokey_device::serin_ready(int after)
|
||||
{
|
||||
timer_set(m_clock_period * after, 5, 0);
|
||||
|
@ -234,6 +234,7 @@ public:
|
||||
UINT8 read(offs_t offset);
|
||||
void write(offs_t offset, UINT8 data);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( sid_w ); // pin 24
|
||||
void serin_ready(int after);
|
||||
|
||||
// analog output configuration
|
||||
|
@ -2100,6 +2100,7 @@ static MACHINE_CONFIG_START( atari_common_nodac, a400_state )
|
||||
MCFG_PIA_CB2_HANDLER(DEVWRITELINE("fdc", atari_fdc_device, pia_cb2_w))
|
||||
|
||||
MCFG_DEVICE_ADD("a8sio", A8SIO, 0)
|
||||
MCFG_A8SIO_DATA_IN_CB(DEVWRITELINE("pokey", pokey_device, sid_w))
|
||||
MCFG_A8SIO_SLOT_ADD("a8sio", "sio", NULL)
|
||||
|
||||
/* sound hardware */
|
||||
|
Loading…
Reference in New Issue
Block a user