diff --git a/src/mame/drivers/super80.cpp b/src/mame/drivers/super80.cpp index 0d6e58fa42a..bb6f6f5531b 100644 --- a/src/mame/drivers/super80.cpp +++ b/src/mame/drivers/super80.cpp @@ -685,6 +685,11 @@ WRITE8_MEMBER(super80_state::io_write_byte) prog_space.write_byte(offset, data); } +void super80_state::machine_start() +{ + m_cass_led.resolve(); +} + static SLOT_INTERFACE_START( super80_floppies ) SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) SLOT_INTERFACE_END diff --git a/src/mame/drivers/taitojc.cpp b/src/mame/drivers/taitojc.cpp index 72dfa509dc4..e9f8c5af2a4 100644 --- a/src/mame/drivers/taitojc.cpp +++ b/src/mame/drivers/taitojc.cpp @@ -655,8 +655,8 @@ WRITE8_MEMBER(taitojc_state::dendego_speedmeter_w) if (m_speed_meter != dendego_odometer_table[data]) { m_speed_meter = dendego_odometer_table[data]; - output().set_value("counter2", m_speed_meter / 10); - output().set_value("counter3", m_speed_meter % 10); + m_counters[2] = m_speed_meter / 10; + m_counters[3] = m_speed_meter % 10; } } @@ -665,7 +665,7 @@ WRITE8_MEMBER(taitojc_state::dendego_brakemeter_w) if (m_brake_meter != dendego_pressure_table[data]) { m_brake_meter = dendego_pressure_table[data]; - output().set_value("counter4", m_brake_meter); + m_counters[4] = m_brake_meter; } } @@ -734,7 +734,7 @@ WRITE8_MEMBER(taitojc_state::hc11_output_w) ? */ for (int i = 0; i < 8; i++) - output().set_lamp_value(i, data >> i & 1); + m_lamps[i] = BIT(data, i); m_mcu_output = data; } @@ -1071,6 +1071,9 @@ void taitojc_state::machine_start() save_item(NAME(m_speed_meter)); save_item(NAME(m_brake_meter)); + + m_lamps.resolve(); + m_counters.resolve(); } diff --git a/src/mame/drivers/tceptor.cpp b/src/mame/drivers/tceptor.cpp index 518e9c560e8..fdbdd63e1b5 100644 --- a/src/mame/drivers/tceptor.cpp +++ b/src/mame/drivers/tceptor.cpp @@ -306,6 +306,8 @@ void tceptor_state::machine_start() save_item(NAME(m_m6809_irq_enable)); save_item(NAME(m_m68k_irq_enable)); save_item(NAME(m_mcu_irq_enable)); + + m_shutter.resolve(); } diff --git a/src/mame/drivers/tehkanwc.cpp b/src/mame/drivers/tehkanwc.cpp index bcc0fe195db..336a4f32b09 100644 --- a/src/mame/drivers/tehkanwc.cpp +++ b/src/mame/drivers/tehkanwc.cpp @@ -108,6 +108,8 @@ void tehkanwc_state::machine_start() save_item(NAME(m_track1)); save_item(NAME(m_msm_data_offs)); save_item(NAME(m_toggle)); + + m_digits.resolve(); } WRITE8_MEMBER(tehkanwc_state::sub_cpu_halt_w) diff --git a/src/mame/includes/super80.h b/src/mame/includes/super80.h index 0d1bc59b364..cbeb5847b37 100644 --- a/src/mame/includes/super80.h +++ b/src/mame/includes/super80.h @@ -53,8 +53,11 @@ public: , m_fdc (*this, "fdc") , m_floppy0(*this, "fdc:0") , m_floppy1(*this, "fdc:1") + , m_cass_led(*this, "cass_led") { } + void machine_start() override; + DECLARE_READ8_MEMBER(super80v_low_r); DECLARE_READ8_MEMBER(super80v_high_r); DECLARE_WRITE8_MEMBER(super80v_low_w); @@ -143,6 +146,7 @@ private: optional_device m_fdc; optional_device m_floppy0; optional_device m_floppy1; + output_finder<> m_cass_led; }; #endif // MAME_INCLUDES_SUPER80_H diff --git a/src/mame/includes/taitojc.h b/src/mame/includes/taitojc.h index 986bfaef66a..40234a697bf 100644 --- a/src/mame/includes/taitojc.h +++ b/src/mame/includes/taitojc.h @@ -28,7 +28,9 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_analog_ports(*this, "AN.%u", 0), - m_tc0780fpa(*this, "tc0780fpa") + m_tc0780fpa(*this, "tc0780fpa"), + m_lamps(*this, "lamp%u", 0U), + m_counters(*this, "counter%u", 0U) { m_mcu_output = 0; m_speed_meter = 0; @@ -54,6 +56,9 @@ public: required_device m_tc0780fpa; + output_finder<8> m_lamps; + output_finder<5> m_counters; + uint32_t m_dsp_rom_pos; int m_first_dsp_reset; diff --git a/src/mame/includes/tceptor.h b/src/mame/includes/tceptor.h index 4a4d5098812..272f74ee083 100644 --- a/src/mame/includes/tceptor.h +++ b/src/mame/includes/tceptor.h @@ -21,7 +21,9 @@ public: m_c45_road(*this, "c45_road"), m_screen(*this, "screen"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_shutter(*this, "shutter") + { } uint8_t m_m6809_irq_enable; uint8_t m_m68k_irq_enable; @@ -73,6 +75,8 @@ public: required_device m_gfxdecode; required_device m_palette; + output_finder<> m_shutter; + TILE_GET_INFO_MEMBER(get_tx_tile_info); TILE_GET_INFO_MEMBER(get_bg1_tile_info); TILE_GET_INFO_MEMBER(get_bg2_tile_info); diff --git a/src/mame/includes/tehkanwc.h b/src/mame/includes/tehkanwc.h index 7d675176a38..6dac020fa7c 100644 --- a/src/mame/includes/tehkanwc.h +++ b/src/mame/includes/tehkanwc.h @@ -25,7 +25,9 @@ public: m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_videoram2(*this, "videoram2"), - m_spriteram(*this, "spriteram") { } + m_spriteram(*this, "spriteram"), + m_digits(*this, "digit%u", 0U) + { } required_device m_maincpu; required_device m_audiocpu; @@ -41,6 +43,8 @@ public: required_shared_ptr m_videoram2; required_shared_ptr m_spriteram; + output_finder<2> m_digits; + int m_track0[2]; int m_track1[2]; int m_msm_data_offs; diff --git a/src/mame/video/super80.cpp b/src/mame/video/super80.cpp index a1247705b67..9b4bd500bfa 100644 --- a/src/mame/video/super80.cpp +++ b/src/mame/video/super80.cpp @@ -66,14 +66,12 @@ WRITE_LINE_MEMBER(super80_state::screen_vblank_super80m) uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr=32,gfx,screen_on=0,fg=0,options=m_io_config->read(); - uint16_t sy=0,ma=m_vidpg,x; + m_cass_led = BIT(m_portf0, 5); - output().set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; + const uint8_t options = m_io_config->read(); + bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) @@ -82,14 +80,17 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 fg = 5; /* green */ } - for (y = 0; y < 16; y++) + uint16_t sy = 0; + uint16_t ma = m_vidpg; + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { uint16_t *p = &bitmap.pix16(sy++); - for (x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF + for (uint16_t x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF { + uint8_t chr = 32; if (screen_on) { chr = m_p_ram[ma | x] & 0x7f; @@ -100,7 +101,7 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; + const uint8_t gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? fg : 0; @@ -113,21 +114,19 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 *p++ = BIT(gfx, 0) ? fg : 0; } } - ma+=32; + ma += 32; } return 0; } uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr=32,gfx,screen_on=0,fg=0,options=m_io_config->read(); - uint16_t sy=0,ma=m_vidpg,x; + m_cass_led = BIT(m_portf0, 5); - output().set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; + const uint8_t options = m_io_config->read(); + bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) @@ -136,19 +135,22 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind fg = 5; /* green */ } - for (y = 0; y < 16; y++) + uint16_t sy = 0; + uint16_t ma = m_vidpg; + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { uint16_t *p = &bitmap.pix16(sy++); - for (x = 0; x < 32; x++) + for (uint16_t x = 0; x < 32; x++) { + uint8_t chr = 32; if (screen_on) chr = m_p_ram[ma | x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); + const uint8_t gfx = m_p_chargen[((chr & 0x7f)<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)] ^ ((chr & 0x80) ? 0xff : 0); /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? fg : 0; @@ -168,14 +170,13 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr=32,gfx,screen_on=0,fg=0,options=m_io_config->read(); - uint16_t sy=0,ma=m_vidpg,x; + m_cass_led = BIT(m_portf0, 5); - output().set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ + const uint8_t options = m_io_config->read(); + bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ screen_on++; + uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) @@ -184,19 +185,22 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind fg = 5; /* green */ } - for (y = 0; y < 16; y++) + uint16_t sy = 0; + uint16_t ma = m_vidpg; + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { uint16_t *p = &bitmap.pix16(sy++); - for (x = 0; x < 32; x++) + for (uint16_t x = 0; x < 32; x++) { + uint8_t chr = 32; if (screen_on) chr = m_p_ram[ma | x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; + const uint8_t gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? fg : 0; @@ -216,17 +220,16 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr=32,gfx,screen_on=0,col,bg=0,fg=0,options=m_io_config->read(); - uint16_t sy=0,ma=m_vidpg,x; + m_cass_led = BIT(m_portf0, 5); + + const uint8_t options = m_io_config->read(); /* get selected character generator */ - uint8_t cgen = m_current_charset ^ ((options & 0x10)>>4); /* bit 0 of port F1 and cgen config switch */ + const uint8_t cgen = m_current_charset ^ ((options & 0x10) >> 4); /* bit 0 of port F1 and cgen config switch */ - output().set_value("cass_led",BIT(m_portf0, 5)); - - if ((BIT(m_portf0, 2)) | (!BIT(options, 2))) /* bit 2 of port F0 is high, OR user turned on config switch */ - screen_on++; + const bool screen_on = BIT(m_portf0, 2) || !BIT(options, 2); /* bit 2 of port F0 is high, OR user turned on config switch */ + uint8_t fg = 0; if (screen_on) { if (BIT(options, 5)) @@ -235,25 +238,30 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind fg = 5; /* green */ } - for (y = 0; y < 16; y++) + uint16_t sy = 0; + uint16_t ma = m_vidpg; + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { uint16_t *p = &bitmap.pix16(sy++); - for (x = 0; x < 32; x++) + for (uint16_t x = 0; x < 32; x++) { + uint8_t chr = 32; if (screen_on) chr = m_p_ram[ma | x]; + uint8_t bg = 0; if (!(options & 0x40)) { - col = m_p_ram[0xfe00 | ma | x]; /* byte of colour to display */ + const uint8_t col = m_p_ram[0xfe00 | ma | x]; /* byte of colour to display */ fg = m_palette_index + (col & 0x0f); bg = m_palette_index + (col >> 4); } /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (cgen) gfx = m_p_chargen[(chr<<4) | ((ra & 8) >> 3) | ((ra & 7) << 1)]; else @@ -339,42 +347,49 @@ WRITE8_MEMBER( super80_state::super80v_high_w ) /* The 6845 can produce a variety of cursor shapes - all are emulated here - remove when mame fixed */ void super80_state::mc6845_cursor_configure() { - uint8_t i,curs_type=0,r9,r10,r11; - /* curs_type holds the general cursor shape to be created 0 = no cursor 1 = partial cursor (only shows on a block of scan lines) 2 = full cursor 3 = two-part cursor (has a part at the top and bottom with the middle blank) */ - for ( i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one + for (uint8_t i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) m_mc6845_cursor[i] = 0; // prepare cursor by erasing old one - r9 = m_mc6845_reg[9]; // number of scan lines - 1 - r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits - r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below + uint8_t r9 = m_mc6845_reg[9]; // number of scan lines - 1 + uint8_t r10 = m_mc6845_reg[10] & 0x1f; // cursor start line = last 5 bits + uint8_t r11 = m_mc6845_reg[11]+1; // cursor end line incremented to suit for-loops below /* decide the curs_type by examining the registers */ - if (r10 < r11) curs_type=1; // start less than end, show start to end + uint8_t curs_type = 0; + if (r10 < r11) + curs_type=1; // start less than end, show start to end + else if (r10 == r11) + curs_type=2; // if equal, show full cursor else - if (r10 == r11) curs_type=2; // if equal, show full cursor - else curs_type=3; // if start greater than end, it's a two-part cursor + curs_type=3; // if start greater than end, it's a two-part cursor if ((r11 - 1) > r9) curs_type=2; // if end greater than scan-lines, show full cursor if (r10 > r9) curs_type=0; // if start greater than scan-lines, then no cursor if (r11 > 16) r11=16; // truncate 5-bit register to fit our 4-bit hardware /* create the new cursor */ - if (curs_type > 1) for (i = 0;i < ARRAY_LENGTH(m_mc6845_cursor);i++) m_mc6845_cursor[i]=0xff; // turn on full cursor + if (curs_type > 1) + for (uint8_t i = 0; i < ARRAY_LENGTH(m_mc6845_cursor); i++) + m_mc6845_cursor[i] = 0xff; // turn on full cursor - if (curs_type == 1) for (i = r10;i < r11;i++) m_mc6845_cursor[i]=0xff; // for each line that should show, turn on that scan line + if (curs_type == 1) + for (uint8_t i = r10; i < r11; i++) + m_mc6845_cursor[i] = 0xff; // for each line that should show, turn on that scan line - if (curs_type == 3) for (i = r11; i < r10;i++) m_mc6845_cursor[i]=0; // now take a bite out of the middle + if (curs_type == 3) + for (uint8_t i = r11; i < r10; i++) + m_mc6845_cursor[i] = 0; // now take a bite out of the middle } uint32_t super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - m_s_options=m_io_config->read(); - output().set_value("cass_led",BIT(m_portf0, 5)); + m_s_options = m_io_config->read(); + m_cass_led = BIT(m_portf0, 5); m_crtc->screen_update(screen, bitmap, cliprect); return 0; } @@ -382,30 +397,30 @@ uint32_t super80_state::screen_update_super80v(screen_device &screen, bitmap_rgb MC6845_UPDATE_ROW( super80_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,col,gfx,fg,bg=0; - uint16_t mem,x; uint32_t *p = &bitmap.pix32(y); - for (x = 0; x < x_count; x++) // for each character + for (uint16_t x = 0; x < x_count; x++) // for each character { - uint8_t inv=0; + uint8_t inv = 0; // if (x == cursor_x) inv=0xff; /* uncomment when mame fixed */ - mem = (ma + x) & 0xfff; - chr = m_p_videoram[mem]; + const uint16_t mem = (ma + x) & 0xfff; + uint8_t chr = m_p_videoram[mem]; /* get colour or b&w */ - fg = 5; /* green */ - if ((m_s_options & 0x60) == 0x60) fg = 15; /* b&w */ + uint8_t fg = 5; /* green */ + if ((m_s_options & 0x60) == 0x60) + fg = 15; /* b&w */ + uint8_t bg = 0; if (~m_s_options & 0x40) { - col = m_p_colorram[mem]; /* byte of colour to display */ + const uint8_t col = m_p_colorram[mem]; /* byte of colour to display */ fg = m_palette_index + (col & 0x0f); bg = m_palette_index + (col >> 4); } /* if inverse mode, replace any pcgram chrs with inverse chrs */ - if ((!BIT(m_portf0, 4)) && (chr & 0x80)) // is it a high chr in inverse mode + if (!BIT(m_portf0, 4) && (chr & 0x80)) // is it a high chr in inverse mode { inv ^= 0xff; // invert the chr chr &= 0x7f; // and drop bit 7 @@ -416,7 +431,7 @@ MC6845_UPDATE_ROW( super80_state::crtc_update_row ) inv ^= m_mc6845_cursor[ra]; /* get pattern of pixels for that character scanline */ - gfx = m_p_ram[0xf000 | ((chr<<4) | ra)] ^ inv; + const uint8_t gfx = m_p_ram[0xf000 | ((chr << 4) | ra)] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7) ? fg : bg]; diff --git a/src/mame/video/taitojc.cpp b/src/mame/video/taitojc.cpp index 65dc07632ef..25f965eb542 100644 --- a/src/mame/video/taitojc.cpp +++ b/src/mame/video/taitojc.cpp @@ -355,15 +355,15 @@ uint32_t taitojc_state::screen_update_dendego(screen_device &screen, bitmap_ind1 for (level = 5; level > 0; level--) if (btn == dendego_mascon_table[level]) break; - if (level != output().get_value("counter0")) - output().set_value("counter0", level); + if (level != m_counters[0]) + m_counters[0] = level; btn = m_analog_ports[0]->read() & 0xff; for (level = 10; level > 0; level--) if (btn >= dendego_brake_table[level]) break; - if (level != output().get_value("counter1")) - output().set_value("counter1", level); + if (level != m_counters[1]) + m_counters[1] = level; return screen_update_taitojc(screen, bitmap, cliprect); } diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp index c627be26dee..8c7125f6b07 100644 --- a/src/mame/video/tceptor.cpp +++ b/src/mame/video/tceptor.cpp @@ -554,5 +554,5 @@ WRITE_LINE_MEMBER(tceptor_state::screen_vblank_tceptor) WRITE8_MEMBER(tceptor_state::tceptor2_shutter_w) { // 3D scope shutter control - output().set_value("shutter", data & 1); + m_shutter = BIT(data, 0); } diff --git a/src/mame/video/tehkanwc.cpp b/src/mame/video/tehkanwc.cpp index 9eaafd6bdf5..f80d2267828 100644 --- a/src/mame/video/tehkanwc.cpp +++ b/src/mame/video/tehkanwc.cpp @@ -121,12 +121,12 @@ void tehkanwc_state::video_start() bit 7 = enable (0 = display off) */ -void tehkanwc_state::gridiron_draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t led,int player) +void tehkanwc_state::gridiron_draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t led, int player) { - if (led&0x80) - output().set_digit_value(player, led&0x7f); - else - output().set_digit_value(player, 0x00); + if (led & 0x80) + m_digits[player] = led & 0x7f; + else + m_digits[player] = 0; } void tehkanwc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)