mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
(MESS) apple2: Support generic 6850 MIDI card (Yamaha, Passport, etc). [R. Belmont]
This commit is contained in:
parent
b91d5a2ac3
commit
c3a7aa3e32
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -6706,6 +6706,8 @@ src/mess/machine/a2lang.c svneol=native#text/plain
|
||||
src/mess/machine/a2lang.h svneol=native#text/plain
|
||||
src/mess/machine/a2memexp.c svneol=native#text/plain
|
||||
src/mess/machine/a2memexp.h svneol=native#text/plain
|
||||
src/mess/machine/a2midi.c svneol=native#text/plain
|
||||
src/mess/machine/a2midi.h svneol=native#text/plain
|
||||
src/mess/machine/a2mockingboard.c svneol=native#text/plain
|
||||
src/mess/machine/a2mockingboard.h svneol=native#text/plain
|
||||
src/mess/machine/a2sam.c svneol=native#text/plain
|
||||
|
@ -211,6 +211,7 @@ Apple 3.5 and Apple 5.25 drives - up to three devices
|
||||
#include "machine/laser128.h"
|
||||
#include "machine/a2echoii.h"
|
||||
#include "machine/a2arcadebd.h"
|
||||
#include "machine/a2midi.h"
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
@ -629,6 +630,7 @@ static SLOT_INTERFACE_START(apple2_cards)
|
||||
SLOT_INTERFACE("vtc1", A2BUS_VTC1) /* Unknown VideoTerm clone #1 */
|
||||
SLOT_INTERFACE("vtc2", A2BUS_VTC2) /* Unknown VideoTerm clone #2 */
|
||||
SLOT_INTERFACE("arcbd", A2BUS_ARCADEBOARD) /* Third Millenium Engineering Arcade Board */
|
||||
SLOT_INTERFACE("midi", A2BUS_MIDI) /* Generic 6840+6850 MIDI board */
|
||||
// SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
|
213
src/mess/machine/a2midi.c
Normal file
213
src/mess/machine/a2midi.c
Normal file
@ -0,0 +1,213 @@
|
||||
/*********************************************************************
|
||||
|
||||
a2midi.c
|
||||
|
||||
Apple II 6850 MIDI card, as made by Passport, Yamaha, and others.
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/apple2.h"
|
||||
#include "machine/a2midi.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
***************************************************************************/
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
const device_type A2BUS_MIDI = &device_creator<a2bus_midi_device>;
|
||||
|
||||
#define MIDI_PTM_TAG "midi_ptm"
|
||||
#define MIDI_ACIA_TAG "midi_acia"
|
||||
|
||||
static struct ptm6840_interface ptm_interface =
|
||||
{
|
||||
1021800.0f,
|
||||
{ 1021800.0f, 1021800.0f, 1021800.0f },
|
||||
{ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, a2bus_midi_device, ptm_irq_w)
|
||||
};
|
||||
|
||||
static struct acia6850_interface acia_interface =
|
||||
{
|
||||
31250*16, // tx clock
|
||||
0, // rx clock (we manually clock rx)
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, a2bus_midi_device, rx_in), // rx in
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, a2bus_midi_device, tx_out), // tx out
|
||||
DEVCB_NULL, // cts in
|
||||
DEVCB_NULL, // rts out
|
||||
DEVCB_NULL, // dcd in
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, a2bus_midi_device, acia_irq_w)
|
||||
};
|
||||
|
||||
static SLOT_INTERFACE_START(midiin_slot)
|
||||
SLOT_INTERFACE("midiin", MIDIIN_PORT)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static const serial_port_interface midiin_intf =
|
||||
{
|
||||
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, a2bus_midi_device, midi_rx_w)
|
||||
};
|
||||
|
||||
static SLOT_INTERFACE_START(midiout_slot)
|
||||
SLOT_INTERFACE("midiout", MIDIOUT_PORT)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
static const serial_port_interface midiout_intf =
|
||||
{
|
||||
DEVCB_NULL // midi out ports don't transmit inward
|
||||
};
|
||||
|
||||
MACHINE_CONFIG_FRAGMENT( midi )
|
||||
MCFG_PTM6840_ADD(MIDI_PTM_TAG, ptm_interface)
|
||||
MCFG_ACIA6850_ADD(MIDI_ACIA_TAG, acia_interface)
|
||||
MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin", NULL)
|
||||
MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout", NULL)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
//-------------------------------------------------
|
||||
// machine_config_additions - device-specific
|
||||
// machine configurations
|
||||
//-------------------------------------------------
|
||||
|
||||
machine_config_constructor a2bus_midi_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( midi );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
a2bus_midi_device::a2bus_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, A2BUS_MIDI, "6850 MIDI card", tag, owner, clock),
|
||||
device_a2bus_card_interface(mconfig, *this),
|
||||
m_ptm(*this, MIDI_PTM_TAG),
|
||||
m_acia(*this, MIDI_ACIA_TAG),
|
||||
m_mdout(*this, "mdout")
|
||||
{
|
||||
m_shortname = "a2midi";
|
||||
}
|
||||
|
||||
a2bus_midi_device::a2bus_midi_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, type, name, tag, owner, clock),
|
||||
device_a2bus_card_interface(mconfig, *this),
|
||||
m_ptm(*this, MIDI_PTM_TAG),
|
||||
m_acia(*this, MIDI_ACIA_TAG),
|
||||
m_mdout(*this, "mdout")
|
||||
{
|
||||
m_shortname = "a2midi";
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void a2bus_midi_device::device_start()
|
||||
{
|
||||
// set_a2bus_device makes m_slot valid
|
||||
set_a2bus_device();
|
||||
}
|
||||
|
||||
void a2bus_midi_device::device_reset()
|
||||
{
|
||||
m_acia_irq = m_ptm_irq = false;
|
||||
m_rx_state = 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
read_c0nx - called for reads from this card's c0nx space
|
||||
-------------------------------------------------*/
|
||||
|
||||
UINT8 a2bus_midi_device::read_c0nx(address_space &space, UINT8 offset)
|
||||
{
|
||||
// PTM at C0n0-C0n7, ACIA at C0n8-C0n9, drum sync (?) at C0nA-C0nB
|
||||
|
||||
if (offset < 8)
|
||||
{
|
||||
return m_ptm->read(space, offset & 7);
|
||||
}
|
||||
else if (offset == 8)
|
||||
{
|
||||
return m_acia->status_read(space, 0);
|
||||
}
|
||||
else if (offset == 9)
|
||||
{
|
||||
UINT8 ret = m_acia->data_read(space, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
write_c0nx - called for writes to this card's c0nx space
|
||||
-------------------------------------------------*/
|
||||
|
||||
void a2bus_midi_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
|
||||
{
|
||||
if (offset < 8)
|
||||
{
|
||||
m_ptm->write(space, offset & 7, data);
|
||||
}
|
||||
else if (offset == 8)
|
||||
{
|
||||
m_acia->control_write(space, 0, data);
|
||||
}
|
||||
else if (offset == 9)
|
||||
{
|
||||
m_acia->data_write(space, 0, data);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a2bus_midi_device::acia_irq_w )
|
||||
{
|
||||
m_acia_irq = state ? true : false;
|
||||
|
||||
if (m_acia_irq || m_ptm_irq)
|
||||
{
|
||||
raise_slot_irq();
|
||||
}
|
||||
else
|
||||
{
|
||||
lower_slot_irq();
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a2bus_midi_device::ptm_irq_w )
|
||||
{
|
||||
m_acia_irq = state ? true : false;
|
||||
|
||||
if (m_acia_irq || m_ptm_irq)
|
||||
{
|
||||
raise_slot_irq();
|
||||
}
|
||||
else
|
||||
{
|
||||
lower_slot_irq();
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a2bus_midi_device::midi_rx_w )
|
||||
{
|
||||
m_rx_state = state;
|
||||
for (int i = 0; i < 16; i++) // divider is set to 16
|
||||
{
|
||||
m_acia->rx_clock_in();
|
||||
}
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER( a2bus_midi_device::rx_in )
|
||||
{
|
||||
return m_rx_state;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( a2bus_midi_device::tx_out )
|
||||
{
|
||||
m_mdout->tx(state);
|
||||
}
|
||||
|
61
src/mess/machine/a2midi.h
Normal file
61
src/mess/machine/a2midi.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*********************************************************************
|
||||
|
||||
a2midi.h
|
||||
|
||||
Apple II 6850 MIDI card, as made by Passport, Yamaha, and others.
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef __A2BUS_MIDI__
|
||||
#define __A2BUS_MIDI__
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/a2bus.h"
|
||||
#include "machine/6840ptm.h"
|
||||
#include "machine/6850acia.h"
|
||||
#include "machine/serial.h"
|
||||
#include "machine/midiinport.h"
|
||||
#include "machine/midioutport.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class a2bus_midi_device:
|
||||
public device_t,
|
||||
public device_a2bus_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
a2bus_midi_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
a2bus_midi_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( ptm_irq_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( midi_rx_w );
|
||||
DECLARE_READ_LINE_MEMBER( rx_in );
|
||||
DECLARE_WRITE_LINE_MEMBER( tx_out );
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
virtual UINT8 read_c0nx(address_space &space, UINT8 offset);
|
||||
virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data);
|
||||
|
||||
required_device<ptm6840_device> m_ptm;
|
||||
required_device<acia6850_device> m_acia;
|
||||
required_device<serial_port_device> m_mdout;
|
||||
|
||||
private:
|
||||
bool m_acia_irq, m_ptm_irq;
|
||||
int m_rx_state;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type A2BUS_MIDI;
|
||||
|
||||
#endif /* __A2BUS_MIDI__ */
|
@ -693,6 +693,7 @@ $(MESSOBJ)/apple.a: \
|
||||
$(MESS_MACHINE)/laser128.o \
|
||||
$(MESS_MACHINE)/a2echoii.o \
|
||||
$(MESS_MACHINE)/a2arcadebd.o \
|
||||
$(MESS_MACHINE)/a2midi.o \
|
||||
$(MESS_MACHINE)/lisa.o \
|
||||
$(MESS_DRIVERS)/lisa.o \
|
||||
$(MESS_MACHINE)/nubus.o \
|
||||
|
Loading…
Reference in New Issue
Block a user