mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Added skeleton for Atari 8bit SIO bus. This will not work until pokey learns to speak low level serial. (nw)
This commit is contained in:
parent
6c0a4f47e3
commit
b3932b60cb
220
src/emu/bus/a8sio/a8sio.c
Normal file
220
src/emu/bus/a8sio/a8sio.c
Normal file
@ -0,0 +1,220 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Wilbert Pol
|
||||
/***************************************************************************
|
||||
|
||||
a8sio.h - Atari 8 bit SIO bus interface
|
||||
|
||||
|
||||
1 1
|
||||
2 4 6 8 0 2
|
||||
+-----------+
|
||||
/ o o o o o o \
|
||||
/ o o o o o o o \
|
||||
+-----------------+
|
||||
1 3 5 7 9 1 1
|
||||
1 3
|
||||
|
||||
1 - clock in (to computer)
|
||||
2 - clock out
|
||||
3 - data in
|
||||
4 - GND
|
||||
5 - data out
|
||||
6 - GND
|
||||
7 - command (active low)
|
||||
8 - motor
|
||||
9 - proceed (active low)
|
||||
10 - +5V/ready
|
||||
11 - audio in
|
||||
12 - +12V (A400/A800)
|
||||
13 - interrupt (active low)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "a8sio.h"
|
||||
#include "cassette.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
const device_type A8SIO_SLOT = &device_creator<a8sio_slot_device>;
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// a8sio_slot_device - constructor
|
||||
//-------------------------------------------------
|
||||
a8sio_slot_device::a8sio_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, A8SIO_SLOT, "Atari 8 bit SIO Slot", tag, owner, clock, "a8sio_slot", __FILE__)
|
||||
, device_slot_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
a8sio_slot_device::a8sio_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
|
||||
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
|
||||
device_slot_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
void a8sio_slot_device::static_set_a8sio_slot(device_t &device, const char *tag, const char *slottag)
|
||||
{
|
||||
a8sio_slot_device &a8sio_ext = dynamic_cast<a8sio_slot_device &>(device);
|
||||
a8sio_ext.m_a8sio_tag = tag;
|
||||
a8sio_ext.m_a8sio_slottag = slottag;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void a8sio_slot_device::device_start()
|
||||
{
|
||||
device_a8sio_card_interface *dev = dynamic_cast<device_a8sio_card_interface *>(get_card_device());
|
||||
|
||||
if (dev)
|
||||
{
|
||||
device_a8sio_card_interface::static_set_a8sio_tag(*dev, m_a8sio_tag, m_a8sio_slottag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
const device_type A8SIO = &device_creator<a8sio_device>;
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// a8sio_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
a8sio_device::a8sio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, A8SIO, "Atari 8 biot SIO", tag, owner, clock, "a8sio", __FILE__)
|
||||
, m_out_clock_in_cb(*this)
|
||||
, m_out_data_in_cb(*this)
|
||||
, m_out_audio_in_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
a8sio_device::a8sio_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
|
||||
, m_out_clock_in_cb(*this)
|
||||
, m_out_data_in_cb(*this)
|
||||
, m_out_audio_in_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void a8sio_device::device_start()
|
||||
{
|
||||
// resolve callbacks
|
||||
m_out_clock_in_cb.resolve_safe();
|
||||
m_out_data_in_cb.resolve_safe();
|
||||
m_out_audio_in_cb.resolve_safe();
|
||||
|
||||
// clear slot
|
||||
m_device = NULL;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void a8sio_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
device_a8sio_card_interface *a8sio_device::get_a8sio_card()
|
||||
{
|
||||
return m_device;
|
||||
}
|
||||
|
||||
void a8sio_device::add_a8sio_card(device_a8sio_card_interface *card)
|
||||
{
|
||||
m_device = card;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a8sio_device::clock_in_w )
|
||||
{
|
||||
m_out_clock_in_cb(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a8sio_device::data_in_w )
|
||||
{
|
||||
m_out_data_in_cb(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a8sio_device::motor_w )
|
||||
{
|
||||
if (m_device)
|
||||
{
|
||||
m_device->motor_w(state);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( a8sio_device::audio_in_w )
|
||||
{
|
||||
m_out_audio_in_cb(data);
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE A8SIO CARD INTERFACE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_a8sio_card_interface - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_a8sio_card_interface::device_a8sio_card_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_slot_card_interface(mconfig, device)
|
||||
, m_a8sio(NULL)
|
||||
, m_a8sio_tag(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~device_a8sio_card_interface - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_a8sio_card_interface::~device_a8sio_card_interface()
|
||||
{
|
||||
}
|
||||
|
||||
void device_a8sio_card_interface::static_set_a8sio_tag(device_t &device, const char *tag, const char *slottag)
|
||||
{
|
||||
device_a8sio_card_interface &a8sio_card = dynamic_cast<device_a8sio_card_interface &>(device);
|
||||
a8sio_card.m_a8sio_tag = tag;
|
||||
a8sio_card.m_a8sio_slottag = slottag;
|
||||
}
|
||||
|
||||
void device_a8sio_card_interface::set_a8sio_device()
|
||||
{
|
||||
m_a8sio = dynamic_cast<a8sio_device *>(device().machine().device(m_a8sio_tag));
|
||||
m_a8sio->add_a8sio_card(this);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( device_a8sio_card_interface::motor_w )
|
||||
{
|
||||
//printf("device_a8sio_card_interface::motor_w %d\n", state);
|
||||
}
|
||||
|
||||
|
||||
SLOT_INTERFACE_START(a8sio_cards)
|
||||
SLOT_INTERFACE("cassette", A8SIO_CASSETTE)
|
||||
SLOT_INTERFACE_END
|
||||
|
141
src/emu/bus/a8sio/a8sio.h
Normal file
141
src/emu/bus/a8sio/a8sio.h
Normal file
@ -0,0 +1,141 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Wilbert Pol
|
||||
/***************************************************************************
|
||||
|
||||
a8sio.h - Atari 8 bit SIO bus interface
|
||||
|
||||
|
||||
1 1
|
||||
2 4 6 8 0 2
|
||||
+-----------+
|
||||
/ o o o o o o \
|
||||
/ o o o o o o o \
|
||||
+-----------------+
|
||||
1 3 5 7 9 1 1
|
||||
1 3
|
||||
|
||||
1 - clock in (to computer)
|
||||
2 - clock out
|
||||
3 - data in
|
||||
4 - GND
|
||||
5 - data out
|
||||
6 - GND
|
||||
7 - command (active low)
|
||||
8 - motor
|
||||
9 - proceed (active low)
|
||||
10 - +5V/ready
|
||||
11 - audio in
|
||||
12 - +12V (A400/A800)
|
||||
13 - interrupt (active low)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __A8SIO_H_
|
||||
#define __A8SIO_H_
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_A8SIO_SLOT_ADD(_nbtag, _tag, _def_slot) \
|
||||
MCFG_DEVICE_ADD(_tag, A8SIO_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(a8sio_cards, _def_slot, false) \
|
||||
a8sio_slot_device::static_set_a8sio_slot(*device, _nbtag, _tag);
|
||||
|
||||
|
||||
class a8sio_slot_device : public device_t,
|
||||
public device_slot_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
a8sio_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
a8sio_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
|
||||
// inline configuration
|
||||
static void static_set_a8sio_slot(device_t &device, const char *tag, const char *slottag);
|
||||
|
||||
protected:
|
||||
// configuration
|
||||
const char *m_a8sio_tag;
|
||||
const char *m_a8sio_slottag;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type A8SIO_SLOT;
|
||||
|
||||
|
||||
class device_a8sio_card_interface;
|
||||
|
||||
class a8sio_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
a8sio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
a8sio_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
|
||||
// inline configuration
|
||||
template<class _Object> static devcb_base &set_clock_in_callback(device_t &device, _Object object) { return downcast<a8sio_device &>(device).m_out_clock_in_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_data_in_callback(device_t &device, _Object object) { return downcast<a8sio_device &>(device).m_out_data_in_cb.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_audio_in_callback(device_t &device, _Object object) { return downcast<a8sio_device &>(device).m_out_audio_in_cb.set_callback(object); }
|
||||
|
||||
void add_a8sio_card(device_a8sio_card_interface *card);
|
||||
device_a8sio_card_interface *get_a8sio_card();
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( clock_in_w ); // pin 1
|
||||
//virtual DECLARE_WRITE_LINE_MEMBER( clock_out_w ); // pin 2
|
||||
DECLARE_WRITE_LINE_MEMBER( data_in_w ); // pin 3
|
||||
//DECLARE_WRITE_LINE_MEMBER( data_out_wi ); // pin 5
|
||||
//DECLARE_WRITE_LINE_MEMBER( command_w ); // pin 7
|
||||
DECLARE_WRITE_LINE_MEMBER( motor_w ); // pin 8
|
||||
//DECLARE_WRITE_LINE_MEMBER( proceed_w ); // pin 9
|
||||
DECLARE_WRITE8_MEMBER( audio_in_w ); // pin 11
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
devcb_write_line m_out_clock_in_cb; // pin 1
|
||||
devcb_write_line m_out_data_in_cb; // pin 3
|
||||
devcb_write8 m_out_audio_in_cb; // pin 11
|
||||
|
||||
device_a8sio_card_interface *m_device;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
extern const device_type A8SIO;
|
||||
|
||||
|
||||
class device_a8sio_card_interface : public device_slot_card_interface
|
||||
{
|
||||
friend class a8sio_device;
|
||||
public:
|
||||
// construction/destruction
|
||||
device_a8sio_card_interface(const machine_config &mconfig, device_t &device);
|
||||
virtual ~device_a8sio_card_interface();
|
||||
|
||||
void set_a8sio_device();
|
||||
|
||||
// inline configuration
|
||||
static void static_set_a8sio_tag(device_t &device, const char *tag, const char *slottag);
|
||||
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( motor_w );
|
||||
|
||||
public:
|
||||
a8sio_device *m_a8sio;
|
||||
const char *m_a8sio_tag;
|
||||
const char *m_a8sio_slottag;
|
||||
};
|
||||
|
||||
|
||||
SLOT_INTERFACE_EXTERN(a8sio_cards);
|
||||
|
||||
#endif
|
72
src/emu/bus/a8sio/cassette.c
Normal file
72
src/emu/bus/a8sio/cassette.c
Normal file
@ -0,0 +1,72 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Wilbert Pol
|
||||
/***************************************************************************
|
||||
|
||||
cassette.h - Atari 8 bit cassette player(s)
|
||||
|
||||
|
||||
Known cassette players:
|
||||
- Atari XC11
|
||||
- Atari XC12 (no SIO connection for an additional device)
|
||||
|
||||
TODO:
|
||||
- Implement cassette reading
|
||||
- Implement cassette writing
|
||||
- Add audio support
|
||||
- Add SIO connector for a next device
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cassette.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
const device_type A8SIO_CASSETTE = &device_creator<a8sio_cassette_device>;
|
||||
|
||||
static MACHINE_CONFIG_FRAGMENT( cassette )
|
||||
MCFG_CASSETTE_ADD("cassette")
|
||||
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
|
||||
MCFG_CASSETTE_INTERFACE("atari8bit_cass")
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
machine_config_constructor a8sio_cassette_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( cassette );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
a8sio_cassette_device::a8sio_cassette_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: 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")
|
||||
{
|
||||
}
|
||||
|
||||
a8sio_cassette_device::a8sio_cassette_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
|
||||
, device_a8sio_card_interface(mconfig, *this)
|
||||
, m_cassette(*this, "cassette")
|
||||
{
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_start()
|
||||
{
|
||||
set_a8sio_device();
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a8sio_cassette_device::motor_w )
|
||||
{
|
||||
//printf("a8sio_cassette::motor_w %d\n", state);
|
||||
}
|
||||
|
49
src/emu/bus/a8sio/cassette.h
Normal file
49
src/emu/bus/a8sio/cassette.h
Normal file
@ -0,0 +1,49 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Wilbert Pol
|
||||
/***************************************************************************
|
||||
|
||||
cassette.h - Atari 8 bit cassette player(s)
|
||||
|
||||
|
||||
Known cassette players:
|
||||
- Atari XC11
|
||||
- Atari XC12 (no SIO connection for an additional device)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __A8SIO_CASSETTE_H_
|
||||
#define __A8SIO_CASSETTE_H_
|
||||
|
||||
|
||||
#include "a8sio.h"
|
||||
#include "imagedev/cassette.h"
|
||||
|
||||
|
||||
class a8sio_cassette_device
|
||||
: public device_t
|
||||
, public device_a8sio_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
a8sio_cassette_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
a8sio_cassette_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
virtual DECLARE_WRITE_LINE_MEMBER( motor_w );
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type A8SIO_CASSETTE;
|
||||
|
||||
|
||||
#endif
|
@ -43,6 +43,18 @@ BUSOBJS += $(BUSOBJ)/a800/sparta.o
|
||||
endif
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
#@src/emu/bus/a8sio/a8sio.h,BUSES += A8SIO
|
||||
#-------------------------------------------------
|
||||
|
||||
ifneq ($(filter A8SIO,$(BUSES)),)
|
||||
OBJDIRS += $(BUSOBJ)/a8sio
|
||||
BUSOBJS += $(BUSOBJ)/a8sio/a8sio.o
|
||||
BUSOBJS += $(BUSOBJ)/a8sio/cassette.o
|
||||
endif
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
#
|
||||
#@src/emu/bus/abcbus/abcbus.h,BUSES += ABCBUS
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "machine/atarifdc.h"
|
||||
#include "bus/a800/a800_slot.h"
|
||||
#include "bus/a800/a800_carts.h"
|
||||
#include "bus/a8sio/a8sio.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -2075,6 +2076,7 @@ WRITE8_MEMBER(a400_state::a800xl_pia_pb_w)
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( atari_common_nodac, a400_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502, FREQ_17_EXACT)
|
||||
@ -2094,8 +2096,12 @@ static MACHINE_CONFIG_START( atari_common_nodac, a400_state )
|
||||
MCFG_DEVICE_ADD("pia", PIA6821, 0)
|
||||
MCFG_PIA_READPA_HANDLER(IOPORT("djoy_0_1"))
|
||||
MCFG_PIA_READPB_HANDLER(IOPORT("djoy_2_3"))
|
||||
MCFG_PIA_CA2_HANDLER(DEVWRITELINE("a8sio", a8sio_device, motor_w))
|
||||
MCFG_PIA_CB2_HANDLER(DEVWRITELINE("fdc", atari_fdc_device, pia_cb2_w))
|
||||
|
||||
MCFG_DEVICE_ADD("a8sio", A8SIO, 0)
|
||||
MCFG_A8SIO_SLOT_ADD("a8sio", "sio", NULL)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT)
|
||||
|
@ -570,6 +570,7 @@ BUSES += A1BUS
|
||||
BUSES += A2BUS
|
||||
BUSES += A7800
|
||||
BUSES += A800
|
||||
BUSES += A8SIO
|
||||
BUSES += ABCBUS
|
||||
BUSES += ABCKB
|
||||
BUSES += ADAM
|
||||
|
Loading…
Reference in New Issue
Block a user