modernize -- nuke first_screen, ioport() lookups, etc. (nw)

This commit is contained in:
Sergey Svishchev 2018-03-04 20:50:46 +03:00 committed by Vas Crabb
parent 6a07dcc57b
commit 2b1d3785bc
9 changed files with 57 additions and 60 deletions

View File

@ -13,7 +13,6 @@
#pragma once #pragma once
#include "emu.h"
#include "a2bus.h" #include "a2bus.h"
//************************************************************************** //**************************************************************************

View File

@ -80,6 +80,7 @@ ioport_constructor a2bus_agat7_ports_device::device_input_ports() const
a2bus_agat7_ports_device::a2bus_agat7_ports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) a2bus_agat7_ports_device::a2bus_agat7_ports_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock) : device_t(mconfig, type, tag, owner, clock)
, device_a2bus_card_interface(mconfig, *this) , device_a2bus_card_interface(mconfig, *this)
, m_printer_cfg(*this, "PRINTER_CFG")
, m_d9(*this, "d9") , m_d9(*this, "d9")
, m_d10(*this, "d10") , m_d10(*this, "d10")
, m_centronics(*this, "centronics") , m_centronics(*this, "centronics")
@ -185,7 +186,7 @@ WRITE8_MEMBER(a2bus_agat7_ports_device::write_portb)
*/ */
READ8_MEMBER(a2bus_agat7_ports_device::read_portc) READ8_MEMBER(a2bus_agat7_ports_device::read_portc)
{ {
return (m_centronics_busy << 7) | ioport("PRINTER_CFG")->read(); return (m_centronics_busy << 7) | m_printer_cfg->read();
} }
WRITE_LINE_MEMBER(a2bus_agat7_ports_device::write_centronics_busy) WRITE_LINE_MEMBER(a2bus_agat7_ports_device::write_centronics_busy)

View File

@ -13,7 +13,6 @@
#pragma once #pragma once
#include "emu.h"
#include "a2bus.h" #include "a2bus.h"
#include "bus/centronics/ctronics.h" #include "bus/centronics/ctronics.h"
@ -45,6 +44,8 @@ protected:
virtual uint8_t read_c0nx(uint8_t offset) override; virtual uint8_t read_c0nx(uint8_t offset) override;
virtual void write_c0nx(uint8_t offset, uint8_t data) override; virtual void write_c0nx(uint8_t offset, uint8_t data) override;
required_ioport m_printer_cfg;
required_device<i8255_device> m_d9; required_device<i8255_device> m_d9;
required_device<i8251_device> m_d10; required_device<i8251_device> m_d10;
required_device<centronics_device> m_centronics; required_device<centronics_device> m_centronics;

View File

@ -13,7 +13,6 @@
#pragma once #pragma once
#include "emu.h"
#include "a2bus.h" #include "a2bus.h"
//************************************************************************** //**************************************************************************

View File

@ -35,7 +35,7 @@ protected:
// device type definition // device type definition
extern const device_type P1_ROM; DECLARE_DEVICE_TYPE(P1_ROM, p1_rom_device)
#endif // MAME_BUS_ISA_P1_ROM_H #endif // MAME_BUS_ISA_P1_ROM_H

View File

