diff options
author | 2012-09-17 06:37:37 +0000 | |
---|---|---|
committer | 2012-09-17 06:37:37 +0000 | |
commit | f97e8f00818bd8d898facc206ed33ab72cf10a75 (patch) | |
tree | 3a021c194ebfddc4a1ac50c11cc9338d93eb2e91 | |
parent | f18ba655cc9409898ee372663a6c2c34d7234675 (diff) |
ATI Stereo F/X ISA card support [Carl]
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | src/mess/drivers/at.c | 1 | ||||
-rw-r--r-- | src/mess/includes/at.h | 1 | ||||
-rw-r--r-- | src/mess/machine/isa_stereo_fx.c | 240 | ||||
-rw-r--r-- | src/mess/machine/isa_stereo_fx.h | 81 | ||||
-rw-r--r-- | src/mess/mess.mak | 1 |
6 files changed, 326 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index 43eec3cf5a0..8de15e1762a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6784,6 +6784,8 @@ src/mess/machine/isa_mpu401.c svneol=native#text/plain src/mess/machine/isa_mpu401.h svneol=native#text/plain src/mess/machine/isa_sblaster.c svneol=native#text/plain src/mess/machine/isa_sblaster.h svneol=native#text/plain +src/mess/machine/isa_stereo_fx.c svneol=native#text/plain +src/mess/machine/isa_stereo_fx.h svneol=native#text/plain src/mess/machine/isa_wdxt_gen.c svneol=native#text/plain src/mess/machine/isa_wdxt_gen.h svneol=native#text/plain src/mess/machine/k7659kb.c svneol=native#text/plain diff --git a/src/mess/drivers/at.c b/src/mess/drivers/at.c index 1e6cb8d03aa..6ad885f3492 100644 --- a/src/mess/drivers/at.c +++ b/src/mess/drivers/at.c @@ -362,6 +362,7 @@ static SLOT_INTERFACE_START(pc_isa16_cards) SLOT_INTERFACE("gblaster", ISA8_GAME_BLASTER) SLOT_INTERFACE("sblaster1_0", ISA8_SOUND_BLASTER_1_0) SLOT_INTERFACE("sblaster1_5", ISA8_SOUND_BLASTER_1_5) + SLOT_INTERFACE("stereo_fx", ISA8_STEREO_FX) SLOT_INTERFACE("ne1000", NE1000) SLOT_INTERFACE("3c503", EL2_3C503) SLOT_INTERFACE("mpu401", ISA8_MPU401) diff --git a/src/mess/includes/at.h b/src/mess/includes/at.h index 77043fa870c..d73e08fc9f4 100644 --- a/src/mess/includes/at.h +++ b/src/mess/includes/at.h @@ -54,6 +54,7 @@ #include "machine/isa_gblaster.h" #include "machine/isa_hdc.h" #include "machine/isa_sblaster.h" +#include "machine/isa_stereo_fx.h" #include "machine/isa_gus.h" #include "machine/3c503.h" #include "machine/ne1000.h" diff --git a/src/mess/machine/isa_stereo_fx.c b/src/mess/machine/isa_stereo_fx.c new file mode 100644 index 00000000000..791d39c47ff --- /dev/null +++ b/src/mess/machine/isa_stereo_fx.c @@ -0,0 +1,240 @@ +// ATI Stereo F/X +// +// TODO: UART is connected to MIDI port + +#include "isa_stereo_fx.h" + +const device_type ISA8_STEREO_FX = &device_creator<stereo_fx_device>; + +static const ym3812_interface pc_ym3812_interface = +{ + NULL +}; + +READ8_MEMBER( stereo_fx_device::dev_dsp_data_r ) +{ + m_data_in = false; + return m_in_byte; +} + +WRITE8_MEMBER( stereo_fx_device::dev_dsp_data_w ) +{ + m_data_out = true; + m_out_byte = data; +} + +// port 1 is the left DAC but is written and read bitwise during capture +READ8_MEMBER( stereo_fx_device::p1_r ) +{ + return 0x80; +} + +READ8_MEMBER( stereo_fx_device::p3_r ) +{ + UINT8 ret = 0; + + ret |= m_data_out << 2; // INT0 + ret |= m_data_in << 3; // INT1 + ret |= m_t0 << 4; // T0 + ret |= m_t1 << 5; // T1 + return ret; +} + +WRITE8_MEMBER( stereo_fx_device::p3_w ) +{ + m_t1 = (data & 0x20)&&1; +} + +WRITE8_MEMBER( stereo_fx_device::dev_host_irq_w ) +{ + m_isa->irq5_w(1); +} + +WRITE8_MEMBER( stereo_fx_device::raise_drq_w ) +{ + m_isa->drq1_w(1); +} + +/* port 0x20 - in ROM (usually) stored in RAM 0x22 + * bit0 - + * bit1 - + * bit2 - + * bit3 - + * bit4 - + * bit5 - + * bit6 - + * bit7 - +*/ +WRITE8_MEMBER( stereo_fx_device::port20_w ) +{ + m_port20 = data; +} + +/* port 0x00 - in ROM (usually) stored in RAM 0x21 + * bit0 - bits 0-4 related to sample rate + * bit1 - are set to 0x09-0x1e + * bit2 - + * bit3 - + * bit4 - + * bit5 - + * bit6 - + * bit7 - +*/ +WRITE8_MEMBER( stereo_fx_device::port00_w ) +{ + m_port00 = data; +} + +ROM_START( stereo_fx ) + ROM_REGION( 0x8000, "stereo_fx_cpu", 0 ) + ROM_LOAD("ati_stereo_fx.bin", 0x0000, 0x8000, CRC(1BEBFFA6) SHA1(e66c2619a6c05199554b5702d67877ae3799d415)) +ROM_END + +static ADDRESS_MAP_START(stereo_fx_io, AS_IO, 8, stereo_fx_device) + AM_RANGE(0xFF00, 0xFF00) AM_WRITE(port00_w) + AM_RANGE(0xFF10, 0xFF10) AM_DEVWRITE("dacr", dac_device, write_unsigned8) + AM_RANGE(0xFF20, 0xFF20) AM_WRITE(port20_w) + //AM_RANGE(0xFF30, 0xFF30) AM_WRITE() // used only on reset and undocumented cmd 0xc4 + AM_RANGE(0xFF40, 0xFF40) AM_READWRITE(dev_dsp_data_r, dev_dsp_data_w) + AM_RANGE(0xFF50, 0xFF50) AM_WRITE(raise_drq_w) + AM_RANGE(0xFF60, 0xFF60) AM_WRITE(dev_host_irq_w) + AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READ(p1_r) AM_DEVWRITE("dacl", dac_device, write_unsigned8) + AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_r, p3_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START(stereo_fx_rom, AS_PROGRAM, 8, stereo_fx_device) + AM_RANGE(0x0000, 0x7fff) AM_ROM +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( stereo_fx ) + MCFG_CPU_ADD("stereo_fx_cpu", I80C31, XTAL_30MHz) + MCFG_CPU_IO_MAP(stereo_fx_io) + MCFG_CPU_PROGRAM_MAP(stereo_fx_rom) + + MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_SOUND_ADD("ym3812", YM3812, XTAL_3_579545MHz) + MCFG_SOUND_CONFIG(pc_ym3812_interface) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.00) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00) + /* no CM/S support (empty sockets) */ + + MCFG_SOUND_ADD("dacl", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.00) + MCFG_SOUND_ADD("dacr", DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.00) + + MCFG_PC_JOY_ADD("joy") +MACHINE_CONFIG_END + +const rom_entry *stereo_fx_device::device_rom_region() const +{ + return ROM_NAME( stereo_fx ); +} + +machine_config_constructor stereo_fx_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( stereo_fx ); +} + +READ8_MEMBER( stereo_fx_device::dsp_data_r ) +{ + m_data_out = false; + return m_out_byte; +} + +WRITE8_MEMBER( stereo_fx_device::dsp_cmd_w ) +{ + m_data_in = true; + m_in_byte = data; +} + +UINT8 stereo_fx_device::dack_r(int line) +{ + m_data_out = false; + m_isa->drq1_w(0); + return m_out_byte; +} + +void stereo_fx_device::dack_w(int line, UINT8 data) +{ + m_data_in = true; + m_isa->drq1_w(0); + m_in_byte = data; +} + +WRITE8_MEMBER( stereo_fx_device::dsp_reset_w ) +{ + device_reset(); + m_cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); +} + +READ8_MEMBER( stereo_fx_device::dsp_wbuf_status_r ) +{ + return m_data_in << 7; +} + +READ8_MEMBER( stereo_fx_device::dsp_rbuf_status_r ) +{ + m_isa->irq5_w(0); + return m_data_out << 7; +} + +WRITE8_MEMBER( stereo_fx_device::invalid_w ) +{ + logerror("stereo fx: invalid port write\n"); +} + +READ8_MEMBER( stereo_fx_device::invalid_r ) +{ + logerror("stereo fx: invalid port write\n"); + return 0xff; +} + +stereo_fx_device::stereo_fx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ISA8_STEREO_FX, "ATI Stereo F/X Audio Adapter", tag, owner, clock), + device_isa8_card_interface(mconfig, *this), + m_dacl(*this, "dacl"), + m_dacr(*this, "dacr"), + m_joy(*this, "joy"), + m_cpu(*this, "stereo_fx_cpu") +{ + m_t1 = 0; +} + +void stereo_fx_device::device_config_complete() +{ + m_shortname = "stereo_fx"; +} + +void stereo_fx_device::device_start() +{ + set_isa_device(); + m_isa->install_device(0x0200, 0x0207, 0, 0, read8_delegate(FUNC(pc_joy_device::joy_port_r), subdevice<pc_joy_device>("joy")), write8_delegate(FUNC(pc_joy_device::joy_port_w), subdevice<pc_joy_device>("joy"))); + m_isa->install_device(0x0226, 0x0227, 0, 0, read8_delegate(FUNC(stereo_fx_device::invalid_r), this), write8_delegate(FUNC(stereo_fx_device::dsp_reset_w), this)); + m_isa->install_device(0x022a, 0x022b, 0, 0, read8_delegate(FUNC(stereo_fx_device::dsp_data_r), this), write8_delegate(FUNC(stereo_fx_device::invalid_w), this) ); + m_isa->install_device(0x022c, 0x022d, 0, 0, read8_delegate(FUNC(stereo_fx_device::dsp_wbuf_status_r), this), write8_delegate(FUNC(stereo_fx_device::dsp_cmd_w), this) ); + m_isa->install_device(0x022e, 0x022f, 0, 0, read8_delegate(FUNC(stereo_fx_device::dsp_rbuf_status_r), this), write8_delegate(FUNC(stereo_fx_device::invalid_w), this) ); + m_isa->install_device(subdevice("ym3812"), 0x0388, 0x0389, 0, 0, FUNC(ym3812_r), FUNC(ym3812_w) ); + m_isa->install_device(subdevice("ym3812"), 0x0228, 0x0229, 0, 0, FUNC(ym3812_r), FUNC(ym3812_w) ); + m_timer = timer_alloc(); + m_timer->adjust(attotime::from_hz(2000000), 0, attotime::from_hz(2000000)); + m_isa->set_dma_channel(1, this, FALSE); +} + + +void stereo_fx_device::device_reset() +{ + m_isa->drq1_w(0); + m_isa->irq5_w(0); + m_data_out = false; + m_data_in = false; + m_port20 = 0; + m_port00 = 0; + m_t0 = CLEAR_LINE; +} + +void stereo_fx_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +{ + m_t0 = !m_t0; + m_cpu->set_input_line(MCS51_T0_LINE, m_t0); +} diff --git a/src/mess/machine/isa_stereo_fx.h b/src/mess/machine/isa_stereo_fx.h new file mode 100644 index 00000000000..934102d50b8 --- /dev/null +++ b/src/mess/machine/isa_stereo_fx.h @@ -0,0 +1,81 @@ +#ifndef __STEREO_FX__ +#define __STEREO_FX__ + +#include "emu.h" +#include "machine/isa.h" +#include "sound/dac.h" +#include "machine/pc_joy.h" +#include "cpu/mcs51/mcs51.h" +#include "sound/3812intf.h" + +//********************************************************************* +// TYPE DEFINITIONS +//********************************************************************* + +// ====================> stereo_fx_device + +class stereo_fx_device : public device_t, + public device_isa8_card_interface +{ +public: + // construction/destruction + stereo_fx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; + + required_device<dac_device> m_dacl; + required_device<dac_device> m_dacr; + required_device<pc_joy_device> m_joy; + required_device<cpu_device> m_cpu; + + // mcu ports + DECLARE_READ8_MEMBER( dev_dsp_data_r ); + DECLARE_WRITE8_MEMBER( dev_dsp_data_w ); + DECLARE_READ8_MEMBER( p1_r ); + DECLARE_READ8_MEMBER( p3_r ); + DECLARE_WRITE8_MEMBER( p3_w ); + DECLARE_WRITE8_MEMBER( dev_host_irq_w ); + DECLARE_WRITE8_MEMBER( raise_drq_w ); + DECLARE_WRITE8_MEMBER( port20_w ); + DECLARE_WRITE8_MEMBER( port00_w ); + + // host ports + DECLARE_READ8_MEMBER( dsp_data_r ); + DECLARE_WRITE8_MEMBER( dsp_cmd_w ); + DECLARE_WRITE8_MEMBER( dsp_reset_w ); + DECLARE_READ8_MEMBER( dsp_wbuf_status_r ); + DECLARE_READ8_MEMBER( dsp_rbuf_status_r ); + DECLARE_READ8_MEMBER( invalid_r ); + DECLARE_WRITE8_MEMBER( invalid_w ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_config_complete(); + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + UINT8 dack_r(int line); + void dack_w(int line, UINT8 data); +private: + // internal state + bool m_data_in; + UINT8 m_in_byte; + bool m_data_out; + UINT8 m_out_byte; + + UINT8 m_port20; + UINT8 m_port00; + emu_timer *m_timer; + UINT8 m_t0; + UINT8 m_t1; +}; + +// device type definition + +extern const device_type ISA8_STEREO_FX; + +#endif + diff --git a/src/mess/mess.mak b/src/mess/mess.mak index d6ffd9a24e9..d633fecc6f5 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1452,6 +1452,7 @@ $(MESSOBJ)/pcshare.a: \ $(MESS_MACHINE)/isa_ibm_mfc.o \ $(MESS_MACHINE)/isa_mpu401.o \ $(MESS_MACHINE)/isa_sblaster.o \ + $(MESS_MACHINE)/isa_stereo_fx.o \ $(MESS_MACHINE)/isa_ide.o \ $(MESS_MACHINE)/isa_ide_cd.o \ $(MESS_MACHINE)/isa_aha1542.o \ |