changed dleuro from beep to speaker driven by z80ctc and removed some unnecessary accessors (nw)

This commit is contained in:
smf- 2014-02-23 13:50:08 +00:00
parent 38d827e993
commit 355c0c472a
6 changed files with 41 additions and 60 deletions

View File

@ -347,11 +347,11 @@ WRITE8_MEMBER( wangpc_wdc_device::status_w )
}
READ8_MEMBER( wangpc_wdc_device::ctc_ch0_r ) { return m_ctc->read(0); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch0_w ) { m_ctc->write(0, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch1_r ) { return m_ctc->read(1); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch1_w ) { m_ctc->write(1, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch2_r ) { return m_ctc->read(2); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch2_w ) { m_ctc->write(2, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch3_r ) { return m_ctc->read(3); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch3_w ) { m_ctc->write(3, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch0_r ) { return m_ctc->read(space, 0); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch0_w ) { m_ctc->write(space, 0, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch1_r ) { return m_ctc->read(space, 1); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch1_w ) { m_ctc->write(space, 1, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch2_r ) { return m_ctc->read(space, 2); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch2_w ) { m_ctc->write(space, 2, data); };
READ8_MEMBER( wangpc_wdc_device::ctc_ch3_r ) { return m_ctc->read(space, 3); };
WRITE8_MEMBER( wangpc_wdc_device::ctc_ch3_w ) { m_ctc->write(space, 3, data); };

View File

@ -326,8 +326,8 @@ void pioneer_ldv1000_device::player_vsync(const vbi_metadata &vbi, int fieldnum,
{
// generate interrupts if we hit the edges
slider_position sliderpos = get_slider_position();
m_z80_ctc->trigger(1, sliderpos == SLIDER_MINIMUM);
m_z80_ctc->trigger(2, sliderpos == SLIDER_MAXIMUM);
m_z80_ctc->trg1(sliderpos == SLIDER_MINIMUM);
m_z80_ctc->trg2(sliderpos == SLIDER_MAXIMUM);
// signal VSYNC and set a timer to turn it off
m_vsync = true;

View File

@ -92,7 +92,7 @@ z80ctc_device::z80ctc_device(const machine_config &mconfig, const char *tag, dev
READ8_MEMBER( z80ctc_device::read )
{
return read(offset & 3);
return m_channel[offset & 3].read();
}
@ -102,7 +102,7 @@ READ8_MEMBER( z80ctc_device::read )
WRITE8_MEMBER( z80ctc_device::write )
{
write(offset & 3, data);
m_channel[offset & 3].write(data);
}
@ -111,10 +111,10 @@ WRITE8_MEMBER( z80ctc_device::write )
// trigger
//-------------------------------------------------
WRITE_LINE_MEMBER( z80ctc_device::trg0 ) { trigger(0, state); }
WRITE_LINE_MEMBER( z80ctc_device::trg1 ) { trigger(1, state); }
WRITE_LINE_MEMBER( z80ctc_device::trg2 ) { trigger(2, state); }
WRITE_LINE_MEMBER( z80ctc_device::trg3 ) { trigger(3, state); }
WRITE_LINE_MEMBER( z80ctc_device::trg0 ) { m_channel[0].trigger(state); }
WRITE_LINE_MEMBER( z80ctc_device::trg1 ) { m_channel[1].trigger(state); }
WRITE_LINE_MEMBER( z80ctc_device::trg2 ) { m_channel[2].trigger(state); }
WRITE_LINE_MEMBER( z80ctc_device::trg3 ) { m_channel[3].trigger(state); }
//-------------------------------------------------

View File

@ -71,14 +71,6 @@ public:
// construction/destruction
z80ctc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// state getters
attotime period(int ch) const { return m_channel[ch].period(); }
// I/O operations
UINT8 read(int ch) { return m_channel[ch].read(); }
void write(int ch, UINT8 data) { m_channel[ch].write(data); }
void trigger(int ch, UINT8 data) { m_channel[ch].trigger(data); }
// read/write handlers
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@ -87,7 +79,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( trg2 );
DECLARE_WRITE_LINE_MEMBER( trg3 );
private:
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
@ -98,6 +90,7 @@ private:
virtual int z80daisy_irq_ack();
virtual void z80daisy_irq_reti();
private:
// internal helpers
void interrupt_check();
void timercallback(int chanindex);

View File

@ -43,22 +43,24 @@
#include "machine/z80ctc.h"
#include "machine/z80sio.h"
#include "sound/ay8910.h"
#include "sound/beep.h"
#include "sound/speaker.h"
#include "dlair.lh"
class dlair_state : public driver_device
{
public:
dlair_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_ldv1000(*this, "ld_ldv1000"),
m_pr7820(*this, "ld_pr7820"),
m_22vp932(*this, "ld_22vp932") ,
dlair_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_ldv1000(*this, "ld_ldv1000"),
m_pr7820(*this, "ld_pr7820"),
m_22vp932(*this, "ld_22vp932") ,
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_beeper(*this, "beeper"),
m_gfxdecode(*this, "gfxdecode") { }
m_speaker(*this, "speaker"),
m_gfxdecode(*this, "gfxdecode")
{
}
void laserdisc_data_w(UINT8 data)
{
@ -119,12 +121,12 @@ public:
DECLARE_MACHINE_RESET(dlair);
DECLARE_PALETTE_INIT(dleuro);
UINT32 screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_callback);
DECLARE_WRITE_LINE_MEMBER(write_speaker);
DECLARE_WRITE_LINE_MEMBER(dleuro_interrupt);
DECLARE_WRITE16_MEMBER(serial_transmit);
DECLARE_READ16_MEMBER(serial_receive);
required_device<cpu_device> m_maincpu;
optional_device<beep_device> m_beeper;
optional_device<speaker_sound_device> m_speaker;
optional_device<gfxdecode_device> m_gfxdecode;
};
@ -183,10 +185,17 @@ READ16_MEMBER(dlair_state::serial_receive)
}
WRITE_LINE_MEMBER(dlair_state::write_speaker)
{
m_speaker->level_w(state);
}
static Z80CTC_INTERFACE( ctc_intf )
{
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), /* interrupt handler */
DEVCB_NULL, /* ZC/TO0 callback */
DEVCB_DRIVER_LINE_MEMBER(dlair_state, write_speaker), /* ZC/TO0 callback */
DEVCB_NULL, /* ZC/TO1 callback */
DEVCB_NULL /* ZC/TO2 callback */
};
@ -281,25 +290,6 @@ MACHINE_RESET_MEMBER(dlair_state,dlair)
/*************************************
*
* VBLANK callback
*
*************************************/
INTERRUPT_GEN_MEMBER(dlair_state::vblank_callback)
{
/* also update the speaker on the European version */
if (m_beeper != NULL)
{
z80ctc_device *ctc = machine().device<z80ctc_device>("ctc");
m_beeper->set_state(1);
m_beeper->set_frequency(ATTOSECONDS_TO_HZ(ctc->period(0).attoseconds));
}
}
/*************************************
*
* Outputs
@ -732,7 +722,6 @@ static MACHINE_CONFIG_START( dlair_base, dlair_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK_US/4)
MCFG_CPU_PROGRAM_MAP(dlus_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dlair_state, vblank_callback)
MCFG_CPU_PERIODIC_INT_DRIVER(dlair_state, irq0_line_hold, (double)MASTER_CLOCK_US/8/16/16/16/16)
MCFG_MACHINE_START_OVERRIDE(dlair_state,dlair)
@ -770,7 +759,6 @@ static MACHINE_CONFIG_START( dleuro, dlair_state )
MCFG_CPU_CONFIG(dleuro_daisy_chain)
MCFG_CPU_PROGRAM_MAP(dleuro_map)
MCFG_CPU_IO_MAP(dleuro_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", dlair_state, vblank_callback)
MCFG_Z80CTC_ADD("ctc", MASTER_CLOCK_EURO/4 /* same as "maincpu" */, ctc_intf)
MCFG_Z80SIO_ADD("sio", MASTER_CLOCK_EURO/4 /* same as "maincpu" */, sio_intf)
@ -794,7 +782,7 @@ static MACHINE_CONFIG_START( dleuro, dlair_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD("beeper", BEEP, 0)
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.33)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33)

View File

@ -77,7 +77,7 @@ WRITE8_MEMBER( ampro_state::port00_w )
READ8_MEMBER( ampro_state::io_r )
{
if (offset < 0x40)
return m_ctc->read(offset>>4);
return m_ctc->read(space, offset>>4);
else
return m_dart->ba_cd_r(space, offset>>2);
}
@ -85,7 +85,7 @@ READ8_MEMBER( ampro_state::io_r )
WRITE8_MEMBER( ampro_state::io_w )
{
if (offset < 0x40)
m_ctc->write(offset>>4, data);
m_ctc->write(space, offset>>4, data);
else
m_dart->ba_cd_w(space, offset>>2, data);
}