@ -49,18 +49,11 @@ TIMER_CALLBACK_MEMBER(mc1502_state::keyb_signal_callback)
{ {
uint8_t key = 0; uint8_t key = 0;
key |= ioport("Y1")->read(); for (int i = 0; i < 12; i++)
key |= ioport("Y2")->read(); {
key |= ioport("Y3")->read(); key |= m_kbdio[i]->read();
key |= ioport("Y4")->read(); }
key |= ioport("Y5")->read();
key |= ioport("Y6")->read();
key |= ioport("Y7")->read();
key |= ioport("Y8")->read();
key |= ioport("Y9")->read();
key |= ioport("Y10")->read();
key |= ioport("Y11")->read();
key |= ioport("Y12")->read();
// DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, m_kbd.pulsing, // DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, m_kbd.pulsing,
// (key || m_kbd.pulsing) ? " will IRQ" : "")); // (key || m_kbd.pulsing) ? " will IRQ" : ""));
@ -126,18 +119,14 @@ READ8_MEMBER(mc1502_state::mc1502_kppi_porta_r)
{ {
uint8_t key = 0; uint8_t key = 0;
if (m_kbd.mask & 0x0001) { key |= ioport("Y1")->read(); } for (int i = 0; i < 12; i++)
if (m_kbd.mask & 0x0002) { key |= ioport("Y2")->read(); } {
if (m_kbd.mask & 0x0004) { key |= ioport("Y3")->read(); } if (BIT(m_kbd.mask, i))
if (m_kbd.mask & 0x0008) { key |= ioport("Y4")->read(); } {
if (m_kbd.mask & 0x0010) { key |= ioport("Y5")->read(); } key |= m_kbdio[i]->read();
if (m_kbd.mask & 0x0020) { key |= ioport("Y6")->read(); } }
if (m_kbd.mask & 0x0040) { key |= ioport("Y7")->read(); } }
if (m_kbd.mask & 0x0080) { key |= ioport("Y8")->read(); }
if (m_kbd.mask & 0x0100) { key |= ioport("Y9")->read(); }
if (m_kbd.mask & 0x0200) { key |= ioport("Y10")->read(); }
if (m_kbd.mask & 0x0400) { key |= ioport("Y11")->read(); }
if (m_kbd.mask & 0x0800) { key |= ioport("Y12")->read(); }
key ^= 0xff; key ^= 0xff;
// DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key)); // DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key));
return key; return key;

View File

@ -74,7 +74,9 @@ public:
, m_speaker(*this, "speaker") , m_speaker(*this, "speaker")
, m_cassette(*this, "cassette") , m_cassette(*this, "cassette")
, m_ram(*this, RAM_TAG) , m_ram(*this, RAM_TAG)
, m_screen(*this, "screen")
, m_palette(*this, "palette") , m_palette(*this, "palette")
, m_kbdio(*this, "Y%u", 1)
{ } { }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
@ -86,8 +88,11 @@ public:
required_device<speaker_sound_device> m_speaker; required_device<speaker_sound_device> m_speaker;
required_device<cassette_image_device> m_cassette; required_device<cassette_image_device> m_cassette;
required_device<ram_device> m_ram; required_device<ram_device> m_ram;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_ioport_array<8> m_kbdio;
DECLARE_DRIVER_INIT(poisk1); DECLARE_DRIVER_INIT(poisk1);
DECLARE_MACHINE_START(poisk1); DECLARE_MACHINE_START(poisk1);
DECLARE_MACHINE_RESET(poisk1); DECLARE_MACHINE_RESET(poisk1);
@ -241,9 +246,9 @@ WRITE8_MEMBER(p1_state::p1_ppi2_porta_w)
if (BIT((data ^ m_video.color_select_68), 7)) if (BIT((data ^ m_video.color_select_68), 7))
{ {
if (BIT(data, 7)) if (BIT(data, 7))
machine().first_screen()->set_visible_area(0, 640 - 1, 0, 200 - 1); m_screen->set_visible_area(0, 640 - 1, 0, 200 - 1);
else else
machine().first_screen()->set_visible_area(0, 320 - 1, 0, 200 - 1); m_screen->set_visible_area(0, 320 - 1, 0, 200 - 1);
} }
m_video.color_select_68 = data; m_video.color_select_68 = data;
set_palette_luts(); set_palette_luts();
@ -489,14 +494,14 @@ READ8_MEMBER(p1_state::p1_ppi_portb_r)
uint16_t key = 0xffff; uint16_t key = 0xffff;
uint8_t ret = 0; uint8_t ret = 0;
if (m_kbpoll_mask & 0x01) { key &= ioport("Y1")->read(); } for (int i = 0; i < 8; i++)
if (m_kbpoll_mask & 0x02) { key &= ioport("Y2")->read(); } {
if (m_kbpoll_mask & 0x04) { key &= ioport("Y3")->read(); } if (BIT(m_kbpoll_mask, i))
if (m_kbpoll_mask & 0x08) { key &= ioport("Y4")->read(); } {
if (m_kbpoll_mask & 0x10) { key &= ioport("Y5")->read(); } key &= m_kbdio[i]->read();
if (m_kbpoll_mask & 0x20) { key &= ioport("Y6")->read(); } }
if (m_kbpoll_mask & 0x40) { key &= ioport("Y7")->read(); } }
if (m_kbpoll_mask & 0x80) { key &= ioport("Y8")->read(); }
ret = key & 0xff; ret = key & 0xff;
// DBG_LOG(1,"p1_ppi_portb_r",("= %02X\n", ret)); // DBG_LOG(1,"p1_ppi_portb_r",("= %02X\n", ret));
return ret; return ret;
@ -507,14 +512,14 @@ READ8_MEMBER(p1_state::p1_ppi_portc_r)
uint16_t key = 0xffff; uint16_t key = 0xffff;
uint8_t ret = 0; uint8_t ret = 0;
if (m_kbpoll_mask & 0x01) { key &= ioport("Y1")->read(); } for (int i = 0; i < 8; i++)
if (m_kbpoll_mask & 0x02) { key &= ioport("Y2")->read(); } {
if (m_kbpoll_mask & 0x04) { key &= ioport("Y3")->read(); } if (BIT(m_kbpoll_mask, i))
if (m_kbpoll_mask & 0x08) { key &= ioport("Y4")->read(); } {
if (m_kbpoll_mask & 0x10) { key &= ioport("Y5")->read(); } key &= m_kbdio[i]->read();
if (m_kbpoll_mask & 0x20) { key &= ioport("Y6")->read(); } }
if (m_kbpoll_mask & 0x40) { key &= ioport("Y7")->read(); } }
if (m_kbpoll_mask & 0x80) { key &= ioport("Y8")->read(); }
ret = (key >> 8) & 0xff; ret = (key >> 8) & 0xff;
DBG_LOG(2,"p1_ppi_portc_r",("= %02X\n", ret)); DBG_LOG(2,"p1_ppi_portc_r",("= %02X\n", ret));
return ret; return ret;

View File

@ -230,7 +230,7 @@ void sm7238_state::recompute_parameters()
refresh = HZ_TO_ATTOSECONDS(20.625_MHz_XTAL) * m_video.stride * 10 * KSM_TOTAL_VERT; refresh = HZ_TO_ATTOSECONDS(20.625_MHz_XTAL) * m_video.stride * 10 * KSM_TOTAL_VERT;
} }
machine().first_screen()->configure(m_video.stride * 10, KSM_TOTAL_VERT, visarea, refresh); m_screen->configure(m_video.stride * 10, KSM_TOTAL_VERT, visarea, refresh);
} }
uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)

