diff --git a/src/devices/machine/i8257.h b/src/devices/machine/i8257.h index f20e68bcee1..80e268f1b2d 100644 --- a/src/devices/machine/i8257.h +++ b/src/devices/machine/i8257.h @@ -42,56 +42,56 @@ ***************************************************************************/ #define MCFG_I8257_OUT_HRQ_CB(_devcb) \ - devcb = &i8257_device::set_out_hrq_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_hrq_callback(DEVCB_##_devcb); #define MCFG_I8257_OUT_TC_CB(_devcb) \ - devcb = &i8257_device::set_out_tc_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_tc_callback(DEVCB_##_devcb); #define MCFG_I8257_IN_MEMR_CB(_devcb) \ - devcb = &i8257_device::set_in_memr_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_in_memr_callback(DEVCB_##_devcb); #define MCFG_I8257_OUT_MEMW_CB(_devcb) \ - devcb = &i8257_device::set_out_memw_callback(*device, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_memw_callback(DEVCB_##_devcb); #define MCFG_I8257_IN_IOR_0_CB(_devcb) \ - devcb = &i8257_device::set_in_ior_callback(*device, 0, DEVCB_##_devcb); + devcb = &downcast(*device).set_in_ior_callback<0>(DEVCB_##_devcb); #define MCFG_I8257_IN_IOR_1_CB(_devcb) \ - devcb = &i8257_device::set_in_ior_callback(*device, 1, DEVCB_##_devcb); + devcb = &downcast(*device).set_in_ior_callback<1>(DEVCB_##_devcb); #define MCFG_I8257_IN_IOR_2_CB(_devcb) \ - devcb = &i8257_device::set_in_ior_callback(*device, 2, DEVCB_##_devcb); + devcb = &downcast(*device).set_in_ior_callback<2>(DEVCB_##_devcb); #define MCFG_I8257_IN_IOR_3_CB(_devcb) \ - devcb = &i8257_device::set_in_ior_callback(*device, 3, DEVCB_##_devcb); + devcb = &downcast(*device).set_in_ior_callback<3>(DEVCB_##_devcb); #define MCFG_I8257_OUT_IOW_0_CB(_devcb) \ - devcb = &i8257_device::set_out_iow_callback(*device, 0, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_iow_callback<0>(DEVCB_##_devcb); #define MCFG_I8257_OUT_IOW_1_CB(_devcb) \ - devcb = &i8257_device::set_out_iow_callback(*device, 1, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_iow_callback<1>(DEVCB_##_devcb); #define MCFG_I8257_OUT_IOW_2_CB(_devcb) \ - devcb = &i8257_device::set_out_iow_callback(*device, 2, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_iow_callback<2>(DEVCB_##_devcb); #define MCFG_I8257_OUT_IOW_3_CB(_devcb) \ - devcb = &i8257_device::set_out_iow_callback(*device, 3, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_iow_callback<3>(DEVCB_##_devcb); #define MCFG_I8257_OUT_DACK_0_CB(_devcb) \ - devcb = &i8257_device::set_out_dack_callback(*device, 0, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_dack_callback<0>(DEVCB_##_devcb); #define MCFG_I8257_OUT_DACK_1_CB(_devcb) \ - devcb = &i8257_device::set_out_dack_callback(*device, 1, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_dack_callback<1>(DEVCB_##_devcb); #define MCFG_I8257_OUT_DACK_2_CB(_devcb) \ - devcb = &i8257_device::set_out_dack_callback(*device, 2, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_dack_callback<2>(DEVCB_##_devcb); #define MCFG_I8257_OUT_DACK_3_CB(_devcb) \ - devcb = &i8257_device::set_out_dack_callback(*device, 3, DEVCB_##_devcb); + devcb = &downcast(*device).set_out_dack_callback<3>(DEVCB_##_devcb); // HACK: the radio86 and alikes require this, is it a bug in the soviet clone or is there something else happening? #define MCFG_I8257_REVERSE_RW_MODE(_flag) \ - i8257_device::static_set_reverse_rw_mode(*device, _flag); + downcast(*device).set_reverse_rw_mode(_flag); // ======================> i8257_device @@ -113,18 +113,18 @@ public: DECLARE_WRITE_LINE_MEMBER( dreq2_w ); DECLARE_WRITE_LINE_MEMBER( dreq3_w ); - template static devcb_base &set_out_hrq_callback(device_t &device, Object &&cb) { return downcast(device).m_out_hrq_cb.set_callback(std::forward(cb)); } - template static devcb_base &set_out_tc_callback(device_t &device, Object &&cb) { return downcast(device).m_out_tc_cb.set_callback(std::forward(cb)); } + template devcb_base &set_out_hrq_callback(Object &&cb) { return m_out_hrq_cb.set_callback(std::forward(cb)); } + template devcb_base &set_out_tc_callback(Object &&cb) { return m_out_tc_cb.set_callback(std::forward(cb)); } - template static devcb_base &set_in_memr_callback(device_t &device, Object &&cb) { return downcast(device).m_in_memr_cb.set_callback(std::forward(cb)); } - template static devcb_base &set_out_memw_callback(device_t &device, Object &&cb) { return downcast(device).m_out_memw_cb.set_callback(std::forward(cb)); } + template devcb_base &set_in_memr_callback(Object &&cb) { return m_in_memr_cb.set_callback(std::forward(cb)); } + template devcb_base &set_out_memw_callback(Object &&cb) { return m_out_memw_cb.set_callback(std::forward(cb)); } - template static devcb_base &set_in_ior_callback(device_t &device, int ch, Object &&cb) { return downcast(device).m_in_ior_cb[ch].set_callback(std::forward(cb)); } - template static devcb_base &set_out_iow_callback(device_t &device, int ch, Object &&cb) { return downcast(device).m_out_iow_cb[ch].set_callback(std::forward(cb)); } + template devcb_base &set_in_ior_callback(Object &&cb) { return m_in_ior_cb[Ch].set_callback(std::forward(cb)); } + template devcb_base &set_out_iow_callback(Object &&cb) { return m_out_iow_cb[Ch].set_callback(std::forward(cb)); } - template static devcb_base &set_out_dack_callback(device_t &device, int ch, Object &&cb) { return downcast(device).m_out_dack_cb[ch].set_callback(std::forward(cb)); } + template devcb_base &set_out_dack_callback(Object &&cb) { return m_out_dack_cb[Ch].set_callback(std::forward(cb)); } - static void static_set_reverse_rw_mode(device_t &device, bool flag) { downcast(device).m_reverse_rw = flag; } + void set_reverse_rw_mode(bool flag) { m_reverse_rw = flag; } protected: // device-level overrides diff --git a/src/devices/machine/roc10937.cpp b/src/devices/machine/roc10937.cpp index 966d28c38c9..e50c0a48710 100644 --- a/src/devices/machine/roc10937.cpp +++ b/src/devices/machine/roc10937.cpp @@ -10,6 +10,9 @@ #include "emu.h" #include "roc10937.h" +#include + + /* Rockwell 10937 16 segment charset lookup table 0 1 @@ -126,37 +129,30 @@ static const int roc10937poslut[]= }; rocvfd_device::rocvfd_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), + m_outputs(), + m_port_val(0) { - m_port_val=0; } -void rocvfd_device::static_set_value(device_t &device, int val) -{ - rocvfd_device &roc = downcast(device); - roc.m_port_val = val; -} - void rocvfd_device::device_start() { - save_item(NAME(m_port_val)); + m_outputs = std::make_unique >(*this, "vfd%u", unsigned(m_port_val * 16)); + m_outputs->resolve(); + save_item(NAME(m_cursor_pos)); save_item(NAME(m_window_size)); save_item(NAME(m_shift_count)); save_item(NAME(m_shift_data)); save_item(NAME(m_pcursor_pos)); save_item(NAME(m_chars)); - save_item(NAME(m_outputs)); save_item(NAME(m_brightness)); save_item(NAME(m_count)); save_item(NAME(m_sclk)); save_item(NAME(m_data)); save_item(NAME(m_duty)); save_item(NAME(m_disp)); - - - device_reset(); } void rocvfd_device::device_reset() @@ -173,8 +169,8 @@ void rocvfd_device::device_reset() m_sclk = 0; m_data = 0; - memset(m_chars, 0, sizeof(m_chars)); - memset(m_outputs, 0, sizeof(m_outputs)); + std::fill(std::begin(m_chars), std::end(m_chars), 0); + std::fill(std::begin(*m_outputs), std::end(*m_outputs), 0); } /////////////////////////////////////////////////////////////////////////// @@ -192,11 +188,7 @@ void rocvfd_device::device_post_load() void rocvfd_device::update_display() { - for (int i =0; i<16; i++) - { - m_outputs[i] = set_display(m_chars[i]); - machine().output().set_indexed_value("vfd", (m_port_val*16) + i, m_outputs[i]); - } + std::transform(std::begin(m_chars), std::end(m_chars), std::begin(*m_outputs), set_display); } WRITE_LINE_MEMBER( rocvfd_device::sclk ) @@ -253,25 +245,21 @@ DEFINE_DEVICE_TYPE(S16LF01, s16lf01_device, "s16lf01", "Samsung 16LF01 Series roc10937_device::roc10937_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : rocvfd_device(mconfig, ROC10937, tag, owner, clock) { - m_port_val=0; } msc1937_device::msc1937_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : rocvfd_device(mconfig, MSC1937, tag, owner, clock) { - m_port_val=0; } mic10937_device::mic10937_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : rocvfd_device(mconfig, MIC10937, tag, owner, clock) { - m_port_val=0; } s16lf01_device::s16lf01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : rocvfd_device(mconfig, S16LF01, tag, owner, clock) { - m_port_val=0; } void rocvfd_device::write_char(int data) @@ -328,7 +316,6 @@ void rocvfd_device::write_char(int data) roc10957_device::roc10957_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : rocvfd_device(mconfig, ROC10957, tag, owner, clock) { - m_port_val=0; } void roc10957_device::write_char(int data) diff --git a/src/devices/machine/roc10937.h b/src/devices/machine/roc10937.h index e0488697d86..2dfc434501d 100644 --- a/src/devices/machine/roc10937.h +++ b/src/devices/machine/roc10937.h @@ -17,7 +17,7 @@ MCFG_ROC10937_PORT(_val) #define MCFG_ROC10937_PORT(_val) \ - roc10937_device::static_set_value(*device, _val); + downcast(*device).set_port_value(_val); #define MCFG_ROC10937_REMOVE(_tag) \ MCFG_DEVICE_REMOVE(_tag) @@ -26,7 +26,7 @@ MCFG_ROC10957_PORT(_val) #define MCFG_ROC10957_PORT(_val) \ - roc10957_device::static_set_value(*device, _val); + downcast(*device).set_port_value(_val); #define MCFG_ROC10957_REMOVE(_tag) \ MCFG_DEVICE_REMOVE(_tag) @@ -57,14 +57,15 @@ #define MCFG_S16LF01_PORT(_val) \ MCFG_ROC10937_PORT(_val) -class rocvfd_device : public device_t { +class rocvfd_device : public device_t +{ public: // inline configuration helpers - static void static_set_value(device_t &device, int val); + void set_port_value(uint8_t val) { m_port_val = val; } + virtual void update_display(); void shift_clock(int data); void write_char(int data); - uint32_t set_display(uint32_t segin); DECLARE_WRITE_LINE_MEMBER( sclk ); DECLARE_WRITE_LINE_MEMBER( data ); DECLARE_WRITE_LINE_MEMBER( por ); @@ -73,9 +74,10 @@ public: protected: rocvfd_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - uint8_t m_port_val; + std::unique_ptr > m_outputs; + int m_cursor_pos; - int m_window_size; // window size + int m_window_size; int m_shift_count; int m_shift_data; int m_pcursor_pos; @@ -87,11 +89,15 @@ protected: int m_sclk; uint8_t m_cursor; uint32_t m_chars[16]; - uint32_t m_outputs[16]; virtual void device_start() override; virtual void device_reset() override; virtual void device_post_load() override; + +private: + static uint32_t set_display(uint32_t segin); + + uint8_t m_port_val; }; diff --git a/src/devices/video/sda5708.cpp b/src/devices/video/sda5708.cpp index 7049b295ca5..05453afadb7 100644 --- a/src/devices/video/sda5708.cpp +++ b/src/devices/video/sda5708.cpp @@ -24,7 +24,7 @@ #define LOG_CNTR (1U << 4) //#define VERBOSE (LOG_DATA|LOG_SETUP|LOG_CMD|LOG_CNTR|LOG_GENERAL) -#define LOG_OUTPUT_FUNC printf // must always be enabled as logerror is not available here +//#define LOG_OUTPUT_STREAM std::cout #include "logmacro.h" @@ -58,8 +58,9 @@ DEFINE_DEVICE_TYPE(SDA5708, sda5708_device, "sda5708", "SDA570 // sda5708_device - constructor //------------------------------------------------- -sda5708_device::sda5708_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, SDA5708, tag, owner, clock) +sda5708_device::sda5708_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, SDA5708, tag, owner, clock) + , m_dots(*this, "Dot_%u%u%u", 1U, 1U, 1U) , m_serial(0) , m_load(0) , m_reset(0) @@ -81,6 +82,10 @@ sda5708_device::sda5708_device(const machine_config &mconfig, const char *tag, d void sda5708_device::device_start() { LOG("%s\n", FUNCNAME); + + // look up outputs + m_dots.resolve(); + // register for state saving save_item(NAME(m_serial)); save_item(NAME(m_load)); @@ -122,21 +127,22 @@ void sda5708_device::device_reset() void sda5708_device::update_display() { - LOG("%s\n", FUNCNAME); - for (int d = 1; d <= 8; d++) + LOG("%s\n", FUNCNAME); + for (int d = 0; d < 8; d++) + { + for (int y = 0; y < 7; y++) { - for (int y = 1; y <= 7; y++) - { - LOGDATA("- SDA5708 data: "); - for (int x = 1; x <= 5; x++) - { - machine().output().set_indexed_value("Dot_", d * 100 + y * 10 + x, (m_dispmem[(d - 1) * 7 + y] & (1 << (4 - (x - 1)))) == 0 ? 7 : m_bright ); - LOGDATA("%c", (m_dispmem[(d - 1) * 7 + (y - 1)] & (1 << (4 - (x - 1)))) == 0 ? '-' : 'x'); - } - LOGDATA("\n"); - } - LOGDATA("\n"); + LOGDATA("- SDA5708 data: "); + for (int x = 0; x < 5; x++) + { + bool const dot = !BIT(m_dispmem[(d * 7) + y], 4 - x); + m_dots[d][y][x] = dot ? 7 : m_bright; + LOGDATA("%c", dot ? '-' : 'x'); + } + LOGDATA("\n"); } + LOGDATA("\n"); + } } WRITE_LINE_MEMBER( sda5708_device::load_w ) @@ -178,11 +184,11 @@ WRITE_LINE_MEMBER( sda5708_device::load_w ) m_dispmem[m_digit * 7 + m_cdp] = m_serial; if (m_clear != 0) { - machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 1, (m_serial & 0x10) ? m_bright : 7 ); - machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 2, (m_serial & 0x08) ? m_bright : 7 ); - machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 3, (m_serial & 0x04) ? m_bright : 7 ); - machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 4, (m_serial & 0x02) ? m_bright : 7 ); - machine().output().set_indexed_value("Dot_", (m_digit + 1) * 100 + (m_cdp + 1) * 10 + 5, (m_serial & 0x01) ? m_bright : 7 ); + m_dots[m_digit][m_cdp][0] = BIT(m_serial, 4) ? m_bright : 7; + m_dots[m_digit][m_cdp][1] = BIT(m_serial, 3) ? m_bright : 7; + m_dots[m_digit][m_cdp][2] = BIT(m_serial, 2) ? m_bright : 7; + m_dots[m_digit][m_cdp][3] = BIT(m_serial, 1) ? m_bright : 7; + m_dots[m_digit][m_cdp][4] = BIT(m_serial, 0) ? m_bright : 7; } m_cdp = (m_cdp + 1) % 7; break; diff --git a/src/devices/video/sda5708.h b/src/devices/video/sda5708.h index d2c0e5a92b9..730ca7406a5 100644 --- a/src/devices/video/sda5708.h +++ b/src/devices/video/sda5708.h @@ -105,6 +105,7 @@ private: SDA5708_DATA_COMMAND = 0x00 }; + output_finder<8, 7, 5> m_dots; uint8_t m_serial; uint8_t m_load; uint8_t m_reset; diff --git a/src/mame/drivers/twinkle.cpp b/src/mame/drivers/twinkle.cpp index b653ca05d94..cb5fa5c04d1 100644 --- a/src/mame/drivers/twinkle.cpp +++ b/src/mame/drivers/twinkle.cpp @@ -252,19 +252,31 @@ Notes: class twinkle_state : public driver_device { public: - twinkle_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + twinkle_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_am53cf96(*this, "am53cf96"), m_ata(*this, "ata"), m_waveram(*this, "rfsnd"), + m_led_displays(*this, "led%u", 0U), + m_spotlights(*this, "spotlight%u", 0U), + m_main_leds(*this, "main_led%u", 0U), + m_key_leds(*this, "key%u-%u", 1U, 1U), + m_spu_leds(*this, "spu_led%u", 0U), m_spu_ata_dma(0), m_spu_ata_dmarq(0), m_wave_bank(0) { } + void twinklex(machine_config &config); + void twinklei(machine_config &config); + void twinkle(machine_config &config); + +protected: + virtual void machine_start() override; + DECLARE_WRITE8_MEMBER(twinkle_io_w); DECLARE_READ8_MEMBER(twinkle_io_r); DECLARE_WRITE16_MEMBER(twinkle_output_w); @@ -288,12 +300,10 @@ public: void scsi_dma_read( uint32_t *p_n_psxram, uint32_t n_address, int32_t n_size ); void scsi_dma_write( uint32_t *p_n_psxram, uint32_t n_address, int32_t n_size ); - void twinklex(machine_config &config); - void twinklei(machine_config &config); - void twinkle(machine_config &config); void main_map(address_map &map); void rf5c400_map(address_map &map); void sound_map(address_map &map); + private: required_device m_maincpu; required_device m_audiocpu; @@ -301,6 +311,12 @@ private: required_device m_ata; required_shared_ptr m_waveram; + output_finder<9> m_led_displays; + output_finder<8> m_spotlights; + output_finder<9> m_main_leds; + output_finder<2, 7> m_key_leds; + output_finder<8> m_spu_leds; + uint16_t m_spu_ctrl; // SPU board control register uint8_t m_spu_shared[0x400]; // SPU/PSX shared dual-ported RAM uint32_t m_spu_ata_dma; @@ -488,6 +504,35 @@ static const uint16_t asciicharset[]= 0, // }; +void twinkle_state::machine_start() +{ + m_led_displays.resolve(); + m_spotlights.resolve(); + m_main_leds.resolve(); + m_key_leds.resolve(); + m_spu_leds.resolve(); + + save_item(NAME(m_spu_ctrl)); + save_item(NAME(m_spu_shared)); + save_item(NAME(m_spu_ata_dma)); + save_item(NAME(m_spu_ata_dmarq)); + save_item(NAME(m_wave_bank)); + + save_item(NAME(m_io_offset)); + save_item(NAME(m_output_last)); + save_item(NAME(m_sector_buffer)); + + save_item(NAME(m_serial_shift)); + save_item(NAME(m_serial_bits)); + save_item(NAME(m_serial_cs)); + save_item(NAME(m_serial_clock)); + + save_item(NAME(m_output_shift)); + save_item(NAME(m_output_bits)); + save_item(NAME(m_output_cs)); + save_item(NAME(m_output_clock)); +} + WRITE8_MEMBER(twinkle_state::twinkle_io_w) { switch( offset ) @@ -534,18 +579,18 @@ WRITE8_MEMBER(twinkle_state::twinkle_io_w) case 0x6f: case 0x77: case 0x7f: - output().set_indexed_value( "led", ( m_io_offset - 0x3f ) / 8, asciicharset[ ( data ^ 0xff ) & 0x7f ] ); + m_led_displays[(m_io_offset - 0x3f) / 8] = asciicharset[(data ^ 0xff) & 0x7f]; break; case 0x87: - output().set_indexed_value( "spotlight", 0, ( ~data >> 3 ) & 1 ); - output().set_indexed_value( "spotlight", 1, ( ~data >> 2 ) & 1 ); - output().set_indexed_value( "spotlight", 2, ( ~data >> 1 ) & 1 ); - output().set_indexed_value( "spotlight", 3, ( ~data >> 0 ) & 1 ); - output().set_indexed_value( "spotlight", 4, ( ~data >> 4 ) & 1 ); - output().set_indexed_value( "spotlight", 5, ( ~data >> 5 ) & 1 ); - output().set_indexed_value( "spotlight", 6, ( ~data >> 6 ) & 1 ); - output().set_indexed_value( "spotlight", 7, ( ~data >> 7 ) & 1 ); + m_spotlights[0] = BIT(~data, 3); + m_spotlights[1] = BIT(~data, 2); + m_spotlights[2] = BIT(~data, 1); + m_spotlights[3] = BIT(~data, 0); + m_spotlights[4] = BIT(~data, 4); + m_spotlights[5] = BIT(~data, 5); + m_spotlights[6] = BIT(~data, 6); + m_spotlights[7] = BIT(~data, 7); break; case 0x8f: @@ -679,15 +724,15 @@ WRITE16_MEMBER(twinkle_state::twinkle_output_w) WRITE16_MEMBER(twinkle_state::led_w) { - output().set_indexed_value("main_led", 0, (~data >> 0) & 1); - output().set_indexed_value("main_led", 1, (~data >> 1) & 1); - output().set_indexed_value("main_led", 2, (~data >> 2) & 1); - output().set_indexed_value("main_led", 3, (~data >> 3) & 1); - output().set_indexed_value("main_led", 4, (~data >> 4) & 1); - output().set_indexed_value("main_led", 5, (~data >> 5) & 1); - output().set_indexed_value("main_led", 6, (~data >> 6) & 1); - output().set_indexed_value("main_led", 7, (~data >> 7) & 1); - output().set_indexed_value("main_led", 8, (~data >> 8) & 1); + m_main_leds[0] = BIT(~data, 0); + m_main_leds[1] = BIT(~data, 1); + m_main_leds[2] = BIT(~data, 2); + m_main_leds[3] = BIT(~data, 3); + m_main_leds[4] = BIT(~data, 4); + m_main_leds[5] = BIT(~data, 5); + m_main_leds[6] = BIT(~data, 6); + m_main_leds[7] = BIT(~data, 7); + m_main_leds[8] = BIT(~data, 8); if ((data & 0xfe00) != 0xfe00) { @@ -698,20 +743,20 @@ WRITE16_MEMBER(twinkle_state::led_w) WRITE16_MEMBER(twinkle_state::key_led_w) { // words are written using a byte write - output().set_indexed_value("key1-", 1, (data >> 0) & 1); - output().set_indexed_value("key1-", 2, (data >> 1) & 1); - output().set_indexed_value("key1-", 3, (data >> 2) & 1); - output().set_indexed_value("key1-", 4, (data >> 3) & 1); - output().set_indexed_value("key1-", 5, (data >> 4) & 1); - output().set_indexed_value("key1-", 6, (data >> 5) & 1); - output().set_indexed_value("key1-", 7, (data >> 6) & 1); - output().set_indexed_value("key2-", 1, (data >> 7) & 1); - output().set_indexed_value("key2-", 2, (data >> 8) & 1); - output().set_indexed_value("key2-", 3, (data >> 9) & 1); - output().set_indexed_value("key2-", 4, (data >> 10) & 1); - output().set_indexed_value("key2-", 5, (data >> 11) & 1); - output().set_indexed_value("key2-", 6, (data >> 12) & 1); - output().set_indexed_value("key2-", 7, (data >> 13) & 1); + m_key_leds[0][0] = BIT(data, 0); + m_key_leds[0][1] = BIT(data, 1); + m_key_leds[0][2] = BIT(data, 2); + m_key_leds[0][3] = BIT(data, 3); + m_key_leds[0][4] = BIT(data, 4); + m_key_leds[0][5] = BIT(data, 5); + m_key_leds[0][6] = BIT(data, 6); + m_key_leds[1][0] = BIT(data, 7); + m_key_leds[1][1] = BIT(data, 8); + m_key_leds[1][2] = BIT(data, 9); + m_key_leds[1][3] = BIT(data, 10); + m_key_leds[1][4] = BIT(data, 11); + m_key_leds[1][5] = BIT(data, 12); + m_key_leds[1][6] = BIT(data, 13); output().set_value("unknown3", (data >> 14) & 1); output().set_value("unknown4", (data >> 15) & 1); } @@ -908,14 +953,14 @@ WRITE16_MEMBER(twinkle_state::shared_68k_w) WRITE16_MEMBER(twinkle_state::spu_led_w) { // upper 8 bits are occassionally written as all zeros - output().set_indexed_value("spu_led", 0, (~data >> 0) & 1); - output().set_indexed_value("spu_led", 1, (~data >> 1) & 1); - output().set_indexed_value("spu_led", 2, (~data >> 2) & 1); - output().set_indexed_value("spu_led", 3, (~data >> 3) & 1); - output().set_indexed_value("spu_led", 4, (~data >> 4) & 1); - output().set_indexed_value("spu_led", 5, (~data >> 5) & 1); - output().set_indexed_value("spu_led", 6, (~data >> 6) & 1); - output().set_indexed_value("spu_led", 7, (~data >> 7) & 1); + m_spu_leds[0] = BIT(~data, 0); + m_spu_leds[1] = BIT(~data, 1); + m_spu_leds[2] = BIT(~data, 2); + m_spu_leds[3] = BIT(~data, 3); + m_spu_leds[4] = BIT(~data, 4); + m_spu_leds[5] = BIT(~data, 5); + m_spu_leds[6] = BIT(~data, 6); + m_spu_leds[7] = BIT(~data, 7); } ADDRESS_MAP_START(twinkle_state::sound_map)