mirror of
https://github.com/holub/mame
synced 2025-05-06 22:35:43 +03:00
dsbz80: Not just a one-way street (nw)
This commit is contained in:
parent
c27cf4867d
commit
1e4bfcd40b
@ -27,7 +27,7 @@ static ADDRESS_MAP_START( dsbz80io_map, AS_IO, 8, dsbz80_device )
|
||||
AM_RANGE(0xe5, 0xe7) AM_WRITE(mpeg_end_w)
|
||||
AM_RANGE(0xe8, 0xe8) AM_WRITE(mpeg_volume_w)
|
||||
AM_RANGE(0xe9, 0xe9) AM_WRITE(mpeg_stereo_w)
|
||||
AM_RANGE(0xf0, 0xf0) AM_DEVREAD("uart", i8251_device, data_r)
|
||||
AM_RANGE(0xf0, 0xf0) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w)
|
||||
AM_RANGE(0xf1, 0xf1) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -39,7 +39,7 @@ MACHINE_CONFIG_FRAGMENT( dsbz80 )
|
||||
|
||||
MCFG_DEVICE_ADD("uart", I8251, 4000000)
|
||||
MCFG_I8251_RXRDY_HANDLER(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0))
|
||||
// no TXD output
|
||||
MCFG_I8251_TXD_HANDLER(WRITELINE(dsbz80_device, output_txd))
|
||||
|
||||
MCFG_CLOCK_ADD("uart_clock", 100000)
|
||||
MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("uart", i8251_device, write_rxc))
|
||||
@ -74,7 +74,8 @@ dsbz80_device::dsbz80_device(const machine_config &mconfig, const char *tag, dev
|
||||
device_t(mconfig, DSBZ80, "Sega Z80-based Digital Sound Board", tag, owner, clock, "dsbz80", __FILE__),
|
||||
device_sound_interface(mconfig, *this),
|
||||
m_ourcpu(*this, Z80_TAG),
|
||||
m_uart(*this, "uart")
|
||||
m_uart(*this, "uart"),
|
||||
m_rxd_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -84,6 +85,7 @@ dsbz80_device::dsbz80_device(const machine_config &mconfig, const char *tag, dev
|
||||
|
||||
void dsbz80_device::device_start()
|
||||
{
|
||||
m_rxd_handler.resolve_safe();
|
||||
uint8_t *rom_base = machine().root_device().memregion("mpeg")->base();
|
||||
decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0);
|
||||
machine().sound().stream_alloc(*this, 0, 2, 32000);
|
||||
@ -108,6 +110,12 @@ WRITE_LINE_MEMBER(dsbz80_device::write_txd)
|
||||
m_uart->write_rxd(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(dsbz80_device::output_txd)
|
||||
{
|
||||
// not used by swa
|
||||
m_rxd_handler(state);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dsbz80_device::mpeg_trigger_w)
|
||||
{
|
||||
mp_state = data;
|
||||
|
@ -14,6 +14,9 @@
|
||||
#define MCFG_DSBZ80_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, DSBZ80, 0)
|
||||
|
||||
#define MCFG_DSBZ80_RXD_HANDLER(_devcb) \
|
||||
devcb = &dsbz80_device::set_rxd_handler(*device, DEVCB_##_devcb);
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
@ -27,10 +30,14 @@ public:
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const override;
|
||||
|
||||
// static configuration
|
||||
template<class _Object> static devcb_base &set_rxd_handler(device_t &device, _Object &&object) { return downcast<dsbz80_device &>(device).m_rxd_handler.set_callback(std::forward<_Object>(object)); }
|
||||
|
||||
required_device<cpu_device> m_ourcpu;
|
||||
required_device<i8251_device> m_uart;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(write_txd);
|
||||
DECLARE_WRITE_LINE_MEMBER(output_txd);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(mpeg_trigger_w);
|
||||
DECLARE_WRITE8_MEMBER(mpeg_start_w);
|
||||
@ -51,6 +58,8 @@ private:
|
||||
int16_t audio_buf[1152*2];
|
||||
uint32_t mp_start, mp_end, mp_vol, mp_pan, mp_state, lp_start, lp_end, start, end;
|
||||
int mp_pos, audio_pos, audio_avail;
|
||||
|
||||
devcb_write_line m_rxd_handler;
|
||||
};
|
||||
|
||||
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const override;
|
||||
|
||||
// static configuration
|
||||
template<class _Object> static devcb_base &set_rxd_handler(device_t &device, _Object &&object) { return downcast<segam1audio_device &>(device).m_rxd_handler.set_callback(std::forward<_Object>(object)); }
|
||||
|
||||
DECLARE_WRITE16_MEMBER(m1_snd_mpcm_bnk1_w);
|
||||
|
Loading…
Reference in New Issue
Block a user