diff options
author | 2013-06-03 11:39:54 +0000 | |
---|---|---|
committer | 2013-06-03 11:39:54 +0000 | |
commit | e098aab416851304b8fd12b126c6ec98aeca6742 (patch) | |
tree | b760ba56173e31cec5ebad7a1f80814b759530e0 /src/mess/machine | |
parent | c601f928555dd0a4c2772803be7b224cda0c6e62 (diff) |
Modernized the PIT8253 device. [Fabio Priuli]
Diffstat (limited to 'src/mess/machine')
-rw-r--r-- | src/mess/machine/amstr_pc.c | 4 | ||||
-rw-r--r-- | src/mess/machine/at.c | 6 | ||||
-rw-r--r-- | src/mess/machine/b2m.c | 5 | ||||
-rw-r--r-- | src/mess/machine/bebox.c | 3 | ||||
-rw-r--r-- | src/mess/machine/compis.c | 8 | ||||
-rw-r--r-- | src/mess/machine/dai.c | 6 | ||||
-rw-r--r-- | src/mess/machine/europc.c | 4 | ||||
-rw-r--r-- | src/mess/machine/genpc.c | 12 | ||||
-rw-r--r-- | src/mess/machine/irisha.c | 4 | ||||
-rw-r--r-- | src/mess/machine/isa_ibm_mfc.c | 6 | ||||
-rw-r--r-- | src/mess/machine/mbc55x.c | 6 | ||||
-rw-r--r-- | src/mess/machine/mz700.c | 17 | ||||
-rw-r--r-- | src/mess/machine/mz80.c | 6 | ||||
-rw-r--r-- | src/mess/machine/pc.c | 31 | ||||
-rw-r--r-- | src/mess/machine/pk8020.c | 6 | ||||
-rw-r--r-- | src/mess/machine/pmd85.c | 6 | ||||
-rw-r--r-- | src/mess/machine/pp01.c | 4 | ||||
-rw-r--r-- | src/mess/machine/southbridge.c | 8 | ||||
-rw-r--r-- | src/mess/machine/special.c | 9 | ||||
-rw-r--r-- | src/mess/machine/tandy1t.c | 2 |
20 files changed, 69 insertions, 84 deletions
diff --git a/src/mess/machine/amstr_pc.c b/src/mess/machine/amstr_pc.c index f272512aee9..0c869faefb9 100644 --- a/src/mess/machine/amstr_pc.c +++ b/src/mess/machine/amstr_pc.c @@ -184,7 +184,7 @@ WRITE8_MEMBER( amstrad_pc_state::pc1640_port60_w ) m_port61=data; if (data==0x30) m_port62=(m_port65&0x10)>>4; else if (data==0x34) m_port62=m_port65&0xf; - pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0)); + machine().device<pit8253_device>("pit8253")->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); pc_keyb_set_clock(data&0x40); break; @@ -222,7 +222,7 @@ READ8_MEMBER( amstrad_pc_state::pc1640_port60_r ) case 2: data = m_port62; - if (pit8253_get_output(machine().device("pit8253"), 2)) + if (machine().device<pit8253_device>("pit8253")->get_output(2)) data |= 0x20; break; } diff --git a/src/mess/machine/at.c b/src/mess/machine/at.c index 00ae168e508..88bf53154a9 100644 --- a/src/mess/machine/at.c +++ b/src/mess/machine/at.c @@ -59,7 +59,7 @@ WRITE_LINE_MEMBER( at_state::at_pit8254_out2_changed ) } -const struct pit8253_config at_pit8254_config = +const struct pit8253_interface at_pit8254_config = { { { @@ -276,7 +276,7 @@ READ8_MEMBER( at_state::at_portb_r ) } data = (data & ~0x10) | ( m_at_offset1 & 0x10 ); - if ( pit8253_get_output(m_pit8254, 2 ) ) + if (m_pit8254->get_output(2)) data |= 0x20; else data &= ~0x20; /* ps2m30 wants this */ @@ -287,7 +287,7 @@ READ8_MEMBER( at_state::at_portb_r ) WRITE8_MEMBER( at_state::at_portb_w ) { m_at_speaker = data; - pit8253_gate2_w(m_pit8254, BIT(data, 0)); + m_pit8254->gate2_w(BIT(data, 0)); at_speaker_set_spkrdata( BIT(data, 1)); m_channel_check = BIT(data, 3); m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); diff --git a/src/mess/machine/b2m.c b/src/mess/machine/b2m.c index a960ba20d86..9ddaff38cdb 100644 --- a/src/mess/machine/b2m.c +++ b/src/mess/machine/b2m.c @@ -11,7 +11,6 @@ #include "cpu/i8085/i8085.h" #include "imagedev/cassette.h" #include "machine/i8255.h" -#include "machine/pit8253.h" #include "machine/wd_fdc.h" #include "machine/pic8259.h" #include "machine/i8251.h" @@ -147,7 +146,7 @@ WRITE_LINE_MEMBER(b2m_state::bm2_pit_out1) speaker_level_w(m_speaker, state); } -const struct pit8253_config b2m_pit8253_intf = +const struct pit8253_interface b2m_pit8253_intf = { { { @@ -163,7 +162,7 @@ const struct pit8253_config b2m_pit8253_intf = { 2000000, DEVCB_NULL, - DEVCB_DEVICE_LINE("pit8253", pit8253_clk0_w) + DEVCB_DEVICE_LINE_MEMBER("pit8253", pit8253_device, clk0_w) } } }; diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c index 9bcc0059816..55491615aaf 100644 --- a/src/mess/machine/bebox.c +++ b/src/mess/machine/bebox.c @@ -99,7 +99,6 @@ #include "machine/upd765.h" #include "machine/mc146818.h" #include "machine/pic8259.h" -#include "machine/pit8253.h" #include "machine/am9517a.h" #include "machine/idectrl.h" #include "machine/pci.h" @@ -766,7 +765,7 @@ WRITE_LINE_MEMBER(bebox_state::bebox_timer0_w) } -const struct pit8253_config bebox_pit8254_config = +const struct pit8253_interface bebox_pit8254_config = { { { diff --git a/src/mess/machine/compis.c b/src/mess/machine/compis.c index 60c519f4fbf..c3d973b204c 100644 --- a/src/mess/machine/compis.c +++ b/src/mess/machine/compis.c @@ -255,7 +255,7 @@ I8255A_INTERFACE( compis_ppi_interface ) /* PIT 8253 */ /*-------------------------------------------------------------------------*/ -const struct pit8253_config compis_pit8253_config = +const struct pit8253_interface compis_pit8253_config = { { /* Timer0 */ @@ -267,7 +267,7 @@ const struct pit8253_config compis_pit8253_config = } }; -const struct pit8253_config compis_pit8254_config = +const struct pit8253_interface compis_pit8254_config = { { /* Timer0 */ @@ -285,12 +285,12 @@ const struct pit8253_config compis_pit8254_config = READ16_MEMBER( compis_state::compis_osp_pit_r ) { - return pit8253_r(m_8254, space, offset); + return m_8254->read(space, offset); } WRITE16_MEMBER( compis_state::compis_osp_pit_w ) { - pit8253_w(m_8254, space, offset, data); + m_8254->write(space, offset, data); } diff --git a/src/mess/machine/dai.c b/src/mess/machine/dai.c index 5c01c17f6de..6ca24519b09 100644 --- a/src/mess/machine/dai.c +++ b/src/mess/machine/dai.c @@ -96,7 +96,7 @@ I8255A_INTERFACE( dai_ppi82555_intf ) DEVCB_NULL /* Port C write */ }; -const struct pit8253_config dai_pit8253_intf = +const struct pit8253_interface dai_pit8253_intf = { { { @@ -230,12 +230,12 @@ WRITE8_MEMBER(dai_state::dai_io_discrete_devices_w) READ8_MEMBER(dai_state::dai_pit_r) { - return pit8253_r(m_pit, space, (offset>>1) & 3); + return m_pit->read(space, (offset >> 1) & 3); } WRITE8_MEMBER(dai_state::dai_pit_w) { - pit8253_w(m_pit, space, (offset>>1) & 3, data); + m_pit->write(space, (offset >> 1) & 3, data); } /*************************************************************************** diff --git a/src/mess/machine/europc.c b/src/mess/machine/europc.c index 17ccc741cd4..2ed4760584c 100644 --- a/src/mess/machine/europc.c +++ b/src/mess/machine/europc.c @@ -168,7 +168,7 @@ WRITE8_MEMBER( europc_pc_state::europc_pio_w ) m_port61=data; // if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4; // else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf; - pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0)); + space.machine().device<pit8253_device>("pit8253")->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata(BIT(data, 1)); pc_keyb_set_clock(BIT(data, 6)); break; @@ -191,7 +191,7 @@ READ8_MEMBER( europc_pc_state::europc_pio_r ) data = m_port61; break; case 2: - if (pit8253_get_output(space.machine().device("pit8253"), 2)) + if (space.machine().device<pit8253_device>("pit8253")->get_output(2)) data |= 0x20; break; } diff --git a/src/mess/machine/genpc.c b/src/mess/machine/genpc.c index d4d84dd4df2..fd4e3b487aa 100644 --- a/src/mess/machine/genpc.c +++ b/src/mess/machine/genpc.c @@ -219,7 +219,7 @@ WRITE_LINE_MEMBER( ibm5160_mb_device::pc_pit8253_out2_changed ) } -const struct pit8253_config pc_pit8253_config = +const struct pit8253_interface pc_pit8253_config = { { { @@ -356,7 +356,7 @@ READ8_MEMBER (ibm5160_mb_device::pc_ppi_porta_r) READ8_MEMBER ( ibm5160_mb_device::pc_ppi_portc_r ) { - int timer2_output = pit8253_get_output( m_pit8253, 2 ); + int timer2_output = m_pit8253->get_output(2); int data=0xff; data&=~0x80; // no parity error @@ -392,7 +392,7 @@ WRITE8_MEMBER( ibm5160_mb_device::pc_ppi_portb_w ) m_ppi_portc_switch_high = data & 0x08; m_ppi_keyboard_clear = data & 0x80; m_ppi_keyb_clock = data & 0x40; - pit8253_gate2_w(m_pit8253, BIT(data, 0)); + m_pit8253->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; @@ -617,7 +617,7 @@ void ibm5160_mb_device::device_start() { install_device(0x0000, 0x000f, 0, 0, read8_delegate(FUNC(am9517a_device::read), (am9517a_device*)m_dma8237), write8_delegate(FUNC(am9517a_device::write), (am9517a_device*)m_dma8237) ); install_device(0x0020, 0x0021, 0, 0, read8_delegate(FUNC(pic8259_device::read), (pic8259_device*)m_pic8259), write8_delegate(FUNC(pic8259_device::write), (pic8259_device*)m_pic8259) ); - install_device(m_pit8253, 0x0040, 0x0043, 0, 0, FUNC(pit8253_r), FUNC(pit8253_w) ); + install_device(0x0040, 0x0043, 0, 0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit8253), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit8253) ); // install_device(m_ppi8255, 0x0060, 0x0063, 0, 0, FUNC(i8255a_r), FUNC(i8255a_w) ); int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width; @@ -777,7 +777,7 @@ READ8_MEMBER (ibm5150_mb_device::pc_ppi_porta_r) READ8_MEMBER ( ibm5150_mb_device::pc_ppi_portc_r ) { - int timer2_output = pit8253_get_output( m_pit8253, 2 ); + int timer2_output = m_pit8253->get_output(2); int data=0xff; data&=~0x80; // no parity error @@ -851,7 +851,7 @@ WRITE8_MEMBER( ibm5150_mb_device::pc_ppi_portb_w ) m_ppi_portc_switch_high = data & 0x08; m_ppi_keyboard_clear = data & 0x80; m_ppi_keyb_clock = data & 0x40; - pit8253_gate2_w(m_pit8253, BIT(data, 0)); + m_pit8253->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); diff --git a/src/mess/machine/irisha.c b/src/mess/machine/irisha.c index d2b5341e14f..4876954208c 100644 --- a/src/mess/machine/irisha.c +++ b/src/mess/machine/irisha.c @@ -99,7 +99,7 @@ WRITE8_MEMBER(irisha_state::irisha_8255_portc_w) //logerror("irisha_8255_portc_w %02x\n",data); if (data & 0x40) - pit8253_gate2_w(m_pit, (BIT(m_ppi_porta,5) && !BIT(data,5)) ? 1 : 0); + m_pit->gate2_w((BIT(m_ppi_porta, 5) && !BIT(data, 5)) ? 1 : 0); m_ppi_portc = data; @@ -127,7 +127,7 @@ WRITE_LINE_MEMBER(irisha_state::irisha_pic_set_int_line) m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE); } -const struct pit8253_config irisha_pit8253_intf = +const struct pit8253_interface irisha_pit8253_intf = { { { diff --git a/src/mess/machine/isa_ibm_mfc.c b/src/mess/machine/isa_ibm_mfc.c index 75bd44d5d75..7604b699aa7 100644 --- a/src/mess/machine/isa_ibm_mfc.c +++ b/src/mess/machine/isa_ibm_mfc.c @@ -266,10 +266,10 @@ WRITE_LINE_MEMBER( isa8_ibm_mfc_device::d8253_clk1_out ) WRITE_LINE_MEMBER( isa8_ibm_mfc_device::d8253_clk2_out ) { - pit8253_clk1_w(m_d8253, state); + m_d8253->clk1_w(state); } -static const struct pit8253_config d8253_intf = +static const struct pit8253_interface d8253_intf = { { { @@ -409,7 +409,7 @@ WRITE8_MEMBER( isa8_ibm_mfc_device::ibm_mfc_w ) case 0x6: case 0x7: { - pit8253_w(m_d8253, space, offset & 3, data); + m_d8253->write(space, offset & 3, data); break; } diff --git a/src/mess/machine/mbc55x.c b/src/mess/machine/mbc55x.c index 3afcc6c5009..0e18f5c4cc3 100644 --- a/src/mess/machine/mbc55x.c +++ b/src/mess/machine/mbc55x.c @@ -126,7 +126,7 @@ IRQ_CALLBACK_MEMBER(mbc55x_state::mbc55x_irq_callback) /* PIT8253 Configuration */ -const struct pit8253_config mbc55x_pit8253_config = +const struct pit8253_interface mbc55x_pit8253_config = { { { @@ -149,12 +149,12 @@ const struct pit8253_config mbc55x_pit8253_config = READ8_MEMBER(mbc55x_state::mbcpit8253_r) { - return pit8253_r(m_pit, space, offset>>1); + return m_pit->read(space, offset >> 1); } WRITE8_MEMBER(mbc55x_state::mbcpit8253_w) { - pit8253_w(m_pit, space, offset>>1, data); + m_pit->write(space, offset >> 1, data); } WRITE_LINE_MEMBER( mbc55x_state::pit8253_t2 ) diff --git a/src/mess/machine/mz700.c b/src/mess/machine/mz700.c index fb81c9c2649..00dfaf4b06f 100644 --- a/src/mess/machine/mz700.c +++ b/src/mess/machine/mz700.c @@ -50,22 +50,22 @@ I8255_INTERFACE( mz700_ppi8255_interface ) -const struct pit8253_config mz700_pit8253_config = +const struct pit8253_interface mz700_pit8253_config = { { /* clockin gate callback */ { XTAL_17_73447MHz/20, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_out0_changed) }, - { 15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w) }, + { 15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE_MEMBER("pit8253", pit8253_device, clk2_w) }, { 0, DEVCB_LINE_VCC, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_irq_2) }, } }; -const struct pit8253_config mz800_pit8253_config = +const struct pit8253_interface mz800_pit8253_config = { { /* clockin gate callback */ { XTAL_17_73447MHz/16, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_out0_changed) }, - { 15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w) }, + { 15611.0, DEVCB_LINE_VCC, DEVCB_DEVICE_LINE_MEMBER("pit8253", pit8253_device, clk2_w) }, { 0, DEVCB_LINE_VCC, DEVCB_DRIVER_LINE_MEMBER(mz_state,pit_irq_2) }, } }; @@ -103,9 +103,6 @@ DRIVER_INIT_MEMBER(mz_state,mz800) void mz_state::machine_start() { - m_pit = machine().device("pit8253"); - m_ppi = machine().device<i8255_device>("ppi8255"); - /* reset memory map to defaults */ mz700_bank_4_w(m_maincpu->space(AS_PROGRAM), 0, 0); } @@ -130,7 +127,7 @@ READ8_MEMBER(mz_state::mz700_e008_r) WRITE8_MEMBER(mz_state::mz700_e008_w) { - pit8253_gate0_w(m_pit, BIT(data, 0)); + m_pit->gate0_w(BIT(data, 0)); } @@ -276,13 +273,13 @@ WRITE8_MEMBER(mz_state::mz700_bank_3_w) if (m_mz700) { spc.install_readwrite_handler(0xe000, 0xfff3, 0, 0x1ff0, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); - spc.install_legacy_readwrite_handler(*m_pit, 0xe004, 0xfff7, 0, 0x1ff0, FUNC(pit8253_r), FUNC(pit8253_w)); + spc.install_readwrite_handler(0xe004, 0xfff7, 0, 0x1ff0, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit)); spc.install_readwrite_handler(0xe008, 0xfff8, 0, 0x1ff0, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this)); } else { spc.install_readwrite_handler(0xe000, 0xe003, read8_delegate(FUNC(i8255_device::read), (i8255_device*)m_ppi), write8_delegate(FUNC(i8255_device::write), (i8255_device*)m_ppi)); - spc.install_legacy_readwrite_handler(*m_pit, 0xe004, 0xe007, FUNC(pit8253_r), FUNC(pit8253_w)); + spc.install_readwrite_handler(0xe004, 0xe007, read8_delegate(FUNC(pit8253_device::read), (pit8253_device*)m_pit), write8_delegate(FUNC(pit8253_device::write), (pit8253_device*)m_pit)); spc.install_readwrite_handler(0xe008, 0xe008, read8_delegate(FUNC(mz_state::mz700_e008_r),this), write8_delegate(FUNC(mz_state::mz700_e008_w),this)); } } diff --git a/src/mess/machine/mz80.c b/src/mess/machine/mz80.c index 2a243c2e683..92d22c3b6af 100644 --- a/src/mess/machine/mz80.c +++ b/src/mess/machine/mz80.c @@ -81,12 +81,12 @@ I8255_INTERFACE( mz80k_8255_int ) DEVCB_DRIVER_MEMBER(mz80_state, mz80k_8255_portc_w), }; -const struct pit8253_config mz80k_pit8253_config = +const struct pit8253_interface mz80k_pit8253_config = { { /* clockin gate callback */ { XTAL_8MHz/ 4, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mz80_state, pit_out0_changed) }, - { XTAL_8MHz/256, DEVCB_NULL, DEVCB_DEVICE_LINE("pit8253", pit8253_clk2_w) }, + { XTAL_8MHz/256, DEVCB_NULL, DEVCB_DEVICE_LINE_MEMBER("pit8253", pit8253_device, clk2_w) }, { 0, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(mz80_state, pit_out2_changed) }, } }; @@ -98,5 +98,5 @@ READ8_MEMBER( mz80_state::mz80k_strobe_r ) WRITE8_MEMBER( mz80_state::mz80k_strobe_w ) { - pit8253_gate0_w(m_pit, BIT(data, 0)); + m_pit->gate0_w(BIT(data, 0)); } diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c index 2cc69ebf736..aba00605523 100644 --- a/src/mess/machine/pc.c +++ b/src/mess/machine/pc.c @@ -360,7 +360,7 @@ WRITE_LINE_MEMBER(pc_state::ibm5150_pit8253_out2_changed) } -const struct pit8253_config ibm5150_pit8253_config = +const struct pit8253_interface ibm5150_pit8253_config = { { { @@ -386,7 +386,7 @@ const struct pit8253_config ibm5150_pit8253_config = supported yet. */ -const struct pit8253_config pcjr_pit8253_config = +const struct pit8253_interface pcjr_pit8253_config = { { { @@ -407,7 +407,7 @@ const struct pit8253_config pcjr_pit8253_config = /* MC1502 uses single XTAL for everything -- incl. CGA? check */ -const struct pit8253_config mc1502_pit8253_config = +const struct pit8253_interface mc1502_pit8253_config = { { { @@ -764,7 +764,7 @@ READ8_MEMBER(pc_state::ibm5160_ppi_porta_r) READ8_MEMBER(pc_state::ibm5160_ppi_portc_r) { - int timer2_output = pit8253_get_output( m_pit8253, 2 ); + int timer2_output = m_pit8253->get_output(2); int data=0xff; data&=~0x80; // no parity error @@ -801,7 +801,7 @@ WRITE8_MEMBER(pc_state::ibm5160_ppi_portb_w) m_ppi_portc_switch_high = data & 0x08; m_ppi_keyboard_clear = data & 0x80; m_ppi_keyb_clock = data & 0x40; - pit8253_gate2_w(m_pit8253, BIT(data, 0)); + m_pit8253->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; @@ -862,7 +862,7 @@ WRITE8_MEMBER(pc_state::pc_ppi_portb_w) m_ppi_portc_switch_high = data & 0x08; m_ppi_keyboard_clear = data & 0x80; m_ppi_keyb_clock = data & 0x40; - pit8253_gate2_w(m_pit8253, BIT(data, 0)); + m_pit8253->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); pc_keyb_set_clock( m_ppi_keyb_clock ); @@ -947,13 +947,13 @@ WRITE8_MEMBER(pc_state::mc1502_ppi_portb_w) { // DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data)); m_ppi_portb = data; - pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0)); + machine().device<pit8253_device>("pit8253")->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); } READ8_MEMBER(pc_state::mc1502_ppi_portc_r) { - int timer2_output = pit8253_get_output( machine().device("pit8253"), 2 ); + int timer2_output = machine().device<pit8253_device>("pit8253")->get_output(2); int data = 0xff; double tap_val = m_cassette->input(); @@ -1015,7 +1015,7 @@ WRITE8_MEMBER(pc_state::pcjr_ppi_portb_w) /* KB controller port B */ m_ppi_portb = data; m_ppi_portc_switch_high = data & 0x08; - pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0)); + machine().device<pit8253_device>("pit8253")->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); @@ -1048,7 +1048,7 @@ READ8_MEMBER(pc_state::pcjr_ppi_porta_r) */ READ8_MEMBER(pc_state::pcjr_ppi_portc_r) { - int timer2_output = pit8253_get_output( machine().device("pit8253"), 2 ); + int timer2_output = machine().device<pit8253_device>("pit8253")->get_output(2); int data=0xff; data&=~0x80; @@ -1453,8 +1453,6 @@ IRQ_CALLBACK_MEMBER(pc_state::pc_irq_callback) MACHINE_START_MEMBER(pc_state,pc) { - m_pic8259 = machine().device<pic8259_device>("pic8259"); - m_pit8253 = machine().device("pit8253"); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this)); pc_fdc_interface *fdc = machine().device<pc_fdc_interface>("fdc"); @@ -1490,9 +1488,6 @@ MACHINE_START_MEMBER(pc_state,mc1502) { m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this)); - m_pic8259 = machine().device<pic8259_device>("pic8259"); - m_pit8253 = machine().device("pit8253"); - /* Keyboard polling circuit holds IRQ1 high until a key is pressed, then it starts a timer that pulses IRQ1 low each @@ -1518,10 +1513,6 @@ MACHINE_START_MEMBER(pc_state,pcjr) m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc_state::pc_irq_callback),this)); machine().device<upd765a_device>("upd765")->set_ready_line_connected(false); - - - m_pic8259 = machine().device<pic8259_device>("pic8259"); - m_pit8253 = machine().device("pit8253"); } MACHINE_RESET_MEMBER(pc_state,pcjr) @@ -1559,7 +1550,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pc_state, pcjr_cartridge ) UINT32 address; UINT32 size; - address = ( ! strcmp( ":cart2", image.device().tag() ) ) ? 0xd0000 : 0xe0000; + address = (!strcmp(":cart2", image.device().tag())) ? 0xd0000 : 0xe6000; if ( image.software_entry() ) { diff --git a/src/mess/machine/pk8020.c b/src/mess/machine/pk8020.c index 17aee1160f4..afa3fdfd663 100644 --- a/src/mess/machine/pk8020.c +++ b/src/mess/machine/pk8020.c @@ -148,7 +148,7 @@ READ8_MEMBER(pk8020_state::devices_r) { switch(offset & 0x38) { - case 0x00: return pit8253_r(m_pit8253,space, offset & 3); + case 0x00: return m_pit8253->read(space, offset & 3); case 0x08: return m_ppi8255_3->read(space,offset & 3); case 0x10: switch(offset & 1) { case 0 : return m_rs232->data_r(space,0); @@ -178,7 +178,7 @@ WRITE8_MEMBER(pk8020_state::devices_w) { switch(offset & 0x38) { - case 0x00: pit8253_w(m_pit8253,space, offset & 3,data); break; + case 0x00: m_pit8253->write(space, offset & 3, data); break; case 0x08: m_ppi8255_3->write(space,offset & 3,data); break; case 0x10: switch(offset & 1) { case 0 : m_rs232->data_w(space,0,data); break; @@ -920,7 +920,7 @@ WRITE_LINE_MEMBER(pk8020_state::pk8020_pit_out1) } -const struct pit8253_config pk8020_pit8253_intf = +const struct pit8253_interface pk8020_pit8253_intf = { { { diff --git a/src/mess/machine/pmd85.c b/src/mess/machine/pmd85.c index 7bd314185db..2f93a268ffc 100644 --- a/src/mess/machine/pmd85.c +++ b/src/mess/machine/pmd85.c @@ -400,7 +400,7 @@ WRITE8_MEMBER(pmd85_state::pmd85_ppi_2_portc_w) *******************************************************************************/ -const struct pit8253_config pmd85_pit8253_interface = +const struct pit8253_interface pmd85_pit8253_interface = { { { 0, DEVCB_NULL, DEVCB_NULL }, @@ -534,7 +534,7 @@ READ8_MEMBER(pmd85_state::pmd85_io_r) case 0x40: /* 8255 (GPIO/0, GPIO/1) */ return m_ppi8255_1->read(space, offset & 0x03); case 0x50: /* 8253 */ - return pit8253_r( m_pit8253, space, offset & 0x03); + return m_pit8253->read(space, offset & 0x03); case 0x70: /* 8255 (IMS-2) */ return m_ppi8255_2->read(space, offset & 0x03); } @@ -610,7 +610,7 @@ WRITE8_MEMBER(pmd85_state::pmd85_io_w) m_ppi8255_1->write(space, offset & 0x03, data); break; case 0x50: /* 8253 */ - pit8253_w(m_pit8253, space, offset & 0x03, data); + m_pit8253->write(space, offset & 0x03, data); logerror ("8253 writing. Address: %02x, Data: %02x\n", offset, data); break; case 0x70: /* 8255 (IMS-2) */ diff --git a/src/mess/machine/pp01.c b/src/mess/machine/pp01.c index 67e7c4f82d9..1d370316f93 100644 --- a/src/mess/machine/pp01.c +++ b/src/mess/machine/pp01.c @@ -162,7 +162,7 @@ WRITE_LINE_MEMBER(pp01_state::pp01_pit_out1) { } -const struct pit8253_config pp01_pit8253_intf = +const struct pit8253_interface pp01_pit8253_intf = { { { @@ -178,7 +178,7 @@ const struct pit8253_config pp01_pit8253_intf = { 2000000, DEVCB_NULL, - DEVCB_DEVICE_LINE("pit8253", pit8253_clk0_w) + DEVCB_DEVICE_LINE_MEMBER("pit8253", pit8253_device, clk0_w) } } }; diff --git a/src/mess/machine/southbridge.c b/src/mess/machine/southbridge.c index a4411cedd0f..5d80074c6f4 100644 --- a/src/mess/machine/southbridge.c +++ b/src/mess/machine/southbridge.c @@ -10,7 +10,7 @@ #include "machine/pc_keyboards.h" -const struct pit8253_config at_pit8254_config = +const struct pit8253_interface at_pit8254_config = { { { @@ -182,7 +182,7 @@ void southbridge_device::device_start() spaceio.install_readwrite_handler(0x0000, 0x001f, read8_delegate(FUNC(am9517a_device::read),&(*m_dma8237_1)), write8_delegate(FUNC(am9517a_device::write),&(*m_dma8237_1)), 0xffffffff); spaceio.install_readwrite_handler(0x0020, 0x003f, read8_delegate(FUNC(pic8259_device::read),&(*m_pic8259_master)), write8_delegate(FUNC(pic8259_device::write),&(*m_pic8259_master)), 0xffffffff); - spaceio.install_legacy_readwrite_handler(*m_pit8254, 0x0040, 0x005f, FUNC(pit8253_r), FUNC(pit8253_w), 0xffffffff); + spaceio.install_readwrite_handler(0x0040, 0x005f, read8_delegate(FUNC(pit8254_device::read),&(*m_pit8254)), write8_delegate(FUNC(pit8254_device::write),&(*m_pit8254)), 0xffffffff); spaceio.install_readwrite_handler(0x0060, 0x0063, read8_delegate(FUNC(southbridge_device::at_keybc_r),this), write8_delegate(FUNC(southbridge_device::at_keybc_w),this), 0xffffffff); spaceio.install_readwrite_handler(0x0064, 0x0067, read8_delegate(FUNC(at_keyboard_controller_device::status_r),&(*m_keybc)), write8_delegate(FUNC(at_keyboard_controller_device::command_w),&(*m_keybc)), 0xffffffff); spaceio.install_readwrite_handler(0x0070, 0x007f, read8_delegate(FUNC(mc146818_device::read),&(*m_mc146818)), write8_delegate(FUNC(mc146818_device::write),&(*m_mc146818)), 0xffffffff); @@ -428,7 +428,7 @@ READ8_MEMBER( southbridge_device::at_portb_r ) } data = (data & ~0x10) | ( m_at_offset1 & 0x10 ); - if ( pit8253_get_output(m_pit8254, 2 ) ) + if (m_pit8254->get_output(2)) data |= 0x20; else data &= ~0x20; /* ps2m30 wants this */ @@ -439,7 +439,7 @@ READ8_MEMBER( southbridge_device::at_portb_r ) WRITE8_MEMBER( southbridge_device::at_portb_w ) { m_at_speaker = data; - pit8253_gate2_w(m_pit8254, BIT(data, 0)); + m_pit8254->gate2_w(BIT(data, 0)); at_speaker_set_spkrdata( BIT(data, 1)); m_channel_check = BIT(data, 3); m_isabus->set_nmi_state((m_nmi_enabled==0) && (m_channel_check==0)); diff --git a/src/mess/machine/special.c b/src/mess/machine/special.c index 694f87bbb14..1cff3c555f7 100644 --- a/src/mess/machine/special.c +++ b/src/mess/machine/special.c @@ -110,10 +110,9 @@ void special_state::device_timer(emu_timer &timer, device_timer_id id, int param break; case TIMER_PIT8253_GATES: { - device_t *pit8253 = machine().device("pit8253"); - pit8253_gate0_w(pit8253, 0); - pit8253_gate1_w(pit8253, 0); - pit8253_gate2_w(pit8253, 0); + m_pit->gate0_w(0); + m_pit->gate1_w(0); + m_pit->gate2_w(0); break; } default: @@ -212,7 +211,7 @@ WRITE_LINE_MEMBER( special_state::specimx_pit8253_out2_changed ) -const struct pit8253_config specimx_pit8253_intf = +const struct pit8253_interface specimx_pit8253_intf = { { { diff --git a/src/mess/machine/tandy1t.c b/src/mess/machine/tandy1t.c index 18ba315e2ae..d3edac78e32 100644 --- a/src/mess/machine/tandy1t.c +++ b/src/mess/machine/tandy1t.c @@ -181,7 +181,7 @@ WRITE8_MEMBER( tandy_pc_state::tandy1000_pio_w ) { case 1: m_tandy_ppi_portb = data; - pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0)); + space.machine().device<pit8253_device>("pit8253")->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); // sx enables keyboard from bit 3, others bit 6, hopefully theres no conflict pc_keyb_set_clock(data&0x48); |