diff --git a/src/mess/drivers/amstr_pc.c b/src/mess/drivers/amstr_pc.c index 00f5434ebe9..fdda1894d87 100644 --- a/src/mess/drivers/amstr_pc.c +++ b/src/mess/drivers/amstr_pc.c @@ -88,11 +88,11 @@ static ADDRESS_MAP_START(ppc512_io, AS_IO, 16, amstrad_pc_state ) AM_RANGE(0x007a, 0x007b) AM_READWRITE8(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff) AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) - AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_2", pc_lpt_w, 0x00ff) + AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8("lpt_2", pc_lpt_device, write, 0x00ff) AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) - AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_1", pc_lpt_w, 0x00ff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff) + AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8("lpt_1", pc_lpt_device, write, 0x00ff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0x00ff) AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_xt_device, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) @@ -116,11 +116,11 @@ static ADDRESS_MAP_START(pc200_io, AS_IO, 16, amstrad_pc_state ) AM_RANGE(0x007a, 0x007b) AM_READWRITE8(pc1640_mouse_y_r, pc1640_mouse_y_w, 0xffff) AM_RANGE(0x0080, 0x0087) AM_READWRITE8(pc_page_r, pc_page_w, 0xffff) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) - AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_2", pc_lpt_w, 0x00ff) + AM_RANGE(0x0278, 0x027b) AM_READ8(pc200_port278_r, 0xffff) AM_DEVWRITE8("lpt_2", pc_lpt_device, write, 0x00ff) AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) - AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8_LEGACY("lpt_1", pc_lpt_w, 0x00ff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0x00ff) + AM_RANGE(0x0378, 0x037b) AM_READ8(pc200_port378_r, 0xffff) AM_DEVWRITE8("lpt_1", pc_lpt_device, write, 0x00ff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0x00ff) AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_xt_device, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) diff --git a/src/mess/drivers/ip22.c b/src/mess/drivers/ip22.c index 9ebcea61167..f144bd3d0d8 100644 --- a/src/mess/drivers/ip22.c +++ b/src/mess/drivers/ip22.c @@ -148,7 +148,7 @@ public: required_device m_wd33c93; required_shared_ptr m_unkpbus0; required_shared_ptr m_mainram; - required_device m_lpt0; + required_device m_lpt0; required_device m_pit; required_device m_newport; required_device m_dac; @@ -270,11 +270,11 @@ READ32_MEMBER(ip22_state::hpc3_pbus6_r) switch( offset ) { case 0x004/4: - ret8 = pc_lpt_control_r(m_lpt0, space, 0) ^ 0x0d; + ret8 = m_lpt0->control_r(space, 0) ^ 0x0d; //verboselog(0, "Parallel Control Read: %02x\n", ret8 ); return ret8; case 0x008/4: - ret8 = pc_lpt_status_r(m_lpt0, space, 0) ^ 0x80; + ret8 = m_lpt0->status_r(space, 0) ^ 0x80; //verboselog(0, "Parallel Status Read: %02x\n", ret8 ); return ret8; case 0x030/4: @@ -344,7 +344,7 @@ WRITE32_MEMBER(ip22_state::hpc3_pbus6_w) { case 0x004/4: //verboselog(0, "Parallel Control Write: %08x\n", data ); - pc_lpt_control_w(m_lpt0, space, 0, data ^ 0x0d); + m_lpt0->control_w(space, 0, data ^ 0x0d); //m_nIOC_ParCntl = data; break; case 0x030/4: diff --git a/src/mess/drivers/pc.c b/src/mess/drivers/pc.c index 80a01ad4dcc..6c24227b24d 100644 --- a/src/mess/drivers/pc.c +++ b/src/mess/drivers/pc.c @@ -199,12 +199,12 @@ static ADDRESS_MAP_START(pc8_io, AS_IO, 8, pc_state ) AM_RANGE(0x00a0, 0x00a0) AM_WRITE(pc_nmi_enable_w ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) AM_RANGE(0x0240, 0x0257) AM_READWRITE(pc_rtc_r, pc_rtc_w) - AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_device, read, write) AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ - AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE_LEGACY("lpt_1", pc_lpt_r, pc_lpt_w) - AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE("lpt_1", pc_lpt_device, read, write) + AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_device, read, write) AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE("fdc", pc_fdc_interface, map) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_device, ins8250_r, ins8250_w) @@ -225,12 +225,12 @@ static ADDRESS_MAP_START(pc16_io, AS_IO, 16, pc_state ) AM_RANGE(0x00a0, 0x00a1) AM_WRITE8(pc_nmi_enable_w, 0x00ff ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) AM_RANGE(0x0240, 0x0257) AM_READWRITE8(pc_rtc_r, pc_rtc_w, 0xffff) - AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8("lpt_2", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ - AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8_LEGACY("lpt_1", pc_lpt_r, pc_lpt_w, 0xffff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_device, read, write, 0xffff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_interface, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) @@ -251,7 +251,7 @@ static ADDRESS_MAP_START(ec1841_io, AS_IO, 16, pc_state) AM_RANGE(0x02b0, 0x02b3) AM_READWRITE8(ec1841_memboard_r, ec1841_memboard_w, 0xffff); // AM_RANGE(0x02f8, 0x02f8) AM_DEVREADWRITE8("upd8251_1", i8251_device, data_r, data_w, 0x00ff) // AM_RANGE(0x02f9, 0x02f9) AM_DEVREADWRITE8("upd8251_1", i8251_device, status_r, control_w, 0xff00) - AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_interface, map, 0xffff) // AM_RANGE(0x03f8, 0x03f9) AM_DEVREADWRITE8("upd8251_0", i8251_device, data_r, data_w, 0x00ff) // AM_RANGE(0x03f8, 0x03f9) AM_DEVREADWRITE8("upd8251_0", i8251_device, status_r, control_w, 0xff00) @@ -271,7 +271,7 @@ static ADDRESS_MAP_START(iskr1031_io, AS_IO, 16, pc_state) // AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ - AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) // AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_interface, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) @@ -289,7 +289,7 @@ static ADDRESS_MAP_START(asst128_io, AS_IO, 16, pc_state) // AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ - AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) // AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x03f2, 0x03f3) AM_WRITE8(asst128_fdc_dor_w, 0xffff) AM_RANGE(0x03f4, 0x03f5) AM_DEVICE8("fdc:upd765", upd765a_device, map, 0xffff) @@ -318,12 +318,12 @@ static ADDRESS_MAP_START(ibm5550_io, AS_IO, 16, pc_state ) AM_RANGE(0x00a0, 0x00a1) AM_READWRITE8(unk_r, pc_nmi_enable_w, 0x00ff ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) AM_RANGE(0x0240, 0x0257) AM_READWRITE8(pc_rtc_r, pc_rtc_w, 0xffff) - AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE8("lpt_2", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE8("ins8250_3", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x0340, 0x0357) AM_NOP /* anonymous bios should not recogniced realtimeclock */ - AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8_LEGACY("lpt_1", pc_lpt_r, pc_lpt_w, 0xffff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x0378, 0x037f) AM_DEVREADWRITE8("lpt_1", pc_lpt_device, read, write, 0xffff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE8("ins8250_2", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_interface, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) @@ -349,12 +349,12 @@ static ADDRESS_MAP_START(europc_io, AS_IO, 8, europc_pc_state ) AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r, pc_page_w) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) AM_RANGE(0x0250, 0x025f) AM_READWRITE(europc_jim_r, europc_jim_w) - AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE_LEGACY("lpt_2", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x0278, 0x027b) AM_DEVREADWRITE("lpt_2", pc_lpt_device, read, write) AM_RANGE(0x02e0, 0x02e0) AM_READ(europc_jim2_r) AM_RANGE(0x02e8, 0x02ef) AM_DEVREADWRITE("ins8250_3", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w) - AM_RANGE(0x0378, 0x037b) AM_DEVREADWRITE_LEGACY("lpt_1", pc_lpt_r, pc_lpt_w) -// AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x0378, 0x037b) AM_DEVREADWRITE("lpt_1", pc_lpt_device, read, write) +// AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE("lpt_0", pc_lpt_device, read, write) AM_RANGE(0x03e8, 0x03ef) AM_DEVREADWRITE("ins8250_2", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE("fdc", pc_fdc_interface, map) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_device, ins8250_r, ins8250_w) @@ -385,7 +385,7 @@ static ADDRESS_MAP_START(tandy1000_io, AS_IO, 8, tandy_pc_state ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) - AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_device, read, write) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE("fdc", pc_fdc_interface, map) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_device, ins8250_r, ins8250_w) ADDRESS_MAP_END @@ -414,7 +414,7 @@ static ADDRESS_MAP_START(tandy1000_16_io, AS_IO, 16, tandy_pc_state ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_interface, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0xffea, 0xffeb) AM_READWRITE8(tandy1000_bank_r, tandy1000_bank_w, 0xffff) @@ -446,7 +446,7 @@ static ADDRESS_MAP_START(tandy1000_286_io, AS_IO, 16, tandy_pc_state ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE8("pc_joy", pc_joy_device, joy_port_r, joy_port_w, 0xffff) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE8("ins8250_1", ins8250_device, ins8250_r, ins8250_w, 0xffff) AM_RANGE(0x0378, 0x037f) AM_READWRITE8(pc_t1t_p37x_r, pc_t1t_p37x_w, 0xffff) - AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w, 0xffff) + AM_RANGE(0x03bc, 0x03bf) AM_DEVREADWRITE8("lpt_0", pc_lpt_device, read, write, 0xffff) AM_RANGE(0x03f0, 0x03f7) AM_DEVICE8("fdc", pc_fdc_interface, map, 0xffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ins8250_0", ins8250_device, ins8250_r, ins8250_w, 0xffff) ADDRESS_MAP_END @@ -478,7 +478,7 @@ static ADDRESS_MAP_START(ibmpcjr_io, AS_IO, 8, tandy_pc_state ) AM_RANGE(0x0200, 0x0207) AM_DEVREADWRITE("pc_joy", pc_joy_device, joy_port_r, joy_port_w) AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE("ins8250_1", ins8250_device, ins8250_r, ins8250_w) AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) - AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE_LEGACY("lpt_0", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x03bc, 0x03be) AM_DEVREADWRITE("lpt_0", pc_lpt_device, read, write) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE("ins8250_0", ins8250_device, ins8250_r, ins8250_w) ADDRESS_MAP_END diff --git a/src/mess/drivers/pcw16.c b/src/mess/drivers/pcw16.c index 980c2926cda..3b18fd5d1ca 100644 --- a/src/mess/drivers/pcw16.c +++ b/src/mess/drivers/pcw16.c @@ -960,7 +960,7 @@ static ADDRESS_MAP_START(pcw16_io, AS_IO, 8, pcw16_state ) AM_RANGE(0x018, 0x01f) AM_DEVICE("fdc", pc_fdc_superio_device, map) AM_RANGE(0x020, 0x027) AM_DEVREADWRITE("ns16550_1", ns16550_device, ins8250_r, ins8250_w) AM_RANGE(0x028, 0x02f) AM_DEVREADWRITE("ns16550_2", ns16550_device, ins8250_r, ins8250_w) - AM_RANGE(0x038, 0x03a) AM_DEVREADWRITE_LEGACY("lpt", pc_lpt_r, pc_lpt_w) + AM_RANGE(0x038, 0x03a) AM_DEVREADWRITE("lpt", pc_lpt_device, read, write) /* anne asic */ AM_RANGE(0x0e0, 0x0ef) AM_WRITE(pcw16_palette_w) AM_RANGE(0x0f0, 0x0f3) AM_READWRITE(pcw16_bankhw_r, pcw16_bankhw_w) diff --git a/src/mess/includes/amstr_pc.h b/src/mess/includes/amstr_pc.h index 90b70b1e43c..bd297e86b4a 100644 --- a/src/mess/includes/amstr_pc.h +++ b/src/mess/includes/amstr_pc.h @@ -8,14 +8,20 @@ #define AMSTR_PC_H_ #include "includes/pc.h" +#include "machine/pc_lpt.h" class amstrad_pc_state : public pc_state { public: amstrad_pc_state(const machine_config &mconfig, device_type type, const char *tag) - : pc_state(mconfig, type, tag) + : pc_state(mconfig, type, tag), + m_lpt1(*this, "lpt_1"), + m_lpt2(*this, "lpt_2") { m_mouse.x =0; m_mouse.y=0;} - + + required_device m_lpt1; + required_device m_lpt2; + DECLARE_READ8_MEMBER( pc1640_port60_r ); DECLARE_WRITE8_MEMBER( pc1640_port60_w ); diff --git a/src/mess/machine/amstr_pc.c b/src/mess/machine/amstr_pc.c index 0c869faefb9..18ec3b31dce 100644 --- a/src/mess/machine/amstr_pc.c +++ b/src/mess/machine/amstr_pc.c @@ -1,7 +1,6 @@ #include "emu.h" #include "machine/pit8253.h" -#include "machine/pc_lpt.h" #include "includes/amstr_pc.h" #include "includes/pc.h" #include "video/pc_vga.h" @@ -231,8 +230,7 @@ READ8_MEMBER( amstrad_pc_state::pc1640_port60_r ) READ8_MEMBER( amstrad_pc_state::pc200_port378_r ) { - device_t *lpt = machine().device("lpt_1"); - UINT8 data = pc_lpt_r(lpt, space, offset); + UINT8 data = m_lpt1->read(space, offset); if (offset == 1) data = (data & ~7) | (ioport("DSW0")->read() & 7); @@ -244,8 +242,7 @@ READ8_MEMBER( amstrad_pc_state::pc200_port378_r ) READ8_MEMBER( amstrad_pc_state::pc200_port278_r ) { - device_t *lpt = machine().device("lpt_2"); - UINT8 data = pc_lpt_r(lpt, space, offset); + UINT8 data = m_lpt2->read(space, offset); if (offset == 1) data = (data & ~7) | (ioport("DSW0")->read() & 7); @@ -258,8 +255,7 @@ READ8_MEMBER( amstrad_pc_state::pc200_port278_r ) READ8_MEMBER( amstrad_pc_state::pc1640_port378_r ) { - device_t *lpt = machine().device("lpt_1"); - UINT8 data = pc_lpt_r(lpt, space, offset); + UINT8 data = m_lpt1->read(space, offset); if (offset == 1) data=(data & ~7) | (ioport("DSW0")->read() & 7); diff --git a/src/mess/machine/pc_lpt.c b/src/mess/machine/pc_lpt.c index 986c4f316cc..47fad84ee3c 100644 --- a/src/mess/machine/pc_lpt.c +++ b/src/mess/machine/pc_lpt.c @@ -6,39 +6,6 @@ #include "emu.h" #include "pc_lpt.h" -#include "machine/ctronics.h" -#include "cntr_covox.h" -#include "devlegcy.h" - - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ - -static WRITE_LINE_DEVICE_HANDLER( pc_lpt_ack_w ); - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -struct pc_lpt_state -{ - centronics_device *centronics; - - devcb_resolved_write_line out_irq_func; - - UINT8 data; - - int ack; - - /* control latch */ - int strobe; - int autofd; - int init; - int select; - int irq_enabled; -}; /*************************************************************************** @@ -47,7 +14,7 @@ struct pc_lpt_state static const centronics_interface pc_centronics_config = { - DEVCB_LINE(pc_lpt_ack_w), + DEVCB_LINE_MEMBER(pc_lpt_device, ack_w), DEVCB_NULL, DEVCB_NULL }; @@ -62,177 +29,122 @@ static MACHINE_CONFIG_FRAGMENT( pc_lpt ) MCFG_CENTRONICS_ADD("centronics", pc_centronics_config, pc_centronics, "printer") MACHINE_CONFIG_END - -/***************************************************************************** - INLINE FUNCTIONS -*****************************************************************************/ - -INLINE pc_lpt_state *get_safe_token(device_t *device) -{ - assert(device != NULL); - assert(device->type() == PC_LPT); - - return (pc_lpt_state *)downcast(device)->token(); -} - - -/*************************************************************************** - DEVICE INTERFACE -***************************************************************************/ - -static DEVICE_START( pc_lpt ) -{ - pc_lpt_state *lpt = get_safe_token(device); - const pc_lpt_interface *intf = (const pc_lpt_interface *)device->static_config(); - /* validate some basic stuff */ - assert(device->static_config() != NULL); - - /* get centronics device */ - lpt->centronics = device->subdevice("centronics"); - assert(lpt->centronics != NULL); - - /* resolve callbacks */ - lpt->out_irq_func.resolve(intf->out_irq_func, *device); - - /* register for state saving */ - device->save_item(NAME(lpt->ack)); - device->save_item(NAME(lpt->strobe)); - device->save_item(NAME(lpt->autofd)); - device->save_item(NAME(lpt->init)); - device->save_item(NAME(lpt->select)); - device->save_item(NAME(lpt->irq_enabled)); -} - -static DEVICE_RESET( pc_lpt ) -{ - pc_lpt_state *lpt = get_safe_token(device); - - lpt->strobe = TRUE; - lpt->autofd = TRUE; - lpt->init = FALSE; - lpt->select = TRUE; - lpt->irq_enabled = FALSE; - lpt->data = 0xff; -} - /*************************************************************************** IMPLEMENTATION ***************************************************************************/ -static WRITE_LINE_DEVICE_HANDLER( pc_lpt_ack_w ) +WRITE_LINE_MEMBER( pc_lpt_device::ack_w ) { - pc_lpt_state *lpt = get_safe_token(device->owner()); - - if (lpt->irq_enabled && lpt->ack == TRUE && state == FALSE) + if (m_irq_enabled && m_ack == TRUE && state == FALSE) { /* pulse irq when going from high to low */ - lpt->out_irq_func(TRUE); - lpt->out_irq_func(FALSE); + m_out_irq_func(TRUE); + m_out_irq_func(FALSE); } - lpt->ack = state; + m_ack = state; } -READ8_DEVICE_HANDLER( pc_lpt_data_r ) +READ8_MEMBER( pc_lpt_device::data_r ) { - pc_lpt_state *lpt = get_safe_token(device); // pull up mechanism for input lines, zeros are provided by pheripherial - return lpt->data & ~lpt->centronics->read(space.machine().driver_data()->generic_space(), 0); + return m_data & ~m_centronics->read(space.machine().driver_data()->generic_space(), 0); } -WRITE8_DEVICE_HANDLER( pc_lpt_data_w ) +WRITE8_MEMBER( pc_lpt_device::data_w ) { - pc_lpt_state *lpt = get_safe_token(device); - lpt->data = data; - lpt->centronics->write(space.machine().driver_data()->generic_space(), 0, data); + m_data = data; + m_centronics->write(space.machine().driver_data()->generic_space(), 0, data); } -READ8_DEVICE_HANDLER( pc_lpt_status_r ) +READ8_MEMBER( pc_lpt_device::status_r ) { - pc_lpt_state *lpt = get_safe_token(device); UINT8 result = 0; - result |= lpt->centronics->fault_r() << 3; - result |= lpt->centronics->vcc_r() << 4; /* SELECT is connected to VCC */ - result |= !lpt->centronics->pe_r() << 5; - result |= lpt->centronics->ack_r() << 6; - result |= !lpt->centronics->busy_r() << 7; + result |= m_centronics->fault_r() << 3; + result |= m_centronics->vcc_r() << 4; /* SELECT is connected to VCC */ + result |= !m_centronics->pe_r() << 5; + result |= m_centronics->ack_r() << 6; + result |= !m_centronics->busy_r() << 7; return result; } -READ8_DEVICE_HANDLER( pc_lpt_control_r ) +READ8_MEMBER( pc_lpt_device::control_r ) { - pc_lpt_state *lpt = get_safe_token(device); UINT8 result = 0; /* return latch state */ - result |= lpt->strobe << 0; - result |= lpt->autofd << 1; - result |= lpt->init << 2; - result |= lpt->select << 3; - result |= lpt->irq_enabled << 4; + result |= m_strobe << 0; + result |= m_autofd << 1; + result |= m_init << 2; + result |= m_select << 3; + result |= m_irq_enabled << 4; return result; } -WRITE8_DEVICE_HANDLER( pc_lpt_control_w ) +WRITE8_MEMBER( pc_lpt_device::control_w ) { - pc_lpt_state *lpt = get_safe_token(device); - -// logerror("pc_lpt_control_w: 0x%02x\n", data); + // logerror("pc_lpt_control_w: 0x%02x\n", data); /* save to latch */ - lpt->strobe = BIT(data, 0); - lpt->autofd = BIT(data, 1); - lpt->init = BIT(data, 2); - lpt->select = BIT(data, 3); - lpt->irq_enabled = BIT(data, 4); + m_strobe = BIT(data, 0); + m_autofd = BIT(data, 1); + m_init = BIT(data, 2); + m_select = BIT(data, 3); + m_irq_enabled = BIT(data, 4); /* output to centronics */ - lpt->centronics->strobe_w(lpt->strobe); - lpt->centronics->autofeed_w(lpt->autofd); - lpt->centronics->init_prime_w(lpt->init); + m_centronics->strobe_w(m_strobe); + m_centronics->autofeed_w(m_autofd); + m_centronics->init_prime_w(m_init); } -READ8_DEVICE_HANDLER( pc_lpt_r ) +READ8_MEMBER( pc_lpt_device::read ) { switch (offset) { - case 0: return pc_lpt_data_r(device, space, 0); - case 1: return pc_lpt_status_r(device, space, 0); - case 2: return pc_lpt_control_r(device, space, 0); + case 0: return data_r(space, 0); + case 1: return status_r(space, 0); + case 2: return control_r(space, 0); } /* if we reach this its an error */ - logerror("PC-LPT %s: Read from invalid offset %x\n", device->tag(), offset); + logerror("PC-LPT %s: Read from invalid offset %x\n", tag(), offset); return 0xff; } -WRITE8_DEVICE_HANDLER( pc_lpt_w ) +WRITE8_MEMBER( pc_lpt_device::write ) { switch (offset) { - case 0: pc_lpt_data_w(device, space, 0, data); break; + case 0: data_w(space, 0, data); break; case 1: break; - case 2: pc_lpt_control_w(device, space, 0, data); break; + case 2: control_w(space, 0, data); break; } } const device_type PC_LPT = &device_creator; pc_lpt_device::pc_lpt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, PC_LPT, "PC-LPT", tag, owner, clock, "pc_lpt", __FILE__) + : device_t(mconfig, PC_LPT, "PC-LPT", tag, owner, clock, "pc_lpt", __FILE__), + m_data(0), + m_ack(0), + m_strobe(0), + m_autofd(0), + m_init(0), + m_select(0), + m_irq_enabled(0) { - m_token = global_alloc_clear(pc_lpt_state); } //------------------------------------------------- @@ -243,6 +155,16 @@ pc_lpt_device::pc_lpt_device(const machine_config &mconfig, const char *tag, dev void pc_lpt_device::device_config_complete() { + // inherit a copy of the static data + const pc_lpt_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&m_out_irq, 0, sizeof(m_out_irq)); + } } //------------------------------------------------- @@ -251,7 +173,20 @@ void pc_lpt_device::device_config_complete() void pc_lpt_device::device_start() { - DEVICE_START_NAME( pc_lpt )(this); + /* get centronics device */ + m_centronics = subdevice("centronics"); + assert(m_centronics != NULL); + + /* resolve callbacks */ + m_out_irq_func.resolve(m_out_irq, *this); + + /* register for state saving */ + save_item(NAME(m_ack)); + save_item(NAME(m_strobe)); + save_item(NAME(m_autofd)); + save_item(NAME(m_init)); + save_item(NAME(m_select)); + save_item(NAME(m_irq_enabled)); } //------------------------------------------------- @@ -260,7 +195,12 @@ void pc_lpt_device::device_start() void pc_lpt_device::device_reset() { - DEVICE_RESET_NAME( pc_lpt )(this); + m_strobe = TRUE; + m_autofd = TRUE; + m_init = FALSE; + m_select = TRUE; + m_irq_enabled = FALSE; + m_data = 0xff; } //------------------------------------------------- @@ -355,8 +295,8 @@ void isa8_lpt_device::device_reset() { m_is_primary = (ioport("DSW")->read() & 1) ? false : true; if (m_is_primary) { - m_isa->install_device(subdevice("lpt"), 0x0378, 0x037b, 0, 0, FUNC(pc_lpt_r), FUNC(pc_lpt_w) ); + m_isa->install_device(0x0378, 0x037b, 0, 0, read8_delegate(FUNC(pc_lpt_device::read), subdevice("lpt")), write8_delegate(FUNC(pc_lpt_device::write), subdevice("lpt"))); } else { - m_isa->install_device(subdevice("lpt"), 0x0278, 0x027b, 0, 0, FUNC(pc_lpt_r), FUNC(pc_lpt_w) ); + m_isa->install_device(0x0278, 0x027b, 0, 0, read8_delegate(FUNC(pc_lpt_device::read), subdevice("lpt")), write8_delegate(FUNC(pc_lpt_device::write), subdevice("lpt"))); } } diff --git a/src/mess/machine/pc_lpt.h b/src/mess/machine/pc_lpt.h index 1ce13bd1e26..fb0d2ceabb6 100644 --- a/src/mess/machine/pc_lpt.h +++ b/src/mess/machine/pc_lpt.h @@ -8,6 +8,8 @@ #define __PC_LPT_H__ #include "isa.h" +#include "machine/ctronics.h" +#include "cntr_covox.h" /*************************************************************************** @@ -16,44 +18,54 @@ struct pc_lpt_interface { - devcb_write_line out_irq_func; + devcb_write_line m_out_irq; }; - -/*************************************************************************** - FUNCTION PROTOTYPES -***************************************************************************/ -DECLARE_READ8_DEVICE_HANDLER( pc_lpt_r ); -DECLARE_WRITE8_DEVICE_HANDLER( pc_lpt_w ); - -DECLARE_READ8_DEVICE_HANDLER( pc_lpt_data_r ); -DECLARE_WRITE8_DEVICE_HANDLER( pc_lpt_data_w ); -DECLARE_READ8_DEVICE_HANDLER( pc_lpt_status_r ); -DECLARE_READ8_DEVICE_HANDLER( pc_lpt_control_r ); -DECLARE_WRITE8_DEVICE_HANDLER( pc_lpt_control_w ); - - /*************************************************************************** DEVICE CONFIGURATION MACROS ***************************************************************************/ -class pc_lpt_device : public device_t +class pc_lpt_device : public device_t, + public pc_lpt_interface { public: pc_lpt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - ~pc_lpt_device() { global_free(m_token); } + ~pc_lpt_device() {} - // access to legacy token - void *token() const { assert(m_token != NULL); return m_token; } + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + + DECLARE_READ8_MEMBER( data_r ); + DECLARE_WRITE8_MEMBER( data_w ); + DECLARE_READ8_MEMBER( status_r ); + DECLARE_READ8_MEMBER( control_r ); + DECLARE_WRITE8_MEMBER( control_w ); + + DECLARE_WRITE_LINE_MEMBER( ack_w ); + protected: // device-level overrides virtual void device_config_complete(); virtual void device_start(); virtual void device_reset(); virtual machine_config_constructor device_mconfig_additions() const; + private: // internal state - void *m_token; + centronics_device *m_centronics; + + devcb_resolved_write_line m_out_irq_func; + + UINT8 m_data; + + int m_ack; + + /* control latch */ + int m_strobe; + int m_autofd; + int m_init; + int m_select; + int m_irq_enabled; }; extern const device_type PC_LPT; diff --git a/src/mess/video/isa_mda.c b/src/mess/video/isa_mda.c index 299daf4536f..35d484b6450 100644 --- a/src/mess/video/isa_mda.c +++ b/src/mess/video/isa_mda.c @@ -438,7 +438,7 @@ READ8_MEMBER( isa8_mda_device::status_r) WRITE8_MEMBER( isa8_mda_device::io_write) { mc6845_device *mc6845 = subdevice(MDA_MC6845_NAME); - device_t *lpt = subdevice("lpt"); + pc_lpt_device *lpt = subdevice("lpt"); switch( offset ) { case 0: case 2: case 4: case 6: @@ -451,7 +451,7 @@ WRITE8_MEMBER( isa8_mda_device::io_write) mode_control_w(space, offset, data); break; case 12: case 13: case 14: - pc_lpt_w(lpt, space, offset - 12, data); + lpt->write(space, offset - 12, data); break; } } @@ -460,7 +460,7 @@ READ8_MEMBER( isa8_mda_device::io_read) { int data = 0xff; mc6845_device *mc6845 = subdevice(MDA_MC6845_NAME); - device_t *lpt = subdevice("lpt"); + pc_lpt_device *lpt = subdevice("lpt"); switch( offset ) { case 0: case 2: case 4: case 6: @@ -474,7 +474,7 @@ READ8_MEMBER( isa8_mda_device::io_read) break; /* 12, 13, 14 are the LPT ports */ case 12: case 13: case 14: - data = pc_lpt_r(lpt, space, offset - 12); + data = lpt->read(space, offset - 12); break; } return data; @@ -671,7 +671,7 @@ WRITE8_MEMBER( isa8_hercules_device::mode_control_w ) WRITE8_MEMBER( isa8_hercules_device::io_write ) { mc6845_device *mc6845 = subdevice(HERCULES_MC6845_NAME); - device_t *lpt = subdevice("lpt"); + pc_lpt_device *lpt = subdevice("lpt"); switch( offset ) { case 0: case 2: case 4: case 6: @@ -684,7 +684,7 @@ WRITE8_MEMBER( isa8_hercules_device::io_write ) mode_control_w(space, offset, data); break; case 12: case 13: case 14: - pc_lpt_w(lpt, space, offset - 12, data); + lpt->write(space, offset - 12, data); break; case 15: m_configuration_switch = data; @@ -717,7 +717,7 @@ READ8_MEMBER( isa8_hercules_device::io_read ) { int data = 0xff; mc6845_device *mc6845 = subdevice(HERCULES_MC6845_NAME); - device_t *lpt = subdevice("lpt"); + pc_lpt_device *lpt = subdevice("lpt"); switch( offset ) { case 0: case 2: case 4: case 6: @@ -731,7 +731,7 @@ READ8_MEMBER( isa8_hercules_device::io_read ) break; /* 12, 13, 14 are the LPT ports */ case 12: case 13: case 14: - data = pc_lpt_r(lpt, space, offset - 12); + data = lpt->read(space, offset - 12); break; } return data;