diff --git a/src/mess/drivers/ssystem3.c b/src/mess/drivers/ssystem3.c index b95fb8d4b0e..17eca5bfef7 100644 --- a/src/mess/drivers/ssystem3.c +++ b/src/mess/drivers/ssystem3.c @@ -38,7 +38,6 @@ backup of playfield rom and picture/description of its board #include "emu.h" #include "includes/ssystem3.h" -#include "machine/6522via.h" #include "cpu/m6502/m6502.h" #include "sound/dac.h" @@ -60,7 +59,7 @@ void ssystem3_state::ssystem3_playfield_reset() { memset(&m_playfield, 0, sizeof(m_playfield)); m_playfield.signal=FALSE; - // m_playfield.on=TRUE; //ioport("Configuration")->read()&1; + // m_playfield.on=TRUE; //m_configuration->read()&1; } void ssystem3_state::ssystem3_playfield_write(int reset, int signal) @@ -91,7 +90,7 @@ void ssystem3_state::ssystem3_playfield_write(int reset, int signal) if (d) m_playfield.data|=1<<(m_playfield.bit^7); m_playfield.bit++; if (m_playfield.bit==8) { - logerror("%.4x playfield wrote %d %02x\n", (int)machine().device("maincpu")->safe_pc(), m_playfield.count, m_playfield.data); + logerror("%.4x playfield wrote %d %02x\n", (int)m_maincpu->pc(), m_playfield.count, m_playfield.data); m_playfield.u.data[m_playfield.count]=m_playfield.data; m_playfield.bit=0; m_playfield.count=(m_playfield.count+1)%ARRAY_LENGTH(m_playfield.u.data); @@ -110,7 +109,7 @@ void ssystem3_state::ssystem3_playfield_write(int reset, int signal) void ssystem3_state::ssystem3_playfield_read(int *on, int *ready) { - *on=!(ioport("Configuration")->read()&1); + *on = !(m_configuration->read() & 1); // *on=!m_playfield.on; *ready=FALSE; } @@ -197,22 +196,21 @@ READ8_MEMBER(ssystem3_state::ssystem3_via_read_b) WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_b) { - ssystem3_playfield_write(data&1, data&8); - ssystem3_lcd_write(data&4, data&2); + ssystem3_playfield_write(data & 1, data & 8); + ssystem3_lcd_write(data & 4, data & 2); // TODO: figure out what this is trying to achieve - via6522_device *via_0 = machine().device("via6522_0"); - UINT8 d=ssystem3_via_read_b(space, 0, mem_mask)&~0x40; - if (data&0x80) d|=0x40; + UINT8 d = ssystem3_via_read_b(space, 0, mem_mask) & ~0x40; + if (data & 0x80) d |= 0x40; // d&=~0x8f; - via_0->write_pb0((d>>0)&1); - via_0->write_pb1((d>>1)&1); - via_0->write_pb2((d>>2)&1); - via_0->write_pb3((d>>3)&1); - via_0->write_pb4((d>>4)&1); - via_0->write_pb5((d>>5)&1); - via_0->write_pb6((d>>6)&1); - via_0->write_pb7((d>>7)&1); + m_via6522_0->write_pb0((d >> 0) & 1); + m_via6522_0->write_pb1((d >> 1) & 1); + m_via6522_0->write_pb2((d >> 2) & 1); + m_via6522_0->write_pb3((d >> 3) & 1); + m_via6522_0->write_pb4((d >> 4) & 1); + m_via6522_0->write_pb5((d >> 5) & 1); + m_via6522_0->write_pb6((d >> 6) & 1); + m_via6522_0->write_pb7((d >> 7) & 1); } DRIVER_INIT_MEMBER(ssystem3_state,ssystem3) diff --git a/src/mess/includes/ssystem3.h b/src/mess/includes/ssystem3.h index 64ed29b7427..0dbbb867a1c 100644 --- a/src/mess/includes/ssystem3.h +++ b/src/mess/includes/ssystem3.h @@ -9,6 +9,8 @@ #ifndef SSYSTEM3_H_ #define SSYSTEM3_H_ +#include "machine/6522via.h" + struct playfield_t { @@ -40,14 +42,13 @@ class ssystem3_state : public driver_device { public: ssystem3_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_palette(*this, "palette") { } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_palette(*this, "palette") + , m_via6522_0(*this, "via6522_0") + , m_configuration(*this, "Configuration") + { } - UINT8 m_porta; - UINT8 *m_videoram; - playfield_t m_playfield; - lcd_t m_lcd; DECLARE_DRIVER_INIT(ssystem3); virtual void video_start(); DECLARE_PALETTE_INIT(ssystem3); @@ -56,8 +57,6 @@ public: DECLARE_READ8_MEMBER(ssystem3_via_read_a); DECLARE_READ8_MEMBER(ssystem3_via_read_b); DECLARE_WRITE8_MEMBER(ssystem3_via_write_b); - required_device m_maincpu; - required_device m_palette; void ssystem3_lcd_reset(); void ssystem3_lcd_write(int clock, int data); void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y); @@ -66,6 +65,17 @@ public: void ssystem3_playfield_reset(); void ssystem3_playfield_write(int reset, int signal); void ssystem3_playfield_read(int *on, int *ready); + +private: + UINT8 m_porta; + UINT8 *m_videoram; + playfield_t m_playfield; + lcd_t m_lcd; + + required_device m_maincpu; + required_device m_palette; + required_device m_via6522_0; + required_ioport m_configuration; }; diff --git a/src/mess/video/ssystem3.c b/src/mess/video/ssystem3.c index b173ae76911..a755dff5a4b 100644 --- a/src/mess/video/ssystem3.c +++ b/src/mess/video/ssystem3.c @@ -18,7 +18,7 @@ void ssystem3_state::ssystem3_lcd_write(int clock, int data) m_lcd.data[m_lcd.count/8]&=~(1<<(m_lcd.count&7)); if (data) m_lcd.data[m_lcd.count/8]|=1<<(m_lcd.count&7); if (m_lcd.count+1==40) { - logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine().device("maincpu")->safe_pc(), + logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)m_maincpu->pc(), m_lcd.data[0], m_lcd.data[1], m_lcd.data[2], m_lcd.data[3], m_lcd.data[4]); } m_lcd.count=(m_lcd.count+1)%40; @@ -204,7 +204,7 @@ UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind1 ssystem3_draw_led(bitmap, m_lcd.data[3]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3'); ssystem3_draw_led(bitmap, m_lcd.data[4]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4'); - if (ioport("Configuration")->read()&1) { // playfield(optional device) + if (m_configuration->read() & 1) { // playfield(optional device) static const int lcd_signs_on[]={ 0, // empty 1, // bauer