View File

@ -28,18 +28,20 @@ class mc1502_state : public driver_device
{ {
public: public:
mc1502_state(const machine_config &mconfig, device_type type, const char *tag) mc1502_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag)
m_maincpu(*this, "maincpu"), , m_maincpu(*this, "maincpu")
m_upd8251(*this, "upd8251"), , m_upd8251(*this, "upd8251")
m_pic8259(*this, "pic8259"), , m_pic8259(*this, "pic8259")
m_pit8253(*this, "pit8253"), , m_pit8253(*this, "pit8253")
m_ppi8255n1(*this, "ppi8255n1"), , m_ppi8255n1(*this, "ppi8255n1")
m_ppi8255n2(*this, "ppi8255n2"), , m_ppi8255n2(*this, "ppi8255n2")
m_isabus(*this, "isa"), , m_isabus(*this, "isa")
m_speaker(*this, "speaker"), , m_speaker(*this, "speaker")
m_cassette(*this, "cassette"), , m_cassette(*this, "cassette")
m_centronics(*this, "centronics"), , m_centronics(*this, "centronics")
m_ram(*this, RAM_TAG) { } , m_ram(*this, RAM_TAG)
, m_kbdio(*this, "Y%u", 1)
{ }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<i8251_device> m_upd8251; required_device<i8251_device> m_upd8251;
@ -52,6 +54,7 @@ public:
required_device<cassette_image_device> m_cassette; required_device<cassette_image_device> m_cassette;
required_device<centronics_device> m_centronics; required_device<centronics_device> m_centronics;
required_device<ram_device> m_ram; required_device<ram_device> m_ram;
required_ioport_array<12> m_kbdio;
DECLARE_DRIVER_INIT(mc1502); DECLARE_DRIVER_INIT(mc1502);
DECLARE_MACHINE_START(mc1502); DECLARE_MACHINE_START(mc1502);