diff options
1070 files changed, 10093 insertions, 12268 deletions
diff --git a/src/devices/bus/a2bus/a2ultraterm.cpp b/src/devices/bus/a2bus/a2ultraterm.cpp index 7b6caa40624..e8d5972e4ec 100644 --- a/src/devices/bus/a2bus/a2ultraterm.cpp +++ b/src/devices/bus/a2bus/a2ultraterm.cpp @@ -304,11 +304,10 @@ void a2bus_videx160_device::write_c800(uint16_t offset, uint8_t data) MC6845_UPDATE_ROW( a2bus_videx160_device::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); uint8_t chr = m_ram[ offset ]; diff --git a/src/devices/bus/a2bus/a2videoterm.cpp b/src/devices/bus/a2bus/a2videoterm.cpp index b0fda659783..839fa19e74a 100644 --- a/src/devices/bus/a2bus/a2videoterm.cpp +++ b/src/devices/bus/a2bus/a2videoterm.cpp @@ -347,7 +347,7 @@ void a2bus_videx80_device::write_c800(uint16_t offset, uint8_t data) MC6845_UPDATE_ROW( a2bus_videx80_device::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; //( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; for (int i = 0; i < x_count; i++) diff --git a/src/devices/bus/acorn/system/vdu40.cpp b/src/devices/bus/acorn/system/vdu40.cpp index dcee8cd9b53..7bc8629ac35 100644 --- a/src/devices/bus/acorn/system/vdu40.cpp +++ b/src/devices/bus/acorn/system/vdu40.cpp @@ -93,7 +93,7 @@ void acorn_vdu40_device::device_reset() MC6845_UPDATE_ROW(acorn_vdu40_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); diff --git a/src/devices/bus/acorn/system/vdu80.cpp b/src/devices/bus/acorn/system/vdu80.cpp index 5cf995d8d3c..77bad0bf32c 100644 --- a/src/devices/bus/acorn/system/vdu80.cpp +++ b/src/devices/bus/acorn/system/vdu80.cpp @@ -172,7 +172,7 @@ void acorn_vdu80_device::device_reset() MC6845_UPDATE_ROW(acorn_vdu80_device::crtc_update_row) { uint8_t invert = BIT(m_links->read(), 1); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int column = 0; column < x_count; column++) { diff --git a/src/devices/bus/bbc/userport/lcd.cpp b/src/devices/bus/bbc/userport/lcd.cpp index cdc70bc35fe..f5f92270ca9 100644 --- a/src/devices/bus/bbc/userport/lcd.cpp +++ b/src/devices/bus/bbc/userport/lcd.cpp @@ -87,7 +87,7 @@ HD44780_PIXEL_UPDATE(bbc_lcd_device::lcd_pixel_update) } if (line < 4) - bitmap.pix16(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2; + bitmap.pix(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2; } } diff --git a/src/devices/bus/c64/xl80.cpp b/src/devices/bus/c64/xl80.cpp index 8f0f35b523f..6bfa6e9d8cd 100644 --- a/src/devices/bus/c64/xl80.cpp +++ b/src/devices/bus/c64/xl80.cpp @@ -85,12 +85,12 @@ const tiny_rom_entry *c64_xl80_device::device_rom_region() const MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int column = 0; column < x_count; column++) { - uint8_t code = m_ram[((ma + column) & 0x7ff)]; - uint16_t addr = (code << 3) | (ra & 0x07); + uint8_t const code = m_ram[((ma + column) & 0x7ff)]; + uint16_t const addr = (code << 3) | (ra & 0x07); uint8_t data = m_char_rom->base()[addr & 0x7ff]; if (column == cursor_x) @@ -100,10 +100,10 @@ MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; + int const x = (column * 8) + bit; + int const color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/devices/bus/centronics/epson_lx810l.cpp b/src/devices/bus/centronics/epson_lx810l.cpp index 1d9c0ac8577..2744ea3e3ac 100644 --- a/src/devices/bus/centronics/epson_lx810l.cpp +++ b/src/devices/bus/centronics/epson_lx810l.cpp @@ -575,9 +575,9 @@ WRITE_LINE_MEMBER( epson_lx810l_device::co0_w ) */ if (m_real_cr_pos < m_bitmap.width()) { for (int i = 0; i < 9; i++) { - unsigned int y = bitmap_line(i); + unsigned int const y = bitmap_line(i); if ((m_printhead & (1<<(8-i))) != 0) - m_bitmap.pix32(y, m_real_cr_pos + CR_OFFSET) = 0x000000; + m_bitmap.pix(y, m_real_cr_pos + CR_OFFSET) = 0x000000; } } } diff --git a/src/devices/bus/compis/hrg.cpp b/src/devices/bus/compis/hrg.cpp index 7aa8aa72f7e..1612729e706 100644 --- a/src/devices/bus/compis/hrg.cpp +++ b/src/devices/bus/compis/hrg.cpp @@ -51,11 +51,11 @@ void compis_uhrg_device::uhrg_map(address_map &map) UPD7220_DISPLAY_PIXELS_MEMBER( compis_hrg_device::display_pixels ) { - uint16_t i,gfx = m_video_ram[(address & 0x7fff) >> 1]; - const pen_t *pen = m_palette->pens(); + uint16_t const gfx = m_video_ram[(address & 0x7fff) >> 1]; + pen_t const *const pen = m_palette->pens(); - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; + for(uint16_t i=0; i<16; i++) + bitmap.pix(y, x + i) = pen[BIT(gfx, i)]; } @@ -65,11 +65,11 @@ UPD7220_DISPLAY_PIXELS_MEMBER( compis_hrg_device::display_pixels ) UPD7220_DISPLAY_PIXELS_MEMBER( compis_uhrg_device::display_pixels ) { - uint16_t i,gfx = m_video_ram[(address & 0x1ffff) >> 1]; - const pen_t *pen = m_palette->pens(); + uint16_t const gfx = m_video_ram[(address & 0x1ffff) >> 1]; + pen_t const *const pen = m_palette->pens(); - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; + for(uint16_t i=0; i<16; i++) + bitmap.pix(y, x + i) = pen[BIT(gfx, i)]; } diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp index ebf7e1f271e..192e5989a36 100644 --- a/src/devices/bus/comx35/clm.cpp +++ b/src/devices/bus/comx35/clm.cpp @@ -104,8 +104,8 @@ MC6845_UPDATE_ROW( comx_clm_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - uint8_t code = m_video_ram[((ma + column) & 0x7ff)]; - uint16_t addr = (code << 3) | (ra & 0x07); + uint8_t const code = m_video_ram[((ma + column) & 0x7ff)]; + uint16_t const addr = (code << 3) | (ra & 0x07); uint8_t data = m_char_rom->base()[addr & 0x7ff]; if (BIT(ra, 3) && column == cursor_x) @@ -115,9 +115,9 @@ MC6845_UPDATE_ROW( comx_clm_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de); data <<= 1; } diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp index 97a33298171..659bab524ad 100644 --- a/src/devices/bus/ecbbus/grip.cpp +++ b/src/devices/bus/ecbbus/grip.cpp @@ -179,35 +179,33 @@ MC6845_UPDATE_ROW( ecb_grip21_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - uint16_t address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); - uint8_t data = m_video_ram[address]; + uint16_t const address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); + uint8_t const data = m_video_ram[address]; for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = (m_flash ? 0 : BIT(data, bit)) && de; + int const x = (column * 8) + bit; + int const color = (m_flash ? 0 : BIT(data, bit)) && de; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(color); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(color); } } } /* MC6845_UPDATE_ROW( ecb_grip21_device::grip5_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int column, bit; - - for (column = 0; column < x_count; column++) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + for (int column = 0; column < x_count; column++) { - uint16_t address = (m_dpage << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); - uint8_t data = m_video_ram[address]; + uint16_t const address = (m_dpage << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); + uint8_t const data = m_video_ram[address]; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = m_flash ? 0 : BIT(data, bit); + int const x = (column * 8) + bit; + int const color = m_flash ? 0 : BIT(data, bit); - bitmap.pix32(y, x) = palette[color]; + bitmap.pix(y, x) = palette[color]; } } } diff --git a/src/devices/bus/einstein/pipe/tk02.cpp b/src/devices/bus/einstein/pipe/tk02.cpp index b0cf5998131..74cd880e151 100644 --- a/src/devices/bus/einstein/pipe/tk02.cpp +++ b/src/devices/bus/einstein/pipe/tk02.cpp @@ -185,14 +185,14 @@ MC6845_UPDATE_ROW( tk02_device::crtc_update_row ) if (i == cursor_x) data ^= 0xff; - bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, i * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, i * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, i * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, i * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, i * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, i * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, i * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, i * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/devices/bus/electron/mode7.cpp b/src/devices/bus/electron/mode7.cpp index 103c861c4ae..408b6a92300 100644 --- a/src/devices/bus/electron/mode7.cpp +++ b/src/devices/bus/electron/mode7.cpp @@ -195,7 +195,7 @@ void electron_mode7_device::expbus_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW(electron_mode7_device::crtc_update_row) { - uint32_t* p = &bitmap.pix32(y); + uint32_t* p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp index 1be643afddd..142947b4ae0 100644 --- a/src/devices/bus/gio64/newport.cpp +++ b/src/devices/bus/gio64/newport.cpp @@ -1302,7 +1302,7 @@ uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32 /* loop over rows and copy to the destination */ for (int y = cliprect.min_y, sy = y_start; y <= cliprect.max_y && sy < y_end; y++, sy++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); const uint32_t *src_rgbci = m_rb2->rgbci(y); const uint32_t *src_cidaux = m_rb2->cidaux(y); diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp index bd96c95852d..eb73c56c6f4 100644 --- a/src/devices/bus/hp_dio/hp98543.cpp +++ b/src/devices/bus/hp_dio/hp98543.cpp @@ -235,7 +235,7 @@ uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 & } for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { uint8_t tmp = m_vram[y * m_h_pix + x]; diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp index 842a7a78229..fe83f227ad9 100644 --- a/src/devices/bus/hp_dio/hp98544.cpp +++ b/src/devices/bus/hp_dio/hp98544.cpp @@ -165,25 +165,22 @@ WRITE_LINE_MEMBER(dio16_98544_device::int_w) uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int startx, starty, endx, endy; - - if (!m_topcat->has_changed()) return UPDATE_HAS_NOT_CHANGED; for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { uint8_t tmp = m_vram[y * m_h_pix + x]; *scanline++ = tmp ? rgb_t(255,255,255) : rgb_t(0, 0, 0); } } + int startx, starty, endx, endy; m_topcat->get_cursor_pos(startx, starty, endx, endy); for (int y = starty; y <= endy; y++) { - uint32_t *scanline = &bitmap.pix32(y); - memset(scanline + startx, 0xff, (endx - startx) << 2); + std::fill_n(&bitmap.pix(y, startx), endx - startx + 1, rgb_t(255,255,255)); } return 0; diff --git a/src/devices/bus/hp_dio/hp98550.cpp b/src/devices/bus/hp_dio/hp98550.cpp index 738926eae77..38f70d2d670 100644 --- a/src/devices/bus/hp_dio/hp98550.cpp +++ b/src/devices/bus/hp_dio/hp98550.cpp @@ -218,7 +218,7 @@ uint32_t dio32_98550_device::screen_update(screen_device &screen, bitmap_rgb32 & mask |= ce->plane_enabled(); for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { const int offset = y * m_fb_width +x; diff --git a/src/devices/bus/iq151/grafik.cpp b/src/devices/bus/iq151/grafik.cpp index 304bcf87b43..497012cf2cd 100644 --- a/src/devices/bus/iq151/grafik.cpp +++ b/src/devices/bus/iq151/grafik.cpp @@ -178,7 +178,7 @@ void iq151_grafik_device::video_update(bitmap_ind16 &bitmap, const rectangle &cl { for (int ra = 0; ra < 8; ra++) { - bitmap.pix16(y, x*8 + ra) |= BIT(m_videoram[(32*8 -1 - y)*64 + x], ra); + bitmap.pix(y, x*8 + ra) |= BIT(m_videoram[(32*8 -1 - y)*64 + x], ra); } } } diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp index d5bf2da1f8b..e0962048411 100644 --- a/src/devices/bus/iq151/minigraf.cpp +++ b/src/devices/bus/iq151/minigraf.cpp @@ -162,7 +162,7 @@ void iq151_minigraf_device::plotter_update(uint8_t control) // if pen is down draws a point if (m_pen) - m_paper->pix16(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; + m_paper->pix(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; m_control = control; } diff --git a/src/devices/bus/iq151/ms151a.cpp b/src/devices/bus/iq151/ms151a.cpp index 447c9f0d43a..651e82bfe6f 100644 --- a/src/devices/bus/iq151/ms151a.cpp +++ b/src/devices/bus/iq151/ms151a.cpp @@ -164,5 +164,5 @@ void iq151_ms151a_device::plotter_update(uint8_t offset, uint8_t data) // if pen is down draws a point if (m_pen) - m_paper->pix16(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; + m_paper->pix(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; } diff --git a/src/devices/bus/iq151/video32.cpp b/src/devices/bus/iq151/video32.cpp index fce21b963e9..2d3f75b66ed 100644 --- a/src/devices/bus/iq151/video32.cpp +++ b/src/devices/bus/iq151/video32.cpp @@ -126,7 +126,7 @@ void iq151_video32_device::video_update(bitmap_ind16 &bitmap, const rectangle &c { for (int ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (int x = ma; x < ma + 32; x++) { diff --git a/src/devices/bus/iq151/video64.cpp b/src/devices/bus/iq151/video64.cpp index a965abbd19e..487bf63ca33 100644 --- a/src/devices/bus/iq151/video64.cpp +++ b/src/devices/bus/iq151/video64.cpp @@ -140,7 +140,7 @@ void iq151_video64_device::video_update(bitmap_ind16 &bitmap, const rectangle &c { for (int ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (int x = ma; x < ma + 64; x++) { diff --git a/src/devices/bus/isa/aga.cpp b/src/devices/bus/isa/aga.cpp index 244fbc0bb66..81e6ba053fe 100644 --- a/src/devices/bus/isa/aga.cpp +++ b/src/devices/bus/isa/aga.cpp @@ -288,7 +288,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; if (y == 0) logerror("mda_text_inten_update_row\n"); @@ -345,7 +345,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; if (y == 0) logerror("mda_text_blink_update_row\n"); @@ -402,7 +402,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_inten_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -431,7 +431,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_inten_alt_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -459,7 +459,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { uint16_t const offset = ((ma + i) << 1) & 0x3fff; @@ -491,7 +491,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_blink_alt_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -526,7 +526,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_gfx_4bppl_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -551,7 +551,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_gfx_4bpph_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -584,7 +584,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); //if (y == 0) logerror("cga_gfx_2bpp_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -609,7 +609,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_1bpp_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint8_t const fg = m_cga_color_select & 0x0f; if (y == 0) logerror("cga_gfx_1bpp_update_row\n"); diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index ff30f3690ad..52a0407f065 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -469,47 +469,43 @@ isa8_cga_superimpose_device::isa8_cga_superimpose_device(const machine_config &m template<bool blink, bool si, bool comp, bool alt, int width> MC6845_UPDATE_ROW( isa8_cga_device::cga_text ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_text_8",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_text_8",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff; - uint8_t chr = videoram[ offset ]; - uint8_t attr = videoram[ offset +1 ]; - uint8_t data = m_chr_gen[ chr * width + ra ]; + uint16_t const offset = ((ma + i) << 1) & 0x3fff; + uint8_t const chr = videoram[offset]; + uint8_t const attr = videoram[offset +1]; + uint8_t data = m_chr_gen[chr * width + ra]; uint16_t fg, bg; - uint8_t xi; - if ( comp ) + if (comp) { - fg = 0x10 + ( attr & 0x0F ); - bg = alt ? 0 : ( 0x10 + ( ( attr >> 4 ) & 0x07 ) ); + fg = 0x10 + (attr & 0x0f); + bg = alt ? 0 : (0x10 + ((attr >> 4) & 0x07)); } else { fg = attr & 0x0F; - bg = alt ? 0 : ( ( attr >> 4 ) & ( blink ? 0x07 : 0x0f ) ); + bg = alt ? 0 : ((attr >> 4) & (blink ? 0x07 : 0x0f)); } - if ( ( i == cursor_x ) && ( m_framecnt & 0x08 ) ) - data = 0xFF; - else if ( blink && ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((i == cursor_x) && (m_framecnt & 0x08)) + data = 0xff; + else if (blink && (attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; - bg = ( attr >> 4 ) & 0x07; + bg = (attr >> 4) & 0x07; } - for(xi=0;xi<8;xi++) + for (int xi = 0; xi < 8; xi++) { - uint8_t pen_data, dot; - - dot = (data & (1 << (7-xi))); - pen_data = dot ? fg : bg; - if(!si || (pen_data || dot)) + uint8_t const dot = (data & (1 << (7 - xi))); + uint8_t const pen_data = dot ? fg : bg; + if (!si || (pen_data || dot)) *p = palette[pen_data]; p++; } @@ -521,28 +517,29 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_text ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bppl_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((y & 1) << 13); + uint8_t data; + + data = videoram[offset]; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; - data = videoram[ offset + 1 ]; + data = videoram[offset + 1]; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; } } @@ -580,37 +577,37 @@ static const uint8_t yc_lut[16][8] = MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bpph_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; - - if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((y & 1) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + + data = videoram[offset + 1]; + + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; } } @@ -623,28 +620,29 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bpph_update_row ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_2bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint8_t data; + + data = videoram[offset]; - *p = palette[m_palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ data & 0x03 ]]; p++; + *p++ = palette[m_palette_lut_2bpp[(data >> 6) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 4) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 2) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[ data & 0x03]]; - data = videoram[ offset+1 ]; + data = videoram[offset + 1]; - *p = palette[m_palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ data & 0x03 ]]; p++; + *p++ = palette[m_palette_lut_2bpp[(data >> 6) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 4) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 2) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[ data & 0x03]]; } } @@ -658,37 +656,38 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_2bpp_update_row ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_1bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0f; - if ( y == 0 ) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; + + data = videoram[offset + 1]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; } } @@ -961,205 +960,200 @@ void isa8_cga_device::io_write(offs_t offset, uint8_t data) // proc = cga_pgfx_4bpp; // -//static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, -// int x, int y, int offs) -//{ -// int color, values[2]; -// int i; -// -// if (cga.plantronics & 0x40) -// { -// values[0] = videoram[offs | 0x4000]; -// values[1] = videoram[offs]; -// } -// else -// { -// values[0] = videoram[offs]; -// values[1] = videoram[offs | 0x4000]; -// } -// for (i=3; i>=0; i--) -// { -// color = ((values[0] & 0x3) << 1) | -// ((values[1] & 2) >> 1) | -// ((values[1] & 1) << 3); -// bitmap.pix16(y, x+i) = Machine->pens[color]; -// values[0]>>=2; -// values[1]>>=2; -// } -//} -// -// -// +#if 0 +static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, int x, int y, int offs) +{ + int values[2]; + + if (cga.plantronics & 0x40) + { + values[0] = videoram[offs | 0x4000]; + values[1] = videoram[offs]; + } + else + { + values[0] = videoram[offs]; + values[1] = videoram[offs | 0x4000]; + } + for (int i = 3; i >= 0; i--) + { + int const color = + ((values[0] & 0x3) << 1) | + ((values[1] & 2) >> 1) | + ((values[1] & 1) << 3); + bitmap.pix(y, x + i) = Machine->pens[color]; + values[0] >>= 2; + values[1] >>= 2; + } +} +#endif + + ///*************************************************************************** // Draw graphics mode with 640x200 pixels (default) with 2 bits/pixel. // Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 // Second plane at CGA_base + 0x4000 / 0x6000 -//***************************************************************************/ -// -//static void cga_pgfx_4bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) -//{ -// int i, sx, sy, sh; -// int offs = mscrtc6845_get_start(crtc)*2; -// int lines = mscrtc6845_get_char_lines(crtc); -// int height = mscrtc6845_get_char_height(crtc); -// int columns = mscrtc6845_get_char_columns(crtc)*2; -// -// for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) -// { -// for (sh=0; sh<height; sh++, offs|=0x2000) -// { -// // char line 0 used as a12 line in graphic mode -// if (!(sh & 1)) -// { -// for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) -// { -// pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); -// } -// } -// else -// { -// for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) -// { -// pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); -// } -// } -// } -// } -//} -// -// -// -//static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, -// int x, int y, const uint16_t *palette, int offs) -//{ -// int i; -// uint8_t bmap[2], values[2]; -// uint16_t *dest; -// -// if (cga.plantronics & 0x40) -// { -// values[0] = videoram[offs]; -// values[1] = videoram[offs | 0x4000]; -// } -// else -// { -// values[0] = videoram[offs | 0x4000]; -// values[1] = videoram[offs]; -// } -// bmap[0] = bmap[1] = 0; -// for (i=3; i>=0; i--) -// { -// bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; -// bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; -// bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; -// bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; -// values[0] = values[0] << 1; -// values[1] = values[1] << 1; -// } -// -// dest = &bitmap.pix16(y, x); -// *(dest++) = palette[(bmap[0] >> 6) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 4) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 2) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 0) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 6) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 4) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 2) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 0) & 0x03]; -//} -// -// -// +//**************************************************************************** + +#if 0 +static void cga_pgfx_4bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) +{ + int offs = mscrtc6845_get_start(crtc) * 2; + int const lines = mscrtc6845_get_char_lines(crtc); + int const height = mscrtc6845_get_char_height(crtc); + int columns = mscrtc6845_get_char_columns(crtc) * 2; + + for (int sy = 0; sy < lines; sy++, offs = (offs + columns) & 0x1fff) + { + for (int sh = 0; sh < height; sh++, offs |= 0x2000) + { + // char line 0 used as a12 line in graphic mode + if (!(sh & 1)) + { + for (int i = offs, sx = 0; sx < columns; sx++, i = (i + 1) & 0x1fff) + { + pgfx_plot_unit_4bpp(bitmap, sx * 4, sy * height + sh, i); + } + } + else + { + for (int i = offs | 0x2000, sx = 0; sx < columns; sx++, i = ((i + 1) & 0x1fff) | 0x2000) + { + pgfx_plot_unit_4bpp(bitmap, sx * 4, sy * height + sh, i); + } + } + } + } +} +#endif + + +#if 0 +static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, int x, int y, const uint16_t *palette, int offs) +{ + uint8_t values[2]; + if (cga.plantronics & 0x40) + { + values[0] = videoram[offs]; + values[1] = videoram[offs | 0x4000]; + } + else + { + values[0] = videoram[offs | 0x4000]; + values[1] = videoram[offs]; + } + uint8_t bmap[2] = { 0, 0 }; + for (int i = 3; i >= 0; i--) + { + bmap[0] = (bmap[0] << 1) | BIT(values[0], 7); + bmap[0] = (bmap[0] << 1) | BIT(values[1], 7); + bmap[1] = (bmap[1] << 1) | BIT(values[0], 3); + bmap[1] = (bmap[1] << 1) | BIT(values[1], 3); + values[0] <<= 1; + values[1] <<= 1; + } + + uint16_t *dest = &bitmap.pix(y, x); + *dest++ = palette[(bmap[0] >> 6) & 0x03]; + *dest++ = palette[(bmap[0] >> 4) & 0x03]; + *dest++ = palette[(bmap[0] >> 2) & 0x03]; + *dest++ = palette[(bmap[0] >> 0) & 0x03]; + *dest++ = palette[(bmap[1] >> 6) & 0x03]; + *dest++ = palette[(bmap[1] >> 4) & 0x03]; + *dest++ = palette[(bmap[1] >> 2) & 0x03]; + *dest++ = palette[(bmap[1] >> 0) & 0x03]; +} +#endif + + ///*************************************************************************** // Draw graphics mode with 320x200 pixels (default) with 2 bits/pixel. // Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 // cga fetches 2 byte per mscrtc6845 access (not modeled here)! -//***************************************************************************/ -// -//static void cga_pgfx_2bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) -//{ -// int i, sx, sy, sh; -// int offs = mscrtc6845_get_start(crtc)*2; -// int lines = mscrtc6845_get_char_lines(crtc); -// int height = mscrtc6845_get_char_height(crtc); -// int columns = mscrtc6845_get_char_columns(crtc)*2; -// int colorset = cga.color_select & 0x3F; -// const uint16_t *palette; -// -// /* Most chipsets use bit 2 of the mode control register to -// * access a third palette. But not consistently. */ -// pc_cga_check_palette(); -// switch(CGA_CHIPSET) -// { -// /* The IBM Professional Graphics Controller behaves like -// * the PC1512, btw. */ -// case CGA_CHIPSET_PC1512: -// if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; -// break; -// -// case CGA_CHIPSET_IBM: -// case CGA_CHIPSET_PC200: -// case CGA_CHIPSET_ATI: -// case CGA_CHIPSET_PARADISE: -// if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; -// break; -// } -// -// -// /* The fact that our palette is located in cga_colortable is a vestigial -// * aspect from when we were doing that ugly trick where drawgfx() would -// * handle graphics drawing. Truthfully, we should probably be using -// * palette_set_color_rgb() here and not doing the palette lookup in the loop -// */ -// palette = &cga_colortable[256*2 + 16*2] + colorset * 4; -// -// for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) { -// -// for (sh=0; sh<height; sh++) -// { -// if (!(sh&1)) { // char line 0 used as a12 line in graphic mode -// for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) -// { -// pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); -// } -// } -// else -// { -// for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) -// { -// pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); -// } -// } -// } -// } -//} +//**************************************************************************** + +#if 0 +static void cga_pgfx_2bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) +{ + int offs = mscrtc6845_get_start(crtc) * 2; + int const lines = mscrtc6845_get_char_lines(crtc); + int const height = mscrtc6845_get_char_height(crtc); + int const columns = mscrtc6845_get_char_columns(crtc) * 2; + + /* Most chipsets use bit 2 of the mode control register to access a third palette. But not consistently. */ + int colorset = cga.color_select & 0x3f; + pc_cga_check_palette(); + switch (CGA_CHIPSET) + { + /* The IBM Professional Graphics Controller behaves like the PC1512, btw. */ + case CGA_CHIPSET_PC1512: + if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; + break; + + case CGA_CHIPSET_IBM: + case CGA_CHIPSET_PC200: + case CGA_CHIPSET_ATI: + case CGA_CHIPSET_PARADISE: + if (cga.mode_control & 4) colorset = (colorset & 0x1f) + 64; + break; + } + + /* The fact that our palette is located in cga_colortable is a vestigial + * aspect from when we were doing that ugly trick where drawgfx() would + * handle graphics drawing. Truthfully, we should probably be using + * palette_set_color_rgb() here and not doing the palette lookup in the loop + */ + uint16_t const *const palette = &cga_colortable[256*2 + 16*2] + colorset * 4; + + for (int sy = 0; sy < lines; sy++, offs = (offs + columns) & 0x1fff) + { + + for (int sh = 0; sh < height; sh++) + { + if (!(sh & 1)) // char line 0 used as a12 line in graphic mode + { + for (int i = offs, sx = 0; sx < columns; sx++, i = (i + 1) & 0x1fff) + { + pgfx_plot_unit_2bpp(bitmap, sx * 8, sy * height + sh, palette, i); + } + } + else + { + for (int i = offs | 0x2000, sx = 0; sx < columns; sx++, i= ((i + 1) & 0x1fff) | 0x2000) + { + pgfx_plot_unit_2bpp(bitmap, sx * 8, sy * height + sh, palette, i); + } + } + } + } +} +#endif MC6845_UPDATE_ROW( isa8_cga_pc1512_device::pc1512_gfx_4bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint16_t offset_base = ra << 13; - int j; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint16_t const offset_base = ra << 13; - if ( y == 0 ) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); - for ( j = 0; j < x_count; j++ ) + if (y == 0) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); + for (int j = 0; j < x_count; j++) { - uint16_t offset = offset_base | ( ( ma + j ) & 0x1FFF ); - uint16_t i = ( m_color_select & 8 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[3] | offset ] << 3 : 0; - uint16_t r = ( m_color_select & 4 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[2] | offset ] << 2 : 0; - uint16_t g = ( m_color_select & 2 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[1] | offset ] << 1 : 0; - uint16_t b = ( m_color_select & 1 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[0] | offset ] : 0; - - *p = palette[( ( i & 0x400 ) | ( r & 0x200 ) | ( g & 0x100 ) | ( b & 0x80 ) ) >> 7]; p++; - *p = palette[( ( i & 0x200 ) | ( r & 0x100 ) | ( g & 0x080 ) | ( b & 0x40 ) ) >> 6]; p++; - *p = palette[( ( i & 0x100 ) | ( r & 0x080 ) | ( g & 0x040 ) | ( b & 0x20 ) ) >> 5]; p++; - *p = palette[( ( i & 0x080 ) | ( r & 0x040 ) | ( g & 0x020 ) | ( b & 0x10 ) ) >> 4]; p++; - *p = palette[( ( i & 0x040 ) | ( r & 0x020 ) | ( g & 0x010 ) | ( b & 0x08 ) ) >> 3]; p++; - *p = palette[( ( i & 0x020 ) | ( r & 0x010 ) | ( g & 0x008 ) | ( b & 0x04 ) ) >> 2]; p++; - *p = palette[( ( i & 0x010 ) | ( r & 0x008 ) | ( g & 0x004 ) | ( b & 0x02 ) ) >> 1]; p++; - *p = palette[ ( i & 0x008 ) | ( r & 0x004 ) | ( g & 0x002 ) | ( b & 0x01 ) ]; p++; + uint16_t const offset = offset_base | ((ma + j) & 0x1fff); + uint16_t const i = (m_color_select & 8) ? videoram[isa8_cga_pc1512_device::vram_offset[3] | offset] << 3 : 0; + uint16_t const r = (m_color_select & 4) ? videoram[isa8_cga_pc1512_device::vram_offset[2] | offset] << 2 : 0; + uint16_t const g = (m_color_select & 2) ? videoram[isa8_cga_pc1512_device::vram_offset[1] | offset] << 1 : 0; + uint16_t const b = (m_color_select & 1) ? videoram[isa8_cga_pc1512_device::vram_offset[0] | offset] : 0; + + *p++ = palette[((i & 0x400) | (r & 0x200) | (g & 0x100) | (b & 0x80) ) >> 7]; + *p++ = palette[((i & 0x200) | (r & 0x100) | (g & 0x080) | (b & 0x40) ) >> 6]; + *p++ = palette[((i & 0x100) | (r & 0x080) | (g & 0x040) | (b & 0x20) ) >> 5]; + *p++ = palette[((i & 0x080) | (r & 0x040) | (g & 0x020) | (b & 0x10) ) >> 4]; + *p++ = palette[((i & 0x040) | (r & 0x020) | (g & 0x010) | (b & 0x08) ) >> 3]; + *p++ = palette[((i & 0x020) | (r & 0x010) | (g & 0x008) | (b & 0x04) ) >> 2]; + *p++ = palette[((i & 0x010) | (r & 0x008) | (g & 0x004) | (b & 0x02) ) >> 1]; + *p++ = palette[ (i & 0x008) | (r & 0x004) | (g & 0x002) | (b & 0x01) ]; } } @@ -1500,31 +1494,38 @@ void isa8_wyse700_device::device_reset() uint32_t isa8_wyse700_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - if (m_control & 0x08) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; + if (m_control & 0x08) + { + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0F; uint32_t addr = 0; - for (int y = 0; y < 800; y++) { - uint8_t *src = &m_vram[addr]; + for (int y = 0; y < 800; y++) + { + uint8_t const *src = &m_vram[addr]; - if (y & 1) { + if (y & 1) + { src += 0x10000; addr += 160; } - for (int x = 0; x < (1280 / 8); x++) { + for (int x = 0; x < (1280 / 8); x++) + { uint8_t val = src[x]; - for (int i = 0; i < 8; i++) { - bitmap.pix32(y,x*8+i) = (val & 0x80) ? palette[fg] : palette[0x00]; + for (int i = 0; i < 8; i++) + { + bitmap.pix(y, x * 8 + i) = (val & 0x80) ? palette[fg] : palette[0x00]; val <<= 1; } } } - } else { + return 0; + } + else + { return isa8_cga_device::screen_update(screen, bitmap, cliprect); } - return 0; } @@ -1837,7 +1838,7 @@ uint8_t isa8_cga_m24_device::io_read(offs_t offset) MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) { - if(m_mode2 & 1) + if (m_mode2 & 1) { m24_gfx_1bpp_m24_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); return; @@ -1847,7 +1848,7 @@ MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) return; y = m_y; - if(m_y >= bitmap.height()) + if (m_y >= bitmap.height()) return; switch (m_update_row_type) @@ -1885,37 +1886,38 @@ MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) MC6845_UPDATE_ROW( isa8_cga_m24_device::m24_gfx_1bpp_m24_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0f; - if ( y == 0 ) CGA_LOG(1,"m24_gfx_1bpp_m24_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"m24_gfx_1bpp_m24_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 3 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; + uint16_t const offset = (((ma + i) << 1 ) & 0x1fff) | ((ra & 3) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; + + data = videoram[offset + 1]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; } } diff --git a/src/devices/bus/isa/ega.cpp b/src/devices/bus/isa/ega.cpp index e3d75e4070a..45d169f3dff 100644 --- a/src/devices/bus/isa/ega.cpp +++ b/src/devices/bus/isa/ega.cpp @@ -783,7 +783,7 @@ WRITE_LINE_MEMBER( isa8_ega_device::vblank_changed ) CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_graphics ) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); LOG("%s: y = %d, x_count = %d, ma = %d, ra = %d\n", FUNCNAME, y, x_count, ma, ra ); @@ -844,12 +844,11 @@ CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_graphics ) CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_text ) { - uint16_t *p = &bitmap.pix16(y); - int i; + uint16_t *p = &bitmap.pix(y); LOG("%s: y = %d, x_count = %d, ma = %d, ra = %d\n", FUNCNAME, y, x_count, ma, ra ); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ma + i; uint8_t chr = m_plane[0][ offset ]; @@ -901,8 +900,6 @@ CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_text ) void isa8_ega_device::change_mode() { - int clock, pixels; - m_video_mode = 0; /* Check for graphics mode */ @@ -938,8 +935,8 @@ void isa8_ega_device::change_mode() } /* Check for changes to the crtc input clock and number of pixels per clock */ - clock = ( ( m_misc_output & 0x0c ) ? 16257000 : 14318181 ); - pixels = ( ( m_sequencer.data[0x01] & 0x01 ) ? 8 : 9 ); + int clock = ( ( m_misc_output & 0x0c ) ? 16257000 : 14318181 ); + int pixels = ( ( m_sequencer.data[0x01] & 0x01 ) ? 8 : 9 ); if ( m_sequencer.data[0x01] & 0x08 ) { diff --git a/src/devices/bus/isa/eis_hgb107x.cpp b/src/devices/bus/isa/eis_hgb107x.cpp index 32aeac02c3e..25b16a38fe3 100644 --- a/src/devices/bus/isa/eis_hgb107x.cpp +++ b/src/devices/bus/isa/eis_hgb107x.cpp @@ -420,10 +420,6 @@ inline int isa8_epc_mda_device::get_yres() MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; - // Get som debug data from a couple of rows now and then if ( y < (16 * 0 + 0x20) && (m_framecnt & 0xff) == 0 ) { @@ -436,7 +432,7 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { for (int i = 0; i < get_xres(); i++) { - bitmap.pix32(y, i) = rgb_t::black(); + bitmap.pix(y, i) = rgb_t::black(); } } @@ -449,14 +445,17 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) // Text modes using one of two 9x16 fonts in character rom else { + uint32_t *p = &bitmap.pix(y); + uint16_t chr_base = ra; + // Adjust row pointer if in monochrome text mode as we insert two scanlines per row of characters (see below) if (m_vmode & VM_MONO) { - p = &bitmap.pix32((y / 14) * 16 + y % 14); + p = &bitmap.pix((y / 14) * 16 + y % 14); } // Loop over each character in a row - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; uint8_t chr = m_videoram[ offset ]; @@ -555,14 +554,14 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { if (chr >= 0xb3 && chr <= 0xdf) // Handle the meta graphics characters { - bitmap.pix32(row + 1, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; - bitmap.pix32(row + 2, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; + bitmap.pix(row + 1, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; + bitmap.pix(row + 2, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; } else { // Handle underline - bitmap.pix32(row + 1, j + i * 9) =(*m_pal)[( attr & ATTR_FOREG ) == ATTR_ULINE ? fg : bg]; - bitmap.pix32(row + 2, j + i * 9) = (*m_pal)[bg]; + bitmap.pix(row + 1, j + i * 9) =(*m_pal)[( attr & ATTR_FOREG ) == ATTR_ULINE ? fg : bg]; + bitmap.pix(row + 2, j + i * 9) = (*m_pal)[bg]; } } } diff --git a/src/devices/bus/isa/ex1280.cpp b/src/devices/bus/isa/ex1280.cpp index 84c8bb8d269..2d9153616e9 100644 --- a/src/devices/bus/isa/ex1280.cpp +++ b/src/devices/bus/isa/ex1280.cpp @@ -144,15 +144,15 @@ void isa16_ex1280_device::vram_w(offs_t offset, uint16_t data, uint16_t mem_mask TMS340X0_SCANLINE_RGB32_CB_MEMBER(isa16_ex1280_device::scanline_update) { - uint16_t *src = &m_vram[params->rowaddr << 8]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_ramdac->pens(); + uint16_t const *const src = &m_vram[params->rowaddr << 8]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_ramdac->pens(); int coladdr = params->coladdr << 1; /* copy the non-blanked portions of this scanline */ for (int x = params->heblnk; x < params->hsblnk; x += 4) { - uint16_t pixels = src[coladdr++]; + uint16_t const pixels = src[coladdr++]; dest[x + 0] = pens[pixels & 0x0f]; dest[x + 1] = pens[(pixels >> 4) & 0x0f]; dest[x + 2] = pens[(pixels >> 8) & 0x0f]; diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index 602147aa060..e9f4ad8d197 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -180,11 +180,8 @@ uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma return 0; uint32_t src = (m_cursor_address & 0x000fffff) << 2; - uint32_t* dst; // destination pixel - uint8_t x,y,z; - uint32_t colour0; - uint32_t colour1; + uint32_t colour0, colour1; if(depth == 8) { colour0 = pen(m_cursor_colour0_b); @@ -197,18 +194,18 @@ uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma } // draw hardware pointer (64x64 max) - for(y=0;y<64;y++) + for(uint8_t y=0;y<64;y++) { - dst = &bitmap.pix32(m_cursor_vertical + y, m_cursor_horizontal); - for(x=0;x<64;x+=8) + uint32_t *dst = &bitmap.pix(m_cursor_vertical + y, m_cursor_horizontal); + for(uint8_t x=0;x<64;x+=8) { - uint16_t bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); + uint16_t const bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); - for(z=0;z<8;z++) + for(uint8_t z=0;z<8;z++) { if(((z + x) > (m_cursor_offset_horizontal-1)) && (y < (63 - m_cursor_offset_vertical))) { - uint8_t val = (bits >> (z*2)) & 0x03; + uint8_t const val = (bits >> (z*2)) & 0x03; switch(val) { case 0: // cursor colour 0 diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp index cf4a6aa3803..ae61e78e116 100644 --- a/src/devices/bus/isa/mda.cpp +++ b/src/devices/bus/isa/mda.cpp @@ -225,27 +225,26 @@ void isa8_mda_device::device_reset() ***************************************************************************/ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ chr_base + chr * 8 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[chr_base + chr * 8]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: bg = 2; @@ -255,36 +254,36 @@ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) bg = 2; fg = 1; break; - case 0xF0: + case 0xf0: bg = 3; fg = 0; break; - case 0xF8: + case 0xf8: bg = 3; fg = 1; break; } - if ( ( i == cursor_x && ( m_framecnt & 0x08 ) ) || ( attr & 0x07 ) == 0x01 ) + if ((i == cursor_x && (m_framecnt & 0x08)) || (attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - if ( ( chr & 0xE0 ) == 0xC0 ) + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; + if ((chr & 0xe0) == 0xc0) { - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x01) ? fg : bg]; } else { - *p = palette[bg]; p++; + *p++ = palette[bg]; } } } @@ -298,75 +297,74 @@ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) MC6845_UPDATE_ROW( isa8_mda_device::mda_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ chr_base + chr * 8 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[chr_base + chr * 8]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: - case 0xF0: + case 0xf0: bg = 2; fg = 0; break; case 0x78: - case 0xF8: + case 0xf8: bg = 2; fg = 1; break; } - if ( ( attr & 0x07 ) == 0x01 ) + if ((attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - if ( i == cursor_x ) + if (i == cursor_x) { - if ( m_framecnt & 0x08 ) + if (m_framecnt & 0x08) { - data = 0xFF; + data = 0xff; } } else { - if ( ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - if ( ( chr & 0xE0 ) == 0xC0 ) + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; + if ((chr & 0xe0) == 0xc0) { - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x01) ? fg : bg]; } else { - *p = palette[bg]; p++; + *p++ = palette[bg]; } } } @@ -631,34 +629,36 @@ void isa8_hercules_device::device_reset() MC6845_UPDATE_ROW( isa8_hercules_device::hercules_gfx_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t gfx_base = ( ( m_mode_control & 0x80 ) ? 0x8000 : 0x0000 ) | ( ( ra & 0x03 ) << 13 ); - int i; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const gfx_base = ((m_mode_control & 0x80) ? 0x8000 : 0x0000) | ((ra & 0x03) << 13); + + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint8_t data = m_videoram[ gfx_base + ( ( ma + i ) << 1 ) ]; - - *p = palette[( data & 0x80 ) ? 2 : 0]; p++; - *p = palette[( data & 0x40 ) ? 2 : 0]; p++; - *p = palette[( data & 0x20 ) ? 2 : 0]; p++; - *p = palette[( data & 0x10 ) ? 2 : 0]; p++; - *p = palette[( data & 0x08 ) ? 2 : 0]; p++; - *p = palette[( data & 0x04 ) ? 2 : 0]; p++; - *p = palette[( data & 0x02 ) ? 2 : 0]; p++; - *p = palette[( data & 0x01 ) ? 2 : 0]; p++; - - data = m_videoram[ gfx_base + ( ( ma + i ) << 1 ) + 1 ]; - - *p = palette[( data & 0x80 ) ? 2 : 0]; p++; - *p = palette[( data & 0x40 ) ? 2 : 0]; p++; - *p = palette[( data & 0x20 ) ? 2 : 0]; p++; - *p = palette[( data & 0x10 ) ? 2 : 0]; p++; - *p = palette[( data & 0x08 ) ? 2 : 0]; p++; - *p = palette[( data & 0x04 ) ? 2 : 0]; p++; - *p = palette[( data & 0x02 ) ? 2 : 0]; p++; - *p = palette[( data & 0x01 ) ? 2 : 0]; p++; + uint8_t data; + + data = m_videoram[gfx_base + ((ma + i) << 1)]; + + *p++ = palette[(data & 0x80) ? 2 : 0]; + *p++ = palette[(data & 0x40) ? 2 : 0]; + *p++ = palette[(data & 0x20) ? 2 : 0]; + *p++ = palette[(data & 0x10) ? 2 : 0]; + *p++ = palette[(data & 0x08) ? 2 : 0]; + *p++ = palette[(data & 0x04) ? 2 : 0]; + *p++ = palette[(data & 0x02) ? 2 : 0]; + *p++ = palette[(data & 0x01) ? 2 : 0]; + + data = m_videoram[gfx_base + ((ma + i) << 1) + 1]; + + *p++ = palette[(data & 0x80) ? 2 : 0]; + *p++ = palette[(data & 0x40) ? 2 : 0]; + *p++ = palette[(data & 0x20) ? 2 : 0]; + *p++ = palette[(data & 0x10) ? 2 : 0]; + *p++ = palette[(data & 0x08) ? 2 : 0]; + *p++ = palette[(data & 0x04) ? 2 : 0]; + *p++ = palette[(data & 0x02) ? 2 : 0]; + *p++ = palette[(data & 0x01) ? 2 : 0]; } } @@ -816,27 +816,26 @@ void isa8_ec1840_0002_device::device_reset() MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ (chr_base + chr * 16) << 1 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[(chr_base + chr * 16) << 1]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: bg = 2; @@ -846,29 +845,29 @@ MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) bg = 2; fg = 1; break; - case 0xF0: + case 0xf0: bg = 3; fg = 0; break; - case 0xF8: + case 0xf8: bg = 3; fg = 1; break; } - if ( ( i == cursor_x && ( m_framecnt & 0x08 ) ) || ( attr & 0x07 ) == 0x01 ) + if ((i == cursor_x && (m_framecnt & 0x08)) || (attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; } } @@ -880,68 +879,67 @@ MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ (chr_base + chr * 16) << 1 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[(chr_base + chr * 16) << 1]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: - case 0xF0: + case 0xf0: bg = 2; fg = 0; break; case 0x78: - case 0xF8: + case 0xf8: bg = 2; fg = 1; break; } - if ( ( attr & 0x07 ) == 0x01 ) + if ((attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - if ( i == cursor_x ) + if (i == cursor_x) { - if ( m_framecnt & 0x08 ) + if (m_framecnt & 0x08) { - data = 0xFF; + data = 0xff; } } else { - if ( ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; } } diff --git a/src/devices/bus/isa/num9rev.cpp b/src/devices/bus/isa/num9rev.cpp index 07a35ee073c..632eb8b544b 100644 --- a/src/devices/bus/isa/num9rev.cpp +++ b/src/devices/bus/isa/num9rev.cpp @@ -36,7 +36,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) color.set_r(pal->entry_color(m_ram[addr] | ((overlay & 0xf) << 8)).r()); color.set_g(pal->entry_color(m_ram[addr + 0x40000] | ((overlay & 0xf0) << 4)).g()); color.set_b(pal->entry_color(m_ram[addr + 0x80000] | (overlay & 0xf00)).b()); - bitmap.pix32(y, x + i) = color; + bitmap.pix(y, x + i) = color; } } else @@ -44,7 +44,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) if(((address << 3) + 16) > (1024*1024)) return; for(int i = 0; i < 16; i++) - bitmap.pix32(y, x + i) = pal->entry_color(m_ram[(address << 4) + i]); + bitmap.pix(y, x + i) = pal->entry_color(m_ram[(address << 4) + i]); } } diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp index 1366bc92dbc..f204333f9f2 100644 --- a/src/devices/bus/isa/pgc.cpp +++ b/src/devices/bus/isa/pgc.cpp @@ -401,14 +401,11 @@ uint8_t isa8_pgc_device::init_r() uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *p; - uint8_t *v; - for (int y = 0; y < PGC_DISP_VERT; y++) { // XXX address translation happens in hardware - v = &m_vram[y * 1024]; - p = &bitmap.pix16(y + PGC_VERT_START, PGC_HORZ_START); + uint8_t const *v = &m_vram[y * 1024]; + uint16_t *p = &bitmap.pix(y + PGC_VERT_START, PGC_HORZ_START); for (int x = 0; x < PGC_DISP_HORZ; x++) { diff --git a/src/devices/bus/isa/trident.cpp b/src/devices/bus/isa/trident.cpp index 0d64df5ba27..5fc2d2d6d19 100644 --- a/src/devices/bus/isa/trident.cpp +++ b/src/devices/bus/isa/trident.cpp @@ -212,29 +212,22 @@ void trident_vga_device::device_reset() uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t cur_mode; - svga_device::screen_update(screen,bitmap,cliprect); - cur_mode = pc_vga_choosevideomode(); + uint8_t const cur_mode = pc_vga_choosevideomode(); // draw hardware graphics cursor if(tri.cursor_ctrl & 0x80) // if cursor is enabled { - uint32_t src; - uint32_t* dst; - uint8_t val; - int x,y; - uint16_t cx = tri.cursor_x & 0x0fff; - uint16_t cy = tri.cursor_y & 0x0fff; - uint32_t bg_col; - uint32_t fg_col; - uint8_t cursor_size = (tri.cursor_ctrl & 0x01) ? 64 : 32; + uint16_t const cx = tri.cursor_x & 0x0fff; + uint16_t const cy = tri.cursor_y & 0x0fff; + uint8_t const cursor_size = (tri.cursor_ctrl & 0x01) ? 64 : 32; if(cur_mode == SCREEN_OFF || cur_mode == TEXT_MODE || cur_mode == MONO_MODE || cur_mode == CGA_MODE || cur_mode == EGA_MODE) return 0; // cursor only works in VGA or SVGA modes - src = tri.cursor_loc * 1024; // start address is in units of 1024 bytes + uint32_t src = tri.cursor_loc * 1024; // start address is in units of 1024 bytes + uint32_t bg_col, fg_col; if(cur_mode == RGB16_MODE) { bg_col = tri.cursor_bg; @@ -246,11 +239,11 @@ uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 & fg_col = pen(tri.cursor_fg & 0xff); } - for(y=0;y<cursor_size;y++) + for(int y=0;y<cursor_size;y++) { uint8_t bitcount = 31; - dst = &bitmap.pix32(cy + y, cx); - for(x=0;x<cursor_size;x++) + uint32_t *const dst = &bitmap.pix(cy + y, cx); + for(int x=0;x<cursor_size;x++) { uint32_t bitb = (vga.memory[(src+3) % vga.svga_intf.vram_size] | ((vga.memory[(src+2) % vga.svga_intf.vram_size]) << 8) @@ -260,7 +253,7 @@ uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 & | ((vga.memory[(src+6) % vga.svga_intf.vram_size]) << 8) | ((vga.memory[(src+5) % vga.svga_intf.vram_size]) << 16) | ((vga.memory[(src+4) % vga.svga_intf.vram_size]) << 24)); - val = (BIT(bita << 1,bitcount+1) << 1 | BIT(bitb,bitcount)); + uint8_t const val = (BIT(bita << 1,bitcount+1) << 1 | BIT(bitb,bitcount)); if(tri.cursor_ctrl & 0x40) { // X11 mode switch(val) diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp index 833d1d3820f..6d9dd93b4ed 100644 --- a/src/devices/bus/macpds/pds_tpdfpd.cpp +++ b/src/devices/bus/macpds/pds_tpdfpd.cpp @@ -154,27 +154,23 @@ void macpds_sedisplay_device::device_timer(emu_timer &timer, device_timer_id tid uint32_t macpds_sedisplay_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = m_vram.get(); - vram = m_vram.get(); - - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * (1024/8)) + (x^1)]; - - *scanline++ = m_palette[((pixels>>7)&0x1)^1]; - *scanline++ = m_palette[((pixels>>6)&0x1)^1]; - *scanline++ = m_palette[((pixels>>5)&0x1)^1]; - *scanline++ = m_palette[((pixels>>4)&0x1)^1]; - *scanline++ = m_palette[((pixels>>3)&0x1)^1]; - *scanline++ = m_palette[((pixels>>2)&0x1)^1]; - *scanline++ = m_palette[((pixels>>1)&0x1)^1]; - *scanline++ = m_palette[(pixels&1)^1]; + uint8_t const pixels = vram[(y * (1024/8)) + (x^1)]; + + *scanline++ = m_palette[BIT(~pixels, 7)]; + *scanline++ = m_palette[BIT(~pixels, 6)]; + *scanline++ = m_palette[BIT(~pixels, 5)]; + *scanline++ = m_palette[BIT(~pixels, 4)]; + *scanline++ = m_palette[BIT(~pixels, 3)]; + *scanline++ = m_palette[BIT(~pixels, 2)]; + *scanline++ = m_palette[BIT(~pixels, 1)]; + *scanline++ = m_palette[BIT(~pixels, 0)]; } } diff --git a/src/devices/bus/mtx/sdx.cpp b/src/devices/bus/mtx/sdx.cpp index e413e997f5b..09e7199ac53 100644 --- a/src/devices/bus/mtx/sdx.cpp +++ b/src/devices/bus/mtx/sdx.cpp @@ -417,7 +417,7 @@ MC6845_UPDATE_ROW(mtx_sdxcpm_device::crtc_update_row) int color = BIT(data, 7) ? fg : bg; - bitmap.pix32(y, x) = pen[de ? color : 0]; + bitmap.pix(y, x) = pen[de ? color : 0]; data <<= 1; } diff --git a/src/devices/bus/nasbus/avc.cpp b/src/devices/bus/nasbus/avc.cpp index f7bc8e95596..f4590b2ac3f 100644 --- a/src/devices/bus/nasbus/avc.cpp +++ b/src/devices/bus/nasbus/avc.cpp @@ -120,7 +120,7 @@ MC6845_UPDATE_ROW( nascom_avc_device::crtc_update_row ) } // plot the pixel - bitmap.pix32(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); + bitmap.pix(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); } } diff --git a/src/devices/bus/nubus/laserview.cpp b/src/devices/bus/nubus/laserview.cpp index 2c58b6e8dc3..7e802b58988 100644 --- a/src/devices/bus/nubus/laserview.cpp +++ b/src/devices/bus/nubus/laserview.cpp @@ -117,30 +117,26 @@ void nubus_laserview_device::device_reset() uint32_t nubus_laserview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - if (!m_vbl_disable) { raise_slot_irq(); } - for (y = 0; y < 600; y++) + for (int y = 0; y < 600; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 832/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 832/8; x++) { - pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index 9105414f3e0..b9b831c6de2 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -12,6 +12,9 @@ #include "nubus_48gc.h" #include "screen.h" +#include <algorithm> + + #define VRAM_SIZE (0x200000) // 2 megs, maxed out #define GC48_SCREEN_NAME "48gc_screen" @@ -152,10 +155,7 @@ void jmfb_device::device_timer(emu_timer &timer, device_timer_id tid, int param, uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline, *base; - int x, y; - uint8_t *vram8 = &m_vram[0]; - uint8_t pixels; + uint8_t const *const vram8 = &m_vram[0xa00]; // first time? kick off the VBL timer if (!m_screen) @@ -164,37 +164,35 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, m_timer->adjust(m_screen->time_until_pos(479, 0), 0); } - vram8 += 0xa00; - switch (m_mode) { case 0: // 1bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < m_xres/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/8; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < m_xres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/4; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>6)&0x3]; *scanline++ = m_palette[(pixels>>4)&0x3]; @@ -205,13 +203,12 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, break; case 2: // 4 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < m_xres/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/2; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)&0xf]; *scanline++ = m_palette[pixels&0xf]; @@ -220,27 +217,22 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, break; case 3: // 8 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < m_xres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } break; case 4: // 24 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - base = (uint32_t *)&m_vram[y * m_stride]; - for (x = 0; x < m_xres; x++) - { - *scanline++ = *base++; - } + uint32_t const *base = (uint32_t *)&m_vram[y * m_stride]; + std::copy_n(base, m_xres, &bitmap.pix(y)); } break; } diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp index db964ec2055..db1fd821a11 100644 --- a/src/devices/bus/nubus/nubus_cb264.cpp +++ b/src/devices/bus/nubus/nubus_cb264.cpp @@ -17,6 +17,9 @@ #include "nubus_cb264.h" #include "screen.h" +#include <algorithm> + + #define CB264_SCREEN_NAME "cb264_screen" #define CB264_ROM_REGION "cb264_rom" @@ -122,10 +125,6 @@ void nubus_cb264_device::device_reset() uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline, *base; - int x, y; - uint8_t pixels; - if (!m_cb264_vbl_disable) { raise_slot_irq(); @@ -134,12 +133,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & switch (m_cb264_mode) { case 0: // 1 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0x80]; *scanline++ = m_palette[(pixels<<1)&0x80]; @@ -154,12 +153,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 1: // 2 bpp (3f/7f/bf/ff) - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xc0]; *scanline++ = m_palette[(pixels<<2)&0xc0]; @@ -170,13 +169,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xf0]; *scanline++ = m_palette[(pixels<<4)&0xf0]; @@ -185,13 +183,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -200,16 +197,11 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & case 4: // 24 bpp case 7: // ??? { - uint32_t *vram32 = (uint32_t *)&m_vram[0]; + uint32_t const *const vram32 = (uint32_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp index 851537685d2..e913c0cb0cb 100644 --- a/src/devices/bus/nubus/nubus_m2hires.cpp +++ b/src/devices/bus/nubus/nubus_m2hires.cpp @@ -137,41 +137,37 @@ void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x20]; + uint8_t const *const vram = &m_vram[0x20]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -182,13 +178,13 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640/2; x++) + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels&0xf0)>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -197,13 +193,13 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640; x++) + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp index f557d7631b0..60728d7dd15 100644 --- a/src/devices/bus/nubus/nubus_m2video.cpp +++ b/src/devices/bus/nubus/nubus_m2video.cpp @@ -139,21 +139,17 @@ void nubus_m2video_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x20]; + uint8_t const *const vram = &m_vram[0x20]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -168,12 +164,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -184,13 +180,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -199,13 +194,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp index f6d152be059..89518f0d223 100644 --- a/src/devices/bus/nubus/nubus_radiustpd.cpp +++ b/src/devices/bus/nubus/nubus_radiustpd.cpp @@ -139,27 +139,23 @@ void nubus_radiustpd_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_radiustpd_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = &m_vram[0x200]; - vram = &m_vram[0x200]; - - for (y = 0; y < 880; y++) + for (int y = 0; y < 880; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp index b7a29b6f537..6ca1f9f4489 100644 --- a/src/devices/bus/nubus/nubus_spec8.cpp +++ b/src/devices/bus/nubus/nubus_spec8.cpp @@ -144,21 +144,17 @@ void nubus_spec8s3_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x400]; + uint8_t const *const vram = &m_vram[0x400]; switch (m_mode) { case 0: // 1 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/8; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0x80]; *scanline++ = m_palette[(pixels<<1)&0x80]; @@ -173,12 +169,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/4; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xc0]; *scanline++ = m_palette[(pixels<<2)&0xc0]; @@ -189,13 +185,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1024/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xf0]; *scanline++ = m_palette[(pixels<<4)&0xf0]; @@ -204,13 +199,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1024; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp index 891defaa336..c00938c6102 100644 --- a/src/devices/bus/nubus/nubus_specpdq.cpp +++ b/src/devices/bus/nubus/nubus_specpdq.cpp @@ -157,22 +157,18 @@ void nubus_specpdq_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - // first time? kick off the VBL timer - vram = &m_vram[0x9000]; + uint8_t const *const vram = &m_vram[0x9000]; switch (m_mode) { case 0: // 1 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0x80)]; *scanline++ = m_palette_val[((pixels<<1)&0x80)]; @@ -187,12 +183,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/4; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0xc0)]; *scanline++ = m_palette_val[((pixels<<2)&0xc0)]; @@ -203,13 +199,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0xf0)]; *scanline++ = m_palette_val[((pixels<<4)&0xf0)]; @@ -218,13 +213,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x++) { - pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_vikbw.cpp b/src/devices/bus/nubus/nubus_vikbw.cpp index 1c25795cd45..18c94f9ba5b 100644 --- a/src/devices/bus/nubus/nubus_vikbw.cpp +++ b/src/devices/bus/nubus/nubus_vikbw.cpp @@ -117,30 +117,26 @@ void nubus_vikbw_device::device_reset() uint32_t nubus_vikbw_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - if (!m_vbl_disable) { raise_slot_irq(); } - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/8; x++) { - pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp index 2f56488bf48..9894e0d7906 100644 --- a/src/devices/bus/nubus/nubus_wsportrait.cpp +++ b/src/devices/bus/nubus/nubus_wsportrait.cpp @@ -137,42 +137,38 @@ void nubus_wsportrait_device::device_timer(emu_timer &timer, device_timer_id tid uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - // first time? kick off the VBL timer - vram = &m_vram[0x80]; + uint8_t const *const vram = &m_vram[0x80]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -183,13 +179,12 @@ uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rg break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels&0xf0)>>4)]; *scanline++ = m_palette[(pixels&0xf)]; diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp index 2fe4687fc44..dde2348abc6 100644 --- a/src/devices/bus/nubus/pds30_30hr.cpp +++ b/src/devices/bus/nubus/pds30_30hr.cpp @@ -139,41 +139,37 @@ void nubus_xceed30hr_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[1024]; + uint8_t const *const vram = &m_vram[1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -184,13 +180,12 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -199,13 +194,12 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp index aa0ca1df648..388aa5f54d5 100644 --- a/src/devices/bus/nubus/pds30_cb264.cpp +++ b/src/devices/bus/nubus/pds30_cb264.cpp @@ -10,6 +10,9 @@ #include "pds30_cb264.h" #include "screen.h" +#include <algorithm> + + #define CB264SE30_SCREEN_NAME "cb264_screen" #define CB264SE30_ROM_REGION "cb264_rom" @@ -133,21 +136,17 @@ void nubus_cb264se30_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[8*1024]; + uint8_t const *const vram = &m_vram[8*1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -162,12 +161,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -178,13 +177,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -193,13 +191,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -207,17 +204,11 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 24 bpp { - uint32_t *vram32 = (uint32_t *)&m_vram[0]; - uint32_t *base; + uint32_t const *const vram32 = (uint32_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp index 20969a5a6b7..87992723319 100644 --- a/src/devices/bus/nubus/pds30_mc30.cpp +++ b/src/devices/bus/nubus/pds30_mc30.cpp @@ -13,6 +13,9 @@ #include "pds30_mc30.h" #include "screen.h" +#include <algorithm> + + #define XCEEDMC30_SCREEN_NAME "x30hr_screen" #define XCEEDMC30_ROM_REGION "x30hr_rom" @@ -135,41 +138,37 @@ void nubus_xceedmc30_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[4*1024]; + uint8_t const *const vram = &m_vram[4*1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -180,13 +179,13 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640/2; x++) + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -195,13 +194,13 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640; x++) + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -209,17 +208,11 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 24 bpp { - uint32_t *vram32 = (uint32_t *)vram; - uint32_t *base; + uint32_t const *const vram32 = (uint32_t *)vram; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp index b251a57c33c..83fd8512704 100644 --- a/src/devices/bus/nubus/pds30_procolor816.cpp +++ b/src/devices/bus/nubus/pds30_procolor816.cpp @@ -139,21 +139,17 @@ void nubus_procolor816_device::device_timer(emu_timer &timer, device_timer_id ti uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[4]; + uint8_t const *const vram = &m_vram[4]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -168,12 +164,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -184,13 +180,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -199,13 +194,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -213,16 +207,15 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r case 4: // 15 bpp { - uint16_t *vram16 = (uint16_t *)&m_vram[0]; - uint16_t pixels; + uint16_t const *const vram16 = (uint16_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram16[(y * 640) + (x^1)]; - *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); + uint16_t const pixels = vram16[(y * 640) + BYTE_XOR_BE(x)]; + *scanline++ = rgb_t(pal5bit((pixels>>10) & 0x1f), pal5bit((pixels>>5) & 0x1f), pal5bit(pixels & 0x1f)); } } } diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp index c509b908064..e04e4b2e297 100644 --- a/src/devices/bus/nubus/pds30_sigmalview.cpp +++ b/src/devices/bus/nubus/pds30_sigmalview.cpp @@ -132,18 +132,14 @@ void nubus_lview_device::device_timer(emu_timer &timer, device_timer_id tid, int uint32_t nubus_lview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = &m_vram[0x20]; - vram = &m_vram[0x20]; - - for (y = 0; y < 600; y++) + for (int y = 0; y < 600; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 832/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 832/8; x++) { - pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; diff --git a/src/devices/bus/s100/dg640.cpp b/src/devices/bus/s100/dg640.cpp index 7f79983f17d..f6adb27cfa8 100644 --- a/src/devices/bus/s100/dg640.cpp +++ b/src/devices/bus/s100/dg640.cpp @@ -39,28 +39,26 @@ void dg640_device::device_start() uint32_t dg640_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // attributes bit 0 = flash, bit 1 = lores. Also bit 7 of the character = reverse-video (text only). - uint8_t y,ra,chr,gfx,attr,inv,gfxbit; - uint16_t sy=0,ma=0,x; - bool flash; + uint16_t sy=0,ma=0; m_framecnt++; - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - attr = m_p_attribram[x]; - chr = m_p_videoram[x]; - flash = BIT(m_framecnt, 4) & BIT(attr, 0); + uint8_t attr = m_p_attribram[x]; + uint8_t chr = m_p_videoram[x]; + bool flash = BIT(m_framecnt, 4) & BIT(attr, 0); if (BIT(attr, 1)) // lores gfx - can flash { if (flash) chr = 0; // blank part of flashing - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c) >> 1; /* Display one line of a lores character (8 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -74,11 +72,11 @@ uint32_t dg640_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else { - gfx = 0; + uint8_t gfx = 0; if (!flash) { - inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed + uint8_t inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed chr &= 0x7f; gfx = inv; diff --git a/src/devices/bus/s100/polyvti.cpp b/src/devices/bus/s100/polyvti.cpp index 973e89c0693..242d13a8fe2 100644 --- a/src/devices/bus/s100/polyvti.cpp +++ b/src/devices/bus/s100/polyvti.cpp @@ -119,22 +119,22 @@ u32 poly_vti_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { u8 r = b/5; if (l==0 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; if (l==0 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; if (l==1 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; if (l==1 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; if (l==2 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; if (l==2 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; } } } @@ -156,11 +156,11 @@ u32 poly_vti_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, } for (int b = 0; b < 7; b++) - bitmap.pix16(y*15+j, xpos+b ) = (l >> (6-b)) & 1; + bitmap.pix(y*15+j, xpos+b ) = (l >> (6-b)) & 1; - bitmap.pix16(y*15+j, xpos+7 ) = 0; - bitmap.pix16(y*15+j, xpos+8 ) = 0; - bitmap.pix16(y*15+j, xpos+9 ) = 0; + bitmap.pix(y*15+j, xpos+7 ) = 0; + bitmap.pix(y*15+j, xpos+8 ) = 0; + bitmap.pix(y*15+j, xpos+9 ) = 0; } } xpos += 10; diff --git a/src/devices/bus/sbus/bwtwo.cpp b/src/devices/bus/sbus/bwtwo.cpp index 55d9f92b7b6..c034d43e05f 100644 --- a/src/devices/bus/sbus/bwtwo.cpp +++ b/src/devices/bus/sbus/bwtwo.cpp @@ -10,6 +10,9 @@ #include "bwtwo.h" #include "screen.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SBUS_BWTWO, sbus_bwtwo_device, "bwtwo", "Sun bwtwo SBus Video") void sbus_bwtwo_device::mem_map(address_map &map) @@ -72,14 +75,14 @@ void sbus_bwtwo_device::install_device() uint32_t sbus_bwtwo_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *line = &m_vram[0]; + uint8_t const *line = &m_vram[0]; for (int y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 1152/8; x++) { - memcpy(scanline, m_mono_lut[*line], sizeof(uint32_t) * 8); + std::copy_n(m_mono_lut[*line], 8, scanline); line++; scanline += 8; } diff --git a/src/devices/bus/sbus/cgsix.cpp b/src/devices/bus/sbus/cgsix.cpp index 5d7bd715efd..65a24e1b505 100644 --- a/src/devices/bus/sbus/cgsix.cpp +++ b/src/devices/bus/sbus/cgsix.cpp @@ -171,12 +171,12 @@ void sbus_cgsix_device::device_reset() uint32_t sbus_cgsix_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_ramdac->pens(); - uint8_t *vram = (uint8_t *)&m_vram[0]; + pen_t const *const pens = m_ramdac->pens(); + uint8_t const *const vram = (uint8_t *)&m_vram[0]; for (int16_t y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); const bool cursor_row_hit = (y >= m_cursor_y && y < (m_cursor_y + 32)); for (int16_t x = 0; x < 1152; x++) { diff --git a/src/devices/bus/sbus/cgthree.cpp b/src/devices/bus/sbus/cgthree.cpp index 5ffe6a885c5..ad0ba5c1467 100644 --- a/src/devices/bus/sbus/cgthree.cpp +++ b/src/devices/bus/sbus/cgthree.cpp @@ -67,12 +67,12 @@ void sbus_cgthree_device::install_device() uint32_t sbus_cgthree_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_ramdac->pens(); - uint8_t *vram = (uint8_t *)&m_vram[0]; + pen_t const *const pens = m_ramdac->pens(); + uint8_t const *const vram = (uint8_t *)&m_vram[0]; for (int y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 1152; x++) { const uint8_t pixel = vram[y * 1152 + BYTE4_XOR_BE(x)]; diff --git a/src/devices/bus/svi3x8/slot/sv806.cpp b/src/devices/bus/svi3x8/slot/sv806.cpp index bc4dafbd415..5a7d858d38b 100644 --- a/src/devices/bus/svi3x8/slot/sv806.cpp +++ b/src/devices/bus/svi3x8/slot/sv806.cpp @@ -94,7 +94,7 @@ void sv806_device::device_start() MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -103,14 +103,14 @@ MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) if (i == cursor_x) data = 0xff; - bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, i * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, i * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, i * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, i * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, i * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, i * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, i * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, i * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/devices/bus/tanbus/mpvdu.cpp b/src/devices/bus/tanbus/mpvdu.cpp index e9f4fe766eb..28cd0b988f9 100644 --- a/src/devices/bus/tanbus/mpvdu.cpp +++ b/src/devices/bus/tanbus/mpvdu.cpp @@ -149,7 +149,7 @@ uint8_t tanbus_mpvdu_device::videoram_r(offs_t offset) MC6845_UPDATE_ROW(tanbus_mpvdu_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); @@ -165,11 +165,11 @@ MC6845_UPDATE_ROW(tanbus_mpvdu_device::crtc_update_row) m_trom->tr6_w(1); m_trom->tr6_w(0); - int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + int const col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; + int const r = BIT(col, 0) * 0xff; + int const g = BIT(col, 1) * 0xff; + int const b = BIT(col, 2) * 0xff; *p++ = rgb_t(r, g, b); } diff --git a/src/devices/bus/tanbus/ravdu.cpp b/src/devices/bus/tanbus/ravdu.cpp index 80664797081..b93b1a41c35 100644 --- a/src/devices/bus/tanbus/ravdu.cpp +++ b/src/devices/bus/tanbus/ravdu.cpp @@ -161,7 +161,7 @@ uint8_t tanbus_ravdu_device::videoram_r(offs_t offset) MC6845_UPDATE_ROW(tanbus_ravdu_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); @@ -178,11 +178,11 @@ MC6845_UPDATE_ROW(tanbus_ravdu_device::crtc_update_row) m_trom->tr6_w(1); m_trom->tr6_w(0); - int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + int const col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; + int const r = BIT(col, 0) * 0xff; + int const g = BIT(col, 1) * 0xff; + int const b = BIT(col, 2) * 0xff; *p++ = rgb_t(r, g, b); } diff --git a/src/devices/bus/tanbus/tanhrg.cpp b/src/devices/bus/tanbus/tanhrg.cpp index 1c8ffc87ab5..b857e84ac69 100644 --- a/src/devices/bus/tanbus/tanhrg.cpp +++ b/src/devices/bus/tanbus/tanhrg.cpp @@ -323,16 +323,13 @@ void tanbus_tanhrgc_device::set_inhibit_lines(offs_t offset, int &inhram, int &i uint32_t tanbus_tanhrg_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t offset; - uint32_t *p; - for (int y = 0; y < 256; y++) { - p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int x = 0; x < 256; x++) { - offset = (y * 32) + (x / 8); + uint16_t const offset = (y * 32) + (x / 8); *p++ = m_palette->pen_color(BIT(m_videoram[offset], x & 7)); } @@ -344,21 +341,17 @@ uint32_t tanbus_tanhrg_device::screen_update(screen_device &screen, bitmap_rgb32 uint32_t tanbus_tanhrgc_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t r, g, b; - uint16_t offset; - uint32_t *p; - for (int y = 0; y < 256; y++) { - p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int x = 0; x < 256; x++) { - offset = (y * 32) + (x / 8); + uint16_t const offset = (y * 32) + (x / 8); - r = m_videoram[0x0000 | offset]; - b = m_videoram[0x2000 | offset]; - g = m_videoram[0x4000 | offset]; + uint8_t const r = m_videoram[0x0000 | offset]; + uint8_t const b = m_videoram[0x2000 | offset]; + uint8_t const g = m_videoram[0x4000 | offset]; *p++ = m_palette->pen_color(BIT(b, x & 7) << 2 | BIT(g, x & 7) << 1 | BIT(r, x & 7)); } diff --git a/src/devices/bus/tanbus/tug8082.cpp b/src/devices/bus/tanbus/tug8082.cpp index 1e4ad1a4504..582ab726c8e 100644 --- a/src/devices/bus/tanbus/tug8082.cpp +++ b/src/devices/bus/tanbus/tug8082.cpp @@ -241,18 +241,14 @@ WRITE_LINE_MEMBER(tanbus_tug8082_device::vdu_irq_w) uint32_t tanbus_tug8082_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; + pen_t const *const pen = m_palette->pens(); - const pen_t *pen = m_palette->pens(); - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 64; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 64; x++) { - pixels = m_videoram[(y * 64) + x]; + uint8_t const pixels = m_videoram[(y * 64) + x]; for (int i = 0; i < 8; ++i) *scanline++ = pen[BIT(pixels, 7 - i)]; diff --git a/src/devices/bus/ti99/internal/992board.cpp b/src/devices/bus/ti99/internal/992board.cpp index 031f82d7fe5..2f01c025cb6 100644 --- a/src/devices/bus/ti99/internal/992board.cpp +++ b/src/devices/bus/ti99/internal/992board.cpp @@ -202,7 +202,7 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par } int vpos = raw_vpos * m_vertical_size / screen().height(); - uint32_t *p = &m_tmpbmp.pix32(vpos); + uint32_t *p = &m_tmpbmp.pix(vpos); bool endofline = false; int linelength = 0; diff --git a/src/devices/bus/vic20/videopak.cpp b/src/devices/bus/vic20/videopak.cpp index 187224721be..1f2b3c35431 100644 --- a/src/devices/bus/vic20/videopak.cpp +++ b/src/devices/bus/vic20/videopak.cpp @@ -77,7 +77,7 @@ MC6845_UPDATE_ROW( vic20_video_pak_device::crtc_update_row ) int x = (column * 8) + bit; int color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/devices/bus/wangpc/lvc.cpp b/src/devices/bus/wangpc/lvc.cpp index 4d31a7b9367..1fd3c0610d4 100644 --- a/src/devices/bus/wangpc/lvc.cpp +++ b/src/devices/bus/wangpc/lvc.cpp @@ -62,17 +62,17 @@ MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - offs_t addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f)); + offs_t const addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f)); uint16_t data = m_video_ram[addr & 0x7fff]; for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; int color = (BIT(data, 15) << 1) | BIT(data, 7); if (column == cursor_x) color = 0x03; - bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); + bitmap.pix(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); data <<= 1; } @@ -89,12 +89,12 @@ MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; int color = (BIT(data, 31) << 3) | (BIT(data, 23) << 2) | (BIT(data, 15) << 1) | BIT(data, 7); if (column == cursor_x) color = 0x03; - bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); + bitmap.pix(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); data <<= 1; } diff --git a/src/devices/bus/wangpc/mvc.cpp b/src/devices/bus/wangpc/mvc.cpp index 562e277f982..cff515a05c1 100644 --- a/src/devices/bus/wangpc/mvc.cpp +++ b/src/devices/bus/wangpc/mvc.cpp @@ -73,15 +73,15 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) { for (int sx = 0; sx < 50; sx++) { - offs_t addr = (y * 50) + sx; + offs_t const addr = (y * 50) + sx; uint16_t data = m_bitmap_ram[addr]; for (int bit = 0; bit < 16; bit++) { - int x = (sx * 16) + bit; - int color = BIT(data, 15) && de; + int const x = (sx * 16) + bit; + int const color = BIT(data, 15) && de; - bitmap.pix32(vbp + y, hbp + x) = PALETTE_MVC[color]; + bitmap.pix(vbp + y, hbp + x) = PALETTE_MVC[color]; data <<= 1; } @@ -89,8 +89,8 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) for (int column = 0; column < x_count; column++) { - uint16_t code = m_video_ram[((ma + column) & 0x7ff)]; - uint8_t attr = code & 0xff; + uint16_t const code = m_video_ram[((ma + column) & 0x7ff)]; + uint8_t const attr = code & 0xff; uint8_t new_ra = ra + 1; @@ -103,7 +103,7 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) new_ra = ra; } - offs_t addr = ((code >> 8) << 4) | (new_ra & 0x0f); + offs_t const addr = ((code >> 8) << 4) | (new_ra & 0x0f); uint16_t data = m_char_ram[addr & 0xfff]; if ((column == cursor_x) || (!ra && ATTR_OVERSCORE) || ((ra == 9) && ATTR_UNDERSCORE)) @@ -113,11 +113,13 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) for (int bit = 0; bit < 10; bit++) { - int x = (column * 10) + bit; + int const x = (column * 10) + bit; int color = ((BIT(data, 9) & ~ATTR_BLANK) ^ ATTR_REVERSE); - if ((color | bitmap.pix32(vbp + y, hbp + x)) & ATTR_BOLD) color = 2; - if (color) bitmap.pix32(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black(); + if ((color | bitmap.pix(vbp + y, hbp + x)) & ATTR_BOLD) + color = 2; + if (color) + bitmap.pix(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black(); data <<= 1; } diff --git a/src/devices/cpu/e0c6200/e0c6s46.cpp b/src/devices/cpu/e0c6200/e0c6s46.cpp index 9f80774a6e5..5094c36a5f7 100644 --- a/src/devices/cpu/e0c6200/e0c6s46.cpp +++ b/src/devices/cpu/e0c6200/e0c6s46.cpp @@ -589,7 +589,7 @@ u32 e0c6s46_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!m_pixel_update_cb.isnull()) m_pixel_update_cb(bitmap, cliprect, m_lcd_contrast, seg, com, pixel); else if (cliprect.contains(seg, com)) - bitmap.pix16(com, seg) = pixel; + bitmap.pix(com, seg) = pixel; } } } diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index d5fd882a484..ab820fc1599 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -1178,7 +1178,7 @@ uint32_t tms340x0_device::tms340x0_ind16(screen_device &screen, bitmap_ind16 &bi params.heblnk = params.hsblnk = cliprect.max_x + 1; /* blank out the blank regions */ - uint16_t *dest = &bitmap.pix16(cliprect.min_y); + uint16_t *dest = &bitmap.pix(cliprect.min_y); for (x = cliprect.min_x; x < params.heblnk; x++) dest[x] = blackpen; for (x = params.hsblnk; x <= cliprect.max_x; x++) @@ -1209,7 +1209,7 @@ uint32_t tms340x0_device::tms340x0_rgb32(screen_device &screen, bitmap_rgb32 &bi params.heblnk = params.hsblnk = cliprect.max_x + 1; /* blank out the blank regions */ - uint32_t *dest = &bitmap.pix32(cliprect.min_y); + uint32_t *dest = &bitmap.pix(cliprect.min_y); for (x = cliprect.min_x; x < params.heblnk; x++) dest[x] = blackpen; for (x = params.hsblnk; x <= cliprect.max_x; x++) diff --git a/src/devices/cpu/vt50/vt50.cpp b/src/devices/cpu/vt50/vt50.cpp index 961dca5aa2c..7a964c4be5b 100644 --- a/src/devices/cpu/vt50/vt50.cpp +++ b/src/devices/cpu/vt50/vt50.cpp @@ -284,7 +284,7 @@ void vt5x_cpu_device::draw_char_line() if (xc > screen().visible_area().right() - 8) return; - u32 *pix = &m_bitmap.pix32(m_current_line, xc); + u32 *pix = &m_bitmap.pix(m_current_line, xc); if (m_video_process && m_cursor_ff && m_cursor_active) std::fill_n(pix, 9, rgb_t::white()); else if (!m_video_process || m_cursor_ff) diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp index 36733555e7d..f0ebf10f612 100644 --- a/src/devices/machine/acorn_vidc.cpp +++ b/src/devices/machine/acorn_vidc.cpp @@ -492,9 +492,9 @@ void acorn_vidc10_device::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (is_cursor == true && dot == 0) continue; dot += pen_base; - bitmap.pix32(dsty, dstx+xi) = this->pen(dot); + bitmap.pix(dsty, dstx+xi) = this->pen(dot); if (m_crtc_interlace) - bitmap.pix32(dsty+1, dstx+xi) = this->pen(dot); + bitmap.pix(dsty+1, dstx+xi) = this->pen(dot); } } } diff --git a/src/devices/machine/exorterm.cpp b/src/devices/machine/exorterm.cpp index 0b62597e3f1..9db3f0658e4 100644 --- a/src/devices/machine/exorterm.cpp +++ b/src/devices/machine/exorterm.cpp @@ -348,7 +348,7 @@ u32 exorterm155_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma u16 sy = 0, ma = 0; u8 disable_fac = m_disable_fac->read() == 0; u8 display_fac = m_display_fac->read() == 0; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); m_framecnt++; @@ -356,7 +356,7 @@ u32 exorterm155_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma { for (u8 ra = 0; ra < 12; ra++) { - u32 *p = &bitmap.pix32(sy++); + u32 *p = &bitmap.pix(sy++); // FAC codes are cleared on horizontal sync. u8 underline1 = 0; u8 underline2 = 0; diff --git a/src/devices/machine/ie15.cpp b/src/devices/machine/ie15.cpp index 3cdb35af145..eba7ace6fa7 100644 --- a/src/devices/machine/ie15.cpp +++ b/src/devices/machine/ie15.cpp @@ -637,7 +637,8 @@ void ie15_device::scanline_callback() uint32_t ie15_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { update_leds(); - memcpy(&bitmap.pix32(0), &m_tmpbmp[0], sizeof(uint32_t) * IE15_TOTAL_HORZ * IE15_TOTAL_VERT); + for (int y = 0; y < IE15_TOTAL_VERT; y++) + std::copy_n(&m_tmpbmp[y * IE15_TOTAL_HORZ], IE15_TOTAL_HORZ, &bitmap.pix(y)); return 0; } diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index ef3df359859..c376c62977c 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -712,10 +712,10 @@ void laserdisc_device::init_video() fillbitmap_yuy16(frame.m_bitmap, 40, 109, 240); // make a copy of the bitmap that clips out the VBI and horizontal blanking areas - frame.m_visbitmap.wrap(&frame.m_bitmap.pix16(44, frame.m_bitmap.width() * 8 / 720), - frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, - frame.m_bitmap.height() - 44, - frame.m_bitmap.rowpixels()); + frame.m_visbitmap.wrap(&frame.m_bitmap.pix( + 44, frame.m_bitmap.width() * 8 / 720), + frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, frame.m_bitmap.height() - 44, + frame.m_bitmap.rowpixels()); frame.m_visbitmap.set_palette(m_videopalette); } @@ -789,7 +789,7 @@ void laserdisc_device::fillbitmap_yuy16(bitmap_yuy16 &bitmap, uint8_t yval, uint // write 32 bits of color (2 pixels at a time) for (int y = 0; y < bitmap.height(); y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); for (int x = 0; x < bitmap.width() / 2; x++) { *dest++ = color0; @@ -918,7 +918,8 @@ void laserdisc_device::read_track_data() frame->m_lastfield = m_curtrack * 2 + m_fieldnum; // set the video target information - m_avhuff_config.video.wrap(&frame->m_bitmap.pix16(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2); + m_avhuff_video.wrap(&frame->m_bitmap.pix(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2); + m_avhuff_config.video = &m_avhuff_video; // set the audio target information if (m_audiobufin + m_audiomaxsamples <= m_audiobufsize) @@ -995,13 +996,13 @@ void laserdisc_device::process_track_data() // remove the video if we had an error if (m_readresult != CHDERR_NONE) - m_avhuff_config.video.reset(); + m_avhuff_video.reset(); // count the field as read if we are successful - if (m_avhuff_config.video.valid()) + if (m_avhuff_video.valid()) { m_frame[m_videoindex].m_numfields++; - player_overlay(m_avhuff_config.video); + player_overlay(m_avhuff_video); } // pass the audio to the callback diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h index 8ca3abad222..9e80d43df52 100644 --- a/src/devices/machine/laserdsc.h +++ b/src/devices/machine/laserdsc.h @@ -277,28 +277,29 @@ private: std::vector<uint8_t> m_vbidata; // pointer to precomputed VBI data int m_width; // width of video int m_height; // height of video - uint32_t m_fps_times_1million; // frame rate of video + uint32_t m_fps_times_1million; // frame rate of video int m_samplerate; // audio samplerate int m_readresult; // result of the most recent read - uint32_t m_chdtracks; // number of tracks in the CHD - avhuff_decompress_config m_avhuff_config; // decompression configuration + uint32_t m_chdtracks; // number of tracks in the CHD + bitmap_yuy16 m_avhuff_video; // decompresed frame buffer + avhuff_decoder::config m_avhuff_config; // decompression configuration // async operations osd_work_queue * m_work_queue; // work queue - uint32_t m_queued_hunknum; // queued hunk + uint32_t m_queued_hunknum; // queued hunk // core states - uint8_t m_audiosquelch; // audio squelch state: bit 0 = audio 1, bit 1 = audio 2 - uint8_t m_videosquelch; // video squelch state: bit 0 = on/off - uint8_t m_fieldnum; // field number (0 or 1) - int32_t m_curtrack; // current track at this end of this vsync - uint32_t m_maxtrack; // maximum track number + uint8_t m_audiosquelch; // audio squelch state: bit 0 = audio 1, bit 1 = audio 2 + uint8_t m_videosquelch; // video squelch state: bit 0 = on/off + uint8_t m_fieldnum; // field number (0 or 1) + int32_t m_curtrack; // current track at this end of this vsync + uint32_t m_maxtrack; // maximum track number attoseconds_t m_attospertrack; // attoseconds per track, or 0 if not moving attotime m_sliderupdate; // time of last slider update // video data frame_data m_frame[3]; // circular list of frames - uint8_t m_videoindex; // index of the current video buffer + uint8_t m_videoindex; // index of the current video buffer bitmap_yuy16 m_emptyframe; // blank frame // audio data diff --git a/src/devices/machine/ldpr8210.cpp b/src/devices/machine/ldpr8210.cpp index fc94159ff6a..64392ed0c90 100644 --- a/src/devices/machine/ldpr8210.cpp +++ b/src/devices/machine/ldpr8210.cpp @@ -784,12 +784,12 @@ void pioneer_pr8210_device::overlay_draw_group(bitmap_yuy16 &bitmap, const uint8 void pioneer_pr8210_device::overlay_erase(bitmap_yuy16 &bitmap, float xstart, float xend) { - uint32_t xmin = (uint32_t)(xstart * 256.0f * float(bitmap.width())); - uint32_t xmax = (uint32_t)(xend * 256.0f * float(bitmap.width())); + uint32_t xmin = uint32_t(xstart * 256.0f * float(bitmap.width())); + uint32_t xmax = uint32_t(xend * 256.0f * float(bitmap.width())); for (uint32_t y = OVERLAY_Y; y < (OVERLAY_Y + (OVERLAY_Y_PIXELS + 2) * OVERLAY_PIXEL_HEIGHT); y++) { - uint16_t *dest = &bitmap.pix16(y, xmin >> 8); + uint16_t *dest = &bitmap.pix(y, xmin >> 8); uint16_t ymax = *dest >> 8; uint16_t ymin = ymax * 3 / 8; uint16_t yres = ymin + ((ymax - ymin) * (xmin & 0xff)) / 256; @@ -819,8 +819,8 @@ void pioneer_pr8210_device::overlay_erase(bitmap_yuy16 &bitmap, float xstart, fl void pioneer_pr8210_device::overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, float xstart) { - uint32_t xminbase = (uint32_t)(xstart * 256.0f * float(bitmap.width())); - uint32_t xsize = (uint32_t)(OVERLAY_PIXEL_WIDTH * 256.0f * float(bitmap.width())); + uint32_t xminbase = uint32_t(xstart * 256.0f * float(bitmap.width())); + uint32_t xsize = uint32_t(OVERLAY_PIXEL_WIDTH * 256.0f * float(bitmap.width())); // iterate over pixels const uint8_t *chdataptr = &text_bitmap[ch & 0x3f][0]; @@ -835,7 +835,7 @@ void pioneer_pr8210_device::overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, uint32_t xmax = xmin + xsize; for (uint32_t yy = 0; yy < OVERLAY_PIXEL_HEIGHT; yy++) { - uint16_t *dest = &bitmap.pix16(OVERLAY_Y + (y + 1) * OVERLAY_PIXEL_HEIGHT + yy, xmin >> 8); + uint16_t *dest = &bitmap.pix(OVERLAY_Y + (y + 1) * OVERLAY_PIXEL_HEIGHT + yy, xmin >> 8); uint16_t ymax = 0xff; uint16_t ymin = *dest >> 8; uint16_t yres = ymin + ((ymax - ymin) * (~xmin & 0xff)) / 256; diff --git a/src/devices/machine/mc68328.cpp b/src/devices/machine/mc68328.cpp index 3df500d2f0c..e3690287710 100644 --- a/src/devices/machine/mc68328.cpp +++ b/src/devices/machine/mc68328.cpp @@ -3044,20 +3044,17 @@ uint16_t mc68328_device::internal_read(offs_t offset, uint16_t mem_mask) uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { uint32_t vram_addr = m_regs.lssa & 0x00fffffe; - uint16_t word; - uint16_t *line; - int y, x, b; if (m_regs.lckcon & LCKCON_LCDC_EN) { - for (y = 0; y < 160; y++) + for (int y = 0; y < 160; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 160; x += 16, vram_addr += 2) + for (int x = 0; x < 160; x += 16, vram_addr += 2) { - word = space(AS_PROGRAM).read_word(vram_addr); - for (b = 0; b < 16; b++) + uint16_t const word = space(AS_PROGRAM).read_word(vram_addr); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -3066,11 +3063,11 @@ uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitm } else { - for (y = 0; y < 160; y++) + for (int y = 0; y < 160; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 160; x++) + for (int x = 0; x < 160; x++) { line[x] = 0; } diff --git a/src/devices/machine/pxa255.cpp b/src/devices/machine/pxa255.cpp index 07e7d997b8c..6bd82ec987c 100644 --- a/src/devices/machine/pxa255.cpp +++ b/src/devices/machine/pxa255.cpp @@ -1583,7 +1583,7 @@ uint32_t pxa255_periphs_device::screen_update(screen_device &screen, bitmap_rgb3 { for (int y = 0; y <= (m_lcd_regs.lccr2 & PXA255_LCCR2_LPP); y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); for (int x = 0; x <= (m_lcd_regs.lccr1 & PXA255_LCCR1_PPL); x++) { *dst++ = m_lcd_palette[m_lcd_framebuffer[y * ((m_lcd_regs.lccr1 & PXA255_LCCR1_PPL) + 1) + x]]; diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp index bdf95dc69d0..4d35b829e74 100644 --- a/src/devices/machine/s2636.cpp +++ b/src/devices/machine/s2636.cpp @@ -247,7 +247,7 @@ void s2636_device::render_next_line() // pre-clear the line for convenience rectangle const &vis_area = screen().visible_area(); - uint16_t *const row = &m_bitmap.pix16(m_screen_line); + uint16_t *const row = &m_bitmap.pix(m_screen_line); m_bitmap.plot_box(0, m_screen_line, m_bitmap.width(), 1, 0); if ((vis_area.min_y > m_screen_line) || (vis_area.max_y < m_screen_line)) diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx index dcff99a7b70..8fae9ee616e 100644 --- a/src/devices/machine/s3c24xx.hxx +++ b/src/devices/machine/s3c24xx.hxx @@ -434,7 +434,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tpal() uint32_t color = s3c24xx_get_color_tpal(); for (int y = m_lcd.vpos_min; y <= m_lcd.vpos_max; y++) { - uint32_t *scanline = &bitmap.pix32(y, m_lcd.hpos_min); + uint32_t *scanline = &bitmap.pix(y, m_lcd.hpos_min); for (int x = m_lcd.hpos_min; x <= m_lcd.hpos_max; x++) { *scanline++ = color; @@ -445,7 +445,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tpal() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -467,7 +467,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -476,7 +476,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -490,7 +490,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -499,7 +499,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -513,7 +513,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -522,7 +522,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -536,7 +536,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -545,7 +545,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 16; i++) { *scanline++ = s3c24xx_get_color_stn_12(s3c24xx_lcd_dma_read_bits(12)); @@ -555,7 +555,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -563,7 +563,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -577,7 +577,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -586,7 +586,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -600,7 +600,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -609,7 +609,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -623,7 +623,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -632,7 +632,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -646,7 +646,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -655,7 +655,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -669,7 +669,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -678,7 +678,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_16() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -692,7 +692,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_16() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -751,9 +751,9 @@ void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bit { for (int y = 0; y < bitmap_dst.height(); y++) { - uint32_t *line0 = &bitmap_src_1.pix32(y); - uint32_t *line1 = &bitmap_src_2.pix32(y); - uint32_t *line2 = &bitmap_dst.pix32(y); + uint32_t const *const line0 = &bitmap_src_1.pix(y); + uint32_t const *const line1 = &bitmap_src_2.pix(y); + uint32_t *const line2 = &bitmap_dst.pix(y); for (int x = 0; x < bitmap_dst.width(); x++) { uint32_t color0 = line0[x]; @@ -764,9 +764,9 @@ void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bit uint16_t r1 = (color1 >> 16) & 0x000000ff; uint16_t g1 = (color1 >> 8) & 0x000000ff; uint16_t b1 = (color1 >> 0) & 0x000000ff; - uint8_t r = (uint8_t)((r0 + r1) >> 1); - uint8_t g = (uint8_t)((g0 + g1) >> 1); - uint8_t b = (uint8_t)((b0 + b1) >> 1); + uint8_t r = uint8_t((r0 + r1) >> 1); + uint8_t g = uint8_t((g0 + g1) >> 1); + uint8_t b = uint8_t((b0 + b1) >> 1); line2[x] = (r << 16) | (g << 8) | b; } } diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp index 6672127e20f..bf3a1ed811c 100644 --- a/src/devices/machine/s3c44b0.cpp +++ b/src/devices/machine/s3c44b0.cpp @@ -17,6 +17,8 @@ #include "coreutil.h" +#include <algorithm> + #define S3C44B0_INTCON (0x00 / 4) // Interrupt Control #define S3C44B0_INTPND (0x04 / 4) // Interrupt Request Status @@ -696,8 +698,8 @@ uint32_t s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitma { for (int y = 0; y < screen.height(); y++) { - uint32_t *scanline = &bitmap.pix32(y); - uint8_t *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1); + uint32_t *scanline = &bitmap.pix(y); + uint8_t const *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1); for (int x = 0; x < screen.width(); x++) { *scanline++ = rgb_t(vram[0], vram[1], vram[2]); @@ -710,8 +712,7 @@ uint32_t s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitma { for (int y = 0; y < screen.height(); y++) { - uint32_t *scanline = &bitmap.pix32(y); - memset(scanline, 0, screen.width() * 4); + std::fill_n(&bitmap.pix(y), screen.width(), 0); } } return 0; diff --git a/src/devices/machine/spg110_video.cpp b/src/devices/machine/spg110_video.cpp index a76fef3bb60..daf7fa5e158 100644 --- a/src/devices/machine/spg110_video.cpp +++ b/src/devices/machine/spg110_video.cpp @@ -4,6 +4,9 @@ #include "emu.h" #include "spg110_video.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SPG110_VIDEO, spg110_video_device, "spg110_video", "SPG110 System-on-a-Chip (Video)") spg110_video_device::spg110_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : @@ -649,9 +652,9 @@ uint32_t spg110_video_device::screen_update(screen_device &screen, bitmap_rgb32 for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); - uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y]; - memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1)); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); + const uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y]; + std::copy_n(src, cliprect.width(), dest); } return 0; diff --git a/src/devices/machine/spg290_ppu.cpp b/src/devices/machine/spg290_ppu.cpp index 8f47d61bf18..19ff7ccb1d2 100644 --- a/src/devices/machine/spg290_ppu.cpp +++ b/src/devices/machine/spg290_ppu.cpp @@ -354,9 +354,9 @@ inline void spg290_ppu_device::argb1555(bitmap_rgb32 &bitmap, const rectangle &c { rgb_t color = rgb_t(pal5bit(argb >> 10), pal5bit(argb >> 5), pal5bit(argb >> 0)); if (blend) - color = blend_colors(bitmap.pix32(posy, posx), color, blend); + color = blend_colors(bitmap.pix(posy, posx), color, blend); - bitmap.pix32(posy, posx) = color; + bitmap.pix(posy, posx) = color; } } @@ -366,9 +366,9 @@ inline void spg290_ppu_device::rgb565(bitmap_rgb32 &bitmap, const rectangle &cli { rgb_t color = rgb_t(pal5bit(rgb >> 11), pal6bit(rgb >> 5), pal5bit(rgb >> 0)); if (blend) - color = blend_colors(bitmap.pix32(posy, posx), color, blend); + color = blend_colors(bitmap.pix(posy, posx), color, blend); - bitmap.pix32(posy, posx) = color; + bitmap.pix(posy, posx) = color; } } diff --git a/src/devices/machine/spg_renderer.cpp b/src/devices/machine/spg_renderer.cpp index 0b6efe58c3f..78bc26438ae 100644 --- a/src/devices/machine/spg_renderer.cpp +++ b/src/devices/machine/spg_renderer.cpp @@ -831,7 +831,7 @@ void spg_renderer_device::update_palette_lookup() void spg_renderer_device::apply_saturation_and_fade(bitmap_rgb32& bitmap, const rectangle& cliprect, int scanline) { - uint32_t* src = &bitmap.pix32(scanline, cliprect.min_x); + uint32_t* src = &bitmap.pix(scanline, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/devices/machine/swtpc8212.cpp b/src/devices/machine/swtpc8212.cpp index 68af9d42e07..fffd6eefe7f 100644 --- a/src/devices/machine/swtpc8212.cpp +++ b/src/devices/machine/swtpc8212.cpp @@ -319,7 +319,7 @@ MC6845_UPDATE_ROW(swtpc8212_device::update_row) else font_color = rgb_t(0x00, 0xd0, 0x00); } - bitmap.pix32(y, x++) = font_color; + bitmap.pix(y, x++) = font_color; data <<= 1; } diff --git a/src/devices/machine/tc009xlvc.cpp b/src/devices/machine/tc009xlvc.cpp index e6fcb74a181..b2d302d3922 100644 --- a/src/devices/machine/tc009xlvc.cpp +++ b/src/devices/machine/tc009xlvc.cpp @@ -347,7 +347,7 @@ u32 tc0090lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { const int res_x = (global_flip()) ? 320 - x : x; - bitmap.pix16(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); + bitmap.pix(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); } } } @@ -398,7 +398,7 @@ u32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { const int res_x = (global_flip()) ? 320 - x : x; - bitmap.pix16(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); + bitmap.pix(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); } } } diff --git a/src/devices/machine/terminal.cpp b/src/devices/machine/terminal.cpp index fd07c5bff35..ccb101d8036 100644 --- a/src/devices/machine/terminal.cpp +++ b/src/devices/machine/terminal.cpp @@ -276,7 +276,7 @@ uint32_t generic_terminal_device::update(screen_device &device, bitmap_rgb32 &bi { for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); for (uint16_t x = ma; x < ma + m_width; x++) { diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp index e8168004811..f4a46748593 100644 --- a/src/devices/sound/cdp1864.cpp +++ b/src/devices/sound/cdp1864.cpp @@ -375,7 +375,7 @@ void cdp1864_device::dma_w(uint8_t data) color = (gdata << 2) | (bdata << 1) | rdata; } - m_bitmap.pix32(y, sx + x) = m_palette[color]; + m_bitmap.pix(y, sx + x) = m_palette[color]; data <<= 1; } diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp index 98580d7ae54..9e28aa4c048 100644 --- a/src/devices/sound/cdp1869.cpp +++ b/src/devices/sound/cdp1869.cpp @@ -574,29 +574,28 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, std::vector<read_ void cdp1869_device::draw_line(bitmap_rgb32 &bitmap, const rectangle &rect, int x, int y, uint8_t data, int color) { - int i; - pen_t fg = m_palette->pen(color); + pen_t const fg = m_palette->pen(color); data <<= 2; - for (i = 0; i < CH_WIDTH; i++) + for (int i = 0; i < CH_WIDTH; i++) { if (data & 0x80) { - bitmap.pix32(y, x) = fg; + bitmap.pix(y, x) = fg; if (!m_fresvert) { - bitmap.pix32(y + 1, x) = fg; + bitmap.pix(y + 1, x) = fg; } if (!m_freshorz) { - bitmap.pix32(y, x + 1) = fg; + bitmap.pix(y, x + 1) = fg; if (!m_fresvert) { - bitmap.pix32(y + 1, x + 1) = fg; + bitmap.pix(y + 1, x + 1) = fg; } } } diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp index e551df0a93d..fadef01dd20 100644 --- a/src/devices/sound/mos6560.cpp +++ b/src/devices/sound/mos6560.cpp @@ -173,20 +173,18 @@ inline uint8_t mos6560_device::read_colorram(offs_t offset) void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color ) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); - - m_bitmap.pix32(y + yoff, xoff + 0) = PALETTE_MOS[color[code >> 7]]; - m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 2) = PALETTE_MOS[color[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 4) = PALETTE_MOS[color[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 6) = PALETTE_MOS[color[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 1]]; + int code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); + + m_bitmap.pix(y + yoff, xoff + 0) = PALETTE_MOS[color[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, xoff + 1) = PALETTE_MOS[color[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, xoff + 2) = PALETTE_MOS[color[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, xoff + 3) = PALETTE_MOS[color[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, xoff + 4) = PALETTE_MOS[color[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, xoff + 5) = PALETTE_MOS[color[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, xoff + 6) = PALETTE_MOS[color[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, xoff + 7) = PALETTE_MOS[color[BIT(code, 0)]]; } } @@ -197,20 +195,18 @@ void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color ) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); - - m_bitmap.pix32(y + yoff, xoff + 0) = - m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[code >> 6]]; - m_bitmap.pix32(y + yoff, xoff + 2) = - m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, xoff + 4) = - m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, xoff + 6) = - m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 3]]; + int code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); + + m_bitmap.pix(y + yoff, xoff + 0) = m_bitmap.pix(y + yoff, xoff + 1) = + PALETTE_MOS[color[code >> 6]]; + m_bitmap.pix(y + yoff, xoff + 2) = m_bitmap.pix(y + yoff, xoff + 3) = + PALETTE_MOS[color[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, xoff + 4) = m_bitmap.pix(y + yoff, xoff + 5) = + PALETTE_MOS[color[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, xoff + 6) = m_bitmap.pix(y + yoff, xoff + 7) = + PALETTE_MOS[color[code & 3]]; } } @@ -221,9 +217,7 @@ void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yof void mos6560_device::drawlines( int first, int last ) { - int line, vline; - int offs, yoff, xoff, ybegin, yend, i, j; - int attr, ch; + int line; m_lastline = last; if (first >= last) @@ -231,12 +225,13 @@ void mos6560_device::drawlines( int first, int last ) for (line = first; (line < m_ypos) && (line < last); line++) { - for (j = 0; j < m_total_xsize; j++) - m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor]; + for (int j = 0; j < m_total_xsize; j++) + m_bitmap.pix(line, j) = PALETTE_MOS[m_framecolor]; } - for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) + for (int vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) { + int offs, yoff, xoff, ybegin, yend; if (m_matrix8x16) { offs = (vline >> 4) * m_chars_x; @@ -254,16 +249,16 @@ void mos6560_device::drawlines( int first, int last ) if (m_xpos > 0) { - for (i = ybegin; i <= yend; i++) - for (j = 0; j < m_xpos; j++) - m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor]; + for (int i = ybegin; i <= yend; i++) + for (int j = 0; j < m_xpos; j++) + m_bitmap.pix(yoff + i, j) = PALETTE_MOS[m_framecolor]; } for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++) { - ch = read_videoram((m_videoaddr + offs) & 0x3fff); + int ch = read_videoram((m_videoaddr + offs) & 0x3fff); - attr = (read_colorram((m_videoaddr + offs) & 0x3fff)) & 0xf; + int attr = (read_colorram((m_videoaddr + offs) & 0x3fff)) & 0xf; if (m_variant == TYPE_ATTACK_UFO) { @@ -301,9 +296,9 @@ void mos6560_device::drawlines( int first, int last ) if (xoff < m_total_xsize) { - for (i = ybegin; i <= yend; i++) - for (j = xoff; j < m_total_xsize; j++) - m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor]; + for (int i = ybegin; i <= yend; i++) + for (int j = xoff; j < m_total_xsize; j++) + m_bitmap.pix(yoff + i, j) = PALETTE_MOS[m_framecolor]; } if (m_matrix8x16) @@ -319,8 +314,8 @@ void mos6560_device::drawlines( int first, int last ) } for (; line < last; line++) - for (j = 0; j < m_total_xsize; j++) - m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor]; + for (int j = 0; j < m_total_xsize; j++) + m_bitmap.pix(line, j) = PALETTE_MOS[m_framecolor]; } diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp index 993cade8ec2..aa9604b3a78 100644 --- a/src/devices/sound/mos7360.cpp +++ b/src/devices/sound/mos7360.cpp @@ -513,106 +513,93 @@ void mos7360_device::sound_stream_update(sound_stream &stream, std::vector<read_ void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { + int code; if (INROM) code = read_rom(m_chargenaddr + ch * 8 + y); else code = read_ram(m_chargenaddr + ch * 8 + y); - m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[color[code >> 7]]; - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[color[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[color[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[color[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[color[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[color[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[color[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[color[code & 1]]; + m_bitmap.pix(y + yoff, 0 + xoff) = PALETTE_MOS[color[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, 1 + xoff) = PALETTE_MOS[color[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, 2 + xoff) = PALETTE_MOS[color[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, 3 + xoff) = PALETTE_MOS[color[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, 4 + xoff) = PALETTE_MOS[color[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, 5 + xoff) = PALETTE_MOS[color[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, 6 + xoff) = PALETTE_MOS[color[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, 7 + xoff) = PALETTE_MOS[color[BIT(code, 0)]]; } } void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { + int code; if (INROM) code = read_rom(m_chargenaddr + ch * 8 + y); else code = read_ram(m_chargenaddr + ch * 8 + y); - m_bitmap.pix32(y + yoff, 0 + xoff) = - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_multi[code >> 6]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_multi[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_multi[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_multi[code & 3]]; + m_bitmap.pix(y + yoff, 0 + xoff) = m_bitmap.pix(y + yoff, 1 + xoff) = + PALETTE_MOS[m_multi[code >> 6]]; + m_bitmap.pix(y + yoff, 2 + xoff) = m_bitmap.pix(y + yoff, 3 + xoff) = + PALETTE_MOS[m_multi[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, 4 + xoff) = m_bitmap.pix(y + yoff, 5 + xoff) = + PALETTE_MOS[m_multi[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, 6 + xoff) = m_bitmap.pix(y + yoff, 7 + xoff) = + PALETTE_MOS[m_multi[code & 3]]; } } void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_ram(m_bitmapaddr + ch * 8 + y); - - m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[code >> 7]]; - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[code & 1]]; + int code = read_ram(m_bitmapaddr + ch * 8 + y); + + m_bitmap.pix(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 0)]]; } } void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_ram(m_bitmapaddr + ch * 8 + y); - - m_bitmap.pix32(y + yoff, 0 + xoff) = - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_bitmapmulti[code >> 6]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_bitmapmulti[code & 3]]; + int code = read_ram(m_bitmapaddr + ch * 8 + y); + + m_bitmap.pix(y + yoff, 0 + xoff) = m_bitmap.pix(y + yoff, 1 + xoff) = + PALETTE_MOS[m_bitmapmulti[code >> 6]]; + m_bitmap.pix(y + yoff, 2 + xoff) = m_bitmap.pix(y + yoff, 3 + xoff) = + PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, 4 + xoff) = m_bitmap.pix(y + yoff, 5 + xoff) = + PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, 6 + xoff) = m_bitmap.pix(y + yoff, 7 + xoff) = + PALETTE_MOS[m_bitmapmulti[code & 3]]; } } void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int color) { - int y; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { for (int x = 0; x < 8; x++) { - m_bitmap.pix32(y + yoff, x + xoff) = PALETTE_MOS[color]; + m_bitmap.pix(y + yoff, x + xoff) = PALETTE_MOS[color]; } } } void mos7360_device::drawlines(int first, int last) { - int line, vline, end; - int attr, ch, c1, c2, ecm; - int offs, yoff, xoff, ybegin, yend, xbegin, xend; - int i; - m_lastline = last; /* top part of display not rastered */ @@ -625,34 +612,44 @@ void mos7360_device::drawlines(int first, int last) if (!SCREENON) { - for (line = first; (line < last) && (line < m_bitmap.height()); line++) + for (int line = first; (line < last) && (line < m_bitmap.height()); line++) { for (int x = 0; x < m_bitmap.width(); x++) { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } return; } + int xbegin, xend; if (COLUMNS40) - xbegin = XPOS, xend = xbegin + 320; + { + xbegin = XPOS; + xend = xbegin + 320; + } else - xbegin = XPOS + 7, xend = xbegin + 304; + { + xbegin = XPOS + 7; + xend = xbegin + 304; + } + int end; if (last < m_y_begin) end = last; else end = m_y_begin + YPOS; + + int line; + for (line = first; line < end; line++) { - for (line = first; line < end; line++) + for (int x = 0; x < m_bitmap.width(); x++) { - for (int x = 0; x < m_bitmap.width(); x++) - { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; - } + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } + + int vline; if (LINES25) vline = line - m_y_begin - YPOS; else @@ -663,23 +660,23 @@ void mos7360_device::drawlines(int first, int last) else end = m_y_end + YPOS; - for (; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) + for (int ybegin, yend; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) { - offs = (vline >> 3) * 40; + int offs = (vline >> 3) * 40; ybegin = vline & 7; - yoff = line - ybegin; + int yoff = line - ybegin; yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); /* rendering 39 characters */ /* left and right borders are overwritten later */ - for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) + for (int xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) { if (HIRESON) { - ch = read_ram((m_videoaddr | 0x400) + offs); - attr = read_ram(m_videoaddr + offs); - c1 = ((ch >> 4) & 0xf) | (attr << 4); - c2 = (ch & 0xf) | (attr & 0x70); + int ch = read_ram((m_videoaddr | 0x400) + offs); + int attr = read_ram(m_videoaddr + offs); + int c1 = ((ch >> 4) & 0xf) | (attr << 4); + int c2 = (ch & 0xf) | (attr & 0x70); m_bitmapmulti[1] = m_c16_bitmap[1] = c1 & 0x7f; m_bitmapmulti[2] = m_c16_bitmap[0] = c2 & 0x7f; if (MULTICOLORON) @@ -693,13 +690,13 @@ void mos7360_device::drawlines(int first, int last) } else { - ch = read_ram((m_videoaddr | 0x400) + offs); - attr = read_ram(m_videoaddr + offs); + int ch = read_ram((m_videoaddr | 0x400) + offs); + int attr = read_ram(m_videoaddr + offs); // levente harsfalvi's docu says cursor off in ecm and multicolor if (ECMON) { // hardware reverse off - ecm = ch >> 6; + int ecm = ch >> 6; m_ecmcolor[0] = m_colors[ecm]; m_ecmcolor[1] = attr & 0x7f; draw_character(ybegin, yend, ch & ~0xc0, yoff, xoff, m_ecmcolor); @@ -741,16 +738,16 @@ void mos7360_device::drawlines(int first, int last) } } - for (i = ybegin; i <= yend; i++) + for (int i = ybegin; i <= yend; i++) { for (int x = 0; x < xbegin; x++) { - m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; } for (int x = xend; x < m_bitmap.width(); x++) { - m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; } } } @@ -764,7 +761,7 @@ void mos7360_device::drawlines(int first, int last) { for (int x = 0; x < m_bitmap.width(); x++) { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } } diff --git a/src/devices/sound/vgm_visualizer.cpp b/src/devices/sound/vgm_visualizer.cpp index c1f438f2b2c..bab3c909ddf 100644 --- a/src/devices/sound/vgm_visualizer.cpp +++ b/src/devices/sound/vgm_visualizer.cpp @@ -158,7 +158,7 @@ void vgmviz_device::apply_fft() void vgmviz_device::apply_waterfall() { - int total_bars = FFT_LENGTH / 2; + const int total_bars = FFT_LENGTH / 2; WDL_FFT_COMPLEX* bins[2] = { (WDL_FFT_COMPLEX*)m_fft_buf[0], (WDL_FFT_COMPLEX*)m_fft_buf[1] }; for (int bar = 0; bar < std::min<int>(total_bars, SCREEN_HEIGHT); bar++) { @@ -555,7 +555,7 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap m_clear_pending = false; } - const pen_t *pal = m_palette->pens(); + pen_t const *const pal = m_palette->pens(); int width = SCREEN_WIDTH; switch (SpecMode) @@ -563,31 +563,26 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap case SPEC_VIZ_PILLAR: for (int y = 2; y < SCREEN_HEIGHT; y++) { - uint32_t *src = &m_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y - 2); + uint32_t const *const src = &m_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y - 2); for (int x = SCREEN_WIDTH - 1; x >= 1; x--) { dst[x] = src[x - 1]; } } - width = (int)(SCREEN_WIDTH * 0.75f); + width = int(SCREEN_WIDTH * 0.75f); break; case SPEC_VIZ_TOP: for (int y = 1; y < SCREEN_HEIGHT; y++) { - uint32_t *src = &m_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y - 1); - for (int x = 0; x < SCREEN_WIDTH; x++) - { - dst[x] = src[x]; - } + std::copy_n(&m_bitmap.pix(y), SCREEN_WIDTH, &bitmap.pix(y - 1)); } break; default: break; } - int total_bars = FFT_LENGTH / 2; + const int total_bars = FFT_LENGTH / 2; WDL_FFT_COMPLEX *bins[2] = { (WDL_FFT_COMPLEX *)m_fft_buf[0], (WDL_FFT_COMPLEX *)m_fft_buf[1] }; for (int bar = 2; bar < total_bars && bar < width; bar += BarSize) @@ -614,8 +609,8 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap } for (int y = 0; y < SCREEN_HEIGHT; y++) { - int bar_y = SCREEN_HEIGHT - y; - uint32_t *line = &bitmap.pix32(y); + const int bar_y = SCREEN_HEIGHT - y; + uint32_t *const line = &bitmap.pix(y); for (int x = 0; x < BarSize; x++) { line[(bar - 2) + x] = bar_y <= level ? pal[256 + pal_index] : pal[black_index]; @@ -631,8 +626,8 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap for (int y = 0; y < SCREEN_HEIGHT; y++) { - int bar_y = SCREEN_HEIGHT - y; - uint32_t *line = &bitmap.pix32(y); + const int bar_y = SCREEN_HEIGHT - y; + uint32_t *const line = &bitmap.pix(y); line[0] = 0; if (bar_y > level) { @@ -643,9 +638,9 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap { if (bar_y < (level - 1)) { - const uint8_t r = (uint8_t)(((entry >> 16) & 0xff) * 0.75f); - const uint8_t g = (uint8_t)(((entry >> 8) & 0xff) * 0.75f); - const uint8_t b = (uint8_t)(((entry >> 0) & 0xff) * 0.75f); + const uint8_t r = uint8_t(((entry >> 16) & 0xff) * 0.75f); + const uint8_t g = uint8_t(((entry >> 8) & 0xff) * 0.75f); + const uint8_t b = uint8_t(((entry >> 0) & 0xff) * 0.75f); line[(bar - 2) + x] = 0xff000000 | (r << 16) | (g << 8) | b; } else @@ -653,9 +648,9 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap line[(bar - 2) + x] = pal[256 + pal_index]; } } - const uint8_t r = (uint8_t)(((entry >> 16) & 0xff) * 0.5f); - const uint8_t g = (uint8_t)(((entry >> 8) & 0xff) * 0.5f); - const uint8_t b = (uint8_t)(((entry >> 0) & 0xff) * 0.5f); + const uint8_t r = uint8_t(((entry >> 16) & 0xff) * 0.5f); + const uint8_t g = uint8_t(((entry >> 8) & 0xff) * 0.5f); + const uint8_t b = uint8_t(((entry >> 0) & 0xff) * 0.5f); line[(bar - 2) + (BarSize - 1)] = 0xff000000 | (r << 16) | (g << 8) | b; if (bar_y < level) { @@ -664,10 +659,11 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap } for (int x = 0; x < SCREEN_WIDTH; x++) { - bitmap.pix32(SCREEN_HEIGHT - 1, x) = 0; - bitmap.pix32(SCREEN_HEIGHT - 2, x) = 0; + bitmap.pix(SCREEN_HEIGHT - 1, x) = 0; + bitmap.pix(SCREEN_HEIGHT - 2, x) = 0; } - memcpy(&m_bitmap.pix32(0), &bitmap.pix32(0), sizeof(uint32_t) * SCREEN_WIDTH * SCREEN_HEIGHT); + for (int y = 0; y < SCREEN_HEIGHT; y++) + std::copy_n(&bitmap.pix(y), SCREEN_WIDTH, &m_bitmap.pix(y)); break; case SPEC_VIZ_TOP: level = int(raw_level * 63.0f); @@ -678,10 +674,11 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap for (int x = 0; x < BarSize; x++) { - bitmap.pix32(SCREEN_HEIGHT - 1, (bar - 2) + x) = level > 0 ? pal[256 + pal_index] : pal[black_index]; + bitmap.pix(SCREEN_HEIGHT - 1, (bar - 2) + x) = level > 0 ? pal[256 + pal_index] : pal[black_index]; } - memcpy(&m_bitmap.pix32(0), &bitmap.pix32(0), sizeof(uint32_t) * SCREEN_WIDTH * SCREEN_HEIGHT); + for (int y = 0; y < SCREEN_HEIGHT; y++) + std::copy_n(&bitmap.pix(y), SCREEN_WIDTH, &m_bitmap.pix(y)); break; } } @@ -700,7 +697,7 @@ void vgmviz_device::draw_waterfall(bitmap_rgb32 &bitmap) const int v0_index = (int)v0h; const int v1_index = (int)v1h; const float interp = v0h - (float)v0_index; - uint32_t* line = &bitmap.pix32(y); + uint32_t* line = &bitmap.pix(y); for (int x = 0; x < SCREEN_WIDTH; x++) { if (m_waterfall_length < SCREEN_WIDTH) @@ -736,8 +733,8 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) for (int x = 0; x < SCREEN_WIDTH; x++) { - bitmap.pix32(CHANNEL_CENTER, x) = MED_GRAY; - bitmap.pix32(CHANNEL_HEIGHT + 1 + CHANNEL_CENTER, x) = MED_GRAY; + bitmap.pix(CHANNEL_CENTER, x) = MED_GRAY; + bitmap.pix(CHANNEL_HEIGHT + 1 + CHANNEL_CENTER, x) = MED_GRAY; const float raw_l = m_audio_buf[1 - m_audio_fill_index][0][((int)m_history_length + 1 + x) % FFT_LENGTH]; const int sample_l = (int)((raw_l - 0.5f) * (CHANNEL_HEIGHT - 1)); @@ -746,7 +743,7 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) int y = endy_l - sample_l; do { - bitmap.pix32(y, x) = LEFT_COLOR; + bitmap.pix(y, x) = LEFT_COLOR; y += dy_l; } while(y != endy_l); @@ -757,11 +754,11 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) y = endy_r - sample_r; do { - bitmap.pix32(y, x) = RIGHT_COLOR; + bitmap.pix(y, x) = RIGHT_COLOR; y += dy_r; } while(y != endy_r); - bitmap.pix32(CHANNEL_HEIGHT, x) = WHITE; - bitmap.pix32(CHANNEL_HEIGHT + 1, x) = WHITE; + bitmap.pix(CHANNEL_HEIGHT, x) = WHITE; + bitmap.pix(CHANNEL_HEIGHT + 1, x) = WHITE; } } diff --git a/src/devices/video/315_5124.cpp b/src/devices/video/315_5124.cpp index 4e7d04bcab6..9a3a0f8c339 100644 --- a/src/devices/video/315_5124.cpp +++ b/src/devices/video/315_5124.cpp @@ -1723,8 +1723,8 @@ void sega315_5124_device::draw_scanline(int pixel_offset_x, int pixel_plot_y, in void sega315_5124_device::blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line) { - u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x); - u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x); + u32 *const p_bitmap = &m_tmpbitmap.pix(pixel_plot_y + line, pixel_offset_x); + u8 *const p_y1 = &m_y1_bitmap.pix(pixel_plot_y + line, pixel_offset_x); int x = 0; if (m_vdp_mode == 4 && BIT(m_reg[0x00], 5)) @@ -1755,8 +1755,8 @@ void sega315_5377_device::blit_scanline(int *line_buffer, int *priority_selected } else { - u32 *p_bitmap = &m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x); - u8 *p_y1 = &m_y1_bitmap.pix8(pixel_plot_y + line, pixel_offset_x); + u32 *const p_bitmap = &m_tmpbitmap.pix(pixel_plot_y + line, pixel_offset_x); + u8 *const p_y1 = &m_y1_bitmap.pix(pixel_plot_y + line, pixel_offset_x); int x = 0; /* border on left side of the GG active screen */ diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp index 77bd8a9094a..4360a4e78a1 100644 --- a/src/devices/video/315_5313.cpp +++ b/src/devices/video/315_5313.cpp @@ -2108,7 +2108,7 @@ void sega315_5313_device::render_videobuffer_to_screenbuffer(int scanline) if (scanline >= m_render_bitmap->height()) // safety, shouldn't happen now we allocate a fixed amount tho return; - lineptr = &m_render_bitmap->pix32(scanline); + lineptr = &m_render_bitmap->pix(scanline); } else lineptr = m_render_line.get(); diff --git a/src/devices/video/cdp1861.cpp b/src/devices/video/cdp1861.cpp index 6a79087990d..03bcd3e0e90 100644 --- a/src/devices/video/cdp1861.cpp +++ b/src/devices/video/cdp1861.cpp @@ -248,12 +248,11 @@ void cdp1861_device::dma_w(uint8_t data) { int sx = screen().hpos() + 4; int y = screen().vpos(); - int x; - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { pen_t color = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); - m_bitmap.pix32(y, sx + x) = color; + m_bitmap.pix(y, sx + x) = color; data <<= 1; } } diff --git a/src/devices/video/cdp1862.cpp b/src/devices/video/cdp1862.cpp index 977615955fe..66fa8d9e684 100644 --- a/src/devices/video/cdp1862.cpp +++ b/src/devices/video/cdp1862.cpp @@ -131,7 +131,6 @@ void cdp1862_device::dma_w(uint8_t data) int rd = 1, bd = 1, gd = 1; int sx = screen().hpos() + 4; int y = screen().vpos(); - int x; if (!m_con) { @@ -140,7 +139,7 @@ void cdp1862_device::dma_w(uint8_t data) gd = m_read_gd(); } - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { int color = CDP1862_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8; @@ -149,7 +148,7 @@ void cdp1862_device::dma_w(uint8_t data) color = (gd << 2) | (bd << 1) | rd; } - m_bitmap.pix32(y, sx + x) = m_palette[color]; + m_bitmap.pix(y, sx + x) = m_palette[color]; data <<= 1; } diff --git a/src/devices/video/cesblit.cpp b/src/devices/video/cesblit.cpp index 4cea7aef4f5..7e0e6a2085b 100644 --- a/src/devices/video/cesblit.cpp +++ b/src/devices/video/cesblit.cpp @@ -213,8 +213,6 @@ void cesblit_device::do_blit() // Draw bitmap_ind16 &bitmap = m_bitmap[layer][buffer]; - int x,y; - uint16_t pen; switch (mode & 0x20) { @@ -227,17 +225,17 @@ void cesblit_device::do_blit() uint8_t dst_pen = (m_color >> 8) & 0xff; uint8_t src_pen = (m_color >> 0) & 0xff; - for (y = y0; y != y1; y += dy) + for (int y = y0; y != y1; y += dy) { - for (x = x0; x != x1; x += dx) + for (int x = x0; x != x1; x += dx) { - pen = m_space->read_byte(addr); + uint16_t pen = m_space->read_byte(addr); if (pen == src_pen) pen = dst_pen; if (pen != 0xff) - bitmap.pix16((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; + bitmap.pix((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; ++addr; } @@ -247,14 +245,14 @@ void cesblit_device::do_blit() { // copy from ROM as is - for (y = y0; y != y1; y += dy) + for (int y = y0; y != y1; y += dy) { - for (x = x0; x != x1; x += dx) + for (int x = x0; x != x1; x += dx) { - pen = m_space->read_byte(addr); + uint16_t pen = m_space->read_byte(addr); if (pen != 0xff) - bitmap.pix16((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; + bitmap.pix((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen + color; ++addr; } @@ -263,16 +261,18 @@ void cesblit_device::do_blit() break; case 0x20: // solid fill - pen = ((m_addr_hi >> 8) & 0xff) + color; + { + uint16_t pen = ((m_addr_hi >> 8) & 0xff) + color; - if ((pen & 0xff) == 0xff) - pen = 0xff; + if ((pen & 0xff) == 0xff) + pen = 0xff; - for (y = y0; y != y1; y += dy) - { - for (x = x0; x != x1; x += dx) + for (int y = y0; y != y1; y += dy) { - bitmap.pix16((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen; + for (int x = x0; x != x1; x += dx) + { + bitmap.pix((sy + y) & 0x1ff, (sx + x) & 0x1ff) = pen; + } } } break; diff --git a/src/devices/video/clgd542x.cpp b/src/devices/video/clgd542x.cpp index ace2e7a4820..eff9f5473c8 100644 --- a/src/devices/video/clgd542x.cpp +++ b/src/devices/video/clgd542x.cpp @@ -134,7 +134,6 @@ void cirrus_gd5428_device::device_reset() uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,bit; uint32_t ptr = (vga.svga_intf.vram_size - 0x4000); // cursor patterns are stored in the last 16kB of VRAM svga_device::screen_update(screen, bitmap, cliprect); @@ -145,11 +144,11 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 if(m_cursor_attr & 0x04) // 64x64 { ptr += ((m_cursor_addr & 0x3c) * 256); - for(y=0;y<64;y++) + for(int y=0;y<64;y++) { - for(x=0;x<64;x+=8) + for(int x=0;x<64;x+=8) { - for(bit=0;bit<8;bit++) + for(int bit=0;bit<8;bit++) { uint8_t pixel1 = vga.memory[ptr % vga.svga_intf.vram_size] >> (7-bit); uint8_t pixel2 = vga.memory[(ptr+512) % vga.svga_intf.vram_size] >> (7-bit); @@ -159,13 +158,13 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 case 0: // transparent - do nothing break; case 1: // background - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 16) | (m_ext_palette[0].green << 8) | (m_ext_palette[0].blue); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 16) | (m_ext_palette[0].green << 8) | (m_ext_palette[0].blue); break; case 2: // XOR - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit); break; case 3: // foreground - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 16) | (m_ext_palette[15].green << 8) | (m_ext_palette[15].blue); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 16) | (m_ext_palette[15].green << 8) | (m_ext_palette[15].blue); break; } } @@ -175,11 +174,11 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 else { ptr += ((m_cursor_addr & 0x3f) * 256); - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - for(x=0;x<32;x+=8) + for(int x=0;x<32;x+=8) { - for(bit=0;bit<8;bit++) + for(int bit=0;bit<8;bit++) { uint8_t pixel1 = vga.memory[ptr % vga.svga_intf.vram_size] >> (7-bit); uint8_t pixel2 = vga.memory[(ptr+128) % vga.svga_intf.vram_size] >> (7-bit); @@ -189,13 +188,13 @@ uint32_t cirrus_gd5428_device::screen_update(screen_device &screen, bitmap_rgb32 case 0: // transparent - do nothing break; case 1: // background - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 18) | (m_ext_palette[0].green << 10) | (m_ext_palette[0].blue << 2); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[0].red << 18) | (m_ext_palette[0].green << 10) | (m_ext_palette[0].blue << 2); break; case 2: // XOR - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = ~bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit); break; case 3: // foreground - bitmap.pix32(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 18) | (m_ext_palette[15].green << 10) | (m_ext_palette[15].blue << 2); + bitmap.pix(m_cursor_y+y,m_cursor_x+x+bit) = (m_ext_palette[15].red << 18) | (m_ext_palette[15].green << 10) | (m_ext_palette[15].blue << 2); break; } } diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp index 9cc05ab747b..39fe1b752c7 100644 --- a/src/devices/video/ef9340_1.cpp +++ b/src/devices/video/ef9340_1.cpp @@ -357,7 +357,7 @@ void ef9340_1_device::ef9340_scanline(int vpos) { // Service row is disabled for (int i = 0; i < 40 * 8; i++) - m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + i) = 8; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + i) = 8; return; } } @@ -466,7 +466,7 @@ void ef9340_1_device::ef9340_scanline(int vpos) for (int i = 0; i < 8; i++) { uint16_t d = blank ? 0 : (char_data & 1) ? fg : bg; - m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + x*8 + i) = d | 8; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + x*8 + i) = d | 8; char_data >>= 1; } @@ -480,7 +480,7 @@ void ef9340_1_device::ef9340_scanline(int vpos) else { for (int i = 0; i < 40 * 8; i++) - m_tmp_bitmap.pix16(m_offset_y + vpos, m_offset_x + i) = 0; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + i) = 0; } // determine next h parity @@ -499,7 +499,7 @@ uint32_t ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bit // note: palette d3 is transparency (datasheet calls it "I"), this handler masks it off for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix16(y, x) = m_tmp_bitmap.pix16(y, x) & 7; + bitmap.pix(y, x) = m_tmp_bitmap.pix(y, x) & 7; return 0; } diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp index 74aa3334c1c..4b8907d0da7 100644 --- a/src/devices/video/ef9345.cpp +++ b/src/devices/video/ef9345.cpp @@ -225,7 +225,7 @@ void ef9345_device::draw_char_40(uint8_t *c, uint16_t x, uint16_t y) for(int i = 0; i < scan_ysize; i++) for(int j = 0; j < scan_xsize; j++) - m_screen_out.pix32(y * 10 + i, x * 8 + j) = palette[c[8 * i + j] & 0x07]; + m_screen_out.pix(y * 10 + i, x * 8 + j) = palette[c[8 * i + j] & 0x07]; } // draw a char in 80 char line mode @@ -237,7 +237,7 @@ void ef9345_device::draw_char_80(uint8_t *c, uint16_t x, uint16_t y) for(int i = 0; i < scan_ysize; i++) for(int j = 0; j < scan_xsize; j++) - m_screen_out.pix32(y * 10 + i, x * 6 + j) = palette[c[6 * i + j] & 0x07]; + m_screen_out.pix(y * 10 + i, x * 6 + j) = palette[c[6 * i + j] & 0x07]; } diff --git a/src/devices/video/ef9364.cpp b/src/devices/video/ef9364.cpp index 858b7309ca6..cef0a33664e 100644 --- a/src/devices/video/ef9364.cpp +++ b/src/devices/video/ef9364.cpp @@ -178,30 +178,27 @@ void ef9364_device::draw_border(uint16_t line) uint32_t ef9364_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,r; - unsigned char c; - - for( r = 0 ; r < NB_OF_ROWS ; r++ ) + for( int r = 0 ; r < NB_OF_ROWS ; r++ ) { - for( y = 0 ; y < 8 ; y++ ) + for( int y = 0 ; y < 8 ; y++ ) { - for( x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ ) + for( int x = 0 ; x < NB_OF_COLUMNS * 8 ; x++ ) { if( ( ( x >> 3 ) != x_curs_pos ) || ( r != y_curs_pos ) || !cursor_state) { - c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) ); + unsigned char c = m_textram->read_byte( ( r * NB_OF_COLUMNS ) + ( x>>3 ) ); if( m_charset[((c&0x7F)<<3) + y] & (0x80>>(x&7)) ) - m_screen_out.pix32((r*12)+y, x) = palette[1]; + m_screen_out.pix((r*12)+y, x) = palette[1]; else - m_screen_out.pix32((r*12)+y, x) = palette[0]; + m_screen_out.pix((r*12)+y, x) = palette[0]; } else { if(y != 7) - m_screen_out.pix32((r*12)+y, x) = palette[0]; + m_screen_out.pix((r*12)+y, x) = palette[0]; else - m_screen_out.pix32((r*12)+y, x) = palette[1]; + m_screen_out.pix((r*12)+y, x) = palette[1]; } } } diff --git a/src/devices/video/ef9365.cpp b/src/devices/video/ef9365.cpp index a24783298d1..7697e6885e6 100644 --- a/src/devices/video/ef9365.cpp +++ b/src/devices/video/ef9365.cpp @@ -1156,18 +1156,15 @@ void ef9365_device::ef9365_exec(uint8_t cmd) uint32_t ef9365_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i,j,ptr,p; - unsigned char color_index; - - for(j=0;j<bitplane_yres;j++) + for(int j=0;j<bitplane_yres;j++) { - for(i=0;i<bitplane_xres;i++) + for(int i=0;i<bitplane_xres;i++) { - color_index = 0x00; + unsigned char color_index = 0x00; - ptr = ( bitplane_xres * j ) + i; + int ptr = ( bitplane_xres * j ) + i; - for( p = 0; p < nb_of_bitplanes; p++) + for(int p = 0; p < nb_of_bitplanes; p++) { if( m_videoram->read_byte( (BITPLANE_MAX_SIZE*p) + (ptr>>3)) & (0x80>>(ptr&7))) { @@ -1175,7 +1172,7 @@ uint32_t ef9365_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma } } - m_screen_out.pix32(j, i) = m_palette->pen( color_index ); + m_screen_out.pix(j, i) = m_palette->pen( color_index ); } } diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp index 4f02d39bfab..06cceeca7b0 100644 --- a/src/devices/video/gb_lcd.cpp +++ b/src/devices/video/gb_lcd.cpp @@ -671,7 +671,7 @@ void cgb_ppu_device::device_reset() inline void dmg_ppu_device::plot_pixel(int x, int y, uint16_t color) { - m_bitmap.pix16(y, x) = color; + m_bitmap.pix(y, x) = color; } diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp index ab71569a9fe..e3e46b5ceae 100644 --- a/src/devices/video/gba_lcd.cpp +++ b/src/devices/video/gba_lcd.cpp @@ -267,7 +267,7 @@ inline void gba_lcd_device::update_mask(uint8_t* mask, int y) void gba_lcd_device::draw_scanline(int y) { - uint16_t *scanline = &m_bitmap.pix16(y); + uint16_t *const scanline = &m_bitmap.pix(y); if (is_set(dispcnt::forced_blank)) { diff --git a/src/devices/video/gf4500.cpp b/src/devices/video/gf4500.cpp index e8c35e7ff25..b703e7cb8c3 100644 --- a/src/devices/video/gf4500.cpp +++ b/src/devices/video/gf4500.cpp @@ -89,12 +89,11 @@ static rgb_t gf4500_get_color_16( uint16_t data ) uint32_t gf4500_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *vram = (uint16_t *)(m_data.get() + GF4500_FRAMEBUF_OFFSET / 4); - int x, y; - for (y = 0; y < 240; y++) + uint16_t const *vram = (uint16_t *)(m_data.get() + GF4500_FRAMEBUF_OFFSET / 4); + for (int y = 0; y < 240; y++) { - uint32_t *scanline = &bitmap.pix32(y); - for (x = 0; x < 320; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 320; x++) { *scanline++ = gf4500_get_color_16(*vram++); } diff --git a/src/devices/video/hd44102.cpp b/src/devices/video/hd44102.cpp index 3b05f1e5e69..1bb8cbf5a4d 100644 --- a/src/devices/video/hd44102.cpp +++ b/src/devices/video/hd44102.cpp @@ -268,7 +268,7 @@ uint32_t hd44102_device::screen_update(screen_device &screen, bitmap_ind16 &bitm { int color = (m_status & STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8); - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } z++; diff --git a/src/devices/video/hd44352.cpp b/src/devices/video/hd44352.cpp index 7fa4b53f1d0..1ca378723f3 100644 --- a/src/devices/video/hd44352.cpp +++ b/src/devices/video/hd44352.cpp @@ -152,7 +152,7 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t d = compute_newval((m_cursor_status>>5) & 0x07, m_video_ram[a][py*16*cw + px*cw + c + m_scroll * 48], m_cursor[c]); for (int b=0; b<8; b++) { - bitmap.pix16(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); + bitmap.pix(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); } } } @@ -163,7 +163,7 @@ uint32_t hd44352_device::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t d = m_video_ram[a][py*16*cw + px*cw + c + m_scroll * 48]; for (int b=0; b<8; b++) { - bitmap.pix16(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); + bitmap.pix(py*8 + b, a*cw*16 + px*cw + c) = BIT(d, 7-b); } } } diff --git a/src/devices/video/hd44780.cpp b/src/devices/video/hd44780.cpp index 7abf8e0a979..8d6db247ba7 100644 --- a/src/devices/video/hd44780.cpp +++ b/src/devices/video/hd44780.cpp @@ -274,7 +274,7 @@ inline void hd44780_device::pixel_update(bitmap_ind16 &bitmap, u8 line, u8 pos, if (m_lines <= 2) { if (pos < m_chars) - bitmap.pix16(line * (line_height + 1) + y, pos * 6 + x) = state; + bitmap.pix(line * (line_height + 1) + y, pos * 6 + x) = state; } else if (m_lines <= 4) { @@ -287,7 +287,7 @@ inline void hd44780_device::pixel_update(bitmap_ind16 &bitmap, u8 line, u8 pos, } if (line < m_lines) - bitmap.pix16(line * (line_height + 1) + y, pos * 6 + x) = state; + bitmap.pix(line * (line_height + 1) + y, pos * 6 + x) = state; } } else diff --git a/src/devices/video/hd61830.cpp b/src/devices/video/hd61830.cpp index 26ee97cb22f..55bf2bbd588 100644 --- a/src/devices/video/hd61830.cpp +++ b/src/devices/video/hd61830.cpp @@ -360,9 +360,9 @@ uint16_t hd61830_device::draw_scanline(bitmap_ind16 &bitmap, const rectangle &cl if(y >= 0 && y < bitmap.height()) { if(((sx * m_hp) + x) >= 0 && ((sx * m_hp) + x) < bitmap.width()) - bitmap.pix16(y, (sx * m_hp) + x) = BIT(data1, x); + bitmap.pix(y, (sx * m_hp) + x) = BIT(data1, x); if(((sx * m_hp) + x + m_hp) >= 0 && ((sx * m_hp) + x + m_hp) < bitmap.width()) - bitmap.pix16(y, (sx * m_hp) + x + m_hp) = BIT(data2, x); + bitmap.pix(y, (sx * m_hp) + x + m_hp) = BIT(data2, x); } } } @@ -454,7 +454,7 @@ void hd61830_device::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, } if (sy < screen().height() && sx < screen().width()) - bitmap.pix16(sy, sx) = pixel; + bitmap.pix(sy, sx) = pixel; } } } diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp index e0b08389492..a740aaa93f9 100644 --- a/src/devices/video/hd63484.cpp +++ b/src/devices/video/hd63484.cpp @@ -2107,7 +2107,7 @@ void hd63484_device::draw_graphics_line(bitmap_ind16 &bitmap, const rectangle &c if (!m_display_cb.isnull()) m_display_cb(bitmap, cliprect, y, px, data & mask); else if (cliprect.contains(px, y)) - bitmap.pix16(y, px) = data & mask; + bitmap.pix(y, px) = data & mask; data >>= bpp; } diff --git a/src/devices/video/hd66421.cpp b/src/devices/video/hd66421.cpp index 22efe3689e8..6be96c81e1f 100644 --- a/src/devices/video/hd66421.cpp +++ b/src/devices/video/hd66421.cpp @@ -208,7 +208,7 @@ void hd66421_device::reg_dat_w(uint8_t data) void hd66421_device::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/devices/video/hp1ll3.cpp b/src/devices/video/hp1ll3.cpp index 9a1952d8c25..006b8823122 100644 --- a/src/devices/video/hp1ll3.cpp +++ b/src/devices/video/hp1ll3.cpp @@ -810,14 +810,14 @@ uint32_t hp1ll3_device::screen_update(screen_device &screen, bitmap_ind16 &bitma { if (!m_enable_video) { - bitmap.fill(rgb_t::black()); + bitmap.fill(0); return 0; } for (int y = 0; y < m_vert_pix_total; y++) { int const offset = m_sad + y*m_conf[CONF_WPL]; - uint16_t *p = &m_bitmap.pix16(y); + uint16_t *p = &m_bitmap.pix(y); for (int x = offset; x < offset + m_horiz_pix_total / 16; x++) { diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp index 1160f7edf13..08ca9abc5d9 100644 --- a/src/devices/video/huc6260.cpp +++ b/src/devices/video/huc6260.cpp @@ -69,7 +69,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para int hpos = screen().hpos(); int h = m_last_h; int v = m_last_v; - uint16_t *bitmap_line = &m_bmp->pix16(v); + uint16_t *bitmap_line = &m_bmp->pix(v); while ( h != hpos || v != vpos ) { @@ -112,7 +112,7 @@ void huc6260_device::device_timer(emu_timer &timer, device_timer_id id, int para m_hsync_changed_cb( 1 ); m_pixel_clock = 0; v = ( v + 1 ) % m_height; - bitmap_line = &m_bmp->pix16(v); + bitmap_line = &m_bmp->pix(v); break; case HUC6260_HSYNC_START + 30: /* End/Start of VSync */ diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp index 42568090447..4ff0080777a 100644 --- a/src/devices/video/huc6261.cpp +++ b/src/devices/video/huc6261.cpp @@ -100,7 +100,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para int hpos = screen().hpos(); int h = m_last_h; int v = m_last_v; - uint32_t *bitmap_line = &m_bmp->pix32(v); + uint32_t *bitmap_line = &m_bmp->pix(v); while ( h != hpos || v != vpos ) { @@ -153,7 +153,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para m_huc6270_b->hsync_changed( 1 ); m_pixel_clock = 0; v = ( v + 1 ) % m_height; - bitmap_line = &m_bmp->pix32(v); + bitmap_line = &m_bmp->pix(v); break; case HUC6261_HSYNC_START + 30: /* End/Start of VSync */ diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index 8288dd9e552..bab576103be 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -508,7 +508,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (cliprect.contains(px, scanline)) { m_collision_map[ px ] |= 0x20; - bitmap.pix16( scanline, px ) = color; + bitmap.pix( scanline, px ) = color; } } } @@ -535,7 +535,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (cliprect.contains(px, scanline)) { m_collision_map[ px ] |= 0x20; - bitmap.pix16( scanline, px ) = color; + bitmap.pix( scanline, px ) = color; } } } @@ -562,7 +562,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (cliprect.contains(px, scanline)) { m_collision_map[ px ] |= 0x10; - bitmap.pix16( scanline, px ) = color; + bitmap.pix( scanline, px ) = color; } } } @@ -619,7 +619,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_collision_status |= colx; m_collision_map[ px ] |= 0x80; - bitmap.pix16( scanline, px ) = color; + bitmap.pix( scanline, px ) = color; } } } @@ -667,7 +667,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_collision_status |= colx; m_collision_map[ px ] |= 0x80; - bitmap.pix16( scanline, px ) = color; + bitmap.pix( scanline, px ) = color; } } } @@ -726,7 +726,7 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_collision_status |= m_collision_map[ px ]; m_collision_map[ px ] |= mask; - bitmap.pix16( scanline, px ) = color; + bitmap.pix( scanline, px ) = color; } } } diff --git a/src/devices/video/imagetek_i4100.cpp b/src/devices/video/imagetek_i4100.cpp index 030314636c1..c742407f9fb 100644 --- a/src/devices/video/imagetek_i4100.cpp +++ b/src/devices/video/imagetek_i4100.cpp @@ -923,8 +923,8 @@ void imagetek_i4100_device::draw_spritegfx(screen_device &screen, bitmap_rgb32 & for (int y = sy; y < ey; y++) { const u8 *source = source_base + (y_index >> 16) * width; - u32 *dest = &bitmap.pix32(y); - u8 *pri = &priority_bitmap.pix8(y); + u32 *dest = &bitmap.pix(y); + u8 *pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -1200,8 +1200,8 @@ void imagetek_i4100_device::draw_tilemap(screen_device &screen, bitmap_rgb32 &bi int const srctilerow = srcline >> tileshift; srcline &= tilemask; - u32 *dst = &bitmap.pix32(y); - u8 *priority_baseaddr = &priority_bitmap.pix8(y); + u32 *dst = &bitmap.pix(y); + u8 *priority_baseaddr = &priority_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/devices/video/m50458.cpp b/src/devices/video/m50458.cpp index 97e67af8a75..e2404684700 100644 --- a/src/devices/video/m50458.cpp +++ b/src/devices/video/m50458.cpp @@ -204,21 +204,19 @@ void m50458_device::device_validity_check(validity_checker &valid) const void m50458_device::device_start() { - uint16_t tmp; - uint8_t *pcg = memregion("m50458")->base(); - int tile; - int yi; - uint16_t src,dst; + uint8_t const *const pcg = memregion("m50458")->base(); /* Create an array for shadow gfx */ /* this will spread the source ROM into four directions (up-left, up-right, down-left, down-right) thus creating a working shadow copy */ m_shadow_gfx = make_unique_clear<uint8_t[]>(0x1200); - for(tile=0;tile<0x80;tile++) + for(int tile=0;tile<0x80;tile++) { - for(yi=1;yi<17;yi++) + for(int yi=1;yi<17;yi++) { - src = (tile & 0x7f)*36+yi*2; /* source offset */ + uint16_t tmp, dst; + + uint16_t const src = (tile & 0x7f)*36+yi*2; /* source offset */ dst = (tile & 0x7f)*36+(yi-1)*2; /* destination offset */ @@ -331,40 +329,34 @@ WRITE_LINE_MEMBER( m50458_device::set_clock_line ) uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t *pcg = memregion("m50458")->base(); - uint8_t bg_r,bg_g,bg_b; + uint8_t const *const pcg = memregion("m50458")->base(); /* TODO: there's probably a way to control the brightness in this */ - bg_r = m_phase & 1 ? 0xdf : 0; - bg_g = m_phase & 2 ? 0xdf : 0; - bg_b = m_phase & 4 ? 0xdf : 0; + uint8_t const bg_r = m_phase & 1 ? 0xdf : 0; + uint8_t const bg_g = m_phase & 2 ? 0xdf : 0; + uint8_t const bg_b = m_phase & 4 ? 0xdf : 0; bitmap.fill(rgb_t(0xff,bg_r,bg_g,bg_b),cliprect); - for(y=0;y<12;y++) + for(int y=0;y<12;y++) { - for(x=0;x<24;x++) + for(int x=0;x<24;x++) { - int xi,yi; - uint16_t tile; int y_base = y; if(y != 0 && m_scrr > 1) { y_base+=(m_scrr - 1); } if(y_base > 11) { y_base -= 11; } if(m_scrr && y == 11) { y_base = 0; } /* Guess: repeat line 0 if scrolling is active */ - tile = read_word(x+y_base*24); + uint16_t const tile = read_word(x+y_base*24); - for(yi=0;yi<18;yi++) + for(int yi=0;yi<18;yi++) { - for(xi=4;xi<16;xi++) /* TODO: remove 4 / 16 / -4 offset once that the ROM is fixed */ + for(int xi=4;xi<16;xi++) /* TODO: remove 4 / 16 / -4 offset once that the ROM is fixed */ { - uint8_t pix; - uint8_t color = (tile & 0x700) >> 8; - uint16_t offset = ((tile & 0x7f)*36+yi*2); - int res_y,res_x; - uint8_t xh,yh; + uint8_t const color = (tile & 0x700) >> 8; + uint16_t const offset = ((tile & 0x7f)*36+yi*2); + uint8_t pix; if(xi>=8) pix = ((pcg[offset+1] >> (7-(xi & 0x7))) & 1) << 1; else @@ -382,8 +374,8 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(yi == 17 && tile & 0x1000) /* underline? */ pix |= 1; - res_y = y*18+yi; - res_x = x*12+(xi-4); + int res_y = y*18+yi; + int res_x = x*12+(xi-4); if(y != 0 && y != 11) { @@ -419,9 +411,9 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(res_y > 215 || res_x > 288) continue; - for(yh=0;yh<m_vsz1+1;yh++) - for(xh=0;xh<m_hsz1+1;xh++) - bitmap.pix32(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; + for(uint8_t yh=0;yh<m_vsz1+1;yh++) + for(uint8_t xh=0;xh<m_hsz1+1;xh++) + bitmap.pix(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; } else if(y_base == 11) { @@ -432,9 +424,9 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(res_y > 215 || res_x > 288) continue; - for(yh=0;yh<m_vsz3+1;yh++) - for(xh=0;xh<m_hsz3+1;xh++) - bitmap.pix32(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; + for(uint8_t yh=0;yh<m_vsz3+1;yh++) + for(uint8_t xh=0;xh<m_hsz3+1;xh++) + bitmap.pix(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; } else { @@ -444,9 +436,9 @@ uint32_t m50458_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma if(res_y > 215 || res_x > 288) continue; - for(yh=0;yh<m_vsz2+1;yh++) - for(xh=0;xh<m_hsz2+1;xh++) - bitmap.pix32(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; + for(uint8_t yh=0;yh<m_vsz2+1;yh++) + for(uint8_t xh=0;xh<m_hsz2+1;xh++) + bitmap.pix(res_y+yh,res_x+xh) = r << 16 | g << 8 | b; } } } diff --git a/src/devices/video/mb88303.cpp b/src/devices/video/mb88303.cpp index 1112012db1d..16a24122306 100644 --- a/src/devices/video/mb88303.cpp +++ b/src/devices/video/mb88303.cpp @@ -339,7 +339,7 @@ void mb88303_device::update_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipre const uint32_t color = BIT(gfx[row], bit) ? 0xffffffff : 0; if (!show_background() && !color) continue; - bitmap.pix32(bitmap_y + row + m_vert_display_pos, bitmap_x + (6 - bit) + m_horiz_display_pos) = color; + bitmap.pix(bitmap_y + row + m_vert_display_pos, bitmap_x + (6 - bit) + m_horiz_display_pos) = color; } } } diff --git a/src/devices/video/mb90082.cpp b/src/devices/video/mb90082.cpp index b56e4e61409..27ef9238ec6 100644 --- a/src/devices/video/mb90082.cpp +++ b/src/devices/video/mb90082.cpp @@ -207,44 +207,37 @@ void mb90082_device::write(uint8_t data) uint32_t mb90082_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t *pcg = memregion("mb90082")->base(); - uint16_t tile,attr; - uint8_t bg_r,bg_g,bg_b; + uint8_t const *const pcg = memregion("mb90082")->base(); /* TODO: there's probably a way to control the brightness in this */ - bg_b = m_uc & 1 ? 0xdf : 0; - bg_g = m_uc & 2 ? 0xdf : 0; - bg_r = m_uc & 4 ? 0xdf : 0; + uint8_t const bg_b = m_uc & 1 ? 0xdf : 0; + uint8_t const bg_g = m_uc & 2 ? 0xdf : 0; + uint8_t const bg_r = m_uc & 4 ? 0xdf : 0; bitmap.fill(rgb_t(0xff,bg_r,bg_g,bg_b),cliprect); - for(y=0;y<12;y++) + for(int y=0;y<12;y++) { - for(x=0;x<24;x++) + for(int x=0;x<24;x++) { - int xi,yi; - - tile = read_word(x+y*24); - attr = read_word((x+y*24)|0x200); + uint16_t tile = read_word(x+y*24); + uint16_t attr = read_word((x+y*24)|0x200); /* TODO: charset hook-up is obviously WRONG so following mustn't be trusted at all */ - for(yi=0;yi<16;yi++) + for(int yi=0;yi<16;yi++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - uint8_t pix; - uint8_t color = (attr & 0x70) >> 4; - uint8_t r,g,b; + uint8_t const color = (attr & 0x70) >> 4; - pix = (pcg[(tile*8)+(yi >> 1)] >> (7-(xi >> 1))) & 1; + uint8_t const pix = (pcg[(tile*8)+(yi >> 1)] >> (7-(xi >> 1))) & 1; /* TODO: check this */ - b = (color & 1) ? 0xff : 0; - g = (color & 2) ? 0xff : 0; - r = (color & 4) ? 0xff : 0; + uint8_t const b = (color & 1) ? 0xff : 0; + uint8_t const g = (color & 2) ? 0xff : 0; + uint8_t const r = (color & 4) ? 0xff : 0; if(tile != 0xff && pix != 0) - bitmap.pix32(y*16+yi,x*16+xi) = r << 16 | g << 8 | b; + bitmap.pix(y*16+yi,x*16+xi) = r << 16 | g << 8 | b; } } } diff --git a/src/devices/video/mb_vcu.cpp b/src/devices/video/mb_vcu.cpp index 745675243e6..09ac807f13a 100644 --- a/src/devices/video/mb_vcu.cpp +++ b/src/devices/video/mb_vcu.cpp @@ -526,36 +526,33 @@ void mb_vcu_device::vbank_clear_w(uint8_t data) uint32_t mb_vcu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t dot; - bitmap.fill(m_palette->pen(0x100),cliprect); - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - dot = read_byte((x >> 0)|(y<<8)|1<<16|(m_vbank ^ 1)<<18); + uint8_t dot = read_byte((x >> 0)|(y<<8)|1<<16|(m_vbank ^ 1)<<18); //if(dot != 0xf) { dot|= m_vregs[1] << 4; - bitmap.pix32(y,x) = m_palette->pen(dot); + bitmap.pix(y,x) = m_palette->pen(dot); } } } - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - dot = read_byte((x >> 0)|(y<<8)|0<<16|(m_vbank ^ 1)<<18); + uint8_t dot = read_byte((x >> 0)|(y<<8)|0<<16|(m_vbank ^ 1)<<18); if(dot != 0xf) { dot|= m_vregs[1] << 4; - bitmap.pix32(y,x) = m_palette->pen(dot); + bitmap.pix(y,x) = m_palette->pen(dot); } } } diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp index 01c7b36e500..4370cf6e457 100644 --- a/src/devices/video/mc6845.cpp +++ b/src/devices/video/mc6845.cpp @@ -1779,7 +1779,7 @@ MC6845_UPDATE_ROW( mos8563_device::vdc_update_row ) if (x < 0) x = 0; int color = BIT(code, 7) ? fg : bg; - bitmap.pix32(vbp + y, hbp + x) = pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = pen(de ? color : 0); } } else @@ -1815,7 +1815,7 @@ MC6845_UPDATE_ROW( mos8563_device::vdc_update_row ) if (x < 0) x = 0; int color = BIT(data, 7) ? fg : bg; - bitmap.pix32(vbp + y, hbp + x) = pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = pen(de ? color : 0); if ((bit < 8) || !HSS_SEMI) data <<= 1; } diff --git a/src/devices/video/mc6847.h b/src/devices/video/mc6847.h index 78a8ad57345..78fe0eac5f3 100644 --- a/src/devices/video/mc6847.h +++ b/src/devices/video/mc6847.h @@ -81,7 +81,7 @@ protected: pixel_t *bitmap_addr(bitmap_rgb32 &bitmap, int y, int x) { - return &bitmap.pix32(y, x); + return &bitmap.pix(y, x); } static uint8_t simplify_mode(uint8_t data, uint8_t mode) @@ -183,8 +183,8 @@ protected: if( (mode & MODE_AS) || ((mode & (MODE_AG|MODE_GM0) ) == MODE_AG) ) { - pixel_t *line1 = &bitmap.pix32(y + base_y, base_x); - pixel_t *line2 = &bitmap.pix32(y + base_y + 1, base_x); + pixel_t *line1 = &bitmap.pix(y + base_y, base_x); + pixel_t *line2 = &bitmap.pix(y + base_y + 1, base_x); std::map<std::pair<pixel_t,pixel_t>,pixel_t>::const_iterator newColor; for( int pixel = 0; pixel < bitmap.width() - (base_x * 2); ++pixel ) diff --git a/src/devices/video/mos6566.cpp b/src/devices/video/mos6566.cpp index b88cad06c64..a6e3c246a76 100644 --- a/src/devices/video/mos6566.cpp +++ b/src/devices/video/mos6566.cpp @@ -515,55 +515,37 @@ inline void mos6566_device::draw_background() inline void mos6566_device::draw_mono( uint16_t p, uint8_t c0, uint8_t c1 ) { - uint8_t c[2]; + uint8_t const c[2] = { c0, c1 }; uint8_t data = m_gfx_data; - c[0] = c0; - c[1] = c1; - - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 7] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 6] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 5] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 4] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 3] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 2] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[c[data & 1]]; - m_fore_coll_buf[p + 1] = data & 1; data >>= 1; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[c[data]]; - m_fore_coll_buf[p + 0] = data & 1; + for (unsigned i = 0; i < 8; i++) + { + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 7 - i) = PALETTE_MOS[c[data & 1]]; + m_fore_coll_buf[p + 7 - i] = data & 1; + data >>= 1; + } } inline void mos6566_device::draw_multi( uint16_t p, uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3 ) { - uint8_t c[4]; + uint8_t const c[4] = { c0, c1, c2, c3 }; uint8_t data = m_gfx_data; - c[0] = c0; - c[1] = c1; - c[2] = c2; - c[3] = c3; - - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 7] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 6] = data & 2; data >>= 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 5] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 4] = data & 2; data >>= 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 3] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[c[data & 3]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[c[data & 3]]; m_fore_coll_buf[p + 2] = data & 2; data >>= 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[c[data]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[c[data]]; m_fore_coll_buf[p + 1] = data & 2; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[c[data]]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[c[data]]; m_fore_coll_buf[p + 0] = data & 2; } @@ -2078,57 +2060,23 @@ void mos6566_device::draw_graphics() draw_mono(p, tmp_col, m_color_data & 0x0f); break; case 5: - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 7] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 6] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 5] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 4] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 3] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 2] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 1] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 0] = 0; - break; case 6: - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 7] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 6] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 5] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 4] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 3] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 2] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 1] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; - m_fore_coll_buf[p + 0] = 0; - break; case 7: - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 7) = PALETTE_MOS[0]; m_fore_coll_buf[p + 7] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 6) = PALETTE_MOS[0]; m_fore_coll_buf[p + 6] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 5) = PALETTE_MOS[0]; m_fore_coll_buf[p + 5] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 4) = PALETTE_MOS[0]; m_fore_coll_buf[p + 4] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 3) = PALETTE_MOS[0]; m_fore_coll_buf[p + 3] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 2) = PALETTE_MOS[0]; m_fore_coll_buf[p + 2] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 1) = PALETTE_MOS[0]; m_fore_coll_buf[p + 1] = 0; - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + 0) = PALETTE_MOS[0]; m_fore_coll_buf[p + 0] = 0; break; } @@ -2203,12 +2151,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } } @@ -2251,12 +2199,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } } @@ -2282,12 +2230,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } } @@ -2308,12 +2256,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } } @@ -2363,12 +2311,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[col]; m_spr_coll_buf[p + i] = sbit; } } @@ -2393,12 +2341,12 @@ void mos6566_device::draw_sprites() if (SPRITE_PRIORITY(snum)) { if (m_fore_coll_buf[p + i] == 0) - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } else { - m_bitmap.pix32(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; + m_bitmap.pix(VIC2_RASTER_2_EMU(m_rasterline), p + i) = PALETTE_MOS[color]; m_spr_coll_buf[p + i] = sbit; } } diff --git a/src/devices/video/msm6255.cpp b/src/devices/video/msm6255.cpp index f7f0ee2928a..de34d079cde 100644 --- a/src/devices/video/msm6255.cpp +++ b/src/devices/video/msm6255.cpp @@ -328,9 +328,7 @@ void msm6255_device::draw_scanline(bitmap_ind16 &bitmap, const rectangle &clipre uint8_t cpd = m_cpr & CPR_CPD_MASK; uint16_t car = (m_cur << 8) | m_clr; - int sx, x; - - for (sx = 0; sx < hn; sx++) + for (int sx = 0; sx < hn; sx++) { uint8_t data = read_byte(ma, ra); @@ -345,9 +343,9 @@ void msm6255_device::draw_scanline(bitmap_ind16 &bitmap, const rectangle &clipre } } - for (x = 0; x < hp; x++) + for (int x = 0; x < hp; x++) { - bitmap.pix16(y, (sx * hp) + x) = BIT(data, 7); + bitmap.pix(y, (sx * hp) + x) = BIT(data, 7); data <<= 1; } diff --git a/src/devices/video/nt7534.cpp b/src/devices/video/nt7534.cpp index e777aac55dc..15fd1fb41e5 100644 --- a/src/devices/video/nt7534.cpp +++ b/src/devices/video/nt7534.cpp @@ -148,7 +148,7 @@ uint32_t nt7534_device::screen_update(screen_device &screen, bitmap_ind16 &bitma { uint8_t py = (y + m_display_start_line - 32) % 65; uint8_t page = py/8; - bitmap.pix16(y, x) = BIT(m_ddram[page*132 + px], py%8); + bitmap.pix(y, x) = BIT(m_ddram[page*132 + px], py%8); } } diff --git a/src/devices/video/pc_vga.cpp b/src/devices/video/pc_vga.cpp index 33f2f48d999..9f0bf5c48a7 100644 --- a/src/devices/video/pc_vga.cpp +++ b/src/devices/video/pc_vga.cpp @@ -449,42 +449,37 @@ uint32_t vga_device::start_addr() void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t ch, attr; - uint8_t bits; - uint32_t font_base; - uint32_t *bitmapline; int width=VGA_CH_WIDTH, height = (vga.crtc.maximum_scan_line) * (vga.crtc.scan_doubling + 1); - int pos, line, column, mask, w, h, addr; - uint8_t blink_en,fore_col,back_col; - pen_t pen; if(vga.crtc.cursor_enable) vga.cursor.visible = screen().frame_number() & 0x10; else vga.cursor.visible = 0; - for (addr = vga.crtc.start_addr, line = -vga.crtc.preset_row_scan; line < TEXT_LINES; + for (int addr = vga.crtc.start_addr, line = -vga.crtc.preset_row_scan; line < TEXT_LINES; line += height, addr += (offset()>>1)) { - for (pos = addr, column=0; column<TEXT_COLUMNS; column++, pos++) + for (int pos = addr, column=0; column<TEXT_COLUMNS; column++, pos++) { - ch = vga.memory[(pos<<1) + 0]; - attr = vga.memory[(pos<<1) + 1]; - font_base = 0x20000+(ch<<5); + uint8_t ch = vga.memory[(pos<<1) + 0]; + uint8_t attr = vga.memory[(pos<<1) + 1]; + uint32_t font_base = 0x20000+(ch<<5); font_base += ((attr & 8) ? vga.sequencer.char_sel.A : vga.sequencer.char_sel.B)*0x2000; - blink_en = (vga.attribute.data[0x10]&8&&screen().frame_number() & 0x20) ? attr & 0x80 : 0; + uint8_t blink_en = (vga.attribute.data[0x10]&8&&screen().frame_number() & 0x20) ? attr & 0x80 : 0; - fore_col = attr & 0xf; - back_col = (attr & 0x70) >> 4; + uint8_t fore_col = attr & 0xf; + uint8_t back_col = (attr & 0x70) >> 4; back_col |= (vga.attribute.data[0x10]&8) ? 0 : ((attr & 0x80) >> 4); - for (h = std::max(-line, 0); (h < height) && (line+h < std::min(TEXT_LINES, bitmap.height())); h++) + for (int h = std::max(-line, 0); (h < height) && (line+h < std::min(TEXT_LINES, bitmap.height())); h++) { - bitmapline = &bitmap.pix32(line+h); - bits = vga.memory[font_base+(h>>(vga.crtc.scan_doubling))]; + uint32_t *const bitmapline = &bitmap.pix(line+h); + uint8_t bits = vga.memory[font_base+(h>>(vga.crtc.scan_doubling))]; + int mask, w; for (mask=0x80, w=0; (w<width)&&(w<8); w++, mask>>=1) { + pen_t pen; if (bits&mask) pen = vga.pens[blink_en ? back_col : fore_col]; else @@ -498,6 +493,7 @@ void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) if (w<width) { /* 9 column */ + pen_t pen; if (TEXT_COPY_9COLUMN(ch)&&(bits&1)) pen = vga.pens[blink_en ? back_col : fore_col]; else @@ -510,7 +506,7 @@ void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) } if (vga.cursor.visible&&(pos==vga.crtc.cursor_addr)) { - for (h=vga.crtc.cursor_scan_start; + for (int h=vga.crtc.cursor_scan_start; (h<=vga.crtc.cursor_scan_end)&&(h<height)&&(line+h<TEXT_LINES); h++) { @@ -525,34 +521,29 @@ void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) void vga_device::vga_vh_ega(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int pos, line, column, c, addr, i, yi; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - uint32_t *bitmapline; - pen_t pen; int pel_shift = (vga.attribute.pel_shift & 7); // popmessage("%08x %02x",EGA_START_ADDRESS,pel_shift); /**/ - for (addr=EGA_START_ADDRESS, pos=0, line=0; line<LINES; - line += height, addr += offset()) + for (int addr=EGA_START_ADDRESS, line=0; line<LINES; line += height, addr += offset()) { - for(yi=0;yi<height;yi++) + for (int yi=0;yi<height;yi++) { - bitmapline = &bitmap.pix32(line + yi); + uint32_t *const bitmapline = &bitmap.pix(line + yi); - for (pos=addr, c=0, column=0; column<EGA_COLUMNS+1; column++, c+=8, pos=(pos+1)&0xffff) + for (int pos=addr, c=0, column=0; column<EGA_COLUMNS+1; column++, c+=8, pos=(pos+1)&0xffff) { - int data[4]; + int data[4] = { + vga.memory[(pos & 0xffff)], + vga.memory[(pos & 0xffff)+0x10000]<<1, + vga.memory[(pos & 0xffff)+0x20000]<<2, + vga.memory[(pos & 0xffff)+0x30000]<<3 }; - data[0]=vga.memory[(pos & 0xffff)]; - data[1]=vga.memory[(pos & 0xffff)+0x10000]<<1; - data[2]=vga.memory[(pos & 0xffff)+0x20000]<<2; - data[3]=vga.memory[(pos & 0xffff)+0x30000]<<3; - - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { - pen = vga.pens[(data[0]&1) | (data[1]&2) | (data[2]&4) | (data[3]&8)]; + pen_t pen = vga.pens[(data[0]&1) | (data[1]&2) | (data[2]&4) | (data[3]&8)]; data[0]>>=1; data[1]>>=1; @@ -571,26 +562,21 @@ void vga_device::vga_vh_ega(bitmap_rgb32 &bitmap, const rectangle &cliprect) /* TODO: I'm guessing that in 256 colors mode every pixel actually outputs two pixels. Is it right? */ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; - uint16_t mask_comp; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int yi; - int xi; int pel_shift = (vga.attribute.pel_shift & 6); int addrmask = vga.crtc.no_wrap ? -1 : 0xffff; /* line compare is screen sensitive */ - mask_comp = 0x3ff; //| (LINES & 0x300); + uint16_t mask_comp = 0x3ff; //| (LINES & 0x300); // popmessage("%02x %02x",vga.attribute.pel_shift,vga.sequencer.data[4] & 0x08); - curr_addr = 0; + int curr_addr = 0; if(!(vga.sequencer.data[4] & 0x08)) { - for (addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) { - for(yi = 0;yi < height; yi++) + for(int yi = 0;yi < height; yi++) { if((line + yi) < (vga.crtc.line_compare & mask_comp)) curr_addr = addr; @@ -599,15 +585,15 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) curr_addr = 0; pel_shift = 0; } - bitmapline = &bitmap.pix32(line + yi); - for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=8, pos++) + uint32_t *const bitmapline = &bitmap.pix(line + yi); + for (int pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=8, pos++) { if(pos > 0x80000/4) return; - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - if(!screen().visible_area().contains(c+xi-(pel_shift), line + yi)) + if (!screen().visible_area().contains(c+xi-(pel_shift), line + yi)) continue; bitmapline[c+xi-(pel_shift)] = pen(vga.memory[(pos & addrmask)+((xi >> 1)*0x10000)]); } @@ -617,22 +603,22 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) } else { - for (addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = start_addr(), line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) { - for(yi = 0;yi < height; yi++) + for(int yi = 0;yi < height; yi++) { if((line + yi) < (vga.crtc.line_compare & mask_comp)) curr_addr = addr; if((line + yi) == (vga.crtc.line_compare & mask_comp)) curr_addr = 0; - bitmapline = &bitmap.pix32(line + yi); + uint32_t *const bitmapline = &bitmap.pix(line + yi); //addr %= 0x80000; - for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=0x10, pos+=0x8) + for (int pos=curr_addr, c=0, column=0; column<VGA_COLUMNS+1; column++, c+=0x10, pos+=0x8) { if(pos + 0x08 > 0x80000) return; - for(xi=0;xi<0x10;xi++) + for (int xi=0;xi<0x10;xi++) { if(!screen().visible_area().contains(c+xi-(pel_shift), line + yi)) continue; @@ -646,28 +632,23 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) void vga_device::vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *bitmapline; int height = (vga.crtc.scan_doubling + 1); - int x,xi,y,yi; - uint32_t addr; - pen_t pen; - int width; - width = (vga.crtc.horz_disp_end + 1) * 8; + int width = (vga.crtc.horz_disp_end + 1) * 8; - for(y=0;y<LINES;y++) + for(int y=0;y<LINES;y++) { - addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/4); + uint32_t addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/4); - for(x=0;x<width;x+=4) + for(int x=0;x<width;x+=4) { - for(yi=0;yi<height;yi++) + for(int yi=0;yi<height;yi++) { - bitmapline = &bitmap.pix32(y * height + yi); + uint32_t *const bitmapline = &bitmap.pix(y * height + yi); - for(xi=0;xi<4;xi++) + for(int xi=0;xi<4;xi++) { - pen = vga.pens[(vga.memory[addr] >> (6-xi*2)) & 3]; + pen_t pen = vga.pens[(vga.memory[addr] >> (6-xi*2)) & 3]; if(!screen().visible_area().contains(x+xi, y * height + yi)) continue; bitmapline[x+xi] = pen; @@ -681,28 +662,23 @@ void vga_device::vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) void vga_device::vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *bitmapline; int height = (vga.crtc.scan_doubling + 1); - int x,xi,y,yi; - uint32_t addr; - pen_t pen; - int width; - width = (vga.crtc.horz_disp_end + 1) * 8; + int width = (vga.crtc.horz_disp_end + 1) * 8; - for(y=0;y<LINES;y++) + for(int y=0;y<LINES;y++) { - addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/8); + uint32_t addr = ((y & 1) * 0x2000) + (((y & ~1) >> 1) * width/8); - for(x=0;x<width;x+=8) + for(int x=0;x<width;x+=8) { - for(yi=0;yi<height;yi++) + for(int yi=0;yi<height;yi++) { - bitmapline = &bitmap.pix32(y * height + yi); + uint32_t *const bitmapline = &bitmap.pix(y * height + yi); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = vga.pens[(vga.memory[addr] >> (7-xi)) & 1]; + pen_t pen = vga.pens[(vga.memory[addr] >> (7-xi)) & 1]; if(!screen().visible_area().contains(x+xi, y * height + yi)) continue; bitmapline[x+xi] = pen; @@ -716,18 +692,12 @@ void vga_device::vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; - uint16_t mask_comp; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int yi; - int xi; - uint8_t start_shift; -// uint16_t line_length; /* line compare is screen sensitive */ - mask_comp = 0x3ff; - curr_addr = 0; + uint16_t mask_comp = 0x3ff; + int curr_addr = 0; +// uint16_t line_length; // if(vga.crtc.dw) // line_length = vga.crtc.offset << 3; // doubleword mode // else @@ -735,29 +705,27 @@ void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) // line_length = vga.crtc.offset << 4; // } - start_shift = (!(vga.sequencer.data[4] & 0x08)) ? 2 : 0; + uint8_t start_shift = (!(vga.sequencer.data[4] & 0x08)) ? 2 : 0; + for (int addr = VGA_START_ADDRESS << start_shift, line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) { - for (addr = VGA_START_ADDRESS << start_shift, line=0; line<LINES; line+=height, addr+=offset(), curr_addr+=offset()) + for (int yi = 0;yi < height; yi++) { - for(yi = 0;yi < height; yi++) + if((line + yi) < (vga.crtc.line_compare & mask_comp)) + curr_addr = addr; + if((line + yi) == (vga.crtc.line_compare & mask_comp)) + curr_addr = 0; + uint32_t *const bitmapline = &bitmap.pix(line + yi); + addr %= vga.svga_intf.vram_size; + for (int pos=curr_addr, c=0, column=0; column<VGA_COLUMNS; column++, c+=8, pos+=0x8) { - if((line + yi) < (vga.crtc.line_compare & mask_comp)) - curr_addr = addr; - if((line + yi) == (vga.crtc.line_compare & mask_comp)) - curr_addr = 0; - bitmapline = &bitmap.pix32(line + yi); - addr %= vga.svga_intf.vram_size; - for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS; column++, c+=8, pos+=0x8) - { - if(pos + 0x08 >= vga.svga_intf.vram_size) - return; + if(pos + 0x08 >= vga.svga_intf.vram_size) + return; - for(xi=0;xi<8;xi++) - { - if(!screen().visible_area().contains(c+xi, line + yi)) - continue; - bitmapline[c+xi] = pen(vga.memory[(pos+(xi))]); - } + for (int xi=0;xi<8;xi++) + { + if(!screen().visible_area().contains(c+xi, line + yi)) + continue; + bitmapline[c+xi] = pen(vga.memory[(pos+(xi))]); } } } @@ -767,38 +735,29 @@ void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8)) - #define IV 0xff000000 + constexpr uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - - uint32_t *bitmapline; -// uint16_t mask_comp; /* line compare is screen sensitive */ -// mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) +// uint16_t mask_comp = 0xff | (TLINES & 0x300); + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) { if(pos + 0x10 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=2) + for(int xi=0,xm=0;xi<8;xi++,xm+=2) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MV(pos+xm)&0x7c00)>>10; - g = (MV(pos+xm)&0x03e0)>>5; - b = (MV(pos+xm)&0x001f)>>0; + int r = (MV(pos+xm)&0x7c00)>>10; + int g = (MV(pos+xm)&0x03e0)>>5; + int b = (MV(pos+xm)&0x001f)>>0; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); @@ -811,38 +770,29 @@ void svga_device::svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8)) - #define IV 0xff000000 + constexpr uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - - uint32_t *bitmapline; -// uint16_t mask_comp; /* line compare is screen sensitive */ -// mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) +// uint16_t mask_comp = 0xff | (TLINES & 0x300); + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x10) { if(pos + 0x10 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=2) + for (int xi=0,xm=0;xi<8;xi++,xm+=2) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MV(pos+xm)&0xf800)>>11; - g = (MV(pos+xm)&0x07e0)>>5; - b = (MV(pos+xm)&0x001f)>>0; + int r = (MV(pos+xm)&0xf800)>>11; + int g = (MV(pos+xm)&0x07e0)>>5; + int b = (MV(pos+xm)&0x001f)>>0; r = (r << 3) | (r & 0x7); g = (g << 2) | (g & 0x3); b = (b << 3) | (b & 0x7); @@ -855,39 +805,30 @@ void svga_device::svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16)) - #define ID 0xff000000 + constexpr uint32_t ID = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; - -// uint16_t mask_comp; /* line compare is screen sensitive */ -// mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS<<1, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) +// uint16_t mask_comp = 0xff | (TLINES & 0x300); + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS<<1, line=0; line<TLINES; line+=height, addr+=offset(), curr_addr+=offset()) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=24) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=24) { if(pos + 24 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=3) + for (int xi=0,xm=0;xi<8;xi++,xm+=3) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MD(pos+xm)&0xff0000)>>16; - g = (MD(pos+xm)&0x00ff00)>>8; - b = (MD(pos+xm)&0x0000ff)>>0; - bitmapline[c+xi] = IV|(r<<16)|(g<<8)|(b<<0); + int r = (MD(pos+xm)&0xff0000)>>16; + int g = (MD(pos+xm)&0x00ff00)>>8; + int b = (MD(pos+xm)&0x0000ff)>>0; + bitmapline[c+xi] = ID|(r<<16)|(g<<8)|(b<<0); } } } @@ -896,39 +837,32 @@ void svga_device::svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect) void svga_device::svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16)) - #define ID 0xff000000 + constexpr uint32_t ID = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int xi; - int yi; - int xm; - int pos, line, column, c, addr, curr_addr; - uint32_t *bitmapline; // uint16_t mask_comp; /* line compare is screen sensitive */ // mask_comp = 0xff | (TLINES & 0x300); - curr_addr = 0; - yi=0; - for (addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=(offset()), curr_addr+=(offset())) + int curr_addr = 0; + int yi=0; + for (int addr = TGA_START_ADDRESS, line=0; line<TLINES; line+=height, addr+=(offset()), curr_addr+=(offset())) { - bitmapline = &bitmap.pix32(line); + uint32_t *const bitmapline = &bitmap.pix(line); addr %= vga.svga_intf.vram_size; - for (pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x20) + for (int pos=addr, c=0, column=0; column<TGA_COLUMNS; column++, c+=8, pos+=0x20) { if(pos + 0x20 >= vga.svga_intf.vram_size) return; - for(xi=0,xm=0;xi<8;xi++,xm+=4) + for (int xi=0,xm=0;xi<8;xi++,xm+=4) { - int r,g,b; - if(!screen().visible_area().contains(c+xi, line + yi)) continue; - r = (MD(pos+xm)&0xff0000)>>16; - g = (MD(pos+xm)&0x00ff00)>>8; - b = (MD(pos+xm)&0x0000ff)>>0; - bitmapline[c+xi] = IV|(r<<16)|(g<<8)|(b<<0); + int r = (MD(pos+xm)&0xff0000)>>16; + int g = (MD(pos+xm)&0x00ff00)>>8; + int b = (MD(pos+xm)&0x0000ff)>>0; + bitmapline[c+xi] = ID|(r<<16)|(g<<8)|(b<<0); } } } @@ -936,13 +870,11 @@ void svga_device::svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect) uint8_t vga_device::pc_vga_choosevideomode() { - int i; - if (vga.crtc.sync_en) { if (vga.dac.dirty) { - for (i=0; i<256;i++) + for (int i=0; i<256;i++) { /* TODO: color shifters? */ set_pen_color(i, (vga.dac.color[3*(i & vga.dac.mask)] & 0x3f) << 2, @@ -954,7 +886,7 @@ uint8_t vga_device::pc_vga_choosevideomode() if (vga.attribute.data[0x10] & 0x80) { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x0f) |((vga.attribute.data[0x14]&0xf)<<4)); @@ -962,7 +894,7 @@ uint8_t vga_device::pc_vga_choosevideomode() } else { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x3f) |((vga.attribute.data[0x14]&0xc)<<4)); @@ -997,13 +929,11 @@ uint8_t vga_device::pc_vga_choosevideomode() uint8_t svga_device::pc_vga_choosevideomode() { - int i; - if (vga.crtc.sync_en) { if (vga.dac.dirty) { - for (i=0; i<256;i++) + for (int i=0; i<256;i++) { /* TODO: color shifters? */ set_pen_color(i, (vga.dac.color[3*(i & vga.dac.mask)] & 0x3f) << 2, @@ -1015,7 +945,7 @@ uint8_t svga_device::pc_vga_choosevideomode() if (vga.attribute.data[0x10] & 0x80) { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x0f) |((vga.attribute.data[0x14]&0xf)<<4)); @@ -1023,7 +953,7 @@ uint8_t svga_device::pc_vga_choosevideomode() } else { - for (i=0; i<16;i++) + for (int i=0; i<16;i++) { vga.pens[i] = pen((vga.attribute.data[i]&0x3f) |((vga.attribute.data[0x14]&0xc)<<4)); @@ -1132,32 +1062,26 @@ uint32_t svga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, uint32_t s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t cur_mode; - svga_device::screen_update(screen, bitmap, cliprect); - cur_mode = pc_vga_choosevideomode(); + uint8_t cur_mode = pc_vga_choosevideomode(); // draw hardware graphics cursor // TODO: support 16 bit and greater video modes if(s3.cursor_mode & 0x01) // if cursor is enabled { - uint32_t src; - uint32_t* dst; - uint8_t val; - int x,y; uint16_t cx = s3.cursor_x & 0x07ff; uint16_t cy = s3.cursor_y & 0x07ff; - uint32_t bg_col; - uint32_t fg_col; - int r,g,b; - uint32_t datax; if(cur_mode == SCREEN_OFF || cur_mode == TEXT_MODE || cur_mode == MONO_MODE || cur_mode == CGA_MODE || cur_mode == EGA_MODE) return 0; // cursor only works in VGA or SVGA modes - src = s3.cursor_start_addr * 1024; // start address is in units of 1024 bytes + uint32_t src = s3.cursor_start_addr * 1024; // start address is in units of 1024 bytes + uint32_t bg_col; + uint32_t fg_col; + int r,g,b; + uint32_t datax; switch(cur_mode) { case RGB15_MODE: @@ -1204,16 +1128,16 @@ uint32_t s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma // ,(s3.cursor_fg[0])|(s3.cursor_fg[1]<<8)|(s3.cursor_fg[2]<<16)|(s3.cursor_fg[3]<<24)); // for(x=0;x<64;x++) // printf("%08x: %02x %02x %02x %02x\n",src+x*4,vga.memory[src+x*4],vga.memory[src+x*4+1],vga.memory[src+x*4+2],vga.memory[src+x*4+3]); - for(y=0;y<64;y++) + for(int y=0;y<64;y++) { if(cy + y < cliprect.max_y && cx < cliprect.max_x) { - dst = &bitmap.pix32(cy + y, cx); - for(x=0;x<64;x++) + uint32_t *const dst = &bitmap.pix(cy + y, cx); + for(int x=0;x<64;x++) { uint16_t bita = (vga.memory[(src+1) % vga.svga_intf.vram_size] | ((vga.memory[(src+0) % vga.svga_intf.vram_size]) << 8)) >> (15-(x % 16)); uint16_t bitb = (vga.memory[(src+3) % vga.svga_intf.vram_size] | ((vga.memory[(src+2) % vga.svga_intf.vram_size]) << 8)) >> (15-(x % 16)); - val = ((bita & 0x01) << 1) | (bitb & 0x01); + uint8_t val = ((bita & 0x01) << 1) | (bitb & 0x01); if(s3.extended_dac_ctrl & 0x10) { // X11 mode switch(val) diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp index 6dccd546a35..82036c4c8c0 100644 --- a/src/devices/video/ppu2c0x.cpp +++ b/src/devices/video/ppu2c0x.cpp @@ -641,7 +641,7 @@ void ppu2c0x_device::draw_background(uint8_t* line_priority) /* set up dest */ int start_x = (m_x_fine ^ 0x07) - 7; - uint32_t* dest = &bitmap.pix32(m_scanline, start_x); + uint32_t* dest = &bitmap.pix(m_scanline, start_x); m_tilecount = 0; @@ -698,7 +698,7 @@ void ppu2c0x_device::draw_background(uint8_t* line_priority) /* if the left 8 pixels for the background are off, blank 'em */ if (!(m_regs[PPU_CONTROL1] & PPU_CONTROL1_BACKGROUND_L8)) { - dest = &bitmap.pix32(m_scanline); + dest = &bitmap.pix(m_scanline); for (int i = 0; i < 8; i++) { draw_back_pen(dest, back_pen); @@ -727,7 +727,7 @@ void ppu2c0x_device::draw_background_pen() // Fill this scanline with the background pen. for (int i = 0; i < bitmap.width(); i++) - draw_back_pen(&bitmap.pix32(m_scanline, i), back_pen); + draw_back_pen(&bitmap.pix(m_scanline, i), back_pen); } void ppu2c0x_device::read_sprite_plane_data(int address) @@ -763,7 +763,7 @@ void ppu2c0x_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, ui palval |= ((m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) << 1); uint32_t pix = m_nespens[palval]; - bitmap.pix32(m_scanline, sprite_xpos + pixel) = pix; + bitmap.pix(m_scanline, sprite_xpos + pixel) = pix; } void ppu2c0x_device::read_extra_sprite_bits(int sprite_index) @@ -1066,7 +1066,7 @@ void ppu2c0x_device::update_visible_disabled_scanline() // Fill this scanline with the background pen. for (int i = 0; i < bitmap.width(); i++) - draw_back_pen(&bitmap.pix32(m_scanline, i), back_pen); + draw_back_pen(&bitmap.pix(m_scanline, i), back_pen); } void ppu2c0x_device::update_visible_scanline() diff --git a/src/devices/video/ppu2c0x_sh6578.cpp b/src/devices/video/ppu2c0x_sh6578.cpp index 66ede857004..dac397f5778 100644 --- a/src/devices/video/ppu2c0x_sh6578.cpp +++ b/src/devices/video/ppu2c0x_sh6578.cpp @@ -91,7 +91,7 @@ void ppu_sh6578_device::scanline_increment_fine_ycounter() void ppu_sh6578_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32& bitmap) { uint8_t palval = m_palette_ram[(pixel_data | color << 2)] & 0x3f; - bitmap.pix32(m_scanline, sprite_xpos + pixel) = m_nespens[palval]; + bitmap.pix(m_scanline, sprite_xpos + pixel) = m_nespens[palval]; } void ppu_sh6578_device::read_tile_plane_data(int address, int color) @@ -193,7 +193,7 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) /* set up dest */ int start_x = (m_x_fine ^ 0x07) - 7; - uint32_t* dest = &bitmap.pix32(m_scanline, start_x); + uint32_t* dest = &bitmap.pix(m_scanline, start_x); m_tilecount = 0; @@ -246,7 +246,7 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) /* if the left 8 pixels for the background are off, blank 'em */ if (!(m_regs[PPU_CONTROL1] & PPU_CONTROL1_BACKGROUND_L8)) { - dest = &bitmap.pix32(m_scanline); + dest = &bitmap.pix(m_scanline); for (int i = 0; i < 8; i++) { *(dest++) = back_pen; diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 739b5490c8f..ad1439a90e1 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -364,7 +364,7 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u if (!is16pix) { uint8_t pen = pixel_data + (4 * color); - draw_tile_pixel_inner(pen, &bitmap.pix32(m_scanline, sprite_xpos + pixel)); + draw_tile_pixel_inner(pen, &bitmap.pix(m_scanline, sprite_xpos + pixel)); } else { @@ -374,13 +374,13 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u if ((pixel_data & 0x03) != 0) { uint8_t pen = (pixel_data & 0x03) + (4 * color); - draw_tile_pixel_inner(pen, &bitmap.pix32(m_scanline, sprite_xpos + pixel)); + draw_tile_pixel_inner(pen, &bitmap.pix(m_scanline, sprite_xpos + pixel)); } if (((pixel_data >> 5) & 0x03) != 0) { uint8_t pen = ((pixel_data >> 5) & 0x03) + (4 * color); - draw_tile_pixel_inner(pen, &bitmap.pix32(m_scanline, sprite_xpos + pixel + 8)); + draw_tile_pixel_inner(pen, &bitmap.pix(m_scanline, sprite_xpos + pixel + 8)); } //ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel, pixel_data & 0x03, bitmap); //ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel + 8, (pixel_data >> 5) & 0x03, bitmap); diff --git a/src/devices/video/psx.cpp b/src/devices/video/psx.cpp index 83cd0e5c02d..b73adb2a319 100644 --- a/src/devices/video/psx.cpp +++ b/src/devices/video/psx.cpp @@ -265,8 +265,8 @@ void psxgpu_device::DebugMesh( int n_coordx, int n_coordy ) (int16_t)n_x.w.h <= width - 1 && (int16_t)n_y.w.h <= height - 1 ) { - if( m_debug.mesh->pix16( n_y.w.h, n_x.w.h ) != 0xffff ) - m_debug.mesh->pix16( n_y.w.h, n_x.w.h ) = n_colour; + if( m_debug.mesh->pix( n_y.w.h, n_x.w.h ) != 0xffff ) + m_debug.mesh->pix( n_y.w.h, n_x.w.h ) = n_colour; } n_x.d += n_dx; @@ -364,7 +364,7 @@ int psxgpu_device::DebugMeshDisplay( bitmap_rgb32 &bitmap, const rectangle &clip if( m_debug.b_mesh ) { for( int y = cliprect.min_y; y <= cliprect.max_y; y++ ) - draw_scanline16( bitmap, cliprect.min_x, y, cliprect.max_x + 1 - cliprect.min_x, &m_debug.mesh->pix16( y ), pens() ); + draw_scanline16( bitmap, cliprect.min_x, y, cliprect.max_x + 1 - cliprect.min_x, &m_debug.mesh->pix( y ), pens() ); } m_debug.b_clear = 1; @@ -772,7 +772,7 @@ uint32_t psxgpu_device::update_screen(screen_device &screen, bitmap_rgb32 &bitma while( n_line > 0 ) { uint16_t *p_n_src = p_p_vram[ n_y + n_displaystarty ] + 3 * n_x + n_displaystartx; - uint32_t *p_n_dest = &bitmap.pix32(n_y + n_top, n_x + n_left); + uint32_t *p_n_dest = &bitmap.pix(n_y + n_top, n_x + n_left); n_column = n_columns; while( n_column > 0 ) diff --git a/src/devices/video/saa5050.cpp b/src/devices/video/saa5050.cpp index 77af6be01ea..b873edfbbb9 100644 --- a/src/devices/video/saa5050.cpp +++ b/src/devices/video/saa5050.cpp @@ -661,9 +661,7 @@ uint32_t saa5050_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm int g = BIT(color, 1) * 0xff; int b = BIT(color, 2) * 0xff; - rgb_t rgb = rgb_t(r, g, b); - - bitmap.pix32(y, x++) = rgb; + bitmap.pix(y, x++) = rgb_t(r, g, b); } } } diff --git a/src/devices/video/scn2674.cpp b/src/devices/video/scn2674.cpp index 17fc68c6b9a..96e1e7d3ca5 100644 --- a/src/devices/video/scn2674.cpp +++ b/src/devices/video/scn2674.cpp @@ -1178,7 +1178,7 @@ TIMER_CALLBACK_MEMBER(scn2674_device::scanline_timer) } if (!m_display_enabled) - std::fill_n(&m_bitmap.pix32(m_linecounter), m_character_per_row * m_hpixels_per_column, rgb_t::black()); + std::fill_n(&m_bitmap.pix(m_linecounter), m_character_per_row * m_hpixels_per_column, rgb_t::black()); if (m_gfx_enabled || (charrow == (m_scanline_per_char_row - 1))) m_address = address; diff --git a/src/devices/video/sed1330.cpp b/src/devices/video/sed1330.cpp index 101ebe72944..37d95caac7b 100644 --- a/src/devices/video/sed1330.cpp +++ b/src/devices/video/sed1330.cpp @@ -605,7 +605,7 @@ void sed1330_device::data_w(uint8_t data) void sed1330_device::draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int r, uint16_t va, bool cursor) { - uint16_t *p = &bitmap.pix16(y, 0); + uint16_t *p = &bitmap.pix(y); for (int sx = 0; sx < m_cr; sx++, p += m_fx) { @@ -653,7 +653,7 @@ void sed1330_device::draw_graphics_scanline(bitmap_ind16 &bitmap, const rectangl for (int x = 0; x < m_fx; x++) { - bitmap.pix16(y, (sx * m_fx) + x) = BIT(data, 7); + bitmap.pix(y, (sx * m_fx) + x) = BIT(data, 7); data <<= 1; } } diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp index a74f7af905d..e0b4eb544b1 100644 --- a/src/devices/video/snes_ppu.cpp +++ b/src/devices/video/snes_ppu.cpp @@ -1251,7 +1251,7 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) if (m_screen_disabled) /* screen is forced blank */ for (int x = 0; x < SNES_SCR_WIDTH * 2; x++) - bitmap.pix32(0, x) = rgb_t::black(); + bitmap.pix(0, x) = rgb_t::black(); else { uint8_t window_above[256]; @@ -1323,8 +1323,8 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int g = (c & 0x3e0) >> 5; const int b = (c & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 0) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); - bitmap.pix32(0, x * 2 + 1) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(0, x * 2 + 0) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(0, x * 2 + 1) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); } else if (!blurring) { @@ -1337,8 +1337,8 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int b0 = (c0 & 0x7c00) >> 10; const int b1 = (c1 & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); - bitmap.pix32(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); + bitmap.pix(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); + bitmap.pix(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); } else { @@ -1348,7 +1348,7 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int r0 = (c0 & 0x1f); const int g0 = (c0 & 0x3e0) >> 5; const int b0 = (c0 & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); + bitmap.pix(0, x * 2 + 0) = rgb_t(pal5bit(r0), pal5bit(g0), pal5bit(b0)); prev = curr; curr = luma[pixel(x, above, below, window_above, window_below)]; @@ -1357,7 +1357,7 @@ void snes_ppu_device::refresh_scanline( bitmap_rgb32 &bitmap, uint16_t curline ) const int r1 = (c1 & 0x1f); const int g1 = (c1 & 0x3e0) >> 5; const int b1 = (c1 & 0x7c00) >> 10; - bitmap.pix32(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); + bitmap.pix(0, x * 2 + 1) = rgb_t(pal5bit(r1), pal5bit(g1), pal5bit(b1)); prev = curr; } diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp index 473fa710f7d..f79f0aec207 100644 --- a/src/devices/video/stvvdp2.cpp +++ b/src/devices/video/stvvdp2.cpp @@ -2530,11 +2530,11 @@ void saturn_state::stv_vdp2_drawgfxzoom( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = source_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); + uint8_t const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { if(stv_vdp2_window_process(x,y)) { @@ -2552,11 +2552,11 @@ void saturn_state::stv_vdp2_drawgfxzoom( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = source_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); + uint8_t const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { if(stv_vdp2_window_process(x,y)) { @@ -2574,11 +2574,11 @@ void saturn_state::stv_vdp2_drawgfxzoom( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = source_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); + uint8_t const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { if(stv_vdp2_window_process(x,y)) { @@ -2716,17 +2716,16 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - int r,g,b,data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2743,17 +2742,16 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - int r,g,b,data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - data = (source[(x_index*2+0)>>16]<<0)|(source[(x_index*2+1)>>16]<<8); - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int data = (source[(x_index*2+0)>>16]<<0)|(source[(x_index*2+1)>>16]<<8); + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2770,17 +2768,16 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( { for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - int r,g,b,data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2877,21 +2874,18 @@ void saturn_state::stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectan for( y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*16; - uint32_t *dest = &dest_bmp.pix32(y); - uint16_t data; + uint8_t const *const source = gfxdata + (y_index>>16)*16; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { - int r,g,b; - - data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; + uint16_t data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; if ((data & 0x8000) || (transparency & STV_TRANSPARENCY_NONE)) { - b = pal5bit((data & 0x7c00) >> 10); - g = pal5bit((data & 0x03e0) >> 5); - r = pal5bit( data & 0x001f); + int b = pal5bit((data & 0x7c00) >> 10); + int g = pal5bit((data & 0x03e0) >> 5); + int r = pal5bit( data & 0x001f); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -2986,26 +2980,21 @@ void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectan if( ex>sx ) { /* skip if inner loop doesn't draw anything */ - int y; - - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = gfxdata + (y_index>>16)*32; - uint32_t *dest = &dest_bmp.pix32(y); - uint32_t data; + uint8_t const *const source = gfxdata + (y_index>>16)*32; + uint32_t *const dest = &dest_bmp.pix(y); - int x, x_index = x_index_base; + int x_index = x_index_base; - for( x=sx; x<ex; x++ ) + for( int x=sx; x<ex; x++ ) { - int r,g,b; - - data = (source[(x_index>>16)*4+0] << 24) | (source[(x_index>>16)*4+1] << 16) | (source[(x_index>>16)*4+2] << 8) | (source[(x_index>>16)*4+3] << 0); + uint32_t data = (source[(x_index>>16)*4+0] << 24) | (source[(x_index>>16)*4+1] << 16) | (source[(x_index>>16)*4+2] << 8) | (source[(x_index>>16)*4+3] << 0); if ((data & 0x80000000) || (transparency & STV_TRANSPARENCY_NONE)) { - b = (data & 0xff0000) >> 16; - g = (data & 0x00ff00) >> 8; - r = (data & 0x0000ff); + int b = (data & 0xff0000) >> 16; + int g = (data & 0x00ff00) >> 8; + int r = (data & 0x0000ff); if(stv2_current_tilemap.fade_control & 1) stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); @@ -3078,27 +3067,23 @@ void saturn_state::stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle /* skip if inner loop doesn't draw anything */ if (ex > sx) { - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + uint8_t const *const source = source_base + y_index*gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const uint8_t *source = source_base + y_index*gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + if(stv_vdp2_window_process(x,y)) { - if(stv_vdp2_window_process(x,y)) - { - int c = (source[x_index]); - if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) - dest[x] = alpha_blend_r32( dest[x], pal[c], alpha ); - } - - x_index += xinc; + int c = (source[x_index]); + if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) + dest[x] = alpha_blend_r32( dest[x], pal[c], alpha ); } - y_index += yinc; + + x_index += xinc; } + y_index += yinc; } } } @@ -3155,27 +3140,23 @@ void saturn_state::stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectan /* skip if inner loop doesn't draw anything */ if (ex > sx) { - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + uint8_t const *const source = source_base + y_index*gfx->rowbytes(); + uint32_t *const dest = &dest_bmp.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const uint8_t *source = source_base + y_index*gfx->rowbytes(); - uint32_t *dest = &dest_bmp.pix32(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + if(stv_vdp2_window_process(x,y)) { - if(stv_vdp2_window_process(x,y)) - { - int c = (source[x_index]); - if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) - dest[x] = pal[c]; - } - - x_index += xinc; + int c = (source[x_index]); + if ((transparency & STV_TRANSPARENCY_NONE) || (c != 0)) + dest[x] = pal[c]; } - y_index += yinc; + + x_index += xinc; } + y_index += yinc; } } } @@ -3227,9 +3208,9 @@ void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr dot_data += pal_bank; if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data); + bitmap.pix(ydst, xdst) = m_palette->pen(dot_data); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); + bitmap.pix(ydst, xdst) = alpha_blend_r32(bitmap.pix(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); } } } @@ -3287,9 +3268,9 @@ void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr dot_data += pal_bank; if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data); + bitmap.pix(ydst, xdst) = m_palette->pen(dot_data); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); + bitmap.pix(ydst, xdst) = alpha_blend_r32(bitmap.pix(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); } } } @@ -3344,9 +3325,9 @@ void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip dot_data += pal_bank; if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data); + bitmap.pix(ydst, xdst) = m_palette->pen(dot_data); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); + bitmap.pix(ydst, xdst) = alpha_blend_r32(bitmap.pix(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha); } } } @@ -3403,9 +3384,9 @@ void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = rgb_t(r, g, b); + bitmap.pix(ydst, xdst) = rgb_t(r, g, b); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32( bitmap.pix32(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); + bitmap.pix(ydst, xdst) = alpha_blend_r32( bitmap.pix(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); } } } @@ -3461,9 +3442,9 @@ void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) - bitmap.pix32(ydst, xdst) = rgb_t(r, g, b); + bitmap.pix(ydst, xdst) = rgb_t(r, g, b); else - bitmap.pix32(ydst, xdst) = alpha_blend_r32( bitmap.pix32(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); + bitmap.pix(ydst, xdst) = alpha_blend_r32( bitmap.pix(ydst, xdst), rgb_t(r, g, b), stv2_current_tilemap.alpha ); } } } @@ -4354,9 +4335,9 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli uint16_t pen; pen = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; - pix = bitmap.pix32(y, x); + pix = bitmap.pix(y, x); - bitmap.pix32(y, x) = add_blend_r32(m_palette->pen(pen & 0x7ff),pix); + bitmap.pix(y, x) = add_blend_r32(m_palette->pen(pen & 0x7ff),pix); } } } @@ -4364,12 +4345,8 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t is_roz) { - int x,y,xi,yi; - uint8_t h_size,v_size; - uint32_t pix; - - h_size = STV_VDP2_MZSZH+1; - v_size = STV_VDP2_MZSZV+1; + uint8_t h_size = STV_VDP2_MZSZH+1; + uint8_t v_size = STV_VDP2_MZSZV+1; if(is_roz) v_size = 1; @@ -4380,15 +4357,15 @@ void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &c if(STV_VDP2_LSMD == 3) v_size <<= 1; - for(y=cliprect.top();y<=cliprect.bottom();y+=v_size) + for(int y=cliprect.top();y<=cliprect.bottom();y+=v_size) { - for(x=cliprect.left();x<=cliprect.right();x+=h_size) + for(int x=cliprect.left();x<=cliprect.right();x+=h_size) { - pix = bitmap.pix32(y, x); + uint32_t pix = bitmap.pix(y, x); - for(yi=0;yi<v_size;yi++) - for(xi=0;xi<h_size;xi++) - bitmap.pix32(y+yi, x+xi) = pix; + for(int yi=0;yi<v_size;yi++) + for(int xi=0;xi<h_size;xi++) + bitmap.pix(y+yi, x+xi) = pix; } } } @@ -4726,7 +4703,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, //dx = (RP.A * RP.dx) + (RP.B * RP.dy); //dy = (RP.D * RP.dx) + (RP.E * RP.dy); - line = &bitmap.pix32(vcnt); + line = &bitmap.pix(vcnt); // TODO: nuke this spaghetti code if ( !use_coeff_table || RP.dkax == 0 ) @@ -4814,7 +4791,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, continue; } - pix = roz_bitmap.pix32(y & planerenderedsizey, x & planerenderedsizex); + pix = roz_bitmap.pix(y & planerenderedsizey, x & planerenderedsizex); if (stv2_current_tilemap.transparency & STV_TRANSPARENCY_ALPHA) { if ((stv2_current_tilemap.transparency & STV_TRANSPARENCY_NONE) || (pix & 0xffffff)) @@ -4918,7 +4895,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, if ( x & clipxmask || y & clipymask ) continue; - pix = roz_bitmap.pix32(y & planerenderedsizey, x & planerenderedsizex); + pix = roz_bitmap.pix(y & planerenderedsizey, x & planerenderedsizex); if (stv2_current_tilemap.transparency & STV_TRANSPARENCY_ALPHA) { if ((stv2_current_tilemap.transparency & STV_TRANSPARENCY_NONE) || (pix & 0xffffff)) @@ -5753,12 +5730,9 @@ void saturn_state::stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cli void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - uint8_t* gfxdata = m_vdp2.gfx_decode.get(); - uint32_t base_offs,base_mask; - uint8_t interlace; + uint8_t const *const gfxdata = m_vdp2.gfx_decode.get(); - interlace = (STV_VDP2_LSMD == 3)+1; + uint8_t interlace = (STV_VDP2_LSMD == 3)+1; // popmessage("Back screen %08x %08x %08x",STV_VDP2_BDCLMD,STV_VDP2_BKCLMD,STV_VDP2_BKTA); @@ -5767,27 +5741,24 @@ void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cli bitmap.fill(m_palette->black_pen(), cliprect); else { - base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; + uint32_t base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; - for(y=cliprect.top();y<=cliprect.bottom();y++) + for(int y=cliprect.top();y<=cliprect.bottom();y++) { - base_offs = ((STV_VDP2_BKTA ) & base_mask) << 1; + uint32_t base_offs = ((STV_VDP2_BKTA ) & base_mask) << 1; if(STV_VDP2_BKCLMD) base_offs += ((y / interlace) << 1); - for(x=cliprect.left();x<=cliprect.right();x++) + for(int x=cliprect.left();x<=cliprect.right();x++) { - int r,g,b; - uint16_t dot; - - dot = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; - b = pal5bit((dot & 0x7c00) >> 10); - g = pal5bit((dot & 0x03e0) >> 5); - r = pal5bit( dot & 0x001f); + uint16_t dot = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; + int b = pal5bit((dot & 0x7c00) >> 10); + int g = pal5bit((dot & 0x03e0) >> 5); + int r = pal5bit( dot & 0x001f); if(STV_VDP2_BKCOEN) stv_vdp2_compute_color_offset( &r, &g, &b, STV_VDP2_BKCOSL ); - bitmap.pix32(y, x) = rgb_t(r, g, b); + bitmap.pix(y, x) = rgb_t(r, g, b); } } } @@ -6737,7 +6708,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, continue; framebuffer_line = m_vdp1.framebuffer_display_lines[y]; - bitmap_line = &bitmap.pix32(y); + bitmap_line = &bitmap.pix(y); for ( x = cliprect.left(); x <= cliprect.right(); x++ ) { @@ -6830,7 +6801,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, continue; framebuffer_line = m_vdp1.framebuffer_display_lines[y]; - bitmap_line = &bitmap.pix32(y); + bitmap_line = &bitmap.pix(y); for ( x = cliprect.left(); x <= cliprect.right(); x++ ) { @@ -6941,12 +6912,12 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, framebuffer_line = m_vdp1.framebuffer_display_lines[y]; if ( interlace_framebuffer == 0 ) { - bitmap_line = &bitmap.pix32(y); + bitmap_line = &bitmap.pix(y); } else { - bitmap_line = &bitmap.pix32(2*y); - bitmap_line2 = &bitmap.pix32(2*y + 1); + bitmap_line = &bitmap.pix(2*y); + bitmap_line2 = &bitmap.pix(2*y + 1); } for ( x = cliprect.left(); x <= cliprect.right() /(double_x+1) ; x++ ) diff --git a/src/devices/video/t6963c.cpp b/src/devices/video/t6963c.cpp index 96995f62c68..215911ed3ff 100644 --- a/src/devices/video/t6963c.cpp +++ b/src/devices/video/t6963c.cpp @@ -346,7 +346,7 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma data = m_display_ram->read_byte(m_cgram_offset + c * 8 + cy); for(int cx=0; cx<m_font_size; cx++) - bitmap.pix16(y * 8 + cy, x * m_font_size + cx) = BIT(data, m_font_size - 1 - cx); + bitmap.pix(y * 8 + cy, x * m_font_size + cx) = BIT(data, m_font_size - 1 - cx); } } @@ -362,13 +362,13 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma switch(m_mode & 7) { case 0: // OR - bitmap.pix16(y, x * m_font_size + i) |= pix; + bitmap.pix(y, x * m_font_size + i) |= pix; break; case 1: // EXOR - bitmap.pix16(y, x * m_font_size + i) ^= pix; + bitmap.pix(y, x * m_font_size + i) ^= pix; break; case 3: // AND - bitmap.pix16(y, x * m_font_size + i) &= pix; + bitmap.pix(y, x * m_font_size + i) &= pix; break; case 4: // Text attribute logerror("%s: Unimplemented Text attribute\n", machine().describe_context()); diff --git a/src/devices/video/t6a04.cpp b/src/devices/video/t6a04.cpp index 8b55f8ce153..a5dc8bfa928 100644 --- a/src/devices/video/t6a04.cpp +++ b/src/devices/video/t6a04.cpp @@ -110,7 +110,7 @@ uint32_t t6a04_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int b=7; b>=0; b--) { - bitmap.pix16(x&0x3f, y*8+b) = data & 1; + bitmap.pix(x&0x3f, y*8+b) = data & 1; data>>=1; } } diff --git a/src/devices/video/tms3556.cpp b/src/devices/video/tms3556.cpp index dbd45105a97..3088e02e685 100644 --- a/src/devices/video/tms3556.cpp +++ b/src/devices/video/tms3556.cpp @@ -573,12 +573,12 @@ void tms3556_device::draw_line(bitmap_ind16 &bmp, int line) // if (m_control_regs[4] & 0x??) // { // interlaced mode -// ln = &bmp->pix16(line, m_field); +// ln = &bmp->pix(line, m_field); // } // else { /* non-interlaced mode */ - ln = &bmp.pix16(line); - ln2 = &bmp.pix16(line, 1); + ln = &bmp.pix(line); + ln2 = &bmp.pix(line, 1); double_lines = 1; } diff --git a/src/devices/video/tms9928a.cpp b/src/devices/video/tms9928a.cpp index 129b364e860..27395fecacb 100644 --- a/src/devices/video/tms9928a.cpp +++ b/src/devices/video/tms9928a.cpp @@ -365,7 +365,7 @@ void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int par int raw_vpos = screen().vpos(); int vpos = raw_vpos * m_vertical_size / screen().height(); uint16_t BackColour = m_Regs[7] & 15; - uint32_t *p = &m_tmpbmp.pix32(vpos); + uint32_t *p = &m_tmpbmp.pix(vpos); int y = vpos - m_top_border; diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp index 0876a3b9923..e82858056e7 100644 --- a/src/devices/video/v9938.cpp +++ b/src/devices/video/v9938.cpp @@ -1863,12 +1863,12 @@ void v99x8_device::refresh_32(int line) if (m_cont_reg[9] & 0x08) { - ln = &m_bitmap.pix32(m_scanline*2+((m_stat_reg[2]>>1)&1)); + ln = &m_bitmap.pix(m_scanline*2+((m_stat_reg[2]>>1)&1)); } else { - ln = &m_bitmap.pix32(m_scanline*2); - ln2 = &m_bitmap.pix32(m_scanline*2+1); + ln = &m_bitmap.pix(m_scanline*2); + ln2 = &m_bitmap.pix(m_scanline*2+1); double_lines = true; } diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp index c493e3d3a05..6b8cae5f04f 100644 --- a/src/devices/video/vic4567.cpp +++ b/src/devices/video/vic4567.cpp @@ -20,6 +20,8 @@ #include "screen.h" +#include <algorithm> + /***************************************************************************** CONSTANTS @@ -424,105 +426,93 @@ TIMER_CALLBACK_MEMBER( vic3_device::timer_timeout ) void vic3_device::draw_character( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); + int code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = code; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = color[code >> 7]; - if ((xoff + 1 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = color[(code >> 6) & 1]; - if ((xoff + 2 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = color[(code >> 5) & 1]; - if ((xoff + 3 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = color[(code >> 4) & 1]; - if ((xoff + 4 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = color[(code >> 3) & 1]; - if ((xoff + 5 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = color[(code >> 2) & 1]; - if ((xoff + 6 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = color[(code >> 1) & 1]; - if ((xoff + 7 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = color[code & 1]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = color[code >> 7]; + if ((xoff + 1 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = color[(code >> 6) & 1]; + if ((xoff + 2 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = color[(code >> 5) & 1]; + if ((xoff + 3 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = color[(code >> 4) & 1]; + if ((xoff + 4 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = color[(code >> 3) & 1]; + if ((xoff + 5 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = color[(code >> 2) & 1]; + if ((xoff + 6 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = color[(code >> 1) & 1]; + if ((xoff + 7 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = color[code & 1]; } } void vic3_device::draw_character_multi( int ybegin, int yend, int ch, int yoff, int xoff, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); + int code = m_dma_read_cb(m_chargenaddr + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = m_foreground[code]; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_multi[code >> 6]; - if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_multi[code >> 6]; - if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = m_multi[(code >> 4) & 3]; - if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = m_multi[(code >> 4) & 3]; - if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = m_multi[(code >> 2) & 3]; - if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = m_multi[(code >> 2) & 3]; - if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = m_multi[code & 3]; - if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = m_multi[code & 3]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = m_multi[code >> 6]; + if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = m_multi[code >> 6]; + if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = m_multi[(code >> 4) & 3]; + if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = m_multi[(code >> 4) & 3]; + if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = m_multi[(code >> 2) & 3]; + if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = m_multi[(code >> 2) & 3]; + if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = m_multi[code & 3]; + if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = m_multi[code & 3]; } } void vic3_device::draw_bitmap( int ybegin, int yend, int ch, int yoff, int xoff, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); + int code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = code; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_c64_bitmap[code >> 7]; - if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_c64_bitmap[(code >> 6) & 1]; - if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = m_c64_bitmap[(code >> 5) & 1]; - if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = m_c64_bitmap[(code >> 4) & 1]; - if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = m_c64_bitmap[(code >> 3) & 1]; - if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = m_c64_bitmap[(code >> 2) & 1]; - if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = m_c64_bitmap[(code >> 1) & 1]; - if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = m_c64_bitmap[code & 1]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = m_c64_bitmap[code >> 7]; + if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = m_c64_bitmap[(code >> 6) & 1]; + if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = m_c64_bitmap[(code >> 5) & 1]; + if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = m_c64_bitmap[(code >> 4) & 1]; + if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = m_c64_bitmap[(code >> 3) & 1]; + if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = m_c64_bitmap[(code >> 2) & 1]; + if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = m_c64_bitmap[(code >> 1) & 1]; + if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = m_c64_bitmap[code & 1]; } } void vic3_device::draw_bitmap_multi( int ybegin, int yend, int ch, int yoff, int xoff, int start_x, int end_x ) { - int code; - for (int y = ybegin; y <= yend; y++) { - code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); + int code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y); m_screenptr[y + yoff][xoff >> 3] = m_foreground[code]; - if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_bitmapmulti[code >> 6]; - if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_bitmapmulti[code >> 6]; - if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 2) = m_bitmapmulti[(code >> 4) & 3]; - if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 3) = m_bitmapmulti[(code >> 4) & 3]; - if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 4) = m_bitmapmulti[(code >> 2) & 3]; - if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 5) = m_bitmapmulti[(code >> 2) & 3]; - if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 6) = m_bitmapmulti[code & 3]; - if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 7) = m_bitmapmulti[code & 3]; + if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 0) = m_bitmapmulti[code >> 6]; + if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 1) = m_bitmapmulti[code >> 6]; + if ((xoff + 2 > start_x) && (xoff + 2 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 2) = m_bitmapmulti[(code >> 4) & 3]; + if ((xoff + 3 > start_x) && (xoff + 3 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 3) = m_bitmapmulti[(code >> 4) & 3]; + if ((xoff + 4 > start_x) && (xoff + 4 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 4) = m_bitmapmulti[(code >> 2) & 3]; + if ((xoff + 5 > start_x) && (xoff + 5 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 5) = m_bitmapmulti[(code >> 2) & 3]; + if ((xoff + 6 > start_x) && (xoff + 6 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 6) = m_bitmapmulti[code & 3]; + if ((xoff + 7 > start_x) && (xoff + 7 < end_x)) m_bitmap->pix(y + yoff + FIRSTLINE, xoff + 7) = m_bitmapmulti[code & 3]; } } void vic3_device::draw_sprite_code( int y, int xbegin, int code, int color, int start_x, int end_x ) { - int mask, x; - if ((y < YPOS) || (y >= (VIC2_STARTVISIBLELINES + VIC2_VISIBLELINES)) || (xbegin <= 1) || (xbegin >= (VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS))) return; - for (x = 0, mask = 0x80; x < 8; x++, mask >>= 1) + for (int x = 0, mask = 0x80; x < 8; x++, mask >>= 1) { if (code & mask) { if ((xbegin + x > start_x) && (xbegin + x < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x) = color; + m_bitmap->pix(y + FIRSTLINE, xbegin + x) = color; } } } void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior, int start_x, int end_x ) { - int x, mask, shift; - if ((y < YPOS) || (y >= (VIC2_STARTVISIBLELINES + VIC2_VISIBLELINES)) || (xbegin <= 1) || (xbegin >= (VIC2_STARTVISIBLECOLUMNS + VIC2_VISIBLECOLUMNS))) return; - for (x = 0, mask = 0xc0, shift = 6; x < 8; x += 2, mask >>= 2, shift -= 2) + for (int x = 0, mask = 0xc0, shift = 6; x < 8; x += 2, mask >>= 2, shift -= 2) { if (code & mask) { @@ -530,17 +520,17 @@ void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior { case 1: if ((xbegin + x + 1 > start_x) && (xbegin + x + 1 < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; break; case 2: if ((xbegin + x > start_x) && (xbegin + x < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; break; case 3: if ((xbegin + x > start_x) && (xbegin + x < end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x) = m_spritemulti[(code >> shift) & 3]; if ((xbegin + x + 1> start_x) && (xbegin + x + 1< end_x)) - m_bitmap->pix16(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; + m_bitmap->pix(y + FIRSTLINE, xbegin + x + 1) = m_spritemulti[(code >> shift) & 3]; break; } } @@ -549,8 +539,6 @@ void vic3_device::draw_sprite_code_multi( int y, int xbegin, int code, int prior void vic3_device::sprite_collision( int nr, int y, int x, int mask ) { - int value, xdiff; - for (int i = 7; i > nr; i--) { if (!SPRITEON(i) || !m_sprites[i].paintedline[y] || (SPRITE_COLLISION(i) && SPRITE_COLLISION(nr))) @@ -559,8 +547,9 @@ void vic3_device::sprite_collision( int nr, int y, int x, int mask ) if ((x + 7 < SPRITE_X_POS(i)) || (x >= SPRITE_X_POS(i) + SPRITE_X_SIZE(i))) continue; - xdiff = x - SPRITE_X_POS(i); + int xdiff = x - SPRITE_X_POS(i); + int value; if ((x & 7) == (SPRITE_X_POS(i) & 7)) value = m_sprites[i].bitmap[y][xdiff >> 3]; else if (xdiff < 0) @@ -785,17 +774,6 @@ void vic3_device::draw_sprite_multi( int nr, int yoff, int ybegin, int yend, int } } -#ifndef memset16 -static void *memset16(void *dest, int value, size_t size) -{ - int i; - - for (i = 0; i < size; i++) - ((short *) dest)[i] = value; - return dest; -} -#endif - void vic3_device::drawlines( int first, int last, int start_x, int end_x ) { int line, vline, end; @@ -825,7 +803,7 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x ) { for (line = first; (line < last) && (line < m_bitmap->height()); line++) { - memset16(&m_bitmap->pix16(line + FIRSTLINE), 0, m_bitmap->width()); + std::fill_n(&m_bitmap->pix(line + FIRSTLINE), m_bitmap->width(), 0); } return; } @@ -841,7 +819,7 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x ) for (line = first; line < end; line++) { - memset16(&m_bitmap->pix16(line + FIRSTLINE), FRAMECOLOR, m_bitmap->width()); + std::fill_n(&m_bitmap->pix(line + FIRSTLINE), m_bitmap->width(), FRAMECOLOR); } if (LINES25) @@ -1013,20 +991,14 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x ) for (; line < end; line++) { - memset16(&m_bitmap->pix16(line + FIRSTLINE), FRAMECOLOR, m_bitmap->width()); + std::fill_n(&m_bitmap->pix(line + FIRSTLINE), m_bitmap->width(), FRAMECOLOR); } } void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) { - int line, vline, end; - int attr, ch, ecm; - int syend; - int offs, yoff, xoff, ybegin, yend, xbegin, xend; - int i; - if (VIC3_BITPLANES) - return ; + return; /* temporary allowing vic3 displaying 80 columns */ if (m_reg[0x31] & 0x80) @@ -1040,8 +1012,8 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) /* top part of display not rastered */ first -= VIC2_YPOS - YPOS; - xbegin = VIC2_STARTVISIBLECOLUMNS; - xend = xbegin + VIC2_VISIBLECOLUMNS; + int xbegin = VIC2_STARTVISIBLECOLUMNS; + int xend = xbegin + VIC2_VISIBLECOLUMNS; if (!SCREENON) { xbegin = VIC2_STARTVISIBLECOLUMNS; @@ -1068,12 +1040,13 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) xend = xbegin + 304; } + int end; if (first + 1 < m_y_begin) end = first + 1; else end = m_y_begin + YPOS; - line = first; + int line = first; // top border if (line < end) { @@ -1088,7 +1061,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) line = end; } - vline = line - YPOS + 3 - VERTICALPOS; + int vline = line - YPOS + 3 - VERTICALPOS; if (first + 1 < m_y_end + YPOS) end = first + 1; @@ -1097,23 +1070,23 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) if (line < end) { - offs = (vline >> 3) * 40; - ybegin = vline & 7; - yoff = line - ybegin; - yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); + int offs = (vline >> 3) * 40; + int ybegin = vline & 7; + int yoff = line - ybegin; + int yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); /* rendering 39 characters */ /* left and right borders are overwritten later */ m_shift[line] = HORIZONTALPOS; - for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) + for (int xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) { - ch = m_dma_read_cb(m_videoaddr + offs); + int ch = m_dma_read_cb(m_videoaddr + offs); #if 0 - attr = m_dma_read_color_cb(m_videoaddr + offs); + int attr = m_dma_read_color_cb(m_videoaddr + offs); #else /* temporary until vic3 finished */ - attr = m_dma_read_color_cb((m_videoaddr + offs)&0x3ff)&0x0f; + int attr = m_dma_read_color_cb((m_videoaddr + offs)&0x3ff)&0x0f; #endif if (HIRESON) { @@ -1131,7 +1104,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) } else if (ECMON) { - ecm = ch >> 6; + int ecm = ch >> 6; m_ecmcolor[0] = m_colors[ecm]; m_ecmcolor[1] = attr; draw_character(ybegin, yend, ch & ~0xC0, yoff, xoff, m_ecmcolor, start_x, end_x); @@ -1149,7 +1122,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) } /* sprite priority, sprite overwrites lowerprior pixels */ - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { if (SPRITEON (i) && (yoff + ybegin >= SPRITE_Y_POS (i)) && @@ -1158,7 +1131,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) { int wrapped = - SPRITE_Y_POS (i) + 6; - syend = yend; + int syend = yend; if (SPRITE_Y_EXPAND (i)) { @@ -1187,7 +1160,7 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x ) { int wrapped = yoff + ybegin - SPRITE_Y_POS (i); - syend = yend; + int syend = yend; if (SPRITE_Y_EXPAND (i)) { @@ -1659,77 +1632,76 @@ uint8_t vic3_device::port_r(offs_t offset) } -#define VIC3_MASK(M) \ - if (M) \ - { \ - if (M & 0x01) \ - colors[0] = m_c64_mem_r_cb(VIC3_ADDR(0) + offset); \ - if (M & 0x02) \ - colors[1] = m_c64_mem_r_cb(VIC3_ADDR(1) + offset) << 1; \ - if (M & 0x04) \ - colors[2] = m_c64_mem_r_cb(VIC3_ADDR(2) + offset) << 2; \ - if (M & 0x08) \ - colors[3] = m_c64_mem_r_cb(VIC3_ADDR(3) + offset) << 3; \ - if (M & 0x10) \ - colors[4] = m_c64_mem_r_cb(VIC3_ADDR(4) + offset) << 4; \ - if (M & 0x20) \ - colors[5] = m_c64_mem_r_cb(VIC3_ADDR(5) + offset) << 5; \ - if (M & 0x40) \ - colors[6] = m_c64_mem_r_cb(VIC3_ADDR(6) + offset) << 6; \ - if (M & 0x80) \ - colors[7] = m_c64_mem_r_cb(VIC3_ADDR(7) + offset) << 7; \ - for (i = 7; i >= 0; i--) \ - { \ - p = 0; \ - if (M & 0x01) \ - { \ - p = colors[0] & 0x01; \ - colors[0] >>= 1; \ - } \ - if (M & 0x02) \ - { \ - p |= colors[1] & 0x02; \ - colors[1] >>= 1; \ - } \ - if (M & 0x04) \ - { \ - p |= colors[2] & 0x04; \ - colors[2] >>= 1; \ - } \ - if (M & 0x08) \ - { \ - p |= colors[3] & 0x08; \ - colors[3] >>= 1; \ - } \ - if (M & 0x10) \ - { \ - p |= colors[4] & 0x10; \ - colors[4] >>= 1; \ - } \ - if (M & 0x20) \ - { \ - p |= colors[5] & 0x20; \ - colors[5] >>= 1; \ - } \ - if (M & 0x40) \ - { \ - p |= colors[6] & 0x40; \ - colors[6] >>= 1; \ - } \ - if (M & 0x80) \ - { \ - p |= colors[7] & 0x80; \ - colors[7] >>= 1; \ - } \ - m_bitmap->pix16(YPOS + y, XPOS + x + i) = p; \ - } \ +#define VIC3_MASK(M) \ + if (M) \ + { \ + if (M & 0x01) \ + colors[0] = m_c64_mem_r_cb(VIC3_ADDR(0) + offset); \ + if (M & 0x02) \ + colors[1] = m_c64_mem_r_cb(VIC3_ADDR(1) + offset) << 1; \ + if (M & 0x04) \ + colors[2] = m_c64_mem_r_cb(VIC3_ADDR(2) + offset) << 2; \ + if (M & 0x08) \ + colors[3] = m_c64_mem_r_cb(VIC3_ADDR(3) + offset) << 3; \ + if (M & 0x10) \ + colors[4] = m_c64_mem_r_cb(VIC3_ADDR(4) + offset) << 4; \ + if (M & 0x20) \ + colors[5] = m_c64_mem_r_cb(VIC3_ADDR(5) + offset) << 5; \ + if (M & 0x40) \ + colors[6] = m_c64_mem_r_cb(VIC3_ADDR(6) + offset) << 6; \ + if (M & 0x80) \ + colors[7] = m_c64_mem_r_cb(VIC3_ADDR(7) + offset) << 7; \ + for (int i = 7; i >= 0; i--) \ + { \ + int p = 0; \ + if (M & 0x01) \ + { \ + p = colors[0] & 0x01; \ + colors[0] >>= 1; \ + } \ + if (M & 0x02) \ + { \ + p |= colors[1] & 0x02; \ + colors[1] >>= 1; \ + } \ + if (M & 0x04) \ + { \ + p |= colors[2] & 0x04; \ + colors[2] >>= 1; \ + } \ + if (M & 0x08) \ + { \ + p |= colors[3] & 0x08; \ + colors[3] >>= 1; \ + } \ + if (M & 0x10) \ + { \ + p |= colors[4] & 0x10; \ + colors[4] >>= 1; \ + } \ + if (M & 0x20) \ + { \ + p |= colors[5] & 0x20; \ + colors[5] >>= 1; \ + } \ + if (M & 0x40) \ + { \ + p |= colors[6] & 0x40; \ + colors[6] >>= 1; \ + } \ + if (M & 0x80) \ + { \ + p |= colors[7] & 0x80; \ + colors[7] >>= 1; \ + } \ + m_bitmap->pix(YPOS + y, XPOS + x + i) = p; \ + } \ } #define VIC3_ADDR(a) VIC3_BITPLANE_IADDR(a) void vic3_device::interlace_draw_block( int x, int y, int offset ) { int colors[8] = {0}; - int i, p; switch (VIC3_BITPLANES_MASK) { @@ -1776,13 +1748,13 @@ void vic3_device::interlace_draw_block( int x, int y, int offset ) if (VIC3_BITPLANES_MASK & 0x80) colors[7] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(7) + offset) << 7; - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { - m_bitmap->pix16(YPOS + y, XPOS + x + i) = - (colors[0] & 0x01) | (colors[1] & 0x02) - | (colors[2] & 0x04) | (colors[3] & 0x08) - | (colors[4] & 0x10) | (colors[5] & 0x20) - | (colors[6] & 0x40) | (colors[7] & 0x80); + m_bitmap->pix(YPOS + y, XPOS + x + i) = + (colors[0] & 0x01) | (colors[1] & 0x02) | + (colors[2] & 0x04) | (colors[3] & 0x08) | + (colors[4] & 0x10) | (colors[5] & 0x20) | + (colors[6] & 0x40) | (colors[7] & 0x80); colors[0] >>= 1; colors[1] >>= 1; colors[2] >>= 1; @@ -1800,7 +1772,6 @@ void vic3_device::interlace_draw_block( int x, int y, int offset ) void vic3_device::draw_block( int x, int y, int offset ) { int colors[8] = {0}; - int i, p; switch (VIC3_BITPLANES_MASK) { @@ -1847,13 +1818,13 @@ void vic3_device::draw_block( int x, int y, int offset ) if (VIC3_BITPLANES_MASK & 0x80) colors[7] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(7) + offset) << 7; - for (i = 7; i >= 0; i--) + for (int i = 7; i >= 0; i--) { - m_bitmap->pix16(YPOS + y, XPOS + x + i) = - (colors[0] & 0x01) | (colors[1] & 0x02) - | (colors[2] & 0x04) | (colors[3] & 0x08) - | (colors[4] & 0x10) | (colors[5] & 0x20) - | (colors[6] & 0x40) | (colors[7] & 0x80); + m_bitmap->pix(YPOS + y, XPOS + x + i) = + (colors[0] & 0x01) | (colors[1] & 0x02) | + (colors[2] & 0x04) | (colors[3] & 0x08) | + (colors[4] & 0x10) | (colors[5] & 0x20) | + (colors[6] & 0x40) | (colors[7] & 0x80); colors[0] >>= 1; colors[1] >>= 1; colors[2] >>= 1; @@ -1869,17 +1840,15 @@ void vic3_device::draw_block( int x, int y, int offset ) void vic3_device::draw_bitplanes() { - int x, y, y1s, offset; - rectangle vis; const rectangle &visarea = screen().visible_area(); if (VIC3_LINES == 400) { /* interlaced! */ - for (y1s = 0, offset = 0; y1s < 400; y1s += 16) + for (int y1s = 0, offset = 0; y1s < 400; y1s += 16) { - for (x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) + for (int x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) { - for (y = y1s; y < y1s + 16; y += 2, offset++) + for (int y = y1s; y < y1s + 16; y += 2, offset++) { if (m_interlace) draw_block(x, y, offset); @@ -1892,11 +1861,11 @@ void vic3_device::draw_bitplanes() } else { - for (y1s = 0, offset = 0; y1s < 200; y1s += 8) + for (int y1s = 0, offset = 0; y1s < 200; y1s += 8) { - for (x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) + for (int x = 0; x < VIC3_BITPLANES_WIDTH; x += 8) { - for (y = y1s; y < y1s + 8; y++, offset++) + for (int y = y1s; y < y1s + 8; y++, offset++) { draw_block(x, y, offset); } @@ -1906,25 +1875,25 @@ void vic3_device::draw_bitplanes() if (XPOS > 0) { - vis.set(0, XPOS - 1, 0, visarea.bottom()); + rectangle vis(0, XPOS - 1, 0, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } if (XPOS + VIC3_BITPLANES_WIDTH < visarea.right()) { - vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.right(), 0, visarea.bottom()); + rectangle vis(XPOS + VIC3_BITPLANES_WIDTH, visarea.right(), 0, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } if (YPOS > 0) { - vis.set(0, visarea.right(), 0, YPOS - 1); + rectangle vis(0, visarea.right(), 0, YPOS - 1); m_bitmap->fill(FRAMECOLOR, vis); } if (YPOS + VIC3_LINES < visarea.bottom()) { - vis.set(0, visarea.right(), YPOS + VIC3_LINES, visarea.bottom()); + rectangle vis(0, visarea.right(), YPOS + VIC3_LINES, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } } diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index 72ef43032ef..ebc9555f25c 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -917,8 +917,8 @@ int voodoo_device::voodoo_update(bitmap_rgb32 &bitmap, const rectangle &cliprect for (y = cliprect.min_y; y <= cliprect.max_y; y++) if (y >= fbi.yoffs) { - uint16_t *src = (uint16_t *)(fbi.ram + fbi.rgboffs[drawbuf]) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; - uint32_t *dst = &bitmap.pix32(y); + uint16_t const *const src = (uint16_t *)(fbi.ram + fbi.rgboffs[drawbuf]) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; + uint32_t *const dst = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = fbi.pen[src[x]]; } @@ -944,8 +944,8 @@ int voodoo_device::voodoo_update(bitmap_rgb32 &bitmap, const rectangle &cliprect { for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t* src = (uint16_t*)(fbi.ram + fbi.auxoffs) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; - uint32_t* dst = &bitmap.pix32(y); + uint16_t const *const src = (uint16_t*)(fbi.ram + fbi.auxoffs) + (y - fbi.yoffs) * fbi.rowpixels - fbi.xoffs; + uint32_t *const dst = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = ((src[x] << 8) & 0xff0000) | ((src[x] >> 0) & 0xff00) | ((src[x] >> 8) & 0xff); } diff --git a/src/devices/video/vrender0.cpp b/src/devices/video/vrender0.cpp index f2bb5c74ac1..8a0e7c9319c 100644 --- a/src/devices/video/vrender0.cpp +++ b/src/devices/video/vrender0.cpp @@ -716,7 +716,7 @@ uint32_t vr0video_device::screen_update(screen_device &screen, bitmap_ind16 &bit uint32_t const dx = cliprect.left(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) - std::copy_n(&m_DisplayDest[(y * 1024) + dx], width, &bitmap.pix16(y, dx)); + std::copy_n(&m_DisplayDest[(y * 1024) + dx], width, &bitmap.pix(y, dx)); return 0; } diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 0c6c34e3fcc..c585373c74e 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -8,6 +8,9 @@ #include "emu.h" #include "zeus2.h" +#include <algorithm> + + #define LOG_REGS 1 // Setting ALWAYS_LOG_FIFO will always log the fifo versus having to hold 'L' #define ALWAYS_LOG_FIFO 0 @@ -236,10 +239,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap for (y = cliprect.min_y; y <= cliprect.max_y; y++) { uint32_t *colorptr = &m_frameColor[frame_addr_from_xy(0, y, false)]; - uint32_t *dest = &bitmap.pix32(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) { - dest[x] = colorptr[x]; - } + std::copy(colorptr + cliprect.min_x, colorptr + cliprect.max_x + 1, &bitmap.pix(y, cliprect.min_x)); } } @@ -265,7 +265,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap int xoffs = screen.visible_area().min_x; for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { if (1) { diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp index 6145e668a23..eb8bd09d440 100644 --- a/src/emu/crsshair.cpp +++ b/src/emu/crsshair.cpp @@ -168,7 +168,6 @@ void render_crosshair::set_default_bitmap() void render_crosshair::create_bitmap() { - int x, y; rgb_t color = m_player < ARRAY_LENGTH(crosshair_colors) ? crosshair_colors[m_player] : rgb_t::white(); // if we have a bitmap and texture for this player, kill it @@ -204,14 +203,14 @@ void render_crosshair::create_bitmap() m_bitmap->fill(rgb_t(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ - for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) + for (int y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ - u32 *dest0 = &m_bitmap->pix32(y); - u32 *dest1 = &m_bitmap->pix32(CROSSHAIR_RAW_SIZE - 1 - y); + u32 *const dest0 = &m_bitmap->pix(y); + u32 *const dest1 = &m_bitmap->pix(CROSSHAIR_RAW_SIZE - 1 - y); /* extract to two rows simultaneously */ - for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) + for (int x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = rgb_t(0xff,0x00,0x00,0x00) | color; } diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 46123a02b3f..817ae6e14cc 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -483,7 +483,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo // finally fill out the new info primlist.add_reference(scaled->bitmap); - texinfo.base = &scaled->bitmap->pix32(0); + texinfo.base = &scaled->bitmap->pix(0); texinfo.rowpixels = scaled->bitmap->rowpixels(); texinfo.width = dwidth; texinfo.height = dheight; @@ -718,8 +718,8 @@ void render_container::overlay_scale(bitmap_argb32 &dest, bitmap_argb32 &source, // simply replicate the source bitmap over the target for (int y = 0; y < dest.height(); y++) { - u32 *src = &source.pix32(y % source.height()); - u32 *dst = &dest.pix32(y); + u32 const *const src = &source.pix(y % source.height()); + u32 *dst = &dest.pix(y); int sx = 0; // loop over columns diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index 7b69a6e97e5..13249a083fc 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -664,7 +664,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight; - u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; + u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix(desty, 0) : nullptr; { for (int x = 0; x < gl.bmwidth; x++) { @@ -723,7 +723,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; ++y) { int const desty(y + m_height + m_yoffs - gl.yoffs - gl.bmheight); - u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix32(desty) : nullptr); + u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix(desty) : nullptr); if (m_format == format::TEXT) { @@ -1531,7 +1531,7 @@ bool render_font::save_cached(const char *filename, u64 length, u32 hash) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight; - const u32 *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; + u32 const *const src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix(desty) : nullptr; for (int x = 0; x < gl.bmwidth; x++) { if (src != nullptr && rgb_t(src[x]).a() != 0) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 46502185e29..de64a98bf30 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -1432,7 +1432,7 @@ private: m_bitmap.fill(0); for (int step = 0; step < 100; step += 25) for (int line = 0; line < 100; line++) - m_bitmap.pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); + m_bitmap.pix((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); // log an error if (m_alphafile.empty()) @@ -2437,8 +2437,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < dest.width(); x++) { int effx = x; @@ -2484,8 +2484,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -2597,8 +2597,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < ourwidth/num_shown; x++) { int effx = basex + x; @@ -2645,8 +2645,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = basex + curx + x; @@ -3109,8 +3109,8 @@ void layout_element::component::draw_text( int effy = bounds.top() + y; if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -3149,8 +3149,8 @@ void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest // loop over the width of the segment for (int y = 0; y < width / 2; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); int ty = (y < width / 8) ? width / 8 : y; // loop over the length of the segment @@ -3182,8 +3182,8 @@ void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, // loop over the width of the segment for (int x = 0; x < width / 2; x++) { - u32 *d0 = &dest.pix32(0, midx - x); - u32 *d1 = &dest.pix32(0, midx + x); + u32 *const d0 = &dest.pix(0, midx - x); + u32 *const d1 = &dest.pix(0, midx + x); int tx = (x < width / 8) ? width / 8 : x; // loop over the length of the segment @@ -3219,7 +3219,7 @@ void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy - width - step; y < maxy - step; y++) @@ -3244,7 +3244,7 @@ void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = miny + step; y < miny + step + width; y++) @@ -3267,8 +3267,8 @@ void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int mi // iterate over y for (u32 y = 0; y <= width; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); s32 left, right; @@ -3296,7 +3296,7 @@ void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx // draw line for (int x = minx; x < maxx; x++) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy; y < maxy - width - step; y--) @@ -3313,7 +3313,7 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) { for (int y = 0; y < dest.height(); y++) { - u32 *destrow = &dest.pix32(y); + u32 *const destrow = &dest.pix(y); int offs = skewwidth * (dest.height() - y) / dest.height(); for (int x = dest.width() - skewwidth - 1; x >= 0; x--) destrow[x + offs] = destrow[x]; diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index f3e4950f598..18755ffb340 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -42,7 +42,7 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, return; /* adjust the source base */ - const u32 *sbase = &source.pix32(0); + const u32 *sbase = &source.pix(0); /* determine the steppings */ u32 swidth = source.width(); @@ -599,11 +599,11 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname if (s == 1) for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); else if (s == 3) for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); else { osd_printf_error("Cannot read JPEG data from %s file.\n", fname); @@ -726,7 +726,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(png.palette[*src * 3], png.palette[*src * 3 + 1], png.palette[*src * 3 + 2]).brightness()); accumalpha &= alpha; @@ -741,7 +741,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -755,7 +755,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 2) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -769,7 +769,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 3) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; @@ -784,7 +784,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 4) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 8c6e69c0059..cacd16d5982 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -1730,9 +1730,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; - u16 *dst = &curbitmap.as_ind16().pix16(y); - const u16 *src = &srcbitmap.pix16(0); + const bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; + u16 *dst = &curbitmap.as_ind16().pix(y); + const u16 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < m_scan_widths[y]; x += dx) { @@ -1746,9 +1746,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; - u32 *dst = &curbitmap.as_rgb32().pix32(y); - const u32 *src = &srcbitmap.pix32(0); + const bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; + u32 *dst = &curbitmap.as_rgb32().pix(y); + const u32 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < dstwidth << 15; x += dx) { @@ -1837,10 +1837,10 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); - u64 *dst = &m_burnin.pix64(y); - const u16 *src = &srcbitmap.pix16(per_scanline ? 0 : (srcy >> 16)); - const rgb_t *palette = m_palette->palette()->entry_list_adjusted(); + const bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); + u64 *const dst = &m_burnin.pix(y); + u16 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); + rgb_t const *const palette = m_palette->palette()->entry_list_adjusted(); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = palette[src[srcx >> 16]]; @@ -1855,9 +1855,9 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); - u64 *dst = &m_burnin.pix64(y); - const u32 *src = &srcbitmap.pix32(per_scanline ? 0 : (srcy >> 16)); + const bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); + u64 *const dst = &m_burnin.pix(y); + u32 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -1900,7 +1900,7 @@ void screen_device::finalize_burnin() u64 maxval = 0; for (int y = 0; y < srcheight; y++) { - u64 *src = &m_burnin.pix64(y); + u64 const *const src = &m_burnin.pix(y); for (int x = 0; x < srcwidth; x++) { minval = std::min(minval, src[x]); @@ -1914,8 +1914,8 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - u64 *src = &m_burnin.pix64(srcy >> 16); - u32 *dst = &finalmap.pix32(y); + u64 const *const src = &m_burnin.pix(srcy >> 16); + u32 *const dst = &finalmap.pix(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { int brightness = u64(maxval - src[srcx >> 16]) * 255 / (maxval - minval); diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index fab04e8f162..4252b9259a2 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -860,8 +860,8 @@ u8 tilemap_t::tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 u8 andmask = ~0, ormask = 0; for (u16 ty = 0; ty < m_tileheight; ty++) { - u16 *pixptr = &m_pixmap.pix16(y0, x0); - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u16 *pixptr = &m_pixmap.pix(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); // pre-advance to the next row y0 += dy0; @@ -913,7 +913,7 @@ u8 tilemap_t::tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category for (u16 ty = 0; ty < m_tileheight; ty++) { // pre-advance to the next row - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); y0 += dy0; // anywhere the bitmask is 0 should be transparent @@ -1182,7 +1182,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // look up priority and destination base addresses for y1 bitmap_ind8 &priority_bitmap = *blit.priority; - u8 *priority_baseaddr = &priority_bitmap.pix8(y1, xpos); + u8 *priority_baseaddr = &priority_bitmap.pix(y1, xpos); typename _BitmapClass::pixel_t *dest_baseaddr = nullptr; int dest_rowpixels = 0; if (dest.valid()) @@ -1198,8 +1198,8 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b y2 -= ypos; // get tilemap pixels - const u16 *source_baseaddr = &m_pixmap.pix16(y1); - const u8 *mask_baseaddr = &m_flagsmap.pix8(y1); + const u16 *source_baseaddr = &m_pixmap.pix(y1); + const u8 *mask_baseaddr = &m_flagsmap.pix(y1); // get start/stop columns, rounding outward int mincol = x1 / m_tilewidth; @@ -1396,9 +1396,9 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c u32 cy = starty >> 16; // get source and priority pointers - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; - const u16 *src = &m_pixmap.pix16(cy); - const u8 *maskptr = &m_flagsmap.pix8(cy); + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; + const u16 *src = &m_pixmap.pix(cy); + const u8 *maskptr = &m_flagsmap.pix(cy); typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); // loop over columns @@ -1440,15 +1440,15 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we match the mask - if ((m_flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((m_flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + ROZ_PLOT_PIXEL(m_pixmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } @@ -1482,16 +1482,16 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we're within the bitmap and we match the mask if (cx < widthshifted && cy < heightshifted) - if ((m_flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((m_flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16(cy >> 16, cx >> 16)); + ROZ_PLOT_PIXEL(m_pixmap.pix(cy >> 16, cx >> 16)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index e28e6aa1bae..6f88d9ae03d 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -1075,9 +1075,9 @@ void video_manager::create_snapshot_bitmap(screen_device *screen) render_primitive_list &primlist = m_snap_target->get_primitives(); primlist.acquire_lock(); if (machine().options().snap_bilinear()) - snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); else - snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); primlist.release_lock(); } diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 92bdd3ada64..cfcb6175dc5 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -392,9 +392,9 @@ menu_select_launch::cache::cache(running_machine &machine) // create a texture for snapshot m_snapx_texture.reset(render.texture_alloc(render_texture::hq_scale)); - std::memcpy(&m_no_avail_bitmap.pix32(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t)); + std::memcpy(&m_no_avail_bitmap.pix(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t)); - std::memcpy(&m_star_bitmap.pix32(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_star_bitmap.pix(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t)); m_star_texture.reset(render.texture_alloc()); m_star_texture->set_bitmap(m_star_bitmap, m_star_bitmap.cliprect(), TEXFORMAT_ARGB32); @@ -410,7 +410,7 @@ menu_select_launch::cache::cache(running_machine &machine) m_toolbar_texture.emplace_back(render.texture_alloc(), render); m_sw_toolbar_texture.emplace_back(render.texture_alloc(), render); - std::memcpy(&m_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_toolbar_bitmap.back().pix(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); if (m_toolbar_bitmap.back().valid()) m_toolbar_texture.back()->set_bitmap(m_toolbar_bitmap.back(), m_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32); else @@ -418,7 +418,7 @@ menu_select_launch::cache::cache(running_machine &machine) if ((i == 0U) || (i == 2U)) { - std::memcpy(&m_sw_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_sw_toolbar_bitmap.back().pix(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); if (m_sw_toolbar_bitmap.back().valid()) m_sw_toolbar_texture.back()->set_bitmap(m_sw_toolbar_bitmap.back(), m_sw_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32); else @@ -1147,7 +1147,7 @@ bool menu_select_launch::scale_icon(bitmap_argb32 &&src, texture_and_bitmap &dst dst.bitmap.allocate(max_width, max_height); for (int y = 0; tmp.height() > y; ++y) for (int x = 0; tmp.width() > x; ++x) - dst.bitmap.pix32(y, x) = tmp.pix32(y, x); + dst.bitmap.pix(y, x) = tmp.pix(y, x); dst.texture->set_bitmap(dst.bitmap, dst.bitmap.cliprect(), TEXFORMAT_ARGB32); return true; } @@ -2412,7 +2412,7 @@ void menu_select_launch::arts_render_images(bitmap_argb32 &&tmp_bitmap, float or for (int x = 0; x < 256; x++) { for (int y = 0; y < 256; y++) - tmp_bitmap.pix32(y, x) = src.pix32(y, x); + tmp_bitmap.pix(y, x) = src.pix(y, x); } no_available = true; } @@ -2475,7 +2475,7 @@ void menu_select_launch::arts_render_images(bitmap_argb32 &&tmp_bitmap, float or for (int x = 0; x < dest_xPixel; x++) for (int y = 0; y < dest_yPixel; y++) - snapx_bitmap.pix32(y + y1, x + x1) = dest_bitmap.pix32(y, x); + snapx_bitmap.pix(y + y1, x + x1) = dest_bitmap.pix(y, x); // apply bitmap m_cache->snapx_texture()->set_bitmap(snapx_bitmap, snapx_bitmap.cliprect(), TEXFORMAT_ARGB32); diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index ff16d117117..c229110caac 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -216,7 +216,7 @@ void mame_ui_manager::init() config_save_delegate(&mame_ui_manager::config_save, this)); // create mouse bitmap - uint32_t *dst = &m_mouse_bitmap.pix32(0); + uint32_t *dst = &m_mouse_bitmap.pix(0); memcpy(dst,mouse_bitmap,32*32*sizeof(uint32_t)); m_mouse_arrow_texture = machine().render().texture_alloc(); m_mouse_arrow_texture->set_bitmap(m_mouse_bitmap, m_mouse_bitmap.cliprect(), TEXFORMAT_ARGB32); diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp index 5b4d187bc95..bc6dee9cd47 100644 --- a/src/frontend/mame/ui/viewgfx.cpp +++ b/src/frontend/mame/ui/viewgfx.cpp @@ -994,18 +994,16 @@ static void gfxset_draw_item(running_machine &machine, gfx_element &gfx, int ind { int width = (rotate & ORIENTATION_SWAP_XY) ? gfx.height() : gfx.width(); int height = (rotate & ORIENTATION_SWAP_XY) ? gfx.width() : gfx.height(); - const rgb_t *palette = dpalette->palette()->entry_list_raw() + gfx.colorbase() + color * gfx.granularity(); - - int x, y; + rgb_t const *const palette = dpalette->palette()->entry_list_raw() + gfx.colorbase() + color * gfx.granularity(); // loop over rows in the cell - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { - uint32_t *dest = &bitmap.pix32(dsty + y, dstx); + uint32_t *dest = &bitmap.pix(dsty + y, dstx); const uint8_t *src = gfx.get_data(index); // loop over columns in the cell - for (x = 0; x < width; x++) + for (int x = 0; x < width; x++) { int effx = x, effy = y; const uint8_t *s; diff --git a/src/frontend/mame/ui/widgets.cpp b/src/frontend/mame/ui/widgets.cpp index d8907303b36..59fda0f203c 100644 --- a/src/frontend/mame/ui/widgets.cpp +++ b/src/frontend/mame/ui/widgets.cpp @@ -36,7 +36,7 @@ widgets_manager::widgets_manager(running_machine &machine) for (unsigned x = 0; x < 256; ++x) { unsigned const alpha((x < 25) ? (0xff * x / 25) : (x >(256 - 25)) ? (0xff * (255 - x) / 25) : 0xff); - m_hilight_bitmap->pix32(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); + m_hilight_bitmap->pix(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); } m_hilight_texture.reset(render.texture_alloc()); m_hilight_texture->set_bitmap(*m_hilight_bitmap, m_hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -49,7 +49,7 @@ widgets_manager::widgets_manager(running_machine &machine) unsigned const r = r1 + (y * (r2 - r1) / 128); unsigned const g = g1 + (y * (g2 - g1) / 128); unsigned const b = b1 + (y * (b2 - b1) / 128); - m_hilight_main_bitmap->pix32(y, 0) = rgb_t(r, g, b); + m_hilight_main_bitmap->pix(y, 0) = rgb_t(r, g, b); } m_hilight_main_texture.reset(render.texture_alloc()); m_hilight_main_texture->set_bitmap(*m_hilight_main_bitmap, m_hilight_main_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -67,18 +67,17 @@ widgets_manager::widgets_manager(running_machine &machine) void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) { - int halfwidth = dest.width() / 2; - int height = dest.height(); - int x, y; + int const halfwidth = dest.width() / 2; + int const height = dest.height(); // start with all-transparent dest.fill(rgb_t(0x00, 0x00, 0x00, 0x00)); // render from the tip to the bottom - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height; - uint32_t *target = &dest.pix32(y, halfwidth); + uint32_t *const target = &dest.pix(y, halfwidth); // don't antialias if height < 12 if (dest.height() < 12) @@ -89,25 +88,23 @@ void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source } // loop while we still have data to generate - for (x = 0; linewidth > 0; x++) + for (int x = 0; linewidth > 0; x++) { int dalpha; - - // first column we only consume one pixel if (x == 0) { + // first column we only consume one pixel dalpha = std::min(0xff, linewidth); target[x] = rgb_t(dalpha, 0xff, 0xff, 0xff); } - - // remaining columns consume two pixels, one on each side else { + // remaining columns consume two pixels, one on each side dalpha = std::min(0x1fe, linewidth); target[x] = target[-x] = rgb_t(dalpha / 2, 0xff, 0xff, 0xff); } - // account for the weight we consumed */ + // account for the weight we consumed linewidth -= dalpha; } } diff --git a/src/lib/util/avhuff.cpp b/src/lib/util/avhuff.cpp index 50eea9f24dc..ac5cea71526 100644 --- a/src/lib/util/avhuff.cpp +++ b/src/lib/util/avhuff.cpp @@ -691,24 +691,19 @@ avhuff_decoder::avhuff_decoder() } /** - * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) + * @fn void avhuff_decoder::configure(const config &cfg) * * @brief ------------------------------------------------- * configure - configure decompression parameters * -------------------------------------------------. * - * @param config The configuration. + * @param cfg The configuration. */ -void avhuff_decoder::configure(const avhuff_decompress_config &config) +void avhuff_decoder::configure(const config &cfg) { - m_config.video.wrap(config.video, config.video.cliprect()); - m_config.maxsamples = config.maxsamples; - m_config.actsamples = config.actsamples; - memcpy(m_config.audio, config.audio, sizeof(m_config.audio)); - m_config.maxmetalength = config.maxmetalength; - m_config.actmetalength = config.actmetalength; - m_config.metadata = config.metadata; + m_video.wrap(*cfg.video, cfg.video->cliprect()); + m_config = cfg; } /** @@ -792,9 +787,9 @@ avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complen // determine the start of each piece of data metastart = m_config.metadata; for (int chnum = 0; chnum < channels; chnum++) - audiostart[chnum] = (uint8_t *)m_config.audio[chnum]; - videostart = (m_config.video.valid()) ? reinterpret_cast<uint8_t *>(&m_config.video.pix(0)) : nullptr; - videostride = (m_config.video.valid()) ? m_config.video.rowpixels() * 2 : 0; + audiostart[chnum] = reinterpret_cast<uint8_t *>(m_config.audio[chnum]); + videostart = m_video.valid() ? reinterpret_cast<uint8_t *>(&m_video.pix(0)) : nullptr; + videostride = m_video.valid() ? m_video.rowpixels() * 2 : 0; // data is assumed to be native-endian uint16_t betest = 0; @@ -802,7 +797,7 @@ avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complen audioxor = videoxor = (betest == 1) ? 1 : 0; // verify against sizes - if (m_config.video.valid() && (m_config.video.width() < width || m_config.video.height() < height)) + if (m_video.valid() && (m_video.width() < width || m_video.height() < height)) return AVHERR_VIDEO_TOO_LARGE; for (int chnum = 0; chnum < channels; chnum++) if (m_config.audio[chnum] != nullptr && m_config.maxsamples < samples) diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h index 90ef43e977f..83b46195d6b 100644 --- a/src/lib/util/avhuff.h +++ b/src/lib/util/avhuff.h @@ -19,6 +19,8 @@ #include "huffman.h" #include "flac.h" +#include <algorithm> + //************************************************************************** // CONSTANTS @@ -49,32 +51,6 @@ enum avhuff_error // TYPE DEFINITIONS //************************************************************************** -// ======================> av_codec_decompress_config - -// decompression configuration -class avhuff_decompress_config -{ -public: - avhuff_decompress_config() - : maxsamples(0), - actsamples(nullptr), - maxmetalength(0), - actmetalength(nullptr), - metadata(nullptr) - { - memset(audio, 0, sizeof(audio)); - } - - bitmap_yuy16 video; // pointer to video bitmap - uint32_t maxsamples; // maximum number of samples per channel - uint32_t * actsamples; // actual number of samples per channel - int16_t * audio[16]; // pointer to individual audio channels - uint32_t maxmetalength; // maximum length of metadata - uint32_t * actmetalength; // actual length of metadata - uint8_t * metadata; // pointer to metadata buffer -}; - - // ======================> avhuff_encoder // core state for the codec @@ -98,8 +74,7 @@ private: { public: // construction/destruction - deltarle_encoder() - : m_rlecount(0) { } + deltarle_encoder() { } // histogramming uint16_t *rle_and_histo_bitmap(const uint8_t *source, uint32_t items_per_row, uint32_t item_advance, uint32_t row_count); @@ -111,7 +86,7 @@ private: private: // internal state - int m_rlecount; + int m_rlecount = 0; huffman_encoder<256 + 16> m_encoder; std::vector<uint16_t> m_rlebuffer; }; @@ -143,11 +118,30 @@ private: class avhuff_decoder { public: + // decompression configuration + class config + { + public: + config() + { + std::fill(std::begin(audio), std::end(audio), nullptr); + } + + bitmap_yuy16 * video = nullptr; // pointer to video bitmap + uint32_t maxsamples = 0; // maximum number of samples per channel + uint32_t * actsamples = nullptr; // actual number of samples per channel + int16_t * audio[16]; // pointer to individual audio channels + uint32_t maxmetalength = 0; // maximum length of metadata + uint32_t * actmetalength = nullptr; // actual length of metadata + uint8_t * metadata = nullptr; // pointer to metadata buffer + }; + + // construction/destruction avhuff_decoder(); // configuration - void configure(const avhuff_decompress_config &config); + void configure(const config &cfg); // encode/decode avhuff_error decode_data(const uint8_t *source, uint32_t complength, uint8_t *dest); @@ -158,8 +152,7 @@ private: { public: // construction/destruction - deltarle_decoder() - : m_rlecount(0), m_prevdata(0) { } + deltarle_decoder() { } // general void reset() { m_rlecount = m_prevdata = 0; } @@ -171,8 +164,8 @@ private: private: // internal state - int m_rlecount; - uint8_t m_prevdata; + int m_rlecount = 0; + uint8_t m_prevdata = 0; huffman_decoder<256 + 16> m_decoder; }; @@ -183,7 +176,8 @@ private: avhuff_error decode_video_lossless(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor); // internal state - avhuff_decompress_config m_config; + bitmap_yuy16 m_video; + config m_config; // video decoding contexts deltarle_decoder m_ycontext; diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 8722017d3e8..7f74920f06b 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -999,7 +999,7 @@ avi_file::error avi_stream::rgb32_compress_to_rgb(const bitmap_rgb32 &bitmap, st /* compressed video */ for (y = 0; y < height; y++) { - const std::uint32_t *source = &bitmap.pix32(y); + const std::uint32_t *source = &bitmap.pix(y); std::uint8_t *dest = data + (m_height - 1 - y) * m_width * 3; for (x = 0; x < width && dest < dataend; x++) @@ -1062,7 +1062,7 @@ avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, st for (y = 0; y < m_height; y++) { const std::uint16_t *source = reinterpret_cast<const std::uint16_t *>(data) + y * m_width; - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *dest = &bitmap.pix(y); /* switch off the compression */ switch (m_format) @@ -1113,7 +1113,7 @@ avi_file::error avi_stream::yuy16_compress_to_yuy(const bitmap_yuy16 &bitmap, st /* compressed video */ for (y = 0; y < m_height; y++) { - const std::uint16_t *source = &bitmap.pix16(y); + const std::uint16_t *source = &bitmap.pix(y); std::uint16_t *dest = reinterpret_cast<std::uint16_t *>(data) + y * m_width; /* switch off the compression */ @@ -1298,7 +1298,7 @@ avi_file::error avi_stream::huffyuv_decompress_to_yuy16(const std::uint8_t *data /* compressed video */ for (y = 0; y < m_height; y++) { - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *dest = &bitmap.pix(y); /* handle the first four bytes independently */ x = 0; @@ -1386,8 +1386,8 @@ avi_file::error avi_stream::huffyuv_decompress_to_yuy16(const std::uint8_t *data lastprevy = lastprevcb = lastprevcr = 0; for (y = 0; y < m_height; y++) { - std::uint16_t *prevrow = &bitmap.pix16(y - prevlines); - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *prevrow = &bitmap.pix(y - prevlines); + std::uint16_t *dest = &bitmap.pix(y); /* handle the first four bytes independently */ x = 0; @@ -1500,7 +1500,7 @@ avi_file::error avi_stream::uncompressed_rgb24_to_argb32(const std::uint8_t *dat /* uncompressed video */ for (int y = 0; y < m_height; y++) { - std::uint32_t *dest = &bitmap.pix32(y); + std::uint32_t *dest = &bitmap.pix(y); /* loop over pixels */ for (int x = 0; x < m_width; x++) @@ -1530,7 +1530,7 @@ avi_file::error avi_stream::uncompressed_yuv420p_to_argb32(const std::uint8_t *d /* uncompressed video */ for (int y = 0; y < m_height; y++) { - std::uint32_t *dest = &bitmap.pix32(y); + std::uint32_t *dest = &bitmap.pix(y); /* loop over pixels */ for (int x = 0; x < m_width; x++) diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp index 2b7cd74b5a1..fc05b89f1b6 100644 --- a/src/lib/util/bitmap.cpp +++ b/src/lib/util/bitmap.cpp @@ -10,7 +10,6 @@ #include "bitmap.h" -#include <algorithm> #include <cassert> #include <new> @@ -360,7 +359,7 @@ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) * @param subrect The subrect. */ -void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) +void bitmap_t::wrap(bitmap_t &source, const rectangle &subrect) { assert(m_format == source.m_format); assert(m_bpp == source.m_bpp); @@ -406,7 +405,7 @@ void bitmap_t::set_palette(palette_t *palette) } /** - * @fn void bitmap_t::fill(uint32_t color, const rectangle &cliprect) + * @fn void bitmap_t::fill(uint64_t color, const rectangle &bounds) * * @brief ------------------------------------------------- * fill -- fill a bitmap with a solid color @@ -416,10 +415,10 @@ void bitmap_t::set_palette(palette_t *palette) * @param cliprect The cliprect. */ -void bitmap_t::fill(uint32_t color, const rectangle &cliprect) +void bitmap_t::fill(uint64_t color, const rectangle &bounds) { // if we have a cliprect, intersect with that - rectangle fill(cliprect); + rectangle fill(bounds); fill &= m_cliprect; if (!fill.empty()) { @@ -448,3 +447,13 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect) } } } + + +//************************************************************************** +// EXPLICIT TEMPLATE INSTANTIATIONS +//************************************************************************** + +template class bitmap_specific<uint8_t>; +template class bitmap_specific<uint16_t>; +template class bitmap_specific<uint32_t>; +template class bitmap_specific<uint64_t>; diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h index ed6a5382a61..57ed0bc1775 100644 --- a/src/lib/util/bitmap.h +++ b/src/lib/util/bitmap.h @@ -16,6 +16,9 @@ #include "osdcore.h" #include "palette.h" +#include <algorithm> +#include <memory> + //************************************************************************** // TYPE DEFINITIONS @@ -151,23 +154,23 @@ public: // operations void set_palette(palette_t *palette); - void fill(uint32_t color) { fill(color, m_cliprect); } - void fill(uint32_t color, const rectangle &cliprect); - void plot_box(int x, int y, int width, int height, uint32_t color) + void fill(uint64_t color) { fill(color, m_cliprect); } + void fill(uint64_t color, const rectangle &bounds); + void plot_box(int32_t x, int32_t y, int32_t width, int32_t height, uint64_t color) { - rectangle clip(x, x + width - 1, y, y + height - 1); - fill(color, clip); + fill(color, rectangle(x, x + width - 1, y, y + height - 1)); } // pixel access - template<typename PixelType> - PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } - void *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } + void *raw_pixptr(int32_t y, int32_t x = 0) { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } + void const *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } protected: // for use by subclasses only to ensure type correctness + template <typename PixelType> PixelType &pixt(int32_t y, int32_t x = 0) { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } + template <typename PixelType> PixelType const &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } void wrap(void *base, int width, int height, int rowpixels); - void wrap(const bitmap_t &source, const rectangle &subrect); + void wrap(bitmap_t &source, const rectangle &subrect); private: // internal helpers @@ -191,17 +194,17 @@ private: // ======================> bitmap_specific, bitmap8_t, bitmap16_t, bitmap32_t, bitmap64_t -template<typename PixelType> +template <typename PixelType> class bitmap_specific : public bitmap_t { - static constexpr int PixelBits = 8 * sizeof(PixelType); + static constexpr int PIXEL_BITS = 8 * sizeof(PixelType); protected: // construction/destruction -- subclasses only bitmap_specific(bitmap_specific<PixelType> &&) = default; - bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PixelBits, width, height, xslop, yslop) { } - bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PixelBits, base, width, height, rowpixels) { } - bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PixelBits, source, subrect) { } + bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PIXEL_BITS, width, height, xslop, yslop) { } + bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PIXEL_BITS, base, width, height, rowpixels) { } + bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PIXEL_BITS, source, subrect) { } bitmap_specific<PixelType> &operator=(bitmap_specific<PixelType> &&) = default; @@ -209,27 +212,46 @@ public: using pixel_t = PixelType; // getters - uint8_t bpp() const { return PixelBits; } + uint8_t bpp() const { return PIXEL_BITS; } // pixel accessors - PixelType &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } - PixelType &pix8(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 8, "must be 8bpp"); return pixt<PixelType>(y, x); } - PixelType &pix16(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 16, "must be 16bpp"); return pixt<PixelType>(y, x); } - PixelType &pix32(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 32, "must be 32bpp"); return pixt<PixelType>(y, x); } - PixelType &pix64(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 64, "must be 64bpp"); return pixt<PixelType>(y, x); } + PixelType &pix(int32_t y, int32_t x = 0) { return pixt<PixelType>(y, x); } + PixelType const &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } + + // operations + void fill(PixelType color) { fill(color, cliprect()); } + void fill(PixelType color, const rectangle &bounds) + { + // if we have a cliprect, intersect with that + rectangle fill(bounds); + fill &= cliprect(); + if (!fill.empty()) + { + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + std::fill_n(&pix(y, fill.left()), fill.width(), color); + } + } + void plot_box(int32_t x, int32_t y, int32_t width, int32_t height, PixelType color) + { + fill(color, rectangle(x, x + width - 1, y, y + height - 1)); + } }; // 8bpp bitmaps using bitmap8_t = bitmap_specific<uint8_t>; +extern template class bitmap_specific<uint8_t>; // 16bpp bitmaps using bitmap16_t = bitmap_specific<uint16_t>; +extern template class bitmap_specific<uint16_t>; // 32bpp bitmaps using bitmap32_t = bitmap_specific<uint32_t>; +extern template class bitmap_specific<uint32_t>; // 64bpp bitmaps using bitmap64_t = bitmap_specific<uint64_t>; +extern template class bitmap_specific<uint64_t>; // ======================> bitmap_ind8, bitmap_ind16, bitmap_ind32, bitmap_ind64 @@ -246,7 +268,7 @@ public: bitmap_ind8(uint8_t *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind8(bitmap_ind8 &source, const rectangle &subrect) : bitmap8_t(k_bitmap_format, source, subrect) { } void wrap(uint8_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -266,7 +288,7 @@ public: bitmap_ind16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind16(bitmap_ind16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { } void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -286,7 +308,7 @@ public: bitmap_ind32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind32(bitmap_ind32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -306,7 +328,7 @@ public: bitmap_ind64(uint64_t *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind64(bitmap_ind64 &source, const rectangle &subrect) : bitmap64_t(k_bitmap_format, source, subrect) { } void wrap(uint64_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -329,7 +351,7 @@ public: bitmap_yuy16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_yuy16(bitmap_yuy16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { } void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -349,7 +371,7 @@ public: bitmap_rgb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_rgb32(bitmap_rgb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -369,7 +391,7 @@ public: bitmap_argb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_argb32(bitmap_argb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -377,5 +399,4 @@ public: bitmap_argb32 &operator=(bitmap_argb32 &&) = default; }; - -#endif // MAME_UTIL_BITMAP_H +#endif // MAME_UTIL_BITMAP_H diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp index 58f7b4291db..7f6e0f018cd 100644 --- a/src/lib/util/chdcodec.cpp +++ b/src/lib/util/chdcodec.cpp @@ -1786,7 +1786,7 @@ void chd_avhuff_decompressor::configure(int param, void *config) { // if we're getting the decompression configuration, apply it now if (param == AVHUFF_CODEC_DECOMPRESS_CONFIG) - m_decoder.configure(*reinterpret_cast<avhuff_decompress_config *>(config)); + m_decoder.configure(*reinterpret_cast<avhuff_decoder::config const *>(config)); // anything else is invalid else diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index 6b59436750c..69835e54051 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -519,7 +519,7 @@ public: accumalpha &= alpha; std::uint16_t const paloffs(std::uint16_t(*src) * 3); rgb_t const pix(alpha, pnginfo.palette[paloffs], pnginfo.palette[paloffs + 1], pnginfo.palette[paloffs + 2]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -537,7 +537,7 @@ public: std::uint8_t const a_val((pnginfo.trans && (transpen == i_val)) ? 0x00 : 0xff); i_val >>= samp_shift; accumalpha &= a_val; - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, i_val, i_val, i_val); + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, i_val, i_val, i_val); } } } @@ -552,7 +552,7 @@ public: { accumalpha &= src[a]; rgb_t const pix(src[a], src[i], src[i], src[i]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -578,7 +578,7 @@ public: g_val >>= samp_shift; b_val >>= samp_shift; accumalpha &= a_val; - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, r_val, g_val, b_val); + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, r_val, g_val, b_val); } } } @@ -595,7 +595,7 @@ public: { accumalpha &= src[a]; rgb_t const pix(src[a], src[r], src[g], src[b]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -1042,7 +1042,7 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo.height; y++) { - auto *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + uint16_t const *src = reinterpret_cast<uint16_t const *>(bitmap.raw_pixptr(y)); uint8_t *dst = &pnginfo.image[y * (rowbytes + 1)]; /* store the filter byte, then copy the data */ @@ -1088,7 +1088,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 16bpp palettized format */ if (bitmap.format() == BITMAP_FORMAT_IND16) { - auto *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + uint16_t const *src16 = reinterpret_cast<uint16_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t color = palette[*src16++]; @@ -1101,7 +1101,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit RGB direct */ else if (bitmap.format() == BITMAP_FORMAT_RGB32) { - auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + uint32_t const *src32 = reinterpret_cast<uint32_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; @@ -1114,7 +1114,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit ARGB direct */ else if (bitmap.format() == BITMAP_FORMAT_ARGB32) { - auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + uint32_t const *src32 = reinterpret_cast<uint32_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; diff --git a/src/mame/drivers/1945kiii.cpp b/src/mame/drivers/1945kiii.cpp index db424a83f54..1f78b084df1 100644 --- a/src/mame/drivers/1945kiii.cpp +++ b/src/mame/drivers/1945kiii.cpp @@ -234,8 +234,8 @@ void k3_state::k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_eleme { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp index 1d8ca3d4af0..387a2362366 100644 --- a/src/mame/drivers/5clown.cpp +++ b/src/mame/drivers/5clown.cpp @@ -553,7 +553,7 @@ MC6845_UPDATE_ROW(_5clown_state::update_row) x--- ---- Extra color for 7's. */ - uint32_t *pix = &bitmap.pix32(y); + uint32_t *pix = &bitmap.pix(y); ra &= 0x07; for (int x = 0; x < x_count; x++) diff --git a/src/mame/drivers/a5105.cpp b/src/mame/drivers/a5105.cpp index d8ffbbcc55c..3525ce5b51d 100644 --- a/src/mame/drivers/a5105.cpp +++ b/src/mame/drivers/a5105.cpp @@ -120,7 +120,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels ) { int const pen = ((gfx >> xi) & 1) ? 7 : 0; - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } @@ -151,7 +151,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text ) pen = 0; if (m_screen->visible_area().contains(res_x+0, res_y)) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/a7150.cpp b/src/mame/drivers/a7150.cpp index 66250419e21..92a3327b452 100644 --- a/src/mame/drivers/a7150.cpp +++ b/src/mame/drivers/a7150.cpp @@ -122,18 +122,17 @@ private: uint32_t a7150_state::screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b; int addr = 0; - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { int horpos = 0; - for (x = 0; x < 80; x++) + for (int x = 0; x < 80; x++) { uint8_t code = m_video_ram[addr++]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? 1 : 0; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? 1 : 0; } } } diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp index f93a40832ae..6a1c050195e 100644 --- a/src/mame/drivers/accomm.cpp +++ b/src/mame/drivers/accomm.cpp @@ -234,7 +234,7 @@ inline uint8_t accomm_state::read_vram(uint16_t addr) inline void accomm_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t accomm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/acefruit.cpp b/src/mame/drivers/acefruit.cpp index c41d958d314..f8fc8e8b065 100644 --- a/src/mame/drivers/acefruit.cpp +++ b/src/mame/drivers/acefruit.cpp @@ -149,16 +149,14 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in { int startrow = cliprect.min_y / 8; int endrow = cliprect.max_y / 8; - int row; - int col; - for( row = startrow; row <= endrow; row++ ) + for( int row = startrow; row <= endrow; row++ ) { int spriterow = 0; int spriteindex = 0; int spriteparameter = 0; - for( col = 0; col < 32; col++ ) + for( int col = 0; col < 32; col++ ) { int tile_index = ( col * 32 ) + row; int code = m_videoram[ tile_index ]; @@ -170,20 +168,18 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in } else if( color >= 0x5 && color <= 0x7 ) { - int y; - int x; static const int spriteskip[] = { 1, 2, 4 }; int spritesize = spriteskip[ color - 5 ]; gfx_element *gfx = m_gfxdecode->gfx(0); - for( x = 0; x < 16; x++ ) + for( int x = 0; x < 16; x++ ) { int sprite = ( m_spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf; const uint8_t *gfxdata = gfx->get_data(sprite); - for( y = 0; y < 8; y++ ) + for( int y = 0; y < 8; y++ ) { - uint16_t *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) ); + uint16_t *dst = &bitmap.pix(y + ( row * 8 ), x + ( col * 16 ) ); *( dst ) = *( gfxdata + ( ( spriterow + y ) * gfx->rowbytes() ) + ( ( spriteindex % 64 ) >> 1 ) ); } @@ -192,14 +188,11 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in } else { - int y; - int x; - - for( x = 0; x < 16; x++ ) + for( int x = 0; x < 16; x++ ) { - for( y = 0; y < 8; y++ ) + for( int y = 0; y < 8; y++ ) { - uint16_t *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) ); + uint16_t *dst = &bitmap.pix(y + ( row * 8 ), x + ( col * 16 ) ); *( dst ) = 0; } } diff --git a/src/mame/drivers/adacp150.cpp b/src/mame/drivers/adacp150.cpp index 3c20a6a82e7..1243bf7a279 100644 --- a/src/mame/drivers/adacp150.cpp +++ b/src/mame/drivers/adacp150.cpp @@ -74,7 +74,7 @@ void adacp150_state::machine_start() HD44780_PIXEL_UPDATE(adacp150_state::pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/adm11.cpp b/src/mame/drivers/adm11.cpp index f976f7da444..e21e34ee018 100644 --- a/src/mame/drivers/adm11.cpp +++ b/src/mame/drivers/adm11.cpp @@ -93,7 +93,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(adm11_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/aleck64.cpp b/src/mame/drivers/aleck64.cpp index 48eb265d078..b0d380bffe0 100644 --- a/src/mame/drivers/aleck64.cpp +++ b/src/mame/drivers/aleck64.cpp @@ -1085,10 +1085,6 @@ uint32_t aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &b for(int offs=0;offs<0x1000/4;offs+=2) { - int xi,yi; - int r,g,b; - int pal_offs; - int pal_shift; // 0x400 is another enable? end code if off? //uint16_t tile = m_e90_vram[offs] >> 16; @@ -1113,28 +1109,26 @@ uint32_t aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &b // some pieces needs this color adjustment (see T piece / 5 block version of I piece) pal |= (attr & 0xc0) >> 4; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - uint16_t raw_rgb; - res_x = x+xi + 4; - res_y = (y & 0xff)+yi + 7; + int res_x = x+xi + 4; + int res_y = (y & 0xff)+yi + 7; - pal_offs = (pal*0x10); + int pal_offs = (pal*0x10); pal_offs+= pal_table[xi+yi*8]; - pal_shift = pal_offs & 1 ? 0 : 16; - raw_rgb = m_e90_pal[pal_offs>>1] >> pal_shift; - r = (raw_rgb & 0x001f) >> 0; - g = (raw_rgb & 0x03e0) >> 5; - b = (raw_rgb & 0x7c00) >> 10; + int pal_shift = pal_offs & 1 ? 0 : 16; + uint16_t raw_rgb = m_e90_pal[pal_offs>>1] >> pal_shift; + int r = (raw_rgb & 0x001f) >> 0; + int g = (raw_rgb & 0x03e0) >> 5; + int b = (raw_rgb & 0x7c00) >> 10; r = pal5bit(r); g = pal5bit(g); b = pal5bit(b); if(cliprect.contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b; + bitmap.pix(res_y, res_x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp index 36759cd6af8..1b02744e3bb 100644 --- a/src/mame/drivers/alesis.cpp +++ b/src/mame/drivers/alesis.cpp @@ -411,7 +411,7 @@ HD44780_PIXEL_UPDATE(alesis_state::sr16_pixel_update) if (line == 1 && pos >= 6 && pos < 8) // last 2 characters of the second line are used to control the LCD symbols update_lcd_symbols(bitmap, pos, y, x, state); else if (pos < 8) - bitmap.pix16(line*9 + y, pos*6 + x) = state; + bitmap.pix(line*9 + y, pos*6 + x) = state; } void alesis_state::hr16(machine_config &config) diff --git a/src/mame/drivers/alfaskop41xx.cpp b/src/mame/drivers/alfaskop41xx.cpp index 30bb0733266..103f9897616 100644 --- a/src/mame/drivers/alfaskop41xx.cpp +++ b/src/mame/drivers/alfaskop41xx.cpp @@ -285,14 +285,14 @@ template <unsigned N> void alfaskop4110_state::irq_w(int state) /* Simplified chargen, no attributes or special formats/features yet */ MC6845_UPDATE_ROW( alfaskop4110_state::crtc_update_row ) { - offs_t base = ma + 0x4000; - u32 *px = &bitmap.pix32(y); + offs_t const base = ma + 0x4000; + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { u8 chr = m_vram[(base + i) & 0x07ff] & 0x7f; - rgb_t bg = rgb_t::white(); - rgb_t fg = rgb_t::black(); + rgb_t const bg = rgb_t::white(); + rgb_t const fg = rgb_t::black(); u8 dots = m_chargen[chr * 16 + ra]; diff --git a/src/mame/drivers/alinvade.cpp b/src/mame/drivers/alinvade.cpp index ce86f28db3a..a13baceb064 100644 --- a/src/mame/drivers/alinvade.cpp +++ b/src/mame/drivers/alinvade.cpp @@ -177,23 +177,19 @@ void alinvade_state::machine_reset() uint32_t alinvade_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = (offs << 3)&0x7f; int y = (offs >> 4)&0x7f; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/alphajuno.cpp b/src/mame/drivers/alphajuno.cpp index 95800a634b9..13f09295084 100644 --- a/src/mame/drivers/alphajuno.cpp +++ b/src/mame/drivers/alphajuno.cpp @@ -58,7 +58,7 @@ void alphajuno_state::machine_reset() HD44780_PIXEL_UPDATE(alphajuno_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp index 08a9c361569..68a3936f12c 100644 --- a/src/mame/drivers/alphatpx.cpp +++ b/src/mame/drivers/alphatpx.cpp @@ -903,31 +903,31 @@ static const gfx_layout extcharlayout = u32 alphatp_12_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); - int start = m_crtc->upscroll_offset(); + pen_t const *const pen = m_palette->pens(); + int const start = m_crtc->upscroll_offset(); rectangle cursor; m_crtc->cursor_bounds(cursor); for (int y = 0; y < 24; y++) { - int vramy = (start + y) % 24; + int const vramy = (start + y) % 24; for (int x = 0; x < 80; x++) { u8 code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line // draw 12 lines of the character - bool cursoren = cursor.contains(x * 8, y * 12); + bool const cursoren = cursor.contains(x * 8, y * 12); for (int line = 0; line < 12; line++) { u8 data = m_gfx[((code & 0x7f) * 16) + line]; if (cursoren) data ^= 0xff; - bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; } } } @@ -945,23 +945,23 @@ GFXDECODE_END u32 alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); - int start = m_crtc->upscroll_offset(); + pen_t const *const pen = m_palette->pens(); + int const start = m_crtc->upscroll_offset(); rectangle cursor; m_crtc->cursor_bounds(cursor); - bool scrext = m_scncfg->read() ? true : false; + bool const scrext = m_scncfg->read() ? true : false; for (int y = 0; y < 24; y++) { - int vramy = (start + y) % 24; + int const vramy = (start + y) % 24; for (int x = 0; x < 80; x++) { u8 code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line // draw 12 lines of the character - bool cursoren = cursor.contains(x * 8, y * 12); + bool const cursoren = cursor.contains(x * 8, y * 12); for (int line = 0; line < 12; line++) { u8 data = 0; - if(scrext) + if (scrext) { offs_t offset = (((vramy * 12) + line) * 80) + x; if(offset < (371 * 80)) @@ -974,14 +974,14 @@ u32 alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, if (cursoren) data ^= 0xff; } - bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; } } } diff --git a/src/mame/drivers/alphatro.cpp b/src/mame/drivers/alphatro.cpp index 0070adcf3d6..912dc35452f 100644 --- a/src/mame/drivers/alphatro.cpp +++ b/src/mame/drivers/alphatro.cpp @@ -340,22 +340,19 @@ void alphatro_state::portf0_w(uint8_t data) MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); bool palette = BIT(m_config->read(), 5); if (y==0) m_flashcnt++; - bool inv; - u8 chr,gfx,attr,bg,fg; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x); - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - attr = m_p_videoram[mem | 0x800]; - bg = (palette) ? 8 : attr & 7; // amber or RGB - fg = (palette) ? 0 : (attr & 0x38) >> 3; + bool inv = (x == cursor_x); + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_p_videoram[mem]; + u8 attr = m_p_videoram[mem | 0x800]; + u8 bg = (palette) ? 8 : attr & 7; // amber or RGB + u8 fg = (palette) ? 0 : (attr & 0x38) >> 3; if (BIT(attr, 7)) // reverse video { @@ -369,7 +366,7 @@ MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; + u8 gfx = m_p_chargen[(chr<<4) | ra]; if (inv) { diff --git a/src/mame/drivers/amust.cpp b/src/mame/drivers/amust.cpp index 1c7d01dd4d8..7441b4a3033 100644 --- a/src/mame/drivers/amust.cpp +++ b/src/mame/drivers/amust.cpp @@ -384,16 +384,15 @@ GFXDECODE_END MC6845_UPDATE_ROW( amust_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,inv; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; + u8 inv = (x == cursor_x) ? 0xff : 0; + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra] ^ inv; else diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp index 9c010c25bbb..cf3686b1730 100644 --- a/src/mame/drivers/apc.cpp +++ b/src/mame/drivers/apc.cpp @@ -207,51 +207,38 @@ UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi,yi_trans; - int x; - uint8_t char_size; -// uint8_t interlace_on; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // if(m_video_ff[DISPLAY_REG] == 0) //screen is off // return; -// interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ - char_size = 19; +// uint8_t interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ + uint8_t char_size = 19; - for(x=0;x<pitch;x++) + for(int x=0;x<pitch;x++) { - uint8_t tile_data; - uint8_t u_line, o_line, v_line, reverse, blink; - uint8_t color; - uint8_t tile,attr,pen; - uint32_t tile_addr; - uint8_t tile_sel; - -// tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); - tile_addr = addr+(x*(1)); - - tile = (m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] >> 8) & 0x00ff; - tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; - attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); - - u_line = attr & 0x01; - o_line = attr & 0x02; - v_line = attr & 0x04; - blink = attr & 0x08; - reverse = attr & 0x10; +// uint32_t tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); + uint32_t tile_addr = addr+(x*(1)); + + uint8_t tile = (m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] >> 8) & 0x00ff; + uint8_t tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; + uint8_t attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); + + uint8_t u_line = attr & 0x01; + uint8_t o_line = attr & 0x02; + uint8_t v_line = attr & 0x04; + uint8_t blink = attr & 0x08; + uint8_t reverse = attr & 0x10; // secret= (attr & 1) ^ 1; - color = (attr & 0xe0) >> 5; + uint8_t color = (attr & 0xe0) >> 5; - for(yi=0;yi<lr;yi++) + for(int yi=0;yi<lr;yi++) { - yi_trans = (yi==0)?lr-1:yi-1; - for(xi=0;xi<8;xi++) + int yi_trans = (yi==0)?lr-1:yi-1; + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - - res_x = (x*8+xi); - res_y = y+yi; + int res_x = (x*8+xi); + int res_y = y+yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; @@ -272,6 +259,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) Data bus: 76543210 = pixels, in left->01234567->right order */ + uint8_t tile_data; if(tile_sel == 0x89)// Aux character RAM select TODO: correct triggering? { if(yi & 0x10) @@ -291,13 +279,14 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) if(cursor_on && cursor_addr == tile_addr && m_screen->frame_number() & 0x10) tile_data^=0xff; + uint8_t pen; if(yi >= char_size) pen = 0; else pen = (tile_data >> (xi) & 1) ? color : 0; if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/apogee.cpp b/src/mame/drivers/apogee.cpp index f91f058ee6c..6284114c8e6 100644 --- a/src/mame/drivers/apogee.cpp +++ b/src/mame/drivers/apogee.cpp @@ -216,7 +216,7 @@ I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels) pixels ^= 0xff; for(int i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index 5cf5e9c3e95..cdc46753200 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -324,24 +324,21 @@ void apple1_state::poll_keyboard() void apple1_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; int fg = 1, bg = 0; - int charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); + int const charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); /* look up the character data */ - chardata = &textgfx_data[(charcode * 8)]; + uint8_t const *const chardata = &textgfx_data[(charcode * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } diff --git a/src/mame/drivers/applix.cpp b/src/mame/drivers/applix.cpp index eef5c0382bc..14c28072e3a 100644 --- a/src/mame/drivers/applix.cpp +++ b/src/mame/drivers/applix.cpp @@ -818,7 +818,7 @@ MC6845_UPDATE_ROW( applix_state::crtc_update_row ) // The 6845 cursor signal is not used at all. rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u32 const vidbase = (m_video_latch & 15) << 14 | (ra & 7) << 12; - u32 *p = &bitmap.pix32(y + vbp, hbp); + u32 *p = &bitmap.pix(y + vbp, hbp); for (u16 x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp index d782dd9111d..60a80be6f72 100644 --- a/src/mame/drivers/apricot.cpp +++ b/src/mame/drivers/apricot.cpp @@ -298,14 +298,14 @@ MC6845_UPDATE_ROW( apricot_state::crtc_update_row ) { int color = fill ? 1 : BIT(data, x); color ^= BIT(code, 15); // reverse? - bitmap.pix32(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; + bitmap.pix(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; } } else { // draw 16 pixels of the cell for (int x = 0; x <= 16; x++) - bitmap.pix32(y, x + i*16) = pen[BIT(data, x)]; + bitmap.pix(y, x + i*16) = pen[BIT(data, x)]; } } } diff --git a/src/mame/drivers/apricotf.cpp b/src/mame/drivers/apricotf.cpp index d7ee2f5d1d1..f3d59584e27 100644 --- a/src/mame/drivers/apricotf.cpp +++ b/src/mame/drivers/apricotf.cpp @@ -149,7 +149,7 @@ u32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const r { int color = (BIT(data, 15) << 1) | BIT(data, 7); - bitmap.pix16(y, (sx * 8) + x) = color; + bitmap.pix(y, (sx * 8) + x) = color; data <<= 1; } @@ -160,8 +160,8 @@ u32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const r { int color = (BIT(data, 15) << 3) | (BIT(data, 14) << 2) | (BIT(data, 7) << 1) | BIT(data, 6); - bitmap.pix16(y, (sx * 8) + (x * 2)) = color; - bitmap.pix16(y, (sx * 8) + (x * 2) + 1) = color; + bitmap.pix(y, (sx * 8) + (x * 2)) = color; + bitmap.pix(y, (sx * 8) + (x * 2) + 1) = color; data <<= 2; } diff --git a/src/mame/drivers/apricotp.cpp b/src/mame/drivers/apricotp.cpp index a2d356486da..8e6b94d197d 100644 --- a/src/mame/drivers/apricotp.cpp +++ b/src/mame/drivers/apricotp.cpp @@ -190,7 +190,7 @@ uint32_t fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co { int color = BIT(data, 15); - bitmap.pix16(y, (sx * 16) + x) = color; + bitmap.pix(y, (sx * 16) + x) = color; data <<= 1; } diff --git a/src/mame/drivers/argo.cpp b/src/mame/drivers/argo.cpp index 090172d407f..9a85211d859 100644 --- a/src/mame/drivers/argo.cpp +++ b/src/mame/drivers/argo.cpp @@ -267,7 +267,7 @@ I8275_DRAW_CHARACTER_MEMBER(argo_state::display_pixels) gfx ^= 0xff; for(u8 i=0;i<7;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 6-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 6-i) ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t argo_pens[3] = diff --git a/src/mame/drivers/aristmk6.cpp b/src/mame/drivers/aristmk6.cpp index 3e90126427d..b0e332129fe 100644 --- a/src/mame/drivers/aristmk6.cpp +++ b/src/mame/drivers/aristmk6.cpp @@ -173,7 +173,7 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r | g<<8 | b<<16; + bitmap.pix(y, x) = r | g<<8 | b<<16; count+=2; } @@ -184,7 +184,7 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg color = blit_ram[count]; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } @@ -205,12 +205,12 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg pix1 = pix & 0xffffffff; col = 0; if (pix1) col = 1; - bitmap.pix32(y, x*2) = m_palette->pen(col); + bitmap.pix(y, x*2) = m_palette->pen(col); pix1 = pix >> 32; col = 0; if (pix1) col = 1; - bitmap.pix32(y, x*2+1) = m_palette->pen(col); + bitmap.pix(y, x*2+1) = m_palette->pen(col); count++; diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp index 0a23d19cbf5..86d1dc1502f 100644 --- a/src/mame/drivers/astinvad.cpp +++ b/src/mame/drivers/astinvad.cpp @@ -168,14 +168,14 @@ void astinvad_state::plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint { uint8_t flip_xor = m_screen_flip & 7; - bitmap.pix32(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); } diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp index 3bd3ee55911..700eca70dd3 100644 --- a/src/mame/drivers/astrof.cpp +++ b/src/mame/drivers/astrof.cpp @@ -356,14 +356,9 @@ void astrof_state::tomahawk_video_control_2_w(uint8_t data) void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens, int num_pens ) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - uint8_t data; - int i; - - uint8_t color = m_colorram[offs >> 1]; + uint8_t const color = m_colorram[offs >> 1]; pen_t back_pen = pens[(color & (num_pens-1)) | 0x00]; pen_t fore_pen = pens[(color & (num_pens-1)) | 0x01]; @@ -377,22 +372,23 @@ void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &c if ((y <= cliprect.top()) || (y >= cliprect.bottom())) continue; + uint8_t data; if (m_screen_off) data = 0; else data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen = (data & 0x01) ? fore_pen : back_pen; + pen_t const pen = (data & 0x01) ? fore_pen : back_pen; if (m_flipscreen) - bitmap.pix32(y, 255 - x) = pen; + bitmap.pix(y, 255 - x) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data >> 1; + x++; + data >>= 1; } } } diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp index 8da5a02d553..1dfd60758f8 100644 --- a/src/mame/drivers/atarisy4.cpp +++ b/src/mame/drivers/atarisy4.cpp @@ -231,7 +231,6 @@ void atarisy4_state::video_reset() uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; uint32_t offset = 0; if (m_gpu.bcrw & 0x80) @@ -245,15 +244,14 @@ uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rg //uint32_t offset = m_gpu.dpr << 5; - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { - uint16_t *src = &m_screen_ram[(offset + (4096 * y)) / 2]; - uint32_t *dest = &bitmap.pix32(y, cliprect.left()); - int x; + uint16_t const *src = &m_screen_ram[(offset + (4096 * y)) / 2]; + uint32_t *dest = &bitmap.pix(y, cliprect.left()); - for (x = cliprect.left(); x < cliprect.right(); x += 2) + for (int x = cliprect.left(); x < cliprect.right(); x += 2) { - uint16_t data = *src++; + uint16_t const data = *src++; *dest++ = m_palette->pen(data & 0xff); *dest++ = m_palette->pen(data >> 8); diff --git a/src/mame/drivers/atronic.cpp b/src/mame/drivers/atronic.cpp index 5d73e60b702..19fe4c15a7e 100644 --- a/src/mame/drivers/atronic.cpp +++ b/src/mame/drivers/atronic.cpp @@ -423,8 +423,8 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(atronic_state::from_shiftreg) TMS340X0_SCANLINE_RGB32_CB_MEMBER(atronic_state::scanline_update) { uint32_t fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 5; - uint32_t* bg0_base = &m_vidram[(fulladdr & 0x7fe00)]; // this probably isn't screen ram, but some temp gfx are copied on startup - uint32_t* dst = &bitmap.pix32(scanline); + uint32_t const *const bg0_base = &m_vidram[(fulladdr & 0x7fe00)]; // this probably isn't screen ram, but some temp gfx are copied on startup + uint32_t *const dst = &bitmap.pix(scanline); int coladdr = fulladdr & 0x1ff; const pen_t *pens = m_palette->pens(); diff --git a/src/mame/drivers/att4425.cpp b/src/mame/drivers/att4425.cpp index e574f006e55..b2033aa5f05 100644 --- a/src/mame/drivers/att4425.cpp +++ b/src/mame/drivers/att4425.cpp @@ -131,26 +131,26 @@ void att4425_state::video_start() uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx, fg, bg, chr, attr; - uint16_t sy = 0, ma, x, ca; + uint16_t sy = 0; - fg = 2; - bg = 0; + uint8_t fg = 2; + uint8_t bg = 0; - for (y = 0; y < 27; y++) + for (uint8_t y = 0; y < 27; y++) { - ma = 0x7e9c + 4 * (81 - 27 + y); + uint16_t ma = 0x7e9c + 4 * (81 - 27 + y); ma = (m_p_videoram[ma] << 8) + m_p_videoram[ma + 1] - 0x8000; - for (ra = 0; ra < 13; ra++) + for (uint8_t ra = 0; ra < 13; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 160; x += 2) + for (uint16_t x = ma; x < ma + 160; x += 2) { - chr = m_p_videoram[x + 1]; - attr = m_p_videoram[x]; - ca = (chr << 4) & 0x7f0; + uint8_t const chr = m_p_videoram[x + 1]; + uint8_t const attr = m_p_videoram[x]; + uint16_t ca = (chr << 4) & 0x7f0; + uint8_t gfx; // font 2 if (attr & 0x01) @@ -178,9 +178,8 @@ uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* Display a scanline of a character */ for (int i = 7; i >= 0; i--) - { *p++ = BIT(gfx, i) ? fg : bg; - } + *p++ = bg; } } diff --git a/src/mame/drivers/att630.cpp b/src/mame/drivers/att630.cpp index 96e0626ea4a..bcedcd25c15 100644 --- a/src/mame/drivers/att630.cpp +++ b/src/mame/drivers/att630.cpp @@ -54,7 +54,7 @@ u32 att630_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con { for (int y = 0; y < 1024; y++) for (int x = 0; x < 1024; x++) - bitmap.pix32(y, x) = BIT(m_vram[y * (1024 / 16) + x / 16], 15 - (x % 16)) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = BIT(m_vram[y * (1024 / 16) + x / 16], 15 - (x % 16)) ? rgb_t::white() : rgb_t::black(); return 0; } diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp index 7f42d3e551a..17f434fce48 100644 --- a/src/mame/drivers/attache.cpp +++ b/src/mame/drivers/attache.cpp @@ -299,39 +299,35 @@ private: // bit 7 = subscript (superscript and subscript combined produces strikethrough) uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y,vy,start,bit,scan,data; - uint8_t dbl_mode = 0; // detemines which half of character to display when using double size attribute, - // as it can start on either odd or even character cells. - // Graphics output (if enabled) if(m_gfx_enabled) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); - for(y=0;y<(bitmap.height()-1)/10;y++) + for(uint8_t y=0;y<(bitmap.height()-1)/10;y++) { - for(x=0;x<(bitmap.width()-1)/8;x++) + for(uint8_t x=0;x<(bitmap.width()-1)/8;x++) { // graphics pixels use half the clock of text, so 4 graphics pixels per character - for(scan=0;scan<10;scan+=2) + for(uint8_t scan=0;scan<10;scan+=2) { - data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; - bitmap.pix32(y*10+scan,x*8) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+1) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+2) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+3) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+4) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+5) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+6) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan,x*8+7) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan+1,x*8) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; - bitmap.pix32(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; + uint8_t const data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; + bitmap.pix(y*10+scan,x*8) = pen[BIT(data,7)]; + bitmap.pix(y*10+scan,x*8+1) = pen[BIT(data,7)]; + bitmap.pix(y*10+scan,x*8+2) = pen[BIT(data,6)]; + bitmap.pix(y*10+scan,x*8+3) = pen[BIT(data,6)]; + bitmap.pix(y*10+scan,x*8+4) = pen[BIT(data,5)]; + bitmap.pix(y*10+scan,x*8+5) = pen[BIT(data,5)]; + bitmap.pix(y*10+scan,x*8+6) = pen[BIT(data,4)]; + bitmap.pix(y*10+scan,x*8+7) = pen[BIT(data,4)]; + bitmap.pix(y*10+scan+1,x*8) = pen[BIT(data,3)]; + bitmap.pix(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; + bitmap.pix(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; + bitmap.pix(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; + bitmap.pix(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; + bitmap.pix(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; + bitmap.pix(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; + bitmap.pix(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; } } } @@ -340,12 +336,14 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma bitmap.fill(0); // Text output - for(y=0;y<(bitmap.height()-1)/10;y++) // lines + uint8_t dbl_mode = 0; // detemines which half of character to display when using double size attribute, + // as it can start on either odd or even character cells. + for(uint8_t y=0;y<(bitmap.height()-1)/10;y++) // lines { - start = m_crtc->upscroll_offset(); - vy = (start + y) % 24; + uint8_t const start = m_crtc->upscroll_offset(); + uint8_t const vy = (start + y) % 24; - for(x=0;x<(bitmap.width()-1)/8;x++) // columns + for(uint8_t x=0;x<(bitmap.width()-1)/8;x++) // columns { assert(((y*128)+x) >= 0 && ((y*128)+x) < ARRAY_LENGTH(m_char_ram)); assert(((vy*128)+x) >= 0 && ((vy*128)+x) < ARRAY_LENGTH(m_char_ram)); @@ -356,9 +354,9 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma else dbl_mode = 0; - for(scan=0;scan<10;scan++) // 10 scanlines per line + for(uint8_t scan=0;scan<10;scan++) // 10 scanlines per line { - data = m_char_rom->base()[(ch*16+scan)]; + uint8_t data = m_char_rom->base()[(ch*16+scan)]; if((m_attr_ram[(vy*128)+x] & 0xc0) != 0xc0) // if not strikethrough { if(m_attr_ram[(vy*128)+x] & 0x40) // superscript @@ -402,13 +400,13 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma data = newdata; } - for(bit=0;bit<8;bit++) // 8 pixels per character + for(uint8_t bit=0;bit<8;bit++) // 8 pixels per character { - uint16_t xpos = x*8+bit; - uint16_t ypos = y*10+scan; + uint16_t const xpos = x*8+bit; + uint16_t const ypos = y*10+scan; if(BIT(data,7-bit)) - bitmap.pix32(ypos,xpos) = fg; + bitmap.pix(ypos,xpos) = fg; } } } diff --git a/src/mame/drivers/avalnche.cpp b/src/mame/drivers/avalnche.cpp index 5b3f930a43e..7c8896238b9 100644 --- a/src/mame/drivers/avalnche.cpp +++ b/src/mame/drivers/avalnche.cpp @@ -48,17 +48,13 @@ uint32_t avalnche_state::screen_update_avalnche(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - int y = offs >> 5; + int const y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen; @@ -67,10 +63,10 @@ uint32_t avalnche_state::screen_update_avalnche(screen_device &screen, bitmap_rg else pen = (data & 0x80) ? rgb_t::black() : rgb_t::white(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data << 1; - x = x + 1; + data <<= 1; + x++; } } diff --git a/src/mame/drivers/b16.cpp b/src/mame/drivers/b16.cpp index a156c83826d..d4a864b0a77 100644 --- a/src/mame/drivers/b16.cpp +++ b/src/mame/drivers/b16.cpp @@ -97,18 +97,17 @@ uint32_t b16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for(int x=0;x<mc6845_h_display;x++) { - int tile = m_vram[x+y*mc6845_h_display] & 0xff; - int color = (m_vram[x+y*mc6845_h_display] & 0x700) >> 8; - int pen; + int const tile = m_vram[x+y*mc6845_h_display] & 0xff; + int const color = (m_vram[x+y*mc6845_h_display] & 0x700) >> 8; for(int yi=0;yi<mc6845_tile_height;yi++) { for(int xi=0;xi<8;xi++) { - pen = (m_char_rom[tile*16+yi] >> (7-xi) & 1) ? color : 0; + int const pen = (m_char_rom[tile*16+yi] >> (7-xi) & 1) ? color : 0; if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/banctec.cpp b/src/mame/drivers/banctec.cpp index 8d5857a7a1f..220ad278819 100644 --- a/src/mame/drivers/banctec.cpp +++ b/src/mame/drivers/banctec.cpp @@ -87,16 +87,14 @@ void banctec_state::videoram_w(u8 data) MC6845_UPDATE_ROW( banctec_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0xff; - chr = m_videoram[mem]; - gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0); + u16 const mem = (ma + x) & 0xff; + u8 const chr = m_videoram[mem]; + u8 const gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/bcs3.cpp b/src/mame/drivers/bcs3.cpp index 8660ded8640..1bb81ef9fc7 100644 --- a/src/mame/drivers/bcs3.cpp +++ b/src/mame/drivers/bcs3.cpp @@ -265,24 +265,24 @@ INPUT_PORTS_END // Official version u32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,rat; - u16 sy=0,ma=0x50,x; + u16 sy=0,ma=0x50; - for (y = 0; y < 12; y++) + for (u8 y = 0; y < 12; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; + uint16_t *p = &bitmap.pix(sy++); + u8 const rat = (ra + 1) & 7; - for (x = ma; x < ma + 28; x++) + for (u16 x = ma; x < ma + 28; x++) { + u8 gfx; if (ra < 8) { - chr = m_p_videoram[x] & 0x7f; + u8 const chr = m_p_videoram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | rat ] ^ 0xff; + gfx = m_p_chargen[(chr<<3) | rat] ^ 0xff; } else gfx = 0xff; @@ -307,27 +307,27 @@ u32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, I'm assuming that it only shows a portion of this, with the cursor always in sight. */ u32 bcs3_state::screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,rat; - u16 sy = 0, ma = s_init, x; - u16 cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position - rat = cursor / (s_cols+1); - if (rat > (s_rows-1)) ma += (rat-(s_rows-1)) * (s_cols+1); + u16 sy = 0, ma = s_init; + u16 const cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position + u8 const cw = cursor / (s_cols+1); + if (cw > (s_rows-1)) ma += (cw-(s_rows-1)) * (s_cols+1); - for (y = 0; y < s_rows; y++) + for (u8 y = 0; y < s_rows; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; + uint16_t *p = &bitmap.pix(sy++); + u8 const rat = (ra + 1) & 7; - for (x = ma; x < ma + s_cols; x++) + for (u16 x = ma; x < ma + s_cols; x++) { + u8 gfx; if (ra < 8) { - chr = m_p_videoram[x] & 0x7f; + u8 const chr = m_p_videoram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | rat ] ^ 0xff; + gfx = m_p_chargen[(chr<<3) | rat] ^ 0xff; } else gfx = 0xff; diff --git a/src/mame/drivers/beaminv.cpp b/src/mame/drivers/beaminv.cpp index e323210244f..91b9e7b664d 100644 --- a/src/mame/drivers/beaminv.cpp +++ b/src/mame/drivers/beaminv.cpp @@ -186,23 +186,19 @@ void beaminv_state::machine_reset() uint32_t beaminv_state::screen_update_beaminv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t y = offs; uint8_t x = offs >> 8 << 3; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/beezer.cpp b/src/mame/drivers/beezer.cpp index beaee78687e..4d6a88944ce 100644 --- a/src/mame/drivers/beezer.cpp +++ b/src/mame/drivers/beezer.cpp @@ -257,8 +257,8 @@ uint32_t beezer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - bitmap.pix16(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; - bitmap.pix16(y, x + 0) = m_videoram[0x80 * x + y] >> 4; + bitmap.pix(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; + bitmap.pix(y, x + 0) = m_videoram[0x80 * x + y] >> 4; } } diff --git a/src/mame/drivers/berzerk.cpp b/src/mame/drivers/berzerk.cpp index 778046da173..6d45d41f3aa 100644 --- a/src/mame/drivers/berzerk.cpp +++ b/src/mame/drivers/berzerk.cpp @@ -492,30 +492,30 @@ uint32_t berzerk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t data = m_videoram[offs]; uint8_t color = m_colorram[((offs >> 2) & 0x07e0) | (offs & 0x001f)]; uint8_t y = offs >> 5; uint8_t x = offs << 3; + int i; + for (i = 0; i < 4; i++) { rgb_t pen = (data & 0x80) ? pens[color >> 4] : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } for (; i < 8; i++) { rgb_t pen = (data & 0x80) ? pens[color & 0x0f] : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } } diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp index ccbefc4235f..c960664c5f8 100644 --- a/src/mame/drivers/bfcobra.cpp +++ b/src/mame/drivers/bfcobra.cpp @@ -415,20 +415,16 @@ void bfcobra_state::video_start() uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint8_t *src; - uint32_t *dest; - uint32_t offset; - uint8_t *hirescol; - uint8_t *lorescol; - /* Select screen has to be programmed into two registers */ /* No idea what happens if the registers are different */ + uint32_t offset; if (m_flip_8 & 0x40 && m_flip_22 & 0x40) offset = 0x10000; else offset = 0; + uint8_t const *hirescol; + uint8_t const *lorescol; if(m_videomode & 0x20) { hirescol = m_col3bit; @@ -445,16 +441,16 @@ uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb3 lorescol = m_col8bit; } - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { uint16_t y_offset = (y + m_v_scroll) * 256; - src = &m_video_ram[offset + y_offset]; - dest = &bitmap.pix32(y); + uint8_t const *const src = &m_video_ram[offset + y_offset]; + uint32_t *dest = &bitmap.pix(y); - for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) + for (int x = cliprect.left(); x <= cliprect.right() / 2; ++x) { - uint8_t x_offset = x + m_h_scroll; - uint8_t pen = *(src + x_offset); + uint8_t const x_offset = x + m_h_scroll; + uint8_t const pen = *(src + x_offset); if ( ( m_videomode & 0x81 ) == 1 || (m_videomode & 0x80 && pen & 0x80) ) { @@ -2323,21 +2319,16 @@ void bfcobjam_state::chipset_w(offs_t offset, uint8_t data) uint32_t bfcobjam_state::screen_update_bfcobjam(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint8_t *src; - uint32_t *dest; - uint32_t offset; - uint8_t *hirescol; - uint8_t *lorescol; - - /* Select screen has to be programmed into two registers */ /* No idea what happens if the registers are different */ + uint32_t offset; if (m_flip_8 & 0x40 && m_flip_22 & 0x40) offset = 0x10000; else offset = 0; + uint8_t const *hirescol; + uint8_t const *lorescol; if(m_videomode & 0x20) { hirescol = m_col3bit; @@ -2354,16 +2345,16 @@ uint32_t bfcobjam_state::screen_update_bfcobjam(screen_device &screen, bitmap_rg lorescol = m_col8bit; } - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { - uint16_t y_offset = (y + m_v_scroll) * 256; - src = &m_video_ram[offset + y_offset]; - dest = &bitmap.pix32(y); + uint16_t const y_offset = (y + m_v_scroll) * 256; + uint8_t const *const src = &m_video_ram[offset + y_offset]; + uint32_t *dest = &bitmap.pix(y); - for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) + for (int x = cliprect.left(); x <= cliprect.right() / 2; ++x) { - uint8_t x_offset = x + m_h_scroll; - uint8_t pen = *(src + x_offset); + uint8_t const x_offset = x + m_h_scroll; + uint8_t const pen = *(src + x_offset); if ( ( m_videomode & 0x81 ) == 1 || (m_videomode & 0x80 && pen & 0x80) ) { diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp index dc597cba79d..a80176597bc 100644 --- a/src/mame/drivers/bigbord2.cpp +++ b/src/mame/drivers/bigbord2.cpp @@ -554,21 +554,19 @@ u8 bigbord2_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, uint16_t ac_cnt, boo MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,attr; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); ra &= 15; m_cnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - attr = m_aram[mem]; - chr = m_vram[mem]; + u16 mem = (ma + x) & 0x7ff; + u8 attr = m_aram[mem]; + u8 chr = m_vram[mem]; /* process attributes */ - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + u8 gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character */ *p++ = palette[BIT( gfx, 7 )]; diff --git a/src/mame/drivers/bingor.cpp b/src/mame/drivers/bingor.cpp index 63a39cc8c05..1d20658a6e3 100644 --- a/src/mame/drivers/bingor.cpp +++ b/src/mame/drivers/bingor.cpp @@ -564,37 +564,32 @@ void bingor_state::video_start() uint32_t bingor_state::screen_update_bingor(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - bitmap.fill(m_palette->black_pen(), cliprect); - count = (0x2000 / 2); - - for(y = 0; y < 256; y++) + int count = (0x2000 / 2); + for(int y = 0; y < 256; y++) { - for(x = 0; x < 286; x += 4) + for(int x = 0; x < 286; x += 4) { - uint32_t color; - - color = (m_blit_ram[count] & 0xf000) >> 12; + uint32_t color = (m_blit_ram[count] & 0xf000) >> 12; if(cliprect.contains(x + 3, y)) - bitmap.pix32(y, x + 3) = m_palette->pen(color); + bitmap.pix(y, x + 3) = m_palette->pen(color); color = (m_blit_ram[count] & 0x0f00) >> 8; if(cliprect.contains(x + 2, y)) - bitmap.pix32(y, x + 2) = m_palette->pen(color); + bitmap.pix(y, x + 2) = m_palette->pen(color); color = (m_blit_ram[count] & 0x00f0) >> 4; if(cliprect.contains(x + 1, y)) - bitmap.pix32(y, x + 1) = m_palette->pen(color); + bitmap.pix(y, x + 1) = m_palette->pen(color); color = (m_blit_ram[count] & 0x000f) >> 0; if(cliprect.contains(x + 0, y)) - bitmap.pix32(y, x + 0) = m_palette->pen(color); + bitmap.pix(y, x + 0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/bitgraph.cpp b/src/mame/drivers/bitgraph.cpp index 89207357183..52279795d3c 100644 --- a/src/mame/drivers/bitgraph.cpp +++ b/src/mame/drivers/bitgraph.cpp @@ -384,16 +384,13 @@ void bitgraph_state::adlc_w(offs_t offset, uint8_t data) uint32_t bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx = 0; - int x, y; - - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = 0; x < 1024 / 8; x += 2) + for (int x = 0; x < 1024 / 8; x += 2) { - gfx = m_videoram[(x + 1) | (y << 7)]; + uint8_t gfx = m_videoram[(x + 1) | (y << 7)]; for (int i = 7; i >= 0; i--) { *p++ = BIT(gfx, i); diff --git a/src/mame/drivers/blitz68k.cpp b/src/mame/drivers/blitz68k.cpp index 8b7a6c96874..ba96cc81447 100644 --- a/src/mame/drivers/blitz68k.cpp +++ b/src/mame/drivers/blitz68k.cpp @@ -274,13 +274,13 @@ VIDEO_START_MEMBER(blitz68k_state,blitz68k_addr_factor1) uint32_t blitz68k_state::screen_update_blitz68k(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *src = m_blit_buffer.get(); + const uint8_t *src = m_blit_buffer.get(); for(int y = 0; y < 256; y++) { for(int x = 0; x < 512; x++) { - bitmap.pix32(y, x) = m_palette->pen(*src++); + bitmap.pix(y, x) = m_palette->pen(*src++); } } @@ -292,17 +292,17 @@ uint32_t blitz68k_state::screen_update_blitz68k(screen_device &screen, bitmap_rg uint32_t blitz68k_state::screen_update_blitz68k_noblit(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *src = m_frame_buffer; + const uint16_t *src = m_frame_buffer; for(int y = 0; y < 256; y++) { for(int x = 0; x < 512; ) { - uint16_t pen = *src++; - bitmap.pix32(y, x++) = m_palette->pen((pen >> 8) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 12) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 0) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 4) & 0xf); + const uint16_t pen = *src++; + bitmap.pix(y, x++) = m_palette->pen((pen >> 8) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 12) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 0) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 4) & 0xf); } } diff --git a/src/mame/drivers/blw700i.cpp b/src/mame/drivers/blw700i.cpp index c5c8a0fd9b7..3552b957a64 100644 --- a/src/mame/drivers/blw700i.cpp +++ b/src/mame/drivers/blw700i.cpp @@ -122,29 +122,24 @@ void lw700i_state::video_start() uint32_t lw700i_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0xffffff, 0 }; - uint8_t *pVRAM = (uint8_t *)m_mainram.target(); + uint8_t const *const pVRAM = (uint8_t *)m_mainram.target() + 0x3e200; - pVRAM += 0x3e200; - - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 480/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 480/8; x++) { - pixels = pVRAM[(y * (480/8)) + (BYTE_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = pVRAM[(y * (480/8)) + (BYTE_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/bmcbowl.cpp b/src/mame/drivers/bmcbowl.cpp index 847acd2b025..79970bf864b 100644 --- a/src/mame/drivers/bmcbowl.cpp +++ b/src/mame/drivers/bmcbowl.cpp @@ -167,41 +167,42 @@ uint32_t bmcbowl_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma missing scroll and priorities (maybe fixed ones) */ - int x,y,z,pixdat; bitmap.fill(rgb_t::black(), cliprect); - z=0; - for (y=0;y<230;y++) + int z=0; + for (int y=0; y<230; y++) { - for (x=0;x<280;x+=2) + for (int x=0; x<280; x+=2) { + int pixdat; + pixdat = m_vid2[0x8000+z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid2[z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid1[0x8000+z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid1[z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); z++; } diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp index 05700c64b71..094dde0f078 100644 --- a/src/mame/drivers/bmcpokr.cpp +++ b/src/mame/drivers/bmcpokr.cpp @@ -147,21 +147,21 @@ void bmcpokr_state::pixram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { COMBINE_DATA(&m_pixram[offset]); - int x = (offset & 0xff) << 2; - int y = (offset >> 8); + int const x = (offset & 0xff) << 2; + int const y = (offset >> 8); - uint16_t pixpal = (m_pixpal & 0xf) << 4; + uint16_t const pixpal = (m_pixpal & 0xf) << 4; uint16_t pen; if (ACCESSING_BITS_8_15) { - pen = (data >> 12) & 0xf; m_pixbitmap->pix16(y, x + 0) = pen ? pixpal + pen : 0; - pen = (data >> 8) & 0xf; m_pixbitmap->pix16(y, x + 1) = pen ? pixpal + pen : 0; + pen = (data >> 12) & 0xf; m_pixbitmap->pix(y, x + 0) = pen ? pixpal + pen : 0; + pen = (data >> 8) & 0xf; m_pixbitmap->pix(y, x + 1) = pen ? pixpal + pen : 0; } if (ACCESSING_BITS_0_7) { - pen = (data >> 4) & 0xf; m_pixbitmap->pix16(y, x + 2) = pen ? pixpal + pen : 0; - pen = (data >> 0) & 0xf; m_pixbitmap->pix16(y, x + 3) = pen ? pixpal + pen : 0; + pen = (data >> 4) & 0xf; m_pixbitmap->pix(y, x + 2) = pen ? pixpal + pen : 0; + pen = (data >> 0) & 0xf; m_pixbitmap->pix(y, x + 3) = pen ? pixpal + pen : 0; } } @@ -173,12 +173,12 @@ void bmcpokr_state::pixbitmap_redraw() { for (int x = 0; x < 1024; x += 4) { - uint16_t data = m_pixram[offset++]; + uint16_t const data = m_pixram[offset++]; uint16_t pen; - pen = (data >> 12) & 0xf; m_pixbitmap->pix16(y, x + 0) = pen ? pixpal + pen : 0; - pen = (data >> 8) & 0xf; m_pixbitmap->pix16(y, x + 1) = pen ? pixpal + pen : 0; - pen = (data >> 4) & 0xf; m_pixbitmap->pix16(y, x + 2) = pen ? pixpal + pen : 0; - pen = (data >> 0) & 0xf; m_pixbitmap->pix16(y, x + 3) = pen ? pixpal + pen : 0; + pen = (data >> 12) & 0xf; m_pixbitmap->pix(y, x + 0) = pen ? pixpal + pen : 0; + pen = (data >> 8) & 0xf; m_pixbitmap->pix(y, x + 1) = pen ? pixpal + pen : 0; + pen = (data >> 4) & 0xf; m_pixbitmap->pix(y, x + 2) = pen ? pixpal + pen : 0; + pen = (data >> 0) & 0xf; m_pixbitmap->pix(y, x + 3) = pen ? pixpal + pen : 0; } } } diff --git a/src/mame/drivers/bmjr.cpp b/src/mame/drivers/bmjr.cpp index 081e5feff2b..93f0fedcf4c 100644 --- a/src/mame/drivers/bmjr.cpp +++ b/src/mame/drivers/bmjr.cpp @@ -71,20 +71,20 @@ private: u32 bmjr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,fg=4; - u16 sy=0,ma=0x100,x; - u8 inv = (m_xor_display) ? 0xff : 0; + u8 fg=4; + u16 sy=0,ma=0x100; + u8 const inv = (m_xor_display) ? 0xff : 0; - for(y = 0; y < 24; y++ ) + for(u8 y = 0; y < 24; y++ ) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 32; x++) + for (u16 x = ma; x < ma + 32; x++) { - chr = m_p_wram[x]; - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + u8 const chr = m_p_wram[x]; + u8 const gfx = m_p_chargen[(chr<<3) | ra] ^ inv; /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? fg : 0; diff --git a/src/mame/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp index 3558439a923..5636185c513 100644 --- a/src/mame/drivers/bml3.cpp +++ b/src/mame/drivers/bml3.cpp @@ -575,7 +575,7 @@ INPUT_CHANGED_MEMBER(bml3_state::nmi_button) MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // The MB-6890 has a 5-bit colour RAM region. The meaning of the bits are: // 0: blue // 1: red @@ -583,13 +583,9 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) // 3: reverse/inverse video // 4: graphic (not character) - u8 x=0,hf=0,xi=0,interlace=0,bgcolor=0,rawbits=0,dots[2]={0,0},color=0,pen=0; - bool reverse=0,graphic=0,lowres=0; - u16 mem=0; - - interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; - lowres = BIT(m_hres_reg, 6); - bgcolor = m_hres_reg & 7; + u8 const interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; + bool const lowres = BIT(m_hres_reg, 6); + u8 const bgcolor = m_hres_reg & 7; if (interlace) { @@ -597,19 +593,21 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) if (y > 0x191) return; } - for(x=0; x<x_count; x++) + for(u8 x=0; x<x_count; x++) { + u16 mem; if (lowres) mem = (ma + x - 0x400) & 0x3fff; else mem = (ma + x + ra * x_count/40 * 0x400 -0x400) & 0x3fff; - color = m_aram[mem] & 7; - reverse = BIT(m_aram[mem], 3) ^ (x == cursor_x); - graphic = BIT(m_aram[mem], 4); + u8 const color = m_aram[mem] & 7; + bool const reverse = BIT(m_aram[mem], 3) ^ (x == cursor_x); + bool const graphic = BIT(m_aram[mem], 4); - rawbits = m_vram[mem]; + u8 const rawbits = m_vram[mem]; + u8 dots[2] = { 0, 0 }; if (graphic) { if (lowres) @@ -629,8 +627,8 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) else { // character mode - int tile = rawbits & 0x7f; - int tile_bank = BIT(rawbits, 7); + int const tile = rawbits & 0x7f; + int const tile_bank = BIT(rawbits, 7); if (interlace) { dots[0] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)]; @@ -642,18 +640,19 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) } } - for(hf=0;hf<=interlace;hf++) + for(u8 hf=0;hf<=interlace;hf++) { - for(xi=0;xi<8;xi++) + for(u8 xi=0;xi<8;xi++) { + u8 pen; if(reverse) pen = (dots[hf] >> (7-xi) & 1) ? bgcolor : color; else pen = (dots[hf] >> (7-xi) & 1) ? color : bgcolor; - bitmap.pix32(y, x*8+xi) = palette[pen]; + bitmap.pix(y, x*8+xi) = palette[pen]; // when the mc6845 device gains full interlace&video support, replace the line above with the line below - // bitmap.pix32(y*(interlace+1)+hf, x*8+xi) = palette[pen]; + // bitmap.pix(y*(interlace+1)+hf, x*8+xi) = palette[pen]; } } } diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index 93337ce0e5b..d9928ac612c 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -302,13 +302,12 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); - int column, bit; + pen_t const *const pen = m_palette->pens(); - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { - uint8_t code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; - uint16_t addr = code << 4 | (ra & 0x0f); + uint8_t const code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; + uint16_t const addr = code << 4 | (ra & 0x0f); uint8_t data = m_char_rom->base()[addr & BW12_CHARROM_MASK]; if (column == cursor_x) @@ -316,12 +315,12 @@ MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) data = 0xff; } - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; + int const x = (column * 8) + bit; + int const color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/c10.cpp b/src/mame/drivers/c10.cpp index 628082f4987..fd7e5f5945b 100644 --- a/src/mame/drivers/c10.cpp +++ b/src/mame/drivers/c10.cpp @@ -98,24 +98,23 @@ void c10_state::machine_reset() uint32_t c10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { //static uint8_t framecnt=0; - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x,xx; + uint16_t sy=0,ma=0; //framecnt++; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - xx = ma; - for (x = ma; x < ma + 80; x++) + uint16_t xx = ma; + for (uint16_t x = ma; x < ma + 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_vram[xx++]; + uint8_t chr = m_vram[xx++]; // /* Take care of flashing characters */ // if ((chr < 0x80) && (framecnt & 0x08)) diff --git a/src/mame/drivers/c65.cpp b/src/mame/drivers/c65.cpp index c918bf97d04..b4bd8c4ec75 100644 --- a/src/mame/drivers/c65.cpp +++ b/src/mame/drivers/c65.cpp @@ -178,7 +178,7 @@ uint32_t c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, if (attr & 0x10) enable_dot = 0; //if(cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_palette->pen(highlight_color + ((enable_dot) ? foreground_color : background_color)); + bitmap.pix(y, x) = m_palette->pen(highlight_color + ((enable_dot) ? foreground_color : background_color)); //gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); diff --git a/src/mame/drivers/calcune.cpp b/src/mame/drivers/calcune.cpp index 64dc5f6453d..f58fbd9f63e 100644 --- a/src/mame/drivers/calcune.cpp +++ b/src/mame/drivers/calcune.cpp @@ -149,7 +149,7 @@ uint32_t calcune_state::screen_update_calcune(screen_device &screen, bitmap_rgb3 { const unsigned palette_per_scanline = 64 * y; - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int pix; diff --git a/src/mame/drivers/camplynx.cpp b/src/mame/drivers/camplynx.cpp index fe43ec05f5c..81d46cc91ff 100644 --- a/src/mame/drivers/camplynx.cpp +++ b/src/mame/drivers/camplynx.cpp @@ -748,9 +748,8 @@ void camplynx_state::machine_reset() MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) { - u8 r,g,b,x; - uint32_t green_bank, *p = &bitmap.pix32(y); - uint16_t mem = ((ma << 2) + (ra << 5)) & 0x1fff; + uint32_t green_bank, *p = &bitmap.pix(y); + uint16_t const mem = ((ma << 2) + (ra << 5)) & 0x1fff; // determine green bank if (BIT(m_port80, 4)) @@ -758,11 +757,11 @@ MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) else green_bank = 0x3c000 + mem; // normal green - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - r = m_p_ram[0x2c000 + mem + x]; - b = m_p_ram[0x28000 + mem + x]; - g = m_p_ram[green_bank + x]; + u8 const r = m_p_ram[0x2c000 + mem + x]; + u8 const b = m_p_ram[0x28000 + mem + x]; + u8 const g = m_p_ram[green_bank + x]; *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); @@ -777,20 +776,20 @@ MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) MC6845_UPDATE_ROW( camplynx_state::lynx128k_update_row ) { - u8 r,g,b,x; - uint32_t green_bank, *p = &bitmap.pix32(y); - uint16_t mem = ((ma << 2) + (ra << 6)) & 0x3fff; + uint32_t green_bank, *p = &bitmap.pix(y); + uint16_t const mem = ((ma << 2) + (ra << 6)) & 0x3fff; + // determine green bank if (BIT(m_port80, 4)) - green_bank = 0x2c000+mem; // alt green + green_bank = 0x2c000 + mem; // alt green else - green_bank = 0x28000+mem; // normal green + green_bank = 0x28000 + mem; // normal green - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - r = m_p_ram[0x20000+mem+x]; - b = m_p_ram[0x24000+mem+x]; - g = m_p_ram[green_bank+x]; + u8 const r = m_p_ram[0x20000 + mem + x]; + u8 const b = m_p_ram[0x24000 + mem + x]; + u8 const g = m_p_ram[green_bank + x]; *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); diff --git a/src/mame/drivers/candela.cpp b/src/mame/drivers/candela.cpp index ca381740f0a..ec9997a80a8 100644 --- a/src/mame/drivers/candela.cpp +++ b/src/mame/drivers/candela.cpp @@ -570,7 +570,7 @@ uint32_t can09_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (x = 0; x < 8; x++) { // if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + y, col + x) = x & 1; //(*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + y, col + x) = x & 1; //(*chardata & (1 << x)) ? 1 : 0; } // chardata++; } diff --git a/src/mame/drivers/canon_s80.cpp b/src/mame/drivers/canon_s80.cpp index 7e2aa68a4dc..7799077fb53 100644 --- a/src/mame/drivers/canon_s80.cpp +++ b/src/mame/drivers/canon_s80.cpp @@ -41,7 +41,7 @@ private: HD44780_PIXEL_UPDATE(canons80_state::pixel_update) { if (pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void canons80_state::canons80_map(address_map &map) diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp index 0db1f9319dd..6dac232e77b 100644 --- a/src/mame/drivers/cardline.cpp +++ b/src/mame/drivers/cardline.cpp @@ -136,9 +136,9 @@ MC6845_UPDATE_ROW( cardline_state::crtc_update_row ) int fg_col = gfx[fg_tile * 64 + ra * 8 + i]; if (fg_col == 1) - bitmap.pix32(y, x) = palette[bg_pal_ofs + bg_col]; + bitmap.pix(y, x) = palette[bg_pal_ofs + bg_col]; else - bitmap.pix32(y, x) = palette[fg_pal_ofs + fg_col]; + bitmap.pix(y, x) = palette[fg_pal_ofs + fg_col]; x++; } diff --git a/src/mame/drivers/casloopy.cpp b/src/mame/drivers/casloopy.cpp index 4ade93aa0eb..7beec8a8564 100644 --- a/src/mame/drivers/casloopy.cpp +++ b/src/mame/drivers/casloopy.cpp @@ -255,7 +255,6 @@ void casloopy_state::video_start() uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *gfx = m_gfxdecode->gfx(m_gfx_index); - int x,y; int count; static int test; @@ -279,9 +278,9 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm #endif count = test; - for (y=0;y<32;y++) + for (int y=0;y<32;y++) { - for (x=0;x<32;x++) + for (int x=0;x<32;x++) { uint16_t tile = (m_vram[count+1])|(m_vram[count]<<8); @@ -295,15 +294,13 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm count = test; - for (y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one? + for (int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one? { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t pix; - - pix = m_bitmap_vram[count]; + uint8_t pix = m_bitmap_vram[count]; if(pix) - bitmap.pix16(y, x) = pix + 0x100; + bitmap.pix(y, x) = pix + 0x100; count++; } diff --git a/src/mame/drivers/cat.cpp b/src/mame/drivers/cat.cpp index 353e2caa6ea..628fa66569f 100644 --- a/src/mame/drivers/cat.cpp +++ b/src/mame/drivers/cat.cpp @@ -960,10 +960,10 @@ uint32_t cat_state::screen_update_cat(screen_device &screen, bitmap_rgb32 &bitma int horpos = 0; for (int x = 0; x < 42; x++) { - uint16_t code = m_p_cat_videoram[addr++]; + const uint16_t code = m_p_cat_videoram[addr++]; for (int b = 15; b >= 0; b--) { - bitmap.pix32(y, horpos++) = BIT(code, b) ? on_color : off_color; + bitmap.pix(y, horpos++) = BIT(code, b) ? on_color : off_color; } } } diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp index 5cec01c471f..ae2bbae0d14 100644 --- a/src/mame/drivers/cbm2.cpp +++ b/src/mame/drivers/cbm2.cpp @@ -11,10 +11,7 @@ */ #include "emu.h" -#include "emupal.h" -#include "screen.h" -#include "softlist.h" -#include "speaker.h" + #include "bus/cbm2/exp.h" #include "bus/cbm2/user.h" #include "bus/ieee488/ieee488.h" @@ -37,6 +34,11 @@ #include "video/mc6845.h" #include "video/mos6566.h" +#include "emupal.h" +#include "screen.h" +#include "softlist.h" +#include "speaker.h" + #define PLA1_TAG "u78" #define PLA2_TAG "u88" #define MOS6567_TAG "u23" @@ -1413,7 +1415,7 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); int x = 0; @@ -1429,7 +1431,7 @@ MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) if (cursor_x == column) color ^= 1; color &= de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; if (bit < 8 || !m_graphics) data <<= 1; } diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index 31cb481ddc3..c0f60554e7e 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -226,7 +226,7 @@ HD44780_PIXEL_UPDATE(cc40_state::cc40_pixel_update) { // internal: 2*16, external: 1*31 if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp index f5469448101..01760a14fbd 100644 --- a/src/mame/drivers/cd2650.cpp +++ b/src/mame/drivers/cd2650.cpp @@ -189,26 +189,25 @@ u32 cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con Further, the letters have bit 6 set low, thus the range is 01 to 1A. When the bottom of the screen is reached, it does not scroll, it just wraps around. */ - u8 y,ra,chr,gfx; - u16 offset=0,sy=0,x,mem; + u16 offset=0,sy=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < CHARACTER_LINES; ra++) + for (u8 ra = 0; ra < CHARACTER_LINES; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (u16 x = 0; x < 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < CHARACTER_HEIGHT) { - mem = offset + y + (x<<4); + u16 mem = offset + y + (x<<4); if (mem > 0x4ff) mem -= 0x500; - chr = m_p_videoram[mem] & 0x3f; + u8 chr = m_p_videoram[mem] & 0x3f; gfx = m_p_chargen[(bitswap<8>(chr,7,6,2,1,0,3,4,5)<<3) | ra]; } diff --git a/src/mame/drivers/cdc721.cpp b/src/mame/drivers/cdc721.cpp index 028d9cae951..1643cf91350 100644 --- a/src/mame/drivers/cdc721.cpp +++ b/src/mame/drivers/cdc721.cpp @@ -259,24 +259,23 @@ void cdc721_state::cdc721_palette(palette_device &palette) const uint32_t cdc721_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,attr,pen; - uint16_t sy=0,x; + uint16_t sy=0; m_flashcnt++; - for (y = 0; y < 30; y++) + for (uint8_t y = 0; y < 30; y++) { uint16_t ma = m_videoram[y * 2] | m_videoram[y * 2 + 1] << 8; - for (ra = 0; ra < 15; ra++) + for (uint8_t ra = 0; ra < 15; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 160; x+=2) + for (uint16_t x = 0; x < 160; x+=2) { - pen = 1; - chr = m_videoram[(x + ma) & 0x1fff]; - attr = m_videoram[(x + ma + 1) & 0x1fff]; - gfx = m_rom_chargen[chr | (ra << 8) ]; + uint8_t pen = 1; + uint8_t chr = m_videoram[(x + ma) & 0x1fff]; + uint8_t attr = m_videoram[(x + ma + 1) & 0x1fff]; + uint8_t gfx = m_rom_chargen[chr | (ra << 8) ]; if (BIT(attr, 0)) // blank pen = 0; if (BIT(attr, 1) && (ra == 14)) // underline diff --git a/src/mame/drivers/cdi.cpp b/src/mame/drivers/cdi.cpp index 94e939df12b..f5579cf659a 100644 --- a/src/mame/drivers/cdi.cpp +++ b/src/mame/drivers/cdi.cpp @@ -402,7 +402,7 @@ void cdi_state::draw_lcd(int y) if (y >= 22 || !m_slave_hle.found()) return; - uint32_t *scanline = &m_lcdbitmap.pix32(y); + uint32_t *scanline = &m_lcdbitmap.pix(y); for (int lcd = 0; lcd < 8; lcd++) { diff --git a/src/mame/drivers/cesclass.cpp b/src/mame/drivers/cesclass.cpp index 73d88eaeccd..1ebb1c639f9 100644 --- a/src/mame/drivers/cesclass.cpp +++ b/src/mame/drivers/cesclass.cpp @@ -71,25 +71,21 @@ void cesclassic_state::video_start() uint32_t cesclassic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,xi; - bitmap.fill(m_palette->black_pen(), cliprect); + for(int y=0;y<64;y++) { - for(y=0;y<64;y++) + for(int x=0;x<16;x++) { - for(x=0;x<16;x++) + for(int xi=0;xi<16;xi++) { - for(xi=0;xi<16;xi++) - { - uint8_t color; + uint8_t color; - color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1); - color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1; + color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1); + color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1; - if((x*16+xi)<256 && ((y)+0)<256) - bitmap.pix32(y, x*16+xi) = m_palette->pen(color); - } + if((x*16+xi)<256 && ((y)+0)<256) + bitmap.pix(y, x*16+xi) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/cfx9850.cpp b/src/mame/drivers/cfx9850.cpp index ffed4490e53..cfd718e9aa1 100644 --- a/src/mame/drivers/cfx9850.cpp +++ b/src/mame/drivers/cfx9850.cpp @@ -270,7 +270,7 @@ u32 cfx9850_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co for (int b = 0; b < 8; b++) { - bitmap.pix16(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); + bitmap.pix(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); data1 <<= 1; data2 <<= 1; } diff --git a/src/mame/drivers/cgenie.cpp b/src/mame/drivers/cgenie.cpp index ca1fe971ec6..b9c8edae374 100644 --- a/src/mame/drivers/cgenie.cpp +++ b/src/mame/drivers/cgenie.cpp @@ -344,10 +344,10 @@ MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) { const rgb_t map[] = { m_background_color, m_palette[8], m_palette[6], m_palette[5] }; - bitmap.pix32(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; } else { @@ -367,7 +367,7 @@ MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) // 8 pixel chars for (int p = 0; p < 8; p++) - bitmap.pix32(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; + bitmap.pix(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; } } } diff --git a/src/mame/drivers/cit101.cpp b/src/mame/drivers/cit101.cpp index a34c5d077ef..97ec2c97ffa 100644 --- a/src/mame/drivers/cit101.cpp +++ b/src/mame/drivers/cit101.cpp @@ -232,7 +232,7 @@ u32 cit101_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con { const int line = ((z / (BIT(rowattr, 8) ? 2 : 1)) + (rowattr & 0x00f)) & 15; const bool last_line = z++ == rowlines - 1; - draw_line(&bitmap.pix32(y++), cliprect.left(), cliprect.right(), line, last_line, rowaddr, rowattr, scrattr); + draw_line(&bitmap.pix(y++), cliprect.left(), cliprect.right(), line, last_line, rowaddr, rowattr, scrattr); if (last_line) break; } diff --git a/src/mame/drivers/cit220.cpp b/src/mame/drivers/cit220.cpp index 18651203502..bbde707b26c 100644 --- a/src/mame/drivers/cit220.cpp +++ b/src/mame/drivers/cit220.cpp @@ -135,7 +135,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(cit220_state::draw_character) for (int i = 0; i < width; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/clayshoo.cpp b/src/mame/drivers/clayshoo.cpp index 87b59a9ad6f..3af7ad14ed8 100644 --- a/src/mame/drivers/clayshoo.cpp +++ b/src/mame/drivers/clayshoo.cpp @@ -196,7 +196,7 @@ uint32_t clayshoo_state::screen_update_clayshoo(screen_device &screen, bitmap_rg for (i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; data = data << 1; x = x + 1; diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index 326802a7bc6..aae6accb85e 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -105,43 +105,43 @@ public: for (int x = 0; x < 60; x++) { - uint8_t bit = m_ram->pointer()[offset++]; - - bitmap.pix16(y, (x * 8) + 0) = (bit >> 7) & 1; - bitmap.pix16(y, (x * 8) + 1) = (bit >> 6) & 1; - bitmap.pix16(y, (x * 8) + 2) = (bit >> 5) & 1; - bitmap.pix16(y, (x * 8) + 3) = (bit >> 4) & 1; - bitmap.pix16(y, (x * 8) + 4) = (bit >> 3) & 1; - bitmap.pix16(y, (x * 8) + 5) = (bit >> 2) & 1; - bitmap.pix16(y, (x * 8) + 6) = (bit >> 1) & 1; - bitmap.pix16(y, (x * 8) + 7) = (bit >> 0) & 1; + uint8_t const bit = m_ram->pointer()[offset++]; + + bitmap.pix(y, (x * 8) + 0) = BIT(bit, 7); + bitmap.pix(y, (x * 8) + 1) = BIT(bit, 6); + bitmap.pix(y, (x * 8) + 2) = BIT(bit, 5); + bitmap.pix(y, (x * 8) + 3) = BIT(bit, 4); + bitmap.pix(y, (x * 8) + 4) = BIT(bit, 3); + bitmap.pix(y, (x * 8) + 5) = BIT(bit, 2); + bitmap.pix(y, (x * 8) + 6) = BIT(bit, 1); + bitmap.pix(y, (x * 8) + 7) = BIT(bit, 0); } } } else { - uint8_t *font = m_lcd_char_rom->base(); + uint8_t const *font = m_lcd_char_rom->base(); if (m_lcd_mode & LCD_MODE_ALT) { font += 1024; } - int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; + int const chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; for (int y = 0; y < 128; y++) { - int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); + int const offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); for (int x = 0; x < 480; x++) { - uint8_t ch = m_ram->pointer()[offset + (x / chrw)]; + uint8_t const ch = m_ram->pointer()[offset + (x / chrw)]; uint8_t bit = font[((ch & 0x7f) * 8) + (y % 8)]; if (ch & 0x80) { bit = ~bit; } - bitmap.pix16(y, x) = (bit >> (7 - (x % chrw))) & 1; + bitmap.pix(y, x) = (bit >> (7 - (x % chrw))) & 1; } } } diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index 333d352af29..dc0d8a940a4 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -490,7 +490,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint8_t *src = &m_video_ram[(512/8) * ((y + y_scroll) & 0xff)]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 8) { @@ -507,7 +507,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit if (m_lp_touch_port->read() && BIT(m_q219_pia->b_output(), 1)) { /* Invert target pixel */ - bitmap.pix32(m_lp_y_port->read(), m_lp_x_port->read()) ^= 0x00ffffff; + bitmap.pix(m_lp_y_port->read(), m_lp_x_port->read()) ^= 0x00ffffff; } diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp index 162bf98d927..9fcd2d39ca6 100644 --- a/src/mame/drivers/cobra.cpp +++ b/src/mame/drivers/cobra.cpp @@ -860,8 +860,8 @@ public: void cobra_renderer::render_color_scan(int32_t scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid) { - uint32_t *fb = &m_backbuffer->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_backbuffer->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); float z = extent.param[POLY_Z].start; float dz = extent.param[POLY_Z].dpdx; @@ -961,8 +961,8 @@ void cobra_renderer::render_texture_scan(int32_t scanline, const extent_t &exten float ga = extent.param[POLY_A].start; float dga = extent.param[POLY_A].dpdx; - uint32_t *fb = &m_backbuffer->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_backbuffer->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); uint32_t texture_width = 1 << ((extradata.tex_format >> 28) & 0xf); uint32_t texture_height = 1 << ((extradata.tex_format >> 24) & 0xf); @@ -1066,7 +1066,7 @@ void cobra_renderer::draw_point(const rectangle &visarea, vertex_t &v, uint32_t if (x >= visarea.min_x && x <= visarea.max_x && y >= visarea.min_y && y <= visarea.max_y) { - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; } } @@ -1094,7 +1094,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t { int y = y1 + (dy * (float)(x - x1) / (float)(dx)); - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; x++; @@ -1107,7 +1107,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t { int x = x1 + (dx * (float)(y - y1) / (float)(dy)); - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; y++; @@ -2610,11 +2610,11 @@ void cobra_renderer::gfx_fifo_exec() uint32_t *buffer; switch (m_gfx_gram[0x80104/4]) { - case 0x800000: buffer = &m_framebuffer->pix32(y); break; - case 0x200000: buffer = &m_backbuffer->pix32(y); break; - case 0x0e0000: buffer = &m_overlay->pix32(y); break; - case 0x000800: buffer = &m_zbuffer->pix32(y); break; - case 0x000200: buffer = &m_stencil->pix32(y); break; + case 0x800000: buffer = &m_framebuffer->pix(y); break; + case 0x200000: buffer = &m_backbuffer->pix(y); break; + case 0x0e0000: buffer = &m_overlay->pix(y); break; + case 0x000800: buffer = &m_zbuffer->pix(y); break; + case 0x000200: buffer = &m_stencil->pix(y); break; default: { @@ -2666,11 +2666,11 @@ void cobra_renderer::gfx_fifo_exec() uint32_t *buffer; switch (m_gfx_gram[0x80104/4]) { - case 0x800000: buffer = &m_framebuffer->pix32(y+i); break; - case 0x200000: buffer = &m_backbuffer->pix32(y+i); break; - case 0x0e0000: buffer = &m_overlay->pix32(y+i); break; - case 0x000800: buffer = &m_zbuffer->pix32(y+i); break; - case 0x000200: buffer = &m_stencil->pix32(y+i); break; + case 0x800000: buffer = &m_framebuffer->pix(y+i); break; + case 0x200000: buffer = &m_backbuffer->pix(y+i); break; + case 0x0e0000: buffer = &m_overlay->pix(y+i); break; + case 0x000800: buffer = &m_zbuffer->pix(y+i); break; + case 0x000200: buffer = &m_stencil->pix(y+i); break; default: { diff --git a/src/mame/drivers/cocoloco.cpp b/src/mame/drivers/cocoloco.cpp index 37e9ac204ba..18e6e0060d4 100644 --- a/src/mame/drivers/cocoloco.cpp +++ b/src/mame/drivers/cocoloco.cpp @@ -288,7 +288,7 @@ uint32_t cocoloco_state::screen_update(screen_device &screen, bitmap_ind16 &bitm color |= ((m_videoram[count|0x6000] >> (xi)) & 1) << 3; if (cliprect.contains(x + xi, 256 - y)) - bitmap.pix16(256 - y, x + xi) = m_palette->pen(color & 0x0f); + bitmap.pix(256 - y, x + xi) = m_palette->pen(color & 0x0f); } count++; diff --git a/src/mame/drivers/compucolor.cpp b/src/mame/drivers/compucolor.cpp index f5dc5662f4b..ca1b9824215 100644 --- a/src/mame/drivers/compucolor.cpp +++ b/src/mame/drivers/compucolor.cpp @@ -284,12 +284,12 @@ uint32_t compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &b uint8_t data = m_char_rom->base()[char_offs]; - rgb_t fg = m_palette->pen_color(attr & 0x07); - rgb_t bg = m_palette->pen_color((attr >> 3) & 0x07); + rgb_t const fg = m_palette->pen_color(attr & 0x07); + rgb_t const bg = m_palette->pen_color((attr >> 3) & 0x07); for (int x = 0; x < 6; x++) { - bitmap.pix32(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; + bitmap.pix(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; data <<= 1; } diff --git a/src/mame/drivers/consola_emt.cpp b/src/mame/drivers/consola_emt.cpp index 8e5abca8046..74bff79497f 100644 --- a/src/mame/drivers/consola_emt.cpp +++ b/src/mame/drivers/consola_emt.cpp @@ -233,7 +233,7 @@ HD44780_PIXEL_UPDATE( consoemt_state::lcd_pixel_update ) return; if (line < 2 && pos < 20) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/drivers/coolpool.cpp b/src/mame/drivers/coolpool.cpp index 8028dcc7a7e..f5fad8a2a87 100644 --- a/src/mame/drivers/coolpool.cpp +++ b/src/mame/drivers/coolpool.cpp @@ -63,21 +63,20 @@ static const uint16_t nvram_unlock_seq[] = TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::amerdart_scanline) { - uint16_t *vram = &m_vram_base[(params->rowaddr << 8) & 0xff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram_base[(params->rowaddr << 8) & 0xff00]; + uint32_t *const dest = &bitmap.pix(scanline); rgb_t pens[16]; int coladdr = params->coladdr; - int x; /* update the palette */ if (scanline < 256) - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { uint16_t pal = m_vram_base[x]; pens[x] = rgb_t(pal4bit(pal >> 4), pal4bit(pal >> 8), pal4bit(pal >> 12)); } - for (x = params->heblnk; x < params->hsblnk; x += 4) + for (int x = params->heblnk; x < params->hsblnk; x += 4) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[(pixels >> 0) & 15]; @@ -90,13 +89,12 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::amerdart_scanline) TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::coolpool_scanline) { - uint16_t *vram = &m_vram_base[(params->rowaddr << 8) & 0x1ff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const vram = &m_vram_base[(params->rowaddr << 8) & 0x1ff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/coolridr.cpp b/src/mame/drivers/coolridr.cpp index 8b454e86424..cbb54e200b3 100644 --- a/src/mame/drivers/coolridr.cpp +++ b/src/mame/drivers/coolridr.cpp @@ -663,17 +663,17 @@ do { /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + PIXEL_TYPE *destptr = &dest.pix(cury, destx); \ + const uint8_t *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ for (curx = 0; curx < numblocks; curx++) \ { \ - COOL_PIXEL_OP(destptr[0], srcptr[0]); \ - COOL_PIXEL_OP(destptr[1], srcptr[1]); \ - COOL_PIXEL_OP(destptr[2], srcptr[2]); \ - COOL_PIXEL_OP(destptr[3], srcptr[3]); \ + COOL_PIXEL_OP(destptr[0], srcptr[0]); \ + COOL_PIXEL_OP(destptr[1], srcptr[1]); \ + COOL_PIXEL_OP(destptr[2], srcptr[2]); \ + COOL_PIXEL_OP(destptr[3], srcptr[3]); \ \ srcptr += 4; \ destptr += 4; \ @@ -682,7 +682,7 @@ do { /* iterate over leftover pixels */ \ for (curx = 0; curx < leftovers; curx++) \ { \ - COOL_PIXEL_OP(destptr[0], srcptr[0]); \ + COOL_PIXEL_OP(destptr[0], srcptr[0]); \ srcptr++; \ destptr++; \ } \ @@ -695,8 +695,8 @@ do { /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + PIXEL_TYPE *destptr = &dest.pix(cury, destx); \ + const uint8_t *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -910,8 +910,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t* linesrc = &m_screen_bitmap[Screen].pix16(y); - uint16_t* linedest = &bitmap.pix16(y); + uint16_t const *const linesrc = &m_screen_bitmap[Screen].pix(y); + uint16_t *const linedest = &bitmap.pix(y); for (int x = cliprect.left(); x<= cliprect.right(); x++) { @@ -1129,8 +1129,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm const int pixelOffsetnextX = ((hPositionTable) + ((h+1)* 16 * hZoomHere)) / 0x40; \ if (drawy>clipmaxY) { break; }; \ if (drawy<clipminY) { drawy++; continue; }; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int blockwide = pixelOffsetnextX-pixelOffsetX; \ if (pixelOffsetX+blockwide <clipminX) { drawy++; continue; } \ if (pixelOffsetX>clipmaxX) { drawy++; continue; } \ @@ -1167,8 +1167,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int realy = ((y*incy)>>21); \ const int drawy = pixelOffsetY+y; \ if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int drawx = pixelOffsetX; \ for (int x = 0; x < blockwide; x++) \ { \ @@ -1185,8 +1185,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { \ const int drawy = pixelOffsetY+realy; \ if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int drawx = pixelOffsetX; \ for (int realx = 0; realx < 16; realx++) \ { \ @@ -1937,9 +1937,6 @@ void *coolridr_state::draw_object_threaded(void *param, int threadid) uint32_t incy = 0x8000000 / vZoom; // DEBUG: Draw 16x16 block - uint16_t* line; - //uint16_t* zline; - if (indirect_zoom_enable) { diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp index d8bd5d0ae54..90c58278ed9 100644 --- a/src/mame/drivers/corona.cpp +++ b/src/mame/drivers/corona.cpp @@ -499,22 +499,18 @@ void corona_state::video_start() uint32_t corona_state::screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) - bitmap.pix16(y, x) = m_videobuf[y * 512 + x]; + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(y, x) = m_videobuf[y * 512 + x]; return 0; } uint32_t corona_state::screen_update_luckyrlt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) - bitmap.pix16(255 - y, x) = m_videobuf[y * 512 + x]; + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(255 - y, x) = m_videobuf[y * 512 + x]; return 0; } diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp index ce0a55bc62c..ab0408d1a1c 100644 --- a/src/mame/drivers/cps3.cpp +++ b/src/mame/drivers/cps3.cpp @@ -707,8 +707,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -723,8 +723,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -740,8 +740,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -757,8 +757,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -1288,8 +1288,8 @@ u32 cps3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const /* copy render bitmap without zoom */ for (u32 rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++) { - u32* dstbitmap = &bitmap.pix32(rendery); - u32* srcbitmap = &m_renderbuffer_bitmap.pix32(rendery); + u32 *const dstbitmap = &bitmap.pix(rendery); + u32 const *const srcbitmap = &m_renderbuffer_bitmap.pix(rendery); for (u32 renderx = cliprect.left(); renderx <= cliprect.right(); renderx++) { @@ -1303,8 +1303,8 @@ u32 cps3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const u32 srcy = cliprect.top() * fszy; for (u32 rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++) { - u32* dstbitmap = &bitmap.pix32(rendery); - u32* srcbitmap = &m_renderbuffer_bitmap.pix32(srcy >> 16); + u32 *const dstbitmap = &bitmap.pix(rendery); + u32 const *const srcbitmap = &m_renderbuffer_bitmap.pix(srcy >> 16); u32 srcx = cliprect.left() * fszx; for (u32 renderx = cliprect.left(); renderx <= cliprect.right(); renderx++) diff --git a/src/mame/drivers/cubeqst.cpp b/src/mame/drivers/cubeqst.cpp index 6df6c4eec61..96a799ac89b 100644 --- a/src/mame/drivers/cubeqst.cpp +++ b/src/mame/drivers/cubeqst.cpp @@ -130,8 +130,6 @@ void cubeqst_state::palette_w(offs_t offset, uint16_t data, uint16_t mem_mask) /* TODO: This is a simplified version of what actually happens */ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; - /* * Clear the display with palette RAM entry 0xff * This will be either transparent or an actual colour @@ -141,13 +139,11 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 bitmap.fill(m_colormap[255], cliprect); /* TODO: Add 1 for linebuffering? */ - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - int i; int num_entries = m_linecpu->cubeqcpu_get_ptr_ram_val(y); - uint32_t *stk_ram = m_linecpu->cubeqcpu_get_stack_ram(); - uint32_t *dest = &bitmap.pix32(y); - uint32_t pen; + uint32_t const *const stk_ram = m_linecpu->cubeqcpu_get_stack_ram(); + uint32_t *const dest = &bitmap.pix(y); /* Zap the depth buffer */ memset(m_depth_buffer.get(), 0xff, 512); @@ -155,11 +151,10 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 /* Process all the spans on this scanline */ if (y < 256) { - for (i = 0; i < num_entries; i += 2) + for (int i = 0; i < num_entries; i += 2) { int color = 0, depth = 0; int h1 = 0, h2 = 0; - int x; int entry1 = stk_ram[(y << 7) | ((i + 0) & 0x7f)]; int entry2 = stk_ram[(y << 7) | ((i + 1) & 0x7f)]; @@ -187,8 +182,8 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 } /* Draw the span, testing for depth */ - pen = m_colormap[m_generic_paletteram_16[color]]; - for (x = h1; x <= h2; ++x) + uint32_t pen = m_colormap[m_generic_paletteram_16[color]]; + for (int x = h1; x <= h2; ++x) { if (!(m_depth_buffer[x] < depth)) { diff --git a/src/mame/drivers/cupidon.cpp b/src/mame/drivers/cupidon.cpp index a4681e71eaf..4f0066ebf99 100644 --- a/src/mame/drivers/cupidon.cpp +++ b/src/mame/drivers/cupidon.cpp @@ -29,25 +29,23 @@ public: m_gfxram(*this, "gfxram") { } + void init_cupidon(); + void init_funnyfm(); + + void cupidon(machine_config &config); + void cupidon_map(address_map &map); + +protected: // devices required_device<m68340_cpu_device> m_maincpu; required_shared_ptr<uint32_t> m_gfxram; uint32_t screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void init_cupidon(); - void init_funnyfm(); - uint32_t cupidon_return_ffffffff() { return -1; // or it hits an illegal opcode (sleep on the 68340?) - }; - - void cupidon(machine_config &config); - void cupidon_map(address_map &map); -protected: - - + } }; uint32_t cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -60,7 +58,7 @@ uint32_t cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind1 { for (int y=0;y<16;y++) { - uint16_t* destline = &bitmap.pix16(ytile*16 + y); + uint16_t *const destline = &bitmap.pix(ytile*16 + y); for (int x=0;x<8;x++) { diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp index 612e69281e3..a477f9626df 100644 --- a/src/mame/drivers/cxhumax.cpp +++ b/src/mame/drivers/cxhumax.cpp @@ -897,17 +897,14 @@ static inline uint32_t ycc_to_rgb(uint32_t ycc) uint32_t cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - uint32_t osd_pointer = m_drm1_regs[DRM_OSD_PTR_REG]; if(osd_pointer) { - uint32_t *ram = m_ram; - uint32_t *osd_header = &ram[osd_pointer/4]; - uint8_t *vbuf = (uint8_t*)(&ram[osd_header[3]/4]); - uint32_t *palette = &ram[osd_header[7]/4]; + uint32_t const *ram = m_ram; + uint32_t const *osd_header = &ram[osd_pointer/4]; + uint8_t const *vbuf = (uint8_t*)(&ram[osd_header[3]/4]); + uint32_t const *palette = &ram[osd_header[7]/4]; uint32_t x_disp_start_and_width = osd_header[1]; uint32_t xdisp_width = (x_disp_start_and_width >> 16) & 0x1fff; @@ -927,14 +924,14 @@ uint32_t cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb3 uint32_t first_y = m_drm0_regs[DRM_ACTIVE_Y_REG] & 0xfff; uint32_t last_y = (m_drm0_regs[DRM_ACTIVE_Y_REG] >> 16) & 0xfff;*/ - for (j=ydisp_start; j <= ydisp_last; j++) + for (int j=ydisp_start; j <= ydisp_last; j++) { - uint32_t *bmp = &bitmap.pix32(j); + uint32_t *const bmp = &bitmap.pix(j); - for (i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) + for (int i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) { if ((i <= (xdisp_start + ximg_width)) && (j <= (ydisp_start + yimg_height))) { - bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; + bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; // FIXME: need BYTE4_XOR_?E for endianness } else { bmp[i] = ycc_to_rgb(m_drm1_regs[DRM_BCKGND_REG]); } diff --git a/src/mame/drivers/cybertnk.cpp b/src/mame/drivers/cybertnk.cpp index 306769ebbb5..bc713eedbe1 100644 --- a/src/mame/drivers/cybertnk.cpp +++ b/src/mame/drivers/cybertnk.cpp @@ -379,7 +379,7 @@ void cybertnk_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c if ((yy>=miny) && (yy<=maxy)) { - dest = &bitmap.pix16(yy, 0); + dest = &bitmap.pix(yy, 0); int start,end,inc; diff --git a/src/mame/drivers/cz101.cpp b/src/mame/drivers/cz101.cpp index b41b08c17b0..1e475f33125 100644 --- a/src/mame/drivers/cz101.cpp +++ b/src/mame/drivers/cz101.cpp @@ -259,7 +259,7 @@ HD44780_PIXEL_UPDATE( cz101_state::lcd_pixel_update ) return; if (line < 2 && pos < 16) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } void cz101_state::led_4_w(uint8_t data) diff --git a/src/mame/drivers/d6800.cpp b/src/mame/drivers/d6800.cpp index 49bc8d9ead2..010f6274193 100644 --- a/src/mame/drivers/d6800.cpp +++ b/src/mame/drivers/d6800.cpp @@ -171,16 +171,16 @@ INPUT_CHANGED_MEMBER(d6800_state::reset_button) /* Video */ uint32_t d6800_state::screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t x,y,gfx=0; + uint8_t gfx=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = 0; x < 8; x++) + for (uint8_t x = 0; x < 8; x++) { if (m_cb2) - gfx = m_videoram[ x | (y<<3)]; + gfx = m_videoram[x | (y<<3)]; *p++ = BIT(gfx, 7); *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/dai3wksi.cpp b/src/mame/drivers/dai3wksi.cpp index 91293f00cee..64a54bdad0e 100644 --- a/src/mame/drivers/dai3wksi.cpp +++ b/src/mame/drivers/dai3wksi.cpp @@ -179,9 +179,9 @@ uint32_t dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rg rgb_t pen = (data & (1 << i)) ? m_palette->pen_color(color) : rgb_t::black(); if (m_dai3wksi_flipscreen) - bitmap.pix32(255-y, 255-x) = pen; + bitmap.pix(255-y, 255-x) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; x++; } diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index 85e8f828216..8e59a701fa2 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -1703,7 +1703,6 @@ uint8_t ddenlovr_state::ddenlovr_gfxrom_r() void ddenlovr_state::copylayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer) { - int x,y; int scrollx = m_ddenlovr_scroll[layer / 4 * 8 + (layer % 4) + 0]; int scrolly = m_ddenlovr_scroll[layer / 4 * 8 + (layer % 4) + 4]; @@ -1720,15 +1719,15 @@ void ddenlovr_state::copylayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (((m_ddenlovr_layer_enable2 << 4) | m_ddenlovr_layer_enable) & (1 << layer)) { - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { int pen = m_ddenlovr_pixmap[layer][512 * ((y + scrolly) & 0x1ff) + ((x + scrollx) & 0x1ff)]; if ((pen & transmask) != transpen) { pen &= penmask; - bitmap.pix32(y, x) = pens[pen]; + bitmap.pix(y, x) = pens[pen]; } } } @@ -4283,18 +4282,16 @@ VIDEO_START_MEMBER(htengoku_state,htengoku) uint32_t htengoku_state::screen_update_htengoku(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int layer, x, y; - // render the layers, one by one, "dynax.c" style. Then convert the pixmaps to "ddenlovr.c" // format and let screen_update_ddenlovr() do the final compositing (priorities + palettes) - for (layer = 0; layer < 4; layer++) + for (int layer = 0; layer < 4; layer++) { m_htengoku_layer.fill(0, cliprect); hanamai_copylayer(m_htengoku_layer, cliprect, layer); - for (y = 0; y < 256; y++) - for (x = 0; x < 512; x++) - m_ddenlovr_pixmap[3 - layer][y * 512 + x] = (uint8_t)(m_htengoku_layer.pix16(y, x)); + for (int y = 0; y < 256; y++) + for (int x = 0; x < 512; x++) + m_ddenlovr_pixmap[3 - layer][y * 512 + x] = uint8_t(m_htengoku_layer.pix(y, x)); } return screen_update_ddenlovr(screen, bitmap, cliprect); diff --git a/src/mame/drivers/decstation.cpp b/src/mame/drivers/decstation.cpp index 36125d8c584..aa0ecc18f17 100644 --- a/src/mame/drivers/decstation.cpp +++ b/src/mame/drivers/decstation.cpp @@ -171,17 +171,14 @@ void decstation_state::video_start() uint32_t decstation_state::kn01_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - uint8_t *vram = (uint8_t *)m_kn01vram.target(); + uint8_t const *const vram = (uint8_t *)m_kn01vram.target(); - for (y = 0; y < 864; y++) + for (int y = 0; y < 864; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024; x++) { - pixels = vram[(y * 1024) + x]; + uint8_t const pixels = vram[(y * 1024) + x]; *scanline++ = m_palette[pixels]; } } diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp index 8d328ae2003..fd863440050 100644 --- a/src/mame/drivers/destroyr.cpp +++ b/src/mame/drivers/destroyr.cpp @@ -174,7 +174,7 @@ uint32_t destroyr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int i = 0; i < 256; i++) { if (i & 4) - bitmap.pix16(m_cursor ^ 0xff, i) = 7; + bitmap.pix(m_cursor ^ 0xff, i) = 7; } return 0; } diff --git a/src/mame/drivers/dgpix.cpp b/src/mame/drivers/dgpix.cpp index 29484abd2d0..e06bdcb99b2 100644 --- a/src/mame/drivers/dgpix.cpp +++ b/src/mame/drivers/dgpix.cpp @@ -419,8 +419,8 @@ u32 dgpix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { int x = cliprect.left(); - u16 *src = &m_vram[(m_vbuffer ? 0 : 0x20000) | (y << 9) | x]; - u16 *dest = &bitmap.pix16(y, x); + u16 const *src = &m_vram[(m_vbuffer ? 0 : 0x20000) | (y << 9) | x]; + u16 *dest = &bitmap.pix(y, x); for (; x <= cliprect.right(); x++) { diff --git a/src/mame/drivers/dim68k.cpp b/src/mame/drivers/dim68k.cpp index ebb3ce6763d..b2937aaef95 100644 --- a/src/mame/drivers/dim68k.cpp +++ b/src/mame/drivers/dim68k.cpp @@ -234,20 +234,20 @@ void dim68k_state::machine_reset() // Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used. MC6845_UPDATE_ROW( dim68k_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,x,xx,inv; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint16_t chr16=0x2020; // set to spaces if screen is off - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); u8 screen_on = ~m_video_control & 4; u8 dot8 = ~m_video_control & 40; // need to divide everything in half to cater for 16-bit reads x_count /= 2; ma /= 2; - xx = 0; + u8 xx = 0; - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { + u8 inv, chr, gfx; if (screen_on) chr16 = m_ram[ma+x]; // reads 2 characters diff --git a/src/mame/drivers/dkmb.cpp b/src/mame/drivers/dkmb.cpp index 5a83f16b125..715c0c03bbb 100644 --- a/src/mame/drivers/dkmb.cpp +++ b/src/mame/drivers/dkmb.cpp @@ -67,11 +67,11 @@ uint32_t dkmb_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, int count = 0; for (int y = 0; y < 256; y++) { - uint32_t* dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = 0; x < 1024 / 2; x++) { - uint64_t val = m_framebuffer[count]; + uint64_t const val = m_framebuffer[count]; dst[(x * 2) + 0] = (val >> 32) & 0x00ffffff; dst[(x * 2) + 1] = (val >> 0) & 0x00ffffff; diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index ced56a6fb8c..ba0a6881739 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -315,17 +315,17 @@ UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) for(int xi=0; xi<16; xi++) { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; + int r = BIT(red, xi) ? 255 : 0; + int g = BIT(green, xi) ? 255 : 0; + int b = BIT(blue, xi) ? 255 : 0; if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + bitmap.pix(y, x + xi) = rgb_t(r, g, b); } } else { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // 32KB videoram uint16_t gfx = m_video_ram[(address & 0xffff) >> 1]; @@ -333,7 +333,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) for(int xi=0;xi<16;xi++) { if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = ((gfx >> xi) & 1) ? palette[2] : palette[0]; + bitmap.pix(y, x + xi) = ((gfx >> xi) & 1) ? palette[2] : palette[0]; } } } @@ -367,18 +367,17 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) for( int xi = 0; xi < 8; xi++) { - int res_x,res_y; int pen = (tile_data >> xi) & 1 ? 1 : 0; - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; if(yi >= 16) { pen = 0; } - bitmap.pix32(res_y, res_x) = pen ? fg : bg; + bitmap.pix(res_y, res_x) = pen ? fg : bg; } } } diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp index c1498e8e5ce..c8fc3ac0278 100644 --- a/src/mame/drivers/dooyong.cpp +++ b/src/mame/drivers/dooyong.cpp @@ -770,9 +770,9 @@ u32 popbingo_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 & for (int y = cliprect.top(); cliprect.bottom() >= y; y++) { - const u16 *const bg_src(&m_bg_bitmap[0].pix16(y, 0)); - const u16 *const bg2_src(&m_bg_bitmap[1].pix16(y, 0)); - u16 *const dst(&bitmap.pix16(y, 0)); + const u16 *const bg_src(&m_bg_bitmap[0].pix(y, 0)); + const u16 *const bg2_src(&m_bg_bitmap[1].pix(y, 0)); + u16 *const dst(&bitmap.pix(y, 0)); for (int x = cliprect.left(); cliprect.right() >= x; x++) dst[x] = 0x100U | (bg_src[x] << 4) | bg2_src[x]; } diff --git a/src/mame/drivers/dorachan.cpp b/src/mame/drivers/dorachan.cpp index fc0e8a74f96..54820630f8c 100644 --- a/src/mame/drivers/dorachan.cpp +++ b/src/mame/drivers/dorachan.cpp @@ -74,8 +74,6 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg { for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - uint8_t fore_color; - uint8_t x = offs >> 8 << 3; uint8_t y = offs & 0xff; @@ -84,6 +82,7 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg uint8_t data = m_videoram[offs]; + uint8_t fore_color; if (m_flip_screen) fore_color = (m_colors[color_address] >> 3) & 0x07; else @@ -92,7 +91,7 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg for (int i = 0; i < 8; i++) { uint8_t color = BIT(data, i) ? fore_color : 0; - bitmap.pix32(y, x++) = m_palette->pen_color(color); + bitmap.pix(y, x++) = m_palette->pen_color(color); } } diff --git a/src/mame/drivers/dotrikun.cpp b/src/mame/drivers/dotrikun.cpp index 9fb00be2adf..3f56aeafaa1 100644 --- a/src/mame/drivers/dotrikun.cpp +++ b/src/mame/drivers/dotrikun.cpp @@ -130,7 +130,7 @@ uint32_t dotrikun_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if ((x & 7) == 0) m_vram_latch = m_vram[x >> 3 | y >> 1 << 4]; - bitmap.pix16(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3; + bitmap.pix(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3; } } diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index 3f6608f311a..87b278a2638 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -1068,8 +1068,8 @@ void dpb7000_state::device_timer(emu_timer &timer, device_timer_id id, int param MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row) { - const pen_t *pen = m_palette->pens(); - const uint8_t *char_rom = m_vdu_char_rom->base(); + const pen_t *const pen = m_palette->pens(); + const uint8_t *const char_rom = m_vdu_char_rom->base(); for (int column = 0; column < x_count; column++) { @@ -1087,7 +1087,7 @@ MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row) int x = (column * 8) + bit; int color = BIT(data, 7) && de; - bitmap.pix32(y, x) = pen[color]; + bitmap.pix(y, x) = pen[color]; data <<= 1; } @@ -2396,9 +2396,9 @@ uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 { for (int py = 0; py < 768; py++) { - uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; - uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; - uint32_t *dst = &bitmap.pix32(py); + const uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; + const uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; + uint32_t *dst = &bitmap.pix(py); for (int px = 0; px < 800; px++) { const uint32_t u = *src_chr++ << 16; @@ -2412,9 +2412,9 @@ uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 { for (int py = 512; py < 768; py++) { - uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; - uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; - uint32_t *dst = &bitmap.pix32(py); + const uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; + const uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; + uint32_t *dst = &bitmap.pix(py); for (int px = 0; px < 256; px += 2) { const uint32_t u = *src_chr++ << 16; diff --git a/src/mame/drivers/duet16.cpp b/src/mame/drivers/duet16.cpp index e2c0f49c303..54d3e4b246e 100644 --- a/src/mame/drivers/duet16.cpp +++ b/src/mame/drivers/duet16.cpp @@ -194,7 +194,7 @@ MC6845_UPDATE_ROW(duet16_state::crtc_update_row) { if(!de) return; - u8 *gvram = (u8 *)&m_gvram[0]; + u8 const *const gvram = (u8 *)&m_gvram[0]; for(int i = 0; i < x_count; i++) { u16 coffset = (ma + i) & 0x07ff; @@ -235,7 +235,7 @@ MC6845_UPDATE_ROW(duet16_state::crtc_update_row) color = m_pal->pen_color((BIT(g2, 7 - xi) << 2) | (BIT(g1, 7 - xi) << 1) | BIT(g0, 7 - xi)); else color = 0; - bitmap.pix32(y, (i * 8) + xi) = color; + bitmap.pix(y, (i * 8) + xi) = color; } } } diff --git a/src/mame/drivers/dvk_kcgd.cpp b/src/mame/drivers/dvk_kcgd.cpp index 664a1d83db0..0844a6781e4 100644 --- a/src/mame/drivers/dvk_kcgd.cpp +++ b/src/mame/drivers/dvk_kcgd.cpp @@ -307,19 +307,19 @@ void kcgd_state::draw_scanline(uint16_t *p, uint16_t offset) TIMER_DEVICE_CALLBACK_MEMBER(kcgd_state::scanline_callback) { - uint16_t y = m_screen->vpos(), offset; + uint16_t y = m_screen->vpos(); if (y < KCGD_VERT_START) return; y -= KCGD_VERT_START; if (y >= KCGD_DISP_VERT) return; - offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); + uint16_t const offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); DBG_LOG(2,"scanline_cb", ("frame %d y %.3d page %d offset %04X *offset %04X\n", m_screen->frame_number(), BIT(m_video.status, KCGD_STATUS_PAGE), y, offset + y, m_videoram[offset + y])); - draw_scanline(&m_tmpbmp.pix16(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); + draw_scanline(&m_tmpbmp.pix(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); } uint32_t kcgd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp index 37dc73a84e8..4a6bc1afa65 100644 --- a/src/mame/drivers/dvk_ksm.cpp +++ b/src/mame/drivers/dvk_ksm.cpp @@ -365,7 +365,6 @@ uint32_t ksm_state::draw_scanline(uint16_t *p, uint16_t offset, uint8_t scanline TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) { uint16_t y = m_screen->vpos(); - uint16_t offset; LOGDBG("scanline_cb addr %02x frame %d x %.4d y %.3d row %.2d\n", m_video.line, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11); @@ -374,6 +373,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) y -= KSM_VERT_START; if (y >= KSM_DISP_VERT) return; + uint16_t offset; if (y < KSM_STATUSLINE_TOTAL) { offset = KSM_STATUSLINE_VRAM - 0xC000; @@ -383,7 +383,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) offset = 0x2000 + 0x30 + (((m_video.line + y / 11 - 1) % 48) << 7); } - draw_scanline(&m_tmpbmp.pix16(y), offset, y % 11); + draw_scanline(&m_tmpbmp.pix(y), offset, y % 11); } uint32_t ksm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dwarfd.cpp b/src/mame/drivers/dwarfd.cpp index 246e31d1bb1..4e040d7581b 100644 --- a/src/mame/drivers/dwarfd.cpp +++ b/src/mame/drivers/dwarfd.cpp @@ -619,10 +619,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::pesp_display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } @@ -642,10 +642,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } @@ -665,10 +665,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::qc_display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } diff --git a/src/mame/drivers/e100.cpp b/src/mame/drivers/e100.cpp index 6afd7a2ec69..2ac709df04e 100644 --- a/src/mame/drivers/e100.cpp +++ b/src/mame/drivers/e100.cpp @@ -235,7 +235,7 @@ uint32_t e100_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (x = 0; x < 8; x++) { if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0; } chardata++; } diff --git a/src/mame/drivers/ec65.cpp b/src/mame/drivers/ec65.cpp index c18395857b2..4ce325e34b5 100644 --- a/src/mame/drivers/ec65.cpp +++ b/src/mame/drivers/ec65.cpp @@ -164,19 +164,17 @@ void ec65_state::machine_reset() MC6845_UPDATE_ROW( ec65_common::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,inv; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; + u8 const inv = (x == cursor_x) ? 0xff : 0; + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; + u8 const gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/embargo.cpp b/src/mame/drivers/embargo.cpp index 9c528330d11..44d903197b8 100644 --- a/src/mame/drivers/embargo.cpp +++ b/src/mame/drivers/embargo.cpp @@ -52,23 +52,19 @@ private: uint32_t embargo_state::screen_update_embargo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - uint8_t y = offs >> 5; + uint8_t const y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/emu68k.cpp b/src/mame/drivers/emu68k.cpp index 2d2dba851cb..f4deb4ebf30 100644 --- a/src/mame/drivers/emu68k.cpp +++ b/src/mame/drivers/emu68k.cpp @@ -54,7 +54,7 @@ void emu68k_state::machine_start() HD44780_PIXEL_UPDATE(emu68k_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/enigma2.cpp b/src/mame/drivers/enigma2.cpp index 7d9b2211cd0..6537fa57d92 100644 --- a/src/mame/drivers/enigma2.cpp +++ b/src/mame/drivers/enigma2.cpp @@ -282,7 +282,7 @@ uint32_t enigma2_state::screen_update_enigma2(screen_device &screen, bitmap_rgb3 /* stars only appear at certain positions */ color = ((x & y & 0x0f) == 0x0f) ? star_color : 0; - bitmap.pix32(bitmap_y, x) = m_palette->pen_color(color); + bitmap.pix(bitmap_y, x) = m_palette->pen_color(color); /* next pixel */ x = x + 1; @@ -344,7 +344,7 @@ uint32_t enigma2_state::screen_update_enigma2a(screen_device &screen, bitmap_rgb } pen = bit ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(bitmap_y, x) = pen; + bitmap.pix(bitmap_y, x) = pen; /* next pixel */ x = x + 1; diff --git a/src/mame/drivers/eolith16.cpp b/src/mame/drivers/eolith16.cpp index de0de146aaa..d3ad8c11532 100644 --- a/src/mame/drivers/eolith16.cpp +++ b/src/mame/drivers/eolith16.cpp @@ -129,7 +129,7 @@ uint32_t eolith16_state::screen_update_eolith16(screen_device &screen, bitmap_in { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[(y * 320) + x] & 0xff; + bitmap.pix(y, x) = m_vram[(y * 320) + x] & 0xff; } } return 0; diff --git a/src/mame/drivers/epic14e.cpp b/src/mame/drivers/epic14e.cpp index a32884f75ee..65647de0e8b 100644 --- a/src/mame/drivers/epic14e.cpp +++ b/src/mame/drivers/epic14e.cpp @@ -61,7 +61,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(epic14e_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index 98eeea10226..f47cbf90200 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -118,7 +118,7 @@ uint32_t esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitma for(int yi=0;yi<8;yi++) for(int xi=0;xi<8;xi++) - bitmap.pix32(yi+chary*8, xi+charx*8) = m_palette->pen(palIndex * 8 + pal_bank * 0x100); + bitmap.pix(yi+chary*8, xi+charx*8) = m_palette->pen(palIndex * 8 + pal_bank * 0x100); continue; } diff --git a/src/mame/drivers/esprit.cpp b/src/mame/drivers/esprit.cpp index 610c0fca646..6969eabe52e 100644 --- a/src/mame/drivers/esprit.cpp +++ b/src/mame/drivers/esprit.cpp @@ -82,8 +82,8 @@ INPUT_PORTS_END MC6845_UPDATE_ROW(esprit_state::crtc_update_row) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/eurit.cpp b/src/mame/drivers/eurit.cpp index 24b9ad57b44..1bb12cfc320 100644 --- a/src/mame/drivers/eurit.cpp +++ b/src/mame/drivers/eurit.cpp @@ -53,7 +53,7 @@ void eurit_state::machine_start() HD44780_PIXEL_UPDATE(eurit_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp index 719bb57852c..a62c695a9e5 100644 --- a/src/mame/drivers/eurocom2.cpp +++ b/src/mame/drivers/eurocom2.cpp @@ -302,19 +302,16 @@ uint8_t waveterm_state::waveterm_adc() uint32_t eurocom2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, offset, page; - uint16_t gfx, *p; + int const page = (m_vico[0] & 3) << 14; - page = (m_vico[0] & 3) << 14; - - for (y = 0; y < VC_DISP_VERT; y++) + for (int y = 0; y < VC_DISP_VERT; y++) { - offset = (VC_DISP_HORZ / 8) * ((m_vico[1] + y) % VC_DISP_VERT); - p = &m_tmpbmp.pix16(y); + int const offset = (VC_DISP_HORZ / 8) * ((m_vico[1] + y) % VC_DISP_VERT); + uint16_t *p = &m_tmpbmp.pix(y); - for (x = offset; x < offset + VC_DISP_HORZ / 8; x++) + for (int x = offset; x < offset + VC_DISP_HORZ / 8; x++) { - gfx = m_p_videoram[page + x]; + uint16_t const gfx = m_p_videoram[page + x]; for (int i = 7; i >= 0; i--) { diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp index bf1368c495d..56d2afc5406 100644 --- a/src/mame/drivers/excali64.cpp +++ b/src/mame/drivers/excali64.cpp @@ -530,20 +530,19 @@ void excali64_state::excali64_palette(palette_device &palette) MC6845_UPDATE_ROW( excali64_state::update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,col,bg,fg; - u16 mem,x; - u8 col_base = BIT(m_sys_status, 3) ? 16 : 0; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u8 const col_base = BIT(m_sys_status, 3) ? 16 : 0; + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - col = m_vram[mem+0x800]; - fg = col_base + (col >> 4); - bg = 32 + ((col >> 1) & 7); + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; + u8 const col = m_vram[mem+0x800]; + u8 const fg = col_base + (col >> 4); + u8 const bg = 32 + ((col >> 1) & 7); + u8 gfx; if (BIT(col, 0)) { u8 h = m_vram[mem+0x1000] - 4; diff --git a/src/mame/drivers/expro02.cpp b/src/mame/drivers/expro02.cpp index 6767f6454c7..5a2bc1ed6eb 100644 --- a/src/mame/drivers/expro02.cpp +++ b/src/mame/drivers/expro02.cpp @@ -338,7 +338,7 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1; @@ -363,7 +363,7 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff; diff --git a/src/mame/drivers/f-32.cpp b/src/mame/drivers/f-32.cpp index 7e58b37a5cc..0f07d04cd4a 100644 --- a/src/mame/drivers/f-32.cpp +++ b/src/mame/drivers/f-32.cpp @@ -67,17 +67,15 @@ private: uint32_t mosaicf2_state::screen_update_mosaicf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x10000; offs++) + for (offs_t offs = 0; offs < 0x10000; offs++) { int y = offs >> 8; int x = offs & 0xff; if ((x < 0xa0) && (y < 0xe0)) { - bitmap.pix16(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff; - bitmap.pix16(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff; + bitmap.pix(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff; + bitmap.pix(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff; } } diff --git a/src/mame/drivers/facit4440.cpp b/src/mame/drivers/facit4440.cpp index 2c066aa243c..84c6d8cc8db 100644 --- a/src/mame/drivers/facit4440.cpp +++ b/src/mame/drivers/facit4440.cpp @@ -148,7 +148,7 @@ WRITE_LINE_MEMBER(facit4440_state::vsync_w) MC6845_UPDATE_ROW(facit4440_state::update_row) { offs_t base = ma / 5 * 6; - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { diff --git a/src/mame/drivers/falco5220.cpp b/src/mame/drivers/falco5220.cpp index b7950bde463..a4a2660e4db 100644 --- a/src/mame/drivers/falco5220.cpp +++ b/src/mame/drivers/falco5220.cpp @@ -96,7 +96,7 @@ u32 falco5220_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, gfx = 0xff; for (int x = 0; x < 8; x++) - bitmap.pix32(col*16 + y, row*8 + x) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(col*16 + y, row*8 + x) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/fanucspmg.cpp b/src/mame/drivers/fanucspmg.cpp index 4d8a2f70aca..c5608e0eb92 100644 --- a/src/mame/drivers/fanucspmg.cpp +++ b/src/mame/drivers/fanucspmg.cpp @@ -846,11 +846,10 @@ void fanucspmg_state::memory_write_byte(offs_t offset, uint8_t data) MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); - int i; - uint8_t *chargen = m_chargen->base(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const chargen = m_chargen->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); @@ -868,14 +867,14 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) if (attr & 0x40) fg |= 0x00ff00; if (attr & 0x80) fg |= 0x0000ff; - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; + *p++ = BIT(data, 0) ? fg : bg; + *p++ = BIT(data, 1) ? fg : bg; + *p++ = BIT(data, 2) ? fg : bg; + *p++ = BIT(data, 3) ? fg : bg; + *p++ = BIT(data, 4) ? fg : bg; + *p++ = BIT(data, 5) ? fg : bg; + *p++ = BIT(data, 6) ? fg : bg; + *p++ = BIT(data, 7) ? fg : bg; } } else @@ -894,11 +893,10 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) { - uint32_t *p = &bitmap.pix32(y); - int i; - uint8_t *chargen = m_chargen->base(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const chargen = m_chargen->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); @@ -912,14 +910,14 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) uint32_t fg = 0xff00; uint32_t bg = 0; - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; + *p++ = BIT(data, 0) ? fg : bg; + *p++ = BIT(data, 1) ? fg : bg; + *p++ = BIT(data, 2) ? fg : bg; + *p++ = BIT(data, 3) ? fg : bg; + *p++ = BIT(data, 4) ? fg : bg; + *p++ = BIT(data, 5) ? fg : bg; + *p++ = BIT(data, 6) ? fg : bg; + *p++ = BIT(data, 7) ? fg : bg; } } else diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp index 35cf5c36c46..e05ba8a9255 100644 --- a/src/mame/drivers/fb01.cpp +++ b/src/mame/drivers/fb01.cpp @@ -148,7 +148,7 @@ HD44780_PIXEL_UPDATE(fb01_state::fb01_pixel_update) { if ( pos < 8 && line < 2 ) { - bitmap.pix16(y, line*6*8 + pos*6 + x) = state; + bitmap.pix(y, line*6*8 + pos*6 + x) = state; } } diff --git a/src/mame/drivers/fk1.cpp b/src/mame/drivers/fk1.cpp index 3e8f728ce02..e0d11652fee 100644 --- a/src/mame/drivers/fk1.cpp +++ b/src/mame/drivers/fk1.cpp @@ -404,17 +404,15 @@ void fk1_state::machine_reset() uint32_t fk1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code; - int y, x, b; - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x8000]; - for (b = 0; b < 8; b++) - bitmap.pix16(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; + uint8_t code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x8000]; + for (int b = 0; b < 8; b++) + bitmap.pix(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; } } return 0; diff --git a/src/mame/drivers/flipjack.cpp b/src/mame/drivers/flipjack.cpp index 9f84bca2350..e0eb29c1691 100644 --- a/src/mame/drivers/flipjack.cpp +++ b/src/mame/drivers/flipjack.cpp @@ -173,8 +173,8 @@ MC6845_UPDATE_ROW(flipjack_state::update_row) { const bool flip = !BIT(m_layer, 0); const uint16_t row_base = ((ma & 0x03e0) << 3 | (ra & 7) << 5) ^ (flip ? 0x1fff : 0); - uint32_t *const pbegin = &bitmap.pix32(y); - uint32_t *const pend = &bitmap.pix32(y, x_count * 8); + uint32_t *const pbegin = &bitmap.pix(y); + uint32_t *const pend = &bitmap.pix(y, x_count * 8); std::fill(pbegin, pend, rgb_t::black()); diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp index a45064ae13f..ee657e4a41e 100644 --- a/src/mame/drivers/flyball.cpp +++ b/src/mame/drivers/flyball.cpp @@ -175,7 +175,7 @@ uint32_t flyball_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = bally; y < bally + 2; y++) for (int x = ballx; x < ballx + 2; x++) if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; return 0; } diff --git a/src/mame/drivers/fp1100.cpp b/src/mame/drivers/fp1100.cpp index dab8f080191..0c3208d75b1 100644 --- a/src/mame/drivers/fp1100.cpp +++ b/src/mame/drivers/fp1100.cpp @@ -137,7 +137,7 @@ private: MC6845_UPDATE_ROW( fp1100_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); if (BIT(m_upd7801.porta, 4)) { // green screen diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp index bb8d027dc55..6794d2c5122 100644 --- a/src/mame/drivers/fp200.cpp +++ b/src/mame/drivers/fp200.cpp @@ -135,20 +135,16 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix(y,x) = pix; } /* else if(m_lcd.attr[x/8+yoffs*20] == 0x40) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix(y,x) = pix; }*/ } } @@ -166,19 +162,15 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix(y,x) = pix; } /*else if(m_lcd.attr[x/8+yoffs*20] == 0x40) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix(y,x) = pix; }*/ } } diff --git a/src/mame/drivers/fp6000.cpp b/src/mame/drivers/fp6000.cpp index b4f5ecff25a..51bec4e9682 100644 --- a/src/mame/drivers/fp6000.cpp +++ b/src/mame/drivers/fp6000.cpp @@ -243,15 +243,15 @@ uint16_t fp6000_state::unk_r() MC6845_UPDATE_ROW( fp6000_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); - uint8_t *pcg = reinterpret_cast<uint8_t *>(m_pcg.target()); - uint32_t *vram = reinterpret_cast<uint32_t *>(m_gvram.target()); + pen_t const *const pen = m_palette->pens(); + uint8_t const *const pcg = reinterpret_cast<uint8_t *>(m_pcg.target()); + uint32_t const *const vram = reinterpret_cast<uint32_t *>(m_gvram.target()); for (int x = 0; x < x_count; x++) { // text mode - uint8_t code = (m_vram[ma + x] >> 0) & 0xff; - uint8_t color = (m_vram[ma + x] >> 8) & 0x0f; + uint8_t const code = (m_vram[ma + x] >> 0) & 0xff; + uint8_t const color = (m_vram[ma + x] >> 8) & 0x0f; uint8_t gfx = pcg[(code << 4) | ra]; // cursor? @@ -260,20 +260,20 @@ MC6845_UPDATE_ROW( fp6000_state::crtc_update_row ) // draw 8 pixels of the character for (int i = 0; i < 8; i++) - bitmap.pix32(y, x * 8 + i) = BIT(gfx, 7 - i) ? pen[color] : 0; + bitmap.pix(y, x * 8 + i) = BIT(gfx, 7 - i) ? pen[color] : 0; // graphics - uint32_t data = vram[(ma << 3) + (ra * x_count) + x]; + uint32_t const data = vram[(ma << 3) + (ra * x_count) + x]; // draw 8 gfx pixels - if ((data >> 12) & 0x0f) bitmap.pix32(y, x * 8 + 0) = pen[(data >> 12) & 0x0f]; - if ((data >> 8) & 0x0f) bitmap.pix32(y, x * 8 + 1) = pen[(data >> 8) & 0x0f]; - if ((data >> 4) & 0x0f) bitmap.pix32(y, x * 8 + 2) = pen[(data >> 4) & 0x0f]; - if ((data >> 0) & 0x0f) bitmap.pix32(y, x * 8 + 3) = pen[(data >> 0) & 0x0f]; - if ((data >> 28) & 0x0f) bitmap.pix32(y, x * 8 + 4) = pen[(data >> 28) & 0x0f]; - if ((data >> 24) & 0x0f) bitmap.pix32(y, x * 8 + 5) = pen[(data >> 24) & 0x0f]; - if ((data >> 20) & 0x0f) bitmap.pix32(y, x * 8 + 6) = pen[(data >> 20) & 0x0f]; - if ((data >> 16) & 0x0f) bitmap.pix32(y, x * 8 + 7) = pen[(data >> 16) & 0x0f]; + if ((data >> 12) & 0x0f) bitmap.pix(y, x * 8 + 0) = pen[(data >> 12) & 0x0f]; + if ((data >> 8) & 0x0f) bitmap.pix(y, x * 8 + 1) = pen[(data >> 8) & 0x0f]; + if ((data >> 4) & 0x0f) bitmap.pix(y, x * 8 + 2) = pen[(data >> 4) & 0x0f]; + if ((data >> 0) & 0x0f) bitmap.pix(y, x * 8 + 3) = pen[(data >> 0) & 0x0f]; + if ((data >> 28) & 0x0f) bitmap.pix(y, x * 8 + 4) = pen[(data >> 28) & 0x0f]; + if ((data >> 24) & 0x0f) bitmap.pix(y, x * 8 + 5) = pen[(data >> 24) & 0x0f]; + if ((data >> 20) & 0x0f) bitmap.pix(y, x * 8 + 6) = pen[(data >> 20) & 0x0f]; + if ((data >> 16) & 0x0f) bitmap.pix(y, x * 8 + 7) = pen[(data >> 16) & 0x0f]; } } diff --git a/src/mame/drivers/fs3216.cpp b/src/mame/drivers/fs3216.cpp index 5491a7a518b..ba4522b4601 100644 --- a/src/mame/drivers/fs3216.cpp +++ b/src/mame/drivers/fs3216.cpp @@ -141,7 +141,7 @@ void fs3216_state::machine_reset() MC6845_UPDATE_ROW(fs3216_state::crt_update_row) { - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { diff --git a/src/mame/drivers/galgame.cpp b/src/mame/drivers/galgame.cpp index cbfb4a7c6be..53fa633f66b 100644 --- a/src/mame/drivers/galgame.cpp +++ b/src/mame/drivers/galgame.cpp @@ -187,7 +187,7 @@ uint32_t galaxygame_state::screen_update_galaxygame(screen_device &screen, bitma bitmap.fill(m_palette->black_pen(), cliprect); for (int i = 0; i < m_point_display_list_index; i++ ) { - bitmap.pix16(m_point_display_list[i].x >> 7, m_point_display_list[i].y >> 7) = 1; + bitmap.pix(m_point_display_list[i].x >> 7, m_point_display_list[i].y >> 7) = 1; } return 0; } diff --git a/src/mame/drivers/galpani3.cpp b/src/mame/drivers/galpani3.cpp index 0ffb68cd319..6e56e73c5db 100644 --- a/src/mame/drivers/galpani3.cpp +++ b/src/mame/drivers/galpani3.cpp @@ -190,7 +190,7 @@ void galpani3_state::video_start() uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); bitmap.fill(0, cliprect); @@ -198,137 +198,134 @@ uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rg // popmessage("%02x %02x", m_grap2[0]->m_framebuffer_bright2, m_grap2[1]->m_framebuffer_bright2); + for (int drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++) { - int drawy, drawx; - for (drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++) - { - uint16_t* sprline = &m_sprite_bitmap.pix16(drawy); - uint16_t* srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const sprline = &m_sprite_bitmap.pix(drawy); + uint16_t const *const srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200; - uint32_t* dst = &bitmap.pix32(drawy & 0x3ff); + uint32_t *const dst = &bitmap.pix(drawy & 0x3ff); - for (drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++) - { - int sproffs = drawx & 0x3ff; - int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff; - int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff; - int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff; + for (int drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++) + { + int sproffs = drawx & 0x3ff; + int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff; + int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff; + int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff; - int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff; + int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff; - uint16_t sprdat = sprline[sproffs]; - uint8_t dat1 = srcline1[srcoffs1]; - uint8_t dat2 = srcline2[srcoffs2]; - uint8_t dat3 = srcline3[srcoffs3]; + uint16_t sprdat = sprline[sproffs]; + uint8_t dat1 = srcline1[srcoffs1]; + uint8_t dat2 = srcline2[srcoffs2]; + uint8_t dat3 = srcline3[srcoffs3]; - uint8_t pridat = priline[prioffs]; + uint8_t pridat = priline[prioffs]; - // TODO : Verify priorities, blendings from real PCB. - if (pridat==0x0f) // relates to the area you've drawn over + // TODO : Verify priorities, blendings from real PCB. + if (pridat==0x0f) // relates to the area you've drawn over + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[2]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat1 && m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat2 && m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(2, dat3); } - else if (pridat==0xcf) // the girl + SPRITE_DRAW_PIXEL(0x4000); + if (dat1 && m_grap2[0]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, 0x100); - } - SPRITE_DRAW_PIXEL(0x4000); - if (m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, 0x100); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(0, dat1); } - else if (pridat==0x30) // during the 'gals boxes' on the intro + SPRITE_DRAW_PIXEL(0x8000); + if (dat2 && m_grap2[1]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[1]->m_framebuffer_enable) // TODO : Opaqued and Swapped order? - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat1 && m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(1, dat2); } - else + SPRITE_DRAW_PIXEL(0xc000); + } + else if (pridat==0xcf) // the girl + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[0]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB? - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat2 && m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(0, 0x100); } - - /* - else if (pridat==0x2f) // area outside of the girl + SPRITE_DRAW_PIXEL(0x4000); + if (m_grap2[1]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(1, 0x100); } - - else if (pridat==0x00) // the initial line / box that gets drawn + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) + { + FB_DRAW_PIXEL(2, dat3); + } + SPRITE_DRAW_PIXEL(0xc000); + } + else if (pridat==0x30) // during the 'gals boxes' on the intro + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[1]->m_framebuffer_enable) // TODO : Opaqued and Swapped order? + { + FB_DRAW_PIXEL(1, dat2); + } + SPRITE_DRAW_PIXEL(0x4000); + if (dat1 && m_grap2[0]->m_framebuffer_enable) + { + FB_DRAW_PIXEL(0, dat1); + } + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(2, dat3); } - else if (pridat==0x30) // during the 'gals boxes' on the intro + SPRITE_DRAW_PIXEL(0xc000); + } + else + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB? { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(0, dat1); } - else if (pridat==0x0c) // 'nice' at end of level + SPRITE_DRAW_PIXEL(0x4000); + if (dat2 && m_grap2[1]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(1, dat2); } - else + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) { - //printf("%02x, ",pridat); + FB_DRAW_PIXEL(2, dat3); } - */ + SPRITE_DRAW_PIXEL(0xc000); + } + + /* + else if (pridat==0x2f) // area outside of the girl + { + //dst[drawx] = machine().rand()&0x3fff; + } + + else if (pridat==0x00) // the initial line / box that gets drawn + { + //dst[drawx] = machine().rand()&0x3fff; + } + else if (pridat==0x30) // during the 'gals boxes' on the intro + { + //dst[drawx] = machine().rand()&0x3fff; + } + else if (pridat==0x0c) // 'nice' at end of level + { + //dst[drawx] = machine().rand()&0x3fff; + } + else + { + //printf("%02x, ",pridat); } + */ } } return 0; diff --git a/src/mame/drivers/galpanic_ms.cpp b/src/mame/drivers/galpanic_ms.cpp index f94e85e1de7..7401d06caf5 100644 --- a/src/mame/drivers/galpanic_ms.cpp +++ b/src/mame/drivers/galpanic_ms.cpp @@ -272,7 +272,7 @@ uint32_t galspanic_ms_state::screen_update_backgrounds(screen_device &screen, bi count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1; @@ -285,7 +285,7 @@ uint32_t galspanic_ms_state::screen_update_backgrounds(screen_device &screen, bi count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff; diff --git a/src/mame/drivers/gamecstl.cpp b/src/mame/drivers/gamecstl.cpp index 0207bd9dd2b..699c0b9ed55 100644 --- a/src/mame/drivers/gamecstl.cpp +++ b/src/mame/drivers/gamecstl.cpp @@ -137,16 +137,14 @@ void gamecstl_state::video_start() void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint16_t *p = &bitmap.pix16(j); + uint16_t *const p = &bitmap.pix(j); - for (i=x; i < x+8; i++) + for (int i=x; i < x+8; i++) { uint8_t pen = dp[index++]; if (pen) @@ -159,16 +157,15 @@ void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t gamecstl_state::screen_update_gamecstl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, j; gfx_element *gfx = m_gfxdecode->gfx(0); - uint32_t *cga = m_cga_ram; + uint32_t const *const cga = m_cga_ram; int index = 0; bitmap.fill(0, cliprect); - for (j=0; j < 25; j++) + for (int j=0; j < 25; j++) { - for (i=0; i < 80; i+=2) + for (int i=0; i < 80; i+=2) { int att0 = (cga[index] >> 8) & 0xff; int ch0 = (cga[index] >> 0) & 0xff; diff --git a/src/mame/drivers/gameking.cpp b/src/mame/drivers/gameking.cpp index b381b324244..0e02f8f42a5 100644 --- a/src/mame/drivers/gameking.cpp +++ b/src/mame/drivers/gameking.cpp @@ -153,10 +153,10 @@ uint32_t gameking_state::screen_update_gameking(screen_device &screen, bitmap_in for (int x=0, j=0;j<48/4;x+=4, j++) { uint8_t data=maincpu_ram->read_byte(lssa+j+i*12); - bitmap.pix16(y, x+3)=data&3; - bitmap.pix16(y, x+2)=(data>>2)&3; - bitmap.pix16(y, x+1)=(data>>4)&3; - bitmap.pix16(y, x)=(data>>6)&3; + bitmap.pix(y, x+3)=data&3; + bitmap.pix(y, x+2)=(data>>2)&3; + bitmap.pix(y, x+1)=(data>>4)&3; + bitmap.pix(y, x)=(data>>6)&3; } } return 0; @@ -188,24 +188,24 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r switch (i % 3) { case 0: - bitmap.pix32(y, x + 3) = rgb_t(0, gameking3_intensities[data&3], 0); - bitmap.pix32(y + 1, x + 2) = rgb_t(gameking3_intensities[(data>>2)&3], 0, 0); - bitmap.pix32(y, x + 1) = rgb_t(0, gameking3_intensities[(data>>4)&3], 0); - bitmap.pix32(y + 1, x) = rgb_t(gameking3_intensities[(data>>6)&3], 0, 0); + bitmap.pix(y, x + 3) = rgb_t(0, gameking3_intensities[data&3], 0); + bitmap.pix(y + 1, x + 2) = rgb_t(gameking3_intensities[(data>>2)&3], 0, 0); + bitmap.pix(y, x + 1) = rgb_t(0, gameking3_intensities[(data>>4)&3], 0); + bitmap.pix(y + 1, x) = rgb_t(gameking3_intensities[(data>>6)&3], 0, 0); break; case 1: - bitmap.pix32(y, x + 3) = rgb_t(0, 0, gameking3_intensities[data&3]); - bitmap.pix32(y + 1, x+2) = rgb_t(0, gameking3_intensities[(data>>2)&3], 0); - bitmap.pix32(y, x + 1) = rgb_t(0, 0, gameking3_intensities[(data>>4)&3]); - bitmap.pix32(y + 1, x) = rgb_t(0, gameking3_intensities[(data>>6)&3], 0); + bitmap.pix(y, x + 3) = rgb_t(0, 0, gameking3_intensities[data&3]); + bitmap.pix(y + 1, x+2) = rgb_t(0, gameking3_intensities[(data>>2)&3], 0); + bitmap.pix(y, x + 1) = rgb_t(0, 0, gameking3_intensities[(data>>4)&3]); + bitmap.pix(y + 1, x) = rgb_t(0, gameking3_intensities[(data>>6)&3], 0); break; case 2: - bitmap.pix32(y, x + 3) = rgb_t(gameking3_intensities[data&3], 0, 0); - bitmap.pix32(y + 1, x+2) = rgb_t(0, 0, gameking3_intensities[(data>>2)&3]); - bitmap.pix32(y, x + 1) = rgb_t(gameking3_intensities[(data>>4)&3], 0, 0); - bitmap.pix32(y + 1, x) = rgb_t(0, 0, gameking3_intensities[(data>>6)&3]); + bitmap.pix(y, x + 3) = rgb_t(gameking3_intensities[data&3], 0, 0); + bitmap.pix(y + 1, x+2) = rgb_t(0, 0, gameking3_intensities[(data>>2)&3]); + bitmap.pix(y, x + 1) = rgb_t(gameking3_intensities[(data>>4)&3], 0, 0); + bitmap.pix(y + 1, x) = rgb_t(0, 0, gameking3_intensities[(data>>6)&3]); break; } } @@ -216,12 +216,12 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r { for (int x = y & 1; x < 160; x += 2) { - rgb_t l = rgb_t(x == 0 ? 0 : bitmap.pix32(y, x - 1)); - rgb_t r = rgb_t(x == 159 ? 0 : bitmap.pix32(y, x + 1)); - rgb_t u = rgb_t(y == 0 ? 0 : bitmap.pix32(y - 1, x)); - rgb_t d = rgb_t(y == 159 ? 0 : bitmap.pix32(y + 1, x)); + rgb_t l = rgb_t(x == 0 ? 0 : bitmap.pix(y, x - 1)); + rgb_t r = rgb_t(x == 159 ? 0 : bitmap.pix(y, x + 1)); + rgb_t u = rgb_t(y == 0 ? 0 : bitmap.pix(y - 1, x)); + rgb_t d = rgb_t(y == 159 ? 0 : bitmap.pix(y + 1, x)); - bitmap.pix32(y, x) = rgb_t( + bitmap.pix(y, x) = rgb_t( ((u.r() + d.r()) * 2 + l.r() + r.r()) / 3, ((u.g() + d.g()) * 2 + l.g() + r.g()) / 3, ((u.b() + d.b()) * 2 + l.b() + r.b()) / 3 diff --git a/src/mame/drivers/gei.cpp b/src/mame/drivers/gei.cpp index d7d3dadd732..fa12d4e20cf 100644 --- a/src/mame/drivers/gei.cpp +++ b/src/mame/drivers/gei.cpp @@ -235,7 +235,7 @@ void gei_state::gei_bitmap_w(offs_t offset, uint8_t data) sy = (sy + m_yadd) & 0xff; for (int i = 0; i < 8; i++) - m_bitmap.pix16(sy, sx + i) = m_color[8 - i - 1]; + m_bitmap.pix(sy, sx + i) = m_color[8 - i - 1]; } void gei_state::video_start() diff --git a/src/mame/drivers/generalplus_gpl_unknown.cpp b/src/mame/drivers/generalplus_gpl_unknown.cpp index fffce35facb..405158d73b5 100644 --- a/src/mame/drivers/generalplus_gpl_unknown.cpp +++ b/src/mame/drivers/generalplus_gpl_unknown.cpp @@ -178,7 +178,7 @@ uint32_t gpl162xx_lcdtype_state::screen_update(screen_device &screen, bitmap_rgb int count = 0; for (int y = 0; y < 256; y++) { - uint32_t* dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = 0; x < 320; x++) { diff --git a/src/mame/drivers/geniusiq.cpp b/src/mame/drivers/geniusiq.cpp index 9350d3c4989..b46c3df2457 100644 --- a/src/mame/drivers/geniusiq.cpp +++ b/src/mame/drivers/geniusiq.cpp @@ -275,7 +275,7 @@ uint32_t geniusiq_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for(int b=0; b<4; b++) { - bitmap.pix16(y, x*2 + b) = (data>>12) & 0x0f; + bitmap.pix(y, x*2 + b) = (data>>12) & 0x0f; data <<= 4; } } @@ -292,7 +292,7 @@ uint32_t geniusiq_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // I assume color 0 is transparent if(pen != 0 && screen.visible_area().contains(m_mouse_gfx_posx + x*4 + b, m_mouse_gfx_posy + y)) - bitmap.pix16(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; + bitmap.pix(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; data <<= 2; } } diff --git a/src/mame/drivers/gigatron.cpp b/src/mame/drivers/gigatron.cpp index 3261208786b..5397a95288a 100644 --- a/src/mame/drivers/gigatron.cpp +++ b/src/mame/drivers/gigatron.cpp @@ -103,7 +103,7 @@ void gigatron_state::video_start() void gigatron_state::video_reset() { - uint32_t *dest = &m_bitmap_render->pix32(0, 0); + uint32_t *dest = &m_bitmap_render->pix(0, 0); for(uint32_t i = 0; i < 640*480; i++) *dest++ = 0; } @@ -138,7 +138,7 @@ void gigatron_state::port_out(uint8_t data) uint8_t r = (out << 6) & 0xC0; uint8_t g = (out << 4) & 0xC0; uint8_t b = (out << 2) & 0xC0; - uint32_t *dest = &m_bitmap_render->pix32(m_row, m_col); + uint32_t *dest = &m_bitmap_render->pix(m_row, m_col); for(uint8_t i = 0; i < 4; i++) *dest++ = b|(g<<8)|(r<<16); } diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 4dfd39519ce..4b670245d25 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -162,22 +162,18 @@ void igt_gameking_state::video_start() uint32_t igt_gameking_state::screen_update_igt_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - bitmap.fill(m_palette->black_pen(), cliprect); - for(y = 0; y < 480; y++) + for(int y = 0; y < 480; y++) { - for(x = 0; x < 640; x+=4) + for(int x = 0; x < 640; x+=4) { for(int xi=0;xi<4;xi++) { - uint32_t color; - - color = (m_vram[(x+y*1024)/4] >> (xi*8)) & 0xff; + uint32_t const color = (m_vram[(x+y*1024)/4] >> (xi*8)) & 0xff; if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(color); + bitmap.pix(y, x+xi) = m_palette->pen(color); } } diff --git a/src/mame/drivers/gmaster.cpp b/src/mame/drivers/gmaster.cpp index 76e5f116817..cd798155887 100644 --- a/src/mame/drivers/gmaster.cpp +++ b/src/mame/drivers/gmaster.cpp @@ -280,30 +280,20 @@ void gmaster_state::gmaster_palette(palette_device &palette) const uint32_t gmaster_state::screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - for (y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) + for (int y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) { - for (x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) + for (int x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) { - uint8_t d = m_video.pixels[y][x]; - uint16_t *line; - - line = &bitmap.pix16((y * 8), x); - line[0] = BIT(d, 0); - line = &bitmap.pix16((y * 8 + 1), x); - line[0] = BIT(d, 1); - line = &bitmap.pix16((y * 8 + 2), x); - line[0] = BIT(d, 2); - line = &bitmap.pix16((y * 8 + 3), x); - line[0] = BIT(d, 3); - line = &bitmap.pix16((y * 8 + 4), x); - line[0] = BIT(d, 4); - line = &bitmap.pix16((y * 8 + 5), x); - line[0] = BIT(d, 5); - line = &bitmap.pix16((y * 8 + 6), x); - line[0] = BIT(d, 6); - line = &bitmap.pix16((y * 8 + 7), x); - line[0] = BIT(d, 7); + uint8_t const d = m_video.pixels[y][x]; + + bitmap.pix((y * 8 + 0), x) = BIT(d, 0); + bitmap.pix((y * 8 + 1), x) = BIT(d, 1); + bitmap.pix((y * 8 + 2), x) = BIT(d, 2); + bitmap.pix((y * 8 + 3), x) = BIT(d, 3); + bitmap.pix((y * 8 + 4), x) = BIT(d, 4); + bitmap.pix((y * 8 + 5), x) = BIT(d, 5); + bitmap.pix((y * 8 + 6), x) = BIT(d, 6); + bitmap.pix((y * 8 + 7), x) = BIT(d, 7); } } return 0; diff --git a/src/mame/drivers/goldart.cpp b/src/mame/drivers/goldart.cpp index 975211b4e8c..d2b95d88a63 100644 --- a/src/mame/drivers/goldart.cpp +++ b/src/mame/drivers/goldart.cpp @@ -111,9 +111,9 @@ uint32_t goldart_state::screen_update_goldart(screen_device& screen, bitmap_ind1 { for (int x = 0; x < 192; x++) { - uint16_t* dstptr_bitmap = &bitmap.pix16(y); - uint8_t data = m_ram[count]; - uint8_t data2 = m_ram2[count]; + uint16_t *const dstptr_bitmap = &bitmap.pix(y); + uint8_t const data = m_ram[count]; + uint8_t const data2 = m_ram2[count]; count++; diff --git a/src/mame/drivers/goldngam.cpp b/src/mame/drivers/goldngam.cpp index c701d74f91e..27c0b483c20 100644 --- a/src/mame/drivers/goldngam.cpp +++ b/src/mame/drivers/goldngam.cpp @@ -300,8 +300,8 @@ uint32_t goldngam_state::screen_update_goldngam(screen_device &screen, bitmap_in for(int x = 0; x < 384; x += 2) { uint16_t word = m_videoram[index]; - bitmap.pix16(y, x) = word >> 8; - bitmap.pix16(y, x+1) = word & 0xff; + bitmap.pix(y, x) = word >> 8; + bitmap.pix(y, x+1) = word & 0xff; ++index; } } diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp index 38fc94e5cb2..b4bcae82f41 100644 --- a/src/mame/drivers/goupil.cpp +++ b/src/mame/drivers/goupil.cpp @@ -489,7 +489,7 @@ WRITE_LINE_MEMBER( goupil_g1_state::via_video_ca2_w ) MC6845_UPDATE_ROW(goupil_g2_state::crtc_update_row) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (uint8_t x = 0; x < x_count; ++x) { uint16_t const offset = ( 0x400 + ( ma + x ) ) & 0x7FF; diff --git a/src/mame/drivers/gp2x.cpp b/src/mame/drivers/gp2x.cpp index 2ff5addc312..7c2af984b7c 100644 --- a/src/mame/drivers/gp2x.cpp +++ b/src/mame/drivers/gp2x.cpp @@ -159,8 +159,7 @@ uint32_t gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bit // only support RGB still image layer for now if (m_vidregs[0x80/2] & 4) { - int x, y; - uint16_t *vram = (uint16_t *)&m_ram[0x2100000/4]; + uint16_t const *const vram = (uint16_t *)&m_ram[0x2100000/4]; /* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", (m_vidregs[(0xda/2)]>>9)&3, @@ -170,13 +169,13 @@ uint32_t gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bit m_vidregs[(0xe8/2)]);*/ - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 320; x++) + for (int x = 0; x < 320; x++) { - uint16_t pixel = vram[(320*y)+x]; + uint16_t const pixel = vram[(320*y)+x]; *scanline++ = rgb_t(0xff, (pixel>>11)<<3, ((pixel>>5)&0x3f)<<2, (pixel&0x1f)<<3); } diff --git a/src/mame/drivers/gp32.cpp b/src/mame/drivers/gp32.cpp index 34a80fedcda..189babc7069 100644 --- a/src/mame/drivers/gp32.cpp +++ b/src/mame/drivers/gp32.cpp @@ -143,21 +143,20 @@ uint32_t gp32_state::s3c240x_lcd_dma_read( ) void gp32_state::s3c240x_lcd_render_01( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 32; j++) + for (int j = 0; j < 32; j++) { *scanline++ = m_palette->pen_color((data >> 31) & 0x01); - data = data << 1; + data <<= 1; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 4)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -166,21 +165,20 @@ void gp32_state::s3c240x_lcd_render_01( ) void gp32_state::s3c240x_lcd_render_02( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 16; j++) + for (int j = 0; j < 16; j++) { *scanline++ = m_palette->pen_color((data >> 30) & 0x03); - data = data << 2; + data <<= 2; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 3)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -189,21 +187,20 @@ void gp32_state::s3c240x_lcd_render_02( ) void gp32_state::s3c240x_lcd_render_04( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read( ); - for (j = 0; j < 8; j++) + for (int j = 0; j < 8; j++) { *scanline++ = m_palette->pen_color((data >> 28) & 0x0F); - data = data << 4; + data <<= 4; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 2)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -212,21 +209,20 @@ void gp32_state::s3c240x_lcd_render_04( ) void gp32_state::s3c240x_lcd_render_08( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) { *scanline++ = m_palette->pen_color((data >> 24) & 0xFF); - data = data << 8; + data <<= 8; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 1)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -235,21 +231,20 @@ void gp32_state::s3c240x_lcd_render_08( ) void gp32_state::s3c240x_lcd_render_16( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 2; j++) + for (int j = 0; j < 2; j++) { *scanline++ = s3c240x_get_color_5551( (data >> 16) & 0xFFFF); - data = data << 16; + data <<= 16; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 0)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } diff --git a/src/mame/drivers/gpworld.cpp b/src/mame/drivers/gpworld.cpp index 0e717fe6fea..d9d008b31b7 100644 --- a/src/mame/drivers/gpworld.cpp +++ b/src/mame/drivers/gpworld.cpp @@ -138,7 +138,7 @@ void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,in } if (cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); } void gpworld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/grfd2301.cpp b/src/mame/drivers/grfd2301.cpp index 6767c3d543d..a17b1616455 100644 --- a/src/mame/drivers/grfd2301.cpp +++ b/src/mame/drivers/grfd2301.cpp @@ -82,21 +82,20 @@ void grfd2301_state::machine_reset() uint32_t grfd2301_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_p_videoram[x+ma]; + uint8_t chr = m_p_videoram[x+ma]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp index 63d41b12390..1deb3174053 100644 --- a/src/mame/drivers/gridcomp.cpp +++ b/src/mame/drivers/gridcomp.cpp @@ -246,18 +246,15 @@ uint8_t gridcomp_state::grid_dma_r(offs_t offset) uint32_t gridcomp_state::screen_update_generic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int px) { - int x, y, offset; - uint16_t gfx, *p; - - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - offset = y * (px / 16); + int const offset = y * (px / 16); - for (x = offset; x < offset + px / 16; x++) + for (int x = offset; x < offset + px / 16; x++) { - gfx = m_videoram[x]; + uint16_t const gfx = m_videoram[x]; for (int i = 15; i >= 0; i--) { diff --git a/src/mame/drivers/gstream.cpp b/src/mame/drivers/gstream.cpp index c5d88370663..95f27a7c4d4 100644 --- a/src/mame/drivers/gstream.cpp +++ b/src/mame/drivers/gstream.cpp @@ -587,10 +587,8 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & do { g_profiler.start(PROFILER_DRAWGFX); do { - const uint8_t *srcdata, *srcdata2; int32_t destendx, destendy; int32_t srcx, srcy; - int32_t curx, cury; int32_t dy; assert(dest.valid()); @@ -649,8 +647,8 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & } /* fetch the source data */ - srcdata = gfx->get_data(code); - srcdata2 = gfx2->get_data(code); + const uint8_t *srcdata = gfx->get_data(code); + const uint8_t *srcdata2 = gfx2->get_data(code); /* compute how many blocks of 4 pixels we have */ uint32_t leftovers = (destendx + 1 - destx); @@ -663,16 +661,16 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & if (!flipx) { /* iterate over pixels in Y */ - for (cury = desty; cury <= destendy; cury++) + for (int32_t cury = desty; cury <= destendy; cury++) { - uint32_t *destptr = &dest.pix32(cury, destx); + uint32_t *destptr = &dest.pix(cury, destx); const uint8_t *srcptr = srcdata; const uint8_t *srcptr2 = srcdata2; srcdata += dy; srcdata2 += dy; /* iterate over leftover pixels */ - for (curx = 0; curx < leftovers; curx++) + for (int32_t curx = 0; curx < leftovers; curx++) { uint32_t srcdata = (srcptr[0]); uint32_t srcdata2 = (srcptr2[0]); @@ -692,9 +690,9 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & else { /* iterate over pixels in Y */ - for (cury = desty; cury <= destendy; cury++) + for (int32_t cury = desty; cury <= destendy; cury++) { - uint32_t *destptr = &dest.pix32(cury, destx); + uint32_t *destptr = &dest.pix(cury, destx); const uint8_t *srcptr = srcdata; const uint8_t *srcptr2 = srcdata2; @@ -702,7 +700,7 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & srcdata2 += dy; /* iterate over leftover pixels */ - for (curx = 0; curx < leftovers; curx++) + for (int32_t curx = 0; curx < leftovers; curx++) { uint32_t srcdata = (srcptr[0]); uint32_t srcdata2 = (srcptr2[0]); diff --git a/src/mame/drivers/gsword.cpp b/src/mame/drivers/gsword.cpp index 47398823e39..472c6a80550 100644 --- a/src/mame/drivers/gsword.cpp +++ b/src/mame/drivers/gsword.cpp @@ -153,14 +153,14 @@ So far, the AA-016 and AA-017 MCUs have been dumped successfully. At least two Great Swordsman boards have been seen with a UVEPROM-based D8741A-8 MCU for AA-013 at 9.5A. This suggests the developers made some -last-minute change to the code that only the main CPU. +last-minute change to the code that only affects the main CPU. It appears that during development, the developers worked with three copies of what became the AA-016 MCU. Protection code was added to the I/O MCU program, and this became AA-017. At this point they intended to use two copies of AA-016 for communications, and one AA-017 for I/O. It -turned out that some last-minute change was required for the master CPU, -but it was too late to order new mask ROM MUCs. This resulted in the +turned out that some last-minute change was required for the main CPU, +but it was too late to order new mask ROM MCUs. This resulted in the use of UVEPROM parts for AA-013. There are problems with sound. Many effects aren't playing or are cut @@ -255,9 +255,9 @@ contained within a single page. The initialisation/self test and mode selection, the subroutine for receiving configuration, and an unused subroutine for sending a negated program byte to the host are in page 0. The subroutines that implement coin handling are in page 1. There are -three input handling and protection programs of increasing of increasing -complexity in page 2 and page 3. The host selects the input handling -program to use with the high nybble of the first command. +three input handling and protection programs of increasing complexity in +page 2 and page 3. The host selects the input handling program to use +with the high nybble of the first command. The subroutine for receiving configuration from the host is identical to the one in the AA-016 MCU besides being shifted to a different address. @@ -310,11 +310,11 @@ command: The MCU keeps an internal credit counter ($2D). Each time the MCU receives a polling command, if the credit counter is non-zero it will be decremented and bit 7 of the response will be set; if the credit counter -is zero, but 7 of the response will be clear. +is zero, bit 7 of the response will be clear. After terminating the setup phase, any byte written to the data port will cause the MCU to check the coin inputs, update the credit counter -if necessary, and return the desired data. A byte written to the +if necessary, and return the requested data. A byte written to the control port after the setup phase terminates causes the MCU to read a byte of program memory from page 2 using the received byte as the offset, twos-complement it, return it, and then immediately re-execute diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp index 49bf5252eec..74d251c5d58 100644 --- a/src/mame/drivers/gticlub.cpp +++ b/src/mame/drivers/gticlub.cpp @@ -909,7 +909,7 @@ uint32_t gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb3 for (x=0; x < 512; x++) { uint8_t pixel = rom[index + (y*512) + x]; - bitmap.pix32(y, x) = K001006_palette[tp][(pal * 256) + pixel]; + bitmap.pix(y, x) = K001006_palette[tp][(pal * 256) + pixel]; } } diff --git a/src/mame/drivers/gts3a.cpp b/src/mame/drivers/gts3a.cpp index 2e2aeb056bd..86a613df8b3 100644 --- a/src/mame/drivers/gts3a.cpp +++ b/src/mame/drivers/gts3a.cpp @@ -321,14 +321,13 @@ void gts3a_state::palette_init(palette_device &palette) MC6845_UPDATE_ROW( gts3a_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t gfx=0; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0xfff;mem++; + uint16_t mem = (ma + x) & 0xfff;mem++; gfx = 4;//m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character */ diff --git a/src/mame/drivers/gts80a.cpp b/src/mame/drivers/gts80a.cpp index 6ed611719ac..84aa0c5ca58 100644 --- a/src/mame/drivers/gts80a.cpp +++ b/src/mame/drivers/gts80a.cpp @@ -430,10 +430,10 @@ uint32_t caveman_state::screen_update_caveman(screen_device &screen, bitmap_ind1 { uint8_t pix = m_vram[count]; - bitmap.pix16(y, x+0) = (pix >> 6)&0x3; - bitmap.pix16(y, x+1) = (pix >> 4)&0x3; - bitmap.pix16(y, x+2) = (pix >> 2)&0x3; - bitmap.pix16(y, x+3) = (pix >> 0)&0x3; + bitmap.pix(y, x+0) = (pix >> 6)&0x3; + bitmap.pix(y, x+1) = (pix >> 4)&0x3; + bitmap.pix(y, x+2) = (pix >> 2)&0x3; + bitmap.pix(y, x+3) = (pix >> 0)&0x3; count++; } diff --git a/src/mame/drivers/guab.cpp b/src/mame/drivers/guab.cpp index 193675652cc..d308bfb5e02 100644 --- a/src/mame/drivers/guab.cpp +++ b/src/mame/drivers/guab.cpp @@ -275,12 +275,12 @@ uint32_t guab_state::screen_update_guab(screen_device &screen, bitmap_ind16 &bit for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint8_t *src = &m_tms34061->m_display.vram[256 * y]; - uint16_t *dest = &bitmap.pix16(y); + uint8_t const *const src = &m_tms34061->m_display.vram[256 * y]; + uint16_t *dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - uint8_t pen = src[x >> 1]; + uint8_t const pen = src[x >> 1]; /* Draw two 4-bit pixels */ *dest++ = m_palette->pen(pen >> 4); diff --git a/src/mame/drivers/gunpey.cpp b/src/mame/drivers/gunpey.cpp index 9b79660e2aa..db35f1242dc 100644 --- a/src/mame/drivers/gunpey.cpp +++ b/src/mame/drivers/gunpey.cpp @@ -295,9 +295,6 @@ void gunpey_state::video_start() uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count,uint8_t scene_gradient) { - int x,y; - int bpp_sel; - int color; const int ZOOM_SHIFT = 15; // there doesn't seem to be a specific bit to mark compressed sprites (we currently have a hack to look at the first byte of the data) // do they get decompressed at blit time instead? of are there other registers we need to look at @@ -326,12 +323,12 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in if(!(m_wram[count+0] & 1)) { - x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); - y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); + int x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); + int y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); uint32_t zoomheight = (m_wram[count+5] >> 8); uint32_t zoomwidth = (m_wram[count+5] & 0xff); - bpp_sel = (m_wram[count+0] & 0x18); - color = (m_wram[count+0] >> 8); + int bpp_sel = (m_wram[count+0] & 0x18); + int color = (m_wram[count+0] >> 8); x-=0x160; y-=0x188; @@ -379,8 +376,6 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in int xi2 = xsourceoff>>ZOOM_SHIFT; uint8_t data = m_vram[((((ysource + yi2) & 0x7ff) * 0x800) + ((xsource + (xi2/2)) & 0x7ff))]; uint8_t pix; - uint32_t col_offs; - uint16_t color_data; if (xi2 & 1) { @@ -391,19 +386,17 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in pix = (data & 0x0f); } - col_offs = ((pix + color*0x10) & 0xff) << 1; + uint32_t col_offs = ((pix + color*0x10) & 0xff) << 1; col_offs+= ((pix + color*0x10) >> 8)*0x800; - color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); + uint16_t color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); if(!(color_data & 0x8000)) { if(scene_gradient & 0x40) { - int r,g,b; - - r = (color_data & 0x7c00) >> 10; - g = (color_data & 0x03e0) >> 5; - b = (color_data & 0x001f) >> 0; + int r = (color_data & 0x7c00) >> 10; + int g = (color_data & 0x03e0) >> 5; + int b = (color_data & 0x001f) >> 0; r-= (scene_gradient & 0x1f); g-= (scene_gradient & 0x1f); b-= (scene_gradient & 0x1f); @@ -418,11 +411,11 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in { if (alpha==0x00) // a value of 0x00 is solid { - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } else { - uint16_t basecolor = bitmap.pix16(y+yi, x+xi); + uint16_t basecolor = bitmap.pix(y+yi, x+xi); int base_r = ((basecolor >> 10)&0x1f)*alpha; int base_g = ((basecolor >> 5)&0x1f)*alpha; int base_b = ((basecolor >> 0)&0x1f)*alpha; @@ -433,7 +426,7 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in g = (base_g+g)/0x1f; b = (base_b+b)/0x1f; color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } } } @@ -460,24 +453,19 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in int xi2 = xsourceoff>>ZOOM_SHIFT; uint8_t data = m_vram[((((ysource+yi2)&0x7ff)*0x800) + ((xsource+xi2)&0x7ff))]; - uint8_t pix; - uint32_t col_offs; - uint16_t color_data; - pix = (data & 0xff); - col_offs = ((pix + color*0x100) & 0xff) << 1; + uint8_t pix = (data & 0xff); + uint32_t col_offs = ((pix + color*0x100) & 0xff) << 1; col_offs+= ((pix + color*0x100) >> 8)*0x800; - color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); + uint16_t color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); if(!(color_data & 0x8000)) { if(scene_gradient & 0x40) { - int r,g,b; - - r = (color_data & 0x7c00) >> 10; - g = (color_data & 0x03e0) >> 5; - b = (color_data & 0x001f) >> 0; + int r = (color_data & 0x7c00) >> 10; + int g = (color_data & 0x03e0) >> 5; + int b = (color_data & 0x001f) >> 0; r-= (scene_gradient & 0x1f); g-= (scene_gradient & 0x1f); b-= (scene_gradient & 0x1f); @@ -492,11 +480,11 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in { if (alpha==0x00) // a value of 0x00 is solid { - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } else { - uint16_t basecolor = bitmap.pix16(y+yi, x+xi); + uint16_t basecolor = bitmap.pix(y+yi, x+xi); int base_r = ((basecolor >> 10)&0x1f)*alpha; int base_g = ((basecolor >> 5)&0x1f)*alpha; int base_b = ((basecolor >> 0)&0x1f)*alpha; @@ -507,7 +495,7 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in g = (base_g+g)/0x1f; b = (base_b+b)/0x1f; color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } } } diff --git a/src/mame/drivers/h19.cpp b/src/mame/drivers/h19.cpp index 0feafc33d63..fc296c17392 100644 --- a/src/mame/drivers/h19.cpp +++ b/src/mame/drivers/h19.cpp @@ -475,8 +475,9 @@ MC6845_UPDATE_ROW( h19_state::crtc_update_row ) { if (!de) return; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) { @@ -491,7 +492,7 @@ MC6845_UPDATE_ROW( h19_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t const gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp index a4423bd304c..18b653d6908 100644 --- a/src/mame/drivers/halleys.cpp +++ b/src/mame/drivers/halleys.cpp @@ -1310,7 +1310,7 @@ void halleys_state::copy_scroll_op(bitmap_ind16 &bitmap, uint16_t *source, int s // draw top split for (int y=0; y != bch; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); memcpy(dest, src+sx, 2*rcw); memcpy(dest + rcw, src, 2*(CLIP_W - rcw)); src += SCREEN_WIDTH; @@ -1320,7 +1320,7 @@ void halleys_state::copy_scroll_op(bitmap_ind16 &bitmap, uint16_t *source, int s // draw bottom split for (int y = bch; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); memcpy(dest, src+sx, 2*rcw); memcpy(dest + rcw, src, 2*(CLIP_W - rcw)); src += SCREEN_WIDTH; @@ -1345,7 +1345,7 @@ void halleys_state::copy_scroll_xp(bitmap_ind16 &bitmap, uint16_t *source, int s // draw top split for (int y=0; y != bch; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); const uint16_t *src = src_base + sx; for(int x=0; x != rcw; x++) { uint16_t pixel = *src++; @@ -1370,7 +1370,7 @@ void halleys_state::copy_scroll_xp(bitmap_ind16 &bitmap, uint16_t *source, int s // draw bottom split for (int y = bch; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); const uint16_t *src = src_base + sx; for(int x=0; x != rcw; x++) { uint16_t pixel = *src++; @@ -1398,7 +1398,7 @@ void halleys_state::copy_fixed_xp(bitmap_ind16 &bitmap, uint16_t *source) { uint16_t *src = source + CLIP_SKIP; for(int y=0; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); for(int x=0; x != CLIP_W; x++) { uint16_t pixel = src[x]; @@ -1414,7 +1414,7 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, uint16_t *source) { uint16_t *src = source + CLIP_SKIP; for(int y=0; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); for(int x=0; x != CLIP_W; x++) { uint16_t pixel = src[x]; @@ -1436,7 +1436,7 @@ void halleys_state::filter_bitmap(bitmap_ind16 &bitmap, int mask) pal_ptr = m_internal_palette.get(); esi = mask | 0xffffff00; - edi = (uint32_t*)&bitmap.pix16(VIS_MINY, VIS_MINX + CLIP_W); + edi = (uint32_t*)&bitmap.pix(VIS_MINY, VIS_MINX + CLIP_W); dst_pitch = bitmap.rowpixels() >> 1; ecx = -(CLIP_W>>1); edx = CLIP_H; diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index 1055ae69d69..ba0ea2f53c3 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -269,11 +269,10 @@ uint32_t hazl1500_state::screen_update_hazl1500(screen_device &screen, bitmap_rg m_last_hpos = 0; m_last_vpos = 0; - uint32_t pixindex = 0; for (int y = 0; y < SCREEN_VTOTAL; y++) { - uint32_t *scanline = &bitmap.pix32(y); - pixindex = y * SCREEN_HTOTAL; + uint32_t *scanline = &bitmap.pix(y); + uint32_t pixindex = y * SCREEN_HTOTAL; for (int x = 0; x < SCREEN_HTOTAL; x++) //*scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 0.5) * 0x010101); *scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 63.0) * 0x010101); diff --git a/src/mame/drivers/hektor.cpp b/src/mame/drivers/hektor.cpp index 939896fcc0e..0342dc91160 100644 --- a/src/mame/drivers/hektor.cpp +++ b/src/mame/drivers/hektor.cpp @@ -215,14 +215,14 @@ MC6845_UPDATE_ROW(hektor3_state::crtc_update_row) uint8_t data = m_ram->pointer()[~offset & 0xffff]; if (x == cursor_x) data ^= 0xff; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/mame/drivers/hhtiger.cpp b/src/mame/drivers/hhtiger.cpp index e0d486317c3..24256624a91 100644 --- a/src/mame/drivers/hhtiger.cpp +++ b/src/mame/drivers/hhtiger.cpp @@ -184,18 +184,18 @@ GFXDECODE_END UPD7220_DISPLAY_PIXELS_MEMBER(hhtiger_state::display_pixels) { /* 96KB video RAM (32KB green + 32KB red + 32KB blue) */ - uint16_t green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; - uint16_t red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; - uint16_t blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; + uint16_t const green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; + uint16_t const red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; + uint16_t const blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; for (int xi = 0; xi<16; xi++) { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; + int const r = BIT(red, xi) ? 255 : 0; + int const g = BIT(green, xi) ? 255 : 0; + int const b = BIT(blue, xi) ? 255 : 0; if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + bitmap.pix(y, x + xi) = rgb_t(r, g, b); } } @@ -226,7 +226,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER(hhtiger_state::draw_text) pen = 0; if (!m_screen->visible_area().contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/highvdeo.cpp b/src/mame/drivers/highvdeo.cpp index 6fb110ad7d4..16c02ff3922 100644 --- a/src/mame/drivers/highvdeo.cpp +++ b/src/mame/drivers/highvdeo.cpp @@ -216,24 +216,22 @@ void highvdeo_state::machine_start() uint32_t highvdeo_state::screen_update_tourvisn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.min_y;y<=cliprect.max_y;y++) { - count = ((y * (screen.visible_area().max_x+1)) + cliprect.min_x) >> 1; - for(x=(cliprect.min_x>>1);x<=(cliprect.max_x>>1);x++) + int count = ((y * (screen.visible_area().max_x+1)) + cliprect.min_x) >> 1; + for(int x=(cliprect.min_x>>1);x<=(cliprect.max_x>>1);x++) { uint32_t color; color = ((m_blit_ram[count]) & 0x00ff)>>0; if(cliprect.contains((x*2)+0, y)) - bitmap.pix32(y, (x*2)+0) = m_palette->pen(color); + bitmap.pix(y, (x*2)+0) = m_palette->pen(color); color = ((m_blit_ram[count]) & 0xff00)>>8; if(cliprect.contains((x*2)+1, y)) - bitmap.pix32(y, (x*2)+1) = m_palette->pen(color); + bitmap.pix(y, (x*2)+1) = m_palette->pen(color); count++; } @@ -245,16 +243,14 @@ uint32_t highvdeo_state::screen_update_tourvisn(screen_device &screen, bitmap_rg /*Later HW, RGB565 instead of RAM-based pens (+ ramdac).*/ uint32_t highvdeo_state::screen_update_brasil(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - - const pen_t *rgb = m_palette->pens(); // 16 bit RGB + pen_t const *const rgb = m_palette->pens(); // 16 bit RGB - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.min_y;y<=cliprect.max_y;y++) { - count = (y * 400) + cliprect.min_x; - for(x=cliprect.min_x;x<=cliprect.max_x;x++) + int count = (y * 400) + cliprect.min_x; + for(int x=cliprect.min_x;x<=cliprect.max_x;x++) { - bitmap.pix32(y, x) = rgb[m_blit_ram[count++]]; + bitmap.pix(y, x) = rgb[m_blit_ram[count++]]; } } diff --git a/src/mame/drivers/hitme.cpp b/src/mame/drivers/hitme.cpp index 1c6e59f3742..33b65f0c945 100644 --- a/src/mame/drivers/hitme.cpp +++ b/src/mame/drivers/hitme.cpp @@ -80,26 +80,26 @@ uint32_t hitme_state::screen_update_hitme(screen_device &screen, bitmap_ind16 &b double dot_freq = 15750 * 336; /* the number of pixels is the duration times the frequency */ int width_pixels = width_duration * dot_freq; - int x, y, xx, inv; offs_t offs = 0; /* start by drawing the tilemap */ m_tilemap->draw(screen, bitmap, cliprect, 0, 0); /* now loop over and invert anything */ - for (y = 0; y < 19; y++) + for (int y = 0; y < 19; y++) { int dy = bitmap.rowpixels(); - for (inv = x = 0; x < 40; x++, offs++) + int inv = 0; + for (int x = 0; x < 40; x++, offs++) { /* if the high bit is set, reset the oneshot */ if (m_videoram[y * 40 + x] & 0x80) inv = width_pixels; /* invert pixels until we run out */ - for (xx = 0; xx < 8 && inv; xx++, inv--) + for (int xx = 0; xx < 8 && inv; xx++, inv--) { - uint16_t *dest = &bitmap.pix16(y * 10, x * 8 + xx); + uint16_t *const dest = &bitmap.pix(y * 10, x * 8 + xx); dest[0 * dy] ^= 1; dest[1 * dy] ^= 1; dest[2 * dy] ^= 1; diff --git a/src/mame/drivers/homelab.cpp b/src/mame/drivers/homelab.cpp index d19379c2e8d..4861ab08b83 100644 --- a/src/mame/drivers/homelab.cpp +++ b/src/mame/drivers/homelab.cpp @@ -622,19 +622,18 @@ u32 homelab_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co if (!m_cols) return 1; - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for(y = 0; y < m_rows; y++ ) + for (u8 y = 0; y < m_rows; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + m_cols; x++) + for (u16 x = ma; x < ma + m_cols; x++) { - chr = m_vram[x]; // get char in videoram - gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen + u8 const chr = m_vram[x]; // get char in videoram + u8 const gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/homez80.cpp b/src/mame/drivers/homez80.cpp index e84d42b71d6..c6e339af789 100644 --- a/src/mame/drivers/homez80.cpp +++ b/src/mame/drivers/homez80.cpp @@ -233,21 +233,20 @@ void homez80_state::machine_start() u32 homez80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++, 44); + uint16_t *p = &bitmap.pix(sy++, 44); - for (x = ma; x < ma+32; x++) + for (u16 x = ma; x < ma+32; x++) { - chr = m_vram[x]; + u8 const chr = m_vram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr<<3) | ra]; + u8 const gfx = m_p_chargen[ (chr<<3) | ra]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/hotblock.cpp b/src/mame/drivers/hotblock.cpp index 40f73692962..9aa225c38ca 100644 --- a/src/mame/drivers/hotblock.cpp +++ b/src/mame/drivers/hotblock.cpp @@ -159,7 +159,7 @@ uint32_t hotblock_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int count = (y * 320) + cliprect.left(); for(int x = cliprect.left(); x <= cliprect.right(); x++) { - bitmap.pix16(y, x) = m_vram[count++]; + bitmap.pix(y, x) = m_vram[count++]; } } diff --git a/src/mame/drivers/hotstuff.cpp b/src/mame/drivers/hotstuff.cpp index 446c4edbaab..05c1b1ffb77 100644 --- a/src/mame/drivers/hotstuff.cpp +++ b/src/mame/drivers/hotstuff.cpp @@ -40,11 +40,10 @@ void hotstuff_state::video_start() uint32_t hotstuff_state::screen_update_hotstuff(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int yyy,xxx; uint16_t row_palette_data[0x10]; rgb_t row_palette_data_as_rgb32_pen_data[0x10]; - yyy=512;xxx=512*2; + int yyy=512, xxx=512*2; int count = 0; for (int y = 0; y < yyy; y++) @@ -61,13 +60,13 @@ uint32_t hotstuff_state::screen_update_hotstuff(screen_device &screen, bitmap_rg for (int x = 0; x < xxx; ) { - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0xf000)>>12]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0xf000)>>12]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x0f00)>>8]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x0f00)>>8]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x00f0)>>4]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x00f0)>>4]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x000f)>>0]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x000f)>>0]; x++; count++; diff --git a/src/mame/drivers/hp16500.cpp b/src/mame/drivers/hp16500.cpp index f26bfda1e2d..654228a96db 100644 --- a/src/mame/drivers/hp16500.cpp +++ b/src/mame/drivers/hp16500.cpp @@ -143,12 +143,11 @@ WRITE_LINE_MEMBER( hp16500_state::vsync_changed ) MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); - int i, pos; + uint32_t *p = &bitmap.pix(y); - pos = y * 144; + int pos = y * 144; - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { *p++ = m_palette[m_vram[pos+0x00000]]; *p++ = m_palette[m_vram[pos+0x10000]]; @@ -165,12 +164,11 @@ MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) MC6845_UPDATE_ROW( hp16500_state::crtc_update_row_1650 ) { - uint32_t *p = &bitmap.pix32(y); - int i, pos; + uint32_t *p = &bitmap.pix(y); - pos = y * 148; + int pos = y * 148; - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { *p++ = m_palette[m_vram[pos+0x00000]]; *p++ = m_palette[m_vram[pos+0x10000]]; @@ -400,7 +398,7 @@ uint32_t hp16500_state::screen_update_hp16500(screen_device &screen, bitmap_rgb3 int pos = 0; for (int y = 0; y < 384; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 576; x+=4) { diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp index 618377674aa..55c26b3edd3 100644 --- a/src/mame/drivers/hp2640.cpp +++ b/src/mame/drivers/hp2640.cpp @@ -667,8 +667,8 @@ void hp2645_state::video_render_buffer(unsigned video_scanline , unsigned line_i } unsigned on_pen = BIT(attrs , 3) ? 1 : 2; for (unsigned x = 0; x < VIDEO_CHAR_WIDTH * 2; x += 2) { - m_bitmap.pix32(video_scanline , x_left + x) = m_palette->pen(BIT(pixels_e , 0) ? on_pen : 0); - m_bitmap.pix32(video_scanline , x_left + x + 1) = m_palette->pen(BIT(pixels_o , 0) ? on_pen : 0); + m_bitmap.pix(video_scanline , x_left + x) = m_palette->pen(BIT(pixels_e , 0) ? on_pen : 0); + m_bitmap.pix(video_scanline , x_left + x + 1) = m_palette->pen(BIT(pixels_o , 0) ? on_pen : 0); pixels_e >>= 1; pixels_o >>= 1; } diff --git a/src/mame/drivers/hp64k.cpp b/src/mame/drivers/hp64k.cpp index ba1e068e2a0..3d2e2ca4298 100644 --- a/src/mame/drivers/hp64k.cpp +++ b/src/mame/drivers/hp64k.cpp @@ -481,11 +481,9 @@ WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_vrtc_w) I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; - bool lvid , livid; uint16_t pixels_lvid , pixels_livid; - unsigned i; if (vsp) { pixels_lvid = pixels_livid = ~0; @@ -504,19 +502,19 @@ I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) pixels_livid = ~0; } - for (i = 0; i < 9; i++) { - lvid = (pixels_lvid & (1U << (8 - i))) != 0; - livid = (pixels_livid & (1U << (8 - i))) != 0; + for (unsigned i = 0; i < 9; i++) { + bool const lvid = (pixels_lvid & (1U << (8 - i))) != 0; + bool const livid = (pixels_livid & (1U << (8 - i))) != 0; if (!lvid) { // Normal brightness - bitmap.pix32(y , x + i) = palette[ 2 ]; + bitmap.pix(y , x + i) = palette[ 2 ]; } else if (livid) { // Black - bitmap.pix32(y , x + i) = palette[ 0 ]; + bitmap.pix(y , x + i) = palette[ 0 ]; } else { // Half brightness - bitmap.pix32(y , x + i) = palette[ 1 ]; + bitmap.pix(y , x + i) = palette[ 1 ]; } } diff --git a/src/mame/drivers/hp80.cpp b/src/mame/drivers/hp80.cpp index 6fa046d2822..7daea00a448 100644 --- a/src/mame/drivers/hp80.cpp +++ b/src/mame/drivers/hp80.cpp @@ -1107,7 +1107,7 @@ WRITE_LINE_MEMBER(hp85_state::vblank_w) uint8_t pixels = video_mem_r(video_start , GRAPH_MEM_SIZE / 2 - 1); video_start += 2; for (unsigned sub_x = 0; sub_x < 8; sub_x++) { - m_bitmap.pix32(y , x + sub_x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , x + sub_x) = m_palette->pen(BIT(pixels , 7)); pixels <<= 1; } } @@ -1130,7 +1130,7 @@ WRITE_LINE_MEMBER(hp85_state::vblank_w) pixels = 0; } for (unsigned sub_x = 0; sub_x < 8; sub_x++) { - m_bitmap.pix32(row + sub_row , col + sub_x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(row + sub_row , col + sub_x) = m_palette->pen(BIT(pixels , 7)); pixels <<= 1; } } @@ -1840,14 +1840,14 @@ WRITE_LINE_MEMBER(hp86_state::vblank_w) if (++video_ptr >= limit) { video_ptr = 0; } - m_bitmap.pix32(y , x) = m_palette->pen(BIT(pixels , 7)); - m_bitmap.pix32(y , x + 1) = m_palette->pen(BIT(pixels , 6)); - m_bitmap.pix32(y , x + 2) = m_palette->pen(BIT(pixels , 5)); - m_bitmap.pix32(y , x + 3) = m_palette->pen(BIT(pixels , 4)); - m_bitmap.pix32(y , x + 4) = m_palette->pen(BIT(pixels , 3)); - m_bitmap.pix32(y , x + 5) = m_palette->pen(BIT(pixels , 2)); - m_bitmap.pix32(y , x + 6) = m_palette->pen(BIT(pixels , 1)); - m_bitmap.pix32(y , x + 7) = m_palette->pen(BIT(pixels , 0)); + m_bitmap.pix(y , x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , x + 1) = m_palette->pen(BIT(pixels , 6)); + m_bitmap.pix(y , x + 2) = m_palette->pen(BIT(pixels , 5)); + m_bitmap.pix(y , x + 3) = m_palette->pen(BIT(pixels , 4)); + m_bitmap.pix(y , x + 4) = m_palette->pen(BIT(pixels , 3)); + m_bitmap.pix(y , x + 5) = m_palette->pen(BIT(pixels , 2)); + m_bitmap.pix(y , x + 6) = m_palette->pen(BIT(pixels , 1)); + m_bitmap.pix(y , x + 7) = m_palette->pen(BIT(pixels , 0)); } } } else { @@ -1880,14 +1880,14 @@ WRITE_LINE_MEMBER(hp86_state::vblank_w) pixels = ~pixels; } unsigned y = row * lines_per_row + sub_row; - m_bitmap.pix32(y , col) = m_palette->pen(BIT(pixels , 7)); - m_bitmap.pix32(y , col + 1) = m_palette->pen(BIT(pixels , 6)); - m_bitmap.pix32(y , col + 2) = m_palette->pen(BIT(pixels , 5)); - m_bitmap.pix32(y , col + 3) = m_palette->pen(BIT(pixels , 4)); - m_bitmap.pix32(y , col + 4) = m_palette->pen(BIT(pixels , 3)); - m_bitmap.pix32(y , col + 5) = m_palette->pen(BIT(pixels , 2)); - m_bitmap.pix32(y , col + 6) = m_palette->pen(BIT(pixels , 1)); - m_bitmap.pix32(y , col + 7) = m_palette->pen(BIT(pixels , 0)); + m_bitmap.pix(y , col) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , col + 1) = m_palette->pen(BIT(pixels , 6)); + m_bitmap.pix(y , col + 2) = m_palette->pen(BIT(pixels , 5)); + m_bitmap.pix(y , col + 3) = m_palette->pen(BIT(pixels , 4)); + m_bitmap.pix(y , col + 4) = m_palette->pen(BIT(pixels , 3)); + m_bitmap.pix(y , col + 5) = m_palette->pen(BIT(pixels , 2)); + m_bitmap.pix(y , col + 6) = m_palette->pen(BIT(pixels , 1)); + m_bitmap.pix(y , col + 7) = m_palette->pen(BIT(pixels , 0)); } } } diff --git a/src/mame/drivers/hp95lx.cpp b/src/mame/drivers/hp95lx.cpp index dc8b0ec5998..2c8df7ad204 100644 --- a/src/mame/drivers/hp95lx.cpp +++ b/src/mame/drivers/hp95lx.cpp @@ -188,20 +188,16 @@ void hp95lx_state::hp95lx_palette(palette_device &palette) const uint32_t hp95lx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, offset; - uint16_t gfx, *p; - uint8_t chr, attr; - if (m_graphics_mode) { - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - p = &bitmap.pix16(y); - offset = y * (240 / 8); + uint16_t *p = &bitmap.pix(y); + int const offset = y * (240 / 8); - for (x = offset; x < offset + (240 / 8); x++) + for (int x = offset; x < offset + (240 / 8); x++) { - gfx = m_p_videoram[x]; + uint16_t const gfx = m_p_videoram[x]; for (int i = 7; i >= 0; i--) { @@ -215,17 +211,17 @@ uint32_t hp95lx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap bool blink((m_screen->frame_number() % 10) > 4); // screen memory is normal MDA 80x25, but only a scrollable 40x16 window is displayed - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - p = &bitmap.pix16(y); - offset = (y / 8) * 160 + m_window_start_addr; + uint16_t *p = &bitmap.pix(y); + int const offset = (y / 8) * 160 + m_window_start_addr; - for (x = offset; x < offset + 80; x += 2) + for (int x = offset; x < offset + 80; x += 2) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x + 1]; + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x + 1]; - gfx = m_p_chargen[(chr)*8 + (y % 8)]; + uint16_t gfx = m_p_chargen[(chr)*8 + (y % 8)]; if ((x >> 1) == m_cursor_addr && blink && (y % 8) >= m_cursor_start_ras) { diff --git a/src/mame/drivers/hp9845.cpp b/src/mame/drivers/hp9845.cpp index 1543d81dfe1..400aeb02133 100644 --- a/src/mame/drivers/hp9845.cpp +++ b/src/mame/drivers/hp9845.cpp @@ -1032,7 +1032,7 @@ void hp9845b_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked) { // Blank scanline for (unsigned i = 0; i < VIDEO_HBSTART; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } else { bool cursor_line = line_in_row == 12; @@ -1065,7 +1065,7 @@ void hp9845b_state::video_render_buff(unsigned video_scanline , unsigned line_in for (unsigned j = 0; j < 9; j++) { bool pixel = (pixels & (1U << j)) != 0; - m_bitmap.pix32(video_scanline , i * 9 + j) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; + m_bitmap.pix(video_scanline , i * 9 + j) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; } } } @@ -1105,7 +1105,7 @@ void hp9845b_state::graphic_video_render(unsigned video_scanline) // Normal pixel pixel = (word & mask) != 0 ? PEN_GRAPHIC : PEN_BLACK; } - m_bitmap.pix32(video_scanline - GVIDEO_VBEND , x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline - GVIDEO_VBEND , x++) = pen[ pixel ]; } } } @@ -1693,15 +1693,15 @@ void hp9845ct_base_state::render_lp_cursor(unsigned video_scanline , unsigned pe const pen_t &pen = m_palette->pen(pen_idx); if (!yc) { if (m_gv_lp_cursor_x < VIDEO_TOT_HPIXELS) { - m_bitmap.pix32(video_scanline , m_gv_lp_cursor_x) = pen; + m_bitmap.pix(video_scanline , m_gv_lp_cursor_x) = pen; } } else if (m_gv_lp_cursor_fs) { for (unsigned x = 0; x < VIDEO_TOT_HPIXELS; x++) { - m_bitmap.pix32(video_scanline , x) = pen; + m_bitmap.pix(video_scanline , x) = pen; } } else { for (unsigned x = std::max(0 , (int)m_gv_lp_cursor_x - 24); x <= (m_gv_lp_cursor_x + 25) && x < VIDEO_TOT_HPIXELS; x++) { - m_bitmap.pix32(video_scanline , x) = pen; + m_bitmap.pix(video_scanline , x) = pen; } } } @@ -2216,15 +2216,15 @@ void hp9845c_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked || !m_alpha_sel) { // Blank scanline for (unsigned i = 0; i < VIDEO_770_ALPHA_L_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } if (!m_graphic_sel) { for (unsigned i = VIDEO_770_ALPHA_L_LIM; i < VIDEO_770_ALPHA_R_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } } for (unsigned i = VIDEO_770_ALPHA_R_LIM; i < VIDEO_TOT_HPIXELS; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } } else { bool cursor_line = line_in_row == 12; @@ -2272,11 +2272,11 @@ void hp9845c_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_graphic_sel && x >= VIDEO_770_ALPHA_L_LIM && x < VIDEO_770_ALPHA_R_LIM) { // alpha overlays graphics (non-dominating) if (pixel) { - m_bitmap.pix32(video_scanline , x) = pen[ pen_alpha(color) ]; + m_bitmap.pix(video_scanline , x) = pen[ pen_alpha(color) ]; } } else { // Graphics disabled or alpha-only zone - m_bitmap.pix32(video_scanline , x) = pen[ pixel ? pen_alpha(color) : pen_alpha(0) ]; + m_bitmap.pix(video_scanline , x) = pen[ pixel ? pen_alpha(color) : pen_alpha(0) ]; } } } @@ -2347,7 +2347,7 @@ void hp9845c_state::graphic_video_render(unsigned video_scanline) // Normal pixel pixel = pen_graphic(((word0 & mask) ? pen0 : 0) | ((word1 & mask) ? pen1 : 0) | ((word2 & mask) ? pen2 : 0)); } - m_bitmap.pix32(video_scanline , VIDEO_770_ALPHA_L_LIM + x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline , VIDEO_770_ALPHA_L_LIM + x++) = pen[ pixel ]; } } } @@ -2914,15 +2914,15 @@ void hp9845t_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked || !m_alpha_sel) { // Blank scanline for (unsigned i = 0; i < VIDEO_780_ALPHA_L_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } if (!m_graphic_sel) { for (unsigned i = VIDEO_780_ALPHA_L_LIM; i < VIDEO_780_ALPHA_R_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } for (unsigned i = VIDEO_780_ALPHA_R_LIM; i < VIDEO_TOT_HPIXELS; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } else { bool cursor_line = line_in_row == 12; @@ -2974,11 +2974,11 @@ void hp9845t_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_graphic_sel && x >= VIDEO_780_ALPHA_L_LIM && x < VIDEO_780_ALPHA_R_LIM) { // alpha overlays graphics (non-dominating) if (pixel) { - m_bitmap.pix32(video_scanline , x) = pen[ PEN_ALPHA ]; + m_bitmap.pix(video_scanline , x) = pen[ PEN_ALPHA ]; } } else { // Graphics disabled or alpha-only zone - m_bitmap.pix32(video_scanline , x) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; + m_bitmap.pix(video_scanline , x) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; } } } @@ -3042,7 +3042,7 @@ void hp9845t_state::graphic_video_render(unsigned video_scanline) else pixel = word & mask ? PEN_GRAPHIC : PEN_BLACK; } - m_bitmap.pix32(video_scanline , VIDEO_780_ALPHA_L_LIM + x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline , VIDEO_780_ALPHA_L_LIM + x++) = pen[ pixel ]; } } } diff --git a/src/mame/drivers/hp9k.cpp b/src/mame/drivers/hp9k.cpp index 1895babc4d1..ca89fd2a7bd 100644 --- a/src/mame/drivers/hp9k.cpp +++ b/src/mame/drivers/hp9k.cpp @@ -353,14 +353,13 @@ GFXDECODE_END void hp9k_state::putChar(uint8_t thec,int x,int y,bitmap_ind16 &bitmap) { - const uint8_t* pchar=m_gfxdecode->gfx(0)->get_data(thec); + uint8_t const *const pchar=m_gfxdecode->gfx(0)->get_data(thec); for (int py=0;py<HP9816_CHDIMY;py++) { for (int px=0;px<HP9816_CHDIMX;px++) { - uint16_t *dest=&bitmap.pix16((y*(HP9816_CHDIMY))+py,(x*(HP9816_CHDIMX))+px); - *dest=pchar[px+(py*8)]; + bitmap.pix((y*(HP9816_CHDIMY))+py,(x*(HP9816_CHDIMX))+px) = pchar[px+(py*8)]; } } } diff --git a/src/mame/drivers/hprot1.cpp b/src/mame/drivers/hprot1.cpp index 685bf8bc84f..feaff0856f5 100644 --- a/src/mame/drivers/hprot1.cpp +++ b/src/mame/drivers/hprot1.cpp @@ -236,12 +236,12 @@ HD44780_PIXEL_UPDATE(hprot1_state::hprot1_pixel_update) { if ( pos < 16 && line==0 ) { - bitmap.pix16(y, pos*6 + x) = state; + bitmap.pix(y, pos*6 + x) = state; } if ( pos >= 64 && pos < 80 && line==0 ) { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; + bitmap.pix(y+9,(pos-64)*6 + x) = state; } } diff --git a/src/mame/drivers/huebler.cpp b/src/mame/drivers/huebler.cpp index 8b3a6974097..56b5748d3d3 100644 --- a/src/mame/drivers/huebler.cpp +++ b/src/mame/drivers/huebler.cpp @@ -231,26 +231,25 @@ INPUT_PORTS_END uint32_t amu880_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y, sx, x, line; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - line = y % 10; + int const line = y % 10; - for (sx = 0; sx < 64; sx++) + for (int sx = 0; sx < 64; sx++) { - uint16_t videoram_addr = ((y / 10) * 64) + sx; - uint8_t videoram_data = m_video_ram[videoram_addr & 0x7ff]; + uint16_t const videoram_addr = ((y / 10) * 64) + sx; + uint8_t const videoram_data = m_video_ram[videoram_addr & 0x7ff]; - uint16_t charrom_addr = ((videoram_data & 0x7f) << 3) | line; + uint16_t const charrom_addr = ((videoram_data & 0x7f) << 3) | line; uint8_t data = m_char_rom->base()[charrom_addr & 0x3ff]; - for (x = 0; x < 6; x++) + for (int x = 0; x < 6; x++) { - int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); + int const color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); - bitmap.pix32(y, (sx * 6) + x) = pen[color]; + bitmap.pix(y, (sx * 6) + x) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/hunter16.cpp b/src/mame/drivers/hunter16.cpp index aadb3dcea92..1824bbc508c 100644 --- a/src/mame/drivers/hunter16.cpp +++ b/src/mame/drivers/hunter16.cpp @@ -169,12 +169,12 @@ void hunter16_state::palette_init_hunter16(palette_device &palette) MC6845_UPDATE_ROW(hunter16_state::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (int i = 0; i < x_count; i++) { - uint16_t offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); uint8_t data = m_videoram[offset]; for (int bit = 7; bit >= 0; bit--) diff --git a/src/mame/drivers/husky.cpp b/src/mame/drivers/husky.cpp index ba63742e0a2..84084b366cb 100644 --- a/src/mame/drivers/husky.cpp +++ b/src/mame/drivers/husky.cpp @@ -384,13 +384,13 @@ uint32_t husky_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, I'm drawing each character as 6x12 to form an overall screen of 192x48. */ - uint8_t data; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int y = 0; y < 48; y++) { for (int x = 0; x < 32; x++) { + uint8_t data; switch (y % 12) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: @@ -399,24 +399,24 @@ uint32_t husky_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int b = 0; b < 5; b++) { - bitmap.pix32(y, (x * 6) + b) = BIT(data, 0) ? pen[1] : pen[2]; + bitmap.pix(y, (x * 6) + b) = BIT(data, 0) ? pen[1] : pen[2]; data >>= 1; } - bitmap.pix32(y, (x * 6) + 5) = pen[0]; + bitmap.pix(y, (x * 6) + 5) = pen[0]; break; case 8: /* cursor */ for (int b = 0; b < 5; b++) { - bitmap.pix32(y, (x * 6) + b) = (!m_curinh && m_cursor == (y / 12) * 32 + x) ? pen[1] : pen[2]; + bitmap.pix(y, (x * 6) + b) = (!m_curinh && m_cursor == (y / 12) * 32 + x) ? pen[1] : pen[2]; } - bitmap.pix32(y, (x * 6) + 5) = pen[0]; + bitmap.pix(y, (x * 6) + 5) = pen[0]; break; default: /* blank */ for (int b = 0; b < 6; b++) { - bitmap.pix32(y, (x * 6) + b) = pen[0]; + bitmap.pix(y, (x * 6) + b) = pen[0]; } break; } diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp index 0f2ec3a18d1..26ae14be877 100644 --- a/src/mame/drivers/ibm6580.cpp +++ b/src/mame/drivers/ibm6580.cpp @@ -717,23 +717,24 @@ INPUT_PORTS_END uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx,fg,bg,chr,attr; - uint16_t sy=0,ma=25,x,ca; + uint16_t sy=0,ma=25; - fg = 1; bg = 0; + uint8_t fg = 1, bg = 0; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - // graphics mode - if (m_p_videoram[ma] & 0x100) { - for (x = ma; x < ma + 80; x++) + if (m_p_videoram[ma] & 0x100) + { + // graphics mode + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x] >> 8; + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x] >> 8; + uint8_t gfx; switch (ra >> 1) { @@ -764,13 +765,16 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma *p++ = BIT(gfx, i) ? fg : bg; } } - } else { - // text mode - for (x = ma; x < ma + 80; x++) + } + else + { + // text mode + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x] >> 8; - ca = (chr<<4); + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x] >> 8; + uint16_t ca = (chr<<4); + uint8_t gfx; // font 2 if (attr & 0x02) diff --git a/src/mame/drivers/icatel.cpp b/src/mame/drivers/icatel.cpp index e20cde566cb..151fd97ed80 100644 --- a/src/mame/drivers/icatel.cpp +++ b/src/mame/drivers/icatel.cpp @@ -228,12 +228,12 @@ HD44780_PIXEL_UPDATE(icatel_state::icatel_pixel_update) { if ( pos < 16 && line==0 ) { - bitmap.pix16(y, pos*6 + x) = state; + bitmap.pix(y, pos*6 + x) = state; } if ( pos >= 64 && pos < 80 && line==0 ) { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; + bitmap.pix(y+9,(pos-64)*6 + x) = state; } } diff --git a/src/mame/drivers/if800.cpp b/src/mame/drivers/if800.cpp index 0719bb7f354..26128d2aa91 100644 --- a/src/mame/drivers/if800.cpp +++ b/src/mame/drivers/if800.cpp @@ -43,18 +43,15 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - int xi,gfx; - uint8_t pen; + int gfx = m_video_ram[address >> 1]; - gfx = m_video_ram[address >> 1]; - - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - pen = ((gfx >> xi) & 1) ? 1 : 0; + uint8_t pen = BIT(gfx, xi); - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp index 284abb450fd..f6268c6800e 100644 --- a/src/mame/drivers/igs011.cpp +++ b/src/mame/drivers/igs011.cpp @@ -394,10 +394,10 @@ u32 igs011_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con #ifdef MAME_DEBUG if ((layer_enable != -1) && (pri_addr == 0xff)) - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x) = m_palette->black_pen(); else #endif - bitmap.pix16(y, x) = m_layer[l][scr_addr] | (l << 8); + bitmap.pix(y, x) = m_layer[l][scr_addr] | (l << 8); } } return 0; diff --git a/src/mame/drivers/imolagp.cpp b/src/mame/drivers/imolagp.cpp index 67503390b3b..05b87fba010 100644 --- a/src/mame/drivers/imolagp.cpp +++ b/src/mame/drivers/imolagp.cpp @@ -182,7 +182,7 @@ uint32_t imolagp_state::screen_update_imolagp(screen_device &screen, bitmap_ind1 for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { uint8_t const *const source = &m_videoram[layer][(y & 0xff) * 0x40]; - uint16_t *const dest = &bitmap.pix16(y & 0xff); + uint16_t *const dest = &bitmap.pix(y & 0xff); for (int i = 0; i < 0x40; i++) { uint8_t const data = source[i]; diff --git a/src/mame/drivers/informer_207_100.cpp b/src/mame/drivers/informer_207_100.cpp index eb7e9ab238e..37814336add 100644 --- a/src/mame/drivers/informer_207_100.cpp +++ b/src/mame/drivers/informer_207_100.cpp @@ -108,7 +108,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED( informer_207_100_state::crtc_addr ) MC6845_UPDATE_ROW( informer_207_100_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int x = 0; x < x_count; x++) { @@ -120,14 +120,14 @@ MC6845_UPDATE_ROW( informer_207_100_state::crtc_update_row ) data = 0xff; // draw 8 pixels of the character - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; } } diff --git a/src/mame/drivers/informer_207_376.cpp b/src/mame/drivers/informer_207_376.cpp index 4d084317302..a10483728d3 100644 --- a/src/mame/drivers/informer_207_376.cpp +++ b/src/mame/drivers/informer_207_376.cpp @@ -139,11 +139,11 @@ void informer_207_376_state::crt_brightness_w(uint8_t data) MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int x = 0; x < x_count; x++) { - uint8_t code = m_ram[ma + x]; + uint8_t const code = m_ram[ma + x]; uint8_t data = m_chargen[(code << 4) + ra]; if (x == cursor_x) @@ -154,14 +154,14 @@ MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row ) data = 0xff; // draw 8 pixels of the character - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; } } diff --git a/src/mame/drivers/informer_213.cpp b/src/mame/drivers/informer_213.cpp index f2167563fbe..c031b214484 100644 --- a/src/mame/drivers/informer_213.cpp +++ b/src/mame/drivers/informer_213.cpp @@ -196,12 +196,12 @@ uint32_t informer_213_state::screen_update(screen_device &screen, bitmap_rgb32 & data = 0xff; // 6 pixels of the character - bitmap.pix32(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 2) = BIT(data, 5) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 3) = BIT(data, 4) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 4) = BIT(data, 3) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 5) = BIT(data, 2) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 2) = BIT(data, 5) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 3) = BIT(data, 4) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 4) = BIT(data, 3) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 5) = BIT(data, 2) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/invqix.cpp b/src/mame/drivers/invqix.cpp index d25b321c04c..6a51d9e74c6 100644 --- a/src/mame/drivers/invqix.cpp +++ b/src/mame/drivers/invqix.cpp @@ -174,8 +174,6 @@ void invqix_state::video_start() uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - // this means freeze or blank or something if (m_vctl == 0x100) { @@ -184,45 +182,39 @@ uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap if (m_vctl == 0x0000) { - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t r,g,b; - int pen_data; - - pen_data = (m_vram[(x+y*256)]); - b = (pen_data & 0x001f); - g = (pen_data & 0x03e0) >> 5; - r = (pen_data & 0x7c00) >> 10; + int pen_data = (m_vram[(x+y*256)]); + uint8_t b = (pen_data & 0x001f); + uint8_t g = (pen_data & 0x03e0) >> 5; + uint8_t r = (pen_data & 0x7c00) >> 10; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } else if (m_vctl == 0x0001) // flip { - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t r,g,b; - int pen_data; - - pen_data = (m_vram[(256-x)+((256-y)*256)]); - b = (pen_data & 0x001f); - g = (pen_data & 0x03e0) >> 5; - r = (pen_data & 0x7c00) >> 10; + int pen_data = (m_vram[(256-x)+((256-y)*256)]); + uint8_t b = (pen_data & 0x001f); + uint8_t g = (pen_data & 0x03e0) >> 5; + uint8_t r = (pen_data & 0x7c00) >> 10; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/drivers/ipds.cpp b/src/mame/drivers/ipds.cpp index 1e25739e3f9..cd6379ed07e 100644 --- a/src/mame/drivers/ipds.cpp +++ b/src/mame/drivers/ipds.cpp @@ -92,8 +92,7 @@ void ipds_state::machine_reset() I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t *charmap = memregion("chargen")->base(); uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -106,8 +105,8 @@ I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + for(int i=0;i<6;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp index e986c5562c2..0a51a6b624e 100644 --- a/src/mame/drivers/irisha.cpp +++ b/src/mame/drivers/irisha.cpp @@ -207,17 +207,15 @@ INPUT_PORTS_END uint32_t irisha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx; - uint16_t y,ma=0,x; - uint16_t *p; + uint16_t ma=0; - for (y = 0; y < 200; y++) + for (uint16_t y = 0; y < 200; y++) { - p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = ma; x < ma+40; x++) + for (uint16_t x = ma; x < ma+40; x++) { - gfx = m_p_videoram[x]; + uint8_t const gfx = m_p_videoram[x]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/itgambl2.cpp b/src/mame/drivers/itgambl2.cpp index 61b39d63c18..26d1107f089 100644 --- a/src/mame/drivers/itgambl2.cpp +++ b/src/mame/drivers/itgambl2.cpp @@ -145,7 +145,7 @@ uint32_t itgambl2_state::screen_update_itgambl2(screen_device &screen, bitmap_rg uint32_t const color = (blit_ram[count] & 0xff) >> 0; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/itgambl3.cpp b/src/mame/drivers/itgambl3.cpp index 894145657f8..ea119054d62 100644 --- a/src/mame/drivers/itgambl3.cpp +++ b/src/mame/drivers/itgambl3.cpp @@ -92,8 +92,7 @@ void itgambl3_state::video_start() /* (dirty) debug code for looking 8bpps blitter-based gfxs */ uint32_t itgambl3_state::screen_update_itgambl3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - const uint8_t *blit_ram = memregion("gfx1")->base(); + uint8_t const *const blit_ram = memregion("gfx1")->base(); if(machine().input().code_pressed(KEYCODE_Z)) m_test_x++; @@ -123,18 +122,16 @@ uint32_t itgambl3_state::screen_update_itgambl3(screen_device &screen, bitmap_rg bitmap.fill(m_palette->black_pen(), cliprect); - count = (m_start_offs); + int count = m_start_offs; - for(y=0;y<m_test_y;y++) + for(int y=0;y<m_test_y;y++) { - for(x=0;x<m_test_x;x++) + for(int x=0;x<m_test_x;x++) { - uint32_t color; - - color = (blit_ram[count] & 0xff)>>0; + uint32_t color = (blit_ram[count] & 0xff)>>0; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/itt1700.cpp b/src/mame/drivers/itt1700.cpp index ec993830f2d..f9d9cb41f04 100644 --- a/src/mame/drivers/itt1700.cpp +++ b/src/mame/drivers/itt1700.cpp @@ -51,7 +51,7 @@ private: MC6845_UPDATE_ROW(itt1700_state::update_row) { - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); u16 page = 0x800; for (int i = 0; i < x_count; i++) diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 789343aa3dc..7888971b5a2 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -193,7 +193,7 @@ uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); - uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); + uint16_t *dst = &m_tmp_bitmap->pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/drivers/jantotsu.cpp b/src/mame/drivers/jantotsu.cpp index 200b8339b36..41912c6a542 100644 --- a/src/mame/drivers/jantotsu.cpp +++ b/src/mame/drivers/jantotsu.cpp @@ -166,28 +166,23 @@ void jantotsu_state::video_start() uint32_t jantotsu_state::screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y, i; - int count = 0; - uint8_t pen_i; - if(!m_display_on) return 0; - for (y = 0; y < 256; y++) + int count = 0; + for (int y = 0; y < 256; y++) { - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - uint8_t color; - - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - color = m_col_bank; + uint8_t color = m_col_bank; - for(pen_i = 0;pen_i<4;pen_i++) + for (uint8_t pen_i = 0;pen_i<4;pen_i++) color |= (((m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << pen_i; if (cliprect.contains(x + i, y)) - bitmap.pix32(y, x + i) = m_palette->pen(color); + bitmap.pix(y, x + i) = m_palette->pen(color); } count++; diff --git a/src/mame/drivers/jchan.cpp b/src/mame/drivers/jchan.cpp index 37a642da4cc..412ef71848c 100644 --- a/src/mame/drivers/jchan.cpp +++ b/src/mame/drivers/jchan.cpp @@ -323,10 +323,10 @@ u32 jchan_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons // TODO : verify sprite-tile priorities from real hardware, Check what 15 bit of palette actually working for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16* src1 = &m_sprite_bitmap[0]->pix16(y); - const u16* src2 = &m_sprite_bitmap[1]->pix16(y); - u8 *tilepri = &tile_primap->pix8(y); - u16* dst = &bitmap.pix16(y); + u16 const *const src1 = &m_sprite_bitmap[0]->pix(y); + u16 const *const src2 = &m_sprite_bitmap[1]->pix(y); + u8 *const tilepri = &tile_primap->pix(y); + u16 *const dst = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/jollyjgr.cpp b/src/mame/drivers/jollyjgr.cpp index 4c2bfccea69..d413146df0f 100644 --- a/src/mame/drivers/jollyjgr.cpp +++ b/src/mame/drivers/jollyjgr.cpp @@ -514,13 +514,13 @@ void jollyjgr_state::draw_bitmap(bitmap_rgb32 &bitmap) if (color) { if (m_flip_x && m_flip_y) - bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color); + bitmap.pix(y, x * 8 + i) = m_bm_palette->pen_color(color); else if (m_flip_x && !m_flip_y) - bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); + bitmap.pix(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); else if (!m_flip_x && m_flip_y) - bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); + bitmap.pix(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); else - bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); + bitmap.pix(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); } } @@ -602,7 +602,7 @@ uint32_t jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_rgb if (sy>=cliprect.min_y && sy<=cliprect.max_y) for (int x=sx-4;x<sx;x++) if (x>=cliprect.min_x && x<=cliprect.max_x) - bitmap.pix32(sy, x) = m_bm_palette->pen_color(bc); + bitmap.pix(sy, x) = m_bm_palette->pen_color(bc); } return 0; diff --git a/src/mame/drivers/jongkyo.cpp b/src/mame/drivers/jongkyo.cpp index 1193f11fa83..98f8ed1d3b0 100644 --- a/src/mame/drivers/jongkyo.cpp +++ b/src/mame/drivers/jongkyo.cpp @@ -98,18 +98,10 @@ void jongkyo_state::video_start() uint32_t jongkyo_state::screen_update_jongkyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - - for (y = 0; y < 256; ++y) + for (int y = 0; y < 256; ++y) { - int x; - - for (x = 0; x < 256; x += 4) + for (int x = 0; x < 256; x += 4) { - int b; - int res_x,res_y; - uint8_t data1; - uint8_t data2; uint8_t data3; // data3 = m_videoram2[x/4 + y*64]; // wrong @@ -120,15 +112,14 @@ uint32_t jongkyo_state::screen_update_jongkyo(screen_device &screen, bitmap_ind1 // data3 = 0x00; // we're missing 2 bits.. there must be another piece of video ram somewhere or we can't use all the colours (6bpp).. banked somehow? + uint8_t data1 = m_videoram[0x4000 + x / 4 + y * 64]; + uint8_t data2 = m_videoram[x / 4 + y * 64]; - data1 = m_videoram[0x4000 + x / 4 + y * 64]; - data2 = m_videoram[x / 4 + y * 64]; - - for (b = 0; b < 4; ++b) + for (int b = 0; b < 4; ++b) { - res_x = m_flip_screen ? 255 - (x + b) : (x + b); - res_y = m_flip_screen ? 255 - y : y; - bitmap.pix16(res_y, res_x) = ((data2 & 0x01)) + ((data2 & 0x10) >> 3) + + int const res_x = m_flip_screen ? 255 - (x + b) : (x + b); + int const res_y = m_flip_screen ? 255 - y : y; + bitmap.pix(res_y, res_x) = ((data2 & 0x01)) + ((data2 & 0x10) >> 3) + ((data1 & 0x01) << 2) + ((data1 & 0x10) >> 1) + ((data3 & 0x01) << 4) + ((data3 & 0x10) << 1); data1 >>= 1; diff --git a/src/mame/drivers/jonos.cpp b/src/mame/drivers/jonos.cpp index 2009928dd76..ea499a758d3 100644 --- a/src/mame/drivers/jonos.cpp +++ b/src/mame/drivers/jonos.cpp @@ -124,23 +124,23 @@ void jonos_state::machine_reset() uint32_t jonos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_framecnt++; - u8 y,ra,chr,gfx,inv; - u16 sy=0,x; + u16 sy=0; u16 ma = (m_p_videoram[0x7da] + (m_p_videoram[0x7db] << 8)) & 0x7ff; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); u16 cpos = y << 8; - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - inv = (BIT(chr, 7) ^ ((cpos == m_curs_pos) && BIT(m_framecnt, 5))) ? 0xff : 0; + u8 chr = m_p_videoram[x]; + u8 inv = (BIT(chr, 7) ^ ((cpos == m_curs_pos) && BIT(m_framecnt, 5))) ? 0xff : 0; chr &= 0x7f; + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra ] ^ inv; else diff --git a/src/mame/drivers/joystand.cpp b/src/mame/drivers/joystand.cpp index 049ffbf1421..0fa58107e82 100644 --- a/src/mame/drivers/joystand.cpp +++ b/src/mame/drivers/joystand.cpp @@ -253,7 +253,7 @@ void joystand_state::bg2_w(offs_t offset, uint16_t data, uint16_t mem_mask) void joystand_state::bg15_0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { uint16_t val = COMBINE_DATA(&m_bg15_0_ram[offset]); - m_bg15_bitmap[0].pix32(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + m_bg15_bitmap[0].pix(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); } // tile-based @@ -268,7 +268,7 @@ void joystand_state::draw_bg15_tile(address_space &space, int x, int y, uint16_t for (int tx = 0; tx < 16; ++tx) { uint16_t val = space.read_word(srcaddr + ty * 16 * 2 + tx * 2); - m_bg15_bitmap[1].pix32(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + m_bg15_bitmap[1].pix(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); } } } diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp index b203c7d6330..a0f4bad7093 100644 --- a/src/mame/drivers/jpmsys5.cpp +++ b/src/mame/drivers/jpmsys5.cpp @@ -153,8 +153,6 @@ void jpmsys5v_state::ramdac_w(offs_t offset, uint16_t data) uint32_t jpmsys5v_state::screen_update_jpmsys5v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - m_tms34061->get_display_state(); if (m_tms34061->m_display.blanked) @@ -163,14 +161,14 @@ uint32_t jpmsys5v_state::screen_update_jpmsys5v(screen_device &screen, bitmap_rg return 0; } - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint8_t *src = &m_tms34061->m_display.vram[(m_tms34061->m_display.dispstart & 0xffff)*2 + 256 * y]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint8_t const *const src = &m_tms34061->m_display.vram[(m_tms34061->m_display.dispstart & 0xffff)*2 + 256 * y]; + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x +=2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x +=2) { - uint8_t pen = src[(x-cliprect.min_x)>>1]; + uint8_t const pen = src[(x-cliprect.min_x)>>1]; /* Draw two 4-bit pixels */ *dest++ = m_palette->pen((pen >> 4) & 0xf); diff --git a/src/mame/drivers/jr100.cpp b/src/mame/drivers/jr100.cpp index b502a72b4d3..748771028d0 100644 --- a/src/mame/drivers/jr100.cpp +++ b/src/mame/drivers/jr100.cpp @@ -216,20 +216,19 @@ void jr100_state::machine_reset() uint32_t jr100_state::screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool attr; - u8 y,ra,gfx,chr; - u16 x,sy=0,ma=0; + u16 sy=0,ma=0; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - for (x = ma; x < ma + 32; x++) + uint16_t *p = &bitmap.pix(sy++); + for (u16 x = ma; x < ma + 32; x++) { - chr = m_vram[x]; - attr = BIT(chr, 7); + u8 chr = m_vram[x]; + bool const attr = BIT(chr, 7); chr &= 0x7f; + u8 gfx; // ATTR is inverted for normal char or use PCG in case of CMODE1 if (m_use_pcg && attr && (chr < 32)) gfx = m_pcg[(chr<<3) | ra]; diff --git a/src/mame/drivers/jr200.cpp b/src/mame/drivers/jr200.cpp index 80f08a50e21..eabbbd154b4 100644 --- a/src/mame/drivers/jr200.cpp +++ b/src/mame/drivers/jr200.cpp @@ -166,22 +166,21 @@ void jr200_state::video_start() uint32_t jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,xi,yi,pen; - bitmap.fill(m_border_col, cliprect); - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t tile = m_vram[x + y*32]; uint8_t attr = m_cram[x + y*32]; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - uint8_t *gfx_data; + const uint8_t *gfx_data; + int pen; if(attr & 0x80) //bitmap mode { @@ -209,7 +208,7 @@ uint32_t jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &b pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1) ? (attr & 0x7) : ((attr & 0x38) >> 3); } - bitmap.pix16(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); + bitmap.pix(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/jtc.cpp b/src/mame/drivers/jtc.cpp index ffd343f3f2c..7c425e7eb46 100644 --- a/src/mame/drivers/jtc.cpp +++ b/src/mame/drivers/jtc.cpp @@ -669,16 +669,14 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 i, y, sx; - - for (y = 0; y < 64; y++) + for (u8 y = 0; y < 64; y++) { - for (sx = 0; sx < 8; sx++) + for (u8 sx = 0; sx < 8; sx++) { - u8 data = m_video_ram[(y * 8) + sx]; + u8 const data = m_video_ram[(y * 8) + sx]; - for (i = 0; i < 8; i++) - bitmap.pix16(y, (sx * 8) + i) = BIT(data, 7-i); + for (u8 i = 0; i < 8; i++) + bitmap.pix(y, (sx * 8) + i) = BIT(data, 7-i); } } @@ -687,16 +685,14 @@ u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const u32 jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 i, y, sx; - - for (y = 0; y < 128; y++) + for (u8 y = 0; y < 128; y++) { - for (sx = 0; sx < 16; sx++) + for (u8 sx = 0; sx < 16; sx++) { - u8 data = m_video_ram[(y * 16) + sx]; + u8 const data = m_video_ram[(y * 16) + sx]; - for (i = 0; i < 8; i++) - bitmap.pix16(y, (sx * 8) + i) = BIT(data, 7-i); + for (u8 i = 0; i < 8; i++) + bitmap.pix(y, (sx * 8) + i) = BIT(data, 7-i); } } @@ -742,7 +738,7 @@ u32 jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co u8 const b = ~m_color_ram_b[ma + x]; for (int i = 0; i < 8; i++) - bitmap.pix16(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3); + bitmap.pix(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3); } ma+=40; } diff --git a/src/mame/drivers/juku.cpp b/src/mame/drivers/juku.cpp index 0ab5ca60f12..98ac5951af0 100644 --- a/src/mame/drivers/juku.cpp +++ b/src/mame/drivers/juku.cpp @@ -303,7 +303,7 @@ uint32_t juku_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (int y = 0; y < 240; y++) for (int x = 0; x < 320; x++) - bitmap.pix32(y, x) = BIT(m_ram[0xd800 + (y * (320 / 8) + x / 8)], 7 - (x % 8)) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = BIT(m_ram[0xd800 + (y * (320 / 8) + x / 8)], 7 - (x % 8)) ? rgb_t::white() : rgb_t::black(); return 0; } diff --git a/src/mame/drivers/jupace.cpp b/src/mame/drivers/jupace.cpp index 9c1d55bf969..455eef6f8c2 100644 --- a/src/mame/drivers/jupace.cpp +++ b/src/mame/drivers/jupace.cpp @@ -584,21 +584,19 @@ TIMER_DEVICE_CALLBACK_MEMBER(ace_state::clear_irq) uint32_t ace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=56,ma=0,x; - - for (y = 0; y < 24; y++) + uint16_t sy=56, ma=0; + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++, 40); + uint16_t *p = &bitmap.pix(sy++, 40); - for (x = ma; x < ma+32; x++) + for (uint16_t x = ma; x < ma+32; x++) { - chr = m_video_ram[x]; + uint8_t const chr = m_video_ram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + uint8_t const gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/jupiter.cpp b/src/mame/drivers/jupiter.cpp index 9c2692e6ebc..79ca7743019 100644 --- a/src/mame/drivers/jupiter.cpp +++ b/src/mame/drivers/jupiter.cpp @@ -202,21 +202,20 @@ void jupiter3_state::kbd_put(u8 data) uint32_t jupiter3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/k8915.cpp b/src/mame/drivers/k8915.cpp index 8e19debc68e..6f8f4bbd7d7 100644 --- a/src/mame/drivers/k8915.cpp +++ b/src/mame/drivers/k8915.cpp @@ -92,24 +92,23 @@ void k8915_state::machine_start() u32 k8915_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; /* Take care of flashing characters */ if ((chr & 0x80) && (m_framecnt & 0x08)) diff --git a/src/mame/drivers/kdt6.cpp b/src/mame/drivers/kdt6.cpp index abd0ff77dfd..5cb6a5b28cb 100644 --- a/src/mame/drivers/kdt6.cpp +++ b/src/mame/drivers/kdt6.cpp @@ -297,7 +297,7 @@ uint32_t kdt6_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -314,7 +314,7 @@ MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) for (int x = 0; x < 8; x++) { int color = BIT(data, 7 - x); - bitmap.pix32(y, x + i*8) = pen[blink ? 0 : (color ^ inverse)]; + bitmap.pix(y, x + i*8) = pen[blink ? 0 : (color ^ inverse)]; } } else @@ -324,7 +324,7 @@ MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) // draw 8 pixels of the cell for (int x = 0; x < 8; x++) - bitmap.pix32(y, x + i*8) = pen[BIT(data, 7 - x)]; + bitmap.pix(y, x + i*8) = pen[BIT(data, 7 - x)]; } } } diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp index bb9ed493ac3..a27fafc0d88 100644 --- a/src/mame/drivers/kinst.cpp +++ b/src/mame/drivers/kinst.cpp @@ -317,18 +317,18 @@ void kinst_state::machine_reset() uint32_t kinst_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); /* loop over rows and copy to the destination */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *src = &m_video_base[640/4 * y]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t const *src = &m_video_base[640/4 * y]; + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); /* loop over columns */ for (int x = cliprect.min_x; x < cliprect.max_x; x += 2) { - uint32_t data = *src++; + uint32_t const data = *src++; /* store two pixels */ *dest++ = pen[(data >> 0) & 0x7fff]; diff --git a/src/mame/drivers/konamigs.cpp b/src/mame/drivers/konamigs.cpp index 23c307b78ac..a0afaef7075 100644 --- a/src/mame/drivers/konamigs.cpp +++ b/src/mame/drivers/konamigs.cpp @@ -746,7 +746,7 @@ u32 gsan_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const if (!m_bg16bit) col = get_color(col); } - bitmap.pix32(y, x) = pal565(col, 11, 5, 0); + bitmap.pix(y, x) = pal565(col, 11, 5, 0); } } else diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp index 02ce8da8538..a5a4a987c77 100644 --- a/src/mame/drivers/konmedal68k.cpp +++ b/src/mame/drivers/konmedal68k.cpp @@ -152,8 +152,8 @@ void konmedal68k_state::fill_backcolor(bitmap_ind16 &bitmap, const rectangle &cl } else { - uint16_t *dst_ptr = &bitmap.pix16(cliprect.min_y); - int dst_pitch = bitmap.rowpixels(); + uint16_t *dst_ptr = &bitmap.pix(cliprect.min_y); + int const dst_pitch = bitmap.rowpixels(); if ((mode & 0x01) == 0) // vertical gradient fill { @@ -173,7 +173,7 @@ void konmedal68k_state::fill_backcolor(bitmap_ind16 &bitmap, const rectangle &cl { pen_idx += cliprect.min_x; dst_ptr += cliprect.min_x; - for(int y = cliprect.min_y; y<= cliprect.max_y; y++) + for (int y = cliprect.min_y; y<= cliprect.max_y; y++) { for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/kontest.cpp b/src/mame/drivers/kontest.cpp index 921ced6509f..c63d32404f4 100644 --- a/src/mame/drivers/kontest.cpp +++ b/src/mame/drivers/kontest.cpp @@ -106,29 +106,20 @@ void kontest_state::video_start() uint32_t kontest_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { - int x,y; - int xi,yi; - uint16_t tile; - uint8_t attr; - - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - for(x=0;x<64;x++) + for(int x=0;x<64;x++) { - tile = m_ram[(x+y*64)|0x800]; - attr = m_ram[(x+((y >> 1)*64))|0x000] & 7; - tile *= 0x10; - tile += 0x1000; + uint16_t const tile = (m_ram[(x+y*64)|0x800] * 0x10) + 0x1000; + uint8_t const attr = m_ram[(x+((y >> 1)*64))|0x000] & 7; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { uint8_t color,pen[2]; - uint8_t x_step; - int res_x,res_y; - x_step = xi >> 2; + uint8_t const x_step = xi >> 2; pen[0] = m_ram[(x_step+yi*2)|(tile)]; pen[0] >>= 3-((xi & 3)); @@ -140,11 +131,11 @@ uint32_t kontest_state::screen_update( screen_device &screen, bitmap_rgb32 &bitm color = pen[0]; color|= pen[1]<<1; - res_x = x*8+xi-256; - res_y = y*8+yi; + int const res_x = x*8+xi-256; + int const res_y = y*8+yi; if (cliprect.contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = m_palette->pen(color|attr*4); + bitmap.pix(res_y, res_x) = m_palette->pen(color|attr*4); } } } diff --git a/src/mame/drivers/korgds8.cpp b/src/mame/drivers/korgds8.cpp index f6d80b7b8d2..18fedea0b89 100644 --- a/src/mame/drivers/korgds8.cpp +++ b/src/mame/drivers/korgds8.cpp @@ -72,13 +72,13 @@ void korg_ds8_state::machine_start() HD44780_PIXEL_UPDATE(korg_ds8_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 40) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } HD44780_PIXEL_UPDATE(korg_ds8_state::korg707_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } u8 korg_ds8_state::kbd_sw_r() diff --git a/src/mame/drivers/korgdss1.cpp b/src/mame/drivers/korgdss1.cpp index eb6da9b2efe..69b13016ebd 100644 --- a/src/mame/drivers/korgdss1.cpp +++ b/src/mame/drivers/korgdss1.cpp @@ -141,7 +141,7 @@ void korg_dss1_state::machine_reset() HD44780_PIXEL_UPDATE(korg_dss1_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/korgm1.cpp b/src/mame/drivers/korgm1.cpp index c7fdc20825b..62e8d1dc1c0 100644 --- a/src/mame/drivers/korgm1.cpp +++ b/src/mame/drivers/korgm1.cpp @@ -66,7 +66,7 @@ void korgm1_state::video_start() HD44780_PIXEL_UPDATE(korgm1_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 40) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void korgm1_state::pio_pa_w(u8 data) diff --git a/src/mame/drivers/krokha.cpp b/src/mame/drivers/krokha.cpp index 10140b2755c..399f29c69a3 100644 --- a/src/mame/drivers/krokha.cpp +++ b/src/mame/drivers/krokha.cpp @@ -116,22 +116,19 @@ void krokha_state::machine_reset() uint32_t krokha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx; - uint16_t chr, ma = 0, x = 0; - - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - ma = 0xe0 + y; - for (ra = 0; ra < 8; ra++) + uint16_t ma = 0xe0 + y; + for (uint8_t ra = 0; ra < 8; ra++) { - for (x = ma; x < ma + 64*32; x += 32) + for (uint16_t x = ma; x < ma + 64*32; x += 32) { - chr = m_p_videoram[x] << 3; - gfx = m_p_chargen[chr | ra]; + uint16_t chr = m_p_videoram[x] << 3; + uint8_t gfx = m_p_chargen[chr | ra]; for (int i = 0; i < 8; i++) { - bitmap.pix16(y * 8 + ra, (x - ma) / 4 + i) = BIT(gfx, 7 - i); + bitmap.pix(y * 8 + ra, (x - ma) / 4 + i) = BIT(gfx, 7 - i); } } } diff --git a/src/mame/drivers/kron.cpp b/src/mame/drivers/kron.cpp index 34f2804fdf7..bb9cd9dc0d3 100644 --- a/src/mame/drivers/kron.cpp +++ b/src/mame/drivers/kron.cpp @@ -224,30 +224,26 @@ INPUT_PORTS_END /* Video TODO: find and understand the char table within main rom */ uint32_t kron180_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int vramad; - uint8_t *chardata; - uint8_t charcode; - LOGSCREEN("%s()\n", FUNCNAME); - vramad = 0; + int vramad = 0; for (int row = 0; row < 25 * 8; row += 8) { + uint8_t charcode; for (int col = 0; col < 80 * 8; col += 8) { /* look up the character data */ charcode = m_vram[vramad]; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %c at X=%d Y=%d: ", charcode, col, row); - chardata = &m_chargen[(charcode * 8) + 8]; + uint8_t const *chardata = &m_chargen[(charcode * 8) + 8]; /* plot the character */ - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { chardata--; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %02x: ", *chardata); - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; } } vramad += 2; diff --git a/src/mame/drivers/laser3k.cpp b/src/mame/drivers/laser3k.cpp index 3e514ee9e0f..f17caa47a11 100644 --- a/src/mame/drivers/laser3k.cpp +++ b/src/mame/drivers/laser3k.cpp @@ -496,32 +496,28 @@ uint8_t laser3k_state::io2_r(offs_t offset) void laser3k_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; int fg = m_fg_color; int bg = m_bg_color; - const uint8_t *chardata; - uint16_t color; /* look up the character data */ - chardata = &textgfx_data[(code * 8) % textgfx_datalen]; + uint8_t const *const chardata = &textgfx_data[(code * 8) % textgfx_datalen]; if (m_flash && (code >= 0x40) && (code <= 0x7f)) { /* we're flashing; swap */ - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -578,15 +574,6 @@ void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, con void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42] ; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -595,31 +582,32 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -629,14 +617,6 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[82]; - uint16_t v; - uint16_t *p; - uint32_t w; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -645,16 +625,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); if (col < 40) { vram_row[1+(col*2)+0] = vram[offset]; @@ -667,17 +648,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con } } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + uint16_t v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; } } diff --git a/src/mame/drivers/laserbas.cpp b/src/mame/drivers/laserbas.cpp index 10a009326dd..8412283fcac 100644 --- a/src/mame/drivers/laserbas.cpp +++ b/src/mame/drivers/laserbas.cpp @@ -150,8 +150,8 @@ MC6845_UPDATE_ROW( laserbas_state::crtc_update_row ) } int pixaddr = y << 8; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *b = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *const b = &bitmap.pix(y); while (x != x_max) { diff --git a/src/mame/drivers/lastfght.cpp b/src/mame/drivers/lastfght.cpp index 81b4a5a40e3..fd7749a3502 100644 --- a/src/mame/drivers/lastfght.cpp +++ b/src/mame/drivers/lastfght.cpp @@ -165,9 +165,7 @@ uint32_t lastfght_state::screen_update(screen_device &screen, bitmap_ind16 &bitm #ifdef MAME_DEBUG #if 1 // gfx roms viewer (toggle with enter, use pgup/down to browse) - int x, y, count = 0; - uint8_t *gfxdata = memregion("gfx1")->base(); - uint8_t data; + uint8_t const *const gfxdata = memregion("gfx1")->base(); if (machine().input().code_pressed_once(KEYCODE_ENTER)) m_view_roms ^= 1; if (m_view_roms) @@ -176,15 +174,15 @@ uint32_t lastfght_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (machine().input().code_pressed_once(KEYCODE_PGUP)) m_base -= 512 * 256; m_base %= memregion("gfx1")->bytes(); - count = m_base; + int count = m_base; bitmap.fill(m_palette->black_pen(), cliprect ); - for (y = 0 ; y < 256; y++) + for (int y = 0 ; y < 256; y++) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { - data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? m_palette->white_pen() : gfxdata[count]; // white grid or data - bitmap.pix16(y, x) = data; + uint8_t data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? m_palette->white_pen() : gfxdata[count]; // white grid or data + bitmap.pix(y, x) = data; count++; } } @@ -317,7 +315,6 @@ void lastfght_state::blit_w(offs_t offset, uint16_t data, uint16_t mem_mask) { if (ACCESSING_BITS_8_15) { - int x, y, addr; uint8_t *gfxdata = memregion( "gfx1" )->base(); bitmap_ind16 &dest = m_bitmap[m_dest]; @@ -330,18 +327,18 @@ void lastfght_state::blit_w(offs_t offset, uint16_t data, uint16_t mem_mask) data >> 8); #endif - for (y = 0; y <= m_h; y++) + for (int y = 0; y <= m_h; y++) { - for (x = 0; x <= m_w; x++) + for (int x = 0; x <= m_w; x++) { - addr = (((m_sx + m_sx1 + m_dsx * x) >> 6) & 0x1ff) + + int addr = (((m_sx + m_sx1 + m_dsx * x) >> 6) & 0x1ff) + (((m_sy + m_sy1 + m_dsy * y) >> 6) & 0xff) * 0x200 + m_sp * 0x200 * 0x100 + m_sr * 0x200000; data = gfxdata[addr]; if (data && (m_x + x >= 0) && (m_x + x < 512) && (m_y + y >= 0) && (m_y + y < 256)) - dest.pix16(m_y + y, m_x + x) = data; + dest.pix(m_y + y, m_x + x) = data; } } } diff --git a/src/mame/drivers/lbeach.cpp b/src/mame/drivers/lbeach.cpp index a2f77a19d7b..94c44d0f39b 100644 --- a/src/mame/drivers/lbeach.cpp +++ b/src/mame/drivers/lbeach.cpp @@ -189,8 +189,8 @@ u32 lbeach_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con { for (int x = sprite_x; x < (sprite_x + 16) && cliprect.contains(x, y); x++) { - m_collision_bg_car |= (bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1); - m_collision_fg_car |= (fg_bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1); + m_collision_bg_car |= (bitmap.pix(y, x) & m_colmap_car.pix(y, x) & 1); + m_collision_fg_car |= (fg_bitmap.pix(y, x) & m_colmap_car.pix(y, x) & 1); } } diff --git a/src/mame/drivers/lft_craft.cpp b/src/mame/drivers/lft_craft.cpp index 3069c2172f2..6f6ce148570 100644 --- a/src/mame/drivers/lft_craft.cpp +++ b/src/mame/drivers/lft_craft.cpp @@ -174,7 +174,7 @@ uint32_t lft_craft_state::screen_update(screen_device &screen, bitmap_rgb32 &bit const pen_t *pens = m_palette->pens(); for(int y = 0; y < LINES_PER_FRAME; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); uint8_t *src = &m_pixels[y * LINE_CYCLES]; for(int x = 0; x < LINE_CYCLES; x++) { diff --git a/src/mame/drivers/lft_phasor.cpp b/src/mame/drivers/lft_phasor.cpp index 11335ca939b..2f18af496e3 100644 --- a/src/mame/drivers/lft_phasor.cpp +++ b/src/mame/drivers/lft_phasor.cpp @@ -186,7 +186,7 @@ uint32_t lft_phasor_state::screen_update(screen_device &screen, bitmap_rgb32 &bi const pen_t *pens = m_palette->pens(); for(int y = 0; y < 313; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); uint8_t *src = &m_samples[y * 1135]; for(int x = 0; x < 1135; x++) { diff --git a/src/mame/drivers/limenko.cpp b/src/mame/drivers/limenko.cpp index ced23bf5779..1455aaa25f3 100644 --- a/src/mame/drivers/limenko.cpp +++ b/src/mame/drivers/limenko.cpp @@ -375,9 +375,9 @@ void limenko_state::draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &c { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * width; - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &m_sprites_bitmap_pri.pix8(y); + u8 const *const source = source_base + y_index * width; + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &m_sprites_bitmap_pri.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -452,10 +452,10 @@ void limenko_state::copy_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &sprites_bit { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *source = &sprites_bitmap.pix16(y); - u16 *dest = &bitmap.pix16(y); - u8 *dest_pri = &priority_bitmap.pix8(y); - u8 *source_pri = &m_sprites_bitmap_pri.pix8(y); + u16 const *const source = &sprites_bitmap.pix(y); + u16 *const dest = &bitmap.pix(y); + u8 const *const dest_pri = &priority_bitmap.pix(y); + u8 const *const source_pri = &m_sprites_bitmap_pri.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/llc1.cpp b/src/mame/drivers/llc1.cpp index a0117d521d8..29e900f8b1e 100644 --- a/src/mame/drivers/llc1.cpp +++ b/src/mame/drivers/llc1.cpp @@ -237,22 +237,21 @@ void llc1_state::machine_start() u32 llc1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - inv = (m_vram[x] & 0x80) ? 0xff : 0; - chr = m_vram[x] & 0x7f; + u8 const inv = (m_vram[x] & 0x80) ? 0xff : 0; + u8 const chr = m_vram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; + u8 const gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/llc2.cpp b/src/mame/drivers/llc2.cpp index b22de1b0774..cc00f24d67c 100644 --- a/src/mame/drivers/llc2.cpp +++ b/src/mame/drivers/llc2.cpp @@ -166,30 +166,29 @@ void llc2_state::machine_start() u32 llc2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv, inv1=m_rv ? 0xff : 0; - u16 sy=0,ma=0,x; + u8 const inv1 = m_rv ? 0xff : 0; + u16 sy = 0, ma = 0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - inv = 0; - u16 *p = &bitmap.pix16(sy++); + u8 inv = 0; + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - chr = m_vram[x]; + u8 chr = m_vram[x]; if (chr==0x11) // inverse on { inv=0xff; chr=0x0f; // must not show } - else - if (chr==0x10) // inverse off + else if (chr==0x10) // inverse off inv=0; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; + u8 const gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/lola8a.cpp b/src/mame/drivers/lola8a.cpp index f915bed8bfe..3ca470eb116 100644 --- a/src/mame/drivers/lola8a.cpp +++ b/src/mame/drivers/lola8a.cpp @@ -234,16 +234,14 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( lola8a_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 x,gfx; - u16 mem; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); ma &= 0x7ff; - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - mem = (x+ma)*8 + ra; - gfx = m_p_videoram[mem] ^ ((cursor_x == x) ? 0xff : 0); + u16 mem = (x+ma)*8 + ra; + u8 gfx = m_p_videoram[mem] ^ ((cursor_x == x) ? 0xff : 0); *p++ = palette[BIT(gfx, 7) ? 7 : 0]; *p++ = palette[BIT(gfx, 6) ? 7 : 0]; diff --git a/src/mame/drivers/m14.cpp b/src/mame/drivers/m14.cpp index 5a40e118da5..99bedecc74c 100644 --- a/src/mame/drivers/m14.cpp +++ b/src/mame/drivers/m14.cpp @@ -161,33 +161,31 @@ void m14_state::video_start() void m14_state::draw_ball_and_paddle(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int xi,yi; //const rgb_t white_pen = rgb_t::white(); const uint8_t white_pen = 0x1f; const int xoffs = -8; // matches left-right wall bounces const int p_ybase = 184; // matches ball bounce to paddle - int resx,resy; // draw ball - for(xi=0;xi<4;xi++) - for(yi=0;yi<4;yi++) + for(int xi=0;xi<4;xi++) + for(int yi=0;yi<4;yi++) { - resx = flip_screen() ? 32*8-(m_ballx+xi+xoffs) : m_ballx+xi+xoffs; - resy = flip_screen() ? 28*8-(m_bally+yi) : m_bally+yi; + const int resx = flip_screen() ? 32*8-(m_ballx+xi+xoffs) : m_ballx+xi+xoffs; + const int resy = flip_screen() ? 28*8-(m_bally+yi) : m_bally+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_palette->pen(white_pen); + bitmap.pix(resy, resx) = m_palette->pen(white_pen); } // draw paddle - for(xi=0;xi<16;xi++) - for(yi=0;yi<4;yi++) + for(int xi=0;xi<16;xi++) + for(int yi=0;yi<4;yi++) { - resx = flip_screen() ? 32*8-(m_paddlex+xi+xoffs) : (m_paddlex+xi+xoffs); - resy = flip_screen() ? 28*8-(p_ybase+yi) : p_ybase+yi; + const int resx = flip_screen() ? 32*8-(m_paddlex+xi+xoffs) : (m_paddlex+xi+xoffs); + const int resy = flip_screen() ? 28*8-(p_ybase+yi) : p_ybase+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_palette->pen(white_pen); + bitmap.pix(resy, resx) = m_palette->pen(white_pen); } diff --git a/src/mame/drivers/m20.cpp b/src/mame/drivers/m20.cpp index 00c61f10ee6..557c4e684a1 100644 --- a/src/mame/drivers/m20.cpp +++ b/src/mame/drivers/m20.cpp @@ -130,16 +130,15 @@ private: MC6845_UPDATE_ROW( m20_state::update_row ) { - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ((ma | (ra << 1)) << 4) + i; uint16_t data = m_p_videoram[ offset ]; - for ( j = 15; j >= 0; j-- ) + for ( int j = 15; j >= 0; j-- ) { *p = palette[( data & 1 << j ) ? 1 : 0]; p++; diff --git a/src/mame/drivers/m3.cpp b/src/mame/drivers/m3.cpp index e97675a6e50..f40db77c10f 100644 --- a/src/mame/drivers/m3.cpp +++ b/src/mame/drivers/m3.cpp @@ -62,16 +62,14 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( m3_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + uint8_t inv = (x == cursor_x) ? 0xff : 0; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_p_videoram[mem]; if (BIT(chr, 7)) { inv ^= 0xff; @@ -79,7 +77,7 @@ MC6845_UPDATE_ROW( m3_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 6)]; diff --git a/src/mame/drivers/m79152pc.cpp b/src/mame/drivers/m79152pc.cpp index cf041466982..2f05839a30c 100644 --- a/src/mame/drivers/m79152pc.cpp +++ b/src/mame/drivers/m79152pc.cpp @@ -185,10 +185,10 @@ TIMER_CALLBACK_MEMBER(m79152pc_state::hsync_off) void m79152pc_state::screen_draw_line(bitmap_ind16 &bitmap, unsigned y) { - u16 ma = u16(m_line_base) << 4; - u8 ra = m_line_count & 0xf; + const u16 ma = u16(m_line_base) << 4; + const u8 ra = m_line_count & 0xf; - u16 *p = &bitmap.pix16(y++); + u16 *p = &bitmap.pix(y++); for (u16 x = ma; x < ma + 80; x++) { diff --git a/src/mame/drivers/m79amb.cpp b/src/mame/drivers/m79amb.cpp index 7baecaf457e..c855502faa1 100644 --- a/src/mame/drivers/m79amb.cpp +++ b/src/mame/drivers/m79amb.cpp @@ -75,20 +75,16 @@ void m79amb_state::ramtek_videoram_w(offs_t offset, uint8_t data) uint32_t m79amb_state::screen_update_ramtek(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t data = m_videoram[offs]; int y = offs >> 5; int x = (offs & 0x1f) << 3; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; x++; data <<= 1; diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp index a6bdee192d3..d42a91fc82c 100644 --- a/src/mame/drivers/mac128.cpp +++ b/src/mame/drivers/mac128.cpp @@ -938,23 +938,17 @@ void mac128_state::mac_driver_init(mac128model_t model) uint32_t mac128_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint32_t const video_base = m_ram_size - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + uint16_t const *video_ram = (const uint16_t *) (m_ram_ptr + video_base); - video_base = m_ram_size - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const uint16_t *) (m_ram_ptr + video_base); - - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + uint16_t const word = *(video_ram++); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } diff --git a/src/mame/drivers/magicard.cpp b/src/mame/drivers/magicard.cpp index 20a74fe5b1e..eec8a48e058 100644 --- a/src/mame/drivers/magicard.cpp +++ b/src/mame/drivers/magicard.cpp @@ -646,43 +646,40 @@ void magicard_state::video_start() uint32_t magicard_state::screen_update_magicard(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint32_t count; - bitmap.fill(m_palette->black_pen(), cliprect); //TODO if(!(SCC_DE_VREG)) //display enable return 0; - count = ((SCC_VSR_VREG) / 2); + uint32_t count = ((SCC_VSR_VREG) / 2); if(SCC_FG_VREG) //4bpp gfx { - for(y = 0; y < 300; y++) + for(int y = 0; y < 300; y++) { - for(x = 0; x < 84; x++) + for(int x = 0; x < 84; x++) { uint32_t color; color = ((m_magicram[count]) & 0x000f) >> 0; if(cliprect.contains((x * 4) + 3, y)) - bitmap.pix32(y, (x * 4) + 3) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 3) = m_palette->pen(color); color = ((m_magicram[count]) & 0x00f0) >> 4; if(cliprect.contains((x * 4) + 2, y)) - bitmap.pix32(y, (x * 4) + 2) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 2) = m_palette->pen(color); color = ((m_magicram[count]) & 0x0f00) >> 8; if(cliprect.contains((x * 4) + 1, y)) - bitmap.pix32(y, (x * 4) + 1) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 1) = m_palette->pen(color); color = ((m_magicram[count]) & 0xf000) >> 12; if(cliprect.contains((x * 4) + 0, y)) - bitmap.pix32(y, (x * 4) + 0) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 0) = m_palette->pen(color); count++; } @@ -690,21 +687,21 @@ uint32_t magicard_state::screen_update_magicard(screen_device &screen, bitmap_rg } else //8bpp gfx { - for(y = 0; y < 300; y++) + for(int y = 0; y < 300; y++) { - for(x = 0; x < 168; x++) + for(int x = 0; x < 168; x++) { uint32_t color; color = ((m_magicram[count]) & 0x00ff) >> 0; if(cliprect.contains((x * 2) + 1, y)) - bitmap.pix32(y, (x * 2) + 1) = m_palette->pen(color); + bitmap.pix(y, (x * 2) + 1) = m_palette->pen(color); color = ((m_magicram[count]) & 0xff00) >> 8; if(cliprect.contains((x * 2) + 0, y)) - bitmap.pix32(y, (x * 2) + 0) = m_palette->pen(color); + bitmap.pix(y, (x * 2) + 0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/marinedt.cpp b/src/mame/drivers/marinedt.cpp index 79ed6144257..b0a4bdfdb75 100644 --- a/src/mame/drivers/marinedt.cpp +++ b/src/mame/drivers/marinedt.cpp @@ -205,8 +205,8 @@ void marinedt_state::init_seabitmap() if(blue_pen > 0x5f) blue_pen = 0x5f; - m_seabitmap[0]->pix16(y, x) = blue_pen; - m_seabitmap[1]->pix16(y, x) = blue_pen+0x20; + m_seabitmap[0]->pix(y, x) = blue_pen; + m_seabitmap[1]->pix(y, x) = blue_pen+0x20; } } } @@ -360,11 +360,11 @@ inline uint32_t marinedt_state::obj_to_obj_collision() resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix16(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) continue; // return value is never read most likely - if(m_obj[1].bitmap.pix16(resy,resx) != 0) + if(m_obj[1].bitmap.pix(resy,resx) != 0) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); } } @@ -387,14 +387,14 @@ inline uint32_t marinedt_state::obj_to_layer_collision() resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix16(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) continue; if(!m_screen_flip) resy -= 32; // TODO: non screen flip path doesn't work properly - if(m_tilemap->pixmap().pix16(resy,resx) != 0) + if(m_tilemap->pixmap().pix(resy,resx) != 0) { if(m_screen_flip) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); diff --git a/src/mame/drivers/maygayv1.cpp b/src/mame/drivers/maygayv1.cpp index 4459418d0cc..b0f686a348d 100644 --- a/src/mame/drivers/maygayv1.cpp +++ b/src/mame/drivers/maygayv1.cpp @@ -329,7 +329,6 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in uint16_t *atable = &i82716.dram[VREG(ATBA)]; uint16_t *otable = &i82716.dram[VREG(ODTBA) & 0xfc00]; // both must be bank 0 - int sl, sx; int slmask = 0xffff; // TODO: Save if using scanline callbacks int xbound = (VREG(DWBA) & 0x3f8) | 7; @@ -344,13 +343,12 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in } /* For every scanline... */ - for (sl = cliprect.min_x; sl <= cliprect.max_y; ++sl) + for (int sl = cliprect.min_x; sl <= cliprect.max_y; ++sl) { - int obj; uint16_t aflags = atable[sl]; uint16_t slmask_old = slmask; - uint16_t *bmp_ptr = &bitmap.pix16(sl); + uint16_t *bmp_ptr = &bitmap.pix(sl); slmask = 0xffff ^ (slmask ^ aflags); @@ -359,7 +357,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in memset(i82716.line_buf.get(), 0x22, 512); /* Parse the list of 16 objects */ - for (obj = 0; obj < 16; ++obj) + for (int obj = 0; obj < 16; ++obj) { int offs = obj * 4; @@ -367,7 +365,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in if ( !BIT(slmask, obj) ) { uint32_t objbase, trans, width; - int32_t x, xpos; + int32_t xpos; uint16_t w0, w1, w2; uint16_t *objptr; uint8_t *bmpptr; // ? @@ -419,7 +417,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in bmpptr = (uint8_t*)objptr; // 4bpp - for (x = xpos; x < std::min(xbound, int(xpos + width * 8)); ++x) + for (int x = xpos; x < std::min(xbound, int(xpos + width * 8)); ++x) { if (x >= 0) { @@ -441,7 +439,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in } // Write it out - for (sx = cliprect.min_x; sx < cliprect.max_x; sx += 2) + for (int sx = cliprect.min_x; sx < cliprect.max_x; sx += 2) { uint8_t pix = i82716.line_buf[sx / 2]; diff --git a/src/mame/drivers/mbc200.cpp b/src/mame/drivers/mbc200.cpp index 369cb6ee117..64e89698e6b 100644 --- a/src/mame/drivers/mbc200.cpp +++ b/src/mame/drivers/mbc200.cpp @@ -268,15 +268,13 @@ static void mbc200_floppies(device_slot_interface &device) MC6845_UPDATE_ROW( mbc200_state::update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma+x)*4+ra; - gfx = m_vram[mem & 0x7fff]; + u16 mem = (ma+x)*4+ra; + u8 gfx = m_vram[mem & 0x7fff]; *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; diff --git a/src/mame/drivers/mc8020.cpp b/src/mame/drivers/mc8020.cpp index f5fcd33bcee..bcdd4f3c1fc 100644 --- a/src/mame/drivers/mc8020.cpp +++ b/src/mame/drivers/mc8020.cpp @@ -263,20 +263,20 @@ static const uint8_t prom[] = { uint32_t mc8020_state::screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + u16 sy=0,ma=0; - for(y = 0; y < 8; y++ ) + for (u8 y = 0; y < 8; y++ ) { - for (ra = 0; ra < 16; ra++) + for (u8 ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 32; x++) + for (u16 x = ma; x < ma + 32; x++) { + u8 gfx; if (ra > 3 && ra < 12) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; gfx = prom[(chr<<3) | (ra-4)]; } else diff --git a/src/mame/drivers/mc8030.cpp b/src/mame/drivers/mc8030.cpp index a3b35bd5f2d..e8f0abcdfe1 100644 --- a/src/mame/drivers/mc8030.cpp +++ b/src/mame/drivers/mc8030.cpp @@ -145,27 +145,24 @@ uint8_t mc8030_state::asp_port_b_r() uint32_t mc8030_state::screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx; - uint16_t y=0,ma=0,x; + uint16_t ma=0; - for(y = 0; y < 256; y++ ) + for(uint16_t y = 0; y < 256; y++ ) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); + for (uint16_t x = ma; x < ma + 64; x++) { - for (x = ma; x < ma + 64; x++) - { - gfx = m_vram[x^0x3fff]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } + uint8_t const gfx = m_vram[x^0x3fff]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); } ma+=64; } diff --git a/src/mame/drivers/mdt60.cpp b/src/mame/drivers/mdt60.cpp index 63669bbf0f9..45623589d4f 100644 --- a/src/mame/drivers/mdt60.cpp +++ b/src/mame/drivers/mdt60.cpp @@ -108,7 +108,7 @@ TIMER_CALLBACK_MEMBER(mdt60_state::baud_timer) MC6845_UPDATE_ROW(mdt60_state::update_row) { - u32 *pix = &bitmap.pix32(y); + u32 *pix = &bitmap.pix(y); for (unsigned x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/mediagx.cpp b/src/mame/drivers/mediagx.cpp index 353f25ab02d..6e20ffb9e58 100644 --- a/src/mame/drivers/mediagx.cpp +++ b/src/mame/drivers/mediagx.cpp @@ -266,19 +266,17 @@ void mediagx_state::video_start() void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - const pen_t *pens = &m_palette->pen(0); + pen_t const *const pens = &m_palette->pen(0); - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint32_t *p = &bitmap.pix32(j); - for (i=x; i < x+8; i++) + uint32_t *const p = &bitmap.pix(j); + for (int i=x; i < x+8; i++) { - uint8_t pen = dp[index++]; + uint8_t const pen = dp[index++]; if (pen) p[i] = pens[gfx->colorbase() + (att & 0xf)]; else @@ -292,18 +290,16 @@ void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, g void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - int width, height; - int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; + int const line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; - width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1; + int width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1; if (m_disp_ctrl_reg[DC_TIMING_CFG] & 0x8000) // pixel double { width >>= 1; } width += 4; - height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1; + int height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1; if ( (width != m_frame_width || height != m_frame_height) && (width > 1 && height > 1 && width <= 640 && height <= 480) ) @@ -319,19 +315,19 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode { - uint8_t *framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; - uint8_t *pal = m_pal; + uint8_t const *const framebuf = (uint8_t const *)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint8_t const *const pal = m_pal; - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint8_t *si = &framebuf[j * line_delta]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint8_t const *si = &framebuf[j * line_delta]; + for (int i=0; i < m_frame_width; i++) { - int c = *si++; - int r = pal[(c*3)+0] << 2; - int g = pal[(c*3)+1] << 2; - int b = pal[(c*3)+2] << 2; + int const c = *si++; + int const r = pal[(c*3)+0] << 2; + int const g = pal[(c*3)+1] << 2; + int const b = pal[(c*3)+2] << 2; p[i] = r << 16 | g << 8 | b; } @@ -339,21 +335,21 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip } else // 16-bit { - uint16_t *framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint16_t const *const framebuf = (uint16_t const *)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; // RGB 5-6-5 mode if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0) { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { - uint16_t c = *si++; - int r = ((c >> 11) & 0x1f) << 3; - int g = ((c >> 5) & 0x3f) << 2; - int b = (c & 0x1f) << 3; + uint16_t const c = *si++; + int const r = ((c >> 11) & 0x1f) << 3; + int const g = ((c >> 5) & 0x3f) << 2; + int const b = (c & 0x1f) << 3; p[i] = r << 16 | g << 8 | b; } @@ -362,16 +358,16 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip // RGB 5-5-5 mode else { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { - uint16_t c = *si++; - int r = ((c >> 10) & 0x1f) << 3; - int g = ((c >> 5) & 0x1f) << 3; - int b = (c & 0x1f) << 3; + uint16_t const c = *si++; + int const r = ((c >> 10) & 0x1f) << 3; + int const g = ((c >> 5) & 0x1f) << 3; + int const b = (c & 0x1f) << 3; p[i] = r << 16 | g << 8 | b; } diff --git a/src/mame/drivers/megaplay.cpp b/src/mame/drivers/megaplay.cpp index 8b0f4011e38..be3943762bd 100644 --- a/src/mame/drivers/megaplay.cpp +++ b/src/mame/drivers/megaplay.cpp @@ -633,9 +633,9 @@ uint32_t mplay_state::screen_update_megplay(screen_device &screen, bitmap_rgb32 const u32 width = sega315_5124_device::WIDTH - (sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); for (int y = 0; y < 224; y++) { - uint32_t* lineptr = &bitmap.pix32(y); - uint32_t* srcptr = &m_vdp1->get_bitmap().pix32(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); - uint8_t* y1ptr = &m_vdp1->get_y1_bitmap().pix8(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); + uint32_t *const lineptr = &bitmap.pix(y); + uint32_t const *const srcptr = &m_vdp1->get_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); + uint8_t const *const y1ptr = &m_vdp1->get_y1_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); for (int srcx = 0, xx = 0, dstx = 0; srcx < width; dstx++) { diff --git a/src/mame/drivers/megatech.cpp b/src/mame/drivers/megatech.cpp index d13980ffad6..5b1f42d7a66 100644 --- a/src/mame/drivers/megatech.cpp +++ b/src/mame/drivers/megatech.cpp @@ -627,8 +627,8 @@ uint32_t mtech_state::screen_update_main(screen_device &screen, bitmap_rgb32 &bi // when launching megatech + both sms and megadrive games, the following would be needed... for (int y = 0; y < 224; y++) { - uint32_t* lineptr = &bitmap.pix32(y); - uint32_t* srcptr = &m_vdp->get_bitmap().pix32(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT); + uint32_t* lineptr = &bitmap.pix(y); + uint32_t* srcptr = &m_vdp->get_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT); for (int x = 0; x < sega315_5124_device::WIDTH; x++) lineptr[x] = srcptr[x]; diff --git a/src/mame/drivers/meijinsn.cpp b/src/mame/drivers/meijinsn.cpp index 0778c284c18..09fc80ded0a 100644 --- a/src/mame/drivers/meijinsn.cpp +++ b/src/mame/drivers/meijinsn.cpp @@ -324,7 +324,7 @@ uint32_t meijinsn_state::screen_update_meijinsn(screen_device &screen, bitmap_in { color= BIT(data1, x) | (BIT(data1, x + 4) << 1); data = BIT(data2, x) | (BIT(data2, x + 4) << 1); - bitmap.pix16(sy, (sx * 4 + (3 - x))) = color * 4 + data; + bitmap.pix(sy, (sx * 4 + (3 - x))) = color * 4 + data; } } return 0; diff --git a/src/mame/drivers/mekd3.cpp b/src/mame/drivers/mekd3.cpp index aed68ab06ad..29105919019 100644 --- a/src/mame/drivers/mekd3.cpp +++ b/src/mame/drivers/mekd3.cpp @@ -837,31 +837,34 @@ MC6845_UPDATE_ROW(mekd3_state::update_row) uint8_t code = m_video_ram[(ma + column) & 0xfff]; int dcursor = (column == cursor_x); - if (BIT(code, 7)) { - /* Lores 6 pixel character. - ----------- - | D1 | D0 | - | D3 | D2 | - | D5 | D4 | - ----------- - D6 - 1 Grey tone, 0 brightness. - */ - int pixel = ((ra & 0x0c) >> 1) + 1; - int dout = BIT(code, pixel); - int grey = BIT(code, 6); - int color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - pixel--; - dout = BIT(code, pixel); - color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - } else { + if (BIT(code, 7)) + { + /* Lores 6 pixel character. + ----------- + | D1 | D0 | + | D3 | D2 | + | D5 | D4 | + ----------- + D6 - 1 Grey tone, 0 brightness. + */ + int pixel = ((ra & 0x0c) >> 1) + 1; + int dout = BIT(code, pixel); + int grey = BIT(code, 6); + int color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + pixel--; + dout = BIT(code, pixel); + color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + } + else + { offs_t address = ra < 8 ? ((code & 0x7f) << 3) | (ra & 0x07) : 0; uint8_t data = m_p_chargen[address]; @@ -870,7 +873,7 @@ MC6845_UPDATE_ROW(mekd3_state::update_row) int dout = BIT(data, 7); int color = ((dcursor ^ dout) && de) << 1; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/mekd4.cpp b/src/mame/drivers/mekd4.cpp index f03c8e3248f..d8856a11893 100644 --- a/src/mame/drivers/mekd4.cpp +++ b/src/mame/drivers/mekd4.cpp @@ -874,29 +874,29 @@ MC6845_UPDATE_ROW(mekd4_state::update_row) int dcursor = (column == cursor_x); if (BIT(code, 7)) { - /* Lores 6 pixel character. - ----------- - | D1 | D0 | - | D3 | D2 | - | D5 | D4 | - ----------- - D6 - 1 Grey tone, 0 brightness. - */ - int pixel = ((ra & 0x0c) >> 1) + 1; - int dout = BIT(code, pixel); - int grey = BIT(code, 6); - int color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - pixel--; - dout = BIT(code, pixel); - color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; + /* Lores 6 pixel character. + ----------- + | D1 | D0 | + | D3 | D2 | + | D5 | D4 | + ----------- + D6 - 1 Grey tone, 0 brightness. + */ + int pixel = ((ra & 0x0c) >> 1) + 1; + int dout = BIT(code, pixel); + int grey = BIT(code, 6); + int color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + pixel--; + dout = BIT(code, pixel); + color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } else { offs_t address = ra < 8 ? ((code & 0x7f) << 3) | (ra & 0x07) : 0; uint8_t data = m_p_chargen[address]; @@ -906,7 +906,7 @@ MC6845_UPDATE_ROW(mekd4_state::update_row) int dout = BIT(data, 7); int color = ((dcursor ^ dout) && de) << 1; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index f54de1f3f07..ffa8650e791 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -296,28 +296,23 @@ MC6845_BEGIN_UPDATE( merit_state::crtc_begin_update ) MC6845_UPDATE_ROW( merit_state::crtc_update_row ) { - uint8_t *gfx[2]; + uint8_t const *const gfx[2] = { memregion("gfx1")->base(), memregion("gfx2")->base() }; uint16_t x = 0; - int rlen; - gfx[0] = memregion("gfx1")->base(); - gfx[1] = memregion("gfx2")->base(); - rlen = memregion("gfx2")->bytes(); + int const rlen = memregion("gfx2")->bytes(); //ma = ma ^ 0x7ff; for (uint8_t cx = 0; cx < x_count; cx++) { - int i; int attr = m_ram_attr[ma & 0x7ff]; int region = (attr & 0x40) >> 6; int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (m_extra_video_bank_bit)) << 4) | (ra & 0x0f); int colour = (attr & 0x7f) << 3; - uint8_t *data; addr &= (rlen-1); - data = gfx[region]; + uint8_t const *const data = gfx[region]; - for (i = 7; i>=0; i--) + for (int i = 7; i>=0; i--) { int col = colour; @@ -331,7 +326,7 @@ MC6845_UPDATE_ROW( merit_state::crtc_update_row ) col |= 0x03; col = m_ram_palette[col & 0x3ff]; - bitmap.pix32(y, x) = m_pens[col ? col & (NUM_PENS-1) : (m_lscnblk ? 8 : 0)]; + bitmap.pix(y, x) = m_pens[col ? col & (NUM_PENS-1) : (m_lscnblk ? 8 : 0)]; x++; } diff --git a/src/mame/drivers/meritum.cpp b/src/mame/drivers/meritum.cpp index 6be63729eea..c16a2514999 100644 --- a/src/mame/drivers/meritum.cpp +++ b/src/mame/drivers/meritum.cpp @@ -227,12 +227,11 @@ static INPUT_PORTS_START( meritum ) INPUT_PORTS_END u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -/* lores characters are in the character generator. Each character is 6x12 (basic characters are 6x7 excluding descenders/ascenders). */ { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; - u8 cols = m_mode ? 32 : 64; - u8 skip = m_mode ? 2 : 1; + // lores characters are in the character generator. Each character is 6x12 (basic characters are 6x7 excluding descenders/ascenders). + u16 sy=0,ma=0; + const u8 cols = m_mode ? 32 : 64; + const u8 skip = m_mode ? 2 : 1; if (m_mode != m_size_store) { @@ -240,28 +239,28 @@ u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x] & 0xbf; + const u8 chr = m_p_videoram[x] & 0xbf; + u8 gfx; // shift down comma and semicolon // not sure Meritum I got the circuit for this (like TRS80) // but position of ';' suggests most likely yes if ((chr == 0x2c) && (ra >= 2)) gfx = m_p_chargen[0x2be + ra]; - else - if ((chr == 0x3b) && (ra >= 1)) + else if ((chr == 0x3b) && (ra >= 1)) gfx = m_p_chargen[0x3af + ra]; else gfx = m_p_chargen[(chr<<4) | ra]; - /* Display a scanline of a character (6 pixels) */ + // Display a scanline of a character (6 pixels) *p++ = BIT(gfx, 5); *p++ = BIT(gfx, 4); *p++ = BIT(gfx, 3); @@ -277,10 +276,9 @@ u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &b u32 meritum_state::screen_update_meritum2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; - u8 cols = m_mode ? 32 : 64; - u8 skip = m_mode ? 2 : 1; + u16 sy=0,ma=0; + const u8 cols = m_mode ? 32 : 64; + const u8 skip = m_mode ? 2 : 1; if (m_mode != m_size_store) { @@ -288,20 +286,20 @@ u32 meritum_state::screen_update_meritum2(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + const u8 chr = m_p_videoram[x]; - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; + // get pattern of pixels for that character scanline + const u8 gfx = m_p_chargen[(chr<<4) | ra]; - /* Display a scanline of a character (6 pixels) */ + // Display a scanline of a character (6 pixels) *p++ = BIT(gfx, 5); *p++ = BIT(gfx, 4); *p++ = BIT(gfx, 3); @@ -343,7 +341,7 @@ void meritum_state::port_ff_w(u8 data) d1, d0 Cassette output */ static const double levels[4] = { 0.0, 1.0, -1.0, 0.0 }; - static bool init = 0; + static bool init = 0; // FIXME: static variable, breaks hard reset and multiple runs from system selection menu m_cassette->change_state(BIT(data, 2) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); m_cassette->output(levels[data & 3]); diff --git a/src/mame/drivers/mes.cpp b/src/mame/drivers/mes.cpp index 24b69b6866a..de379ba2a96 100644 --- a/src/mame/drivers/mes.cpp +++ b/src/mame/drivers/mes.cpp @@ -99,21 +99,20 @@ void mes_state::machine_reset() Also the screen dimensions are a guess. */ uint32_t mes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/metalmx.cpp b/src/mame/drivers/metalmx.cpp index 4fc9ec4f3a6..e1c5acfb595 100644 --- a/src/mame/drivers/metalmx.cpp +++ b/src/mame/drivers/metalmx.cpp @@ -290,7 +290,7 @@ uint32_t metalmx_state::screen_update_metalmx(screen_device &screen, bitmap_ind1 for (int y = (std::max)(0, cliprect.min_y); y <= (std::min)(383, cliprect.max_y); ++y) { - uint16_t *pix = &bitmap.pix16(y); + uint16_t *pix = &bitmap.pix(y); for (int x = 0; x < 256; x++) { *pix++ = src_base[256 * y + x] & 0xffff; diff --git a/src/mame/drivers/meyc8080.cpp b/src/mame/drivers/meyc8080.cpp index 7b63e7e117f..5ff1731fa36 100644 --- a/src/mame/drivers/meyc8080.cpp +++ b/src/mame/drivers/meyc8080.cpp @@ -113,12 +113,8 @@ private: uint32_t meyc8080_state::screen_update_meyc8080(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram_0.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram_0.bytes(); offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; @@ -132,15 +128,15 @@ uint32_t meyc8080_state::screen_update_meyc8080(screen_device &screen, bitmap_rg uint8_t data_g = (data2 & ~data0) | (data2 & data1) | (~data2 & ~data1 & data0); uint8_t data_b = data0 ^ data1; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x) = rgb_t(pal1bit(data_r >> 7), pal1bit(data_g >> 7), pal1bit(data_b >> 7)); + bitmap.pix(y, x) = rgb_t(pal1bit(data_r >> 7), pal1bit(data_g >> 7), pal1bit(data_b >> 7)); - data_r = data_r << 1; - data_g = data_g << 1; - data_b = data_b << 1; + data_r <<= 1; + data_g <<= 1; + data_b <<= 1; - x = x + 1; + x++; } } diff --git a/src/mame/drivers/meyc8088.cpp b/src/mame/drivers/meyc8088.cpp index 363eaffe16d..653ff3b757b 100644 --- a/src/mame/drivers/meyc8088.cpp +++ b/src/mame/drivers/meyc8088.cpp @@ -163,7 +163,7 @@ uint32_t meyc8088_state::screen_update(screen_device &screen, bitmap_ind16 &bitm v[3] = m_vram[offs|0x4001]; // video4: color prom d3 for (int i = 0; i < 8; i++) - bitmap.pix16(y, x | i) = ((v[0] << i) >> 7 & 1) | ((v[1] << i) >> 6 & 2) | ((v[2] << i) >> 5 & 4) | ((v[3] << i) >> 4 & 8) | v[4]; + bitmap.pix(y, x | i) = ((v[0] << i) >> 7 & 1) | ((v[1] << i) >> 6 & 2) | ((v[2] << i) >> 5 & 4) | ((v[3] << i) >> 4 & 8) | v[4]; } return 0; diff --git a/src/mame/drivers/micral.cpp b/src/mame/drivers/micral.cpp index 12c1c90f2af..692c61480b7 100644 --- a/src/mame/drivers/micral.cpp +++ b/src/mame/drivers/micral.cpp @@ -323,21 +323,20 @@ INPUT_PORTS_END uint32_t micral_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_vram[x+ma]; + uint8_t chr = m_vram[x+ma]; gfx = m_p_chargen[(chr<<4) | ra ]; if (((s_curpos & 0xff)==x) && ((s_curpos >> 8)==y)) gfx ^= 0xff; diff --git a/src/mame/drivers/microb.cpp b/src/mame/drivers/microb.cpp index a7186e48554..4feafb18f93 100644 --- a/src/mame/drivers/microb.cpp +++ b/src/mame/drivers/microb.cpp @@ -285,9 +285,9 @@ I8275_DRAW_CHARACTER_MEMBER(microb_state::draw_character) dots ^= 0xff; // HLGT is active on status line - rgb_t fg = hlgt ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); + rgb_t const fg = hlgt ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); - u32 *pix = &bitmap.pix32(y, x); + u32 *pix = &bitmap.pix(y, x); for (int i = 0; i < 8; i++) { *pix++ = BIT(dots, 7) ? fg : rgb_t::black(); diff --git a/src/mame/drivers/microterm_f8.cpp b/src/mame/drivers/microterm_f8.cpp index 9d476def400..da4d83cd617 100644 --- a/src/mame/drivers/microterm_f8.cpp +++ b/src/mame/drivers/microterm_f8.cpp @@ -162,7 +162,7 @@ u32 microterm_f8_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma bool dot = (!BIT(ch, 8) && allow_underline) || ((BIT(ch, 10) || blink_on) && BIT(chdata, 8 - (x % 9))); if ((BIT(ch, 7) && cursor_on) == BIT(ch, 9)) dot = !dot; - bitmap.pix32(y, x) = dot ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = dot ? rgb_t::white() : rgb_t::black(); } y++; diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index 7957d16279d..324443a5366 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -267,7 +267,7 @@ uint32_t microvision_state::screen_update(screen_device &screen, bitmap_rgb32 &b p = (p > 255) ? 0 : p ^ 255; if (cliprect.contains(x, y)) - bitmap.pix32(y, x) = p << 16 | p << 8 | p; + bitmap.pix(y, x) = p << 16 | p << 8 | p; } } diff --git a/src/mame/drivers/mikro80.cpp b/src/mame/drivers/mikro80.cpp index 5501b6d0536..b49f864e6f6 100644 --- a/src/mame/drivers/mikro80.cpp +++ b/src/mame/drivers/mikro80.cpp @@ -184,7 +184,7 @@ u32 mikro80_state::screen_update_mikro80(screen_device &screen, bitmap_ind16 &bi { for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); for (u16 x = ma; x < ma + 64; x++) { diff --git a/src/mame/drivers/mikrosha.cpp b/src/mame/drivers/mikrosha.cpp index 6660e81c278..8442c3238b3 100644 --- a/src/mame/drivers/mikrosha.cpp +++ b/src/mame/drivers/mikrosha.cpp @@ -190,7 +190,7 @@ I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels) pixels ^= 0xff; for(int i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/mindset.cpp b/src/mame/drivers/mindset.cpp index 279ad92bbf8..d11e5291420 100644 --- a/src/mame/drivers/mindset.cpp +++ b/src/mame/drivers/mindset.cpp @@ -751,12 +751,12 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co if(ibm_mode) { if(large_pixels) { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; for(int field=0; field<2; field++) { for(u32 yy=0; yy<2; yy++) { const u16 *src = bank + 4096*yy; for(u32 y=yy; y<200; y+=2) { - u32 *dest = &bitmap.pix32(2*y+field+dy, dx); + u32 *dest = &bitmap.pix(2*y+field+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -770,12 +770,12 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co } return 0; } else { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; for(int field=0; field<2; field++) { for(u32 yy=0; yy<2; yy++) { const u16 *src = bank + 4096*yy; for(u32 y=yy; y<200; y+=2) { - u32 *dest = &bitmap.pix32(2*y+field+dy, dx); + u32 *dest = &bitmap.pix(2*y+field+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -795,8 +795,8 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 0: { const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=4) { u16 sv = sw(*src++); for(u32 xx=0; xx<4; xx++) { @@ -811,11 +811,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -832,8 +832,8 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 2: { const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -853,7 +853,7 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 0: { const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<320; x+=4) { u16 sv = sw(*src++); for(u32 xx=0; xx<4; xx++) { @@ -866,10 +866,10 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -887,11 +887,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co if(!interleave) { switch(pixels_per_byte_order) { case 0: { - static int palind[4] = { 0, 4, 8, 12 }; + static int const palind[4] = { 0, 4, 8, 12 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<640; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -904,11 +904,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -922,10 +922,10 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co } } } else { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp index 28f52c0aed3..9423a10432d 100644 --- a/src/mame/drivers/miniboy7.cpp +++ b/src/mame/drivers/miniboy7.cpp @@ -320,7 +320,7 @@ int miniboy7_state::get_color_offset(uint8_t tile, uint8_t attr, int ra, int px) MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (uint8_t cx = 0; cx < x_count; cx+=1) { @@ -332,9 +332,9 @@ MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row ) uint8_t color_b = m_proms[offset_b] & 0x0f; if (color_a && (m_gpri || !color_b)) // videoram A has priority - bitmap.pix32(y, (cx << 3) + px) = palette[offset_a]; + bitmap.pix(y, (cx << 3) + px) = palette[offset_a]; else if (color_b && (!m_gpri || !color_a)) // videoram B has priority - bitmap.pix32(y, (cx << 3) + px) = palette[offset_b]; + bitmap.pix(y, (cx << 3) + px) = palette[offset_b]; } } } diff --git a/src/mame/drivers/minivadr.cpp b/src/mame/drivers/minivadr.cpp index 0b0b1bd4c88..329d3c5fa15 100644 --- a/src/mame/drivers/minivadr.cpp +++ b/src/mame/drivers/minivadr.cpp @@ -65,23 +65,19 @@ private: uint32_t minivadr_state::screen_update_minivadr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - int y = offs >> 5; + const int y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data << 1; - x = x + 1; + data <<= 1; + x++; } } diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp index ca2f756d1c4..b4c1d9c0823 100644 --- a/src/mame/drivers/missile.cpp +++ b/src/mame/drivers/missile.cpp @@ -683,24 +683,21 @@ uint8_t missile_state::read_vram(address_space &space, offs_t address) uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; - int x, y; - // draw the bitmap to the screen, looping over Y - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); - int effy = m_flipscreen ? ((256+24 - y) & 0xff) : y; - uint8_t *src = &videoram[effy * 64]; - uint8_t *src3 = nullptr; + int const effy = m_flipscreen ? ((256+24 - y) & 0xff) : y; + uint8_t const *const src = &m_videoram[effy * 64]; + uint8_t const *src3 = nullptr; // compute the base of the 3rd pixel row if (effy >= 224) - src3 = &videoram[get_bit3_addr(effy << 8)]; + src3 = &m_videoram[get_bit3_addr(effy << 8)]; // loop over X - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pix = src[x / 4] >> (x & 3); pix = ((pix >> 2) & 4) | ((pix << 1) & 2); diff --git a/src/mame/drivers/mjsenpu.cpp b/src/mame/drivers/mjsenpu.cpp index f38ca081012..5d3954855ca 100644 --- a/src/mame/drivers/mjsenpu.cpp +++ b/src/mame/drivers/mjsenpu.cpp @@ -407,32 +407,26 @@ void mjsenpu_state::video_start() uint32_t mjsenpu_state::screen_update_mjsenpu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,count; - int color; + uint32_t const *const vram = (m_control & 0x01) ? m_vram0 : m_vram1; - uint32_t* vram; - - if (m_control & 0x01) vram = m_vram0; - else vram = m_vram1; - - - - count = 0; - for (y=0;y < 256;y++) + int count = 0; + for (int y=0;y < 256;y++) { - for (x=0;x < 512/4;x++) + for (int x=0;x < 512/4;x++) { + int color; + color = vram[count] & 0x000000ff; - bitmap.pix16(y, x*4 + 2) = color; + bitmap.pix(y, x*4 + 2) = color; color = (vram[count] & 0x0000ff00) >> 8; - bitmap.pix16(y, x*4 + 3) = color; + bitmap.pix(y, x*4 + 3) = color; color = (vram[count] & 0x00ff0000) >> 16; - bitmap.pix16(y, x*4 + 0) = color; + bitmap.pix(y, x*4 + 0) = color; color = (vram[count] & 0xff000000) >> 24; - bitmap.pix16(y, x*4 + 1) = color; + bitmap.pix(y, x*4 + 1) = color; count++; } diff --git a/src/mame/drivers/mjsister.cpp b/src/mame/drivers/mjsister.cpp index 79ea31be2ae..94f3f27cf69 100644 --- a/src/mame/drivers/mjsister.cpp +++ b/src/mame/drivers/mjsister.cpp @@ -139,8 +139,8 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row ) // background layer uint8_t data_bg = m_vram[0x400 + ((ma << 3) | (ra << 7) | i)]; - bitmap.pix32(y, x1) = pen[m_colorbank << 5 | ((data_bg & 0x0f) >> 0)]; - bitmap.pix32(y, x2) = pen[m_colorbank << 5 | ((data_bg & 0xf0) >> 4)]; + bitmap.pix(y, x1) = pen[m_colorbank << 5 | ((data_bg & 0x0f) >> 0)]; + bitmap.pix(y, x2) = pen[m_colorbank << 5 | ((data_bg & 0xf0) >> 4)]; // foreground layer uint8_t data_fg = m_vram[0x8000 | (0x400 + ((ma << 3) | (ra << 7) | i))]; @@ -149,8 +149,8 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row ) uint8_t c2 = ((data_fg & 0xf0) >> 4); // 0 is transparent - if (c1) bitmap.pix32(y, x1) = pen[m_colorbank << 5 | 0x10 | c1]; - if (c2) bitmap.pix32(y, x2) = pen[m_colorbank << 5 | 0x10 | c2]; + if (c1) bitmap.pix(y, x1) = pen[m_colorbank << 5 | 0x10 | c1]; + if (c2) bitmap.pix(y, x2) = pen[m_colorbank << 5 | 0x10 | c2]; } } diff --git a/src/mame/drivers/ml20.cpp b/src/mame/drivers/ml20.cpp index 413efc7ca99..d31a697b5a0 100644 --- a/src/mame/drivers/ml20.cpp +++ b/src/mame/drivers/ml20.cpp @@ -170,7 +170,7 @@ HD44780_PIXEL_UPDATE( ml20_state::lcd_pixel_update ) return; if (line < 2 && pos < 16) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } // 7654---- unknown (set to input) diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp index ef3b653a06a..1a7734e07c9 100644 --- a/src/mame/drivers/mlanding.cpp +++ b/src/mame/drivers/mlanding.cpp @@ -243,12 +243,12 @@ void mlanding_state::machine_reset() u32 mlanding_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_palette->pens(); + pen_t const *const pens = m_palette->pens(); for (u32 y = cliprect.min_y; y <= cliprect.max_y; ++y) { - u16 *src = &m_g_ram[(112 + y) * 512 + cliprect.min_x]; - u16 *dst = &bitmap.pix16(y, cliprect.min_x); + u16 const *src = &m_g_ram[(112 + y) * 512 + cliprect.min_x]; + u16 *dst = &bitmap.pix(y, cliprect.min_x); for (u32 x = cliprect.min_x; x <= cliprect.max_x; ++x) { diff --git a/src/mame/drivers/mmagic.cpp b/src/mame/drivers/mmagic.cpp index cd17c92e098..ac9eb64d633 100644 --- a/src/mame/drivers/mmagic.cpp +++ b/src/mame/drivers/mmagic.cpp @@ -229,15 +229,15 @@ uint32_t mmagic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap { uint8_t gfx = m_tiles[(code << 4) + tx]; - bitmap.pix32(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black() : m_palette->pen_color(color); - - bitmap.pix32(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black() : m_palette->pen_color(color); + + bitmap.pix(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black() : m_palette->pen_color(color); } } } diff --git a/src/mame/drivers/modellot.cpp b/src/mame/drivers/modellot.cpp index 8e8e710fe06..c33d1bc3460 100644 --- a/src/mame/drivers/modellot.cpp +++ b/src/mame/drivers/modellot.cpp @@ -166,25 +166,25 @@ GFXDECODE_END u32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (u8 ra = 0; ra < 16; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 64; x++) + for (u16 x = 0; x < 64; x++) { - inv = 0; + u8 inv = 0; - chr = m_p_videoram[x+ma]; + u8 chr = m_p_videoram[x+ma]; if (BIT(chr, 7)) inv = 0xff; chr &= 0x7f; // cursor + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra ]; else diff --git a/src/mame/drivers/monty.cpp b/src/mame/drivers/monty.cpp index 835c6119390..b0d096fed3d 100644 --- a/src/mame/drivers/monty.cpp +++ b/src/mame/drivers/monty.cpp @@ -106,7 +106,7 @@ u32 monty_state::screen_update(screen_device& screen, bitmap_rgb32& bitmap, cons // letters with width 5 with space in between them for (int y = 0; y < 32; y++) for (int x = 0; x < 40; x++) - bitmap.pix32(y + 1, x + x/5 + 1) = BIT(m_lcd_data[y], x) ? 0 : 0xffffff; + bitmap.pix(y + 1, x + x/5 + 1) = BIT(m_lcd_data[y], x) ? 0 : 0xffffff; return 0; } diff --git a/src/mame/drivers/monzagp.cpp b/src/mame/drivers/monzagp.cpp index e0af88f679e..5ef342070a1 100644 --- a/src/mame/drivers/monzagp.cpp +++ b/src/mame/drivers/monzagp.cpp @@ -247,9 +247,9 @@ uint32_t monzagp_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } if (cliprect.contains(x * 2, y)) - bitmap.pix16(y, x * 2) = color; + bitmap.pix(y, x * 2) = color; if (cliprect.contains(x * 2 + 1, y)) - bitmap.pix16(y, x * 2 + 1) = color; + bitmap.pix(y, x * 2 + 1) = color; // collisions uint8_t coll_prom_addr = bitswap<8>(tile_idx, 7, 6, 5, 4, 2, 0, 1, 3); diff --git a/src/mame/drivers/mpu4plasma.cpp b/src/mame/drivers/mpu4plasma.cpp index d392a1232f0..5e9e182fb30 100644 --- a/src/mame/drivers/mpu4plasma.cpp +++ b/src/mame/drivers/mpu4plasma.cpp @@ -56,31 +56,23 @@ void mpu4plasma_state::mpu4plasma_map(address_map &map) uint32_t mpu4plasma_state::screen_update_mpu4plasma(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // don't know if this really gets drawn straight from ram.. - int base = 0x1600 / 2; + int const base = 0x1600 / 2; - uint16_t* rambase = m_plasmaram; - uint16_t* dst_bitmap; + uint16_t const *const rambase = m_plasmaram; - int i,y,x,p; - i = 0; + int i = 0; - for (y=0;y<40;y++) + for (int y=0; y<40; y++) { - dst_bitmap = &bitmap.pix16(y); + uint16_t *const dst_bitmap = &bitmap.pix(y); - for (x=0;x<128/16;x++) + for (int x=0; x<128/16; x++) { - uint16_t pix = rambase[base+i]; - - for (p=0;p<16;p++) - { - uint16_t bit = (pix << p)&0x8000; - if (bit) dst_bitmap[x*16 + p] = 1; - else dst_bitmap[x*16 + p] = 0; - } + uint16_t const pix = rambase[base+i]; + for (int p=0; p<16; p++) + dst_bitmap[x*16 + p] = ((pix << p) & 0x8000) ? 1 : 0; i++; - } } diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp index 84cac95b732..cea0f4ea8ad 100644 --- a/src/mame/drivers/mpu4vid.cpp +++ b/src/mame/drivers/mpu4vid.cpp @@ -440,7 +440,7 @@ void mpu4vid_state::mpu4_vram(address_map &map) SCN2674_DRAW_CHARACTER_MEMBER(mpu4vid_state::display_pixels) { - if(!lg) + if (!lg) { uint16_t tile = m_vid_mainram[address & 0x7fff]; const uint8_t *line = m_gfxdecode->gfx(m_gfx_index+0)->get_data(tile & 0xfff); @@ -455,30 +455,29 @@ SCN2674_DRAW_CHARACTER_MEMBER(mpu4vid_state::display_pixels) { // TODO: calculate instead? static const uint8_t lookup[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, - 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, - 0, 0, 2, 2, 4, 4, 6, 6, 0, 0, 2, 2, 4, 4, 6, 6, - 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, - 0, 1, 0, 1, 0, 1, 0, 1, 8, 9, 8, 9, 8, 9, 8, 9, - 0, 0, 2, 2, 0, 0, 2, 2, 8, 8,10,10, 8, 8,10,10, - 0, 1, 2, 3, 0, 1, 2, 3, 8, 9,10,11, 8, 9,10,11, - 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8,12,12,12,12, - 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9,12,13,12,13, - 0, 0, 2, 2, 4, 4, 6, 6, 8, 8,10,10,12,12,14,14, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 - }; - - bitmap.pix32(y, x + i) = m_palette->pen(lookup[(extra << 4) | (pen & 0xf)]); + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, + 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, + 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, + 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, + 0, 0, 2, 2, 4, 4, 6, 6, 0, 0, 2, 2, 4, 4, 6, 6, + 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 1, 0, 1, 0, 1, 0, 1, 8, 9, 8, 9, 8, 9, 8, 9, + 0, 0, 2, 2, 0, 0, 2, 2, 8, 8,10,10, 8, 8,10,10, + 0, 1, 2, 3, 0, 1, 2, 3, 8, 9,10,11, 8, 9,10,11, + 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8,12,12,12,12, + 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9,12,13,12,13, + 0, 0, 2, 2, 4, 4, 6, 6, 8, 8,10,10,12,12,14,14, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 + }; + + bitmap.pix(y, x + i) = m_palette->pen(lookup[(extra << 4) | (pen & 0xf)]); } else { - bitmap.pix32(y, x + i) = m_palette->pen((extra<<4) | (pen & 0xf)); - + bitmap.pix(y, x + i) = m_palette->pen((extra<<4) | (pen & 0xf)); } } } diff --git a/src/mame/drivers/ms0515.cpp b/src/mame/drivers/ms0515.cpp index 33f2e059fb2..5adf16996ad 100644 --- a/src/mame/drivers/ms0515.cpp +++ b/src/mame/drivers/ms0515.cpp @@ -384,34 +384,33 @@ static void ms0515_floppies(device_slot_interface &device) uint32_t ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b; int addr = 0; if (BIT(m_sysregc, 3)) { uint8_t fg = m_sysregc & 7; uint8_t bg = fg ^ 7; - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { uint16_t code = (m_video_ram[addr++] << 8); - code += m_video_ram[addr++]; - for (b = 0; b < 16; b++) + code |= m_video_ram[addr++]; + for (int b = 0; b < 16; b++) { // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (15 - b)) & 0x01) ? bg : fg; + bitmap.pix(y, horpos++) = ((code >> (15 - b)) & 0x01) ? bg : fg; } } } } else { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { uint8_t code = m_video_ram[addr++]; uint8_t attr = m_video_ram[addr++]; @@ -424,11 +423,11 @@ uint32_t ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 bg = tmp; m_blink = -1; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; } } } diff --git a/src/mame/drivers/ms6102.cpp b/src/mame/drivers/ms6102.cpp index 6c52ac9c06d..5280a203381 100644 --- a/src/mame/drivers/ms6102.cpp +++ b/src/mame/drivers/ms6102.cpp @@ -183,7 +183,7 @@ u8 ms6102_state::memory_read_byte(offs_t offset) I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = (lten) ? 0xff : 0; if (!vsp) gfx = m_p_chargen[linecount | (charcode << 4)]; @@ -192,7 +192,7 @@ I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_pixels) gfx ^= 0xff; for(u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_attr) // TODO: attributes diff --git a/src/mame/drivers/mstation.cpp b/src/mame/drivers/mstation.cpp index 517300b2ee5..c96c359ca65 100644 --- a/src/mame/drivers/mstation.cpp +++ b/src/mame/drivers/mstation.cpp @@ -155,7 +155,7 @@ uint32_t mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // columns are inverted (right to left) int col = ((x < 20) ? 19 : 59) - x; - bitmap.pix16(y, col*8 + b)= BIT(data, 0); + bitmap.pix(y, col*8 + b)= BIT(data, 0); data >>= 1; } } @@ -164,7 +164,7 @@ uint32_t mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitm //*************************************************************************** // Bankswitch -//***************************************************************************/ +//*************************************************************************** uint8_t mstation_state::bank1_r(offs_t offset) { diff --git a/src/mame/drivers/mtd1256.cpp b/src/mame/drivers/mtd1256.cpp index fdc73e30185..0c05033a071 100644 --- a/src/mame/drivers/mtd1256.cpp +++ b/src/mame/drivers/mtd1256.cpp @@ -63,9 +63,9 @@ HD44780_PIXEL_UPDATE(mtd1256_state::pixel_update) { // Is this the right layout? if (pos < 20) - bitmap.pix16(line * 16 + y, pos * 6 + x) = state; + bitmap.pix(line * 16 + y, pos * 6 + x) = state; else if (pos < 40) - bitmap.pix16(line * 16 + 8 + y, (pos - 20) * 6 + x) = state; + bitmap.pix(line * 16 + 8 + y, (pos - 20) * 6 + x) = state; } diff --git a/src/mame/drivers/multi16.cpp b/src/mame/drivers/multi16.cpp index 818a137d7cf..48ead99c97d 100644 --- a/src/mame/drivers/multi16.cpp +++ b/src/mame/drivers/multi16.cpp @@ -82,7 +82,7 @@ private: MC6845_UPDATE_ROW(multi16_state::crtc_update_row) { - uint8_t *vram = reinterpret_cast<uint8_t *>(m_vram.target()); + uint8_t const *const vram = reinterpret_cast<uint8_t *>(m_vram.target()); for (int i = 0; i < x_count; i++) { @@ -101,7 +101,7 @@ MC6845_UPDATE_ROW(multi16_state::crtc_update_row) color |= BIT(data_g, 7 - x) << 1; color |= BIT(data_b, 7 - x) << 2; - bitmap.pix32(y, x + i * 8) = m_palette->pens()[color]; + bitmap.pix(y, x + i * 8) = m_palette->pens()[color]; } } } diff --git a/src/mame/drivers/multi8.cpp b/src/mame/drivers/multi8.cpp index 05609efb6ec..819ddc3de4f 100644 --- a/src/mame/drivers/multi8.cpp +++ b/src/mame/drivers/multi8.cpp @@ -115,14 +115,13 @@ void multi8_state::video_start() MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t i,chr,gfx=0,color,pen,attr; - uint16_t mem = y*80,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u16 mem = y*80; + u32 *p = &bitmap.pix(y); - for(x = 0; x < x_count; x++) + for(u16 x = 0; x < x_count; x++) { - for(i = 0; i < 8; i++) + for(u8 i = 0; i < 8; i++) { u8 pen_b = BIT(m_p_vram[mem | 0x0000], 7-i); u8 pen_r = BIT(m_p_vram[mem | 0x4000], 7-i); @@ -143,18 +142,18 @@ MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) mem++; } - u8 x_width = BIT(m_display_reg, 6) ? 80 : 40; - u8 x_step = BIT(m_display_reg, 6) ? 1 : 2; + const u8 x_width = BIT(m_display_reg, 6) ? 80 : 40; + const u8 x_step = BIT(m_display_reg, 6) ? 1 : 2; mem = 0xc000 + ma; - p = &bitmap.pix32(y); + p = &bitmap.pix(y); - for(x = 0; x < x_width; x++) + for(u16 x = 0; x < x_width; x++) { - chr = m_p_vram[mem]; - attr = m_p_vram[mem | 0x800]; - color = (BIT(m_display_reg, 7)) ? 7 : (attr & 0x07); + const u8 chr = m_p_vram[mem]; + const u8 attr = m_p_vram[mem | 0x800]; + const u8 color = (BIT(m_display_reg, 7)) ? 7 : (attr & 0x07); - gfx = BIT(attr, 5); + u8 gfx = BIT(attr, 5); if (cursor_x >= 0) gfx ^= (x == (cursor_x / x_step)); @@ -165,9 +164,9 @@ MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) if (ra < 8) gfx ^= m_p_chargen[(chr << 3) | ra]; - for(i = 0; i < 8; i++) + for(u8 i = 0; i < 8; i++) { - pen = BIT(gfx, 7-i) ? color : 0; + u8 pen = BIT(gfx, 7-i) ? color : 0; if (x_step == 1) { diff --git a/src/mame/drivers/mx2178.cpp b/src/mame/drivers/mx2178.cpp index ef2d7160509..36950bf3ee5 100644 --- a/src/mame/drivers/mx2178.cpp +++ b/src/mame/drivers/mx2178.cpp @@ -84,18 +84,16 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( mx2178_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_p_videoram[mem]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7)]; diff --git a/src/mame/drivers/myb3k.cpp b/src/mame/drivers/myb3k.cpp index 720357451c9..ebfe5b95628 100644 --- a/src/mame/drivers/myb3k.cpp +++ b/src/mame/drivers/myb3k.cpp @@ -305,7 +305,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) { for (int pxl = 0; pxl < 8; pxl++) { - bitmap.pix32(y, ( x_pos * 8) + pxl) = rgb_t::black(); + bitmap.pix(y, ( x_pos * 8) + pxl) = rgb_t::black(); } } else @@ -332,7 +332,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) //pind ^= ((cursor_x != -1 && x_pos == cursor_x && ra == 7) ? 7 : 0); /* Create the grey scale */ - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; } } break; @@ -372,7 +372,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) pind ^= ((cursor_x != -1 && x_pos == cursor_x && ra == 7) ? 7 : 0); /* Pick up the color */ - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; } } break; @@ -394,11 +394,11 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) { if ((pdat & (0x80 >> pxl)) != 0) { - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[0x07]; } else { - bitmap.pix32(y, ( x_pos * 8) + pxl) = rgb_t::black(); + bitmap.pix(y, ( x_pos * 8) + pxl) = rgb_t::black(); } } } diff --git a/src/mame/drivers/mycom.cpp b/src/mame/drivers/mycom.cpp index cd6f3f66ecb..a7fdd4f6403 100644 --- a/src/mame/drivers/mycom.cpp +++ b/src/mame/drivers/mycom.cpp @@ -148,20 +148,17 @@ private: MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx=0,z; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); if (m_port0a & 0x40) { - for (x = 0; x < x_count; x++) // lores pixels + for (u16 x = 0; x < x_count; x++) // lores pixels { - u8 dbit=1; - if (x == cursor_x) dbit=0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - z = ra / 3; + u8 dbit = (x == cursor_x) ? 0 : 1; + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 z = ra / 3; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; @@ -175,16 +172,16 @@ MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) } else { - for (x = 0; x < x_count; x++) // text + for (u16 x = 0; x < x_count; x++) // text { - u8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0x7ff; + u8 inv = (x == cursor_x) ? 0xff : 0; + u16 mem = (ma + x) & 0x7ff; + u8 gfx; if (ra > 7) gfx = inv; // some blank spacing lines else { - chr = m_vram[mem]; + u8 chr = m_vram[mem]; gfx = m_p_chargen[(chr<<3) | ra] ^ inv; } diff --git a/src/mame/drivers/mz2000.cpp b/src/mame/drivers/mz2000.cpp index 36331ccade5..f227ea79c00 100644 --- a/src/mame/drivers/mz2000.cpp +++ b/src/mame/drivers/mz2000.cpp @@ -183,8 +183,8 @@ uint32_t mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 pen |= ((gvram[count+0xc000] >> (xi)) & 1) ? 4 : 0; //G pen &= m_gvram_mask; - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen); + bitmap.pix(y*2+0, x+xi) = m_palette->pen(pen); + bitmap.pix(y*2+1, x+xi) = m_palette->pen(pen); } count++; } @@ -224,27 +224,27 @@ uint32_t mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 { if(m_width80 == 0) { - bitmap.pix16(res_y, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y, res_x*2+1) = m_palette->pen(pen); } else { - bitmap.pix16(res_y, res_x) = m_palette->pen(pen); + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } else { if(m_width80 == 0) { - bitmap.pix16(res_y*2+0, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+0, res_x*2+1) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x*2+1) = m_palette->pen(pen); } else { - bitmap.pix16(res_y*2+0, res_x) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/mz2500.cpp b/src/mame/drivers/mz2500.cpp index b5f430f7474..055fc956233 100644 --- a/src/mame/drivers/mz2500.cpp +++ b/src/mame/drivers/mz2500.cpp @@ -72,23 +72,23 @@ void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,uint16_t { if(width && height) { - bitmap.pix16(y*2+0, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+0, x*2+1) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+1) = m_palette->pen(pen); + bitmap.pix(y*2+0, x*2+0) = m_palette->pen(pen); + bitmap.pix(y*2+0, x*2+1) = m_palette->pen(pen); + bitmap.pix(y*2+1, x*2+0) = m_palette->pen(pen); + bitmap.pix(y*2+1, x*2+1) = m_palette->pen(pen); } else if(width) { - bitmap.pix16(y, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y, x*2+1) = m_palette->pen(pen); + bitmap.pix(y, x*2+0) = m_palette->pen(pen); + bitmap.pix(y, x*2+1) = m_palette->pen(pen); } else if(height) { - bitmap.pix16(y*2+0, x) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x) = m_palette->pen(pen); + bitmap.pix(y*2+0, x) = m_palette->pen(pen); + bitmap.pix(y*2+1, x) = m_palette->pen(pen); } else - bitmap.pix16(y, x) = m_palette->pen(pen); + bitmap.pix(y, x) = m_palette->pen(pen); } void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,uint16_t map_addr) diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp index 0b9b537c340..d9689c2afa1 100644 --- a/src/mame/drivers/mz3500.cpp +++ b/src/mame/drivers/mz3500.cpp @@ -167,39 +167,29 @@ UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile; - int attr; - uint8_t tile_data; - uint8_t width80; - uint8_t char_size; - uint8_t hires; - uint8_t color_mode; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // popmessage("%02x",m_crtc[6]); - color_mode = m_crtc[4] & 1; - width80 = (m_crtc[5] & 2) >> 1; - hires = (m_crtc[6] & 1); - char_size = (hires) ? 16 : 8; + uint8_t color_mode = m_crtc[4] & 1; + uint8_t width80 = (m_crtc[5] & 2) >> 1; + uint8_t hires = (m_crtc[6] & 1); + uint8_t char_size = (hires) ? 16 : 8; - for( x = 0; x < pitch; x++ ) + for( int x = 0; x < pitch; x++ ) { - tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); - attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); + int tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); + int attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); //if(hires) // tile <<= 1; - for( yi = 0; yi < lr; yi++) + for( int yi = 0; yi < lr; yi++) { - tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; + uint8_t tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; - for( xi = 0; xi < 8; xi++) + for( int xi = 0; xi < 8; xi++) { - int res_x,res_y; int pen; if(yi >= char_size) @@ -227,18 +217,18 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) } } - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(pen != -1) { if(!width80) { - bitmap.pix32(res_y, res_x*2+0) = palette[pen]; - bitmap.pix32(res_y, res_x*2+1) = palette[pen]; + bitmap.pix(res_y, res_x*2+0) = palette[pen]; + bitmap.pix(res_y, res_x*2+1) = palette[pen]; } else - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/mz6500.cpp b/src/mame/drivers/mz6500.cpp index 76ba97cf42a..464cb888dd3 100644 --- a/src/mame/drivers/mz6500.cpp +++ b/src/mame/drivers/mz6500.cpp @@ -50,19 +50,14 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int gfx[3]; - u8 i,pen; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + int const gfx[3] = { m_vram[(address + 0x00000) >> 1], m_vram[(address + 0x10000) >> 1], m_vram[(address + 0x20000) >> 1] }; - gfx[0] = m_vram[(address + 0x00000) >> 1]; - gfx[1] = m_vram[(address + 0x10000) >> 1]; - gfx[2] = m_vram[(address + 0x20000) >> 1]; - - for(i=0; i<16; i++) + for(u8 i=0; i<16; i++) { - pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); + u8 pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); - bitmap.pix32(y, x + i) = palette[pen]; + bitmap.pix(y, x + i) = palette[pen]; } } diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp index a033f08bb83..8551fc700c6 100644 --- a/src/mame/drivers/nakajies.cpp +++ b/src/mame/drivers/nakajies.cpp @@ -685,7 +685,7 @@ uint32_t nakajies_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int px=0; px<8; px++) { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + bitmap.pix(y, (x * 8) + px) = BIT(data, 7); data <<= 1; } } diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index ee8177e023d..359c646a822 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -433,20 +433,19 @@ uint16_t namcos21_state::winrun_gpu_videoram_r(offs_t offset) void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_gpu_videoram.get(); + uint8_t const *const videoram = m_gpu_videoram.get(); //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.top(),cliprect.bottom(),m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]); - int yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; - int xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; - int base = 0x1000+0x100*(m_winrun_color&0xf); - int sx,sy; - for( sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) + int const yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; + int const xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; + int const base = 0x1000+0x100*(m_winrun_color&0xf); + for( int sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) { - const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; - uint16_t *pDest = &bitmap.pix16(sy); - for( sx=cliprect.left(); sx<=cliprect.right(); sx++ ) + uint8_t const *const pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; + uint16_t *const pDest = &bitmap.pix(sy); + for( int sx=cliprect.left(); sx<=cliprect.right(); sx++ ) { - int pen = pSource[(sx+xscroll) & 0x1ff]; + int const pen = pSource[(sx+xscroll) & 0x1ff]; switch( pen ) { case 0xff: diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index ca4b2eda839..12d30f9fe01 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -2060,16 +2060,16 @@ void namcos23_renderer::render_scanline(int32_t scanline, const extent_t& extent float u = extent.param[1].start; float v = extent.param[2].start; float l = extent.param[3].start; - float dw = extent.param[0].dpdx; - float du = extent.param[1].dpdx; - float dv = extent.param[2].dpdx; - float dl = extent.param[3].dpdx; + const float dw = extent.param[0].dpdx; + const float du = extent.param[1].dpdx; + const float dv = extent.param[2].dpdx; + const float dl = extent.param[3].dpdx; - uint32_t *img = &object.bitmap->pix32(scanline, extent.startx); + uint32_t *img = &object.bitmap->pix(scanline, extent.startx); for(int x = extent.startx; x < extent.stopx; x++) { - float z = w ? 1/w : 0; - uint32_t pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z); + const float z = w ? 1/w : 0; + const uint32_t pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z); float ll = l*z; *img = (light(pcol >> 16, ll) << 16) | (light(pcol >> 8, ll) << 8) | light(pcol, ll); diff --git a/src/mame/drivers/nanos.cpp b/src/mame/drivers/nanos.cpp index 792a3cc7053..1adfc64ad2f 100644 --- a/src/mame/drivers/nanos.cpp +++ b/src/mame/drivers/nanos.cpp @@ -264,8 +264,7 @@ INPUT_PORTS_END uint32_t nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // static uint8_t framecnt=0; - uint8_t gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; // framecnt++; @@ -273,13 +272,14 @@ uint32_t nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { + uint8_t gfx; if (ra < 8) { - uint8_t chr = m_vram[x]; + uint8_t const chr = m_vram[x]; /* get pattern of pixels for that character scanline */ gfx = m_p_chargen[(chr<<3) | ra ]; diff --git a/src/mame/drivers/ncd68k.cpp b/src/mame/drivers/ncd68k.cpp index ecfeca15ddf..566ebcea5d0 100644 --- a/src/mame/drivers/ncd68k.cpp +++ b/src/mame/drivers/ncd68k.cpp @@ -210,7 +210,7 @@ u32 ncd16_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect { for (unsigned y = 0; y < 1024; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1024 / 8; x++) { u8 const pixels = m_vram->read(BYTE_XOR_BE(y * (1024 / 8) + x)); @@ -227,7 +227,7 @@ u32 ncd17c_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rec { for (unsigned y = 0; y < 768; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1024; x++) { u8 const pixels = m_vram->read((y * 1024) + BYTE4_XOR_BE(x)); @@ -242,7 +242,7 @@ u32 ncd19_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect { for (unsigned y = 0; y < 1024; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1280/8; x++) { u8 const pixels = m_vram->read((y * (2048/8)) + BYTE4_XOR_BE(x)); diff --git a/src/mame/drivers/nexus3d.cpp b/src/mame/drivers/nexus3d.cpp index a0bfc095328..81c218bb886 100644 --- a/src/mame/drivers/nexus3d.cpp +++ b/src/mame/drivers/nexus3d.cpp @@ -97,14 +97,14 @@ void nexus3d_state::video_start() uint32_t nexus3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *fbram = reinterpret_cast<uint16_t *>(m_fbram.target()); - const int width = 640; + uint16_t const *const fbram = reinterpret_cast<uint16_t *>(m_fbram.target()); + int const width = 640; - uint16_t *visible = fbram + (m_screen->frame_number() & 1) * (0x96000/2); + uint16_t const *const visible = fbram + (m_screen->frame_number() & 1) * (0x96000/2); uint32_t const dx = cliprect.left(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) - std::copy_n(&visible[(y * width) + dx], width, &bitmap.pix16(y, dx)); + std::copy_n(&visible[(y * width) + dx], width, &bitmap.pix(y, dx)); return 0; } diff --git a/src/mame/drivers/ngen.cpp b/src/mame/drivers/ngen.cpp index de4ee86a914..e0a18155ead 100644 --- a/src/mame/drivers/ngen.cpp +++ b/src/mame/drivers/ngen.cpp @@ -768,9 +768,9 @@ MC6845_UPDATE_ROW( ngen_state::crtc_update_row ) for(int z=0;z<9;z++) { if(BIT(m_fontram.read16(ch*16+ra),8-z)) - bitmap.pix32(y,x+z) = rgb_t(0,0xff,0); + bitmap.pix(y,x+z) = rgb_t(0,0xff,0); else - bitmap.pix32(y,x+z) = rgb_t(0,0,0); + bitmap.pix(y,x+z) = rgb_t(0,0,0); } } } diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 99b2428e3f1..8acac8fd461 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -175,14 +175,12 @@ void nightgal_state::video_start() uint32_t nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); - uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); + uint16_t *dst = &m_tmp_bitmap->pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint32_t srcpix = *src++; *dst++ = m_palette->pen((srcpix & 0xf) | m_pal_bank); diff --git a/src/mame/drivers/nightmare.cpp b/src/mame/drivers/nightmare.cpp index 5ea1c4ac209..5dda8921429 100644 --- a/src/mame/drivers/nightmare.cpp +++ b/src/mame/drivers/nightmare.cpp @@ -369,9 +369,9 @@ uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_ // combine two buffers (additive?) for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *const bitmap1 = &m_vdc2->get_bitmap().pix32(y); - uint32_t *const bitmap2 = &m_vdc->get_bitmap().pix32(y); - uint32_t *dst = &bitmap.pix32(y); + uint32_t const *const bitmap1 = &m_vdc2->get_bitmap().pix(y); + uint32_t const *const bitmap2 = &m_vdc->get_bitmap().pix(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -379,9 +379,9 @@ uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_ uint32_t p2 = bitmap2[x]; uint32_t result = 0; - for(int shift=0; shift<32;shift+=8) + for (int shift=0; shift<32;shift+=8) { - uint32_t data = ((p2>>shift)&0xff)+((p1>>shift)&0xff); + uint32_t const data = ((p2>>shift)&0xff)+((p1>>shift)&0xff); result|=((data>0xff)?0xff:data)<<shift; } dst[x]=result; diff --git a/src/mame/drivers/nmg5.cpp b/src/mame/drivers/nmg5.cpp index a657a5641b8..c887aaa54f1 100644 --- a/src/mame/drivers/nmg5.cpp +++ b/src/mame/drivers/nmg5.cpp @@ -315,7 +315,7 @@ uint8_t nmg5_state::pixmap_r(offs_t offset) int const sy = offset >> 8; int const sx = (offset & 0xff) << 1; - return ((m_pixmap->pix16(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix16(sy & 0xff, sx | 1) & 0xf); + return ((m_pixmap->pix(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix(sy & 0xff, sx | 1) & 0xf); } void nmg5_state::pixmap_w(offs_t offset, uint8_t data) @@ -323,8 +323,8 @@ void nmg5_state::pixmap_w(offs_t offset, uint8_t data) int const sy = offset >> 8; int const sx = (offset & 0xff) << 1; - m_pixmap->pix16(sy & 0xff, sx & ~1) = 0x300 + ((data & 0xf0) >> 4); - m_pixmap->pix16(sy & 0xff, sx | 1) = 0x300 + (data & 0x0f); + m_pixmap->pix(sy & 0xff, sx & ~1) = 0x300 + ((data & 0xf0) >> 4); + m_pixmap->pix(sy & 0xff, sx | 1) = 0x300 + (data & 0x0f); } template<int Layer> diff --git a/src/mame/drivers/nokia_3310.cpp b/src/mame/drivers/nokia_3310.cpp index 352513d8cc2..0007ecba6ed 100644 --- a/src/mame/drivers/nokia_3310.cpp +++ b/src/mame/drivers/nokia_3310.cpp @@ -422,7 +422,7 @@ PCD8544_SCREEN_UPDATE(noki3310_state::pcd8544_screen_update) for (int y = 0; y < 8; y++) { int p = BIT(gfx, y); - bitmap.pix16(r*8 + y, x) = p ^ inv; + bitmap.pix(r*8 + y, x) = p ^ inv; } } } diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 89b2ed4e811..abf39db27fb 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -282,28 +282,23 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit { // have to figure out what resolution we're drawing to here and draw appropriately to screen // code borrowed/stolen from video/mac.cpp - uint32_t video_base; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = (m_DispAddr << 3)&0x1FFFF; + uint32_t const video_base = (m_DispAddr << 3) & 0x1ffff; #ifdef DEBUG_VIDEO logerror("Video Base = 0x%05x\n", video_base); #endif - const uint16_t *video_ram_field1 = &m_mainram[video_base/2]; - const uint16_t *video_ram_field2 = &m_mainram[(video_base+0x4B00)/2]; + uint16_t const *video_ram_field1 = &m_mainram[video_base / 2]; + uint16_t const *video_ram_field2 = &m_mainram[(video_base + 0x4b00) / 2]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - if ((y&1)==0) word = *(video_ram_field1++); else word = *(video_ram_field2++); - for (b = 0; b < 16; b++) + uint16_t const word = *((y & 1) ? video_ram_field2 : video_ram_field1)++; + for (int b = 0; b < 16; b++) { - line[x + b] = (word >> (15 - b)) & 0x0001; + line[x + b] = BIT(word, 15 - b); } } } @@ -312,15 +307,15 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit void notetaker_state::IPConReg_w(uint16_t data) { - m_BootSeqDone = (data&0x80)?1:0; - m_ProcLock = (data&0x40)?1:0; // bus lock for this processor (hold other processor in wait state) - m_CharCtr = (data&0x20)?1:0; // battery charge control (incorrectly called 'Char counter' in source code) - m_DisableROM = (data&0x10)?1:0; // disable rom at 0000-0fff - m_CorrOn_q = (data&0x08)?1:0; // CorrectionOn (ECC correction enabled); also LedInd5 - m_LedInd6 = (data&0x04)?1:0; - m_LedInd7 = (data&0x02)?1:0; - m_LedInd8 = (data&0x01)?1:0; - popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", (data&0x04)>>2, (data&0x08)>>3, (data&0x02)>>1, (data&0x01)); // cr1 and 2 are in the reverse order as expected, according to the schematic + m_BootSeqDone = BIT(data, 7); + m_ProcLock = BIT(data, 6); // bus lock for this processor (hold other processor in wait state) + m_CharCtr = BIT(data, 5); // battery charge control (incorrectly called 'Char counter' in source code) + m_DisableROM = BIT(data, 4); // disable rom at 0000-0fff + m_CorrOn_q = BIT(data, 3); // CorrectionOn (ECC correction enabled); also LedInd5 + m_LedInd6 = BIT(data, 2); + m_LedInd7 = BIT(data, 1); + m_LedInd8 = BIT(data, 0); + popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", BIT(data, 2), BIT(data, 3), BIT(data, 1), BIT(data, 0)); // cr1 and 2 are in the reverse order as expected, according to the schematic } /* handlers for the two system hd6402s (ay-5-1013 equivalent) */ diff --git a/src/mame/drivers/novag_diablo.cpp b/src/mame/drivers/novag_diablo.cpp index 0c464c6ee2f..2f39f863df3 100644 --- a/src/mame/drivers/novag_diablo.cpp +++ b/src/mame/drivers/novag_diablo.cpp @@ -142,7 +142,7 @@ HD44780_PIXEL_UPDATE(diablo_state::lcd_pixel_update) if (line < 2 && pos < 8) { // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/novag_sexpert.cpp b/src/mame/drivers/novag_sexpert.cpp index c4eb02fd318..a983ba9567f 100644 --- a/src/mame/drivers/novag_sexpert.cpp +++ b/src/mame/drivers/novag_sexpert.cpp @@ -217,7 +217,7 @@ HD44780_PIXEL_UPDATE(sexpert_state::lcd_pixel_update) if (line < 2 && pos < 8) { // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/nyny.cpp b/src/mame/drivers/nyny.cpp index 4f86a5a9cb1..957e26e405b 100644 --- a/src/mame/drivers/nyny.cpp +++ b/src/mame/drivers/nyny.cpp @@ -316,7 +316,7 @@ MC6845_UPDATE_ROW( nyny_state::crtc_update_row ) else color = bit2 ? color2 : 0; - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); x += 1; } @@ -342,7 +342,7 @@ MC6845_END_UPDATE( nyny_state::crtc_end_update ) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* check if the star status */ - if (m_star_enable && (bitmap.pix32(y, x) == m_palette->pen_color(0)) && + if (m_star_enable && (bitmap.pix(y, x) == m_palette->pen_color(0)) && ((m_star_shift_reg & 0x80ff) == 0x00ff) && (((y & 0x01) ^ m_flipscreen) ^ (((x & 0x08) >> 3) ^ m_flipscreen))) { @@ -350,7 +350,7 @@ MC6845_END_UPDATE( nyny_state::crtc_end_update ) ((m_star_shift_reg & 0x0400) >> 9) | /* G */ ((m_star_shift_reg & 0x1000) >> 10); /* B */ - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); } if (delay_counter == 0) diff --git a/src/mame/drivers/octopus.cpp b/src/mame/drivers/octopus.cpp index 05d2d414baf..b33a13202de 100644 --- a/src/mame/drivers/octopus.cpp +++ b/src/mame/drivers/octopus.cpp @@ -863,7 +863,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(octopus_state::display_pixels) data = 0xff; } for (int z=0;z<8;z++) - bitmap.pix32(y,x + z) = BIT(data,z) ? fg : bg; + bitmap.pix(y,x + z) = BIT(data,z) ? fg : bg; } } diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index 6aabae3acc8..f8da9a3ce8c 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -268,7 +268,7 @@ uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // apply external LUM setting for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix16(y, x) |= lum; + bitmap.pix(y, x) |= lum; return 0; } @@ -288,8 +288,8 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit for (int x = clip.min_x; x <= clip.max_x; x++) { - uint16_t d = bitmap.pix16(y, x) & 7; - uint16_t e = ef934x_bitmap->pix16(y, x); + uint16_t d = bitmap.pix(y, x) & 7; + uint16_t e = ef934x_bitmap->pix(y, x); // i8244 decoder enable is masked with cartridge pin B bool en = (e & 8) || !m_cart->b_read(); @@ -302,12 +302,12 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit if (en && BIT(m_mix_i8244, d)) { // Use i8245 input - bitmap.pix16(y, x) |= lum; + bitmap.pix(y, x) |= lum; } else { // Use EF934x input - bitmap.pix16(y, x) = e | (i2 ? 8 : 0); + bitmap.pix(y, x) = e | (i2 ? 8 : 0); } } } diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp index 6ea860f4762..f024415038a 100644 --- a/src/mame/drivers/okean240.cpp +++ b/src/mame/drivers/okean240.cpp @@ -421,17 +421,14 @@ void okean240_state::machine_reset() u32 okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 gfx,ma; // ma must be 8bit - u16 x,y; - - for (y = 0; y < 256; y++) + for (u16 y = 0; y < 256; y++) { - ma = y + m_scroll; - u16 *p = &bitmap.pix16(y); + u8 const ma = y + m_scroll; // ma must be 8-bit + u16 *p = &bitmap.pix(y); - for (x = 0; x < 0x4000; x+=0x200) + for (u16 x = 0; x < 0x4000; x+=0x200) { - gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; + u8 const gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0); diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp index 82bc5696955..900f1f6960e 100644 --- a/src/mame/drivers/olyboss.cpp +++ b/src/mame/drivers/olyboss.cpp @@ -262,18 +262,15 @@ UPD3301_DRAW_CHARACTER_MEMBER( olyboss_state::olyboss_display_pixels ) data = m_vchrram[(data << 4) | lc]; else data = m_char_rom->base()[(data << 4) | lc]; - int i; //if (lc >= 8) return; if (csr) - { data = 0xff; - } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx * 8) + i) = color?0xffffff:0; + bitmap.pix(y, (sx * 8) + i) = color?0xffffff:0; data <<= 1; } } diff --git a/src/mame/drivers/ondra.cpp b/src/mame/drivers/ondra.cpp index aed29ede721..8b05048eeda 100644 --- a/src/mame/drivers/ondra.cpp +++ b/src/mame/drivers/ondra.cpp @@ -123,25 +123,24 @@ INPUT_CHANGED_MEMBER(ondra_state::nmi_button) u32 ondra_state::screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 *r = m_ram->pointer(); + u8 const *const r = m_ram->pointer(); u8 code1=0,code2=0; - int y, x, b; int Vaddr = 0x2800; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - for (y = 127; y >=0; y--) + for (int y = 127; y >=0; y--) { if (m_video_enable) { code1 = r[0xd700 + Vaddr + 0x80]; code2 = r[0xd700 + Vaddr + 0x00]; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - bitmap.pix16(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; - bitmap.pix16(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; + bitmap.pix(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; + bitmap.pix(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; } Vaddr++; } diff --git a/src/mame/drivers/orao.cpp b/src/mame/drivers/orao.cpp index d6ec83ef9b3..65cd7f81a71 100644 --- a/src/mame/drivers/orao.cpp +++ b/src/mame/drivers/orao.cpp @@ -266,7 +266,7 @@ u32 orao_state::screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, u8 code = m_vram[addr++]; for (u8 b = 0; b < 8; b++) { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + bitmap.pix(y, horpos++) = (code >> b) & 0x01; } } } diff --git a/src/mame/drivers/oric.cpp b/src/mame/drivers/oric.cpp index 3fd07906bb4..803a2feb0dd 100644 --- a/src/mame/drivers/oric.cpp +++ b/src/mame/drivers/oric.cpp @@ -235,7 +235,7 @@ uint32_t oric_state::screen_update_oric(screen_device &screen, bitmap_rgb32 &bit uint32_t fgcol = m_palette->pen_color(7); uint32_t bgcol = m_palette->pen_color(0); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for(int x=0; x<40; x++) { // Lookup the byte and, if needed, the pattern data diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 467ab3c0b7d..a1cb78acae9 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -465,7 +465,7 @@ TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) if ( y < 240 ) { uint16_t row_addr = ( y / 10 ) * 128; - uint16_t *p = &m_bitmap.pix16(y); + uint16_t *const p = &m_bitmap.pix(y); uint8_t char_line = y % 10; for ( int x = 0; x < 80; x++ ) diff --git a/src/mame/drivers/othello.cpp b/src/mame/drivers/othello.cpp index b43707ae0c3..051dc56c002 100644 --- a/src/mame/drivers/othello.cpp +++ b/src/mame/drivers/othello.cpp @@ -132,9 +132,9 @@ private: MC6845_UPDATE_ROW( othello_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - const uint8_t *gfx = memregion("gfx")->base(); + uint8_t const *const gfx = memregion("gfx")->base(); for(int cx = 0; cx < x_count; ++cx) { @@ -143,7 +143,7 @@ MC6845_UPDATE_ROW( othello_state::crtc_update_row ) for(int x = 0; x < TILE_WIDTH; ++x) { - bitmap.pix32(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; + bitmap.pix(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; tmp >>= 4; } } diff --git a/src/mame/drivers/panicr.cpp b/src/mame/drivers/panicr.cpp index 564e3803310..d6db1e8f59d 100644 --- a/src/mame/drivers/panicr.cpp +++ b/src/mame/drivers/panicr.cpp @@ -298,12 +298,12 @@ uint32_t panicr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y=0;y<256;y++) { - uint16_t* srcline = &m_temprender->pix16(y); - uint16_t* dstline = &bitmap.pix16(y); + uint16_t const *const srcline = &m_temprender->pix(y); + uint16_t *const dstline = &bitmap.pix(y); for (int x=0;x<256;x++) { - uint16_t dat = srcline[x]; + uint16_t const dat = srcline[x]; dstline[x] = ((dat & 0x00f) | ((dat & 0x1e0)>>0)) + 0x200; @@ -315,12 +315,12 @@ uint32_t panicr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y=0;y<256;y++) { - uint16_t* srcline = &m_temprender->pix16(y); - uint16_t* dstline = &bitmap.pix16(y); + uint16_t const *const srcline = &m_temprender->pix(y); + uint16_t *const dstline = &bitmap.pix(y); for (int x=0;x<256;x++) { - uint16_t dat = srcline[x]; + uint16_t const dat = srcline[x]; if (dat & 0x10) dstline[x] = ((dat & 0x00f) | ((dat & 0x1e0)>>0)) + 0x200; @@ -367,7 +367,7 @@ uint8_t panicr_state::collision_r(offs_t offset) uint8_t ret = 0; - uint16_t* srcline = &m_tempbitmap_1->pix16(actual_line); + uint16_t const *const srcline = &m_tempbitmap_1->pix(actual_line); ret |= (srcline[(actual_column+0)&0xff]&3) << 6; diff --git a/src/mame/drivers/pasha2.cpp b/src/mame/drivers/pasha2.cpp index 397354fb516..74735b174af 100644 --- a/src/mame/drivers/pasha2.cpp +++ b/src/mame/drivers/pasha2.cpp @@ -356,28 +356,25 @@ void pasha2_state::video_start() uint32_t pasha2_state::screen_update_pasha2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, count; - int color; - /* 2 512x256 bitmaps */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - count = cliprect.min_x | (y << 9); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + int count = cliprect.min_x | (y << 9); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - bitmap.pix16(y, x) = m_bitmap0[(m_vbuffer ^ 1)][count++] | 0x100; + bitmap.pix(y, x) = m_bitmap0[(m_vbuffer ^ 1)][count++] | 0x100; } } - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - count = cliprect.min_x | (y << 9); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + int count = cliprect.min_x | (y << 9); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - color = m_bitmap1[(m_vbuffer ^ 1)][count++]; + int color = m_bitmap1[(m_vbuffer ^ 1)][count++]; if (color != 0) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/drivers/paso1600.cpp b/src/mame/drivers/paso1600.cpp index 1f7b32468d3..0c156fdf7db 100644 --- a/src/mame/drivers/paso1600.cpp +++ b/src/mame/drivers/paso1600.cpp @@ -92,10 +92,7 @@ private: uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int xi,yi; - #if 0 - uint32_t count; +#if 0 static int test_x; if(machine().input().code_pressed(KEYCODE_Z)) @@ -106,49 +103,48 @@ uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_in popmessage("%d",test_x); - count = 0; + uint32_t count = 0; - for(y=0;y<475;y++) + for(int y=0;y<475;y++) { count &= 0xffff; - for(x=0;x<test_x/16;x++) + for(int x=0;x<test_x/16;x++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { int pen = (m_p_gvram[count] >> xi) & 1; if(y < 475 && x*16+xi < 640) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(pen); + bitmap.pix(y, x*16+xi) = m_palette->pen(pen); } count++; } } - #endif +#endif // popmessage("%d %d %d",mc6845_h_display,mc6845_v_display,mc6845_tile_height); - for(y=0;y<mc6845_v_display;y++) + for(int y=0;y<mc6845_v_display;y++) { - for(x=0;x<mc6845_h_display;x++) + for(int x=0;x<mc6845_h_display;x++) { int tile = m_p_vram[x+y*mc6845_h_display] & 0xff; int color = (m_p_vram[x+y*mc6845_h_display] & 0x700) >> 8; - int pen; - for(yi=0;yi<19;yi++) + for(int yi=0;yi<19;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; + int pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; if(yi & 0x10) pen = -1; if(pen != -1) if(y*19 < 475 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*19+yi, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y*19+yi, x*8+xi) = m_palette->pen(pen); } } } @@ -156,15 +152,15 @@ uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_in /* quick and dirty way to do the cursor */ if(0) - for(yi=0;yi<mc6845_tile_height;yi++) + for(int yi=0;yi<mc6845_tile_height;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { if((mc6845_cursor_y_start & 0x60) != 0x20 && mc6845_h_display) { - x = mc6845_cursor_addr % mc6845_h_display; - y = mc6845_cursor_addr / mc6845_h_display; - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(7); + int x = mc6845_cursor_addr % mc6845_h_display; + int y = mc6845_cursor_addr / mc6845_h_display; + bitmap.pix(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(7); } } } diff --git a/src/mame/drivers/pasogo.cpp b/src/mame/drivers/pasogo.cpp index dd08e9c4609..10092897b24 100644 --- a/src/mame/drivers/pasogo.cpp +++ b/src/mame/drivers/pasogo.cpp @@ -503,23 +503,22 @@ INPUT_CHANGED_MEMBER(pasogo_state::contrast) uint32_t pasogo_state::screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *vram = (uint8_t *)m_vram.target(); - int x, y; - for (y=0; y<240; y++) + uint8_t const *const vram = (uint8_t *)m_vram.target(); + for (int y=0; y<240; y++) { - for (x=0; x<(320/8); x++) + for (int x=0; x<(320/8); x++) { - int a = (y & 3) * 0x2000; - uint8_t d1 = vram[a + (y >> 2) * 80 + x]; - uint16_t *line = &bitmap.pix16(y, x << 3); - *line++ = ((d1 >> 7) & 1); - *line++ = ((d1 >> 6) & 1); - *line++ = ((d1 >> 5) & 1); - *line++ = ((d1 >> 4) & 1); - *line++ = ((d1 >> 3) & 1); - *line++ = ((d1 >> 2) & 1); - *line++ = ((d1 >> 1) & 1); - *line++ = ((d1 >> 0) & 1); + int const a = (y & 3) * 0x2000; + uint8_t const d1 = vram[a + (y >> 2) * 80 + x]; + uint16_t *line = &bitmap.pix(y, x << 3); + *line++ = BIT(d1, 7); + *line++ = BIT(d1, 6); + *line++ = BIT(d1, 5); + *line++ = BIT(d1, 4); + *line++ = BIT(d1, 3); + *line++ = BIT(d1, 2); + *line++ = BIT(d1, 1); + *line++ = BIT(d1, 0); } } return 0; diff --git a/src/mame/drivers/pasopia.cpp b/src/mame/drivers/pasopia.cpp index f0715ba3ac5..af79aa49211 100644 --- a/src/mame/drivers/pasopia.cpp +++ b/src/mame/drivers/pasopia.cpp @@ -125,9 +125,9 @@ TIMER_CALLBACK_MEMBER( pasopia_state::pio_timer ) MC6845_UPDATE_ROW( pasopia_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 fg=7,bg=0; // colours need to be determined - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (u16 x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp index 3dd0dabb6b8..b38f32be17b 100644 --- a/src/mame/drivers/pasopia7.cpp +++ b/src/mame/drivers/pasopia7.cpp @@ -191,15 +191,13 @@ void pasopia7_state::draw_cg4_line(bitmap_rgb32 &bitmap,int y,int yi,int width,i { for(int xi=0;xi<8;xi++) { - int pen_b,pen_r,pen_g,color; + int pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; + int pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; + int pen_g = 0;//(m_vram[count+yi+0x8000]>>(7-xi)) & 1; - pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; - pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = 0;//(m_vram[count+yi+0x8000]>>(7-xi)) & 1; + int color = pen_g<<2 | pen_r<<1 | pen_b<<0; - color = pen_g<<2 | pen_r<<1 | pen_b<<0; - - bitmap.pix32(y, x+xi) = m_palette->pen(color); + bitmap.pix(y, x+xi) = m_palette->pen(color); } count+=8; } @@ -217,7 +215,7 @@ void pasopia7_state::draw_tv_line(bitmap_rgb32 &bitmap,int y,int yi,int width,in { int pen = ((m_font_rom[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } // draw cursor @@ -225,7 +223,7 @@ void pasopia7_state::draw_tv_line(bitmap_rgb32 &bitmap,int y,int yi,int width,in { for(int xc=0;xc<8;xc++) { - bitmap.pix32(y, x*8+xc) = m_palette->pen(7); + bitmap.pix(y, x*8+xc) = m_palette->pen(7); } } count+=8; @@ -243,15 +241,13 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { for(int xi=0;xi<8;xi++) { - int pen,pen_b,pen_r,pen_g; - - pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; - pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = (m_vram[count+yi+0x8000]>>(7-xi)) & 1; + int pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; + int pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; + int pen_g = (m_vram[count+yi+0x8000]>>(7-xi)) & 1; - pen = pen_g<<2 | pen_r<<1 | pen_b<<0; + int pen = pen_g<<2 | pen_r<<1 | pen_b<<0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } } else @@ -262,7 +258,7 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { int pen = ((m_font_rom[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } } @@ -271,7 +267,7 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { for(int xc=0;xc<8;xc++) { - bitmap.pix32(y, x*8+xc) = m_palette->pen(7); + bitmap.pix(y, x*8+xc) = m_palette->pen(7); } } diff --git a/src/mame/drivers/pc100.cpp b/src/mame/drivers/pc100.cpp index c371415bc86..8cefae88466 100644 --- a/src/mame/drivers/pc100.cpp +++ b/src/mame/drivers/pc100.cpp @@ -164,40 +164,35 @@ void pc100_state::video_start() uint32_t pc100_state::screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int count; - int xi; - int dot; - int pen[4],pen_i; + int count = (m_crtc.vstart + 0x20) * 0x40; - count = ((m_crtc.vstart + 0x20) * 0x40); - - for(y=0;y<512;y++) + for(int y=0;y<512;y++) { count &= 0xffff; - for(x=0;x<1024/16;x++) + for(int x=0;x<1024/16;x++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { if(m_crtc.cmd != 0xffff) { - for(pen_i=0;pen_i<4;pen_i++) + int pen[4]; + for(int pen_i=0;pen_i<4;pen_i++) pen[pen_i] = (m_vram[count+pen_i*0x10000] >> xi) & 1; - dot = 0; - for(pen_i=0;pen_i<4;pen_i++) + int dot = 0; + for(int pen_i=0;pen_i<4;pen_i++) dot |= pen[pen_i]<<pen_i; if(y < 512 && x*16+xi < 768) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot); + bitmap.pix(y, x*16+xi) = m_palette->pen(dot); } else { - dot = (m_vram[count] >> xi) & 1; + int dot = (m_vram[count] >> xi) & 1; if(y < 512 && x*16+xi < 768) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot ? 15 : 0); + bitmap.pix(y, x*16+xi) = m_palette->pen(dot ? 15 : 0); } } diff --git a/src/mame/drivers/pc1500.cpp b/src/mame/drivers/pc1500.cpp index af40cda61af..09e63e71504 100644 --- a/src/mame/drivers/pc1500.cpp +++ b/src/mame/drivers/pc1500.cpp @@ -107,9 +107,9 @@ uint32_t pc1500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int b=0; b<8; b++) { if(b<4) - bitmap.pix16(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); + bitmap.pix(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); else - bitmap.pix16(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); + bitmap.pix(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); } } diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp index d79cb645a09..fdf7b603a96 100644 --- a/src/mame/drivers/pc2000.cpp +++ b/src/mame/drivers/pc2000.cpp @@ -277,7 +277,7 @@ int gl3000s_state::sed1520_screen_update(bitmap_ind16 &bitmap, const rectangle & int py = 8 + y*8 + yi; if (cliprect.contains(px, py)) - bitmap.pix16(py, px) = (vram[addr % 0x140] >> yi) & 1; + bitmap.pix(py, px) = (vram[addr % 0x140] >> yi) & 1; } row_pos++; @@ -336,7 +336,7 @@ SED1520_UPDATE_CB(gl3000s_state::screen_update_left) else if (x < 74 && yi < 7) { int cx = x - 59; - bitmap.pix16(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; + bitmap.pix(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; } } } @@ -413,7 +413,7 @@ HD44780_PIXEL_UPDATE(pc1000_state::pc1000_pixel_update) for (int i=0; i<20; i++) if (pos == layout[i]) { - bitmap.pix16((line * 9) + y, (i * 6) + x) = state; + bitmap.pix((line * 9) + y, (i * 6) + x) = state; break; } } @@ -962,7 +962,7 @@ HD44780_PIXEL_UPDATE(gl4004_state::gl4000_pixel_update) }; uint8_t char_pos = gl4000_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + bitmap.pix((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; } } diff --git a/src/mame/drivers/pc8001.cpp b/src/mame/drivers/pc8001.cpp index c832b088ce1..a7478090cb7 100644 --- a/src/mame/drivers/pc8001.cpp +++ b/src/mame/drivers/pc8001.cpp @@ -373,18 +373,17 @@ static const rgb_t PALETTE_PC8001[] = UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) { uint8_t data = m_char_rom->base()[(cc << 3) | lc]; - int i; if (lc >= 8) return; if (csr) data = 0xff; if (m_width80) { - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; data <<= 1; } @@ -393,12 +392,12 @@ UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) { if (sx % 2) return; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; - bitmap.pix32(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; data <<= 1; } diff --git a/src/mame/drivers/pc8801.cpp b/src/mame/drivers/pc8801.cpp index 9bb9f7b3e36..9683fe3b434 100644 --- a/src/mame/drivers/pc8801.cpp +++ b/src/mame/drivers/pc8801.cpp @@ -311,25 +311,18 @@ void pc8801_state::video_start() void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) { - int x,y,xi; - uint32_t count; - uint16_t y_size; - uint16_t y_double; + uint32_t count = 0; - count = 0; + uint16_t y_double = (pc8801_pixel_clock()); + uint16_t y_size = (y_double+1) * 200; - y_double = (pc8801_pixel_clock()); - y_size = (y_double+1) * 200; - - for(y=0;y<y_size;y+=(y_double+1)) + for(int y=0;y<y_size;y+=(y_double+1)) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = 0; + int pen = 0; /* note: layer masking doesn't occur in 3bpp mode, Bug Attack relies on this */ pen |= ((m_gvram[count+0x0000] >> (7-xi)) & 1) << 0; @@ -339,15 +332,15 @@ void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &clipre if(y_double) { if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y+0, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y+0, x+xi) = m_palette->pen(pen & 7); if(cliprect.contains(x+xi, y+1)) - bitmap.pix16(y+1, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y+1, x+xi) = m_palette->pen(pen & 7); } else { if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y, x+xi) = m_palette->pen(pen & 7); } } @@ -358,42 +351,35 @@ void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &clipre void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) { - int x,y,xi; - uint32_t count; - uint8_t color; - uint8_t is_cursor; - - count = 0; - color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; - is_cursor = 0; + uint32_t count = 0; + uint8_t color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; + uint8_t is_cursor = 0; - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { if(!(m_gfx_ctrl & 1)) is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); + int pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); if(is_cursor) pen^=1; if((m_gfx_ctrl & 1)) { if(cliprect.contains(x+xi, y*2+0)) - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); if(cliprect.contains(x+xi, y*2+1)) - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); } else { if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y, x+xi) = m_palette->pen(pen ? color : 0); } } @@ -405,23 +391,21 @@ void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &clipre { count = 0; - for(y=200;y<400;y++) + for(int y=200;y<400;y++) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { if(!(m_gfx_ctrl & 1)) is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); + int pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); if(is_cursor) pen^=1; if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? 7 : 0); + bitmap.pix(y, x+xi) = m_palette->pen(pen ? 7 : 0); } count++; @@ -496,84 +480,73 @@ uint8_t pc8801_state::extract_text_attribute(uint32_t address,int x, uint8_t wid void pc8801_state::pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,uint8_t gfx_mode,uint8_t reverse,uint8_t secret,uint8_t blink,uint8_t upper,uint8_t lower,int y_size,int width, uint8_t non_special) { - int xi,yi; uint8_t *vram = m_work_ram.get(); - uint8_t is_cursor; - uint8_t y_height, y_double; - uint8_t y_step; - y_height = lines_per_char; - y_double = (pc8801_pixel_clock()); - y_step = (non_special) ? 80 : 120; // trusted by Elthlead - is_cursor = 0; + uint8_t y_height = lines_per_char; + uint8_t y_double = (pc8801_pixel_clock()); + uint8_t y_step = (non_special) ? 80 : 120; // trusted by Elthlead + uint8_t is_cursor = 0; - for(yi=0;yi<y_height;yi++) + for(int yi=0;yi<y_height;yi++) { if(m_gfx_ctrl & 1) is_cursor = calc_cursor_pos(x,y,yi); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - int tile; - int color; + int tile = vram[x+(y*y_step)+m_dma_address[2]]; - { - tile = vram[x+(y*y_step)+m_dma_address[2]]; + int res_x = x*8+xi*(width+1); + int res_y = y*y_height+yi; - res_x = x*8+xi*(width+1); - res_y = y*y_height+yi; + if(!m_screen->visible_area().contains(res_x, res_y)) + continue; - if(!m_screen->visible_area().contains(res_x, res_y)) - continue; + int color; + if(gfx_mode) + { + uint8_t mask; - if(gfx_mode) - { - uint8_t mask; + mask = (xi & 4) ? 0x10 : 0x01; + mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); + color = (tile & mask) ? pal : -1; + } + else + { + uint8_t blink_mask = 0; + if(blink && ((m_screen->frame_number() / blink_speed) & 3) == 1) + blink_mask = 1; - mask = (xi & 4) ? 0x10 : 0x01; - mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); - color = (tile & mask) ? pal : -1; - } + uint8_t char_data; + if(yi >= (1 << (y_double+3)) || secret || blink_mask) + char_data = 0; else - { - uint8_t char_data; - uint8_t blink_mask; - - blink_mask = 0; - if(blink && ((m_screen->frame_number() / blink_speed) & 3) == 1) - blink_mask = 1; - - if(yi >= (1 << (y_double+3)) || secret || blink_mask) - char_data = 0; - else - char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; + char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; - if(yi == 0 && upper) - char_data = 1; + if(yi == 0 && upper) + char_data = 1; - if(yi == y_height && lower) - char_data = 1; + if(yi == y_height && lower) + char_data = 1; - if(is_cursor) - char_data^=1; + if(is_cursor) + char_data^=1; - if(reverse) - char_data^=1; + if(reverse) + char_data^=1; - color = char_data ? pal : -1; - } + color = char_data ? pal : -1; + } - if(color != -1) + if(color != -1) + { + bitmap.pix(res_y, res_x) = m_palette->pen(color); + if(width) { - bitmap.pix16(res_y, res_x) = m_palette->pen(color); - if(width) - { - if(!m_screen->visible_area().contains(res_x+1, res_y)) - continue; - - bitmap.pix16(res_y, res_x+1) = m_palette->pen(color); - } + if(!m_screen->visible_area().contains(res_x+1, res_y)) + continue; + + bitmap.pix(res_y, res_x+1) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp index 1f6cc8ea76c..a532443e380 100644 --- a/src/mame/drivers/pc88va.cpp +++ b/src/mame/drivers/pc88va.cpp @@ -39,26 +39,22 @@ void pc88va_state::video_start() void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *tvram = m_tvram; - int offs,i; + uint16_t const *const tvram = m_tvram; - offs = m_tsp.spr_offset; - for(i=0;i<(0x100);i+=(8)) + int offs = m_tsp.spr_offset; + for(int i=0;i<(0x100);i+=(8)) { - int xp,yp,sw,md,xsize,ysize,spda,fg_col,bc; - int x_i,y_i,x_s; int spr_count; - int pen; - - ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; - sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; - yp = (tvram[(offs + i + 0) / 2] & 0x1ff); - xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; - md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; - xp = (tvram[(offs + i + 2) / 2] & 0x3ff); - spda = (tvram[(offs + i + 4) / 2] & 0xffff); - fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; - bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; + + int ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; + int sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; + int yp = (tvram[(offs + i + 0) / 2] & 0x1ff); + int xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; + int md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; + int xp = (tvram[(offs + i + 2) / 2] & 0x3ff); + int spda = (tvram[(offs + i + 4) / 2] & 0xffff); + int fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; + int bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; if(!sw) continue; @@ -86,18 +82,18 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) spr_count = 0; - for(y_i=0;y_i<ysize;y_i++) + for(int y_i=0;y_i<ysize;y_i++) { - for(x_i=0;x_i<xsize;x_i+=16) + for(int x_i=0;x_i<xsize;x_i+=16) { - for(x_s=0;x_s<16;x_s++) + for(int x_s=0;x_s<16;x_s++) { - pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1; + int pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1; pen = pen & 1 ? fg_col : (bc) ? 8 : -1; if(pen != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + bitmap.pix(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); } spr_count+=2; } @@ -113,16 +109,16 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) spr_count = 0; - for(y_i=0;y_i<ysize;y_i++) + for(int y_i=0;y_i<ysize;y_i++) { - for(x_i=0;x_i<xsize;x_i+=2) + for(int x_i=0;x_i<xsize;x_i+=2) { - for(x_s=0;x_s<2;x_s++) + for(int x_s=0;x_s<2;x_s++) { - pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf; + int pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf; //if(bc != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + bitmap.pix(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); } spr_count+=2; } @@ -148,41 +144,31 @@ uint32_t pc88va_state::calc_kanji_rom_addr(uint8_t jis1,uint8_t jis2,int x,int y void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *tvram = m_tvram; + uint16_t const *const tvram = m_tvram; // TODO: PCG select won't work with this arrangement - uint8_t *kanji = memregion("kanji")->base(); - int xi,yi; - int x,y; - int res_x,res_y; - uint16_t lr_half_gfx; - uint8_t jis1,jis2; - uint32_t count; - uint32_t tile_num; - uint16_t attr; - uint8_t attr_mode; - uint8_t fg_col,bg_col,secret,reverse; - //uint8_t blink,dwidc,dwid,uline,hline; - uint8_t screen_fg_col,screen_bg_col; - - count = tvram[m_tsp.tvram_vreg_offset/2]; - - attr_mode = tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x1f; + uint8_t const *const kanji = memregion("kanji")->base(); + + uint32_t count = tvram[m_tsp.tvram_vreg_offset/2]; + + uint8_t attr_mode = tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x1f; /* Note: bug in docs has the following two reversed */ - screen_fg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0xf000) >> 12; - screen_bg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x0f00) >> 8; + uint8_t screen_fg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0xf000) >> 12; + uint8_t screen_bg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x0f00) >> 8; - for(y=0;y<13;y++) + for(int y=0;y<13;y++) { - for(x=0;x<80;x++) + for(int x=0;x<80;x++) { - jis1 = (tvram[count] & 0x7f) + 0x20; - jis2 = (tvram[count] & 0x7f00) >> 8; - lr_half_gfx = ((tvram[count] & 0x8000) >> 15); + uint8_t jis1 = (tvram[count] & 0x7f) + 0x20; + uint8_t jis2 = (tvram[count] & 0x7f00) >> 8; + uint16_t lr_half_gfx = ((tvram[count] & 0x8000) >> 15); - tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); + uint32_t tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); - attr = (tvram[count+(m_tsp.attr_offset/2)] & 0x00ff); + uint16_t attr = (tvram[count+(m_tsp.attr_offset/2)] & 0x00ff); + uint8_t fg_col,bg_col,secret,reverse; + //uint8_t blink,dwidc,dwid,uline,hline; fg_col = bg_col = reverse = secret = 0; //blink = dwidc = dwid = uline = hline = 0; switch(attr_mode) @@ -296,19 +282,17 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) return; } - for(yi=0;yi<16;yi++) + for(int yi=0;yi<16;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - res_x = x*8+xi; - res_y = y*16+yi; + int res_x = x*8+xi; + int res_y = y*16+yi; if(!cliprect.contains(res_x, res_y)) continue; - pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; + int pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; if(reverse) pen = pen & 1 ? bg_col : fg_col; @@ -318,7 +302,7 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) if(secret) { pen = 0; } //hide text if(pen != -1) //transparent - bitmap.pix32(res_y, res_x) = m_palette->pen(pen); + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } diff --git a/src/mame/drivers/pce220.cpp b/src/mame/drivers/pce220.cpp index e2b08ae5149..fddfa2404ae 100644 --- a/src/mame/drivers/pce220.cpp +++ b/src/mame/drivers/pce220.cpp @@ -161,11 +161,11 @@ uint32_t pce220_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { //first 12 columns int panel1_addr = ((m_lcd_start_line>>3) + y)*0x40 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; + bitmap.pix(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; //last 12 columns int panel2_addr = ((m_lcd_start_line>>3) + y + 4)*0x40 + (59-row_pos); - bitmap.pix16(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; + bitmap.pix(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; } row_pos++; @@ -245,7 +245,7 @@ uint32_t pcg850v_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int yi = 0; yi < 8; yi++) { int addr = ((m_lcd_start_line>>3) + y)*0x100 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; + bitmap.pix(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; } row_pos++; diff --git a/src/mame/drivers/pcm.cpp b/src/mame/drivers/pcm.cpp index db992da93bf..a68ab28fcba 100644 --- a/src/mame/drivers/pcm.cpp +++ b/src/mame/drivers/pcm.cpp @@ -241,20 +241,19 @@ void pcm_state::machine_reset() u32 pcm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0x400,x; + u16 sy=0,ma=0x400; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - chr = m_vram[x]; + u8 const chr = m_vram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + u8 const gfx = m_p_chargen[(chr<<3) | ra]; *p++ = BIT(gfx, 7); *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp index 2218591e41b..9bd5cc80969 100644 --- a/src/mame/drivers/pcw.cpp +++ b/src/mame/drivers/pcw.cpp @@ -641,7 +641,7 @@ void pcw_state::pcw_printer_fire_pins(uint16_t pins) { line = x % PCW_PRINTER_HEIGHT; if((pins & 0x01) == 0) - m_prn_output->pix16(line, m_printer_headpos) = (uint16_t)(pins & 0x01); + m_prn_output->pix(line, m_printer_headpos) = (uint16_t)(pins & 0x01); pins >>= 1; } // if(m_printer_headpos < PCW_PRINTER_WIDTH) diff --git a/src/mame/drivers/pcxt.cpp b/src/mame/drivers/pcxt.cpp index c180067a72e..dd25820e008 100644 --- a/src/mame/drivers/pcxt.cpp +++ b/src/mame/drivers/pcxt.cpp @@ -199,32 +199,27 @@ uint8_t isa8_cga_tetriskr_device::bg_bank_r() uint32_t isa8_cga_tetriskr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - int yi; - const uint8_t *bg_rom = memregion("gfx2")->base(); + uint8_t const *const bg_rom = memregion("gfx2")->base(); //popmessage("%04x",m_start_offs); bitmap.fill(rgb_t::black(), cliprect); - for(y=0;y<200/8;y++) + for(int y=0;y<200/8;y++) { - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(x=0;x<320/8;x++) + for(int x=0;x<320/8;x++) { - uint8_t color; - int xi,pen_i; - - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - color = 0; + uint8_t color = 0; /* TODO: first byte seems bogus? */ - for(pen_i = 0;pen_i<4;pen_i++) + for(int pen_i = 0;pen_i<4;pen_i++) color |= ((bg_rom[y*320/8+x+(pen_i*0x20000)+yi*0x400+m_bg_bank*0x2000+1] >> (7-xi)) & 1) << pen_i; if(cliprect.contains(x*8+xi, y*8+yi)) - bitmap.pix32(y*8+yi, x*8+xi) = m_palette->pen(color); + bitmap.pix(y*8+yi, x*8+xi) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/pda600.cpp b/src/mame/drivers/pda600.cpp index 31d0054973a..3435da028de 100644 --- a/src/mame/drivers/pda600.cpp +++ b/src/mame/drivers/pda600.cpp @@ -132,7 +132,7 @@ uint32_t pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int px=0; px<8; px++) { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + bitmap.pix(y, (x * 8) + px) = BIT(data, 7); data <<= 1; } } diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp index b687074ea1f..55eae153890 100644 --- a/src/mame/drivers/pegasus.cpp +++ b/src/mame/drivers/pegasus.cpp @@ -314,20 +314,19 @@ static const u8 mcm6571a_shift[] = u32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; bool pcg_mode = BIT(m_control_bits, 1); - for(y = 0; y < 16; y++ ) + for(u8 y = 0; y < 16; y++ ) { - for(ra = 0; ra < 16; ra++ ) + for(u8 ra = 0; ra < 16; ra++ ) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for(x = ma; x < ma + 32; x++ ) + for(u16 x = ma; x < ma + 32; x++ ) { - inv = 0xff; - chr = m_vram[x]; + u8 inv = 0xff; + u8 chr = m_vram[x]; if (BIT(chr, 7)) { @@ -335,12 +334,12 @@ u32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co chr &= 0x7f; } + u8 gfx; if (pcg_mode) { gfx = m_pcg[(chr << 4) | ra] ^ inv; } - else - if (mcm6571a_shift[chr]) + else if (mcm6571a_shift[chr]) { if (ra < 3) gfx = inv; diff --git a/src/mame/drivers/peoplepc.cpp b/src/mame/drivers/peoplepc.cpp index 011535db098..9c25f9504e9 100644 --- a/src/mame/drivers/peoplepc.cpp +++ b/src/mame/drivers/peoplepc.cpp @@ -114,17 +114,16 @@ static const gfx_layout peoplepc_charlayout = MC6845_UPDATE_ROW(peoplepc_state::update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for(i = 0; i < x_count; i++) + for(int i = 0; i < x_count; i++) { if(BIT(m_p7c, 1)) { uint16_t data = m_gvram[((((ma / 40) * 16) + ra) * 64) + i]; - for(j = 15; j >= 0; j--) - bitmap.pix32(y, (i * 16) + j) = palette[BIT(data, j)]; + for(int j = 15; j >= 0; j--) + bitmap.pix(y, (i * 16) + j) = palette[BIT(data, j)]; } else { @@ -134,8 +133,8 @@ MC6845_UPDATE_ROW(peoplepc_state::update_row) chr ^= 0xff; if(((data & 0x800) && (ra > 14)) || (i == cursor_x)) chr = 0xff; - for(j = 0; j < 8; j++) - bitmap.pix32(y, (i * 8) + j) = palette[BIT(chr, j)]; + for(int j = 0; j < 8; j++) + bitmap.pix(y, (i * 8) + j) = palette[BIT(chr, j)]; } } } diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp index bf020d6c52e..77a2b3bc43e 100644 --- a/src/mame/drivers/pet.cpp +++ b/src/mame/drivers/pet.cpp @@ -1344,24 +1344,24 @@ TIMER_CALLBACK_MEMBER( pet_state::sync_tick ) uint32_t pet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int y = 0; y < 200; y++) { for (int sx = 0; sx < 40; sx++) { - int sy = y / 8; - offs_t video_addr = (sy * 40) + sx; - uint8_t lsd = m_video_ram[video_addr]; + int const sy = y / 8; + offs_t const video_addr = (sy * 40) + sx; + uint8_t const lsd = m_video_ram[video_addr]; - int ra = y & 0x07; - offs_t char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; + int const ra = y & 0x07; + offs_t const char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; uint8_t data = m_char_rom->base()[char_addr]; for (int x = 0; x < 8; x++, data <<= 1) { - int color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; - bitmap.pix32(y, (sx * 8) + x) = pen[color]; + int const color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; + bitmap.pix(y, (sx * 8) + x) = pen[color]; } } } @@ -1403,8 +1403,8 @@ MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } // odd character @@ -1416,8 +1416,8 @@ MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } @@ -1449,8 +1449,8 @@ MC6845_UPDATE_ROW( pet_state::pet40_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } @@ -1485,8 +1485,8 @@ MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } // odd character @@ -1498,8 +1498,8 @@ MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index 998d9831fe7..b71f5d74306 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -339,13 +339,12 @@ void pg685_state::video_start() MC6845_UPDATE_ROW( pg685_state::crtc_update_row ) { static const uint32_t palette[2] = { 0x00d000, 0 }; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - uint8_t *vram = (uint8_t *)m_vram.target(); - uint8_t *fontram = (uint8_t *)m_fontram.target(); + uint8_t const *const vram = (uint8_t *)m_vram.target(); + uint8_t const *const fontram = (uint8_t *)m_fontram.target(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ) & 0x7ff; uint8_t chr = vram[ offset ]; @@ -353,27 +352,26 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row ) uint8_t fg = 1; uint8_t bg = 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[( data & 0x80 ) ? fg : bg]; + *p++ = palette[( data & 0x40 ) ? fg : bg]; + *p++ = palette[( data & 0x20 ) ? fg : bg]; + *p++ = palette[( data & 0x10 ) ? fg : bg]; + *p++ = palette[( data & 0x08 ) ? fg : bg]; + *p++ = palette[( data & 0x04 ) ? fg : bg]; + *p++ = palette[( data & 0x02 ) ? fg : bg]; + *p++ = palette[( data & 0x01 ) ? fg : bg]; } } MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) { static const uint32_t palette[2] = { 0x00d000, 0 }; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - uint16_t *vram = (uint16_t *)m_vram16.target(); - uint8_t *fontram = (uint8_t *)memregion("chargen")->base(); + uint16_t const *const vram = (uint16_t *)m_vram16.target(); + uint8_t const *const fontram = (uint8_t *)memregion("chargen")->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ) & 0x7ff; uint16_t chr = vram[ offset ] & 0xff; @@ -381,14 +379,14 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) uint8_t fg = 1; uint8_t bg = 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[( data & 0x80 ) ? fg : bg]; + *p++ = palette[( data & 0x40 ) ? fg : bg]; + *p++ = palette[( data & 0x20 ) ? fg : bg]; + *p++ = palette[( data & 0x10 ) ? fg : bg]; + *p++ = palette[( data & 0x08 ) ? fg : bg]; + *p++ = palette[( data & 0x04 ) ? fg : bg]; + *p++ = palette[( data & 0x02 ) ? fg : bg]; + *p++ = palette[( data & 0x01 ) ? fg : bg]; } } diff --git a/src/mame/drivers/photon2.cpp b/src/mame/drivers/photon2.cpp index bd10463a35e..6994861ad22 100644 --- a/src/mame/drivers/photon2.cpp +++ b/src/mame/drivers/photon2.cpp @@ -163,48 +163,46 @@ WRITE_LINE_MEMBER(photon2_state::screen_vblank_spectrum) static inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t photon2_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* for now do a full-refresh */ - int x, y, b, scrx, scry; - unsigned short ink, pap; - unsigned char *attr, *scr; // int full_refresh = 1; - scr=m_spectrum_video_ram; + unsigned char const *scr=m_spectrum_video_ram; bitmap.fill(m_spectrum_port_fe & 0x07, cliprect); - for (y=0; y<192; y++) + for (int y=0; y<192; y++) { - scrx=SPEC_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; + int scrx=SPEC_LEFT_BORDER; + int scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + unsigned char const *attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; - for (x=0;x<32;x++) + for (int x=0;x<32;x++) { - /* Get ink and paper colour with bright */ - if (m_spectrum_flash_invert && (*attr & 0x80)) - { - ink=((*attr)>>3) & 0x0f; - pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - } + /* Get ink and paper colour with bright */ + unsigned short ink, pap; + if (m_spectrum_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (int b=0x80;b!=0;b>>=1) + { + if (*scr&b) + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); else - { - ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - pap=((*attr)>>3) & 0x0f; - } - - for (b=0x80;b!=0;b>>=1) - { - if (*scr&b) - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); - else - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); - } + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); + } scr++; attr++; } diff --git a/src/mame/drivers/phunsy.cpp b/src/mame/drivers/phunsy.cpp index 1ff20267bb1..fc5c5776fa5 100644 --- a/src/mame/drivers/phunsy.cpp +++ b/src/mame/drivers/phunsy.cpp @@ -218,19 +218,19 @@ void phunsy_state::phunsy_palette(palette_device &palette) const uint32_t phunsy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,col; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+64; x++) + for (uint16_t x = ma; x < ma+64; x++) { - chr = m_p_videoram[x]; + uint8_t const chr = m_p_videoram[x]; + uint8_t gfx,col; if (BIT(chr, 7)) { /* Graphics mode */ diff --git a/src/mame/drivers/piggypas.cpp b/src/mame/drivers/piggypas.cpp index c816a490e07..1a144a47e39 100644 --- a/src/mame/drivers/piggypas.cpp +++ b/src/mame/drivers/piggypas.cpp @@ -184,7 +184,7 @@ void piggypas_state::machine_reset() HD44780_PIXEL_UPDATE(piggypas_state::piggypas_pixel_update) { if (pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } void piggypas_state::piggypas(machine_config &config) diff --git a/src/mame/drivers/pinball2k.cpp b/src/mame/drivers/pinball2k.cpp index 56ef596d861..fe6160b1543 100644 --- a/src/mame/drivers/pinball2k.cpp +++ b/src/mame/drivers/pinball2k.cpp @@ -165,19 +165,17 @@ void pinball2k_state::video_start() void pinball2k_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - const pen_t *pens = m_palette->pens(); + pen_t const *const pens = m_palette->pens(); - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint32_t *p = &bitmap.pix32(j); - for (i=x; i < x+8; i++) + uint32_t *const p = &bitmap.pix(j); + for (int i=x; i < x+8; i++) { - uint8_t pen = dp[index++]; + uint8_t const pen = dp[index++]; if (pen) p[i] = pens[gfx->colorbase() + (att & 0xf)]; else @@ -191,7 +189,6 @@ void pinball2k_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; int width, height; int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; @@ -218,14 +215,14 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode { - uint8_t *framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; - uint8_t *pal = m_pal; + uint8_t const *const framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint8_t const *const pal = m_pal; - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint8_t *si = &framebuf[j * line_delta]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint8_t const *si = &framebuf[j * line_delta]; + for (int i=0; i < m_frame_width; i++) { int c = *si++; int r = pal[(c*3)+0] << 2; @@ -238,16 +235,16 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl } else // 16-bit { - uint16_t *framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint16_t const *const framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; // RGB 5-6-5 mode if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0) { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { uint16_t c = *si++; int r = ((c >> 11) & 0x1f) << 3; @@ -261,11 +258,11 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl // RGB 5-5-5 mode else { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { uint16_t c = *si++; int r = ((c >> 10) & 0x1f) << 3; @@ -281,14 +278,13 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl void pinball2k_state::draw_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; gfx_element *gfx = m_gfxdecode->gfx(0); - uint32_t *cga = m_cga_ram; + uint32_t const *const cga = m_cga_ram; int index = 0; - for (j=0; j < 25; j++) + for (int j=0; j < 25; j++) { - for (i=0; i < 80; i+=2) + for (int i=0; i < 80; i+=2) { int att0 = (cga[index] >> 8) & 0xff; int ch0 = (cga[index] >> 0) & 0xff; diff --git a/src/mame/drivers/plan80.cpp b/src/mame/drivers/plan80.cpp index c06159475f0..d1de5e6ce91 100644 --- a/src/mame/drivers/plan80.cpp +++ b/src/mame/drivers/plan80.cpp @@ -195,19 +195,18 @@ void plan80_state::machine_start() u32 plan80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma+48; x++) + for (u16 x = ma; x < ma+48; x++) { - chr = m_vram[x]; - gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + u8 chr = m_vram[x]; + u8 gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); /* Display a scanline of a character */ *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/pmd85.cpp b/src/mame/drivers/pmd85.cpp index b8eab04d666..07c15748cb8 100644 --- a/src/mame/drivers/pmd85.cpp +++ b/src/mame/drivers/pmd85.cpp @@ -245,12 +245,12 @@ uint32_t pmd85_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { int pen = BIT(line[x], 7) ? 1 : 2; - bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; - bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; - bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; - bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; - bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; - bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; + bitmap.pix(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; + bitmap.pix(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; + bitmap.pix(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; + bitmap.pix(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; + bitmap.pix(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; + bitmap.pix(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; } } diff --git a/src/mame/drivers/pockstat.cpp b/src/mame/drivers/pockstat.cpp index 3820b1fc410..551f48b3a3f 100644 --- a/src/mame/drivers/pockstat.cpp +++ b/src/mame/drivers/pockstat.cpp @@ -940,7 +940,7 @@ uint32_t pockstat_state::screen_update_pockstat(screen_device &screen, bitmap_rg { for (int y = 0; y < 32; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *const scanline = &bitmap.pix(y); for (int x = 0; x < 32; x++) { if (m_lcd_control != 0) // Hack diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp index 9bd74e066e2..6e988f870e9 100644 --- a/src/mame/drivers/poisk1.cpp +++ b/src/mame/drivers/poisk1.cpp @@ -323,15 +323,13 @@ void p1_state::set_palette_luts(void) POISK1_UPDATE_ROW(p1_state::cga_gfx_2bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); - uint16_t odd, offset; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); if (ra == 0) LOG("cga_gfx_2bpp_update_row\n"); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; @@ -350,16 +348,14 @@ POISK1_UPDATE_ROW(p1_state::cga_gfx_2bpp_update_row) POISK1_UPDATE_ROW(p1_state::cga_gfx_1bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); uint8_t fg = 15, bg = BG_COLOR(m_video.color_select_68); - uint16_t odd, offset; - int i; if (ra == 0) LOG("cga_gfx_1bpp_update_row bg %d\n", bg); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; @@ -382,20 +378,18 @@ POISK1_UPDATE_ROW(p1_state::cga_gfx_1bpp_update_row) POISK1_UPDATE_ROW(p1_state::poisk1_gfx_1bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); - uint8_t fg, bg = BG_COLOR(m_video.color_select_68); - uint16_t odd, offset; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); + uint8_t bg = BG_COLOR(m_video.color_select_68); if (ra == 0) LOG("poisk1_gfx_1bpp_update_row bg %d\n", bg); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; - fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX + uint8_t fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX *p = palette[bg]; p++; *p = palette[( data & 0x40 ) ? fg : bg ]; p++; *p = palette[( data & 0x20 ) ? fg : bg ]; p++; diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp index 70205b76e24..d99f74beb14 100644 --- a/src/mame/drivers/pokemini.cpp +++ b/src/mame/drivers/pokemini.cpp @@ -1554,12 +1554,10 @@ void pokemini_state::prc_counter_callback() /* Check if the background should be drawn */ if ( m_prc.background_enabled ) { - int x, y; - for ( y = 0; y < 8; y++ ) { - for ( x = 0; x < 12; x++ ) { + for ( int y = 0; y < 8; y++ ) { + for ( int x = 0; x < 12; x++ ) { uint8_t tile = m_p_ram[ 0x360 + ( y * m_prc.map_size_x ) + x ]; - int i; - for( i = 0; i < 8; i++ ) { + for( int i = 0; i < 8; i++ ) { m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( m_prc.bg_tiles + ( tile * 8 ) + i ); } } @@ -1569,9 +1567,7 @@ void pokemini_state::prc_counter_callback() /* Check if the sprites should be drawn */ if ( m_prc.sprites_enabled ) { - uint16_t spr; - - for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) + for ( uint16_t spr = 0x35C; spr >= 0x300; spr -= 4 ) { int spr_x = ( m_p_ram[ spr + 0 ] & 0x7F ) - 16; int spr_y = ( m_p_ram[ spr + 1 ] & 0x7F ) - 16; @@ -1580,19 +1576,17 @@ void pokemini_state::prc_counter_callback() if ( spr_flag & 0x08 ) { - uint16_t gfx, mask; uint32_t spr_base = m_prc.spr_tiles + spr_tile * 64; - int i, j; - for ( i = 0; i < 16; i++ ) + for ( int i = 0; i < 16; i++ ) { if ( spr_x + i >= 0 && spr_x + i < 96 ) { int rel_x = ( spr_flag & 0x01 ) ? 15 - i : i; uint32_t s = spr_base + ( ( rel_x & 0x08 ) << 2 ) + ( rel_x & 0x07 ); - mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); - gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); + uint16_t mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); + uint16_t gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); /* Are the colors inverted? */ if ( spr_flag & 0x04 ) @@ -1600,7 +1594,7 @@ void pokemini_state::prc_counter_callback() gfx = ~gfx; } - for ( j = 0; j < 16; j++ ) + for ( int j = 0; j < 16; j++ ) { if ( spr_y + j >= 0 && spr_y + j < 64 ) { @@ -1647,20 +1641,18 @@ void pokemini_state::prc_counter_callback() /* Check if the rendered data should be copied to the LCD */ if ( m_prc.copy_enabled ) { - int x, y; - - for( y = 0; y < 64; y += 8 ) { - for( x = 0; x < 96; x++ ) { + for( int y = 0; y < 64; y += 8 ) { + for( int x = 0; x < 96; x++ ) { uint8_t data = m_p_ram[ ( y * 12 ) + x ]; - m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; - m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; - m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; - m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; - m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; - m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; - m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; - m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; + m_bitmap.pix(y + 0, x) = ( data & 0x01 ) ? 3 : 0; + m_bitmap.pix(y + 1, x) = ( data & 0x02 ) ? 3 : 0; + m_bitmap.pix(y + 2, x) = ( data & 0x04 ) ? 3 : 0; + m_bitmap.pix(y + 3, x) = ( data & 0x08 ) ? 3 : 0; + m_bitmap.pix(y + 4, x) = ( data & 0x10 ) ? 3 : 0; + m_bitmap.pix(y + 5, x) = ( data & 0x20 ) ? 3 : 0; + m_bitmap.pix(y + 6, x) = ( data & 0x40 ) ? 3 : 0; + m_bitmap.pix(y + 7, x) = ( data & 0x80 ) ? 3 : 0; } } diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp index c0ffcf1f21c..80a6ec1e430 100644 --- a/src/mame/drivers/popobear.cpp +++ b/src/mame/drivers/popobear.cpp @@ -343,7 +343,7 @@ void popobear_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect // colours on game over screen are still wrong without the weird param kludge above if (pix&0x3f) { - bitmap.pix16(y_draw, x_draw) = m_palette->pen(((pix+(add_it))&0xff)+0x100); + bitmap.pix(y_draw, x_draw) = m_palette->pen(((pix+(add_it))&0xff)+0x100); } } diff --git a/src/mame/drivers/pp.cpp b/src/mame/drivers/pp.cpp index 72a4edca6bf..a029c2acb70 100644 --- a/src/mame/drivers/pp.cpp +++ b/src/mame/drivers/pp.cpp @@ -183,11 +183,11 @@ SCN2672_DRAW_CHARACTER_MEMBER(pp_state::display_char) for (int i = 0; i < 7; i++) { - bitmap.pix32(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); dots <<= 1; } if (!BIT(m_mode, 6)) - bitmap.pix32(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); } diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp index 2e12d7db1dc..4cd781a74fd 100644 --- a/src/mame/drivers/prestige.cpp +++ b/src/mame/drivers/prestige.cpp @@ -734,7 +734,7 @@ uint32_t prestige_state::screen_update(int bpp, screen_device &screen, bitmap_in pix |= BIT(data, 7 - b) << b; if (cliprect.contains(sx * 8 / bpp + x, y)) - bitmap.pix16(y, sx * 8 / bpp + x) = pix; + bitmap.pix(y, sx * 8 / bpp + x) = pix; data <<= bpp; } diff --git a/src/mame/drivers/progolf.cpp b/src/mame/drivers/progolf.cpp index 7ef19a14771..d77ca7444f0 100644 --- a/src/mame/drivers/progolf.cpp +++ b/src/mame/drivers/progolf.cpp @@ -224,18 +224,16 @@ void progolf_state::video_start() uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count,color,x,y,xi,yi; - { - int scroll = (m_scrollx_lo | ((m_scrollx_hi & 0x03) << 8)); + int const scroll = (m_scrollx_lo | ((m_scrollx_hi & 0x03) << 8)); - count = 0; + int count = 0; - for(x=0;x<128;x++) + for(int x=0;x<128;x++) { - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - int tile = m_videoram[count]; + int const tile = m_videoram[count]; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,tile,1,0,0,(256-x*8)+scroll,y*8); /* wrap-around */ @@ -248,20 +246,20 @@ uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // framebuffer is 8x8 chars arranged like a bitmap + a register that controls the pen handling. { - count = 0; + int count = 0; - for(y=0;y<256;y+=8) + for(int y=0;y<256;y+=8) { - for(x=0;x<256;x+=8) + for(int x=0;x<256;x+=8) { - for (yi=0;yi<8;yi++) + for (int yi=0;yi<8;yi++) { - for (xi=0;xi<8;xi++) + for (int xi=0;xi<8;xi++) { - color = m_fg_fb[(xi+yi*8)+count*0x40]; + int const color = m_fg_fb[(xi+yi*8)+count*0x40]; if(color != 0 && cliprect.contains(x+yi, 256-y+xi)) - bitmap.pix32(x+yi, 256-y+xi) = m_palette->pen((color & 0x7)); + bitmap.pix(x+yi, 256-y+xi) = m_palette->pen((color & 0x7)); } } diff --git a/src/mame/drivers/proteus3.cpp b/src/mame/drivers/proteus3.cpp index 5717d4125f9..25b11c513ca 100644 --- a/src/mame/drivers/proteus3.cpp +++ b/src/mame/drivers/proteus3.cpp @@ -300,26 +300,24 @@ WRITE_LINE_MEMBER( proteus3_state::ca2_w ) u32 proteus3_state::screen_update_proteus3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_flashcnt++; - for(y = 0; y < 16; y++ ) + for (u8 y = 0; y < 16; y++ ) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]; // get char in videoram + u8 chr = m_vram[x]; // get char in videoram gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen } - else - if ((ra == 9) && (m_curs_pos == x) && BIT(m_flashcnt, 4)) + else if ((ra == 9) && (m_curs_pos == x) && BIT(m_flashcnt, 4)) gfx = 0xff; /* Display a scanline of a character */ diff --git a/src/mame/drivers/psion.cpp b/src/mame/drivers/psion.cpp index 32614e2e5b0..047c8b13424 100644 --- a/src/mame/drivers/psion.cpp +++ b/src/mame/drivers/psion.cpp @@ -518,14 +518,14 @@ HD44780_PIXEL_UPDATE(psion_state::lz_pixel_update) }; uint8_t char_pos = psion_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + bitmap.pix((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; } } HD44780_PIXEL_UPDATE(psion1_state::psion1_pixel_update) { if (pos < 8 && line < 2) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } void psion_state::psion_palette(palette_device &palette) const diff --git a/src/mame/drivers/ptcsol.cpp b/src/mame/drivers/ptcsol.cpp index 4b1b07e0782..8427c1ff915 100644 --- a/src/mame/drivers/ptcsol.cpp +++ b/src/mame/drivers/ptcsol.cpp @@ -650,8 +650,7 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons // any character with bit 7 set will blink. With DPMON, do DA C000 C2FF to see what happens u16 which = (m_iop_config->read() & 2) << 10; u8 s1 = m_iop_s1->read(); - u8 y,ra,chr,gfx; - u16 sy=0,ma,x,inv; + u16 sy=0; u8 polarity = (s1 & 8) ? 0xff : 0; bool cursor_inv = false; @@ -660,18 +659,18 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons m_framecnt++; - ma = m_sol20_fe << 6; // scroll register + u16 ma = m_sol20_fe << 6; // scroll register - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 13; ra++) + for (u8 ra = 0; ra < 13; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - inv = polarity; - chr = m_vram[x & 0x3ff]; + u16 inv = polarity; + u8 chr = m_vram[x & 0x3ff]; // cursor if (BIT(chr, 7) && cursor_inv) @@ -679,10 +678,10 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons chr &= 0x7f; + u8 gfx; if ((ra == 0) || ((s1 & 4) && (chr < 0x20))) gfx = inv; - else - if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) + else if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) { if (ra < 4) gfx = inv; diff --git a/src/mame/drivers/px4.cpp b/src/mame/drivers/px4.cpp index 0bddf1212b4..2f539d2c1e6 100644 --- a/src/mame/drivers/px4.cpp +++ b/src/mame/drivers/px4.cpp @@ -1177,26 +1177,24 @@ uint32_t px4_state::screen_update_px4(screen_device &screen, bitmap_ind16 &bitma // display enabled? if (BIT(m_yoff, 7)) { - int y, x; - // get vram start address - uint8_t *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; + uint8_t const *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { // adjust against y-offset uint8_t row = (y - (m_yoff & 0x3f)) & 0x3f; - for (x = 0; x < 240/8; x++) + for (int x = 0; x < 240/8; x++) { - bitmap.pix16(row, x * 8 + 0) = BIT(*vram, 7); - bitmap.pix16(row, x * 8 + 1) = BIT(*vram, 6); - bitmap.pix16(row, x * 8 + 2) = BIT(*vram, 5); - bitmap.pix16(row, x * 8 + 3) = BIT(*vram, 4); - bitmap.pix16(row, x * 8 + 4) = BIT(*vram, 3); - bitmap.pix16(row, x * 8 + 5) = BIT(*vram, 2); - bitmap.pix16(row, x * 8 + 6) = BIT(*vram, 1); - bitmap.pix16(row, x * 8 + 7) = BIT(*vram, 0); + bitmap.pix(row, x * 8 + 0) = BIT(*vram, 7); + bitmap.pix(row, x * 8 + 1) = BIT(*vram, 6); + bitmap.pix(row, x * 8 + 2) = BIT(*vram, 5); + bitmap.pix(row, x * 8 + 3) = BIT(*vram, 4); + bitmap.pix(row, x * 8 + 4) = BIT(*vram, 3); + bitmap.pix(row, x * 8 + 5) = BIT(*vram, 2); + bitmap.pix(row, x * 8 + 6) = BIT(*vram, 1); + bitmap.pix(row, x * 8 + 7) = BIT(*vram, 0); vram++; } diff --git a/src/mame/drivers/pyl601.cpp b/src/mame/drivers/pyl601.cpp index e20146877e1..52270235c3e 100644 --- a/src/mame/drivers/pyl601.cpp +++ b/src/mame/drivers/pyl601.cpp @@ -414,27 +414,26 @@ void pyl601_state::machine_start() MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charrom = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charrom = memregion("chargen")->base(); - int column, bit, i; - uint8_t data; if (BIT(m_video_mode, 5) == 0) { - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { uint8_t code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; code = ((code << 1) | (code >> 7)) & 0xff; + uint8_t data; if (column == cursor_x-2) data = 0xff; else data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff]; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; - bitmap.pix32(y, x) = palette[BIT(data, 7)]; + bitmap.pix(y, x) = palette[BIT(data, 7)]; data <<= 1; } @@ -442,12 +441,12 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) } else { - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) + uint8_t data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (int bit = 0; bit < 8; bit++) { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + bitmap.pix(y, (i * 8) + bit) = palette[BIT(data, 7)]; data <<= 1; } } @@ -456,25 +455,23 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charrom = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charrom = memregion("chargen")->base(); - int column, bit, i; - uint8_t data; if (BIT(m_video_mode, 5) == 0) { - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { - uint8_t code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; - data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; + uint8_t const code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; + uint8_t data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; if (column == cursor_x) data = 0xff; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; - bitmap.pix32(y, x) = palette[BIT(data, 7)]; + bitmap.pix(y, x) = palette[BIT(data, 7)]; data <<= 1; } @@ -482,12 +479,12 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) } else { - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) + uint8_t data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (int bit = 0; bit < 8; bit++) { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + bitmap.pix(y, (i * 8) + bit) = palette[BIT(data, 7)]; data <<= 1; } } diff --git a/src/mame/drivers/pzletime.cpp b/src/mame/drivers/pzletime.cpp index 856ad762bc3..60c7cbc6caa 100644 --- a/src/mame/drivers/pzletime.cpp +++ b/src/mame/drivers/pzletime.cpp @@ -117,9 +117,6 @@ void pzletime_state::video_start() uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count; - int y, x; - bitmap.fill(m_palette[0]->pen(0), cliprect); //bg pen m_txt_tilemap->set_scrolly(0, m_tilemap_regs[0] - 3); @@ -130,14 +127,14 @@ uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rg if (m_video_regs[2] & 1) { - count = 0; + int count = 0; - for (y = 255; y >= 0; y--) + for (int y = 255; y >= 0; y--) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { if (m_bg_videoram[count] & 0x8000) - bitmap.pix32((y - 18) & 0xff, (x - 32) & 0x1ff) = m_palette[1]->pen(m_bg_videoram[count] & 0x7fff); + bitmap.pix((y - 18) & 0xff, (x - 32) & 0x1ff) = m_palette[1]->pen(m_bg_videoram[count] & 0x7fff); count++; } @@ -146,24 +143,20 @@ uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rg m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 0); + uint16_t const *const spriteram = m_spriteram; + for (int offs = 0; offs < 0x2000 / 2; offs += 4) { - uint16_t *spriteram = m_spriteram; - int offs, spr_offs, colour, sx, sy; - - for(offs = 0; offs < 0x2000 / 2; offs += 4) - { - if(spriteram[offs + 0] == 8) - break; + if(spriteram[offs + 0] == 8) + break; - spr_offs = spriteram[offs + 3] & 0x0fff; - sy = 0x200 - (spriteram[offs + 0] & 0x1ff) - 35; - sx = (spriteram[offs + 1] & 0x1ff) - 30; - colour = (spriteram[offs + 0] & 0xf000) >> 12; + int spr_offs = spriteram[offs + 3] & 0x0fff; + int sy = 0x200 - (spriteram[offs + 0] & 0x1ff) - 35; + int sx = (spriteram[offs + 1] & 0x1ff) - 30; + int colour = (spriteram[offs + 0] & 0xf000) >> 12; - // is spriteram[offs + 0] & 0x200 flipy? it's always set + // is spriteram[offs + 0] & 0x200 flipy? it's always set - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, spr_offs, colour, 0, 1, sx, sy, 0); - } + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, spr_offs, colour, 0, 1, sx, sy, 0); } m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0); diff --git a/src/mame/drivers/quizo.cpp b/src/mame/drivers/quizo.cpp index 1e3e27e9f0b..835d42e31ed 100644 --- a/src/mame/drivers/quizo.cpp +++ b/src/mame/drivers/quizo.cpp @@ -104,10 +104,10 @@ uint32_t quizo_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, uint8_t data2 = m_vram[y * 80 + x + 0x4000]; // draw 4 pixels - bitmap.pix32(y, x * 4 + 0) = m_palette->pen((BIT(data2, 7) << 3) | (BIT(data2, 3) << 2) | (BIT(data1, 7) << 1) | BIT(data1, 3)); - bitmap.pix32(y, x * 4 + 1) = m_palette->pen((BIT(data2, 6) << 3) | (BIT(data2, 2) << 2) | (BIT(data1, 6) << 1) | BIT(data1, 2)); - bitmap.pix32(y, x * 4 + 2) = m_palette->pen((BIT(data2, 5) << 3) | (BIT(data2, 1) << 2) | (BIT(data1, 5) << 1) | BIT(data1, 1)); - bitmap.pix32(y, x * 4 + 3) = m_palette->pen((BIT(data2, 4) << 3) | (BIT(data2, 0) << 2) | (BIT(data1, 4) << 1) | BIT(data1, 0)); + bitmap.pix(y, x * 4 + 0) = m_palette->pen((BIT(data2, 7) << 3) | (BIT(data2, 3) << 2) | (BIT(data1, 7) << 1) | BIT(data1, 3)); + bitmap.pix(y, x * 4 + 1) = m_palette->pen((BIT(data2, 6) << 3) | (BIT(data2, 2) << 2) | (BIT(data1, 6) << 1) | BIT(data1, 2)); + bitmap.pix(y, x * 4 + 2) = m_palette->pen((BIT(data2, 5) << 3) | (BIT(data2, 1) << 2) | (BIT(data1, 5) << 1) | BIT(data1, 1)); + bitmap.pix(y, x * 4 + 3) = m_palette->pen((BIT(data2, 4) << 3) | (BIT(data2, 0) << 2) | (BIT(data1, 4) << 1) | BIT(data1, 0)); } } diff --git a/src/mame/drivers/qvt102.cpp b/src/mame/drivers/qvt102.cpp index 78ebd367020..c2be43eccd9 100644 --- a/src/mame/drivers/qvt102.cpp +++ b/src/mame/drivers/qvt102.cpp @@ -491,7 +491,7 @@ MC6845_UPDATE_ROW( qvt102_state::crtc_update_row ) p = !(p & !((BIT(attr, 3) & (ra == 11)))); // underline p = p ^ (BIT(attr, 2) ^ ((x == cursor_x) | BIT(m_latch, 2))); // reverse - bitmap.pix32(y, x*9 + (8-i)) = palette[p ? 2 - half : 0]; + bitmap.pix(y, x*9 + (8-i)) = palette[p ? 2 - half : 0]; } } diff --git a/src/mame/drivers/qvt103.cpp b/src/mame/drivers/qvt103.cpp index 553d6f2d8c8..020b2981d50 100644 --- a/src/mame/drivers/qvt103.cpp +++ b/src/mame/drivers/qvt103.cpp @@ -52,7 +52,7 @@ u32 qvt103_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con uint16_t gfx = m_p_chargen[code << 4 | y]; for (int x = 0; x < 8; x++) - bitmap.pix32(col*12 + y, row*8 + (7 - x)) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(col*12 + y, row*8 + (7 - x)) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/qvt190.cpp b/src/mame/drivers/qvt190.cpp index 0e4778308e0..03cbf1316f5 100644 --- a/src/mame/drivers/qvt190.cpp +++ b/src/mame/drivers/qvt190.cpp @@ -64,7 +64,7 @@ MC6845_UPDATE_ROW(qvt190_state::update_row) gfx = ~gfx; for (int i = 0; i < 9; i++) - bitmap.pix32(y, x*9 + (8-i)) = palette[BIT(gfx, i) ? 2 : 0]; + bitmap.pix(y, x*9 + (8-i)) = palette[BIT(gfx, i) ? 2 : 0]; } } diff --git a/src/mame/drivers/qvt70.cpp b/src/mame/drivers/qvt70.cpp index e4cd22ee6fe..2e40ec44d68 100644 --- a/src/mame/drivers/qvt70.cpp +++ b/src/mame/drivers/qvt70.cpp @@ -226,7 +226,7 @@ uint32_t qvt70_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // 8 pixels of the character for (int p = 0; p < 8; p++) - bitmap.pix32(y * 16 + i, x * 8 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 16 + i, x * 8 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index eecc0c61e84..a1ac1e0557f 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -173,9 +173,8 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,gfx[3]; - uint8_t pen; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + int gfx[3]; if(m_color_mode) { @@ -190,13 +189,14 @@ UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) gfx[2] = 0; } - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { + uint8_t pen; pen = ((gfx[0] >> xi) & 1) ? 1 : 0; pen|= ((gfx[1] >> xi) & 1) ? 2 : 0; pen|= ((gfx[2] >> xi) & 1) ? 4 : 0; - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } @@ -239,7 +239,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) pen = ((tile_data >> xi) & 1) ? color : 0; if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/r2dtank.cpp b/src/mame/drivers/r2dtank.cpp index 1c9adc338d7..11fdb0c0802 100644 --- a/src/mame/drivers/r2dtank.cpp +++ b/src/mame/drivers/r2dtank.cpp @@ -279,8 +279,6 @@ MC6845_UPDATE_ROW( r2dtank_state::crtc_update_row ) for (uint8_t cx = 0; cx < x_count; cx++) { - uint8_t data, fore_color; - /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 3) & 0x1f00) | ((ra << 5) & 0x00e0) | @@ -289,31 +287,31 @@ MC6845_UPDATE_ROW( r2dtank_state::crtc_update_row ) if (m_flipscreen) offs = offs ^ 0x1fff; - data = m_videoram[offs]; - fore_color = (m_colorram[offs] >> 5) & 0x07; + uint8_t data = m_videoram[offs]; + uint8_t fore_color = (m_colorram[offs] >> 5) & 0x07; for (int i = 0; i < 8; i++) { - uint8_t bit, color; + uint8_t bit; if (m_flipscreen) { bit = data & 0x01; - data = data >> 1; + data >>= 1; } else { bit = data & 0x80; - data = data << 1; + data <<= 1; } - color = bit ? fore_color : 0; - bitmap.pix32(y, x) = m_palette->pen_color(color); + uint8_t const color = bit ? fore_color : 0; + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } - ma = ma + 1; + ma++; } } diff --git a/src/mame/drivers/rabbit.cpp b/src/mame/drivers/rabbit.cpp index 17335829a49..182773d4a09 100644 --- a/src/mame/drivers/rabbit.cpp +++ b/src/mame/drivers/rabbit.cpp @@ -340,26 +340,21 @@ void rabbit_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* the sprite bitmap can probably be handled better than this ... */ void rabbit_state::clearspritebitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int startx, starty; - int y; - int amountx,amounty; - uint16_t *dstline; - /* clears a *sensible* amount of the sprite bitmap */ - startx = (m_spriteregs[0]&0x00000fff); - starty = (m_spriteregs[1]&0x0fff0000)>>16; + int startx = (m_spriteregs[0]&0x00000fff); + int starty = (m_spriteregs[1]&0x0fff0000)>>16; startx-=200; starty-=200; - amountx =650; - amounty =600; + int amountx =650; + int amounty =600; if (startx < 0) { amountx += startx; startx = 0; } if ((startx+amountx)>=0x1000) amountx-=(0x1000-(startx+amountx)); - for (y=0; y<amounty;y++) + for (int y=0; y<amounty;y++) { - dstline = &m_sprite_bitmap->pix16((starty+y)&0xfff); + uint16_t *const dstline = &m_sprite_bitmap->pix((starty+y)&0xfff); memset(dstline+startx,0x00,amountx*2); } } @@ -367,17 +362,11 @@ void rabbit_state::clearspritebitmap( bitmap_ind16 &bitmap, const rectangle &cli /* todo: fix zoom, it's inaccurate and this code is ugly */ void rabbit_state::draw_sprite_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint32_t x,y; - uint16_t *srcline; - uint16_t *dstline; - uint16_t pixdata; uint32_t xsize, ysize; - uint32_t xdrawpos, ydrawpos; uint32_t xstep,ystep; - int startx, starty; - startx = ((m_spriteregs[0]&0x00000fff)); - starty = ((m_spriteregs[1]&0x0fff0000)>>16); + int startx = ((m_spriteregs[0]&0x00000fff)); + int starty = ((m_spriteregs[1]&0x0fff0000)>>16); /* zoom compensation? */ startx-=((m_spriteregs[1]&0x000001ff)>>1); @@ -390,22 +379,21 @@ void rabbit_state::draw_sprite_bitmap( bitmap_ind16 &bitmap, const rectangle &cl ysize+=0x80; xstep = ((320*128)<<16) / xsize; ystep = ((224*128)<<16) / ysize; - ydrawpos = 0; - for (y=0;y<ysize;y+=0x80) + for (uint32_t y=0;y<ysize;y+=0x80) { - ydrawpos = ((y>>7)*ystep); + uint32_t ydrawpos = ((y>>7)*ystep); ydrawpos >>=16; if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - srcline = &m_sprite_bitmap->pix16((starty+(y>>7))&0xfff); - dstline = &bitmap.pix16(ydrawpos); + uint16_t const *const srcline = &m_sprite_bitmap->pix((starty+(y>>7))&0xfff); + uint16_t *const dstline = &bitmap.pix(ydrawpos); - for (x=0;x<xsize;x+=0x80) + for (uint32_t x=0;x<xsize;x+=0x80) { - xdrawpos = ((x>>7)*xstep); + uint32_t xdrawpos = ((x>>7)*xstep); xdrawpos >>=16; - pixdata = srcline[(startx+(x>>7))&0xfff]; + uint16_t const pixdata = srcline[(startx+(x>>7))&0xfff]; if (pixdata) if ((xdrawpos >= cliprect.min_x) && (xdrawpos <= cliprect.max_x)) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 1b28e1aa030..15889f0a18d 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -830,7 +830,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_base_state::hgdc_display_pixels ) for (int xi = 0; xi < 16; xi++) // blank screen when VT102 output active (..) { if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = 0; + bitmap.pix(y, x + xi) = 0; } return; // no output from graphics option } @@ -864,7 +864,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_base_state::hgdc_display_pixels ) (BIT(plane3 ,xi) << 3); if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = paletteX[mono ? (pen + 16) : pen]; + bitmap.pix(y, x + xi) = paletteX[mono ? (pen + 16) : pen]; } } diff --git a/src/mame/drivers/rastersp.cpp b/src/mame/drivers/rastersp.cpp index eddccf092e9..b5925895b1a 100644 --- a/src/mame/drivers/rastersp.cpp +++ b/src/mame/drivers/rastersp.cpp @@ -244,7 +244,7 @@ void rastersp_state::dpylist_w(uint32_t data) int y = 0; int x = 0; - uint16_t *bmpptr = &m_update_bitmap.pix16(0, 0); + uint16_t *bmpptr = &m_update_bitmap.pix(0, 0); while (y < 240) { diff --git a/src/mame/drivers/rc702.cpp b/src/mame/drivers/rc702.cpp index 2f54c89d024..31c43417c83 100644 --- a/src/mame/drivers/rc702.cpp +++ b/src/mame/drivers/rc702.cpp @@ -281,13 +281,13 @@ I8275_DRAW_CHARACTER_MEMBER( rc702_state::display_pixels ) gfx ^= 0xff; // Highlight not used - bitmap.pix32(y, x++) = palette[BIT(gfx, 1) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 2) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 3) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 4) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 5) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 6) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 7) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 1) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 2) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 3) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 4) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 5) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 6) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 7) ? 1 : 0]; } // Baud rate generator. All inputs are 0.614MHz. diff --git a/src/mame/drivers/rc759.cpp b/src/mame/drivers/rc759.cpp index 35dac7a1991..4867bb84cf7 100644 --- a/src/mame/drivers/rc759.cpp +++ b/src/mame/drivers/rc759.cpp @@ -356,7 +356,7 @@ I82730_UPDATE_ROW( rc759_state::txt_update_row ) width = 15 - width; for (int p = 0; p < width; p++) - bitmap.pix32(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white() : rgb_t::black(); } } diff --git a/src/mame/drivers/rd100.cpp b/src/mame/drivers/rd100.cpp index 7f9cb4ea167..2e71d92b050 100644 --- a/src/mame/drivers/rd100.cpp +++ b/src/mame/drivers/rd100.cpp @@ -77,7 +77,7 @@ void rd100_state::machine_reset() HD44780_PIXEL_UPDATE(rd100_state::pixel_update) { if (pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } uint8_t rd100_state::keys_r() diff --git a/src/mame/drivers/rex6000.cpp b/src/mame/drivers/rex6000.cpp index 81812f8a1c0..acf8a15ae3e 100644 --- a/src/mame/drivers/rex6000.cpp +++ b/src/mame/drivers/rex6000.cpp @@ -623,7 +623,7 @@ void oz750_state::machine_reset() uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); + uint16_t const lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); if (m_lcd_enabled) { @@ -634,7 +634,7 @@ uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int b=0; b<8; b++) { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 7); + bitmap.pix(y, (x * 8) + b) = BIT(data, 7); data <<= 1; } } @@ -649,7 +649,7 @@ uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitma uint32_t oz750_state::screen_update_oz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); + uint16_t const lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); if (m_lcd_enabled && m_power_on) { @@ -660,7 +660,7 @@ uint32_t oz750_state::screen_update_oz(screen_device &screen, bitmap_ind16 &bitm for (int b=0; b<8; b++) { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 0); + bitmap.pix(y, (x * 8) + b) = BIT(data, 0); data >>= 1; } } diff --git a/src/mame/drivers/roland_cm32p.cpp b/src/mame/drivers/roland_cm32p.cpp index 9229131cd89..2c3da094385 100644 --- a/src/mame/drivers/roland_cm32p.cpp +++ b/src/mame/drivers/roland_cm32p.cpp @@ -333,20 +333,19 @@ cm32p_state::cm32p_state(const machine_config &mconfig, device_type type, const // screen update function from Roland D-110 uint32_t cm32p_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,gfx; - uint16_t sy=0,x; - const u8 *data = lcd->render(); + u16 sy=0; + u8 const *const data = lcd->render(); bitmap.fill(0); - for (y = 0; y < 2; y++) + for (u8 y = 0; y < 2; y++) { - for (ra = 0; ra < 9; ra++) + for (u8 ra = 0; ra < 9; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 16; x++) + for (u16 x = 0; x < 16; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) gfx = data[x*16 + y*640 + ra]; diff --git a/src/mame/drivers/roland_d10.cpp b/src/mame/drivers/roland_d10.cpp index c6f952eb399..3df347a0777 100644 --- a/src/mame/drivers/roland_d10.cpp +++ b/src/mame/drivers/roland_d10.cpp @@ -109,20 +109,19 @@ private: uint32_t roland_d10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx; - uint16_t sy=0,x; - const uint8_t *data = m_lcd->render(); + uint16_t sy=0; + uint8_t const *const data = m_lcd->render(); bitmap.fill(0); - for (y = 0; y < 2; y++) + for (uint8_t y = 0; y < 2; y++) { - for (ra = 0; ra < 9; ra++) + for (uint8_t ra = 0; ra < 9; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 16; x++) + for (uint16_t x = 0; x < 16; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 8) gfx = data[x*16 + y*640 + ra]; diff --git a/src/mame/drivers/roland_mt32.cpp b/src/mame/drivers/roland_mt32.cpp index 73da136698d..7e1da5e0e19 100644 --- a/src/mame/drivers/roland_mt32.cpp +++ b/src/mame/drivers/roland_mt32.cpp @@ -249,7 +249,7 @@ uint32_t mt32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for(int y=0; y<8; y++) { uint8_t v = data[c*8+y]; for(int x=0; x<5; x++) - bitmap.pix16(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; + bitmap.pix(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; } return 0; } diff --git a/src/mame/drivers/roland_s10.cpp b/src/mame/drivers/roland_s10.cpp index 7b063794a06..7c198ac45b5 100644 --- a/src/mame/drivers/roland_s10.cpp +++ b/src/mame/drivers/roland_s10.cpp @@ -90,13 +90,13 @@ private: HD44780_PIXEL_UPDATE(roland_s10_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } HD44780_PIXEL_UPDATE(roland_s220_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } u8 roland_s10_state::qdd_r(offs_t offset) diff --git a/src/mame/drivers/rollext.cpp b/src/mame/drivers/rollext.cpp index 28dc8130117..d7ce3409478 100644 --- a/src/mame/drivers/rollext.cpp +++ b/src/mame/drivers/rollext.cpp @@ -123,7 +123,7 @@ void rollext_renderer::render_texture_scan(int32_t scanline, const extent_t &ext float du = extent.param[0].dpdx; float dv = extent.param[1].dpdx; - uint32_t *fb = &m_fb->pix32(scanline); + uint32_t *fb = &m_fb->pix(scanline); uint32_t texbot = extradata.tex_bottom; uint32_t texleft = extradata.tex_left; @@ -361,7 +361,7 @@ uint32_t rollext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma int ii=0; for (int j=0; j < 384; j++) { - uint32_t *fb = &bitmap.pix32(j); + uint32_t *fb = &bitmap.pix(j); for (int i=0; i < 512; i++) { uint8_t p = m_texture[ii++]; diff --git a/src/mame/drivers/rotaryf.cpp b/src/mame/drivers/rotaryf.cpp index 2b288225fd6..fd7da906eda 100644 --- a/src/mame/drivers/rotaryf.cpp +++ b/src/mame/drivers/rotaryf.cpp @@ -166,24 +166,20 @@ TIMER_DEVICE_CALLBACK_MEMBER(rotaryf_state::rotaryf_interrupt) uint32_t rotaryf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - pen_t pens[2]; - pens[0] = rgb_t::black(); - pens[1] = rgb_t::white(); - uint8_t i,x,y,data; + pen_t const pens[2] = { rgb_t::black(), rgb_t::white() }; - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - x = offs << 3; - y = offs >> 5; - data = m_videoram[offs]; + uint8_t x = offs << 3; + uint8_t y = offs >> 5; + uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) { if (m_flipscreen) - bitmap.pix32(255-y, 247-(x|i)) = pens[data & 1]; + bitmap.pix(255-y, 247-(x|i)) = pens[data & 1]; else - bitmap.pix32(y, x|i) = pens[data & 1]; + bitmap.pix(y, x|i) = pens[data & 1]; data >>= 1; } diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp index d6d9188f32e..4bee2a01fbc 100644 --- a/src/mame/drivers/roul.cpp +++ b/src/mame/drivers/roul.cpp @@ -255,10 +255,9 @@ void roul_state::video_start() uint32_t roul_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i,j; - for (i = 0; i < 256; i++) - for (j = 0; j < 256; j++) - bitmap.pix16(j, i) = m_videobuf[j * 256 + 255 - i]; + for (int i = 0; i < 256; i++) + for (int j = 0; j < 256; j++) + bitmap.pix(j, i) = m_videobuf[j * 256 + 255 - i]; return 0; } diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp index 7fcb6e4df24..6cc15457f04 100644 --- a/src/mame/drivers/royalmah.cpp +++ b/src/mame/drivers/royalmah.cpp @@ -441,7 +441,7 @@ uint32_t royalmah_state::screen_update_royalmah(screen_device &screen, bitmap_rg { uint8_t pen = ((data2 >> 1) & 0x08) | ((data2 << 2) & 0x04) | ((data1 >> 3) & 0x02) | ((data1 >> 0) & 0x01); - bitmap.pix32(y, x) = m_palette->pen((m_palette_base << 4) | pen); + bitmap.pix(y, x) = m_palette->pen((m_palette_base << 4) | pen); x = (m_flip_screen) ? x - 1 : x + 1; data1 = data1 >> 1; diff --git a/src/mame/drivers/rt1715.cpp b/src/mame/drivers/rt1715.cpp index 271d03ded1c..8e7c10ca402 100644 --- a/src/mame/drivers/rt1715.cpp +++ b/src/mame/drivers/rt1715.cpp @@ -424,7 +424,7 @@ WRITE_LINE_MEMBER(rt1715_state::crtc_drq_w) I8275_DRAW_CHARACTER_MEMBER(rt1715_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = (lten) ? 0xff : 0; if (!vsp) @@ -434,7 +434,7 @@ I8275_DRAW_CHARACTER_MEMBER(rt1715_state::crtc_display_pixels) gfx ^= 0xff; for (u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/rx78.cpp b/src/mame/drivers/rx78.cpp index dcc51357c52..0fb4bb262e3 100644 --- a/src/mame/drivers/rx78.cpp +++ b/src/mame/drivers/rx78.cpp @@ -160,7 +160,7 @@ uint32_t rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, color |= ((pen[2] & 1) << 2); if(color) - bitmap.pix16(y+bordery, x+i+borderx) = color | 8; + bitmap.pix(y+bordery, x+i+borderx) = color | 8; /* fg color */ pen[0] = (m_pri_mask & 0x01) ? (m_vram[count + 0x0000] >> (i)) : 0x00; @@ -172,7 +172,7 @@ uint32_t rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, color |= ((pen[2] & 1) << 2); if(color) - bitmap.pix16(y+bordery, x+i+borderx) = color; + bitmap.pix(y+bordery, x+i+borderx) = color; } count++; } diff --git a/src/mame/drivers/rz1.cpp b/src/mame/drivers/rz1.cpp index c90929eca84..2bd594b568b 100644 --- a/src/mame/drivers/rz1.cpp +++ b/src/mame/drivers/rz1.cpp @@ -206,7 +206,7 @@ HD44780_PIXEL_UPDATE( rz1_state::lcd_pixel_update ) return; if (line < 1 && pos < 16) - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } uint8_t rz1_state::upd934g_c_data_r(offs_t offset) diff --git a/src/mame/drivers/saitek_intchess.cpp b/src/mame/drivers/saitek_intchess.cpp index 7a65f4aa0f7..3e7d65bf3f8 100644 --- a/src/mame/drivers/saitek_intchess.cpp +++ b/src/mame/drivers/saitek_intchess.cpp @@ -136,7 +136,7 @@ u32 intchess_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c // draw chessboard background for (int y = cliprect.top(); y <= cliprect.bottom(); y++) for (int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix16(y, x) = ((x / 20) ^ (y / 16)) << 1 & 2; + bitmap.pix(y, x) = ((x / 20) ^ (y / 16)) << 1 & 2; // draw the sprites for (int i = 0; i < 64; i++) diff --git a/src/mame/drivers/saitek_risc2500.cpp b/src/mame/drivers/saitek_risc2500.cpp index 1126bfb9e94..6ac03d1ae67 100644 --- a/src/mame/drivers/saitek_risc2500.cpp +++ b/src/mame/drivers/saitek_risc2500.cpp @@ -119,7 +119,7 @@ uint32_t risc2500_state::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t gfx = bitswap<8>(m_vram[c*5 + x], 6,5,0,1,2,3,4,7); for(int y=0; y<7; y++) - bitmap.pix16(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; + bitmap.pix(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; } // LCD digits and symbols diff --git a/src/mame/drivers/samcoupe.cpp b/src/mame/drivers/samcoupe.cpp index 6f9032e9052..d6d86d434b2 100644 --- a/src/mame/drivers/samcoupe.cpp +++ b/src/mame/drivers/samcoupe.cpp @@ -383,15 +383,15 @@ uint32_t samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitm void samcoupe_state::draw_mode4_line(int y, int hpos) { /* get start address */ - uint8_t *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + uint8_t const *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 2 pixels (doublewidth) */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; /* move to next address */ vram++; @@ -405,15 +405,15 @@ void samcoupe_state::draw_mode4_line(int y, int hpos) void samcoupe_state::draw_mode3_line(int y, int hpos) { /* get start address */ - uint8_t *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + uint8_t const *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 4 pixels */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; /* move to next address */ vram++; @@ -433,8 +433,8 @@ void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, /* draw block of 8 pixels (doubled to 16) */ for (int i = 0; i < SAM_BLOCK; i++) { - bitmap.pix16(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; - bitmap.pix16(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; } } diff --git a/src/mame/drivers/sapi1.cpp b/src/mame/drivers/sapi1.cpp index 0dd6efdc9c2..ef319a6012b 100644 --- a/src/mame/drivers/sapi1.cpp +++ b/src/mame/drivers/sapi1.cpp @@ -383,24 +383,20 @@ INPUT_PORTS_END uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool val; - uint16_t addr,xpos; - uint8_t chr,attr,ra,x,y,b; - - for(y = 0; y < 24; y++ ) + for(uint8_t y = 0; y < 24; y++ ) { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) + uint16_t addr = y*64; + uint16_t xpos = 0; + for(uint8_t x = 0; x < 40; x++ ) { - chr = m_p_videoram[addr + x]; - attr = (chr >> 6) & 3; + uint8_t chr = m_p_videoram[addr + x]; + uint8_t attr = (chr >> 6) & 3; chr &= 0x3f; - for(ra = 0; ra < 9; ra++ ) + for(uint8_t ra = 0; ra < 9; ra++ ) { - for(b = 0; b < 6; b++ ) + for(uint8_t b = 0; b < 6; b++ ) { - val = 0; + bool val = 0; if (ra==8) { @@ -416,12 +412,12 @@ uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bi if(attr==3) { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + bitmap.pix(y*9+ra, xpos+2*b ) = val; + bitmap.pix(y*9+ra, xpos+2*b+1 ) = val; } else { - bitmap.pix16(y*9+ra, xpos+b ) = val; + bitmap.pix(y*9+ra, xpos+b ) = val; } } } @@ -436,26 +432,22 @@ uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bi // The attributes seem to be different on this one, they need to be understood, so disabled for now uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool val; - uint16_t addr,xpos; - uint8_t chr,attr,ra,x,y,b; - - for(y = 0; y < 20; y++ ) + for(uint8_t y = 0; y < 20; y++ ) { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) + uint16_t addr = y*64; + uint16_t xpos = 0; + for(uint8_t x = 0; x < 40; x++ ) { - chr = m_p_videoram[addr + x]; - attr = 0;//(chr >> 6) & 3; + uint8_t chr = m_p_videoram[addr + x]; + uint8_t attr = 0;//(chr >> 6) & 3; if (chr > 0x3f) chr &= 0x1f; - for(ra = 0; ra < 9; ra++ ) + for(uint8_t ra = 0; ra < 9; ra++ ) { - for(b = 0; b < 6; b++ ) + for(uint8_t b = 0; b < 6; b++ ) { - val = 0; + bool val = 0; if (ra==8) { @@ -471,12 +463,12 @@ uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bi if(attr==3) { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + bitmap.pix(y*9+ra, xpos+2*b ) = val; + bitmap.pix(y*9+ra, xpos+2*b+1 ) = val; } else { - bitmap.pix16(y*9+ra, xpos+b ) = val; + bitmap.pix(y*9+ra, xpos+b ) = val; } } } @@ -490,17 +482,15 @@ uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bi MC6845_UPDATE_ROW( sapi_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = gfx = 0; + uint8_t inv = 0, gfx = 0; if (x == cursor_x) inv ^= 0xff; - mem = (2*(ma + x)) & 0xfff; - chr = m_p_videoram[mem] & 0x3f; + uint16_t mem = (2*(ma + x)) & 0xfff; + uint8_t chr = m_p_videoram[mem] & 0x3f; if (ra < 8) gfx = MHB2501[(chr<<3) | ra] ^ inv; diff --git a/src/mame/drivers/sbowling.cpp b/src/mame/drivers/sbowling.cpp index 8e279a63412..96afdf9cba8 100644 --- a/src/mame/drivers/sbowling.cpp +++ b/src/mame/drivers/sbowling.cpp @@ -116,7 +116,7 @@ static void plot_pixel_sbw(bitmap_ind16 *tmpbitmap, int x, int y, int col, int f x = 255 - x; } - tmpbitmap->pix16(y, x) = col; + tmpbitmap->pix(y, x) = col; } void sbowling_state::videoram_w(offs_t offset, uint8_t data) diff --git a/src/mame/drivers/sbrain.cpp b/src/mame/drivers/sbrain.cpp index 19fa3f5d163..d1bdf6adeed 100644 --- a/src/mame/drivers/sbrain.cpp +++ b/src/mame/drivers/sbrain.cpp @@ -624,8 +624,7 @@ u32 sbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con return 0; } - u8 y,ra,chr,gfx; - uint16_t sy=0,x; + uint16_t sy=0; // Where attributes come from: // - Most systems use ram for character-based attributes, but this one uses strictly hardware which would seem cumbersome @@ -639,18 +638,18 @@ u32 sbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con uint16_t ma = m_crtc->top_of_page(); uint16_t cr = m_crtc->cursor_address(); uint8_t *videoram = &m_ram->pointer()[m_ram->size() - 0x800]; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra > 0) { - chr = videoram[(x + ma) & 0x7ff]; + uint8_t chr = videoram[(x + ma) & 0x7ff]; if (!BIT(chr, 7) || BIT(m_framecnt, 5)) { diff --git a/src/mame/drivers/scopus.cpp b/src/mame/drivers/scopus.cpp index 8ec7a778a4b..373e23dafaa 100644 --- a/src/mame/drivers/scopus.cpp +++ b/src/mame/drivers/scopus.cpp @@ -94,11 +94,10 @@ GFXDECODE_END I8275_DRAW_CHARACTER_MEMBER(sagitta180_state::crtc_display_pixels) { - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; - uint8_t pixels; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + uint8_t pixels; if (lten) { pixels = ~0; } else if (vsp != 0 || (linecount & 8) != 0) { @@ -111,8 +110,8 @@ I8275_DRAW_CHARACTER_MEMBER(sagitta180_state::crtc_display_pixels) pixels = ~pixels; } - for (i = 0; i < 7; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (7 - i))) != 0 ]; + for (unsigned i = 0; i < 7; i++) { + bitmap.pix(y, x + i) = palette[ BIT(pixels, 7 - i) ]; } } diff --git a/src/mame/drivers/scv.cpp b/src/mame/drivers/scv.cpp index 3a69a469bee..e9079dd40d7 100644 --- a/src/mame/drivers/scv.cpp +++ b/src/mame/drivers/scv.cpp @@ -300,16 +300,16 @@ inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, uint8_t x, uint8_ x -= 4; if (pat & 0x08) - bitmap.pix16(y + 2, x) = col; + bitmap.pix(y + 2, x) = col; if (pat & 0x04 && x < 255 ) - bitmap.pix16(y + 2, x + 1) = col; + bitmap.pix(y + 2, x + 1) = col; if (pat & 0x02 && x < 254) - bitmap.pix16(y + 2, x + 2) = col; + bitmap.pix(y + 2, x + 2) = col; if (pat & 0x01 && x < 253) - bitmap.pix16(y + 2, x + 3) = col; + bitmap.pix(y + 2, x + 3) = col; } } @@ -354,32 +354,30 @@ inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, inline void scv_state::draw_text( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t *char_data, uint8_t fg, uint8_t bg ) { - int i; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - uint8_t d = char_data[i]; - - bitmap.pix16(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; - bitmap.pix16(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; - bitmap.pix16(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; - bitmap.pix16(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; - bitmap.pix16(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; - bitmap.pix16(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; - bitmap.pix16(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; - bitmap.pix16(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; + uint8_t const d = char_data[i]; + + bitmap.pix(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; + bitmap.pix(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; + bitmap.pix(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; + bitmap.pix(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; + bitmap.pix(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; + bitmap.pix(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; + bitmap.pix(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; + bitmap.pix(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; } - for ( i = 8; i < 16; i++ ) + for ( int i = 8; i < 16; i++ ) { - bitmap.pix16(y + i, x + 0 ) = bg; - bitmap.pix16(y + i, x + 1 ) = bg; - bitmap.pix16(y + i, x + 2 ) = bg; - bitmap.pix16(y + i, x + 3 ) = bg; - bitmap.pix16(y + i, x + 4 ) = bg; - bitmap.pix16(y + i, x + 5 ) = bg; - bitmap.pix16(y + i, x + 6 ) = bg; - bitmap.pix16(y + i, x + 7 ) = bg; + bitmap.pix(y + i, x + 0 ) = bg; + bitmap.pix(y + i, x + 1 ) = bg; + bitmap.pix(y + i, x + 2 ) = bg; + bitmap.pix(y + i, x + 3 ) = bg; + bitmap.pix(y + i, x + 4 ) = bg; + bitmap.pix(y + i, x + 5 ) = bg; + bitmap.pix(y + i, x + 6 ) = bg; + bitmap.pix(y + i, x + 7 ) = bg; } } @@ -387,35 +385,31 @@ inline void scv_state::draw_text( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, ui inline void scv_state::draw_semi_graph( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t data, uint8_t fg ) { - int i; - if ( ! data ) return; - for ( i = 0; i < 4; i++ ) + for ( int i = 0; i < 4; i++ ) { - bitmap.pix16(y + i, x + 0) = fg; - bitmap.pix16(y + i, x + 1) = fg; - bitmap.pix16(y + i, x + 2) = fg; - bitmap.pix16(y + i, x + 3) = fg; + bitmap.pix(y + i, x + 0) = fg; + bitmap.pix(y + i, x + 1) = fg; + bitmap.pix(y + i, x + 2) = fg; + bitmap.pix(y + i, x + 3) = fg; } } inline void scv_state::draw_block_graph( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t col ) { - int i; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - bitmap.pix16(y + i, x + 0) = col; - bitmap.pix16(y + i, x + 1) = col; - bitmap.pix16(y + i, x + 2) = col; - bitmap.pix16(y + i, x + 3) = col; - bitmap.pix16(y + i, x + 4) = col; - bitmap.pix16(y + i, x + 5) = col; - bitmap.pix16(y + i, x + 6) = col; - bitmap.pix16(y + i, x + 7) = col; + bitmap.pix(y + i, x + 0) = col; + bitmap.pix(y + i, x + 1) = col; + bitmap.pix(y + i, x + 2) = col; + bitmap.pix(y + i, x + 3) = col; + bitmap.pix(y + i, x + 4) = col; + bitmap.pix(y + i, x + 5) = col; + bitmap.pix(y + i, x + 6) = col; + bitmap.pix(y + i, x + 7) = col; } } diff --git a/src/mame/drivers/scyclone.cpp b/src/mame/drivers/scyclone.cpp index cedb403dc5d..113d0d23104 100644 --- a/src/mame/drivers/scyclone.cpp +++ b/src/mame/drivers/scyclone.cpp @@ -234,9 +234,9 @@ uint32_t scyclone_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bit if (y == star && star != 0 && noclipped) - bitmap.pix32(ypos, x) = paldata[7]; + bitmap.pix(ypos, x) = paldata[7]; else - bitmap.pix32(ypos, x) = paldata[0]; + bitmap.pix(ypos, x) = paldata[0]; } } } @@ -273,13 +273,13 @@ uint32_t scyclone_state::draw_bitmap_and_sprite(screen_device &screen, bitmap_rg uint8_t pal = get_bitmap_pixel(realx, realy); - if (pal) bitmap.pix32(y, (x*8)+i) = paldata[pal]; + if (pal) bitmap.pix(y, (x*8)+i) = paldata[pal]; uint8_t pal2 = get_sprite_pixel(realx, realy); if (pal2 & 0x3) { - bitmap.pix32(y, (x*8)+i) = paldata[8+pal2]; + bitmap.pix(y, (x*8)+i) = paldata[8+pal2]; if (pal == 0x7) m_hascollided = 1; } } diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp index 0ef43817215..c9556c8abe3 100644 --- a/src/mame/drivers/seabattl.cpp +++ b/src/mame/drivers/seabattl.cpp @@ -160,14 +160,12 @@ void seabattl_state::seabattl_colorram_w(offs_t offset, uint8_t data) uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y, offset; - // wave if ( m_waveenable ) { - for ( y = 0; y < 32; y++ ) + for ( int y = 0; y < 32; y++ ) { - for ( x = 0; x < 32; x++ ) + for ( int x = 0; x < 32; x++ ) { m_gfxdecode->gfx(2)->opaque(bitmap,cliprect, (y & 0x0f) + (((x & 0x0f) + ((screen.frame_number() & 0xe0) >> 4)) << 4), 0, 0, 0, x*8, y*8 ); } @@ -183,7 +181,7 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in m_bg_tilemap->draw(screen, m_collision_bg, cliprect, TILEMAP_DRAW_OPAQUE, 0); // sprites (m.obj) - for ( offset = 0; offset < 256; offset++ ) + for ( int offset = 0; offset < 256; offset++ ) { // bits 0-3: sprite num // bits 4-7: x coordinate @@ -200,15 +198,15 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in bitmap_ind16 const &s2636_0_bitmap = m_s2636->update(cliprect); // collisions - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { // bit 0: m.obj - pvi-bkg // bit 1: pvi-bkg - scr.sm.obj // bit 2: m.obj - scr.sm.obj bool obj = (bitmap.pix(y,x) > 0) && (bitmap.pix(y,x) < 8); - bool pvi = S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix16(y, x)); + bool pvi = S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix(y, x)); bool scr = (m_collision_bg.pix(y,x) & 1) != 0; if (obj && pvi) @@ -223,14 +221,14 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in } // s2636 layer - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int pixel = s2636_0_bitmap.pix16(y, x); + int pixel = s2636_0_bitmap.pix(y, x); if (S2636_IS_PIXEL_DRAWN(pixel)) { - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel); } } } diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp index dda7283b45f..15fb868b587 100644 --- a/src/mame/drivers/segac2.cpp +++ b/src/mame/drivers/segac2.cpp @@ -1513,10 +1513,8 @@ uint32_t segac2_state::screen_update_segac2_new(screen_device &screen, bitmap_rg /* Copy our screen buffer here */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t* desty = &bitmap.pix32(y, 0); - uint16_t* srcy; - - srcy = m_vdp->m_render_line_raw.get(); + uint32_t *const desty = &bitmap.pix(y, 0); + uint16_t const *const srcy = m_vdp->m_render_line_raw.get(); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 1ab6b3be2f9..e9d547ebe07 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -858,16 +858,16 @@ INPUT_PORTS_END uint32_t systeme_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - bitmap_rgb32 &vdp1_bitmap = m_vdp1->get_bitmap(); - bitmap_rgb32 &vdp2_bitmap = m_vdp2->get_bitmap(); - bitmap_ind8 &vdp2_y1 = m_vdp2->get_y1_bitmap(); + bitmap_rgb32 const &vdp1_bitmap = m_vdp1->get_bitmap(); + bitmap_rgb32 const &vdp2_bitmap = m_vdp2->get_bitmap(); + bitmap_ind8 const &vdp2_y1 = m_vdp2->get_y1_bitmap(); for( int y = cliprect.min_y; y <= cliprect.max_y; y++ ) { - uint32_t *dest_ptr = &bitmap.pix32(y); - uint32_t *vdp1_ptr = &vdp1_bitmap.pix32(y); - uint32_t *vdp2_ptr = &vdp2_bitmap.pix32(y); - uint8_t *y1_ptr = &vdp2_y1.pix8(y); + uint32_t *const dest_ptr = &bitmap.pix(y); + uint32_t const *const vdp1_ptr = &vdp1_bitmap.pix(y); + uint32_t const *const vdp2_ptr = &vdp2_bitmap.pix(y); + uint8_t const *const y1_ptr = &vdp2_y1.pix(y); for ( int x = cliprect.min_x; x <= cliprect.max_x; x++ ) { diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp index 6450e7079d1..0f582a324d8 100644 --- a/src/mame/drivers/sfbonus.cpp +++ b/src/mame/drivers/sfbonus.cpp @@ -1036,17 +1036,15 @@ uint32_t sfbonus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* render reels to bitmap */ draw_reel_layer(screen,*m_temp_reel_bitmap,cliprect,0); + for (int y = 0; y < 288; y++) { - for (int y = 0; y < 288; y++) + uint16_t const *const src = &m_temp_reel_bitmap->pix(y); + uint16_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 512; x++) { - for (int x = 0; x < 512; x++) - { - uint16_t* src = &m_temp_reel_bitmap->pix16(y, x); - uint16_t* dst = &bitmap.pix16(y, x); - - if ((src[0]&0x100)==0x000) - dst[0] = src[0]; - } + if ((src[x]&0x100)==0x000) + dst[x] = src[x]; } } @@ -1059,17 +1057,15 @@ uint32_t sfbonus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } m_tilemap->draw(screen, bitmap, cliprect, 0,0); + for (int y = 0; y < 288; y++) { - for (int y = 0; y < 288; y++) + uint16_t const *const src = &m_temp_reel_bitmap->pix(y); + uint16_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 512; x++) { - for (int x = 0; x < 512; x++) - { - uint16_t* src = &m_temp_reel_bitmap->pix16(y, x); - uint16_t* dst = &bitmap.pix16(y, x); - - if ((src[0]&0x100)==0x100) - dst[0] = src[0]-0x100; - } + if ((src[x]&0x100)==0x100) + dst[x] = src[x]-0x100; } } #if 0 diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp index 625c19ff817..4dc39adc9fb 100644 --- a/src/mame/drivers/shougi.cpp +++ b/src/mame/drivers/shougi.cpp @@ -217,7 +217,7 @@ uint32_t shougi_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap color= ((data1>>x) & 1) | (((data1>>(4+x)) & 1)<<1); data = ((data2>>x) & 1) | (((data2>>(4+x)) & 1)<<1); - bitmap.pix16(255-sy, 255-(sx*4 + x)) = color*4 + data; + bitmap.pix(255-sy, 255-(sx*4 + x)) = color*4 + data; } } diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp index 99fdfb37bbd..0ec089f9b74 100644 --- a/src/mame/drivers/sigmab98.cpp +++ b/src/mame/drivers/sigmab98.cpp @@ -528,8 +528,8 @@ void sigmab98_base_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl dstdyy /= 2; // Transform the source image while drawing to the screen - uint16_t *src = &m_sprite_bitmap->pix16(0); - uint16_t *dst = &bitmap.pix16(0); + uint16_t const *const src = &m_sprite_bitmap->pix(0); + uint16_t *const dst = &bitmap.pix(0); int src_rowpixels = m_sprite_bitmap->rowpixels(); int dst_rowpixels = bitmap.rowpixels(); diff --git a/src/mame/drivers/sk101bl.cpp b/src/mame/drivers/sk101bl.cpp index 0e60fa81c86..8abd709bea2 100644 --- a/src/mame/drivers/sk101bl.cpp +++ b/src/mame/drivers/sk101bl.cpp @@ -87,7 +87,7 @@ void sk101bl_state::machine_reset() HD44780_PIXEL_UPDATE(sk101bl_state::pixel_update) { if (pos < 16 && line == 0) - bitmap.pix16(line * 10 + y, pos * 6 + x) = state; + bitmap.pix(line * 10 + y, pos * 6 + x) = state; } u8 sk101bl_state::p1_r() diff --git a/src/mame/drivers/skeetsht.cpp b/src/mame/drivers/skeetsht.cpp index 4ffb1851f85..1d468709110 100644 --- a/src/mame/drivers/skeetsht.cpp +++ b/src/mame/drivers/skeetsht.cpp @@ -90,13 +90,12 @@ void skeetsht_state::video_start() TMS340X0_SCANLINE_RGB32_CB_MEMBER(skeetsht_state::scanline_update) { - const pen_t *const pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); uint16_t *vram = &m_tms_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint32_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/skimaxx.cpp b/src/mame/drivers/skimaxx.cpp index f50ead130f9..d7d4b13cb00 100644 --- a/src/mame/drivers/skimaxx.cpp +++ b/src/mame/drivers/skimaxx.cpp @@ -224,9 +224,9 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(skimaxx_state::scanline_update) if (params->rowaddr >= 0x220) { u32 const rowaddr = (params->rowaddr - 0x220); - u16 *fg = &m_fg_buffer[rowaddr << 8]; - u32 *bg = &m_bg_buffer_front[rowaddr/2 * 1024/2]; - u16 *dest = &bitmap.pix16(scanline); + u16 const *fg = &m_fg_buffer[rowaddr << 8]; + u32 const *bg = &m_bg_buffer_front[rowaddr/2 * 1024/2]; + u16 *dest = &bitmap.pix(scanline); //int coladdr = params->coladdr; //coladdr = 0; diff --git a/src/mame/drivers/sliver.cpp b/src/mame/drivers/sliver.cpp index 9aec09572d3..13110011ade 100644 --- a/src/mame/drivers/sliver.cpp +++ b/src/mame/drivers/sliver.cpp @@ -169,21 +169,19 @@ void sliver_state::plot_pixel_rgb(int x, int y, uint32_t r, uint32_t g, uint32_t if (y < 0 || x < 0 || x > 383 || y > 255) return; - m_bitmap_bg.pix32(y, x) = r | (g<<8) | (b<<16); + m_bitmap_bg.pix(y, x) = r | (g<<8) | (b<<16); } void sliver_state::plot_pixel_pal(int x, int y, int addr) { - uint32_t r,g,b; - if (y < 0 || x < 0 || x > 383 || y > 255) return; - b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3); - g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3); - r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3); + uint32_t b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3); + uint32_t g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3); + uint32_t r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3); - m_bitmap_fg.pix32(y, x) = r | (g<<8) | (b<<16); + m_bitmap_fg.pix(y, x) = r | (g<<8) | (b<<16); } void sliver_state::fifo_data_w(offs_t offset, uint16_t data, uint16_t mem_mask) diff --git a/src/mame/drivers/slotcarn.cpp b/src/mame/drivers/slotcarn.cpp index 937273676ac..436dae1b6f0 100644 --- a/src/mame/drivers/slotcarn.cpp +++ b/src/mame/drivers/slotcarn.cpp @@ -115,28 +115,23 @@ MC6845_UPDATE_ROW( slotcarn_state::crtc_update_row ) int extra_video_bank_bit = 0; // not used? int lscnblk = 0; // not used? - uint8_t *gfx[2]; uint16_t x = 0; - int rlen; - gfx[0] = memregion("gfx1")->base(); - gfx[1] = memregion("gfx2")->base(); - rlen = memregion("gfx2")->bytes(); + uint8_t const *const gfx[2] = { memregion("gfx1")->base(), memregion("gfx2")->base() }; + int const rlen = memregion("gfx2")->bytes(); //ma = ma ^ 0x7ff; for (uint8_t cx = 0; cx < x_count; cx++) { - int i; int attr = m_ram_attr[ma & 0x7ff]; int region = (attr & 0x40) >> 6; int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f); int colour = (attr & 0x7f) << 3; - uint8_t *data; addr &= (rlen-1); - data = gfx[region]; + uint8_t const *const data = gfx[region]; - for (i = 7; i>=0; i--) + for (int i = 7; i>=0; i--) { int col = colour; @@ -150,7 +145,7 @@ MC6845_UPDATE_ROW( slotcarn_state::crtc_update_row ) col |= 0x03; col = m_ram_palette[col & 0x3ff]; - bitmap.pix32(y, x) = m_pens[col ? col & (NUM_PENS-1) : (lscnblk ? 8 : 0)]; + bitmap.pix(y, x) = m_pens[col ? col & (NUM_PENS-1) : (lscnblk ? 8 : 0)]; x++; } diff --git a/src/mame/drivers/sm1800.cpp b/src/mame/drivers/sm1800.cpp index 342991fa81c..949ceb2f7c2 100644 --- a/src/mame/drivers/sm1800.cpp +++ b/src/mame/drivers/sm1800.cpp @@ -99,9 +99,8 @@ INTERRUPT_GEN_MEMBER(sm1800_state::vblank_interrupt) I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charmap = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charmap = memregion("chargen")->base(); uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; @@ -112,8 +111,8 @@ I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - for(i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + for(int i=0;i<8;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } void sm1800_state::portb_w(uint8_t data) diff --git a/src/mame/drivers/sm7238.cpp b/src/mame/drivers/sm7238.cpp index 636ad4e0c7b..037dbee0c1f 100644 --- a/src/mame/drivers/sm7238.cpp +++ b/src/mame/drivers/sm7238.cpp @@ -228,30 +228,30 @@ void sm7238_state::recompute_parameters() uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx, fg, bg, attr, ctl1, ctl2 = 0; - uint16_t chr, chraddr, sy = 0, ma = 0, x = 0; - bool double_width = false, double_height = false, bottom_half = false; - bool blink((m_screen->frame_number() % 30) > 14); // XXX guess - if (!BIT(m_video.control, 3)) { bitmap.fill(0); return 0; } - for (y = 0; y < 26; y++) + uint8_t ctl2 = 0; + uint16_t sy = 0, ma = 0; + bool double_width = false, double_height = false, bottom_half = false; + bool blink((m_screen->frame_number() % 30) > 14); // XXX guess + + for (uint8_t y = 0; y < 26; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { if (y == 1 && ctl2 && ra < ctl2) continue; - uint16_t *p = &bitmap.pix16(sy++, 0); + uint16_t *p = &bitmap.pix(sy++, 0); - for (x = ma; x < ma + m_video.stride; x++) + for (uint16_t x = ma; x < ma + m_video.stride; x++) { - chr = m_p_videoram[x] << 4; - attr = m_p_videoram[x + 0x1000]; + uint16_t chr = m_p_videoram[x] << 4; + uint8_t const attr = m_p_videoram[x + 0x1000]; // alternate font 1 if (BIT(attr, 6)) @@ -259,9 +259,10 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap chr += 0x1000; } - bg = 0; - fg = 1; + uint8_t bg = 0; + uint8_t fg = 1; + uint16_t chraddr; if (double_height) { chraddr = chr | (bottom_half ? (5 + (ra >> 1)) : (ra >> 1)); @@ -272,6 +273,7 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } // alternate font 2 (downloadable font) -- only in models .05 and .06 + uint8_t gfx; if (BIT(attr, 7) && m_p_charram[chr + 15]) { gfx = m_p_charram[chraddr] ^ 255; @@ -318,7 +320,7 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (double_width) x++; } } - ctl1 = m_p_videoram[ma + 0x1000 + m_video.stride]; + uint8_t const ctl1 = m_p_videoram[ma + 0x1000 + m_video.stride]; double_width = BIT(ctl1, 6); double_height = BIT(ctl1, 7); bottom_half = BIT(ctl1, 5); diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp index ab95effa741..980990dc82d 100644 --- a/src/mame/drivers/smc777.cpp +++ b/src/mame/drivers/smc777.cpp @@ -164,47 +164,44 @@ void smc777_state::video_start() uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,yi; uint16_t count; - int x_width; // popmessage("%d %d %d %d",mc6845_v_char_total,mc6845_v_total_adj,mc6845_v_display,mc6845_v_sync_pos); bitmap.fill(m_palette->pen(m_backdrop_pen), cliprect); - x_width = ((m_display_reg & 0x80) >> 7); + int x_width = ((m_display_reg & 0x80) >> 7); count = 0x0000; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(y=0;y<200;y+=8) + for(int y=0;y<200;y+=8) { - for(x=0;x<160;x++) + for(int x=0;x<160;x++) { - uint16_t color; + uint16_t color = (m_gvram[count] & 0xf0) >> 4; - color = (m_gvram[count] & 0xf0) >> 4; /* todo: clean this up! */ //if(x_width) { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); } //else //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); + // bitmap.pix(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); //} color = (m_gvram[count] & 0x0f) >> 0; //if(x_width) { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); } //else //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); + // bitmap.pix(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); //} count++; @@ -216,9 +213,9 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 count = 0x0000; - for(y=0;y<25;y++) + for(int y=0;y<25;y++) { - for(x=0;x<80/(x_width+1);x++) + for(int x=0;x<80/(x_width+1);x++) { /* -x-- ---- blink @@ -229,11 +226,9 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 int color = m_attr[count] & 7; int bk_color = (m_attr[count] & 0x18) >> 3; int blink = m_attr[count] & 0x40; - int xi; - int bk_pen; //int bk_struct[4] = { -1, 0x10, 0x11, (color & 7) ^ 8 }; - bk_pen = -1; + int bk_pen = -1; switch(bk_color & 3) { case 0: bk_pen = -1; break; //transparent @@ -245,23 +240,21 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 if(blink && m_screen->frame_number() & 0x10) //blinking, used by Dragon's Alphabet color = bk_pen; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; + int pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; if (pen != -1) { if(x_width) { - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); } else - bitmap.pix16(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); } } } @@ -269,9 +262,7 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 // draw cursor if(mc6845_cursor_addr == count) { - int xc,yc,cursor_on; - - cursor_on = 0; + int cursor_on = 0; switch(mc6845_cursor_y_start & 0x60) { case 0x00: cursor_on = 1; break; //always on @@ -282,17 +273,17 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 if(cursor_on) { - for(yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) + for(int yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) { - for(xc=0;xc<8;xc++) + for(int xc=0;xc<8;xc++) { if(x_width) { - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); } else - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); } } } diff --git a/src/mame/drivers/smotor.cpp b/src/mame/drivers/smotor.cpp index 0479bb8b41b..7bca82cc50d 100644 --- a/src/mame/drivers/smotor.cpp +++ b/src/mame/drivers/smotor.cpp @@ -233,7 +233,7 @@ uint32_t smotor_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_bg_tilemap->set_scrolly((m_videoreg[3] + (m_videoreg[5] << 8))); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); } else { - bitmap.fill(rgb_t::black(), cliprect); + bitmap.fill(0, cliprect); } m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); diff --git a/src/mame/drivers/smsmcorp.cpp b/src/mame/drivers/smsmcorp.cpp index c89f7cfce31..d67da1b4289 100644 --- a/src/mame/drivers/smsmcorp.cpp +++ b/src/mame/drivers/smsmcorp.cpp @@ -448,7 +448,6 @@ void smsmfg_state::video_w(offs_t offset, uint8_t data) m_vid_regs[offset] = data; if ( offset == 5 ) { - int x,y; int xstart = m_vid_regs[0] + m_vid_regs[1]*256; int width = m_vid_regs[2]; int ystart = m_vid_regs[3]; @@ -461,12 +460,12 @@ void smsmfg_state::video_w(offs_t offset, uint8_t data) if ( width == 0 ) width = 256; - for ( y = ystart; y < ystart + height; y++ ) + for ( int y = ystart; y < ystart + height; y++ ) { - for ( x = xstart; x < xstart + width; x++ ) + for ( int x = xstart; x < xstart + width; x++ ) { if ( y < 256 ) - m_bitmap.pix16(y, x) = color; + m_bitmap.pix(y, x) = color; } } } diff --git a/src/mame/drivers/socrates.cpp b/src/mame/drivers/socrates.cpp index 768feeac3a2..4c2da8d187e 100644 --- a/src/mame/drivers/socrates.cpp +++ b/src/mame/drivers/socrates.cpp @@ -809,36 +809,33 @@ void socrates_state::video_start() uint32_t socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - static const uint8_t fixedcolors[8] = - { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 - }; - uint8_t *videoram = m_vram_reg->base(); - int x, y, colidx, color; + static const uint8_t fixedcolors[8] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 }; + uint8_t const *const videoram = m_vram_reg->base(); int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000 - for (y = 0; y < 228; y++) + for (int y = 0; y < 228; y++) { if ((((y+m_scroll_offset)*128)&0xffff) >= 0xf000) lineoffset = 0x1000; // see comment above - for (x = 0; x < 264; x++) + for (int x = 0; x < 264; x++) { + int color; if (x < 256) { - colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; + int colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; if (x&1) colidx >>=4; colidx &= 0xF; if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; } else { - colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; + int colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; colidx >>=4; colidx &= 0xF; if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; } + bitmap.pix(y, x) = color; } } return 0; @@ -898,7 +895,7 @@ uint32_t iqunlimz_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for(int b=0; b<2; b++) { - bitmap.pix16(y, x*2 + b) = get_color(data & 0x0f, y); + bitmap.pix(y, x*2 + b) = get_color(data & 0x0f, y); data >>= 4; } } @@ -932,7 +929,7 @@ uint32_t iqunlimz_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int cx=0; cx<6; cx++) { int px = 8 + x*6 + cx; - bitmap.pix16(py, px) = BIT(data, 7) ? col1 : col0; + bitmap.pix(py, px) = BIT(data, 7) ? col1 : col0; data <<= 1; } } diff --git a/src/mame/drivers/sorcerer.cpp b/src/mame/drivers/sorcerer.cpp index 63b2002ad13..8e507a39ca7 100644 --- a/src/mame/drivers/sorcerer.cpp +++ b/src/mame/drivers/sorcerer.cpp @@ -391,22 +391,20 @@ GFXDECODE_END uint32_t sorcerer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space& program = m_maincpu->space(AS_PROGRAM); - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0xf080,x; - uint16_t *p; + uint16_t sy=0,ma=0xf080; - for (y = 0; y < 30; y++) + for (uint8_t y = 0; y < 30; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+64; x++) + for (uint16_t x = ma; x < ma+64; x++) { - chr = program.read_byte(x); + uint8_t const chr = program.read_byte(x); /* get pattern of pixels for that character scanline */ - gfx = program.read_byte(0xf800 | (chr<<3) | ra); + uint8_t const gfx = program.read_byte(0xf800 | (chr<<3) | ra); /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/spaceg.cpp b/src/mame/drivers/spaceg.cpp index 176219979db..5c8e169c2d0 100644 --- a/src/mame/drivers/spaceg.cpp +++ b/src/mame/drivers/spaceg.cpp @@ -341,18 +341,15 @@ uint8_t spaceg_state::colorram_r(offs_t offset) uint32_t spaceg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; uint8_t data = m_videoram[offs]; int y = offs & 0xff; int x = (offs >> 8) << 3; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix16(y, x) = (data & 0x80) ? m_colorram[offs] : 0; + bitmap.pix(y, x) = (data & 0x80) ? m_colorram[offs] : 0; x++; data <<= 1; diff --git a/src/mame/drivers/spc1500.cpp b/src/mame/drivers/spc1500.cpp index c6732deed1f..8fc2d1eefac 100644 --- a/src/mame/drivers/spc1500.cpp +++ b/src/mame/drivers/spc1500.cpp @@ -523,36 +523,29 @@ MC6845_RECONFIGURE(spc1500_state::crtc_reconfig) MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) { - uint8_t han2; - uint8_t *pf; + uint8_t const *pf; uint16_t hfnt; - int i; - int j; - int h1, h2, h3; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); unsigned char cho[] ={1,1,1,1,1,1,1,1,0,0,1,1,1,3,5,5,0,0,5,3,3,5,5,5,0,0,3,3,5,1}; unsigned char jong[]={0,0,0,1,1,1,1,1,0,0,1,1,1,2,2,2,0,0,2,2,2,2,2,2,0,0,2,2,1,1}; - bool inv = false; char hs = (m_crtc_vreg[0x9] < 15 ? 3 : 4); int n = y & (m_crtc_vreg[0x9]); bool ln400 = (hs == 4 && m_crtc_vreg[0x4] > 20); - uint8_t *vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13]; - for (i = 0; i < x_count; i++) + uint8_t const *const vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13]; + for (int i = 0; i < x_count; i++) { - uint8_t *pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)]; - uint8_t *pv = &vram[(y>>hs)*x_count + i]; + uint8_t const *const pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)]; + uint8_t const *const pv = &vram[(y>>hs)*x_count + i]; uint8_t ascii = *(pv+0x1000); uint8_t attr = *pv; - inv = (attr & 0x8 ? true : false); + bool inv = (attr & 0x8 ? true : false); uint8_t color = attr & 0x7; uint8_t pixelb = *(pp+0); uint8_t pixelr = *(pp+0x4000); uint8_t pixelg = *(pp+0x8000); bool nopalet = ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400); uint8_t pen = (nopalet ? color : m_paltbl[color]); - uint8_t pixelpen = 0; - uint8_t pixel = 0; if (hs == 4 && (ascii & 0x80)) { uint16_t wpixelb = (pixelb << 8) + (*(pp+1)); @@ -560,10 +553,10 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) uint16_t wpixelg = (pixelg << 8) + (*(pp+0x8001)); if (ascii != 0xfa) { - han2 = *(pv+0x1001); - h1 = (ascii>>2)&0x1f; - h2 = ((ascii<<3)|(han2>>5))&0x1f; - h3 = (han2)&0x1f; + uint8_t han2 = *(pv+0x1001); + int h1 = (ascii>>2)&0x1f; + int h2 = ((ascii<<3)|(han2>>5))&0x1f; + int h3 = (han2)&0x1f; pf = &m_font[0x2000+(h1 * 32) + (cho[h2] + (h3 != 0) -1) * 16 * 2 * 32 + n]; hfnt = (*pf << 8) | (*(pf+16)); pf = &m_font[0x4000+(h2 * 32) + (h3 == 0 ? 0 : 1) * 16 * 2 * 32 + n]; @@ -578,26 +571,26 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) hfnt = (*pf << 8) | (*(pf+16)); } hfnt = (inv ? 0xffff - hfnt : hfnt); - for (j = 0x8000; j > 0; j>>=1) + for (int j = 0x8000; j > 0; j>>=1) { - pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0)); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0)); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); *p++ = m_palette->pen(((hfnt & j) || (m_priority & (1<<pixel))) ? pixelpen : pen); } i++; } else if (attr & 0x20) { - uint8_t *pa = &m_pcgram[(ascii*(m_crtc_vreg[0x9]+1))+n]; + uint8_t const *pa = &m_pcgram[(ascii*(m_crtc_vreg[0x9]+1))+n]; uint8_t b = *pa; uint8_t r = *(pa+0x800); uint8_t g = *(pa+0x1000); - for (j = 0x80; j > 0; j>>=1) + for (int j = 0x80; j > 0; j>>=1) { - pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0); + uint8_t pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0); pen = (pixel == 7 ? color : pixel); pixel = (pixelg&j ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); *p++ = m_palette->pen((m_priority & (1<<pixel)) ? pixelpen : pen); } } @@ -609,10 +602,10 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) fnt = 0xff; } fnt = (inv ? 0xff - fnt : fnt); - for (j = 0x80; j > 0; j>>=1) + for (int j = 0x80; j > 0; j>>=1) { - pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); if (ascii == 0 && attr == 0 && !inv) *p++ = m_palette->pen(pixelpen); else diff --git a/src/mame/drivers/special_gambl.cpp b/src/mame/drivers/special_gambl.cpp index b04b71edb2f..f81628ffdd1 100644 --- a/src/mame/drivers/special_gambl.cpp +++ b/src/mame/drivers/special_gambl.cpp @@ -201,9 +201,9 @@ u32 dinaris_state::screen_update_dice(screen_device &screen, bitmap_ind16 &bitma u8 const color1 = m_vram[0x4000 + (y & 0xfe) + x * 256]; u8 const color2 = m_vram[0x4000 + (y | 0x01) + x * 256]; for (int b = 7; b >= 4; b--) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(code, b) ? (color1 & 0xf) : (color1 >> 4); + bitmap.pix(y, x * 8 + (7 - b)) = BIT(code, b) ? (color1 & 0xf) : (color1 >> 4); for (int b = 3; b >= 0; b--) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(code, b) ? (color2 & 0xf) : (color2 >> 4); + bitmap.pix(y, x * 8 + (7 - b)) = BIT(code, b) ? (color2 & 0xf) : (color2 >> 4); } } return 0; diff --git a/src/mame/drivers/speglsht.cpp b/src/mame/drivers/speglsht.cpp index 5ec410fe31a..03e67016e09 100644 --- a/src/mame/drivers/speglsht.cpp +++ b/src/mame/drivers/speglsht.cpp @@ -374,18 +374,16 @@ VIDEO_START_MEMBER(speglsht_state,speglsht) #define PLOT_PIXEL_RGB(x,y,r,g,b) if(y>=0 && x>=0 && x<512 && y<512) \ { \ - bitmap.pix32(y, x) = (b) | ((g)<<8) | ((r)<<16); \ + bitmap.pix(y, x) = (b) | ((g)<<8) | ((r)<<16); \ } uint32_t speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,dy; + int dy=(m_videoreg&0x20)?(256*512):0; //visible frame - dy=(m_videoreg&0x20)?(256*512):0; //visible frame - - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<512;x++) + for(int x=0;x<512;x++) { int tmp=dy+y*512+x; PLOT_PIXEL_RGB(x-67,y-5,(m_framebuffer[tmp]>>0)&0xff,(m_framebuffer[tmp]>>8)&0xff,(m_framebuffer[tmp]>>16)&0xff); @@ -397,10 +395,10 @@ uint32_t speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rg m_maincpu->draw_screen(screen, *m_bitmap, cliprect); //copy temporary bitmap to rgb 32 bit bitmap - for(y=cliprect.min_y; y<cliprect.max_y;y++) + for(int y=cliprect.min_y; y<cliprect.max_y;y++) { - uint16_t *srcline = &m_bitmap->pix16(y); - for(x=cliprect.min_x; x<cliprect.max_x;x++) + uint16_t const *const srcline = &m_bitmap->pix(y); + for(int x=cliprect.min_x; x<cliprect.max_x;x++) { if(srcline[x]) { diff --git a/src/mame/drivers/spg29x.cpp b/src/mame/drivers/spg29x.cpp index dc25021cc42..79144684df1 100644 --- a/src/mame/drivers/spg29x.cpp +++ b/src/mame/drivers/spg29x.cpp @@ -245,8 +245,8 @@ uint32_t spg29x_game_state::spg290_screen_update(screen_device &screen, bitmap_r for (int y=0; y <= cliprect.max_y; y++) for (int x=0; x <= cliprect.max_x; x++) { - auto pix = rgb_t(bitmap.pix32(y, x)); - bitmap.pix32(y, x) = rgb_t(pix.r() * fade_offset / 255, pix.g() * fade_offset / 255, pix.b() * fade_offset / 255); + rgb_t pix(bitmap.pix(y, x)); + bitmap.pix(y, x) = rgb_t(pix.r() * fade_offset / 255, pix.g() * fade_offset / 255, pix.b() * fade_offset / 255); } } diff --git a/src/mame/drivers/spiders.cpp b/src/mame/drivers/spiders.cpp index 2f77fc485fe..b1dd2729510 100644 --- a/src/mame/drivers/spiders.cpp +++ b/src/mame/drivers/spiders.cpp @@ -285,8 +285,6 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) for (uint8_t cx = 0; cx < x_count; cx++) { - uint8_t data1, data2, data3; - /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 3) & 0x3f00) | ((ra << 5) & 0x00e0) | @@ -295,9 +293,9 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) if (m_flipscreen) offs = offs ^ 0x3fff; - data1 = m_ram[0x0000 | offs]; - data2 = m_ram[0x4000 | offs]; - data3 = m_ram[0x8000 | offs]; + uint8_t data1 = m_ram[0x0000 | offs]; + uint8_t data2 = m_ram[0x4000 | offs]; + uint8_t data3 = m_ram[0x8000 | offs]; for (int i = 0; i < 8; i++) { @@ -309,9 +307,9 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) ((data2 & 0x80) >> 6) | ((data1 & 0x80) >> 7); - data1 = data1 << 1; - data2 = data2 << 1; - data3 = data3 << 1; + data1 <<= 1; + data2 <<= 1; + data3 <<= 1; } else { @@ -319,17 +317,17 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) ((data2 & 0x01) << 1) | ((data1 & 0x01) << 0); - data1 = data1 >> 1; - data2 = data2 >> 1; - data3 = data3 >> 1; + data1 >>= 1; + data2 >>= 1; + data3 >>= 1; } - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } - ma = ma + 1; + ma++; } } diff --git a/src/mame/drivers/spinb.cpp b/src/mame/drivers/spinb.cpp index f7235c7ecfb..bebb8c64b7c 100644 --- a/src/mame/drivers/spinb.cpp +++ b/src/mame/drivers/spinb.cpp @@ -599,7 +599,7 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 16; x++) { uint8_t const gfx = m_dmdram[ma+0x200]; @@ -622,7 +622,7 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 16; x++) { uint8_t const gfx = m_dmdram[ma++]; diff --git a/src/mame/drivers/splash_ms.cpp b/src/mame/drivers/splash_ms.cpp index ac4c1e33ba4..f16b9504ccb 100644 --- a/src/mame/drivers/splash_ms.cpp +++ b/src/mame/drivers/splash_ms.cpp @@ -184,11 +184,11 @@ uint32_t splashms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = 0; y < 256; y++) { - uint16_t* dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); for (int x = 0; x < 512; x++) { - uint8_t pix = m_bitmapram[(y * 512) + x]; + uint8_t const pix = m_bitmapram[(y * 512) + x]; //if (pix) dst[x] = pix + 0x100; } diff --git a/src/mame/drivers/srmp5.cpp b/src/mame/drivers/srmp5.cpp index 9ef4d397dfa..414d65e9829 100644 --- a/src/mame/drivers/srmp5.cpp +++ b/src/mame/drivers/srmp5.cpp @@ -137,7 +137,7 @@ private: uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,address,xs,xs2,ys,ys2,height,width,xw,yw,xb,yb,sizex,sizey; + int address,height,width,sizex,sizey; uint16_t *sprite_list=m_sprram.get(); uint16_t *sprite_list_end=&m_sprram[0x4000]; //guess uint8_t *pixels=(uint8_t *)m_tileram.get(); @@ -152,22 +152,22 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b { // 16x16 tile uint16_t *map = &sprram[0x2000]; - for(yw = 0; yw < tile_height; yw++) + for(int yw = 0; yw < tile_height; yw++) { - for(xw = 0; xw < tile_width; xw++) + for(int xw = 0; xw < tile_width; xw++) { uint16_t tile = map[yw * 128 + xw * 2]; if(tile >= 0x2000) continue; address = tile * SPRITE_DATA_GRANULARITY; - for(y = 0; y < 16; y++) + for(int y = 0; y < 16; y++) { - for(x = 0; x < 16; x++) + for(int x = 0; x < 16; x++) { uint8_t pen = pixels[BYTE_XOR_LE(address)]; if(pen) { - bitmap.pix32(yw * 16 + y, xw * 16 + x) = pens[pen]; + bitmap.pix(yw * 16 + y, xw * 16 + x) = pens[pen]; } address++; } @@ -191,8 +191,8 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b global_y=(int16_t)sprite_list[SPRITE_GLOBAL_Y]; while(sublist_length) { - x=(int16_t)sprite_sublist[SPRITE_LOCAL_X]+global_x; - y=(int16_t)sprite_sublist[SPRITE_LOCAL_Y]+global_y; + int x=(int16_t)sprite_sublist[SPRITE_LOCAL_X]+global_x; + int y=(int16_t)sprite_sublist[SPRITE_LOCAL_Y]+global_y; width =(sprite_sublist[SPRITE_SIZE]>> 4)&0xf; height=(sprite_sublist[SPRITE_SIZE]>>12)&0xf; @@ -201,24 +201,24 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b address=(sprite_sublist[SPRITE_TILE] & ~(sprite_sublist[SPRITE_SIZE] >> 11 & 7))*SPRITE_DATA_GRANULARITY; y -= (height + 1) * (sizey + 1)-1; - for(xw=0;xw<=width;xw++) + for(int xw=0;xw<=width;xw++) { - xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; - for(yw=0;yw<=height;yw++) + int xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; + for(int yw=0;yw<=height;yw++) { - yb = yw*(sizey+1)+y; - for(ys=0;ys<=sizey;ys++) + int yb = yw*(sizey+1)+y; + for(int ys=0;ys<=sizey;ys++) { - ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); - for(xs=0;xs<=sizex;xs++) + int ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); + for(int xs=0;xs<=sizex;xs++) { uint8_t pen=pixels[BYTE_XOR_LE(address)&(0x100000-1)]; - xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; + int xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; if(pen) { if(cliprect.contains(xb+xs2, yb+ys2)) { - bitmap.pix32(yb+ys2, xb+xs2) = pens[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; + bitmap.pix(yb+ys2, xb+xs2) = pens[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; } } ++address; @@ -235,8 +235,7 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b #ifdef DEBUG_CHAR { - int i; - for(i = 0; i < 0x2000; i++) + for(int i = 0; i < 0x2000; i++) { if (m_tileduty[i] == 1) { diff --git a/src/mame/drivers/ssem.cpp b/src/mame/drivers/ssem.cpp index 62b543c48cf..bb232317522 100644 --- a/src/mame/drivers/ssem.cpp +++ b/src/mame/drivers/ssem.cpp @@ -437,9 +437,8 @@ void ssem_state::glyph_print(bitmap_rgb32 &bitmap, int32_t x, int32_t y, Format int32_t line = 0; for(line = 0; line < 8; line++) { - uint32_t *d = &bitmap.pix32(y + line); - int32_t bit = 0; - for(bit = 0; bit < 8; bit++) + uint32_t *const d = &bitmap.pix(y + line); + for(uint32_t bit = 0; bit < 8; bit++) { if(char_glyphs[cur][line] & (1 << (7 - bit))) { diff --git a/src/mame/drivers/ssingles.cpp b/src/mame/drivers/ssingles.cpp index 8b1fd2918f9..8ad3cc7f007 100644 --- a/src/mame/drivers/ssingles.cpp +++ b/src/mame/drivers/ssingles.cpp @@ -218,20 +218,18 @@ static constexpr rgb_t ssingles_colors[NUM_PENS] = MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) { - uint32_t tile_address; - uint16_t cell, palette; - uint8_t b0, b1; - const uint8_t *gfx = memregion("gfx1")->base(); + uint8_t const *const gfx = memregion("gfx1")->base(); for (int cx = 0; cx < x_count; ++cx) { int address = ((ma >> 1) + (cx >> 1)) & 0xff; - cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); - tile_address = ((cell & 0x3ff) << 4) + ra; - palette = (cell >> 10) & 0x1c; + uint32_t tile_address = ((cell & 0x3ff) << 4) + ra; + uint16_t palette = (cell >> 10) & 0x1c; + uint8_t b0, b1; if (cx & 1) { b0 = gfx[tile_address + 0x0000]; /* 9.bin */ @@ -245,7 +243,7 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) for (int x = 7; x >= 0; --x) { - bitmap.pix32(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; + bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; b0 >>= 1; b1 >>= 1; } @@ -254,20 +252,18 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) { - uint32_t tile_address; - uint16_t cell, palette; - uint8_t b0, b1; const uint8_t *gfx = memregion("gfx1")->base(); for (int cx = 0; cx < x_count; ++cx) { int address = ((ma >> 1) + (cx >> 1)) & 0xff; - cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); - tile_address = ((cell & 0x1ff) << 4) + ra; - palette = (cell >> 10) & 0x1c; + uint32_t tile_address = ((cell & 0x1ff) << 4) + ra; + uint16_t palette = (cell >> 10) & 0x1c; + uint8_t b0, b1; if (cx & 1) { b0 = gfx[tile_address + 0x0000]; /* 9.bin */ @@ -281,7 +277,7 @@ MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) for (int x = 7; x >= 0; --x) { - bitmap.pix32(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; + bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; b0 >>= 1; b1 >>= 1; } diff --git a/src/mame/drivers/sstrangr.cpp b/src/mame/drivers/sstrangr.cpp index c83a1ed145c..ac633ef2d8b 100644 --- a/src/mame/drivers/sstrangr.cpp +++ b/src/mame/drivers/sstrangr.cpp @@ -403,17 +403,17 @@ uint32_t sstrangr_state::screen_update_sstrangr(screen_device &screen, bitmap_rg if (m_flip_screen) { pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - data = data << 1; + data <<= 1; } else { pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - data = data >> 1; + data >>= 1; } - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; + x++; } } @@ -441,17 +441,17 @@ uint32_t sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rg if (m_flip_screen) { color = (data & 0x80) ? fore_color : 0; - data = data << 1; + data <<= 1; } else { color = (data & 0x01) ? fore_color : 0; - data = data >> 1; + data >>= 1; } - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } } diff --git a/src/mame/drivers/studio2.cpp b/src/mame/drivers/studio2.cpp index 3365c1005a2..44278fe4780 100644 --- a/src/mame/drivers/studio2.cpp +++ b/src/mame/drivers/studio2.cpp @@ -518,7 +518,7 @@ void visicom_state::dma_w(offs_t offset, uint8_t data) for (int x = 0; x < 8; x++) { int color = (BIT(color1, 7) << 1) | BIT(color0, 7); - m_vdc->m_bitmap.pix32(y, sx + x) = VISICOM_PALETTE[color]; + m_vdc->m_bitmap.pix(y, sx + x) = VISICOM_PALETTE[color]; color0 <<= 1; color1 <<= 1; } diff --git a/src/mame/drivers/sun2.cpp b/src/mame/drivers/sun2.cpp index 8f43b4249dd..f6b895fd502 100644 --- a/src/mame/drivers/sun2.cpp +++ b/src/mame/drivers/sun2.cpp @@ -624,29 +624,26 @@ void sun2_state::mbustype3space_map(address_map &map) uint32_t sun2_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); if (!(m_bw2_ctrl & 0x8000)) return 0; - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/sun3.cpp b/src/mame/drivers/sun3.cpp index 01418f6ca10..5650ba652ed 100644 --- a/src/mame/drivers/sun3.cpp +++ b/src/mame/drivers/sun3.cpp @@ -283,8 +283,8 @@ private: uint8_t rtc7170_r(offs_t offset); void rtc7170_w(offs_t offset, uint8_t data); + template <unsigned W, unsigned H> uint32_t bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(sun3_timer); @@ -898,57 +898,27 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3_state::sun3_timer) } } +template <unsigned W, unsigned H> uint32_t sun3_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); - for (y = 0; y < 900; y++) + for (int y = 0; y < H; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < W/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; - } - } - return 0; -} - -uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - uint32_t *scanline; - int x, y; - uint8_t pixels; - static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); - - for (y = 0; y < 1100; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1600/8; x++) - { - pixels = m_vram[(y * (1600/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (W/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } return 0; @@ -956,27 +926,24 @@ uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t sun3_state::bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)]; + uint8_t const *const m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)]; - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } return 0; @@ -1013,7 +980,7 @@ void sun3_state::sun3(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(SCREEN(config, "bwtwo", SCREEN_TYPE_RASTER)); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1152, 900>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1152-1, 0, 900-1); bwtwo.set_refresh_hz(72); @@ -1079,7 +1046,7 @@ void sun3_state::sun3_60(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(*subdevice<screen_device>("bwtwo")); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1600-1, 0, 1100-1); bwtwo.set_refresh_hz(72); @@ -1102,7 +1069,7 @@ void sun3_state::sun3200(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(*subdevice<screen_device>("bwtwo")); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1600-1, 0, 1100-1); bwtwo.set_refresh_hz(72); diff --git a/src/mame/drivers/sun3x.cpp b/src/mame/drivers/sun3x.cpp index c79ca22c57f..08f9c6e9ef2 100644 --- a/src/mame/drivers/sun3x.cpp +++ b/src/mame/drivers/sun3x.cpp @@ -531,27 +531,24 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3x_state::sun380_timer) uint32_t sun3x_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/supertnk.cpp b/src/mame/drivers/supertnk.cpp index 32c3b059d65..8d7dbad2182 100644 --- a/src/mame/drivers/supertnk.cpp +++ b/src/mame/drivers/supertnk.cpp @@ -281,12 +281,8 @@ WRITE_LINE_MEMBER(supertnk_state::bitplane_select_1_w) uint32_t supertnk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; @@ -294,16 +290,16 @@ uint32_t supertnk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm uint8_t data1 = m_videoram[1][offs]; uint8_t data2 = m_videoram[2][offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { uint8_t color = ((data0 & 0x80) >> 5) | ((data1 & 0x80) >> 6) | ((data2 & 0x80) >> 7); - bitmap.pix32(y, x) = m_pens[color]; + bitmap.pix(y, x) = m_pens[color]; - data0 = data0 << 1; - data1 = data1 << 1; - data2 = data2 << 1; + data0 <<= 1; + data1 <<= 1; + data2 <<= 1; - x = x + 1; + x++; } } diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp index 3a75624bb61..d37796980ae 100644 --- a/src/mame/drivers/supracan.cpp +++ b/src/mame/drivers/supracan.cpp @@ -553,8 +553,8 @@ void supracan_state::draw_sprite_tile(bitmap_ind16 &dst, bitmap_ind8 &priomap, c for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint8_t *priop = &priomap.pix8(y, dstx); - uint16_t *dstp = &dst.pix16(y, dstx); + uint8_t *priop = &priomap.pix(y, dstx); + uint16_t *dstp = &dst.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { const uint32_t srcdata = *srcp; @@ -627,7 +627,7 @@ void supracan_state::draw_sprite_tile_mask(bitmap_ind8 &dst, const rectangle &cl for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint8_t *dstp = &dst.pix8(y, dstx); + uint8_t *dstp = &dst.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { if (*srcp) @@ -697,9 +697,9 @@ void supracan_state::draw_sprite_tile_masked(bitmap_ind16 &dst, bitmap_ind8 &mas for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint16_t *dstp = &dst.pix16(y, dstx); - uint8_t *priop = &priomap.pix8(y, dstx); - uint8_t *maskp = &mask.pix8(y, dstx); + uint16_t *dstp = &dst.pix(y, dstx); + uint8_t *priop = &priomap.pix(y, dstx); + uint8_t *maskp = &mask.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { const uint32_t srcdata = *srcp; @@ -838,8 +838,8 @@ void supracan_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &maskmap, bi uint32_t delta = (1 << 17) / xscale; for (int sy = 0; sy < ysize * 8; sy++) { - uint16_t *src = &sprite_bitmap->pix16(sy); - uint16_t *dst = &bitmap.pix16(y + sy); + uint16_t *src = &sprite_bitmap->pix(sy); + uint16_t *dst = &bitmap.pix(y + sy); uint32_t dx = x << 16; for (int sx = 0; sx < xsize * 8; sx++) { @@ -897,7 +897,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr uint32_t cy = starty; /* get dest and priority pointers */ - uint16_t *dest = &bitmap.pix16(sy, sx); + uint16_t *dest = &bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) @@ -909,7 +909,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr { int scroll = 0; // scrollram[(cx>>16)&0x3ff]); - uint16_t data = &srcbitmap.pix16(((cy >> 16) - scroll) & ymask, (cx >> 16) & xmask)[0]; + uint16_t data = &srcbitmap.pix(((cy >> 16) - scroll) & ymask, (cx >> 16) & xmask)[0]; if ((data & transmask) != 0) dest[0] = data; @@ -918,7 +918,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr #endif { int scroll = 0;//scrollram[(cy>>16)&0x3ff]); - uint16_t data = srcbitmap.pix16((cy >> 16) & ymask, ((cx >> 16) - scroll) & xmask); + uint16_t data = srcbitmap.pix((cy >> 16) & ymask, ((cx >> 16) - scroll) & xmask); if ((data & transmask) != 0) *dest = data; @@ -1059,8 +1059,8 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - // these will have to change to pix32 etc. once alpha blending is supported - uint16_t* screen = &bitmap.pix16(y); + // these will have to change to uint32_t* etc. once alpha blending is supported + uint16_t* screen = &bitmap.pix(y); int actualy = y & mosaic_mask; int realy = actualy + scrolly; @@ -1069,8 +1069,8 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (scrolly + y < 0 || scrolly + y > ((ysize * 8) - 1)) continue; - uint16_t* src = &src_bitmap.pix16(realy & ((ysize * 8) - 1)); - uint8_t* priop = &m_prio_bitmap.pix8(y); + uint16_t* src = &src_bitmap.pix(realy & ((ysize * 8) - 1)); + uint8_t* priop = &m_prio_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { @@ -1163,9 +1163,9 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t* dstp = &bitmap.pix16(y); - uint8_t* priop = &m_prio_bitmap.pix8(y); - uint16_t* spritep = &m_sprite_final_bitmap.pix16(y); + uint16_t* dstp = &bitmap.pix(y); + uint8_t* priop = &m_prio_bitmap.pix(y); + uint16_t* spritep = &m_sprite_final_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/suprgolf.cpp b/src/mame/drivers/suprgolf.cpp index 41cabcb5380..3b39c581fd9 100644 --- a/src/mame/drivers/suprgolf.cpp +++ b/src/mame/drivers/suprgolf.cpp @@ -135,40 +135,36 @@ void suprgolf_state::video_start() uint32_t suprgolf_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,count,color; + int count; bitmap.fill(m_palette->black_pen(), cliprect); - { - count = 0; + count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) + { + for(int x=0;x<512;x++) { - for(x=0;x<512;x++) - { - color = m_bg_fb[count]; + int const color = m_bg_fb[count]; - if(x <= cliprect.max_x && y <= cliprect.max_y) - bitmap.pix16(y, x) = m_palette->pen((color & 0x7ff)); + if(x <= cliprect.max_x && y <= cliprect.max_y) + bitmap.pix(y, x) = m_palette->pen((color & 0x7ff)); - count++; - } + count++; } } - { - count = 0; + count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) + { + for(int x=0;x<512;x++) { - for(x=0;x<512;x++) - { - color = m_fg_fb[count]; + int const color = m_fg_fb[count]; - if(((m_fg_fb[count] & 0x0f) != 0x0f) && (x <= cliprect.max_x && y <= cliprect.max_y)) - bitmap.pix16(y, x) = m_palette->pen((color & 0x7ff)); + if(((m_fg_fb[count] & 0x0f) != 0x0f) && (x <= cliprect.max_x && y <= cliprect.max_y)) + bitmap.pix(y, x) = m_palette->pen((color & 0x7ff)); - count++; - } + count++; } } diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp index 6f852db02ab..41aebc4abee 100644 --- a/src/mame/drivers/svision.cpp +++ b/src/mame/drivers/svision.cpp @@ -362,7 +362,7 @@ uint32_t svision_state::screen_update_svision(screen_device &screen, bitmap_ind1 { const int start_x = 3 - (m_reg[XPOS] & 3); const int end_x = std::min(163, m_reg[XSIZE] | 3); - uint16_t *line = &bitmap.pix16(y, start_x); + uint16_t *line = &bitmap.pix(y, start_x); for (int x = start_x, i = 0; x < end_x; x+=4, i++) { uint8_t b = m_videoram[j+i]; @@ -394,7 +394,7 @@ uint32_t svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 { const int start_x = 3 - (m_reg[XPOS] & 3); const int end_x = std::min(163, m_reg[XSIZE] | 3); - uint32_t *line = &bitmap.pix32(y, start_x); + uint32_t *line = &bitmap.pix(y, start_x); for (int x = start_x, i = 0; x < end_x; x += 4, i++) { uint8_t b = m_videoram[j + i]; diff --git a/src/mame/drivers/swyft.cpp b/src/mame/drivers/swyft.cpp index 5030904123d..a4d20d070d4 100644 --- a/src/mame/drivers/swyft.cpp +++ b/src/mame/drivers/swyft.cpp @@ -599,19 +599,16 @@ void swyft_state::video_start() uint32_t swyft_state::screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t code; - int y, x, b; - int addr = 0; - for (y = 0; y < 242; y++) + for (int y = 0; y < 242; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - code = m_p_swyft_videoram[addr++]; - for (b = 7; b >= 0; b--) + uint16_t code = m_p_swyft_videoram[addr++]; + for (int b = 7; b >= 0; b--) { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + bitmap.pix(y, horpos++) = (code >> b) & 0x01; } } } diff --git a/src/mame/drivers/sys9002.cpp b/src/mame/drivers/sys9002.cpp index 37bf2d7abfa..3e113c90f59 100644 --- a/src/mame/drivers/sys9002.cpp +++ b/src/mame/drivers/sys9002.cpp @@ -91,18 +91,16 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( sys9002_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem] & 0x7f; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_vram[mem] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7)]; diff --git a/src/mame/drivers/systel1.cpp b/src/mame/drivers/systel1.cpp index 98bd3af70bc..b02d503ea1c 100644 --- a/src/mame/drivers/systel1.cpp +++ b/src/mame/drivers/systel1.cpp @@ -108,7 +108,7 @@ I8275_DRAW_CHARACTER_MEMBER(systel1_state::draw_character) for (int i = 0; i < 7; i++) { - bitmap.pix32(y, x + i) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x + i) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/taitotz.cpp b/src/mame/drivers/taitotz.cpp index 84840c89d54..431db2869a2 100644 --- a/src/mame/drivers/taitotz.cpp +++ b/src/mame/drivers/taitotz.cpp @@ -845,12 +845,12 @@ static inline uint32_t generate_texel_address(int iu, int iv) void taitotz_renderer::draw_scanline_noz(int32_t scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); float u = extent.param[POLY_U].start; float v = extent.param[POLY_V].start; - float du = extent.param[POLY_U].dpdx; - float dv = extent.param[POLY_V].dpdx; + float const du = extent.param[POLY_U].dpdx; + float const dv = extent.param[POLY_V].dpdx; uint32_t *texram = &m_texture[extradata.texture * 0x1000]; @@ -879,24 +879,24 @@ void taitotz_renderer::draw_scanline_noz(int32_t scanline, const extent_t &exten void taitotz_renderer::draw_scanline(int32_t scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); float ooz = extent.param[POLY_Z].start; float uoz = extent.param[POLY_U].start; float voz = extent.param[POLY_V].start; - float dooz = extent.param[POLY_Z].dpdx; - float duoz = extent.param[POLY_U].dpdx; - float dvoz = extent.param[POLY_V].dpdx; + const float dooz = extent.param[POLY_Z].dpdx; + const float duoz = extent.param[POLY_U].dpdx; + const float dvoz = extent.param[POLY_V].dpdx; float nx= extent.param[POLY_NX].start; float dnx = extent.param[POLY_NX].dpdx; float ny = extent.param[POLY_NY].start; - float dny = extent.param[POLY_NY].dpdx; + const float dny = extent.param[POLY_NY].dpdx; float nz = extent.param[POLY_NZ].start; - float dnz = extent.param[POLY_NZ].dpdx; + const float dnz = extent.param[POLY_NZ].dpdx; - uint32_t *texram = &m_texture[extradata.texture * 0x1000]; + uint32_t *const texram = &m_texture[extradata.texture * 0x1000]; uint32_t alpha = extradata.alpha & 0x1f; uint32_t alpha_enable = extradata.alpha & 0x80; @@ -1435,11 +1435,11 @@ uint32_t taitotz_state::screen_update_taitotz(screen_device &screen, bitmap_rgb3 { m_renderer->draw(bitmap, cliprect); - uint16_t *screen_src = (uint16_t*)&m_screen_ram[m_scr_base]; + uint16_t const *screen_src = (uint16_t*)&m_screen_ram[m_scr_base]; for (int j=0; j < 384; j++) { - uint32_t *fb = &bitmap.pix32(j); + uint32_t *const fb = &bitmap.pix(j); for (int i=0; i < 512; i++) { uint16_t p = *screen_src++; diff --git a/src/mame/drivers/taitowlf.cpp b/src/mame/drivers/taitowlf.cpp index dc57211b3d3..74d86eefeb7 100644 --- a/src/mame/drivers/taitowlf.cpp +++ b/src/mame/drivers/taitowlf.cpp @@ -113,22 +113,18 @@ private: #if !TAITOWLF_ENABLE_VGA uint32_t taitowlf_state::screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - bitmap.fill(m_palette->black_pen(), cliprect); - count = (0); + int count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<512;x++) + for(int x=0;x<512;x++) { - uint32_t color; - - color = (m_bootscreen_rom[count] & 0xff); + uint32_t color = m_bootscreen_rom[count] & 0xff; if(cliprect.contains(x+0, y)) - bitmap.pix32(y, x+0) = m_palette->pen(color); + bitmap.pix(y, x+0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/tamag1.cpp b/src/mame/drivers/tamag1.cpp index 649a6ca54cc..a0f77f5df63 100644 --- a/src/mame/drivers/tamag1.cpp +++ b/src/mame/drivers/tamag1.cpp @@ -69,7 +69,7 @@ E0C6S46_PIXEL_UPDATE(tamag1_state::pixel_update) int y = com, x = seg2x[seg]; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = state; + bitmap.pix(y, x) = state; // 2 rows of indicators: // above screen: 0:meal, 1:lamp, 2:play, 3:medicine diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp index 69b7ba9e13a..3cac1126519 100644 --- a/src/mame/drivers/tandy2k.cpp +++ b/src/mame/drivers/tandy2k.cpp @@ -502,7 +502,7 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 0; x < 8; x++) { int color = BIT(a, x) | (BIT(b, x) << 1) | (BIT(c, x) << 2); - bitmap.pix32(y, (sx * 8) + (7 - x)) = cpen[color]; + bitmap.pix(y, (sx * 8) + (7 - x)) = cpen[color]; } } else @@ -517,7 +517,7 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 0; x < 8; x++) { int color = 4 | (BIT(attr, 6) << 1) | BIT(data, 7); - bitmap.pix32(y, (sx * 8) + x) = cpen[color]; + bitmap.pix(y, (sx * 8) + x) = cpen[color]; data <<= 1; } } @@ -624,7 +624,7 @@ CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character ) { int color = BIT(video, 7 - i); - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } } diff --git a/src/mame/drivers/tapatune.cpp b/src/mame/drivers/tapatune.cpp index e98f02f8b83..7ce930e02eb 100644 --- a/src/mame/drivers/tapatune.cpp +++ b/src/mame/drivers/tapatune.cpp @@ -180,10 +180,10 @@ MC6845_BEGIN_UPDATE( tapatune_state::crtc_begin_update ) MC6845_UPDATE_ROW( tapatune_state::crtc_update_row ) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); offs_t offs = (ma*2 + ra*0x40)*4; - uint8_t *videoram = reinterpret_cast<uint8_t *>(m_videoram.target()); + uint8_t const *const videoram = reinterpret_cast<uint8_t *>(m_videoram.target()); for (uint32_t x = 0; x < x_count*4; x++) { diff --git a/src/mame/drivers/tattack.cpp b/src/mame/drivers/tattack.cpp index 5d1b56b7910..8f419a20d2c 100644 --- a/src/mame/drivers/tattack.cpp +++ b/src/mame/drivers/tattack.cpp @@ -144,13 +144,11 @@ void tattack_state::draw_edge_bitmap(bitmap_ind16 &bitmap, const rectangle &clip void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t ram_offs; const uint16_t ram_base = 0x40+(m_ram[0x33] & 0x10); const int x_base = -8; - int xi,yi; // draw brick pattern - for(ram_offs=ram_base;ram_offs<ram_base+0xe;ram_offs++) + for(uint16_t ram_offs=ram_base;ram_offs<ram_base+0xe;ram_offs++) { uint8_t cur_column = m_ram[ram_offs]; @@ -174,15 +172,15 @@ void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle & if(draw_block == true) { - for(xi=0;xi<3;xi++) + for(int xi=0;xi<3;xi++) { - for(yi=0;yi<15;yi++) + for(int yi=0;yi<15;yi++) { int resx = bit*4+xi+160+x_base; int resy = (ram_offs & 0xf)*16+yi+16; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_bricks_color_bank == true ? red_pen : (bit & 4 ? yellow_pen : green_pen); + bitmap.pix(resy, resx) = m_bricks_color_bank == true ? red_pen : (bit & 4 ? yellow_pen : green_pen); } } } @@ -192,25 +190,25 @@ void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle & // draw paddle if(m_bottom_edge_enable == false) { - for(xi=0;xi<4;xi++) - for(yi=0;yi<m_paddle_ysize;yi++) + for(int xi=0;xi<4;xi++) + for(int yi=0;yi<m_paddle_ysize;yi++) { int resx =(paddle_xpos+xi); int resy = m_paddle_reg+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = white_pen; + bitmap.pix(resy, resx) = white_pen; } } // draw ball - for(xi=0;xi<3;xi++) - for(yi=0;yi<3;yi++) + for(int xi=0;xi<3;xi++) + for(int yi=0;yi<3;yi++) { int resx = m_ball_regs[0]+xi-2+x_base; int resy = m_ball_regs[1]+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = (white_pen); + bitmap.pix(resy, resx) = (white_pen); } } diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp index 0293cc0ad34..21748861b5c 100644 --- a/src/mame/drivers/tavernie.cpp +++ b/src/mame/drivers/tavernie.cpp @@ -255,19 +255,17 @@ void ivg09_state::ds_w(u8 data) // Attributes when high: 0 = alpha rom; 1 = flash; 2 = reverse video; 3 = highlight off MC6845_UPDATE_ROW( ivg09_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 gfx,attr; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); m_flashcnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0xfff; - attr = m_vram[mem] >> 8; - u8 inv = ((x == cursor_x) ^ (BIT(attr, 2)) ^ (BIT(attr, 1) && BIT(m_flashcnt, 6))) ? 0xff : 0; - gfx = m_p_chargen[((m_vram[mem] & 0x1ff)<<4) | ra] ^ inv; // takes care of attr bit 0 too - u8 pen = BIT(attr, 3) ? 1 : 2; + u16 const mem = (ma + x) & 0xfff; + u8 const attr = m_vram[mem] >> 8; + u8 const inv = ((x == cursor_x) ^ (BIT(attr, 2)) ^ (BIT(attr, 1) && BIT(m_flashcnt, 6))) ? 0xff : 0; + u8 const gfx = m_p_chargen[((m_vram[mem] & 0x1ff)<<4) | ra] ^ inv; // takes care of attr bit 0 too + u8 const pen = BIT(attr, 3) ? 1 : 2; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7) ? pen : 0]; diff --git a/src/mame/drivers/tek440x.cpp b/src/mame/drivers/tek440x.cpp index 1dac2008b89..e04123889ee 100644 --- a/src/mame/drivers/tek440x.cpp +++ b/src/mame/drivers/tek440x.cpp @@ -131,22 +131,17 @@ void tek440x_state::machine_reset() u32 tek440x_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const u16 *video_ram; - u16 word; - u16 *line; - int y, x, b; - - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - line = &bitmap.pix16(y); - video_ram = &m_vram[y * 64]; + u16 *const line = &bitmap.pix(y); + u16 const *video_ram = &m_vram[y * 64]; - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + u16 const word = *(video_ram++); + for (int b = 0; b < 16; b++) { - line[x + b] = (word >> (15 - b)) & 0x0001; + line[x + b] = BIT(word, 15 - b); } } } diff --git a/src/mame/drivers/teleray10.cpp b/src/mame/drivers/teleray10.cpp index e603a734327..2aa362e4dec 100644 --- a/src/mame/drivers/teleray10.cpp +++ b/src/mame/drivers/teleray10.cpp @@ -158,7 +158,7 @@ u32 teleray10_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (unsigned scan = 0; scan < 12; scan++) { - u32 *px = &bitmap.pix32(y * 12 + scan); + u32 *px = &bitmap.pix(y * 12 + scan); for (unsigned x = 0; x < 80; x++) { u8 ch = m_displayram[offset + x]; diff --git a/src/mame/drivers/tgtpanic.cpp b/src/mame/drivers/tgtpanic.cpp index 1077dbb4251..8e7598b7796 100644 --- a/src/mame/drivers/tgtpanic.cpp +++ b/src/mame/drivers/tgtpanic.cpp @@ -59,33 +59,31 @@ void tgtpanic_state::machine_start() uint32_t tgtpanic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { uint32_t colors[4]; - uint32_t offs; - uint32_t x, y; colors[0] = 0; colors[1] = 0xffffffff; colors[2] = rgb_t(pal1bit(m_color >> 2), pal1bit(m_color >> 1), pal1bit(m_color >> 0)); colors[3] = rgb_t(pal1bit(m_color >> 6), pal1bit(m_color >> 5), pal1bit(m_color >> 4)); - for (offs = 0; offs < 0x2000; ++offs) + for (uint32_t offs = 0; offs < 0x2000; ++offs) { uint8_t val = m_ram[offs]; - y = (offs & 0x7f) << 1; - x = (offs >> 7) << 2; + uint32_t const y = (offs & 0x7f) << 1; + uint32_t const x = (offs >> 7) << 2; /* I'm guessing the hardware doubles lines */ - bitmap.pix32(y + 0, x + 0) = colors[val & 3]; - bitmap.pix32(y + 1, x + 0) = colors[val & 3]; + bitmap.pix(y + 0, x + 0) = colors[val & 3]; + bitmap.pix(y + 1, x + 0) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 1) = colors[val & 3]; - bitmap.pix32(y + 1, x + 1) = colors[val & 3]; + bitmap.pix(y + 0, x + 1) = colors[val & 3]; + bitmap.pix(y + 1, x + 1) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 2) = colors[val & 3]; - bitmap.pix32(y + 1, x + 2) = colors[val & 3]; + bitmap.pix(y + 0, x + 2) = colors[val & 3]; + bitmap.pix(y + 1, x + 2) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 3) = colors[val & 3]; - bitmap.pix32(y + 1, x + 3) = colors[val & 3]; + bitmap.pix(y + 0, x + 3) = colors[val & 3]; + bitmap.pix(y + 1, x + 3) = colors[val & 3]; } return 0; diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index ed51e4dffce..d473b040492 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -201,7 +201,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti74_pixel_update) { // internal: 2*16, external: 1*31 if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; } } @@ -220,7 +220,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) { // 1st line is simply 16 chars if (y == 7) y++; // the cursor is slightly below the char - bitmap.pix16(10 + y, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(10 + y, 1 + pos*6 + x) = state ? 1 : 2; } else if (line == 1 && pos < 15 && y < 7) { @@ -228,7 +228,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) // note: the chars are smaller than on the 1st line (this is handled in .lay file) const int gap = 9; int group = pos / 3; - bitmap.pix16(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp index 700e3b978f1..b7815de0f74 100644 --- a/src/mame/drivers/ti89.cpp +++ b/src/mame/drivers/ti89.cpp @@ -498,19 +498,18 @@ void ti68k_state::machine_reset() uint32_t ti68k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* preliminary implementation, doesn't use the contrast value */ - uint8_t width = screen.width(); - uint8_t height = screen.height(); - uint8_t x, y, b; + uint8_t const width = screen.width(); + uint8_t const height = screen.height(); if (!m_lcd_on || !m_lcd_base) bitmap.fill(0); else - for (y = 0; y < height; y++) - for (x = 0; x < width / 8; x++) + for (uint8_t y = 0; y < height; y++) + for (uint8_t x = 0; x < width / 8; x++) { uint8_t s_byte= m_maincpu->space(AS_PROGRAM).read_byte(m_lcd_base + y * (width/8) + x); - for (b = 0; b<8; b++) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(s_byte, b); + for (uint8_t b = 0; b<8; b++) + bitmap.pix(y, x * 8 + (7 - b)) = BIT(s_byte, b); } return 0; diff --git a/src/mame/drivers/ti931.cpp b/src/mame/drivers/ti931.cpp index 3531bf7ea13..aabcfe9839e 100644 --- a/src/mame/drivers/ti931.cpp +++ b/src/mame/drivers/ti931.cpp @@ -52,10 +52,10 @@ SCN2672_DRAW_CHARACTER_MEMBER(ti931_state::draw_character) { if (!half_shift) dots <<= 1; - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); if (half_shift) dots <<= 1; - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); } } diff --git a/src/mame/drivers/tickee.cpp b/src/mame/drivers/tickee.cpp index 076043c17f6..a0ca3cf7f1e 100644 --- a/src/mame/drivers/tickee.cpp +++ b/src/mame/drivers/tickee.cpp @@ -220,21 +220,20 @@ VIDEO_START_MEMBER(tickee_state,tickee) TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::scanline_update) { - uint16_t *src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; /* blank palette: fill with pen 255 */ if (m_control[2]) { - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = pens[0xff]; } else /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = src[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; @@ -245,16 +244,15 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::scanline_update) TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::rapidfir_scanline_update) { - uint16_t *src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); const pen_t *pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; if (m_palette_bank) { /* blank palette: fill with pen 255 */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { dest[x + 0] = pens[0xff]; dest[x + 1] = pens[0xff]; @@ -263,7 +261,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::rapidfir_scanline_update) else { /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = src[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/tiki100.cpp b/src/mame/drivers/tiki100.cpp index c9dce4cdd35..3c1b19f2f1a 100644 --- a/src/mame/drivers/tiki100.cpp +++ b/src/mame/drivers/tiki100.cpp @@ -493,13 +493,13 @@ uint32_t tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // // - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (int vaddr = cliprect.min_y; vaddr <= cliprect.max_y; vaddr++) { // This is at the start of a line int haddr = (cliprect.min_x>>4); - int haddr_end = (cliprect.max_x>>4); + int const haddr_end = (cliprect.max_x>>4); for (; haddr <= haddr_end; haddr++) { // This is at the start of a 16-dot cluster. Changes in m_scroll and m_video_ram come into effect here. @@ -521,7 +521,7 @@ uint32_t tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // m_current_pixel = data&0x0F; } - bitmap.pix32(vaddr, (haddr<<4) + dot) = palette[m_current_pixel&0x0F]; + bitmap.pix(vaddr, (haddr<<4) + dot) = palette[m_current_pixel&0x0F]; // This will run the dot-shifter and add the TEST-pattern to the upper bits (usually hidden by palette). data = (data>>1)|((haddr&0x02)<<14); diff --git a/src/mame/drivers/tim100.cpp b/src/mame/drivers/tim100.cpp index 2c8a8f7997c..447708f15a9 100644 --- a/src/mame/drivers/tim100.cpp +++ b/src/mame/drivers/tim100.cpp @@ -118,11 +118,10 @@ GFXDECODE_END I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t pixels; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (uint8_t i = 0; i < 2; i++) { - pixels = m_charmap[(i * 0x1000) | (linecount & 15) | (charcode << 4)]; + uint8_t pixels = m_charmap[(i * 0x1000) | (linecount & 15) | (charcode << 4)]; if (vsp) pixels = 0; @@ -132,12 +131,12 @@ I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - bitmap.pix32(y, x++) = palette[BIT(pixels, 7) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 6) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 5) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 4) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 3) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 2) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 7) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 6) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 5) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 4) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 3) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 2) ? (hlgt ? 2 : 1) : 0]; } } diff --git a/src/mame/drivers/tk635.cpp b/src/mame/drivers/tk635.cpp index e57e27e870d..3b27c8907c5 100644 --- a/src/mame/drivers/tk635.cpp +++ b/src/mame/drivers/tk635.cpp @@ -122,10 +122,10 @@ uint32_t tk635_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // 8 pixels of the character for (int p = 0; p < 8; p++) - bitmap.pix32(y * 16 + i, x * 9 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 16 + i, x * 9 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); // 9th pixel empty - bitmap.pix32(y * 16 + i, x * 9 + 8) = rgb_t::black(); + bitmap.pix(y * 16 + i, x * 9 + 8) = rgb_t::black(); } } } diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp index 4315b0c991c..50c527f21ff 100644 --- a/src/mame/drivers/tmmjprd.cpp +++ b/src/mame/drivers/tmmjprd.cpp @@ -235,30 +235,25 @@ void tmmjprd_state::draw_tile(bitmap_ind16 &bitmap, const rectangle &cliprect, i { for (int drawx=x;drawx<x+sizex;drawx++) { - uint16_t dat; - uint16_t* dst; - if (!depth) { if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; + uint16_t dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; if (dat!=15) { //dat += (colour<<8); - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } drawx++; if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0x0f); + uint16_t dat = (rom[(tileaddr*32)+count] & 0x0f); if (dat!=15) { //dat += (colour<<8); - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } @@ -268,12 +263,11 @@ void tmmjprd_state::draw_tile(bitmap_ind16 &bitmap, const rectangle &cliprect, i { if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0xff); + uint16_t dat = (rom[(tileaddr*32)+count] & 0xff); if (dat!=255) { dat += (colour<<8) & 0xf00; - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } count++; diff --git a/src/mame/drivers/toratora.cpp b/src/mame/drivers/toratora.cpp index 805860a038f..4e3e827f373 100644 --- a/src/mame/drivers/toratora.cpp +++ b/src/mame/drivers/toratora.cpp @@ -121,20 +121,16 @@ WRITE_LINE_MEMBER(toratora_state::cb2_u2_w) uint32_t toratora_state::screen_update_toratora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; data = data << 1; x = x + 1; diff --git a/src/mame/drivers/toypop.cpp b/src/mame/drivers/toypop.cpp index b257d003dd1..2883d32f8c5 100644 --- a/src/mame/drivers/toypop.cpp +++ b/src/mame/drivers/toypop.cpp @@ -180,14 +180,14 @@ void namcos16_state::toypop_palette(palette_device &palette) const void namcos16_state::legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip) { - const uint16_t pal_base = 0x300 + (m_pal_bank << 4); - const uint32_t src_base = 0x200/2; - const uint16_t src_pitch = 288 / 2; + uint16_t const pal_base = 0x300 + (m_pal_bank << 4); + uint32_t const src_base = 0x200/2; + uint16_t const src_pitch = 288 / 2; for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint16_t *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base]; - uint16_t *dst = &bitmap.pix16(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x); + uint16_t const *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base]; + uint16_t *dst = &bitmap.pix(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/drivers/trs80dt1.cpp b/src/mame/drivers/trs80dt1.cpp index 0aa9fc23e79..c4446f0048e 100644 --- a/src/mame/drivers/trs80dt1.cpp +++ b/src/mame/drivers/trs80dt1.cpp @@ -310,7 +310,7 @@ I8275_DRAW_CHARACTER_MEMBER( trs80dt1_state::crtc_update_row ) charcode &= 0x7f; linecount &= 15; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = 0; if (lten) // underline attr @@ -326,7 +326,7 @@ I8275_DRAW_CHARACTER_MEMBER( trs80dt1_state::crtc_update_row ) gfx ^= 0xff; for(u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } diff --git a/src/mame/drivers/trs80m2.cpp b/src/mame/drivers/trs80m2.cpp index 2a249824e59..6b971840d1f 100644 --- a/src/mame/drivers/trs80m2.cpp +++ b/src/mame/drivers/trs80m2.cpp @@ -391,7 +391,7 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); int x = 0; @@ -409,7 +409,7 @@ MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) int dout = BIT(data, 7); int color = (dcursor ^ drevid ^ dout) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/ts803.cpp b/src/mame/drivers/ts803.cpp index 3e088f09bbd..62a1a03033a 100644 --- a/src/mame/drivers/ts803.cpp +++ b/src/mame/drivers/ts803.cpp @@ -327,24 +327,23 @@ MC6845_ON_UPDATE_ADDR_CHANGED( ts803_state::crtc_update_addr ) MC6845_UPDATE_ROW( ts803_state::crtc_update_row ) { bool rv = BIT(m_io_dsw->read(), 8) ? 0 : 1; - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = (rv ^ (x == cursor_x)) ? 0xff : 0; + uint8_t inv = (rv ^ (x == cursor_x)) ? 0xff : 0; + uint8_t gfx; if (m_graphics_mode) { - mem = (ra*0x2000 + ma + x) & 0x7fff; + uint16_t mem = (ra*0x2000 + ma + x) & 0x7fff; gfx = m_videoram[mem] ^ inv; } else { - mem = 0x1800 + ((ma + x) & 0x7ff); - chr = m_videoram[mem]; + uint16_t mem = 0x1800 + ((ma + x) & 0x7ff); + uint8_t chr = m_videoram[mem]; gfx = (ra > 7) ? inv : m_p_chargen[(chr<<3) | ((ra+1)&7)] ^ inv; } diff --git a/src/mame/drivers/ttchamp.cpp b/src/mame/drivers/ttchamp.cpp index 41a8430f9ac..17523eb68fe 100644 --- a/src/mame/drivers/ttchamp.cpp +++ b/src/mame/drivers/ttchamp.cpp @@ -186,45 +186,43 @@ void ttchamp_state::video_start() uint32_t ttchamp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { logerror("update\n"); - int y,x,count; + int count; static const int xxx=320,yyy=204; bitmap.fill(m_palette->black_pen()); - uint8_t *videoramfg; - uint8_t* videorambg; + uint8_t const *const videoramfg = (uint8_t*)m_videoram2; + uint8_t const *const videorambg = (uint8_t*)m_videoram0; count=0; - videorambg = (uint8_t*)m_videoram0; - videoramfg = (uint8_t*)m_videoram2; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) + for(int x=0;x<xxx;x++) { - bitmap.pix16(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; + bitmap.pix(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; count++; } } - /* +#if 0 count=0; videoram = (uint8_t*)m_videoram1; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) - { - uint8_t pix = videoram[BYTE_XOR_LE(count)]; - if (pix) bitmap.pix16(y, x) = pix+0x200; - count++; - } + for (int x=0;x<xxx;x++) + { + uint8_t pix = videoram[BYTE_XOR_LE(count)]; + if (pix) bitmap.pix(y, x) = pix+0x200; + count++; + } } - */ +#endif count=0; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) + for(int x=0;x<xxx;x++) { uint8_t pix = videoramfg[BYTE_XOR_LE(count)]; if (pix) @@ -239,16 +237,16 @@ uint32_t ttchamp_state::screen_update(screen_device &screen, bitmap_ind16 &bitma if (pix == 0x01) // blend mode 1 { uint8_t pix = videorambg[BYTE_XOR_LE(count)]; - bitmap.pix16(y, x) = pix + 0x200; + bitmap.pix(y, x) = pix + 0x200; } else if (pix == 0x02) // blend mode 2 { uint8_t pix = videorambg[BYTE_XOR_LE(count)]; - bitmap.pix16(y, x) = pix + 0x100; + bitmap.pix(y, x) = pix + 0x100; } else { - bitmap.pix16(y, x) = pix + 0x000; + bitmap.pix(y, x) = pix + 0x000; } } count++; diff --git a/src/mame/drivers/tulip1.cpp b/src/mame/drivers/tulip1.cpp index b2af48f7fca..a52a7ae8864 100644 --- a/src/mame/drivers/tulip1.cpp +++ b/src/mame/drivers/tulip1.cpp @@ -118,7 +118,7 @@ GFXDECODE_END MC6845_UPDATE_ROW( tulip1_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -127,7 +127,7 @@ MC6845_UPDATE_ROW( tulip1_state::crtc_update_row ) // draw 8 pixels of the character for (int x = 0; x < 8; x++) - bitmap.pix32(y, x + i*8) = pen[BIT(data, 7 - x)]; + bitmap.pix(y, x + i*8) = pen[BIT(data, 7 - x)]; } } diff --git a/src/mame/drivers/tv910.cpp b/src/mame/drivers/tv910.cpp index c5b3803cdf8..3ef568eb70f 100644 --- a/src/mame/drivers/tv910.cpp +++ b/src/mame/drivers/tv910.cpp @@ -465,7 +465,7 @@ void tv910_state::vbl_ack_w(uint8_t data) MC6845_UPDATE_ROW( tv910_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = (ra & 7) | m_charset->read() << 10; uint8_t chr = m_vram[0x7ff]; uint8_t att = (chr & 0xf0) == 0x90 ? chr & 0x0f : 0; @@ -498,14 +498,14 @@ MC6845_UPDATE_ROW( tv910_state::crtc_update_row ) if (bow) data ^= 0xff; - *p = BIT(data, 7) ? bg : fg; p++; - *p = BIT(data, 6) ? bg : fg; p++; - *p = BIT(data, 5) ? bg : fg; p++; - *p = BIT(data, 4) ? bg : fg; p++; - *p = BIT(data, 3) ? bg : fg; p++; - *p = BIT(data, 2) ? bg : fg; p++; - *p = BIT(data, 1) ? bg : fg; p++; - *p = BIT(data, 0) ? bg : fg; p++; + *p++ = BIT(data, 7) ? bg : fg; + *p++ = BIT(data, 6) ? bg : fg; + *p++ = BIT(data, 5) ? bg : fg; + *p++ = BIT(data, 4) ? bg : fg; + *p++ = BIT(data, 3) ? bg : fg; + *p++ = BIT(data, 2) ? bg : fg; + *p++ = BIT(data, 1) ? bg : fg; + *p++ = BIT(data, 0) ? bg : fg; } } diff --git a/src/mame/drivers/tv950.cpp b/src/mame/drivers/tv950.cpp index 4b46e96315b..3db629e060c 100644 --- a/src/mame/drivers/tv950.cpp +++ b/src/mame/drivers/tv950.cpp @@ -259,7 +259,7 @@ MC6845_UPDATE_ROW( tv950_state::crtc_update_row ) else m_attr_screen = m_attr_row; - uint32_t *p = &bitmap.pix32(m_row); + uint32_t *p = &bitmap.pix(m_row); rgb_t fg(255,255,255,255); rgb_t bg(0,0,0,0); diff --git a/src/mame/drivers/tv955.cpp b/src/mame/drivers/tv955.cpp index dfc6f9f67c7..b0f4f055bab 100644 --- a/src/mame/drivers/tv955.cpp +++ b/src/mame/drivers/tv955.cpp @@ -77,7 +77,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(tv955_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/tv990.cpp b/src/mame/drivers/tv990.cpp index 38de5f3b54a..f28d5b01c42 100644 --- a/src/mame/drivers/tv990.cpp +++ b/src/mame/drivers/tv990.cpp @@ -194,51 +194,43 @@ void tv990_state::tvi1111_w(offs_t offset, uint16_t data, uint16_t mem_mask) uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, pixels2; - uint16_t *vram = (uint16_t *)m_vram.target(); - uint8_t *fontram = (uint8_t *)m_fontram.target(); - uint16_t *curchar; - uint8_t *fontptr; - int miny = cliprect.min_y / m_rowh; - int maxy = cliprect.max_y / m_rowh; + uint16_t const *const vram = (uint16_t *)m_vram.target(); + uint8_t const *const fontram = (uint8_t *)m_fontram.target(); + int const miny = cliprect.min_y / m_rowh; + int const maxy = cliprect.max_y / m_rowh; bitmap.fill(0, cliprect); - for (y = miny; y <= maxy; y++) + for (int y = miny; y <= maxy; y++) { - int i; - for(i = 7; i >= 0; i--) + for(int i = 7; i >= 0; i--) { if(!BIT(tvi1111_regs[0x1f], i)) continue; - int starty = tvi1111_regs[i + 0x40] >> 8; - int endy = tvi1111_regs[i + 0x40] & 0xff; + int const starty = tvi1111_regs[i + 0x40] >> 8; + int const endy = tvi1111_regs[i + 0x40] & 0xff; if((y < starty) || (y >= endy)) continue; - uint16_t row_offset = tvi1111_regs[i + 0x50]; - curchar = &vram[row_offset]; + uint16_t const row_offset = tvi1111_regs[i + 0x50]; + uint16_t const *curchar = &vram[row_offset]; int minx = tvi1111_regs[i + 0x30] >> 8; int maxx = tvi1111_regs[i + 0x30] & 0xff; if(maxx > m_width) maxx = m_width; - uint16_t cursor_x = tvi1111_regs[0x16] - row_offset; + uint16_t const cursor_x = tvi1111_regs[0x16] - row_offset; - for (x = minx; x < maxx; x++) + for (int x = minx; x < maxx; x++) { uint8_t chr = curchar[x - minx] >> 8; uint8_t attr = curchar[x - minx] & 0xff; if((attr & 2) && (m_screen->frame_number() & 32)) // blink rate? continue; - fontptr = (uint8_t *)&fontram[(chr + (attr & 0x40 ? 256 : 0)) * 64]; - - uint32_t palette[2]; + uint8_t const *fontptr = &fontram[(chr + (attr & 0x40 ? 256 : 0)) * 64]; if (BIT(tvi1111_regs[0x1b], 0) && x == cursor_x) { @@ -253,6 +245,7 @@ uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, attr ^= attrchg; } + uint32_t palette[2]; if (attr & 0x4) // inverse video? { palette[1] = m_palette->pen(0); @@ -266,32 +259,32 @@ uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int chary = 0; chary < m_rowh; chary++) { - scanline = &bitmap.pix32((y*m_rowh)+chary, (x*16)); + uint32_t *scanline = &bitmap.pix((y*m_rowh)+chary, (x*16)); - pixels = *fontptr++; - pixels2 = *fontptr++; + uint8_t pixels = *fontptr++; + uint8_t pixels2 = *fontptr++; if((attr & 0x8) && (chary == m_rowh - 1)) { pixels = 0xff; pixels2 = 0xff; } - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels2>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels2>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels2>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels2>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels2>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels2>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels2>>1)&1]; - *scanline++ = palette[(pixels&1)]; - *scanline++ = palette[(pixels2&1)]; + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels2, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels2, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels2, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels2, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels2, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels2, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels2, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; + *scanline++ = palette[BIT(pixels2, 0)]; } } } diff --git a/src/mame/drivers/tvc.cpp b/src/mame/drivers/tvc.cpp index 3fff0ca5fca..7dac19358ff 100644 --- a/src/mame/drivers/tvc.cpp +++ b/src/mame/drivers/tvc.cpp @@ -635,18 +635,17 @@ void tvc64p_state::machine_reset() MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vram = &m_vram_base[(m_vram_bank & 0x30)<<10]; - uint16_t offset = ((ma*4 + ra*0x40) & 0x3fff); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vram = &m_vram_base[(m_vram_bank & 0x30)<<10]; + uint16_t const offset = ((ma*4 + ra*0x40) & 0x3fff); switch(m_video_mode) { case 0 : // 2 colors mode - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; + uint8_t const data = vram[offset + i]; *p++ = palette[m_col[BIT(data,7)]]; *p++ = palette[m_col[BIT(data,6)]]; *p++ = palette[m_col[BIT(data,5)]]; @@ -660,9 +659,9 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) case 1 : // 4 colors mode // a0 b0 c0 d0 a1 b1 c1 d1 - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; + uint8_t const data = vram[offset + i]; *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; @@ -676,11 +675,11 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) default: // 16 colors mode // IIGG RRBB - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; - uint8_t col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); - uint8_t col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); + uint8_t const data = vram[offset + i]; + uint8_t const col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); + uint8_t const col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); *p++ = palette[col0]; *p++ = palette[col0]; *p++ = palette[col0]; diff --git a/src/mame/drivers/tvgame.cpp b/src/mame/drivers/tvgame.cpp index 9e8334e16bd..5f2ec5156c5 100644 --- a/src/mame/drivers/tvgame.cpp +++ b/src/mame/drivers/tvgame.cpp @@ -76,15 +76,14 @@ void tvgame_state::speaker_w(uint8_t data) uint32_t tvgame_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,gfx; - uint16_t sy=0,ma=241,x; + uint16_t sy=0,ma=241; - for (y = 0; y < 213; y++) + for (uint8_t y = 0; y < 213; y++) { - uint16_t *p = &bitmap.pix16(sy++); - for (x = ma; x < ma+27; x++) + uint16_t *p = &bitmap.pix(sy++); + for (uint16_t x = ma; x < ma+27; x++) { - gfx = m_p_videoram[x]; + uint8_t gfx = m_p_videoram[x]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 0); diff --git a/src/mame/drivers/twins.cpp b/src/mame/drivers/twins.cpp index 787cfc93da5..611402fdeea 100644 --- a/src/mame/drivers/twins.cpp +++ b/src/mame/drivers/twins.cpp @@ -238,7 +238,7 @@ void twins_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprec { int count = (y * 320) + cliprect.left(); for(int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix16(y, x) = videoram[BYTE_XOR_LE(count++)]; + bitmap.pix(y, x) = videoram[BYTE_XOR_LE(count++)]; } } @@ -260,7 +260,7 @@ void spider_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &clipre { u8 pixel = videoram[BYTE_XOR_LE(count++)]; if (pixel) - bitmap.pix16(y, x) = pixel; + bitmap.pix(y, x) = pixel; } } } diff --git a/src/mame/drivers/ultrsprt.cpp b/src/mame/drivers/ultrsprt.cpp index f79dd7229da..315951ef4fa 100644 --- a/src/mame/drivers/ultrsprt.cpp +++ b/src/mame/drivers/ultrsprt.cpp @@ -72,16 +72,16 @@ private: u32 ultrsprt_state::screen_update_ultrsprt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 *vram = m_vram.get() + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES; + u8 const *const vram = m_vram.get() + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES; for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { int fb_index = y * 1024; - u16 *dest = &bitmap.pix16(y, cliprect.min_x); + u16 *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - u8 p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)]; + u8 const p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)]; if (p1 == 0) *dest++ = vram[BYTE4_XOR_BE(fb_index + x)]; diff --git a/src/mame/drivers/unior.cpp b/src/mame/drivers/unior.cpp index 1e8fafe958f..054e52e24e3 100644 --- a/src/mame/drivers/unior.cpp +++ b/src/mame/drivers/unior.cpp @@ -281,7 +281,7 @@ void unior_state::scroll_w(u8 data) I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = m_p_chargen[(linecount & 7) | (charcode << 3)]; if (vsp) @@ -294,7 +294,7 @@ I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) gfx ^= 0xff; for(u8 i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t unior_pens[3] = diff --git a/src/mame/drivers/unistar.cpp b/src/mame/drivers/unistar.cpp index ea086d988f9..49b9b68a54e 100644 --- a/src/mame/drivers/unistar.cpp +++ b/src/mame/drivers/unistar.cpp @@ -136,7 +136,7 @@ void unistar_state::unistar_palette(palette_device &palette) const I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character) { // This code just a guess, so that we can see something - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = m_chargen[(linecount & 15) | (charcode << 4)]; if (vsp) @@ -149,7 +149,7 @@ I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character) gfx ^= 0xff; for(u8 i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/univac.cpp b/src/mame/drivers/univac.cpp index 403e2ad029f..b0d98788273 100644 --- a/src/mame/drivers/univac.cpp +++ b/src/mame/drivers/univac.cpp @@ -502,7 +502,7 @@ uint32_t univac_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap { for (u8 ra = 0; ra < 14; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); for (uint16_t x = ma; x < ma + 80; x++) { diff --git a/src/mame/drivers/unixpc.cpp b/src/mame/drivers/unixpc.cpp index fa042790363..c28fc92cc3d 100644 --- a/src/mame/drivers/unixpc.cpp +++ b/src/mame/drivers/unixpc.cpp @@ -309,7 +309,7 @@ uint32_t unixpc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 348; y++) for (int x = 0; x < 720/16; x++) for (int b = 0; b < 16; b++) - bitmap.pix16(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); + bitmap.pix(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); return 0; } diff --git a/src/mame/drivers/unkhorse.cpp b/src/mame/drivers/unkhorse.cpp index 432c2ccb57d..ddb9c514cb7 100644 --- a/src/mame/drivers/unkhorse.cpp +++ b/src/mame/drivers/unkhorse.cpp @@ -86,7 +86,7 @@ uint32_t horse_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, uint8_t color = m_colorram[(y << 1 & 0x1e0) | x] >> 4; for (int i = 0; i < 8; i++) - bitmap.pix16(y, x << 3 | i) = (data >> i & 1) ? color : 0; + bitmap.pix(y, x << 3 | i) = (data >> i & 1) ? color : 0; } } diff --git a/src/mame/drivers/unkpoker.cpp b/src/mame/drivers/unkpoker.cpp index 1445d167f1d..4f60318aaa0 100644 --- a/src/mame/drivers/unkpoker.cpp +++ b/src/mame/drivers/unkpoker.cpp @@ -70,7 +70,7 @@ uint32_t unkpoker_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { diff --git a/src/mame/drivers/uzebox.cpp b/src/mame/drivers/uzebox.cpp index f7407df54c4..2d1399d0b1c 100644 --- a/src/mame/drivers/uzebox.cpp +++ b/src/mame/drivers/uzebox.cpp @@ -242,10 +242,10 @@ void uzebox_state::line_update() for (uint32_t x = m_line_pos_cycles; x < cycles; x++) { if (m_bitmap.cliprect().contains(x, m_vpos)) - m_bitmap.pix32(m_vpos, x) = color; + m_bitmap.pix(m_vpos, x) = color; if (!INTERLACED) if (m_bitmap.cliprect().contains(x, m_vpos + 1)) - m_bitmap.pix32(m_vpos + 1, x) = color; + m_bitmap.pix(m_vpos + 1, x) = color; } m_line_pos_cycles = cycles; diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index 60103982180..ab00be275cd 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -177,16 +177,14 @@ GFXDECODE_END MC6845_UPDATE_ROW( v6809_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/vboy.cpp b/src/mame/drivers/vboy.cpp index ef69def55cc..3dbaf47a3eb 100644 --- a/src/mame/drivers/vboy.cpp +++ b/src/mame/drivers/vboy.cpp @@ -227,7 +227,7 @@ void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, { uint8_t const col = (pal >> (dat * 2)) & 3; - bitmap.pix16((res_y), (res_x)) = m_palette->pen(col); + bitmap.pix((res_y), (res_x)) = m_palette->pen(col); } } } @@ -288,9 +288,8 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num) { // g_profiler.start(PROFILER_USER2); - int x,y; - for(y=0;y<=h;y++) + for(int y=0;y<=h;y++) { int32_t y1 = (y+gy); @@ -299,7 +298,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui int src_y = y+my; - for(x=0;x<=w;x++) + for(int x=0;x<=w;x++) { int32_t x1 = (x+gx); @@ -336,7 +335,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui } if(pix != -1) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + bitmap.pix(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -346,9 +345,8 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num) { // g_profiler.start(PROFILER_USER3); - int x,y; - for(y=0;y<=h;y++) + for(int y=0;y<=h;y++) { float h_skw = (int16_t)READ_BGMAP(param_base + (y*8+0)) / 8.0; float prlx = (int16_t)READ_BGMAP(param_base + (y*8+1)) / 8.0; @@ -358,7 +356,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect h_skw += right ? -prlx : prlx; - for(x=0;x<=w;x++) + for(int x=0;x<=w;x++) { int32_t src_x,src_y; int16_t y1 = (y+gy); @@ -381,7 +379,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect if(pix != -1) if (cliprect.contains(x1, y1)) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + bitmap.pix(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -421,7 +419,6 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle uint16_t param_base = READ_WORLD(num+9) & 0xfff0; uint16_t ovr_char = READ_BGMAP(READ_WORLD(num+10)); uint8_t bg_map_num = def & 0x0f; - int i; if(end) return 1; @@ -458,21 +455,19 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle } else if (mode==3) // OBJ Mode { - int start_offs, end_offs; - if(cur_spt == -1) { popmessage("Cur spt used with -1 pointer!"); return 0; } - start_offs = m_vip_regs.SPT[cur_spt]; + int start_offs = m_vip_regs.SPT[cur_spt]; - end_offs = 0x3ff; + int end_offs = 0x3ff; if(cur_spt != 0) end_offs = m_vip_regs.SPT[cur_spt-1]; - i = start_offs; + int i = start_offs; do { uint16_t start_ndx = i * 4; @@ -489,12 +484,12 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle if(right && jron) put_obj(bitmap, cliprect, (jx+jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); - i --; + i--; i &= 0x3ff; }while(i != end_offs); if((lon && !right) || (ron && right)) - cur_spt --; + cur_spt--; } return 0; @@ -514,21 +509,15 @@ uint32_t vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 if(0) { - int x,y; - - for(y=0;y<224;y++) + for(int y=0;y<224;y++) { - for(x=0;x<384;x++) + for(int x=0;x<384;x++) { - uint8_t pen; - uint8_t pix; - int yi; - - pen = m_l_frame_1[(x*0x40)+(y >> 2)]; - yi = ((y & 0x3)*2); - pix = (pen >> yi) & 3; + uint8_t pen = m_l_frame_1[(x*0x40)+(y >> 2)]; + int yi = ((y & 0x3)*2); + uint8_t pix = (pen >> yi) & 3; - bitmap.pix16(y, x) = m_palette->pen(pix & 3); + bitmap.pix(y, x) = m_palette->pen(pix & 3); } } } diff --git a/src/mame/drivers/vcombat.cpp b/src/mame/drivers/vcombat.cpp index ef93aec1594..3dd856f4fb8 100644 --- a/src/mame/drivers/vcombat.cpp +++ b/src/mame/drivers/vcombat.cpp @@ -173,20 +173,18 @@ uint32_t vcombat_state::update_screen(screen_device &screen, bitmap_rgb32 &bitma for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { - int x; int src_addr = 256/2 * y; const uint16_t *m68k_src = &m68k_buf[src_addr]; const uint16_t *i860_src = &i860_buf[src_addr]; - uint32_t *dst = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dst = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - int i; uint16_t m68k_pix = *m68k_src++; uint16_t i860_pix = *i860_src++; /* Draw two pixels */ - for (i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) { /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors. Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */ diff --git a/src/mame/drivers/vegaeo.cpp b/src/mame/drivers/vegaeo.cpp index 796a3c03332..62fb7c9f077 100644 --- a/src/mame/drivers/vegaeo.cpp +++ b/src/mame/drivers/vegaeo.cpp @@ -167,7 +167,7 @@ uint32_t vegaeo_state::screen_update_vega(screen_device &screen, bitmap_ind16 &b { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[0x14000 * (m_vbuffer ^ 1) + (y * 320) + x] & 0xff; + bitmap.pix(y, x) = m_vram[0x14000 * (m_vbuffer ^ 1) + (y * 320) + x] & 0xff; } } return 0; diff --git a/src/mame/drivers/victor9k.cpp b/src/mame/drivers/victor9k.cpp index fae63959c6e..b42e75619b5 100644 --- a/src/mame/drivers/victor9k.cpp +++ b/src/mame/drivers/victor9k.cpp @@ -304,7 +304,7 @@ MC6845_UPDATE_ROW( victor9k_state::crtc_update_row ) color = palette[pen]; } - bitmap.pix32(vbp + y, x++) = color; + bitmap.pix(vbp + y, x++) = color; } aa += 2; diff --git a/src/mame/drivers/video21.cpp b/src/mame/drivers/video21.cpp index 66a1ed5521e..6af36ce0652 100644 --- a/src/mame/drivers/video21.cpp +++ b/src/mame/drivers/video21.cpp @@ -74,19 +74,18 @@ private: uint32_t video21_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 28; y++) + for (uint8_t y = 0; y < 28; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 32; x++) + for (uint16_t x = 0; x < 32; x++) { - chr = m_p_videoram[x+ma] & 0x7f; - gfx = m_p_chargen[(chr<<3) | ra ]; + uint8_t chr = m_p_videoram[x+ma] & 0x7f; + uint8_t gfx = m_p_chargen[(chr<<3) | ra ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/vis.cpp b/src/mame/drivers/vis.cpp index 1ade543187c..816e0764017 100644 --- a/src/mame/drivers/vis.cpp +++ b/src/mame/drivers/vis.cpp @@ -316,11 +316,11 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect { const uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int pos, line, column, col, addr, curr_addr = 0; + int curr_addr = 0; const uint8_t decode_tbl[] = {0, 1, 2, 3, 4, 5, 6, 9, 12, 17, 22, 29, 38, 50, 66, 91, 128, 165, 190, 206, 218, 227, 234, 239, 244, 247, 250, 251, 252, 253, 254, 255}; - for (addr = vga.crtc.start_addr, line=0; line<(vga.crtc.vert_disp_end+1); line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = vga.crtc.start_addr, line=0; line<(vga.crtc.vert_disp_end+1); line+=height, addr+=offset(), curr_addr+=offset()) { for(int yi = 0;yi < height; yi++) { @@ -329,7 +329,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect curr_addr = addr; if((line + yi) == (vga.crtc.line_compare & 0x3ff)) curr_addr = 0; - for (pos=curr_addr, col=0, column=0; column<(vga.crtc.horz_disp_end+1); column++, col+=8, pos+=8) + for (int pos=curr_addr, col=0, column=0; column<(vga.crtc.horz_disp_end+1); column++, col+=8, pos+=8) { if(pos + 0x08 > 0x80000) return; @@ -340,8 +340,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect continue; uint8_t a = vga.memory[pos + xi], b = vga.memory[pos + xi + 1]; uint8_t c = vga.memory[pos + xi + 2], d = vga.memory[pos + xi + 3]; - uint8_t y[4], ub, vb, trans; - uint16_t u, v; + uint8_t y[4], ub, vb; if(col || xi) { y[0] = decode_tbl[a & 0x1f] + ydelta; @@ -357,9 +356,9 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect y[1] = decode_tbl[b & 0x1f] + y[0]; y[2] = decode_tbl[c & 0x1f] + y[1]; y[3] = decode_tbl[d & 0x1f] + y[2]; - trans = (a >> 7) | ((c >> 6) & 2); - u = ua; - v = va; + uint8_t trans = (a >> 7) | ((c >> 6) & 2); + uint16_t u = ua; + uint16_t v = va; for(int i = 0; i < 4; i++) { if(i == trans) @@ -372,7 +371,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect u = ub; v = vb; } - bitmap.pix32(line + yi, col + xi + i) = IV | (uint32_t)yuv_to_rgb(y[i], u, v); + bitmap.pix(line + yi, col + xi + i) = IV | (uint32_t)yuv_to_rgb(y[i], u, v); } ua = ub; va = vb; diff --git a/src/mame/drivers/vixen.cpp b/src/mame/drivers/vixen.cpp index 545e5f83ead..4c926f7c6ea 100644 --- a/src/mame/drivers/vixen.cpp +++ b/src/mame/drivers/vixen.cpp @@ -417,7 +417,7 @@ uint32_t vixen_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { int color = BIT(gfx, 7 - b); - bitmap.pix32((y * 10) + ra, (x * 8) + b) = pen[color]; + bitmap.pix((y * 10) + ra, (x * 8) + b) = pen[color]; } } } diff --git a/src/mame/drivers/vk100.cpp b/src/mame/drivers/vk100.cpp index b56b800fdbb..cb3e4ee42db 100644 --- a/src/mame/drivers/vk100.cpp +++ b/src/mame/drivers/vk100.cpp @@ -1025,7 +1025,7 @@ MC6845_UPDATE_ROW( vk100_state::crtc_update_row ) // display a 12-bit wide chunk for (int j = 0; j < 12; j++) { - bitmap.pix32(y, (12*i)+j) = (((block&(0x0001<<j))?1:0)^(m_vgSOPS&1))?fgColor:bgColor; + bitmap.pix(y, (12*i)+j) = (((block&(0x0001<<j))?1:0)^(m_vgSOPS&1))?fgColor:bgColor; } } } diff --git a/src/mame/drivers/vp101.cpp b/src/mame/drivers/vp101.cpp index dc094bf91b7..aea28ee884f 100644 --- a/src/mame/drivers/vp101.cpp +++ b/src/mame/drivers/vp101.cpp @@ -275,7 +275,7 @@ uint32_t vp10x_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (int y = 0; y < 240; y++) { - uint32_t *line = &bitmap.pix32(y); + uint32_t *line = &bitmap.pix(y); const uint32_t *video_ram = (const uint32_t *) &m_mainram[(m_fb_base/4) + (y * (0x1000/4)) + 4]; for (int x = 0; x < 320; x++) @@ -306,7 +306,7 @@ uint32_t vp10x_state::vp50_screen_update(screen_device &screen, bitmap_rgb32 &bi for (int y = 0; y < 240; y++) { - uint32_t *line = &bitmap.pix32(y); + uint32_t *line = &bitmap.pix(y); const uint8_t *video_ram = (const uint8_t *) &m_mainram[(0x10000/4)+(y * 100)]; for (int x = 0; x < 400; x++) diff --git a/src/mame/drivers/vt1682.cpp b/src/mame/drivers/vt1682.cpp index 82dc11ebf92..3c815bbe116 100644 --- a/src/mame/drivers/vt1682.cpp +++ b/src/mame/drivers/vt1682.cpp @@ -4295,11 +4295,11 @@ void vt_vt1682_state::draw_tile_pixline(int segment, int tile, int tileline, int else currentaddress = startaddress + ((tilesize_high - 1) - tileline) * linebytes; - uint8_t* pri2ptr = &m_pal2_priority_bitmap.pix8(y); - uint8_t* pri1ptr = &m_pal1_priority_bitmap.pix8(y); + uint8_t *const pri2ptr = &m_pal2_priority_bitmap.pix(y); + uint8_t *const pri1ptr = &m_pal1_priority_bitmap.pix(y); - uint8_t* pix2ptr = &m_pal2_pix_bitmap.pix8(y); - uint8_t* pix1ptr = &m_pal1_pix_bitmap.pix8(y); + uint8_t *const pix2ptr = &m_pal2_pix_bitmap.pix(y); + uint8_t *const pix1ptr = &m_pal1_pix_bitmap.pix(y); int shift_amount, mask, bytes_in; @@ -5042,12 +5042,12 @@ uint32_t vt_vt1682_state::screen_update(screen_device& screen, bitmap_rgb32& bit for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const pen_t* paldata = m_palette->pens(); - uint8_t* pri2ptr = &m_pal2_priority_bitmap.pix8(y); - uint8_t* pri1ptr = &m_pal1_priority_bitmap.pix8(y); - uint8_t* pix2ptr = &m_pal2_pix_bitmap.pix8(y); - uint8_t* pix1ptr = &m_pal1_pix_bitmap.pix8(y); - uint32_t* dstptr = &bitmap.pix32(y); + pen_t const *const paldata = m_palette->pens(); + uint8_t const *const pri2ptr = &m_pal2_priority_bitmap.pix(y); + uint8_t const *const pri1ptr = &m_pal1_priority_bitmap.pix(y); + uint8_t const *const pix2ptr = &m_pal2_pix_bitmap.pix(y); + uint8_t const *const pix1ptr = &m_pal1_pix_bitmap.pix(y); + uint32_t *const dstptr = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp index b8a29a08829..c40cc146cf2 100644 --- a/src/mame/drivers/vt240.cpp +++ b/src/mame/drivers/vt240.cpp @@ -201,10 +201,7 @@ READ_LINE_MEMBER(vt240_state::i8085_sid_r) UPD7220_DISPLAY_PIXELS_MEMBER( vt240_state::hgdc_draw ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - int xi, gfx1, gfx2; - uint8_t vom; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(!BIT(m_reg0, 7)) { @@ -212,14 +209,14 @@ UPD7220_DISPLAY_PIXELS_MEMBER( vt240_state::hgdc_draw ) vram_w((0x20000 + address) >> 1, 0); } - gfx1 = m_video_ram[(address & 0x7fff) >> 1]; - gfx2 = m_video_ram[((address & 0x7fff) + 0x8000) >> 1]; + int const gfx1 = m_video_ram[(address & 0x7fff) >> 1]; + int const gfx2 = m_video_ram[((address & 0x7fff) + 0x8000) >> 1]; - bool color = m_monitor->read() ? true : false; - for(xi=0;xi<16;xi++) + bool const color = m_monitor->read() ? true : false; + for(int xi=0;xi<16;xi++) { - vom = BIT(gfx1, xi) | (BIT(gfx2, xi) << 1) | ((m_reg0 & 3) << 2); - bitmap.pix32(y, x + xi) = palette[color ? (vom + 16) : vom]; + uint8_t const vom = BIT(gfx1, xi) | (BIT(gfx2, xi) << 1) | ((m_reg0 & 3) << 2); + bitmap.pix(y, x + xi) = palette[color ? (vom + 16) : vom]; } } diff --git a/src/mame/drivers/vta2000.cpp b/src/mame/drivers/vta2000.cpp index 974bd16f0d0..db6f3cea898 100644 --- a/src/mame/drivers/vta2000.cpp +++ b/src/mame/drivers/vta2000.cpp @@ -100,29 +100,28 @@ void vta2000_state::machine_reset() uint32_t vta2000_state::screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) /* Cursor is missing. */ { - static uint8_t framecnt=0; - uint8_t y,ra,gfx,attr,fg,bg; - uint16_t sy=0,ma=0,x,xx=0,chr; + static uint8_t framecnt=0; // FIXME: static variable + uint16_t sy=0,ma=0; framecnt++; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - xx = ma << 1; - for (x = ma; x < ma + 80; x++) + uint16_t xx = ma << 1; + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[xx++]; - attr = m_p_videoram[xx++]; + uint16_t chr = m_p_videoram[xx++]; + uint8_t const attr = m_p_videoram[xx++]; if ((chr & 0x60)==0x60) chr+=256; - gfx = m_p_chargen[(chr<<4) | ra ]; - bg = 0; + uint8_t gfx = m_p_chargen[(chr<<4) | ra ]; + uint8_t fg, bg = 0; /* Process attributes */ if (BIT(attr, 4)) diff --git a/src/mame/drivers/warpsped.cpp b/src/mame/drivers/warpsped.cpp index 53c6360c58d..fe66335c014 100644 --- a/src/mame/drivers/warpsped.cpp +++ b/src/mame/drivers/warpsped.cpp @@ -171,7 +171,7 @@ static void draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l, int colo { if (y >= 0 && y <= bitmap.height() - 1) { - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int h1 = x - l; int h2 = x + l; diff --git a/src/mame/drivers/wheelfir.cpp b/src/mame/drivers/wheelfir.cpp index 0a462c9f937..2443bdf0bf9 100644 --- a/src/mame/drivers/wheelfir.cpp +++ b/src/mame/drivers/wheelfir.cpp @@ -276,9 +276,6 @@ void wheelfir_state::wheelfir_blit_w(offs_t offset, uint16_t data, uint16_t mem_ if(!ACCESSING_BITS_8_15 && offset==0x6) //LSB only! { - int x,y; - - int direct_width=m_direct_write_x1-m_direct_write_x0+1; int direct_height=m_direct_write_y1-m_direct_write_y0+1; @@ -286,203 +283,197 @@ void wheelfir_state::wheelfir_blit_w(offs_t offset, uint16_t data, uint16_t mem_ if(direct_width>0 && direct_height>0) { - x= m_direct_write_idx % direct_width; - y = (m_direct_write_idx / direct_width) %direct_height; + int x = m_direct_write_idx % direct_width; + int y = (m_direct_write_idx / direct_width) % direct_height; x+=m_direct_write_x0; y+=m_direct_write_y0; if(x<512 && y <512) { - m_tmp_bitmap[LAYER_BG]->pix16(y, x) = sixdat; + m_tmp_bitmap[LAYER_BG]->pix(y, x) = sixdat; } } ++m_direct_write_idx; return; - } if(offset==0xf && data==0xffff) { m_maincpu->set_input_line(1, HOLD_LINE); - { - uint8_t *rom = memregion("gfx1")->base(); + uint8_t const *const rom = memregion("gfx1")->base(); - int width = m_screen->width(); - int height = m_screen->height(); + int width = m_screen->width(); + int height = m_screen->height(); - int src_x0=(m_blitter_data[0]>>8)+((m_blitter_data[6]&0x100)?256:0); - int src_y0=(m_blitter_data[2]>>8)+((m_blitter_data[6]&0x200)?256:0); + int src_x0=(m_blitter_data[0]>>8)+((m_blitter_data[6]&0x100)?256:0); + int src_y0=(m_blitter_data[2]>>8)+((m_blitter_data[6]&0x200)?256:0); - int dst_x0=(m_blitter_data[0]&0xff)+((m_blitter_data[7]&0x40)?256:0); - int dst_y0=(m_blitter_data[2]&0xff)+((m_blitter_data[7]&0x80)?256:0); + int dst_x0=(m_blitter_data[0]&0xff)+((m_blitter_data[7]&0x40)?256:0); + int dst_y0=(m_blitter_data[2]&0xff)+((m_blitter_data[7]&0x80)?256:0); - int dst_x1=(m_blitter_data[1]&0xff)+((m_blitter_data[9]&4)?256:0); - int dst_y1=(m_blitter_data[3]&0xff)+((m_blitter_data[9]&8)?256:0); + int dst_x1=(m_blitter_data[1]&0xff)+((m_blitter_data[9]&4)?256:0); + int dst_y1=(m_blitter_data[3]&0xff)+((m_blitter_data[9]&8)?256:0); - int x_dst_step=(m_blitter_data[7]&0x1)?1:-1; - int y_dst_step=(m_blitter_data[7]&0x2)?1:-1; + int x_dst_step=(m_blitter_data[7]&0x1)?1:-1; + int y_dst_step=(m_blitter_data[7]&0x2)?1:-1; - int x_src_step=(m_blitter_data[8]&0x4000)?1:-1; - int y_src_step=(m_blitter_data[8]&0x8000)?1:-1; + int x_src_step=(m_blitter_data[8]&0x4000)?1:-1; + int y_src_step=(m_blitter_data[8]&0x8000)?1:-1; - int page=((m_blitter_data[6])>>10)*0x40000; + int page=((m_blitter_data[6])>>10)*0x40000; - if(page>=0x400000) /* src set to unav. page before direct write to the framebuffer */ - { - m_direct_write_x0=dst_x0; - m_direct_write_x1=dst_x1; - m_direct_write_y0=dst_y0; - m_direct_write_y1=dst_y1; - m_direct_write_idx=0; + if(page>=0x400000) /* src set to unav. page before direct write to the framebuffer */ + { + m_direct_write_x0=dst_x0; + m_direct_write_x1=dst_x1; + m_direct_write_y0=dst_y0; + m_direct_write_y1=dst_y1; + m_direct_write_idx=0; + } + if(x_dst_step<0) + { + if(dst_x0<=dst_x1) + { + return; } - if(x_dst_step<0) + } + else + { + if(dst_x0>=dst_x1) { - if(dst_x0<=dst_x1) - { - return; - } - + return; } - else - { - if(dst_x0>=dst_x1) - { - return; - } - } + } - if(y_dst_step<0) + if(y_dst_step<0) + { + if(dst_y0<=dst_y1) { - if(dst_y0<=dst_y1) - { - return; - } + return; } - else + } + else + { + if(dst_y0>=dst_y1) { - if(dst_y0>=dst_y1) - { - return; - } - + return; } + } - //additional checks - - int d1, d2, hflag, dflag, index; - d1=((m_blitter_data[0x0a]&0x1f00)>>8); + //additional checks - d2=((m_blitter_data[0x0b]&0x1f00)>>8); + int d1, d2, hflag, dflag, index; + d1=((m_blitter_data[0x0a]&0x1f00)>>8); - d1|=((m_blitter_data[0x8]&0x100)>>3); - d2|=((m_blitter_data[0x8]&0x400)>>5); - hflag=(m_blitter_data[0x9]&0x1)?1:0; - dflag=(m_blitter_data[0x8]&0x1000)?1:0; - index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + d2=((m_blitter_data[0x0b]&0x1f00)>>8); - float scale_x=get_scale(index); + d1|=((m_blitter_data[0x8]&0x100)>>3); + d2|=((m_blitter_data[0x8]&0x400)>>5); + hflag=(m_blitter_data[0x9]&0x1)?1:0; + dflag=(m_blitter_data[0x8]&0x1000)?1:0; + index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); - d1=((m_blitter_data[0x0b]&0xc000)>>14) | - ((m_blitter_data[0x0c]&0xc000)>>12) | - ((m_blitter_data[0x0a]&0x4000)>>10); + const float scale_x=get_scale(index); - d2=((m_blitter_data[0x0c]&0x1f00)>>8); + d1=((m_blitter_data[0x0b]&0xc000)>>14) | + ((m_blitter_data[0x0c]&0xc000)>>12) | + ((m_blitter_data[0x0a]&0x4000)>>10); - d1|=((m_blitter_data[0x8]&0x200)>>4); - d2|=((m_blitter_data[0x8]&0x800)>>6); + d2=((m_blitter_data[0x0c]&0x1f00)>>8); - hflag=(m_blitter_data[0x9]&0x2)?1:0; - dflag=(m_blitter_data[0x8]&0x2000)?1:0; - index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + d1|=((m_blitter_data[0x8]&0x200)>>4); + d2|=((m_blitter_data[0x8]&0x800)>>6); - float scale_y=get_scale(index); + hflag=(m_blitter_data[0x9]&0x2)?1:0; + dflag=(m_blitter_data[0x8]&0x2000)?1:0; + index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + const float scale_y=get_scale(index); - if(scale_x==0 || scale_y==0) return; + if(scale_x==0 || scale_y==0) return; - float scale_x_step=100.f/scale_x; - float scale_y_step=100.f/scale_y; + const float scale_x_step=100.f/scale_x; + const float scale_y_step=100.f/scale_y; - int x,y; - float idx_x,idx_y; - int vpage=LAYER_FG; - if(m_blitter_data[0x7]&0x10) - { - vpage=LAYER_BG; + int vpage=LAYER_FG; + if(m_blitter_data[0x7]&0x10) + { + vpage=LAYER_BG; /* - printf("%s bg -> %d %d %d %d %d %d @ %x\n",machine().describe_context().c_str(), dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0); + printf("%s bg -> %d %d %d %d %d %d @ %x\n",machine().describe_context().c_str(), dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0); - for(int i=0;i<16;++i) - { - printf("%x = %.4x\n",i,m_blitter_data[i]); - } + for(int i=0;i<16;++i) + { + printf("%x = %.4x\n",i,m_blitter_data[i]); + } - printf("\n"); + printf("\n"); */ - } + } - bool endx=false; - bool endy=false; + bool endx=false; + bool endy=false; - if(m_blitter_data[0x7]&0x0c) - { - //??? - } + if(m_blitter_data[0x7]&0x0c) + { + //??? + } - for( x=dst_x0, idx_x=0 ; !endx;x+=x_dst_step, idx_x+=scale_x_step ) + float idx_x = 0; + for(int x=dst_x0; !endx; x+=x_dst_step, idx_x+=scale_x_step) + { + endy=false; + float idx_y = 0; + for(int y=dst_y0; !endy; y+=y_dst_step, idx_y+=scale_y_step) { - endy=false; - for( y=dst_y0, idx_y=0 ; !endy;y+=y_dst_step, idx_y+=scale_y_step) - { - endx=(x==dst_x1); - endy=(y==dst_y1); + endx=(x==dst_x1); + endy=(y==dst_y1); - int xx=src_x0+x_src_step*idx_x; - int yy=src_y0+y_src_step*idx_y; + int xx=src_x0+x_src_step*idx_x; + int yy=src_y0+y_src_step*idx_y; - int address=page+yy*512+xx; + int address=page+yy*512+xx; - int pix = rom[address&(0x1000000-1)]; + int pix = rom[address&(0x1000000-1)]; - int screen_x=x; - int screen_y=y; + int screen_x=x; + int screen_y=y; - if(page>=0x400000) + if(page>=0x400000) + { + //hack for clear + if(screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) { - //hack for clear - if(screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) - { - // m_tmp_bitmap[vpage]->pix16(screen_y , screen_x ) =0; - } + // m_tmp_bitmap[vpage]->pix(screen_y , screen_x ) =0; } - else - { - if (vpage == LAYER_FG) screen_y&=0xff; + } + else + { + if (vpage == LAYER_FG) screen_y&=0xff; - if(pix && screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) - { - m_tmp_bitmap[vpage]->pix16(screen_y , screen_x ) = pix; - } + if(pix && screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) + { + m_tmp_bitmap[vpage]->pix(screen_y, screen_x) = pix; } } } @@ -502,22 +493,19 @@ uint32_t wheelfir_state::screen_update_wheelfir(screen_device &screen, bitmap_in for(int y=cliprect.min_y; y < cliprect.max_y; y++) { - uint16_t *source = &m_tmp_bitmap[LAYER_BG]->pix16(( (m_scanlines[y].y)&511)); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const source = &m_tmp_bitmap[LAYER_BG]->pix(( (m_scanlines[y].y)&511)); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x < cliprect.max_x; x++) { - dest[x] = source[ (x+(m_scanlines[y].x)) &511]; + dest[x] = source[(x + m_scanlines[y].x) & 511]; } } copybitmap_trans(bitmap, *m_tmp_bitmap[LAYER_FG], 0, 0, 0, 0, cliprect, 0); /* - { - m_tmp_bitmap[LAYER_BG]->fill(0, screen.visible_area()); - - } + m_tmp_bitmap[LAYER_BG]->fill(0, screen.visible_area()); */ return 0; diff --git a/src/mame/drivers/wicat.cpp b/src/mame/drivers/wicat.cpp index 7c273fc5b04..32283d00bfc 100644 --- a/src/mame/drivers/wicat.cpp +++ b/src/mame/drivers/wicat.cpp @@ -623,13 +623,13 @@ WRITE_LINE_MEMBER(wicat_state::crtc_irq_clear_w) I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels) { uint8_t romdata = vsp ? 0 : m_chargen->base()[(charcode << 4) | linecount]; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < 10; i++) { int color = ((romdata & 0xc0) != 0) ^ rvv; - bitmap.pix32(y, x + i) = pen[color]; + bitmap.pix(y, x + i) = pen[color]; romdata <<= 1; } } diff --git a/src/mame/drivers/wpc_dot.cpp b/src/mame/drivers/wpc_dot.cpp index 8dc47fb4784..0b677efd3a6 100644 --- a/src/mame/drivers/wpc_dot.cpp +++ b/src/mame/drivers/wpc_dot.cpp @@ -249,22 +249,21 @@ WRITE_LINE_MEMBER(wpc_dot_state::wpc_firq_w) uint32_t wpc_dot_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y,bit; uint32_t offset = (m_wpc->get_visible_page() * 0x200); - uint32_t col; - for(y=0;y<32;y++) // scanline + for(uint8_t y=0;y<32;y++) // scanline { - for(x=0;x<128;x+=8) // column + for(uint8_t x=0;x<128;x+=8) // column { - for(bit=0;bit<8;bit++) // bits + for(uint8_t bit=0;bit<8;bit++) // bits { assert(offset >= 0 && offset < ARRAY_LENGTH(m_dmdram)); + uint32_t col; if(m_dmdram[offset] & (1<<bit)) col = rgb_t(0xff,0xaa,0x00); else col = rgb_t(0x00,0x00,0x00); - bitmap.pix32(y,x+bit) = col; + bitmap.pix(y,x+bit) = col; } offset++; } diff --git a/src/mame/drivers/wy100.cpp b/src/mame/drivers/wy100.cpp index 693c37039fc..46522a98922 100644 --- a/src/mame/drivers/wy100.cpp +++ b/src/mame/drivers/wy100.cpp @@ -111,7 +111,7 @@ I8275_DRAW_CHARACTER_MEMBER(wy100_state::draw_character) const rgb_t fg = rgb_t::white(); const rgb_t bg = rgb_t::black(); for (int i = 0; i < 10; i++) - bitmap.pix32(y, x + i) = BIT(dots, i < 1 || i > 8 ? 7 : 8 - i) ? fg : bg; + bitmap.pix(y, x + i) = BIT(dots, i < 1 || i > 8 ? 7 : 8 - i) ? fg : bg; } WRITE_LINE_MEMBER(wy100_state::txd_w) diff --git a/src/mame/drivers/wy50.cpp b/src/mame/drivers/wy50.cpp index a8d01829a15..434b0b041ad 100644 --- a/src/mame/drivers/wy50.cpp +++ b/src/mame/drivers/wy50.cpp @@ -158,11 +158,11 @@ SCN2672_DRAW_CHARACTER_MEMBER(wy50_state::draw_character) const rgb_t fg = BIT(m_cur_attr, 0) || (prot && !m_rev_prot) ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); dots <<= 1; } if (!m_is_132) - bitmap.pix32(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); } WRITE_LINE_MEMBER(wy50_state::mbc_attr_clock_w) diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index 9a0948aa6db..87fa7b56c7e 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -1094,9 +1094,9 @@ uint32_t x07_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c for(int y = 0; y < 8; y++) for (int x=0; x<6; x++) if(m_cursor.on && m_blink && m_cursor.x == px && m_cursor.y == py) - bitmap.pix16(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; + bitmap.pix(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; else - bitmap.pix16(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; + bitmap.pix(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; } diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp index 64bd8293172..02d48199d76 100644 --- a/src/mame/drivers/xerox820.cpp +++ b/src/mame/drivers/xerox820.cpp @@ -480,25 +480,25 @@ WRITE_LINE_MEMBER( xerox820_state::fdc_drq_w ) uint32_t xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=(m_scroll + 1) * 0x80,x; - const pen_t *pen=m_palette->pens(); + uint16_t sy=0,ma=(m_scroll + 1) * 0x80; + pen_t const *const pen=m_palette->pens(); m_framecnt++; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { if (ma > 0xb80) ma = 0; - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { + uint8_t gfx; if (ra < 8) { - chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; + uint8_t chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; /* Take care of flashing characters */ if ((chr < 0x80) && (m_framecnt & 0x08)) @@ -510,14 +510,14 @@ uint32_t xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else gfx = 0xff; - /* Display a scanline of a character (7 pixels) */ - *p++ = pen[0]; - *p++ = pen[BIT(gfx, 4) ^ 1]; - *p++ = pen[BIT(gfx, 3) ^ 1]; - *p++ = pen[BIT(gfx, 2) ^ 1]; - *p++ = pen[BIT(gfx, 1) ^ 1]; - *p++ = pen[BIT(gfx, 0) ^ 1]; - *p++ = pen[0]; + /* Display a scanline of a character (7 pixels) */ + *p++ = pen[0]; + *p++ = pen[BIT(gfx, 4) ^ 1]; + *p++ = pen[BIT(gfx, 3) ^ 1]; + *p++ = pen[BIT(gfx, 2) ^ 1]; + *p++ = pen[BIT(gfx, 1) ^ 1]; + *p++ = pen[BIT(gfx, 0) ^ 1]; + *p++ = pen[0]; } } ma+=128; diff --git a/src/mame/drivers/xtheball.cpp b/src/mame/drivers/xtheball.cpp index a1971a6f27f..eae17c07c2a 100644 --- a/src/mame/drivers/xtheball.cpp +++ b/src/mame/drivers/xtheball.cpp @@ -77,19 +77,18 @@ void xtheball_state::machine_start() TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update) { - uint16_t *srcbg = &m_vram_bg[(params->rowaddr << 8) & 0xff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const srcbg = &m_vram_bg[(params->rowaddr << 8) & 0xff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr; - int x; /* bit stored at 3040130 controls which foreground mode to use */ if (!m_foreground_mode) { /* mode 0: foreground is the same as background */ - uint16_t *srcfg = &m_vram_fg[(params->rowaddr << 8) & 0xff00]; + uint16_t const *const srcfg = &m_vram_fg[(params->rowaddr << 8) & 0xff00]; - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t fgpix = srcfg[coladdr & 0xff]; uint16_t bgpix = srcbg[coladdr & 0xff]; @@ -102,9 +101,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update) { /* mode 1: foreground is half background resolution in */ /* X and supports two pages */ - uint16_t *srcfg = &m_vram_fg[(params->rowaddr << 7) & 0xff00]; + uint16_t const *const srcfg = &m_vram_fg[(params->rowaddr << 7) & 0xff00]; - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t fgpix = srcfg[(coladdr >> 1) & 0xff] >> (8 * (coladdr & 1)); uint16_t bgpix = srcbg[coladdr & 0xff]; diff --git a/src/mame/drivers/xyonix.cpp b/src/mame/drivers/xyonix.cpp index 80126638f8d..4308d390c03 100644 --- a/src/mame/drivers/xyonix.cpp +++ b/src/mame/drivers/xyonix.cpp @@ -197,10 +197,10 @@ MC6845_UPDATE_ROW( xyonix_state::crtc_update_row ) uint16_t data = m_gfx->base()[0x8000 | tile] << 8 | m_gfx->base()[tile]; // draw 4 pixels - bitmap.pix32(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; - bitmap.pix32(y, i * 4 + 1) = pen[(attr & 0xf0) | bitswap<4>(data, 5, 1, 13, 9)]; - bitmap.pix32(y, i * 4 + 2) = pen[(attr & 0xf0) | bitswap<4>(data, 6, 2, 14, 10)]; - bitmap.pix32(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; + bitmap.pix(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; + bitmap.pix(y, i * 4 + 1) = pen[(attr & 0xf0) | bitswap<4>(data, 5, 1, 13, 9)]; + bitmap.pix(y, i * 4 + 2) = pen[(attr & 0xf0) | bitswap<4>(data, 6, 2, 14, 10)]; + bitmap.pix(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; } } #endif diff --git a/src/mame/drivers/ymdx11.cpp b/src/mame/drivers/ymdx11.cpp index 0de96879f69..6b131a0dd8e 100644 --- a/src/mame/drivers/ymdx11.cpp +++ b/src/mame/drivers/ymdx11.cpp @@ -57,7 +57,7 @@ void yamaha_dx11_state::machine_start() HD44780_PIXEL_UPDATE(yamaha_dx11_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void yamaha_dx11_state::palette_init(palette_device &palette) diff --git a/src/mame/drivers/ymtx81z.cpp b/src/mame/drivers/ymtx81z.cpp index 21892a615b6..8680a59f698 100644 --- a/src/mame/drivers/ymtx81z.cpp +++ b/src/mame/drivers/ymtx81z.cpp @@ -43,7 +43,7 @@ private: HD44780_PIXEL_UPDATE(ymtx81z_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void ymtx81z_state::palette_init(palette_device &palette) diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp index fab1cab1f5a..881119f48bc 100644 --- a/src/mame/drivers/z100.cpp +++ b/src/mame/drivers/z100.cpp @@ -309,7 +309,7 @@ void z100_state::memory_ctrl_w(uint8_t data) MC6845_UPDATE_ROW(z100_state::update_row) { - uint32_t *const pix = &bitmap.pix32(y); + uint32_t *const pix = &bitmap.pix(y); const uint16_t amask = m_vram_config->read() ? 0xfff : 0x7ff; for (int x = 0; x < x_count; x++) diff --git a/src/mame/drivers/z1013.cpp b/src/mame/drivers/z1013.cpp index fba061a158f..363738abfc9 100644 --- a/src/mame/drivers/z1013.cpp +++ b/src/mame/drivers/z1013.cpp @@ -240,21 +240,20 @@ INPUT_PORTS_END uint32_t z1013_state::screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+32; x++) + for (uint16_t x = ma; x < ma+32; x++) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/z22.cpp b/src/mame/drivers/z22.cpp index 7421bf9ad16..b2ab00d41bf 100644 --- a/src/mame/drivers/z22.cpp +++ b/src/mame/drivers/z22.cpp @@ -77,7 +77,7 @@ void z22_state::machine_reset() MC6845_UPDATE_ROW(z22_state::update_row) { - u32 *pix = &bitmap.pix32(y); + u32 *pix = &bitmap.pix(y); for (unsigned x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/z9001.cpp b/src/mame/drivers/z9001.cpp index 3755fcfdd85..3e24d356356 100644 --- a/src/mame/drivers/z9001.cpp +++ b/src/mame/drivers/z9001.cpp @@ -175,23 +175,22 @@ void z9001_state::machine_start() uint32_t z9001_state::screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,col,fg,bg; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; m_framecnt++; - for(y = 0; y < 24; y++ ) + for (uint8_t y = 0; y < 24; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen - col = m_p_colorram[x]; - fg = col>>4; - bg = col&15; + uint8_t chr = m_p_videoram[x]; // get char in videoram + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen + uint8_t col = m_p_colorram[x]; + uint8_t fg = col>>4; + uint8_t bg = col&15; /* Check for flashing - swap bg & fg */ if ((BIT(col, 7)) && (m_framecnt & 0x10)) diff --git a/src/mame/drivers/zorba.cpp b/src/mame/drivers/zorba.cpp index 52d667554a5..c0c6f9924cb 100644 --- a/src/mame/drivers/zorba.cpp +++ b/src/mame/drivers/zorba.cpp @@ -490,8 +490,7 @@ void zorba_state::pia1_portb_w(uint8_t data) I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t gfx = m_p_chargen[(linecount & 15) + (charcode << 4) + ((gpa & 1) << 11)]; @@ -505,8 +504,8 @@ I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) if (lten) gfx = 0xff; - for(i=0;i<8;i++) - bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; + for (int i = 0; i < 8; i++) + bitmap.pix(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; } diff --git a/src/mame/drivers/zrt80.cpp b/src/mame/drivers/zrt80.cpp index 2d571912ab6..712bfef2cca 100644 --- a/src/mame/drivers/zrt80.cpp +++ b/src/mame/drivers/zrt80.cpp @@ -224,18 +224,16 @@ void zrt80_state::machine_reset() MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); - uint8_t polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = polarity; + uint8_t inv = polarity; if (x == cursor_x) inv ^= 0xff; - mem = (ma + x) & 0x1fff; - chr = m_p_videoram[mem]; + uint16_t const mem = (ma + x) & 0x1fff; + uint8_t chr = m_p_videoram[mem]; if (BIT(chr, 7)) { @@ -243,7 +241,7 @@ MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) chr &= 0x7f; } - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t const gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index f12948d0557..f4b9ee8ba17 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -145,7 +145,7 @@ protected: uint8_t update_tilemaps(screen_device &screen, const rectangle &cliprect); void sprite_erase_buffer(); void sprite_swap_buffers(); - int draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); + int draw_one_sprite(uint16_t const *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); void sprite_render_list(); inline uint8_t compute_color_offsets(int which, int layerbit, int layerflag); inline uint16_t compute_sprite_blend(uint8_t encoding); diff --git a/src/mame/machine/3do.cpp b/src/mame/machine/3do.cpp index 245f018fe8b..cf5af65cfe8 100644 --- a/src/mame/machine/3do.cpp +++ b/src/mame/machine/3do.cpp @@ -1046,8 +1046,8 @@ uint32_t _3do_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for ( int y = 0; y < 120; y++ ) { - uint32_t *dest_p0 = &bitmap.pix32(22 + y * 2, 254 ); - uint32_t *dest_p1 = &bitmap.pix32(22 + y * 2 + 1, 254 ); + uint32_t *dest_p0 = &bitmap.pix(22 + y * 2, 254 ); + uint32_t *dest_p1 = &bitmap.pix(22 + y * 2 + 1, 254 ); for ( int x = 0; x < 320; x++ ) { diff --git a/src/mame/machine/3dom2.cpp b/src/mame/machine/3dom2.cpp index dee32da9369..7da659deefa 100644 --- a/src/mame/machine/3dom2.cpp +++ b/src/mame/machine/3dom2.cpp @@ -1336,9 +1336,9 @@ uint32_t m2_vdu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (uint32_t ys = vdouble ? 2 : 1; ys > 0; --ys) { if (hdouble) - draw_scanline_double(&bitmap.pix32(v, 0), srclower, srcupper); + draw_scanline_double(&bitmap.pix(v, 0), srclower, srcupper); else - draw_scanline(&bitmap.pix32(v, 0), srclower, srcupper); + draw_scanline(&bitmap.pix(v, 0), srclower, srcupper); ++v; } @@ -1352,7 +1352,7 @@ uint32_t m2_vdu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma // Blank this block of lines if DMA is disabled while (lines--) { - uint32_t *dst = &bitmap.pix32(v, cliprect.min_x); + uint32_t *dst = &bitmap.pix(v, cliprect.min_x); for (uint32_t x = cliprect.min_x; x <= cliprect.max_x; ++x) *dst++ = rgb_t::black(); diff --git a/src/mame/machine/aim65.cpp b/src/mame/machine/aim65.cpp index 5c7ce8c221d..cf7b14ba9e1 100644 --- a/src/mame/machine/aim65.cpp +++ b/src/mame/machine/aim65.cpp @@ -315,8 +315,6 @@ void aim65_state::z32_pa_w( u8 data ) // Display printer output uint32_t aim65_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t data; - for (u8 y = 0; y<cliprect.max_y; y++) { u16 sy = m_printer_y*10 - cliprect.max_y + 10 + y; @@ -324,13 +322,14 @@ uint32_t aim65_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, sy += 0x280; for(u8 x = 0; x < 10; x++) { + uint16_t data; if (!BIT(sy, 0)) data = m_printerRAM[sy * 10 + x]; else data = m_printerRAM[sy * 10 + (9 - x)]; for (u8 b = 0; b < 10; b++) - bitmap.pix16(y, 120 - (b * 12) - ((x > 4) ? x+1 : x)) = BIT(data, b); + bitmap.pix(y, 120 - (b * 12) - ((x > 4) ? x+1 : x)) = BIT(data, b); } } diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp index 0fecabe04f1..13109d4da1f 100644 --- a/src/mame/machine/amstrad.cpp +++ b/src/mame/machine/amstrad.cpp @@ -799,7 +799,7 @@ void amstrad_state::amstrad_plus_update_video_sprites() else horiz = m_asic.h_start; - p = &m_gate_array.bitmap->pix16(m_gate_array.y, horiz ); + p = &m_gate_array.bitmap->pix(m_gate_array.y, horiz ); for ( i = 15 * 8; i >= 0; i -= 8 ) { uint8_t xmag = ( m_asic.ram[ 0x2000 + i + 4 ] >> 2 ) & 0x03; @@ -852,7 +852,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_hsync_changed) m_gate_array.line_ticks = 0; if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + m_gate_array.draw_p = &m_gate_array.bitmap->pix(m_gate_array.y); } else { @@ -895,7 +895,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_hsync_changed) m_gate_array.line_ticks = 0; if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + m_gate_array.draw_p = &m_gate_array.bitmap->pix(m_gate_array.y); } else { diff --git a/src/mame/machine/b2m.cpp b/src/mame/machine/b2m.cpp index 10c892e25db..fae7b699f9c 100644 --- a/src/mame/machine/b2m.cpp +++ b/src/mame/machine/b2m.cpp @@ -280,17 +280,14 @@ void b2m_state::machine_reset() uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1; - uint8_t code2; - uint8_t col; - int y, x, b; - uint8_t *ram = m_ram->pointer(); + u8 const *const ram = m_ram->pointer(); - for (x = 0; x < 48; x++) + for (int x = 0; x < 48; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - u16 t = x*256 + ((y + m_video_scroll) & 0xff); + u16 const t = x*256 + ((y + m_video_scroll) & 0xff); + u8 code1, code2; if (m_video_page==0) { code1 = ram[0x11000 + t]; @@ -301,10 +298,10 @@ uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c code1 = ram[0x19000 + t]; code2 = ram[0x1d000 + t]; } - for (b = 7; b >= 0; b--) + for (int b = 7; b >= 0; b--) { - col = (BIT(code2, b)<<1) + BIT(code1, b); - bitmap.pix16(y, x*8+b) = col; + u8 const col = (BIT(code2, b)<<1) + BIT(code1, b); + bitmap.pix(y, x*8+b) = col; } } } diff --git a/src/mame/machine/bk.cpp b/src/mame/machine/bk.cpp index cd83484112f..d9c5a7c6907 100644 --- a/src/mame/machine/bk.cpp +++ b/src/mame/machine/bk.cpp @@ -151,15 +151,15 @@ void bk_state::floppy_data_w(uint16_t data) u32 bk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u16 nOfs = (m_scroll - 728) % 256; + u16 const nOfs = (m_scroll - 728) % 256; for (u16 y = 0; y < 256; y++) { for (u16 x = 0; x < 32; x++) { - u16 code = m_vram[((y+nOfs) %256)*32 + x]; + u16 const code = m_vram[((y+nOfs) %256)*32 + x]; for (u8 b = 0; b < 16; b++) - bitmap.pix16(y, x*16 + b) = BIT(code, b); + bitmap.pix(y, x*16 + b) = BIT(code, b); } } return 0; diff --git a/src/mame/machine/cedar_magnet_plane.cpp b/src/mame/machine/cedar_magnet_plane.cpp index 094d25ddeab..9ecb7a7eea3 100644 --- a/src/mame/machine/cedar_magnet_plane.cpp +++ b/src/mame/machine/cedar_magnet_plane.cpp @@ -140,7 +140,7 @@ u32 cedar_magnet_plane_device::draw(screen_device &screen, bitmap_ind16 &bitmap, for (int y = 0; y < 256;y++) { - u16 *dst = &bitmap.pix16((y - m_scrolly) & 0xff); + u16 *const dst = &bitmap.pix((y - m_scrolly) & 0xff); for (int x = 0; x < 256;x++) { diff --git a/src/mame/machine/cedar_magnet_sprite.cpp b/src/mame/machine/cedar_magnet_sprite.cpp index 3be7bd8466f..0109d59efe0 100644 --- a/src/mame/machine/cedar_magnet_sprite.cpp +++ b/src/mame/machine/cedar_magnet_sprite.cpp @@ -309,7 +309,7 @@ u32 cedar_magnet_sprite_device::draw(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 256; y++) { - uint16_t *dst = &bitmap.pix16((y) & 0xff); + uint16_t *const dst = &bitmap.pix((y) & 0xff); for (int x = 0; x < 256; x++) { diff --git a/src/mame/machine/concept.cpp b/src/mame/machine/concept.cpp index 83de6b7e48b..ff70dfd656d 100644 --- a/src/mame/machine/concept.cpp +++ b/src/mame/machine/concept.cpp @@ -66,7 +66,7 @@ uint32_t concept_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* resolution is 720*560 */ for (int y = 0; y < 560; y++) { - uint16_t *line = &bitmap.pix16(560-1-y); + uint16_t *const line = &bitmap.pix(560-1-y); for (int x = 0; x < 720; x++) line[720-1-x] = (m_videoram[(x+48+y*768)>>4] & (0x8000 >> ((x+48+y*768) & 0xf))) ? 1 : 0; } diff --git a/src/mame/machine/dragon.cpp b/src/mame/machine/dragon.cpp index 35f32ef1c31..3499c6553bd 100644 --- a/src/mame/machine/dragon.cpp +++ b/src/mame/machine/dragon.cpp @@ -222,7 +222,7 @@ MC6845_UPDATE_ROW(d64plus_state::crtc_update_row) for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; - bitmap.pix32(y, x) = m_palette->pen(BIT(data, 7) && de); + bitmap.pix(y, x) = m_palette->pen(BIT(data, 7) && de); data <<= 1; } } diff --git a/src/mame/machine/gamepock.cpp b/src/mame/machine/gamepock.cpp index 66de6c28dcb..6b188d2a312 100644 --- a/src/mame/machine/gamepock.cpp +++ b/src/mame/machine/gamepock.cpp @@ -154,14 +154,14 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 50; j++ ) { - bitmap.pix16(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } @@ -172,14 +172,14 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 50; j++ ) { - bitmap.pix16(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } @@ -190,25 +190,25 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 25; j++ ) { - bitmap.pix16(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; } for ( int j = 25; j < 50; j++ ) { - bitmap.pix16(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } diff --git a/src/mame/machine/imds2ioc.cpp b/src/mame/machine/imds2ioc.cpp index fc9c7a25dd9..1f8008b48b2 100644 --- a/src/mame/machine/imds2ioc.cpp +++ b/src/mame/machine/imds2ioc.cpp @@ -347,9 +347,8 @@ WRITE_LINE_MEMBER(imds2ioc_device::pio_lpt_select_w) I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) { - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; uint16_t pixels; if (lten) { @@ -392,8 +391,8 @@ I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) pixels = ~pixels; } - for (i = 0; i < 14; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; + for (unsigned i = 0; i < 14; i++) { + bitmap.pix(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; } } diff --git a/src/mame/machine/inder_vid.cpp b/src/mame/machine/inder_vid.cpp index e5005ea52b3..ea501338fe2 100644 --- a/src/mame/machine/inder_vid.cpp +++ b/src/mame/machine/inder_vid.cpp @@ -36,17 +36,16 @@ void inder_vid_device::megaphx_tms_map(address_map &map) TMS340X0_SCANLINE_RGB32_CB_MEMBER(inder_vid_device::scanline) { - uint16_t *vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); const pen_t *paldata = m_palette->pens(); int coladdr = params->coladdr; - int x; if (m_bpp_mode == 8) { - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = paldata[pixels & 0xff]; @@ -55,7 +54,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(inder_vid_device::scanline) } else if (m_bpp_mode == 4) { - for (x = params->heblnk; x < params->hsblnk; x += 4) + for (int x = params->heblnk; x < params->hsblnk; x += 4) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 3] = paldata[((pixels & 0xf000) >> 12)]; diff --git a/src/mame/machine/lynx.cpp b/src/mame/machine/lynx.cpp index 0ea49c13a12..7da6ae8f077 100644 --- a/src/mame/machine/lynx.cpp +++ b/src/mame/machine/lynx.cpp @@ -1310,7 +1310,7 @@ void lynx_state::lynx_draw_line() if (m_mikey.data[0x92] & 0x02) { j -= 160 * 102 / 2 - 1; - uint32_t *const line = &m_bitmap_temp.pix32(102 - 1 - y); + uint32_t *const line = &m_bitmap_temp.pix(102 - 1 - y); for (int x = 160 - 2; x >= 0; j++, x -= 2) { uint8_t const byte = lynx_read_ram(j); @@ -1320,7 +1320,7 @@ void lynx_state::lynx_draw_line() } else { - uint32_t *const line = &m_bitmap_temp.pix32(y); + uint32_t *const line = &m_bitmap_temp.pix(y); for (int x = 0; x < 160; j++, x += 2) { uint8_t const byte = lynx_read_ram(j); diff --git a/src/mame/machine/megacd.cpp b/src/mame/machine/megacd.cpp index d0b53d9b595..0fefc92c4b6 100644 --- a/src/mame/machine/megacd.cpp +++ b/src/mame/machine/megacd.cpp @@ -1473,7 +1473,7 @@ inline uint8_t sega_segacd_device::read_pixel_from_stampmap(bitmap_ind16* srcbit if (x >= srcbitmap->width) return 0; if (y >= srcbitmap->height) return 0; - uint16_t* cacheptr = &srcbitmap->pix16(y, x); + uint16_t* cacheptr = &srcbitmap->pix(y, x); return cacheptr[0] & 0xf; */ diff --git a/src/mame/machine/megadriv.cpp b/src/mame/machine/megadriv.cpp index b9fb9ec504d..2a277d83789 100644 --- a/src/mame/machine/megadriv.cpp +++ b/src/mame/machine/megadriv.cpp @@ -764,11 +764,11 @@ uint32_t md_base_state::screen_update_megadriv(screen_device &screen, bitmap_rgb /* Copy our screen buffer here */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t* desty = &bitmap.pix32(y, 0); - uint32_t* srcy; + uint32_t *const desty = &bitmap.pix(y, 0); + uint32_t const *srcy; if (!m_vdp->m_use_alt_timing) - srcy = &m_vdp->m_render_bitmap->pix32(y, 0); + srcy = &m_vdp->m_render_bitmap->pix(y, 0); else srcy = m_vdp->m_render_line.get(); diff --git a/src/mame/machine/model1io2.cpp b/src/mame/machine/model1io2.cpp index f47a5b3bda2..9ff771dbcc2 100644 --- a/src/mame/machine/model1io2.cpp +++ b/src/mame/machine/model1io2.cpp @@ -282,7 +282,7 @@ HD44780_PIXEL_UPDATE( model1io2_device::lcd_pixel_update ) return; if (line < 2 && pos < 20) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp index 932cabea96b..0b18cfe1193 100644 --- a/src/mame/machine/osborne1.cpp +++ b/src/mame/machine/osborne1.cpp @@ -382,7 +382,7 @@ inline void osborne1_state::draw_rows(uint16_t col, bitmap_ind16 &bitmap, const // Draw a line of the display u8 const ra(y % 10); - uint16_t *p(&bitmap.pix16(y)); + uint16_t *p(&bitmap.pix(y)); uint16_t const row(((m_scroll_y + (y / 10)) << 7) & 0x0F80); for (uint16_t x = 0; Width > x; ++x) @@ -539,7 +539,7 @@ MC6845_UPDATE_ROW(osborne1nv_state::crtc_update_row) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint16_t const base = (ma >> 1) & 0xF80; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (u8 x = 0; x < x_count; ++x) { uint16_t const offset = base | ((ma + x) & 0x7F); diff --git a/src/mame/machine/partner.cpp b/src/mame/machine/partner.cpp index 69f9c201922..0bcc83d5f0a 100644 --- a/src/mame/machine/partner.cpp +++ b/src/mame/machine/partner.cpp @@ -343,9 +343,8 @@ void partner_state::mem_page_w(u8 data) I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const u8 *charmap = m_chargen + 0x400 * (gpa * 2 + hlgt); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u8 const *const charmap = m_chargen + 0x400 * (gpa * 2 + hlgt); u8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; @@ -356,8 +355,8 @@ I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) if (rvv) pixels ^= 0xff; - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1]; + for(int i=0;i<6;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1]; } void partner_state::machine_reset() diff --git a/src/mame/machine/primo.cpp b/src/mame/machine/primo.cpp index 6c76a961e6d..ad4989257f8 100644 --- a/src/mame/machine/primo.cpp +++ b/src/mame/machine/primo.cpp @@ -340,7 +340,7 @@ u32 primo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons for (u8 y = 0; y < 192; y++) { - u16 *p = &bitmap.pix16(y); + u16 *p = &bitmap.pix(y); for (u16 x = 0; x < 32; x++) { u8 data = m_vram[ma+x]; diff --git a/src/mame/machine/radio86.cpp b/src/mame/machine/radio86.cpp index 14517a58409..577d141815e 100644 --- a/src/mame/machine/radio86.cpp +++ b/src/mame/machine/radio86.cpp @@ -217,7 +217,7 @@ I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels) pixels ^= 0xff; for (u8 i = 0; i < 6; i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t radio86_pens[3] = { diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp index 62baaccc2b6..402d9b8a78b 100644 --- a/src/mame/machine/sms.cpp +++ b/src/mame/machine/sms.cpp @@ -1433,7 +1433,7 @@ void gamegear_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rg if (sms_y2 >= vdp_bitmap.cliprect().min_y && sms_y2 <= vdp_bitmap.cliprect().max_y) { - uint32_t *vdp_buffer = &vdp_bitmap.pix32(sms_y2); + uint32_t *const vdp_buffer = &vdp_bitmap.pix(sms_y2); int sms_x = sms_min_x; int x_min_i = plot_min_x - plot_x_first_group; @@ -1496,7 +1496,7 @@ void gamegear_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rg line3 = m_line_buffer.get() + ((sms_y + y_i + 1) & 0x03) * 160; line4 = m_line_buffer.get() + ((sms_y + y_i + 2) & 0x03) * 160; - uint32_t *p_bitmap = &bitmap.pix32(visarea.min_y + plot_y_group + y_i, visarea.min_x); + uint32_t *const p_bitmap = &bitmap.pix(visarea.min_y + plot_y_group + y_i, visarea.min_x); for (int plot_x = plot_min_x; plot_x <= plot_max_x; plot_x++) { @@ -1555,9 +1555,9 @@ uint32_t gamegear_state::screen_update_gamegear(screen_device &screen, bitmap_rg // (it would be better to generalize this in the core, to be used for all LCD systems) for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *linedst = &bitmap.pix32(y); - uint32_t *line0 = &source_bitmap->pix32(y); - uint32_t *line1 = &m_prev_bitmap.pix32(y); + uint32_t *const linedst = &bitmap.pix(y); + uint32_t const *const line0 = &source_bitmap->pix(y); + uint32_t const *const line1 = &m_prev_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint32_t color0 = line0[x]; @@ -1568,9 +1568,9 @@ uint32_t gamegear_state::screen_update_gamegear(screen_device &screen, bitmap_rg uint16_t r1 = (color1 >> 16) & 0x000000ff; uint16_t g1 = (color1 >> 8) & 0x000000ff; uint16_t b1 = (color1 >> 0) & 0x000000ff; - uint8_t r = (uint8_t)((r0 + r1) >> 1); - uint8_t g = (uint8_t)((g0 + g1) >> 1); - uint8_t b = (uint8_t)((b0 + b1) >> 1); + uint8_t r = uint8_t((r0 + r1) >> 1); + uint8_t g = uint8_t((g0 + g1) >> 1); + uint8_t b = uint8_t((b0 + b1) >> 1); linedst[x] = (r << 16) | (g << 8) | b; } } diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 30ea3f738e6..f4cafda3f71 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -511,7 +511,7 @@ void st0016_cpu_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip if (!flipy) { drawypos = ypos + yloop; } else { drawypos = (ypos + 8 - 1) - yloop; } - destline = &bitmap.pix16(drawypos); + destline = &bitmap.pix(drawypos); for (xloop = 0; xloop<8; xloop++) { @@ -654,7 +654,7 @@ void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap, const rectangle &clipre if (!flipy) { drawypos = ypos + yloop; } else { drawypos = (ypos + 8 - 1) - yloop; } - destline = &bitmap.pix16(drawypos); + destline = &bitmap.pix(drawypos); for (xloop = 0; xloop<8; xloop++) { diff --git a/src/mame/machine/teleprinter.cpp b/src/mame/machine/teleprinter.cpp index 8ef1576a2c2..75b1654a7ef 100644 --- a/src/mame/machine/teleprinter.cpp +++ b/src/mame/machine/teleprinter.cpp @@ -187,20 +187,17 @@ void teleprinter_device::term_write(uint8_t data) ***************************************************************************/ uint32_t teleprinter_device::tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t code; - int y, c, x, b; - - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { - for (c = 0; c < 8; c++) + for (int c = 0; c < 8; c++) { int horpos = 0; - for (x = 0; x < m_width; x++) + for (int x = 0; x < m_width; x++) { - code = teleprinter_font[(m_buffer[y*m_width + x] & 0x7f) *8 + c]; - for (b = 0; b < 8; b++) + uint8_t code = teleprinter_font[(m_buffer[y*m_width + x] & 0x7f) *8 + c]; + for (int b = 0; b < 8; b++) { - bitmap.pix32(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; + bitmap.pix(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; } } } diff --git a/src/mame/machine/zx.cpp b/src/mame/machine/zx.cpp index a42a9244108..df7318a34c2 100644 --- a/src/mame/machine/zx.cpp +++ b/src/mame/machine/zx.cpp @@ -70,19 +70,19 @@ void zx_state::drop_sync() xe = 0; } if(ys == ye) { - uint16_t *dest = &m_bitmap_render->pix16(ys, xs); + uint16_t *dest = &m_bitmap_render->pix(ys, xs); for(int x = xs; x < xe; x++) *dest++ = 1; } else { - uint16_t *dest = &m_bitmap_render->pix16(ys, xs); + uint16_t *dest = &m_bitmap_render->pix(ys, xs); for(int x = xs; x < 384; x++) *dest++ = 1; for(int y = ys+1; y < ye; y++) { - dest = &m_bitmap_render->pix16(y, 0); + dest = &m_bitmap_render->pix(y, 0); for(int x = 0; x<384; x++) *dest++ = 1; } - dest = &m_bitmap_render->pix16(ye, 0); + dest = &m_bitmap_render->pix(ye, 0); for(int x = 0; x < xe; x++) *dest++ = 1; } diff --git a/src/mame/video/1943.cpp b/src/mame/video/1943.cpp index 545cb91a6da..1a23037cd9b 100644 --- a/src/mame/video/1943.cpp +++ b/src/mame/video/1943.cpp @@ -257,15 +257,15 @@ void _1943_state::_1943_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { if (!(pri[x] & 0x80)) { - u8 c = source[x_index]; + u8 const c = source[x_index]; if (c != transparent_color) { // the priority is actually selected by bit 3 of BMPROM.07 diff --git a/src/mame/video/20pacgal.cpp b/src/mame/video/20pacgal.cpp index f087ed59822..56324388ea6 100644 --- a/src/mame/video/20pacgal.cpp +++ b/src/mame/video/20pacgal.cpp @@ -82,7 +82,7 @@ void _20pacgal_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &clipr for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for(int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = pen[bitmap.pix32(y, x)]; + bitmap.pix(y, x) = pen[bitmap.pix(y, x)]; } @@ -139,7 +139,7 @@ void _20pacgal_state::draw_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprec /* pen bits A0-A3 */ if (col) - bitmap.pix32(y, x) = (bitmap.pix32(y, x) & 0xff0) | col; + bitmap.pix(y, x) = (bitmap.pix(y, x) & 0xff0) | col; } /* next pixel */ @@ -278,7 +278,7 @@ void _20pacgal_state::draw_chars(bitmap_rgb32 &bitmap, const rectangle &cliprect /* pen bits A4-A11 */ if ( col != 0 ) - bitmap.pix32(y, x) = (color_base | col) << 4; + bitmap.pix(y, x) = (color_base | col) << 4; /* next pixel */ if (flip) @@ -398,7 +398,7 @@ void _20pacgal_state::draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect if (((lfsr & 0xffc0) == star_seta) || ((lfsr & 0xffc0) == star_setb)) { if (y >= cliprect.min_y && y <= cliprect.max_y) - bitmap.pix32(y, x) = NUM_PENS + (lfsr & 0x3f); + bitmap.pix(y, x) = NUM_PENS + (lfsr & 0x3f); cnt++; } } diff --git a/src/mame/video/40love.cpp b/src/mame/video/40love.cpp index 5a5560c599a..005f02090b7 100644 --- a/src/mame/video/40love.cpp +++ b/src/mame/video/40love.cpp @@ -155,29 +155,16 @@ uint8_t fortyl_state::fortyl_pixram_r(offs_t offset) void fortyl_state::fortyl_plot_pix( int offset ) { - int x, y, i, c, d1, d2; + const int x = (offset & 0x1f) * 8; + const int y = (offset >> 5) & 0xff; - x = (offset & 0x1f) * 8; - y = (offset >> 5) & 0xff; + const int d1 = (m_pixram_sel ? m_pixram2 : m_pixram1)[offset]; + const int d2 = (m_pixram_sel ? m_pixram2 : m_pixram1)[offset + 0x2000]; - if (m_pixram_sel) - { - d1 = m_pixram2[offset]; - d2 = m_pixram2[offset + 0x2000]; - } - else + for (int i = 0; i < 8; i++) { - d1 = m_pixram1[offset]; - d2 = m_pixram1[offset + 0x2000]; - } - - for (i = 0; i < 8; i++) - { - c = ((d2 >> i) & 1) + ((d1 >> i) & 1) * 2; - if (m_pixram_sel) - m_tmp_bitmap2->pix16(y, x + i) = m_pix_color[c] | ((m_color_bank == true) ? 0x200 : 0); - else - m_tmp_bitmap1->pix16(y, x + i) = m_pix_color[c] | ((m_color_bank == true) ? 0x200 : 0); + const int c = BIT(d2, i) | (BIT(d1, i) << 1); + (m_pixram_sel ? m_tmp_bitmap2 : m_tmp_bitmap1)->pix(y, x + i) = m_pix_color[c] | (m_color_bank ? 0x200 : 0); } } diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp index e97df1fd17f..c19d45b60c5 100644 --- a/src/mame/video/733_asr.cpp +++ b/src/mame/video/733_asr.cpp @@ -207,7 +207,7 @@ void asr733_device::linefeed() assert(asr_window_offset_y + asr_window_height <= m_bitmap->height()); for (int y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++) { - std::copy_n(&m_bitmap->pix16(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); + std::copy_n(&m_bitmap->pix(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); draw_scanline8(*m_bitmap, asr_window_offset_x, y, asr_window_width, buf, palette().pens()); } diff --git a/src/mame/video/8080bw.cpp b/src/mame/video/8080bw.cpp index f3df7201358..65c51ba6ebe 100644 --- a/src/mame/video/8080bw.cpp +++ b/src/mame/video/8080bw.cpp @@ -56,9 +56,9 @@ inline void _8080bw_state::set_pixel( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x if (y >= MW8080BW_VCOUNTER_START_NO_VBLANK) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = m_palette->pen_color(color); + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); } } @@ -80,18 +80,16 @@ inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, uint8_t y, uint8_ /* this is needed as this driver doesn't emulate the shift register like mw8080bw does */ void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, int color ) { - uint8_t x; - - for (x = 0; x < 4; x++) + for (uint8_t x = 0; x < 4; x++) { uint8_t y; for (y = MW8080BW_VCOUNTER_START_NO_VBLANK; y != 0; y++) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); } } } @@ -379,9 +377,9 @@ uint32_t _8080bw_state::screen_update_shuttlei(screen_device &screen, bitmap_rgb for (int i = 0; i < 8; i++) { if (m_flip_screen) - bitmap.pix32(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); + bitmap.pix(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); else - bitmap.pix32(y, x|i) = m_palette->pen_color(BIT(data, 7)); + bitmap.pix(y, x|i) = m_palette->pen_color(BIT(data, 7)); data <<= 1; } } @@ -402,7 +400,7 @@ uint32_t _8080bw_state::screen_update_spacecom(screen_device &screen, bitmap_rgb for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); + bitmap.pix(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); data >>= 1; } } diff --git a/src/mame/video/abc1600.cpp b/src/mame/video/abc1600.cpp index 5b9e8919f12..b8b87f295bd 100644 --- a/src/mame/video/abc1600.cpp +++ b/src/mame/video/abc1600.cpp @@ -180,7 +180,7 @@ MC6845_UPDATE_ROW(abc1600_mover_device::crtc_update_row) { int color = ((BIT(data, 15) ^ PIX_POL) && !BLANK) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; data <<= 1; } diff --git a/src/mame/video/abc80.cpp b/src/mame/video/abc80.cpp index 5aa828894cf..c5cf846b425 100644 --- a/src/mame/video/abc80.cpp +++ b/src/mame/video/abc80.cpp @@ -128,7 +128,7 @@ void abc80_state::draw_scanline(bitmap_rgb32 &bitmap, int y) color ^= (cursor & m_blink); color &= blank; - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); data <<= 1; } diff --git a/src/mame/video/abc800.cpp b/src/mame/video/abc800.cpp index 386ba12581c..bc6f3636a9d 100644 --- a/src/mame/video/abc800.cpp +++ b/src/mame/video/abc800.cpp @@ -73,16 +73,16 @@ void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) if (color) { - bool black = bitmap.pix32(y, x) == rgb_t::black(); + bool black = bitmap.pix(y, x) == rgb_t::black(); bool opaque = !BIT(fgctl, 3); if (black || opaque) { - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; + bitmap.pix(y, x) = pen[color]; + bitmap.pix(y, x + 1) = pen[color]; - bitmap.pix32(y + 1, x) = pen[color]; - bitmap.pix32(y + 1, x + 1) = pen[color]; + bitmap.pix(y + 1, x) = pen[color]; + bitmap.pix(y + 1, x + 1) = pen[color]; } } @@ -200,8 +200,8 @@ void abc800m_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) uint16_t fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); int color = (m_fgctl_prom->base()[fgctl_addr] & 0x07) ? 1 : 0; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 2; } @@ -241,7 +241,7 @@ MC6845_UPDATE_ROW( abc800m_state::abc800m_update_row ) if (BIT(data, 7) && de) { - bitmap.pix32(y, x) = fgpen; + bitmap.pix(y, x) = fgpen; } data <<= 1; diff --git a/src/mame/video/abc802.cpp b/src/mame/video/abc802.cpp index 5037c6a69fd..e42d84afc5f 100644 --- a/src/mame/video/abc802.cpp +++ b/src/mame/video/abc802.cpp @@ -127,7 +127,7 @@ MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + bit; int color = (BIT(data, 7) ^ ri) && de; - bitmap.pix32(y, x) = pen[color]; + bitmap.pix(y, x) = pen[color]; data <<= 1; } @@ -139,8 +139,8 @@ MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + (bit << 1); int color = (BIT(data, 7) ^ ri) && de; - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; + bitmap.pix(y, x) = pen[color]; + bitmap.pix(y, x + 1) = pen[color]; data <<= 1; } diff --git a/src/mame/video/abc806.cpp b/src/mame/video/abc806.cpp index f9a8b7209f8..558b217832c 100644 --- a/src/mame/video/abc806.cpp +++ b/src/mame/video/abc806.cpp @@ -310,11 +310,11 @@ MC6845_UPDATE_ROW( abc806_state::abc806_update_row ) int color = BIT(chargen_data, 7) ? fg_color : bg_color; if (!de) color = 0; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; if (e5 || e6) { - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } chargen_data <<= 1; @@ -407,9 +407,9 @@ void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int x = HORIZONTAL_PORCH_HACK + (ABC800_CHAR_WIDTH * 4) - 16 + (sx * 4) + pixel; - if (BIT(dot, 15) || (bitmap.pix32(y, x) == rgb_t::black())) + if (BIT(dot, 15) || (bitmap.pix(y, x) == rgb_t::black())) { - bitmap.pix32(y, x) = pen[(dot >> 12) & 0x07]; + bitmap.pix(y, x) = pen[(dot >> 12) & 0x07]; } dot <<= 4; diff --git a/src/mame/video/advision.cpp b/src/mame/video/advision.cpp index b0eec08439b..3dcbbc11433 100644 --- a/src/mame/video/advision.cpp +++ b/src/mame/video/advision.cpp @@ -96,9 +96,9 @@ uint32_t advision_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = 0; y < 128; y+=2) { if (*led > 0) - bitmap.pix16(30 + y, 85 + x) = --(*led); + bitmap.pix(30 + y, 85 + x) = --(*led); else - bitmap.pix16(30 + y, 85 + x) = 0; + bitmap.pix(30 + y, 85 + x) = 0; led += 256; } diff --git a/src/mame/video/aeroboto.cpp b/src/mame/video/aeroboto.cpp index 50fb751fe95..a7257ddec08 100644 --- a/src/mame/video/aeroboto.cpp +++ b/src/mame/video/aeroboto.cpp @@ -120,9 +120,7 @@ void aeroboto_state::aeroboto_tilecolor_w(offs_t offset, uint8_t data) void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { int x = m_spriteram[offs + 3]; int y = 240 - m_spriteram[offs]; @@ -144,10 +142,9 @@ void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const rectangle splitrect1(0, 255, 0, 39); - const rectangle splitrect2(0, 255, 40, 255); - uint8_t *src_base, *src_colptr, *src_rowptr; - int src_offsx, src_colmask, sky_color, star_color, x, y, i, j, pen; + rectangle const splitrect1(0, 255, 0, 39); + rectangle const splitrect2(0, 255, 40, 255); + int sky_color, star_color; sky_color = star_color = *m_bgcolor << 2; @@ -165,30 +162,30 @@ uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_in bitmap.fill(sky_color, cliprect); // actual scroll speed is unknown but it can be adjusted by changing the SCROLL_SPEED constant - m_sx += (char)(*m_starx - m_ox); + m_sx += char(*m_starx - m_ox); m_ox = *m_starx; - x = m_sx / SCROLL_SPEED; + int const x = m_sx / SCROLL_SPEED; if (*m_vscroll != 0xff) - m_sy += (char)(*m_stary - m_oy); + m_sy += char(*m_stary - m_oy); m_oy = *m_stary; - y = m_sy / SCROLL_SPEED; + int const y = m_sy / SCROLL_SPEED; - src_base = m_stars_rom; + uint8_t const *const src_base = m_stars_rom; - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { - src_offsx = (x + i) & 0xff; - src_colmask = 1 << (src_offsx & 7); + int src_offsx = (x + i) & 0xff; + int const src_colmask = 1 << (src_offsx & 7); src_offsx >>= 3; - src_colptr = src_base + src_offsx; - pen = star_color + ((i + 8) >> 4 & 1); + uint8_t const *const src_colptr = src_base + src_offsx; + int const pen = star_color + ((i + 8) >> 4 & 1); - for (j = 0; j < 256; j++) + for (int j = 0; j < 256; j++) { - src_rowptr = src_colptr + (((y + j) & 0xff) << 5 ); + uint8_t const *const src_rowptr = src_colptr + (((y + j) & 0xff) << 5 ); if (!((unsigned)*src_rowptr & src_colmask)) - bitmap.pix16(j, i) = pen; + bitmap.pix(j, i) = pen; } } } @@ -199,7 +196,7 @@ uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_in bitmap.fill(sky_color, cliprect); } - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) m_bg_tilemap->set_scrollx(y, m_hscroll[y]); // the playfield is part of a splitscreen and should not overlap with status display diff --git a/src/mame/video/aerofgt.cpp b/src/mame/video/aerofgt.cpp index 1fb4a2d8d5f..217de0c076a 100644 --- a/src/mame/video/aerofgt.cpp +++ b/src/mame/video/aerofgt.cpp @@ -640,17 +640,15 @@ void aerofgt_state::aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 & // BOOTLEG void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) { - int x, y, count; - - count = 16; // weird, the bitmap doesn't start at 0? - for (y = 0; y < 256; y++) - for (x = 0; x < 512; x++) + int count = 16; // weird, the bitmap doesn't start at 0? + for (int y = 0; y < 256; y++) + for (int x = 0; x < 512; x++) { int color = m_bitmapram[count] >> 1; /* data is GRB; convert to RGB */ rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f)); - bitmap.pix32(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; + bitmap.pix(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; count++; count &= 0x1ffff; @@ -660,11 +658,9 @@ void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) // BOOTLEG uint32_t aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, scrolly; - m_tilemap[0]->set_scroll_rows(256); - scrolly = m_scrolly[0]; - for (i = 0; i < 256; i++) + int scrolly = m_scrolly[0]; + for (int i = 0; i < 256; i++) m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i] + 22); m_tilemap[0]->set_scrolly(0, scrolly); diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp index 50bfd364300..891d89c25af 100644 --- a/src/mame/video/agat7.cpp +++ b/src/mame/video/agat7.cpp @@ -146,22 +146,18 @@ void agat7video_device::do_io(int offset) void agat7video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { - color = (chardata[y] & (1 << (7-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (7-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -226,26 +222,22 @@ void agat7video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 32; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 32; col++) { - address = m_start_address + col + (row * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + (row * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80); + uint8_t const v = (gfx & 0x80); gfx <<= 1; *(p++) = v ? fg : bg; *(p++) = v ? fg : bg; @@ -256,25 +248,20 @@ void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &b void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row/2) * 0x40); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row/2) * 0x40); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t const v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; @@ -287,25 +274,20 @@ void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 & void agat7video_device::graph_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x20; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x20; col++) { - address = m_start_address + col + ((row/4) * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row/4) * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t const v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; diff --git a/src/mame/video/agat9.cpp b/src/mame/video/agat9.cpp index 9e2f48ba42f..841f69bec26 100644 --- a/src/mame/video/agat9.cpp +++ b/src/mame/video/agat9.cpp @@ -294,33 +294,29 @@ void agat9video_device::do_io(int offset) void agat9video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { - color = (chardata[y] & (1 << (7 - x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (7 - x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -int color_1_p[4] = +static constexpr int color_1_p[4] = { 0, 4, 0, 5 }; -int color_2_p[4][2] = +static constexpr int color_2_p[4][2] = { { 0, 7 }, { 7, 0 }, @@ -392,26 +388,22 @@ void agat9video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b void agat9video_device::graph_update_mono_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 32; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 32; col++) { - address = m_start_address + col + (row * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + (row * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80) >> 7; + uint8_t v = (gfx & 0x80) >> 7; v = color_2_p[palette_index][v]; gfx <<= 1; *(p++) = v ? fg : bg; @@ -423,26 +415,22 @@ void agat9video_device::graph_update_mono_lores(screen_device &screen, bitmap_in void agat9video_device::graph_update_mono_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 64; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 64; col++) { - address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80) >> 7; + uint8_t v = (gfx & 0x80) >> 7; v = color_2_p[palette_index][v]; gfx <<= 1; *(p++) = v ? fg : bg; @@ -451,7 +439,7 @@ void agat9video_device::graph_update_mono_hires(screen_device &screen, bitmap_in } } -int color_4_p[4][4] = +static constexpr int color_4_p[4][4] = { { 0, 1, 2, 4 }, { 7, 1, 2, 4 }, @@ -461,25 +449,20 @@ int color_4_p[4][4] = void agat9video_device::graph_update_color_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { - v = (gfx & 0xc0) >> 6; + uint8_t v = (gfx & 0xc0) >> 6; v = color_4_p[palette_index][v]; gfx <<= 2; *(p++) = v; @@ -491,25 +474,20 @@ void agat9video_device::graph_update_color_hires(screen_device &screen, bitmap_i void agat9video_device::graph_update_color_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row / 2) * 0x40); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; @@ -525,34 +503,29 @@ void agat9video_device::graph_update_color_lores(screen_device &screen, bitmap_i void agat9video_device::plot_text_character_apple(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { code &= 0x3f; if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6 - x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6 - x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -560,25 +533,20 @@ void agat9video_device::plot_text_character_apple(bitmap_ind16 &bitmap, int xpos void agat9video_device::text_update_apple(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address; - uint32_t address; - int fg, bg; - - start_address = m_page2 ? 0x800 : 0x400; + uint32_t const start_address = m_page2 ? 0x800 : 0x400; - fg = color_2_p[palette_index][1]; - bg = color_2_p[palette_index][0]; + int const fg = color_2_p[palette_index][1]; + int const bg = color_2_p[palette_index][0]; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); plot_text_character_apple(bitmap, col * 7, row, 1, m_ram_dev->read(address), m_char_ptr, m_char_size, fg, bg); } @@ -587,13 +555,7 @@ void agat9video_device::text_update_apple(screen_device &screen, bitmap_ind16 &b void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b, va; - int offset; uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; int begincol = 0, endcol = 40; /* sanity checks */ @@ -614,20 +576,20 @@ void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, if (endcol < begincol) return; - va = m_page2 ? 0x4000 : 0x2000; + int const va = m_page2 ? 0x4000 : 0x2000; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = begincol; col < endcol; col++) + for (int col = begincol; col < endcol; col++) { - offset = ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1 + col] = m_ram_dev->read(va + offset); } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); /* * p. 50 of technical manual: @@ -638,17 +600,17 @@ void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, * 4. odd pixels can be 'black', 'green' (2) or 'red' (1) * 5. bit 7 affects color of pixels in this byte. zero = 'blue' or 'red', one = 'purple' or 'green'. */ - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t const w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7 - 1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7 - 1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; } } diff --git a/src/mame/video/airraid_dev.cpp b/src/mame/video/airraid_dev.cpp index 5b02b48a517..4a25c6e99c7 100644 --- a/src/mame/video/airraid_dev.cpp +++ b/src/mame/video/airraid_dev.cpp @@ -176,8 +176,8 @@ void airraid_video_device::mix_layer(screen_device &screen, bitmap_ind16 &bitmap { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_temp_bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &m_temp_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint8_t pix = src[x] & 0xff; diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp index 1194a8d422c..2ff7c7b6fdc 100644 --- a/src/mame/video/amiga.cpp +++ b/src/mame/video/amiga.cpp @@ -705,7 +705,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) if ((scanline & 1) ^ lof) { // lof matches? then render this scanline - dst = &bitmap.pix32(scanline); + dst = &bitmap.pix(scanline); } else { @@ -715,7 +715,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // otherwise just render the contents of the previous frame's scanline int shift = (m_previous_lof == lof) ? 1 : 0; - std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline)); + std::copy_n(&m_flickerfixer.pix(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix(scanline)); return; } } @@ -1026,7 +1026,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // save if (dst != nullptr) - std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline)); + std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix(save_scanline)); #if GUESS_COPPER_OFFSET if (m_screen->frame_number() % 64 == 0 && scanline == 0) diff --git a/src/mame/video/amigaaga.cpp b/src/mame/video/amigaaga.cpp index 46a5d092623..59e99a9bcbc 100644 --- a/src/mame/video/amigaaga.cpp +++ b/src/mame/video/amigaaga.cpp @@ -475,7 +475,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) if ((scanline & 1) ^ lof) { // lof matches? then render this scanline - dst = &bitmap.pix32(scanline); + dst = &bitmap.pix(scanline); } else { @@ -485,7 +485,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) // otherwise just render the contents of the previous frame's scanline int shift = (m_previous_lof == lof) ? 1 : 0; - std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline)); + std::copy_n(&m_flickerfixer.pix(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix(scanline)); return; } } @@ -829,7 +829,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) // save if (dst != nullptr) - std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline)); + std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix(save_scanline)); #if GUESS_COPPER_OFFSET if (m_screen->frame_number() % 64 == 0 && scanline == 0) diff --git a/src/mame/video/ams40041.cpp b/src/mame/video/ams40041.cpp index fc0143efa91..6dacc421a29 100644 --- a/src/mame/video/ams40041.cpp +++ b/src/mame/video/ams40041.cpp @@ -488,10 +488,10 @@ offs_t ams40041_device::get_char_rom_offset() MC6845_UPDATE_ROW( ams40041_device::draw_alpha ) { offs_t char_rom_offset = get_char_rom_offset(); - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); if (get_display_mode(m_vdu_mode) == ALPHA_40) - p = &bitmap.pix32(y + vbp, hbp); + p = &bitmap.pix(y + vbp, hbp); if (y > 199) return; @@ -558,7 +558,7 @@ MC6845_UPDATE_ROW( ams40041_device::draw_graphics_1 ) { if (y > 199) return; - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); for (int column = 0; column < x_count; column++) { @@ -578,7 +578,7 @@ MC6845_UPDATE_ROW( ams40041_device::draw_graphics_2 ) { if (y > 199) return; - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); for (int column = 0; column < x_count; column++) { diff --git a/src/mame/video/apexc.cpp b/src/mame/video/apexc.cpp index 095763b9c40..683e55e642b 100644 --- a/src/mame/video/apexc.cpp +++ b/src/mame/video/apexc.cpp @@ -72,7 +72,7 @@ void apexc_state::draw_led(bitmap_ind16 &bitmap, int x, int y, int state) { for (int yy = 1; yy < 7; yy++) for (int xx = 1; xx < 7; xx++) - bitmap.pix16(y + yy, x + xx) = state ? 2 : 3; + bitmap.pix(y + yy, x + xx) = state ? 2 : 3; } /* write a single char on screen */ @@ -134,7 +134,7 @@ void apexc_state::teletyper_linefeed() assert(teletyper_window_offset_y + teletyper_window_height <= m_bitmap->height()); for (int y = teletyper_window_offset_y; y < teletyper_window_offset_y + teletyper_window_height - teletyper_scroll_step; y++) { - std::copy_n(&m_bitmap->pix16(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); + std::copy_n(&m_bitmap->pix(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); draw_scanline8(*m_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/apollo.cpp b/src/mame/video/apollo.cpp index e4124bab8cd..84183400c2a 100644 --- a/src/mame/video/apollo.cpp +++ b/src/mame/video/apollo.cpp @@ -1563,24 +1563,22 @@ uint32_t apollo_graphics_15i::screen_update(screen_device &screen, bitmap_rgb32 void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *source_ptr = m_image_memory.get(); - int x, y; - uint16_t data, mask; - uint16_t inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; + uint16_t const *source_ptr = m_image_memory.get(); + uint16_t const inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; MLOG1(("screen_update1: size=%0x rowpixels=%d", m_image_memory_size, bitmap.rowpixels())); if ((m_cr1 & CR1_DISP_EN) == 0) { // display is disabled - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { - bitmap.pix32(y, dest++) = 0; + bitmap.pix(y, dest++) = 0; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1588,23 +1586,24 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else if (m_n_planes == 4) { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { uint16_t data0 = source_ptr[0]; uint16_t data1 = source_ptr[m_image_plane_size]; uint16_t data2 = source_ptr[m_image_plane_size * 2]; uint16_t data3 = source_ptr[m_image_plane_size * 3]; source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { + uint16_t data; data = (data0 & mask) ? 1 : 0; data |= (data1 & mask) ? 2 : 0; data |= (data2 & mask) ? 4 : 0; data |= (data3 & mask) ? 8 : 0; - bitmap.pix32(y, dest++) = m_color_lookup_table[data]; + bitmap.pix(y, dest++) = m_color_lookup_table[data]; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1612,10 +1611,10 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else if (m_n_planes == 8) { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { uint16_t data0 = source_ptr[0]; uint16_t data1 = source_ptr[m_image_plane_size]; @@ -1626,8 +1625,9 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & uint16_t data6 = source_ptr[m_image_plane_size * 6]; uint16_t data7 = source_ptr[m_image_plane_size * 7]; source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { + uint16_t data; data = (data0 & mask) ? 1 : 0; data |= (data1 & mask) ? 2 : 0; data |= (data2 & mask) ? 4 : 0; @@ -1636,7 +1636,7 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & data |= (data5 & mask) ? 0x20 : 0; data |= (data6 & mask) ? 0x40 : 0; data |= (data7 & mask) ? 0x80 : 0; - bitmap.pix32(y, dest++) = m_bt458->get_rgb(data); + bitmap.pix(y, dest++) = m_bt458->get_rgb(data); } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1644,15 +1644,15 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else // m_n_planes == 1 { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { - data = *source_ptr++ ^ inverse; - for (mask = 0x8000; mask; mask >>= 1) + uint16_t const data = *source_ptr++ ^ inverse; + for (uint16_t mask = 0x8000; mask; mask >>= 1) { - bitmap.pix32(y, dest++) = data & mask ? 0 : 0x00ffffff; + bitmap.pix(y, dest++) = data & mask ? 0 : 0x00ffffff; } } source_ptr += (m_buffer_width - m_width) / 16; diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp index 37e3819052c..b69561e2331 100644 --- a/src/mame/video/apple2.cpp +++ b/src/mame/video/apple2.cpp @@ -195,10 +195,6 @@ WRITE_LINE_MEMBER(a2_video_device::an2_w) void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -207,9 +203,8 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -218,24 +213,23 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp if ((code >= 0x60) && (code <= 0x7f)) { code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; + using std::swap;// and flip the color + std::swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << x)) ? bg : fg; + uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -244,10 +238,6 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -256,9 +246,8 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -267,24 +256,23 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i if ((code >= 0x60) && (code <= 0x7f)) { code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; + using std::swap;// and flip the color + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (x+1))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (x+1))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -293,38 +281,32 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } else if (code < 0x40) // inverse: flip FG and BG { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -333,25 +315,19 @@ void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, i void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { code &= 0x3f; if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } else if (code < 0x40) // inverse: flip FG and BG { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } if (m_an2) @@ -360,17 +336,17 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -379,32 +355,27 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 1; x < 8; x++) + for (int x = 1; x < 8; x++) { - color = (chardata[y] & (1 << x)) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << x)) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + ((x-1) * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + ((x-1) * xscale) + i) = color; } } } @@ -413,10 +384,6 @@ void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, i void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -425,9 +392,8 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -437,17 +403,17 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << x)) ? bg : fg; + uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -455,10 +421,7 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, y, x; - uint8_t code; - uint32_t start_address = m_page2 ? 0x0800 : 0x0400; - uint32_t address; + uint32_t const start_address = m_page2 ? 0x0800 : 0x0400; int fg = 0; switch (m_sysconfig & 0x03) @@ -475,34 +438,34 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, if (!(m_sysconfig & 0x03)) { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; + uint8_t const code = m_ram_ptr[address]; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { - bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; + bitmap.pix(row + y, col * 14 + x) = (code >> 0) & 0x0F; } } } - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { - bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; + bitmap.pix(row + y, col * 14 + x) = (code >> 4) & 0x0F; } } } @@ -511,58 +474,58 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, } else { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { uint8_t bits; /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; + uint8_t const code = m_ram_ptr[address]; bits = (code >> 0) & 0x0F; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { if (col & 1) { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; } else { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; } } } } bits = (code >> 4) & 0x0F; - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { if (col & 1) { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; } else { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; } } } } - if (row == 64) printf("\n"); + //if (row == 64) printf("\n"); } } @@ -571,10 +534,7 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, y; - uint8_t code, auxcode; - uint32_t start_address = m_page2 ? 0x0800 : 0x0400; - uint32_t address; + uint32_t const start_address = m_page2 ? 0x0800 : 0x0400; static const int aux_colors[16] = { 0, 2, 4, 6, 8, 0xa, 0xc, 0xe, 1, 3, 5, 7, 9, 0xb, 0xd, 0xf }; int fg = 0; @@ -592,21 +552,21 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, if (!(m_sysconfig & 0x03)) { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; + uint8_t const code = m_ram_ptr[address]; + uint8_t const auxcode = m_aux_ptr[address]; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; @@ -623,9 +583,9 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, *vram++ = (code >> 0) & 0x0F; *vram++ = (code >> 0) & 0x0F; } - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; @@ -647,26 +607,26 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, } else { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { uint8_t bits, abits; /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; + uint8_t const code = m_ram_ptr[address]; + uint8_t const auxcode = m_aux_ptr[address]; bits = (code >> 0) & 0x0F; abits = (auxcode >> 0) & 0x0F; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); if (col & 1) { @@ -707,9 +667,9 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, bits = (code >> 4) & 0x0F; abits = (auxcode >> 4) & 0x0F; - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); if (col & 1) { @@ -753,30 +713,15 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address; - uint32_t address; - uint8_t *aux_page = m_ram_ptr; - int fg = 0; - int bg = 0; + uint8_t const *const aux_page = m_aux_ptr ? m_aux_ptr : m_ram_ptr; - if (m_aux_ptr) - { - aux_page = m_aux_ptr; - } - - if (m_80col) - { - start_address = 0x400; - } - else - { - start_address = m_page2 ? 0x800 : 0x400; - } + uint32_t const start_address = m_80col ? 0x400 : m_page2 ? 0x800 : 0x400; beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + int fg = 0; + int bg = 0; switch (m_sysconfig & 0x03) { case 0: case 4: fg = WHITE; break; @@ -785,14 +730,14 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { if (m_80col) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); plot_text_character(bitmap, col * 14, row, 1, aux_page[address], m_char_ptr, m_char_size, fg, bg); @@ -802,10 +747,10 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); if (((m_sysconfig & 7) == 4) && (m_dhires)) { u8 tmp = aux_page[address]; @@ -977,14 +922,6 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; int mon_type = m_sysconfig & 0x03; int begincol = 0, endcol = 40; @@ -1008,28 +945,30 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co //printf("HGR draw: page %c, rows %d-%d cols %d-%d\n", m_page2 ? '2' : '1', beginrow, endrow, begincol, endcol); - vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; + uint8_t const *const vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = begincol; col < endcol; col++) + for (int col = begincol; col < endcol; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); // verified on h/w: setting dhires w/o 80col emulates a rev. 0 Apple ][ with no orange/blue + uint16_t const *artifact_map_ptr; if (m_dhires) { artifact_map_ptr = m_hires_artifact_map.get(); @@ -1054,9 +993,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co switch (mon_type) { case 0: - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -1068,9 +1007,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? WHITE : BLACK; *(p++) = v ? WHITE : BLACK; @@ -1087,9 +1026,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? GREEN : BLACK; *(p++) = v ? GREEN : BLACK; @@ -1106,9 +1045,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? ORANGE : BLACK; *(p++) = v ? ORANGE : BLACK; @@ -1126,15 +1065,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co // similar to regular A2 except page 2 is at $A000 void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - int mon_type = m_sysconfig & 0x03; + int const mon_type = m_sysconfig & 0x03; /* sanity checks */ if (beginrow < cliprect.top()) @@ -1144,34 +1075,36 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit if (endrow < beginrow) return; - vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + uint8_t const *const vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint16_t const *artifact_map_ptr; switch (mon_type) { case 0: artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -1183,9 +1116,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? WHITE : BLACK; *(p++) = v ? WHITE : BLACK; @@ -1202,9 +1135,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? GREEN : BLACK; *(p++) = v ? GREEN : BLACK; @@ -1221,9 +1154,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? ORANGE : BLACK; *(p++) = v ? ORANGE : BLACK; @@ -1240,17 +1173,11 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram, *vaux; - int row, col, b; - int offset; - uint8_t vram_row[82]; uint16_t v; - uint16_t *p; - uint32_t w; - int page = m_page2 ? 0x4000 : 0x2000; + int const page = m_page2 ? 0x4000 : 0x2000; int mon_type = m_sysconfig & 0x03; - bool bIsRGB = ((m_sysconfig & 7) == 4); - bool bIsRGBMixed = ((bIsRGB) && (m_rgbmode == 1)); + bool const bIsRGB = ((m_sysconfig & 7) == 4); + bool const bIsRGBMixed = ((bIsRGB) && (m_rgbmode == 1)); // IIgs force-monochrome-DHR setting if (m_newvideo & 0x20) @@ -1272,30 +1199,23 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (endrow < beginrow) return; - vram = &m_ram_ptr[page]; - if (m_aux_ptr) - { - vaux = m_aux_ptr; - } - else - { - vaux = vram; - } - vaux += page; + uint8_t const *const vram = &m_ram_ptr[page]; + uint8_t const *const vaux = (m_aux_ptr ? m_aux_ptr : vram) + page; + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+(col*2)+0] = vaux[offset]; vram_row[1+(col*2)+1] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); // RGB DHR 160-wide mode if ((bIsRGB) && (m_rgbmode == 2)) @@ -1303,11 +1223,11 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c mon_type = 4; } - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); /* DHGR pixel layout: @@ -1333,7 +1253,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!(vram_row[col-1] & 0x80)) { - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { v = (tw & 1); tw >>= 1; @@ -1342,7 +1262,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1351,7 +1271,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!(vram_row[col] & 0x80)) { - for (b = 4; b < 7; b++) + for (int b = 4; b < 7; b++) { v = (tw & 1); tw >>= 1; @@ -1360,7 +1280,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 4; b < 7; b++) + for (int b = 4; b < 7; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1372,7 +1292,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if ((bIsRGBMixed) && !(vram_row[col] & 0x80)) { uint32_t tw = (w >> 6); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (tw & 1); tw >>= 1; @@ -1381,7 +1301,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1392,7 +1312,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 1: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1402,7 +1322,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 2: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1412,7 +1332,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 3: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1426,7 +1346,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c { // Center the 480-wide image in the 560-wide display. // Aspect ratio won't be perfect, but it's in range. - for (b = 0; b < 40; b++) + for (int b = 0; b < 40; b++) { *(p++) = BLACK; } @@ -1445,7 +1365,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (mon_type == 4) { - for (b = 0; b < 40; b++) + for (int b = 0; b < 40; b++) { *(p++) = BLACK; } @@ -1490,15 +1410,7 @@ uint32_t a2_video_device::palette_entries() const uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const uint8_t *vram; - uint32_t *scanline; - uint8_t scb, b; - int col, palette; - uint32_t last_pixel = 0, pixel; - int beamy; - uint16_t *a2pixel; - - beamy = cliprect.top(); + int const beamy = cliprect.top(); if (m_newvideo & 0x80) { @@ -1511,24 +1423,24 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & return 0; } - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + uint32_t *const scanline = &bitmap.pix(beamy); + for (int col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; } } else // regular screen area { - int shrline = beamy - BORDER_TOP; + int const shrline = beamy - BORDER_TOP; - scb = m_aux_ptr[0x9D00 + shrline]; - palette = ((scb & 0x0f) << 4); + uint8_t const scb = m_aux_ptr[0x9D00 + shrline]; + int const palette = ((scb & 0x0f) << 4); - vram = &m_aux_ptr[0x2000 + (shrline * 160)]; - scanline = &bitmap.pix32(beamy); + uint8_t const *const vram = &m_aux_ptr[0x2000 + (shrline * 160)]; + uint32_t *const scanline = &bitmap.pix(beamy); // draw left and right borders - for (col = 0; col < BORDER_LEFT; col++) + for (int col = 0; col < BORDER_LEFT; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; scanline[col+BORDER_LEFT+640] = m_GSborder_colors[m_GSborder]; @@ -1536,9 +1448,9 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & if (scb & 0x80) // 640 mode { - for (col = 0; col < 160; col++) + for (int col = 0; col < 160; col++) { - b = vram[col]; + uint8_t const b = vram[col]; scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[palette + 0 + ((b >> 6) & 0x03)]; scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[palette + 4 + ((b >> 4) & 0x03)]; scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[palette + 8 + ((b >> 2) & 0x03)]; @@ -1555,9 +1467,12 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, }; - last_pixel = fillmode_init[scb & 0x1f]; - for (col = 0; col < 160; col++) + uint32_t last_pixel = fillmode_init[scb & 0x1f]; + for (int col = 0; col < 160; col++) { + uint8_t b; + uint32_t pixel; + b = vram[col]; pixel = (b >> 4) & 0x0f; @@ -1588,7 +1503,7 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & /* call legacy Apple II video rendering at scanline 0 to draw into the off-screen buffer */ if (beamy == 0) { - rectangle new_cliprect(0, 559, 0, 191); + rectangle const new_cliprect(0, 559, 0, 191); screen_update_GS_8bit(screen, *m_8bit_graphics, new_cliprect); } @@ -1599,24 +1514,24 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & return 0; } - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + uint32_t *const scanline = &bitmap.pix(beamy); + for (int col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; } } else { - scanline = &bitmap.pix32(beamy); + uint32_t *const scanline = &bitmap.pix(beamy); // draw left and right borders - for (col = 0; col < BORDER_LEFT + 40; col++) + for (int col = 0; col < BORDER_LEFT + 40; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; scanline[col+BORDER_LEFT+600] = m_GSborder_colors[m_GSborder]; } - a2pixel = &m_8bit_graphics->pix16(beamy-(BORDER_TOP+4)); + uint16_t *a2pixel = &m_8bit_graphics->pix(beamy-(BORDER_TOP+4)); for (int x = 0; x < 560; x++) { scanline[40 + BORDER_LEFT + x] = m_GSborder_colors[*a2pixel++]; diff --git a/src/mame/video/apple3.cpp b/src/mame/video/apple3.cpp index 5eba4a46a4b..940531d5a72 100644 --- a/src/mame/video/apple3.cpp +++ b/src/mame/video/apple3.cpp @@ -138,26 +138,21 @@ void apple3_state::video_start() void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, col, row, lc; - offs_t offset; - uint8_t ch; - const uint8_t *char_data; - pen_t fg, bg, temp; - uint16_t *dest; - uint8_t *ram = m_ram->pointer(); - uint32_t ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; - int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; - - for (y = beginrow; y <= endrow; y++) + uint8_t const *const ram = m_ram->pointer(); + uint32_t const ram_size = m_ram->size(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + int const beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int const endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; + + for (int y = beginrow; y <= endrow; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); - ch = ram[offset]; + offs_t offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); + uint8_t const ch = ram[offset]; // no color text in emulation mode + pen_t fg, bg; if ((m_flags & VAR_VM0) && (m_via_1_a & 0x40)) { /* color text */ @@ -175,17 +170,17 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) /* inverse? */ if (!(ch & 0x80)) { - temp = fg; - fg = bg; - bg = temp; + using std::swap; + swap(fg, bg); } - char_data = &m_char_mem[(ch & 0x7F) * 8]; + uint8_t const *const char_data = &m_char_mem[(ch & 0x7F) * 8]; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { + int lc; if (m_smoothscr) { // get the offset into the group of 8 lines @@ -196,7 +191,7 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) lc = col; } - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + lc * 2); dest[0] = (char_data[row] & (1 << col)) ? fg : bg; dest[1] = (char_data[row] & (1 << col)) ? fg : bg; } @@ -209,23 +204,20 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, col, row, lc; - offs_t offset; - uint8_t ch; - const uint8_t *char_data; - pen_t fg, bg; - uint16_t *dest; - uint8_t *ram = m_ram->pointer(); - uint32_t ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; - int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; - - for (y = beginrow; y <= endrow; y++) + uint8_t const *const ram = m_ram->pointer(); + uint32_t const ram_size = m_ram->size(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + int const beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int const endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; + + for (int y = beginrow; y <= endrow; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x; + offs_t const offset = ram_size - 0x8000 + text_map[y] + x; + uint8_t ch; + uint8_t const *char_data; + pen_t fg, bg; /* first character */ ch = ram[offset + 0x0000]; @@ -233,10 +225,11 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { + int lc; if (m_smoothscr) { // get the offset into the group of 8 lines @@ -247,7 +240,7 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) lc = col; } - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + lc + 0); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -258,11 +251,11 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { - dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 7); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + col + 7); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -275,37 +268,34 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* hi-res mode: 280x192x2 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info; - uint16_t *ptr; - uint8_t b; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info; if (m_flags & VAR_VM2) pix_info = &ram[m_hgr_map[ly]]; else pix_info = &ram[m_hgr_map[ly] - 0x2000]; - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - b = *(pix_info++); + uint8_t b = *(pix_info++); - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { ptr[0] = ptr[1] = (b & 0x01) ? WHITE : BLACK; ptr += 2; @@ -318,28 +308,24 @@ void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* color hi-res mode: 280x192x16 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info; - const uint8_t *col_info; - uint16_t *ptr; - uint8_t b; - uint16_t fgcolor, bgcolor; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info; + uint8_t const *col_info; if (m_flags & VAR_VM2) { pix_info = &ram[m_hgr_map[ly] + 0x2000]; @@ -350,16 +336,16 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect pix_info = &ram[m_hgr_map[ly] - 0x2000]; col_info = &ram[m_hgr_map[ly]]; } - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - bgcolor = ((*col_info >> 0) & 0x0F) + 16; - fgcolor = ((*col_info >> 4) & 0x0F) + 16; + uint16_t const bgcolor = ((*col_info >> 0) & 0x0F) + 16; + uint16_t const fgcolor = ((*col_info >> 4) & 0x0F) + 16; - b = *pix_info; + uint8_t b = *pix_info; - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { ptr[0] = ptr[1] = (b & 1) ? fgcolor : bgcolor; ptr += 2; @@ -376,27 +362,24 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* super hi-res mode: 560x192x2 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info1; - const uint8_t *pix_info2; - uint16_t *ptr; - uint8_t b1, b2; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info1; + uint8_t const *pix_info2; if (m_flags & VAR_VM2) { pix_info1 = &ram[m_hgr_map[ly] + 0x2000]; @@ -407,20 +390,20 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect pix_info1 = &ram[m_hgr_map[ly] - 0x2000]; pix_info2 = &ram[m_hgr_map[ly]]; } - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - b1 = *(pix_info1++); - b2 = *(pix_info2++); + uint8_t b1 = *(pix_info1++); + uint8_t b2 = *(pix_info2++); - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { *(ptr++) = (b1 & 0x01) ? WHITE : BLACK; b1 >>= 1; } - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { *(ptr++) = (b2 & 0x01) ? WHITE : BLACK; b2 >>= 1; @@ -433,28 +416,26 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect void apple3_state::graphics_chires(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *pen; - uint8_t p1, p2, p3, p4; - int y, i, ly, lyb; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } - pen = &bitmap.pix16(y); - for (i = 0; i < 20; i++) + uint16_t *pen = &bitmap.pix(y); + for (int i = 0; i < 20; i++) { + uint8_t p1, p2, p3, p4; if (m_flags & VAR_VM2) { p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0]; diff --git a/src/mame/video/arcadecl.cpp b/src/mame/video/arcadecl.cpp index 446ebb928a5..aa8ec654940 100644 --- a/src/mame/video/arcadecl.cpp +++ b/src/mame/video/arcadecl.cpp @@ -80,8 +80,8 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -107,12 +107,12 @@ uint32_t sparkz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { const uint16_t *const src = &m_bitmap[256 * y]; - uint16_t *const dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* regenerate the line */ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { - int bits = src[(x - 8) / 2]; + int const bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; dst[x + 1] = bits & 0xff; } diff --git a/src/mame/video/arcadia.cpp b/src/mame/video/arcadia.cpp index 491d30d9556..8940bdbc8ae 100644 --- a/src/mame/video/arcadia.cpp +++ b/src/mame/video/arcadia.cpp @@ -584,7 +584,7 @@ void arcadia_state::draw_sprites() for (j=0,m=0x80; j<8; j++, m>>=1) { if (b & m) - m_bitmap->pix16(y, x + j) = color; + m_bitmap->pix(y, x + j) = color; } } else @@ -594,8 +594,8 @@ void arcadia_state::draw_sprites() { if (b & m) { - m_bitmap->pix16(y, x + j) = color; - m_bitmap->pix16(y+1, x + j) = color; + m_bitmap->pix(y, x + j) = color; + m_bitmap->pix(y+1, x + j) = color; } } } diff --git a/src/mame/video/argus.cpp b/src/mame/video/argus.cpp index 023c5f2bf8b..443f6f5d0a2 100644 --- a/src/mame/video/argus.cpp +++ b/src/mame/video/argus.cpp @@ -719,36 +719,30 @@ void valtric_state::draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con else { m_bg_tilemap[1]->draw(screen, m_mosaicbitmap, cliprect, 0, 0); - { - int step=m_mosaic; - u32 *dest; - int x,y,xx,yy,c=0; - int width = screen.width(); - int height = screen.height(); + int step=m_mosaic; + int c=0; + int width = screen.width(); + int height = screen.height(); - if (m_mosaic<0)step*=-1; + if (m_mosaic<0)step*=-1; - for (y=0;y<width+step;y+=step) - for (x=0;x<height+step;x+=step) - { - if (y < height && x < width) - c=m_mosaicbitmap.pix32(y, x); - - if (m_mosaic<0) - if (y+step-1<height && x+step-1< width) - c = m_mosaicbitmap.pix32(y+step-1, x+step-1); - - for (yy=0;yy<step;yy++) - for (xx=0;xx<step;xx++) - { - if (xx+x < width && yy+y<height) - { - dest=&bitmap.pix32(y+yy, x+xx); - *dest=c; - } - } - } - } + for (int y=0;y<width+step;y+=step) + for (int x=0;x<height+step;x+=step) + { + if (y < height && x < width) + c=m_mosaicbitmap.pix(y, x); + + if (m_mosaic<0) + if (y+step-1<height && x+step-1< width) + c = m_mosaicbitmap.pix(y+step-1, x+step-1); + + for (int yy=0;yy<step;yy++) + for (int xx=0;xx<step;xx++) + { + if (xx+x < width && yy+y<height) + bitmap.pix(y+yy, x+xx) = c; + } + } } } #else @@ -761,33 +755,27 @@ void valtric_state::draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con else { m_bg_tilemap[1]->draw(screen, m_mosaicbitmap, cliprect, 0, 0); - { - u32 *dest; - int x,y,xx,yy,c=0; - int width = screen.width(); - int height = screen.height(); + int c=0; + int width = screen.width(); + int height = screen.height(); - for (y = 0; y < width+step; y += step) - for (x = 0; x < height+step; x += step) - { - if (y < height && x < width) - c = m_mosaicbitmap.pix32(y, x); - - if (m_valtric_mosaic & 0x80) - if (y+step-1 < height && x+step-1 < width) - c = m_mosaicbitmap.pix32(y+step-1, x+step-1); - - for (yy = 0; yy < step; yy++) - for (xx = 0; xx < step; xx++) - { - if (xx+x < width && yy+y < height) - { - dest = &bitmap.pix32(y+yy, x+xx); - *dest = c; - } - } - } - } + for (int y = 0; y < width+step; y += step) + for (int x = 0; x < height+step; x += step) + { + if (y < height && x < width) + c = m_mosaicbitmap.pix(y, x); + + if (m_valtric_mosaic & 0x80) + if (y+step-1 < height && x+step-1 < width) + c = m_mosaicbitmap.pix(y+step-1, x+step-1); + + for (int yy = 0; yy < step; yy++) + for (int xx = 0; xx < step; xx++) + { + if (xx+x < width && yy+y < height) + bitmap.pix(y+yy, x+xx) = c; + } + } } } #endif diff --git a/src/mame/video/armedf.cpp b/src/mame/video/armedf.cpp index 45a9b36f1f8..11995cb029e 100644 --- a/src/mame/video/armedf.cpp +++ b/src/mame/video/armedf.cpp @@ -281,28 +281,24 @@ void armedf_state::armedf_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,g if (ex > sx) { /* skip if inner loop doesn't draw anything */ - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + u8 const *const source = source_base + y_index*gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const destpri = &primap.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const u8 *source = source_base + y_index*gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *destpri = &primap.pix8(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); + if (c != transparent_color) { - int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); - if (c != transparent_color) - { - if (((1 << (destpri[x] & 0x1f)) & pmask) == 0) - dest[x] = pal[c]; - destpri[x] = 0x1f; - } - x_index += xinc; + if (((1 << (destpri[x] & 0x1f)) & pmask) == 0) + dest[x] = pal[c]; + destpri[x] = 0x1f; } - y_index += yinc; + x_index += xinc; } + y_index += yinc; } } } diff --git a/src/mame/video/artmagic.cpp b/src/mame/video/artmagic.cpp index 1060e828688..0fede06b4a5 100644 --- a/src/mame/video/artmagic.cpp +++ b/src/mame/video/artmagic.cpp @@ -334,13 +334,12 @@ void artmagic_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) TMS340X0_SCANLINE_RGB32_CB_MEMBER(artmagic_state::scanline) { offs_t offset = (params->rowaddr << 12) & 0x7ff000; - uint16_t *vram = address_to_vram(&offset); - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *vram = address_to_vram(&offset); + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; vram += offset; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = pens[vram[coladdr++ & 0x1ff] & 0xff]; } diff --git a/src/mame/video/astrocde.cpp b/src/mame/video/astrocde.cpp index 43bb3cb1a97..d89d431a2e6 100644 --- a/src/mame/video/astrocde.cpp +++ b/src/mame/video/astrocde.cpp @@ -256,11 +256,10 @@ void astrocde_state::init_savestate() uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; + uint8_t const *const videoram = m_videoram; uint32_t sparklebase = 0; const int colormask = (m_video_config & AC_MONITOR_BW) ? 0 : 0x1f0; int xystep = 2 - m_video_mode; - int y; /* compute the starting point of sparkle for the current frame */ int width = screen.width(); @@ -270,13 +269,12 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in sparklebase = (screen.frame_number() * (uint64_t)(width * height)) % RNG_PERIOD; /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); int effy = mame_vpos_to_astrocade_vpos(y); uint16_t offset = (effy / xystep) * (80 / xystep); uint32_t sparkleoffs = 0, staroffs = 0; - int x; /* compute the star and sparkle offset at the start of this line */ if (m_video_config & AC_STARS) @@ -288,23 +286,20 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in } /* iterate over groups of 4 pixels */ - for (x = 0; x < 456/4; x += xystep) + for (int x = 0; x < 456/4; x += xystep) { int effx = x - HORZ_OFFSET/4; const uint8_t *colorbase = &m_colors[(effx < m_colorsplit) ? 4 : 0]; - uint8_t data; - int xx; /* select either video data or background data */ - data = (effx >= 0 && effx < 80 && effy >= 0 && effy < m_vblank) ? videoram[offset++] : m_bgdata; + uint8_t data = (effx >= 0 && effx < 80 && effy >= 0 && effy < m_vblank) ? videoram[offset++] : m_bgdata; /* iterate over the 4 pixels */ - for (xx = 0; xx < 4; xx++) + for (int xx = 0; xx < 4; xx++) { uint8_t pixdata = (data >> 6) & 3; int colordata = colorbase[pixdata] << 1; int luma = colordata & 0x0f; - rgb_t color; /* handle stars/sparkle */ if (m_video_config & AC_STARS) @@ -324,7 +319,7 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in if (++sparkleoffs >= RNG_PERIOD) sparkleoffs = 0; } - color = (colordata & colormask) | luma; + rgb_t const color = (colordata & colormask) | luma; /* store the final color to the destination and shift */ *dest++ = color; @@ -341,20 +336,17 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in uint32_t astrocde_state::screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = mame_vpos_to_astrocade_vpos(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); uint16_t offset = m_profpac_vispage * 0x4000 + effy * 80; - int x; /* star with black */ /* iterate over groups of 4 pixels */ - for (x = 0; x < 456/4; x++) + for (int x = 0; x < 456/4; x++) { int effx = x - HORZ_OFFSET/4; diff --git a/src/mame/video/atarig42.cpp b/src/mame/video/atarig42.cpp index b3b8b197ba5..67a50a0478b 100644 --- a/src/mame/video/atarig42.cpp +++ b/src/mame/video/atarig42.cpp @@ -174,23 +174,22 @@ uint32_t atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.left(); - int top = cliprect.top(); - int right = cliprect.right() + 1; - int bottom = cliprect.bottom() + 1; - int x, y; + int const left = cliprect.left(); + int const top = cliprect.top(); + int const right = cliprect.right() + 1; + int const bottom = cliprect.bottom() + 1; /* now blend with the playfield */ - for (y = top; y < bottom; y++) + for (int y = top; y < bottom; y++) { - uint16_t *pf = &bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); - for (x = left; x < right; x++) + uint16_t *const pf = &bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); + for (int x = left; x < right; x++) if (mo[x]) { - int pfpri = pri[x]; - int mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; + int const pfpri = pri[x]; + int const mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; if (mopri >= pfpri) pf[x] = mo[x] & ATARIRLE_DATA_MASK; } diff --git a/src/mame/video/atarigt.cpp b/src/mame/video/atarigt.cpp index 711b792ec6d..490e5376ad2 100644 --- a/src/mame/video/atarigt.cpp +++ b/src/mame/video/atarigt.cpp @@ -486,9 +486,6 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 { bitmap_ind16 &mo_bitmap = m_rle->vram(0); bitmap_ind16 &tm_bitmap = m_rle->vram(1); - uint16_t *cram, *tram; - int color_latch; - int x, y; /* draw the playfield */ m_playfield_tilemap->draw(screen, m_pf_bitmap, cliprect, 0, 0); @@ -497,32 +494,31 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 m_alpha_tilemap->draw(screen, m_an_bitmap, cliprect, 0, 0); /* cache pointers */ - color_latch = m_colorram[0x30000>>1]; - cram = (uint16_t *)&m_colorram[0x00000>>1] + ((color_latch & 0x08) << 10); - tram = (uint16_t *)&m_colorram[0x20000>>1] + ((color_latch & 0x30) << 8); - const pen_t *mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; + int const color_latch = m_colorram[0x30000>>1]; + uint16_t const *const cram = (uint16_t *)&m_colorram[0x00000>>1] + ((color_latch & 0x08) << 10); + uint16_t const *const tram = (uint16_t *)&m_colorram[0x20000>>1] + ((color_latch & 0x30) << 8); + pen_t const *const mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; /* now do the nasty blend */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *an = &m_an_bitmap.pix16(y); - uint16_t *pf = &m_pf_bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint16_t *tm = &tm_bitmap.pix16(y); - uint32_t *dst = &bitmap.pix32(y); + uint16_t const *const an = &m_an_bitmap.pix(y); + uint16_t const *const pf = &m_pf_bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint16_t const *const tm = &tm_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y); /* Primal Rage: no TRAM, slightly different priorities */ if (m_is_primrage) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pfpri = (pf[x] >> 10) & 7; uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; uint8_t mgep = (mopri >= pfpri) && !(pfpri & 4); - uint16_t cra; - uint32_t rgb; /* compute CRA -- unlike T-Mek, MVID11 enforces MO priority and is ignored */ + uint16_t cra; if (an[x] & 0x8f) cra = an[x] & 0xff; else if ((mo[x] & 0x3f) && ((mo[x] & 0x800) || mgep || !(pf[x] & 0x3f))) @@ -532,6 +528,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 cra = cram[cra]; /* compute the result */ + uint32_t rgb; rgb = mram[((cra >> 10) & 0x01f)] & 0xff0000; rgb |= mram[((cra >> 5) & 0x01f)] & 0x00ff00; rgb |= mram[((cra >> 0) & 0x01f)] & 0x0000ff; @@ -548,16 +545,14 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 /* T-Mek: full TRAM and all effects */ else { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint8_t pfpri = (pf[x] >> 10) & 7; - uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; - uint8_t mgep = (mopri >= pfpri) && !(pfpri & 4); - int no_tra = 0, no_cra = 0; - uint16_t cra, tra, mra; - uint32_t rgb; + uint8_t const pfpri = (pf[x] >> 10) & 7; + uint8_t const mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; + uint8_t const mgep = (mopri >= pfpri) && !(pfpri & 4); /* compute CRA/TRA */ + uint16_t cra, tra; if (an[x] & 0x8f) { cra = an[x] & 0xff; @@ -577,9 +572,10 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 tra = tram[tra]; /* compute MRA */ - mra = (tm[x] & 0xe00) << 1; + uint16_t const mra = (tm[x] & 0xe00) << 1; /* turn off CRA/TRA as appropriate */ + int no_tra = 0, no_cra = 0; if (!(pf[x] & 0x1000) && (tra & 0x8000)) no_cra = 1; if (!(!(cra & 0x8000) && (!(pf[x] & 0x1000) || !(pf[x] & 0x3f)))) @@ -590,6 +586,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 tra = 0; /* compute the result */ + uint32_t rgb; rgb = mram[mra | ((cra >> 10) & 0x01f) | ((tra >> 5) & 0x3e0)] & 0xff0000; rgb |= mram[mra | ((cra >> 5) & 0x01f) | ((tra >> 0) & 0x3e0)] & 0x00ff00; rgb |= mram[mra | ((cra >> 0) & 0x01f) | ((tra << 5) & 0x3e0)] & 0x0000ff; diff --git a/src/mame/video/atarigx2.cpp b/src/mame/video/atarigx2.cpp index 870fbbe9b42..c376ac43112 100644 --- a/src/mame/video/atarigx2.cpp +++ b/src/mame/video/atarigx2.cpp @@ -182,19 +182,18 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.left(); - int top = cliprect.top(); - int right = cliprect.right() + 1; - int bottom = cliprect.bottom() + 1; - int x, y; + int const left = cliprect.left(); + int const top = cliprect.top(); + int const right = cliprect.right() + 1; + int const bottom = cliprect.bottom() + 1; /* now blend with the playfield */ - for (y = top; y < bottom; y++) + for (int y = top; y < bottom; y++) { - uint16_t *pf = &bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); - for (x = left; x < right; x++) + uint16_t *const pf = &bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); + for (int x = left; x < right; x++) if (mo[x] && (mo[x] >> ATARIRLE_PRIORITY_SHIFT) >= pri[x]) pf[x] = mo[x] & ATARIRLE_DATA_MASK; } diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp index 3db58a6d8d2..7ceb6e23699 100644 --- a/src/mame/video/atarimo.cpp +++ b/src/mame/video/atarimo.cpp @@ -234,7 +234,7 @@ void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cl // a stop or the end of line. //------------------------------------------------- -void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y) +void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t const *mo, int x, int y) { const uint16_t START_MARKER = ((4 << PRIORITY_SHIFT) | 2); const uint16_t END_MARKER = ((4 << PRIORITY_SHIFT) | 4); diff --git a/src/mame/video/atarimo.h b/src/mame/video/atarimo.h index 2de0270217f..8fc8e2db95d 100644 --- a/src/mame/video/atarimo.h +++ b/src/mame/video/atarimo.h @@ -101,7 +101,7 @@ public: // rendering virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; - void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y); + void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t const *mo, int x, int y); // memory access uint16_t &slipram(int offset) { return m_slipram[offset]; } diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp index 5112e2f8afc..5063ea02590 100644 --- a/src/mame/video/atarirle.cpp +++ b/src/mame/video/atarirle.cpp @@ -606,7 +606,7 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang int current_row = 0; for (int y = sy; y <= ey; y++, sourcey += dy) { - u16 *dest = &bitmap.pix16(y, sx); + u16 *dest = &bitmap.pix(y, sx); int sourcex = dx / 2, rle_end = 0; // loop until we hit the row we're on @@ -665,7 +665,7 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang // clipped case else { - const u16 *end = &bitmap.pix16(y, ex); + const u16 *end = &bitmap.pix(y, ex); int to_be_skipped = pixels_to_skip; // decode the pixels @@ -785,7 +785,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r int current_row = 0; for (int y = sy; y <= ey; y++, sourcey += dy) { - u16 *dest = &bitmap.pix16(y, ex); + u16 *dest = &bitmap.pix(y, ex); int sourcex = dx / 2, rle_end = 0; // loop until we hit the row we're on @@ -844,7 +844,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r // clipped case else { - const u16 *start = &bitmap.pix16(y, sx); + const u16 *start = &bitmap.pix(y, sx); int to_be_skipped = pixels_to_skip; // decode the pixels @@ -989,19 +989,19 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite) for (int ty = sy; ty <= ey; ty++) { - bitmap.pix16(ty, sx) = machine().rand() & 0xff; - bitmap.pix16(ty, ex) = machine().rand() & 0xff; + bitmap.pix(ty, sx) = machine().rand() & 0xff; + bitmap.pix(ty, ex) = machine().rand() & 0xff; } for (int tx = sx; tx <= ex; tx++) { - bitmap.pix16(sy, tx) = machine().rand() & 0xff; - bitmap.pix16(ey, tx) = machine().rand() & 0xff; + bitmap.pix(sy, tx) = machine().rand() & 0xff; + bitmap.pix(ey, tx) = machine().rand() & 0xff; } } while (0); - fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", - code, color, hflip, - x, -scaled_xoffs, (scale * info.width) >> 12, - y, -scaled_yoffs, (scale * info.height) >> 12, scale); + osd_printf_info(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", + code, color, hflip, + x, -scaled_xoffs, (scale * info.width) >> 12, + y, -scaled_yoffs, (scale * info.height) >> 12, scale); } } diff --git a/src/mame/video/atarist.cpp b/src/mame/video/atarist.cpp index 89f0d060ece..093c118f982 100644 --- a/src/mame/video/atarist.cpp +++ b/src/mame/video/atarist.cpp @@ -156,7 +156,7 @@ void st_state::shifter_tick() break; } - m_bitmap.pix32(y, x) = pen; + m_bitmap.pix(y, x) = pen; } @@ -192,7 +192,7 @@ inline void st_state::shifter_load() void st_state::draw_pixel(int x, int y, u32 pen) { if(x < m_bitmap.width() && y < m_bitmap.height()) - m_bitmap.pix32(y, x) = pen; + m_bitmap.pix(y, x) = pen; } void st_state::glue_tick() diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp index 44a7129aff6..8c77c936622 100644 --- a/src/mame/video/atarisy1.cpp +++ b/src/mame/video/atarisy1.cpp @@ -487,8 +487,8 @@ uint32_t atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp index 95c75cfee5b..a3acaa781e2 100644 --- a/src/mame/video/atarisy2.cpp +++ b/src/mame/video/atarisy2.cpp @@ -248,13 +248,13 @@ uint32_t atarisy2_state::screen_update_atarisy2(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; // high priority PF? if ((mopriority + pri[x]) & 2) diff --git a/src/mame/video/aussiebyte.cpp b/src/mame/video/aussiebyte.cpp index faf67b30126..65aceaa2cab 100644 --- a/src/mame/video/aussiebyte.cpp +++ b/src/mame/video/aussiebyte.cpp @@ -166,23 +166,22 @@ u8 aussiebyte_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, u16 ac_cnt, bool a MC6845_UPDATE_ROW( aussiebyte_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,attr; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); ra &= 15; m_cnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = ma + x; - attr = m_aram[mem & 0x7ff]; + u16 mem = ma + x; + u8 attr = m_aram[mem & 0x7ff]; + u8 chr; if (BIT(attr, 7)) chr = m_vram[mem & 0x3fff]; // alpha else chr = m_vram[(mem << 4) | ra]; // gfx - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + u8 gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/video/avigo.cpp b/src/mame/video/avigo.cpp index 5e84eb94e69..9bb5d450ed6 100644 --- a/src/mame/video/avigo.cpp +++ b/src/mame/video/avigo.cpp @@ -78,32 +78,26 @@ void avigo_state::video_start() uint32_t avigo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - int b; - int x; - /* draw avigo display */ - for (y=0; y<AVIGO_SCREEN_HEIGHT; y++) + for (int y=0; y<AVIGO_SCREEN_HEIGHT; y++) { - int by; uint8_t *line_ptr = &m_video_memory[y*(AVIGO_SCREEN_WIDTH>>3)]; - x = 0; - for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) + int x = 0; + for (int by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) { - int px; uint8_t byte = line_ptr[0]; - px = x; - for (b=7; b>=0; b--) + int px = x; + for (int b=7; b>=0; b--) { - bitmap.pix16(y, px) = ((byte>>7) & 0x01); + bitmap.pix(y, px) = ((byte>>7) & 0x01); px++; - byte = byte<<1; + byte <<= 1; } x = px; - line_ptr = line_ptr+1; + line_ptr++; } } return 0; diff --git a/src/mame/video/badlands.cpp b/src/mame/video/badlands.cpp index 9582a100e23..27fd00abf7e 100644 --- a/src/mame/video/badlands.cpp +++ b/src/mame/video/badlands.cpp @@ -114,13 +114,12 @@ uint32_t badlands_state::screen_update_badlands(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not yet verified - */ + // not yet verified if ((mo[x] & atari_motion_objects_device::PRIORITY_MASK) || !(pf[x] & 8)) pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; } diff --git a/src/mame/video/balsente.cpp b/src/mame/video/balsente.cpp index 3b7e65aec1a..ad5737a2db7 100644 --- a/src/mame/video/balsente.cpp +++ b/src/mame/video/balsente.cpp @@ -127,27 +127,25 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip int image = sprite[1] | ((flags & 7) << 8); int ypos = sprite[2] + 17 + BALSENTE_VBEND; int xpos = sprite[3]; - uint8_t *src; - int x, y; /* get a pointer to the source image */ - src = &m_sprite_data[(64 * image) & m_sprite_mask]; + uint8_t const *src = &m_sprite_data[(64 * image) & m_sprite_mask]; if (flags & 0x80) src += 4 * 15; /* loop over y */ - for (y = 0; y < 16; y++, ypos = (ypos + 1) & 255) + for (int y = 0; y < 16; y++, ypos = (ypos + 1) & 255) { if (ypos >= (16 + BALSENTE_VBEND) && ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - const pen_t *pens = &m_palette->pen(m_palettebank_vis * 256); - uint8_t *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; + pen_t const *const pens = &m_palette->pen(m_palettebank_vis * 256); + const uint8_t *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; int currx = xpos; /* standard case */ if (!(flags & 0x40)) { /* loop over x */ - for (x = 0; x < 4; x++, old += 2) + for (int x = 0; x < 4; x++, old += 2) { int ipixel = *src++; int left = ipixel & 0xf0; @@ -155,12 +153,12 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip /* left pixel, combine with the background */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[left | old[0]]; + bitmap.pix(ypos, currx) = pens[left | old[0]]; currx++; /* right pixel, combine with the background */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[right | old[1]]; + bitmap.pix(ypos, currx) = pens[right | old[1]]; currx++; } } @@ -171,7 +169,7 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip src += 4; /* loop over x */ - for (x = 0; x < 4; x++, old += 2) + for (int x = 0; x < 4; x++, old += 2) { int ipixel = *--src; int left = (ipixel << 4) & 0xf0; @@ -179,12 +177,12 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip /* left pixel, combine with the background */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[left | old[0]]; + bitmap.pix(ypos, currx) = pens[left | old[0]]; currx++; /* right pixel, combine with the background */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[right | old[1]]; + bitmap.pix(ypos, currx) = pens[right | old[1]]; currx++; } src += 4; diff --git a/src/mame/video/batman.cpp b/src/mame/video/batman.cpp index eb5b4c27f25..9d9746580ec 100644 --- a/src/mame/video/batman.cpp +++ b/src/mame/video/batman.cpp @@ -120,9 +120,9 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -143,7 +143,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 obscured by high fg playfield pens priority 3 only obscured by bg playfield priority 3 only */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -152,7 +152,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* foreground playfield case */ if (pri[x] & 0x80) { - int pfpriority = (pri[x] >> 2) & 3; + int const pfpriority = (pri[x] >> 2) & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -170,7 +170,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* background playfield case */ else { - int pfpriority = pri[x] & 3; + int const pfpriority = pri[x] & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -192,12 +192,12 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/battlane.cpp b/src/mame/video/battlane.cpp index 83de94e3da9..f9ba9320711 100644 --- a/src/mame/video/battlane.cpp +++ b/src/mame/video/battlane.cpp @@ -69,22 +69,19 @@ void battlane_state::battlane_spriteram_w(offs_t offset, uint8_t data) void battlane_state::battlane_bitmap_w(offs_t offset, uint8_t data) { - int i, orval; - - orval = (~m_video_ctrl >> 1) & 0x07; - + int orval = (~m_video_ctrl >> 1) & 0x07; if (!orval) orval = 7; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (data & 1 << i) { - m_screen_bitmap.pix8(offset % 0x100, (offset / 0x100) * 8 + i) |= orval; + m_screen_bitmap.pix(offset % 0x100, (offset / 0x100) * 8 + i) |= orval; } else { - m_screen_bitmap.pix8(offset % 0x100, (offset / 0x100) * 8 + i) &= ~orval; + m_screen_bitmap.pix(offset % 0x100, (offset / 0x100) * 8 + i) &= ~orval; } } } @@ -207,20 +204,18 @@ void battlane_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre void battlane_state::draw_fg_bitmap( bitmap_ind16 &bitmap ) { - int x, y, data; - - for (y = 0; y < 32 * 8; y++) + for (int y = 0; y < 32 * 8; y++) { - for (x = 0; x < 32 * 8; x++) + for (int x = 0; x < 32 * 8; x++) { - data = m_screen_bitmap.pix8(y, x); + int const data = m_screen_bitmap.pix(y, x); if (data) { if (flip_screen()) - bitmap.pix16(255 - y, 255 - x) = data; + bitmap.pix(255 - y, 255 - x) = data; else - bitmap.pix16(y, x) = data; + bitmap.pix(y, x) = data; } } } diff --git a/src/mame/video/bbc.cpp b/src/mame/video/bbc.cpp index d599169000a..5ba8ced6e97 100644 --- a/src/mame/video/bbc.cpp +++ b/src/mame/video/bbc.cpp @@ -308,7 +308,7 @@ MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) int col = m_trom->get_rgb() ^ ((x_pos == cursor_x) ? 7 : 0); - bitmap.pix32(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); + bitmap.pix(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); } } } @@ -324,7 +324,7 @@ MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) col ^= ((cursor_x != -1 && x_pos >= cursor_x && x_pos < (cursor_x + m_cursor_size)) ? 7 : 0); - bitmap.pix32(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); + bitmap.pix(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); data = (data << 1) | 1; } } diff --git a/src/mame/video/bbusters.cpp b/src/mame/video/bbusters.cpp index 9f9132cf9ff..ffb748fab9a 100644 --- a/src/mame/video/bbusters.cpp +++ b/src/mame/video/bbusters.cpp @@ -137,31 +137,30 @@ void bbusters_state_base::draw_block(screen_device &screen, bitmap_ind16 &dest,i gfx_element *gfx = m_gfxdecode->gfx(bank); pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors()); uint32_t xinc=(m_scale_line_count * 0x10000 ) / size; - uint8_t pixel; - int x_index; int dy=y; - int sx, ex = m_scale_line_count; + int ex = m_scale_line_count; while (m_scale_line_count) { if (dy>=16 && dy<240) { - uint16_t *destline = &dest.pix16(dy); - uint8_t *priorityline = &screen.priority().pix8(dy); + uint16_t *const destline = &dest.pix(dy); + uint8_t *const priorityline = &screen.priority().pix(dy); uint8_t srcline=*m_scale_table_ptr; const uint8_t *srcptr=nullptr; if (!flipy) srcline=size-srcline-1; + int x_index; if (flipx) x_index=(ex-1)*0x10000; else x_index=0; - for (sx=0; sx<size; sx++) { + for (int sx=0; sx<size; sx++) { if ((sx%16)==0) srcptr=get_source_ptr(gfx,sprite,sx,srcline,block); - pixel=*srcptr++; + uint8_t pixel=*srcptr++; if (pixel!=15 && priority > priorityline[(x+(x_index>>16)) & 0x1ff]) { priorityline[(x+(x_index>>16)) & 0x1ff] = priority; diff --git a/src/mame/video/bigevglf.cpp b/src/mame/video/bigevglf.cpp index f7cc450a09f..7b05c7443a2 100644 --- a/src/mame/video/bigevglf.cpp +++ b/src/mame/video/bigevglf.cpp @@ -35,12 +35,11 @@ void bigevglf_state::bigevglf_vidram_addr_w(uint8_t data) void bigevglf_state::bigevglf_vidram_w(offs_t offset, uint8_t data) { - uint32_t x, y, o; - o = m_vidram_bank + offset; + uint32_t o = m_vidram_bank + offset; m_vidram[o + 0x10000 * m_plane_selected] = data; - y = o >>8; - x = (o & 255); - m_tmp_bitmap[m_plane_selected].pix16(y, x) = data; + uint32_t y = o >>8; + uint32_t x = (o & 255); + m_tmp_bitmap[m_plane_selected].pix(y, x) = data; } uint8_t bigevglf_state::bigevglf_vidram_r(offs_t offset) diff --git a/src/mame/video/bking.cpp b/src/mame/video/bking.cpp index 868a648a01e..62cd0dd73d7 100644 --- a/src/mame/video/bking.cpp +++ b/src/mame/video/bking.cpp @@ -291,12 +291,12 @@ WRITE_LINE_MEMBER(bking_state::screen_vblank_bking) m_bg_tilemap->set_scrolly(0, 0); // check for collision - const uint8_t* colmask = memregion("user1")->base() + 8 * m_hit; + uint8_t const *const colmask = memregion("user1")->base() + 8 * m_hit; for (int y = rect.min_y; y <= rect.max_y; y++) { - const uint16_t* p0 = &m_colmap_bg.pix16(y); - const uint16_t* p1 = &m_colmap_ball.pix16(y); + uint16_t const *const p0 = &m_colmap_bg.pix(y); + uint16_t const *const p1 = &m_colmap_ball.pix(y); for (int x = rect.min_x; x <= rect.max_x; x++) { diff --git a/src/mame/video/blockout.cpp b/src/mame/video/blockout.cpp index 1206a755bf5..1e84ca939e8 100644 --- a/src/mame/video/blockout.cpp +++ b/src/mame/video/blockout.cpp @@ -79,7 +79,7 @@ void blockout_state::videoram_w(offs_t offset, u8 data) else color = back | 0x100; - m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix(y, x) = color; } } @@ -96,7 +96,7 @@ u32 blockout_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { const u16 d = m_frontvideoram[((y & 0xff) << 6) + ((x & 0x1ff) >> 3)]; if (d & (1 << (7 - (x & 7)))) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp index e903a2be935..d71c2db6ca0 100644 --- a/src/mame/video/blstroid.cpp +++ b/src/mame/video/blstroid.cpp @@ -152,8 +152,8 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -161,7 +161,7 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in priority address = HPPPMMMM */ - int priaddr = ((pf[x] & 8) << 4) | (pf[x] & 0x70) | ((mo[x] & 0xf0) >> 4); + int const priaddr = ((pf[x] & 8) << 4) | (pf[x] & 0x70) | ((mo[x] & 0xf0) >> 4); if (m_priorityram[priaddr] & 1) pf[x] = mo[x]; } diff --git a/src/mame/video/boogwing.cpp b/src/mame/video/boogwing.cpp index 6668fc3b6d2..5095b54e964 100644 --- a/src/mame/video/boogwing.cpp +++ b/src/mame/video/boogwing.cpp @@ -37,8 +37,7 @@ constexpr u32 sub_blend_r32(u32 d, u32 s, u8 level) */ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y, x; - const pen_t *paldata = &m_deco_ace->pen(0); + pen_t const *const paldata = &m_deco_ace->pen(0); bitmap_ind16 *sprite_bitmap1, *sprite_bitmap2, *alpha_tmap_bitmap; bitmap_ind8* priority_bitmap; @@ -49,21 +48,17 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c alpha_tmap_bitmap = &m_alpha_tmap_bitmap; priority_bitmap = &screen.priority(); - uint32_t* dstline; - uint16_t *srcline1, *srcline2, *srcline3, *tmapline; - uint8_t *srcpriline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top();y<=cliprect.bottom();y++) { - srcline1=&sprite_bitmap1->pix16(y,0); - srcline2=&sprite_bitmap2->pix16(y,0); - srcline3=&alpha_tmap_bitmap->pix16(y,0); - tmapline=&m_temp_bitmap.pix16(y,0); - srcpriline=&priority_bitmap->pix8(y,0); + uint16_t *srcline1=&sprite_bitmap1->pix(y,0); + uint16_t *srcline2=&sprite_bitmap2->pix(y,0); + uint16_t *srcline3=&alpha_tmap_bitmap->pix(y,0); + uint16_t *tmapline=&m_temp_bitmap.pix(y,0); + uint8_t *srcpriline=&priority_bitmap->pix(y,0); - dstline=&bitmap.pix32(y,0); + uint32_t *dstline=&bitmap.pix(y,0); - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix1 = srcline1[x]; uint16_t pix2 = srcline2[x]; diff --git a/src/mame/video/bosco.cpp b/src/mame/video/bosco.cpp index 62b366cebf9..8e7b869c3aa 100644 --- a/src/mame/video/bosco.cpp +++ b/src/mame/video/bosco.cpp @@ -266,16 +266,16 @@ uint32_t bosco_state::screen_update_bosco(screen_device &screen, bitmap_ind16 &b { for (int x = 63; x >= 0; x--) { - bitmap.pix16(y, x + 3) = bitmap.pix16(y, x); - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x + 3) = bitmap.pix(y, x); + bitmap.pix(y, x) = m_palette->black_pen(); } } else { for (int x = 224; x < 288; x++) { - bitmap.pix16(y, x - 3) = bitmap.pix16(y, x); - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x - 3) = bitmap.pix(y, x); + bitmap.pix(y, x) = m_palette->black_pen(); } } } diff --git a/src/mame/video/btoads.cpp b/src/mame/video/btoads.cpp index b891357d00e..a4203790a1d 100644 --- a/src/mame/video/btoads.cpp +++ b/src/mame/video/btoads.cpp @@ -307,10 +307,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) uint16_t *bg0_base = &m_vram_bg0[(fulladdr + (m_yscroll0 << 10)) & 0x3fc00]; uint16_t *bg1_base = &m_vram_bg1[(fulladdr + (m_yscroll1 << 10)) & 0x3fc00]; uint8_t *spr_base = &m_vram_fg_display[fulladdr & 0x3fc00]; - uint32_t *dst = &bitmap.pix32(scanline); + uint32_t *const dst = &bitmap.pix(scanline); const pen_t *pens = m_tlc34076->pens(); int coladdr = fulladdr & 0x3ff; - int x; /* for each scanline, switch off the render mode */ switch (m_screen_control & 3) @@ -324,7 +323,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG0 */ case 0: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -369,7 +368,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG1 */ case 1: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -411,7 +410,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 3. BG0 */ case 2: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -447,7 +446,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG0 */ case 3: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t bg0pix = bg0_base[(coladdr + m_xscroll0) & 0xff]; uint16_t bg1pix = bg1_base[(coladdr + m_xscroll1) & 0xff]; @@ -486,7 +485,6 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) { char name[10]; FILE *f; - int i; while (machine().input().code_pressed(KEYCODE_X)) ; @@ -494,7 +492,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) f = fopen(name, "w"); fprintf(f, "screen_control = %04X\n\n", m_screen_control << 8); - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { uint16_t *base = (i == 0) ? (uint16_t *)m_vram_fg_display : (i == 1) ? m_vram_bg0 : m_vram_bg1; int xscr = (i == 0) ? 0 : (i == 1) ? m_xscroll0 : m_xscroll1; diff --git a/src/mame/video/buggychl.cpp b/src/mame/video/buggychl.cpp index e3c98e953c9..7ac9ed42437 100644 --- a/src/mame/video/buggychl.cpp +++ b/src/mame/video/buggychl.cpp @@ -77,7 +77,7 @@ void buggychl_state::draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) { for (int y = 0; y < 256; y++) for (int x = 0; x < 256; x++) - bitmap.pix16(y, x) = 128 + x / 2; + bitmap.pix(y, x) = 128 + x / 2; } @@ -158,28 +158,21 @@ void buggychl_state::draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ) void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - const uint8_t *gfx; - g_profiler.start(PROFILER_USER1); - gfx = memregion("gfx2")->base(); - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + uint8_t const *const gfx = memregion("gfx2")->base(); + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int sx, sy, flipy, zoom, ch, x, px, y; - const uint8_t *lookup; - const uint8_t *zoomx_rom, *zoomy_rom; + int sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); + int sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); + int flipy = m_spriteram[offs + 1] & 0x40; + int zoom = m_spriteram[offs + 1] & 0x3f; + uint8_t const *const zoomy_rom = gfx + (zoom << 6); + uint8_t const *const zoomx_rom = gfx + 0x2000 + (zoom << 3); - sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); - sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); - flipy = m_spriteram[offs + 1] & 0x40; - zoom = m_spriteram[offs + 1] & 0x3f; - zoomy_rom = gfx + (zoom << 6); - zoomx_rom = gfx + 0x2000 + (zoom << 3); + uint8_t const *const lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { int dy = flip_screen_y() ? (255 - sy - y) : (sy + y); @@ -192,26 +185,23 @@ void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre if (flipy) base_pos ^= 0x38; - px = 0; - for (ch = 0; ch < 4; ch++) + int px = 0; + for (int ch = 0; ch < 4; ch++) { - int pos, code, realflipy; - const uint8_t *pendata; - - pos = base_pos + 2 * ch; - code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); - realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; + int pos = base_pos + 2 * ch; + int code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); + int realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; code += (realflipy ? (charline ^ 7) : charline); - pendata = m_gfxdecode->gfx(1)->get_data(code); + uint8_t const *const pendata = m_gfxdecode->gfx(1)->get_data(code); - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { int col = pendata[x]; if (col) { int dx = flip_screen_x() ? (255 - sx - px) : (sx + px); if ((dx & ~0xff) == 0) - bitmap.pix16(dy, dx) = m_sprite_color_base + col; + bitmap.pix(dy, dx) = m_sprite_color_base + col; } /* the following line is almost certainly wrong */ diff --git a/src/mame/video/busicom.cpp b/src/mame/video/busicom.cpp index 81c0c715f9a..711d1917915 100644 --- a/src/mame/video/busicom.cpp +++ b/src/mame/video/busicom.cpp @@ -1826,10 +1826,10 @@ uint32_t busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind1 for (u8 j = 0; j < 44; j++) { for (u8 b = 0; b < 34; b++) - bitmap.pix16((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; + bitmap.pix((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; for (u8 b = 34; b < 40; b++) - bitmap.pix16((y*44)+j, x*40+b) = 0; + bitmap.pix((y*44)+j, x*40+b) = 0; } } } diff --git a/src/mame/video/capbowl.cpp b/src/mame/video/capbowl.cpp index f39ea193571..0e4faece1ec 100644 --- a/src/mame/video/capbowl.cpp +++ b/src/mame/video/capbowl.cpp @@ -140,8 +140,8 @@ uint32_t capbowl_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* now regenerate the bitmap */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t const *src = &m_tms34061->vram(y); - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const src = &m_tms34061->vram(y); + uint32_t *dest = &bitmap.pix(y); for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/video/carpolo.cpp b/src/mame/video/carpolo.cpp index 7942b6a6eaf..69d6b50713f 100644 --- a/src/mame/video/carpolo.cpp +++ b/src/mame/video/carpolo.cpp @@ -321,8 +321,6 @@ int carpolo_state::check_sprite_sprite_collision(int x1, int y1, int code1, int /* check if the two sprites are even within collision range */ if ((abs(x1 - x2) < SPRITE_WIDTH) && (abs(y1 - y2) < SPRITE_HEIGHT)) { - int x,y; - normalize_coordinates(&x1, &y1, &x2, &y2); m_sprite_sprite_collision_bitmap1->fill(0); @@ -338,10 +336,10 @@ int carpolo_state::check_sprite_sprite_collision(int x1, int y1, int code1, int 0,flipy2, x2,y2); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if ((m_sprite_sprite_collision_bitmap1->pix16(y, x) == 1) && - (m_sprite_sprite_collision_bitmap2->pix16(y, x) == 1)) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if ((m_sprite_sprite_collision_bitmap1->pix(y, x) == 1) && + (m_sprite_sprite_collision_bitmap2->pix(y, x) == 1)) { *col_x = (x1 + x) & 0x0f; *col_y = (y1 + y) & 0x0f; @@ -369,12 +367,8 @@ int carpolo_state::check_sprite_left_goal_collision(int x1, int y1, int code1, i if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) && ((x1 + 16) > LEFT_GOAL_X) && (x1 < (LEFT_GOAL_X + GOAL_WIDTH))) { - int x,y; - int x2,y2; - - - x2 = LEFT_GOAL_X; - y2 = GOAL_Y; + int x2 = LEFT_GOAL_X; + int y2 = GOAL_Y; normalize_coordinates(&x1, &y1, &x2, &y2); @@ -392,11 +386,11 @@ int carpolo_state::check_sprite_left_goal_collision(int x1, int y1, int code1, i x2,y2, 0x20000,0x20000,0); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if (m_sprite_goal_collision_bitmap1->pix16(y, x) == 1) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if (m_sprite_goal_collision_bitmap1->pix(y, x) == 1) { - pen_t pix = m_sprite_goal_collision_bitmap2->pix16(y, x); + pen_t pix = m_sprite_goal_collision_bitmap2->pix(y, x); if (pix == LEFT_GOAL_PEN) { @@ -427,11 +421,8 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) && ((x1 + 16) > RIGHT_GOAL_X) && (x1 < (RIGHT_GOAL_X + GOAL_WIDTH))) { - int x,y; - int x2,y2; - - x2 = RIGHT_GOAL_X; - y2 = GOAL_Y; + int x2 = RIGHT_GOAL_X; + int y2 = GOAL_Y; normalize_coordinates(&x1, &y1, &x2, &y2); @@ -449,11 +440,11 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, x2,y2, 0x20000,0x20000,0); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if (m_sprite_goal_collision_bitmap1->pix16(y, x) == 1) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if (m_sprite_goal_collision_bitmap1->pix(y, x) == 1) { - pen_t pix = m_sprite_goal_collision_bitmap2->pix16(y, x); + pen_t pix = m_sprite_goal_collision_bitmap2->pix(y, x); if (pix == RIGHT_GOAL_PEN) { @@ -477,7 +468,6 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, 2 for collision with horizontal border */ int carpolo_state::check_sprite_border_collision(uint8_t x1, uint8_t y1, int code1, int flipy1) { - uint8_t x,y; int collided = 0; x1 = 240 - x1; @@ -488,9 +478,9 @@ int carpolo_state::check_sprite_border_collision(uint8_t x1, uint8_t y1, int cod 0,flipy1, 0,0); - for (x = 0; x < SPRITE_WIDTH; x++) - for (y = 0; y < SPRITE_HEIGHT; y++) - if (m_sprite_border_collision_bitmap->pix16(y, x) == 1) + for (uint8_t x = 0; x < SPRITE_WIDTH; x++) + for (uint8_t y = 0; y < SPRITE_HEIGHT; y++) + if (m_sprite_border_collision_bitmap->pix(y, x) == 1) { if (((uint8_t)(x1 + x) == LEFT_BORDER) || ((uint8_t)(x1 + x) == RIGHT_BORDER)) diff --git a/src/mame/video/ccastles.cpp b/src/mame/video/ccastles.cpp index 175f7f694d0..4784167e80b 100644 --- a/src/mame/video/ccastles.cpp +++ b/src/mame/video/ccastles.cpp @@ -254,49 +254,47 @@ void ccastles_state::ccastles_bitmode_addr_w(offs_t offset, uint8_t data) uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteaddr = &m_spriteram[m_outlatch[1]->q7_r() * 0x100]; /* BUF1/BUF2 */ - int flip = m_outlatch[1]->q4_r() ? 0xff : 0x00; /* PLAYER2 */ - pen_t black = m_palette->black_pen(); - int x, y, offs; + uint8_t const *const spriteaddr = &m_spriteram[m_outlatch[1]->q7_r() * 0x100]; /* BUF1/BUF2 */ + int const flip = m_outlatch[1]->q4_r() ? 0xff : 0x00; /* PLAYER2 */ + pen_t const black = m_palette->black_pen(); /* draw the sprites */ m_spritebitmap.fill(0x0f, cliprect); - for (offs = 0; offs < 320/2; offs += 4) + for (int offs = 0; offs < 320/2; offs += 4) { - int x = spriteaddr[offs + 3]; - int y = 256 - 16 - spriteaddr[offs + 1]; - int which = spriteaddr[offs]; - int color = spriteaddr[offs + 2] >> 7; + int const x = spriteaddr[offs + 3]; + int const y = 256 - 16 - spriteaddr[offs + 1]; + int const which = spriteaddr[offs]; + int const color = spriteaddr[offs + 2] >> 7; m_gfxdecode->gfx(0)->transpen(m_spritebitmap,cliprect, which, color, flip, flip, x, y, 7); } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* if we're in the VBLANK region, just fill with black */ if (m_syncprom[y] & 1) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } /* non-VBLANK region: merge the sprites and the bitmap */ else { - uint16_t *mosrc = &m_spritebitmap.pix16(y); - int effy = (((y - m_vblank_end) + (flip ? 0 : m_vscroll)) ^ flip) & 0xff; - uint8_t *src; + uint16_t const *const mosrc = &m_spritebitmap.pix(y); /* the "POTATO" chip does some magic here; this is just a guess */ + int effy = (((y - m_vblank_end) + (flip ? 0 : m_vscroll)) ^ flip) & 0xff; if (effy < 24) effy = 24; - src = &m_videoram[effy * 128]; + uint8_t const *const src = &m_videoram[effy * 128]; /* loop over X */ - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) @@ -305,12 +303,11 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in /* otherwise, process normally */ else { - int effx = (m_hscroll + (x ^ flip)) & 255; + int const effx = (m_hscroll + (x ^ flip)) & 255; /* low 4 bits = left pixel, high 4 bits = right pixel */ uint8_t pix = (src[effx / 2] >> ((effx & 1) * 4)) & 0x0f; - uint8_t mopix = mosrc[x]; - uint8_t prindex, prvalue; + uint8_t const mopix = mosrc[x]; /* Inputs to the priority PROM: @@ -323,11 +320,12 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in Bit 1 = MPI Bit 0 = BIT3 */ + uint8_t prindex; prindex = 0x40; prindex |= (mopix & 7) << 2; prindex |= (mopix & 8) >> 2; prindex |= (pix & 8) >> 3; - prvalue = m_priprom[prindex]; + uint8_t const prvalue = m_priprom[prindex]; /* Bit 1 of prvalue selects the low 4 bits of the final pixel */ if (prvalue & 2) diff --git a/src/mame/video/cclimber.cpp b/src/mame/video/cclimber.cpp index d476216a1a8..9da5443bf3f 100644 --- a/src/mame/video/cclimber.cpp +++ b/src/mame/video/cclimber.cpp @@ -691,16 +691,14 @@ uint32_t cclimber_state::screen_update_cclimber(screen_device &screen, bitmap_in uint32_t cclimber_state::screen_update_yamato(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - uint8_t *sky_rom = memregion("user1")->base() + 0x1200; + uint8_t const *const sky_rom = memregion("user1")->base() + 0x1200; - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) { - int j; pen_t pen = YAMATO_SKY_PEN_BASE + sky_rom[(m_flip_x ? 0x80 : 0) + (i >> 1)]; - for (j = 0; j < 0x100; j++) - bitmap.pix16(j, (i - 8) & 0xff) = pen; + for (int j = 0; j < 0x100; j++) + bitmap.pix(j, (i - 8) & 0xff) = pen; } draw_playfield(screen, bitmap, cliprect); diff --git a/src/mame/video/cgc7900.cpp b/src/mame/video/cgc7900.cpp index 4ce2acbd448..90ff7bd702e 100644 --- a/src/mame/video/cgc7900.cpp +++ b/src/mame/video/cgc7900.cpp @@ -159,18 +159,18 @@ void cgc7900_state::draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap) { if (!OVERLAY_CURSOR_BLINK || m_blink) { - bitmap.pix32(y, (sx * 8) + x) = pen[7]; + bitmap.pix(y, (sx * 8) + x) = pen[7]; } } else { if (!BIT(data, x) || (OVERLAY_BLK && OVERLAY_CHARACTER_BLINK && !m_blink)) { - if (OVERLAY_VB) bitmap.pix32(y, (sx * 8) + x) = pen[bg]; + if (OVERLAY_VB) bitmap.pix(y, (sx * 8) + x) = pen[bg]; } else { - if (OVERLAY_VF) bitmap.pix32(y, (sx * 8) + x) = pen[fg]; + if (OVERLAY_VF) bitmap.pix(y, (sx * 8) + x) = pen[fg]; } } } diff --git a/src/mame/video/chaknpop.cpp b/src/mame/video/chaknpop.cpp index 06905c73deb..675b0f3644b 100644 --- a/src/mame/video/chaknpop.cpp +++ b/src/mame/video/chaknpop.cpp @@ -208,9 +208,8 @@ void chaknpop_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { int dx = m_flip_x ? -1 : 1; - int offs, i; - for (offs = 0; offs < 0x2000; offs++) + for (int offs = 0; offs < 0x2000; offs++) { int x = ((offs & 0x1f) << 3) + 7; int y = offs >> 5; @@ -221,7 +220,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec if (!m_flip_y) y = 255 - y; - for (i = 0x80; i > 0; i >>= 1, x += dx) + for (int i = 0x80; i > 0; i >>= 1, x += dx) { pen_t color = 0; @@ -235,11 +234,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec color |= 0x040; // tx mask if (color) - { - pen_t pen = bitmap.pix16(y, x); - pen |= color; - bitmap.pix16(y, x) = pen; - } + bitmap.pix(y, x) |= color; } } } diff --git a/src/mame/video/changela.cpp b/src/mame/video/changela.cpp index 098359b15f4..5c2f57e3f1f 100644 --- a/src/mame/video/changela.cpp +++ b/src/mame/video/changela.cpp @@ -44,12 +44,10 @@ void changela_state::video_start() void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) { - int sx, i; + uint8_t const *const ROM = memregion("user1")->base(); + uint8_t const *const RAM = m_spriteram; - uint8_t* ROM = memregion("user1")->base(); - uint8_t* RAM = m_spriteram; - - for (sx = 0; sx < 256; sx++) + for (int sx = 0; sx < 256; sx++) { int vr = (RAM[sx * 4 + 0] & 0x80) >> 7; int hr = (RAM[sx * 4 + 0] & 0x40) >> 6; @@ -61,27 +59,26 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) if (sy - ypos <= vsize) { - for (i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { - uint32_t A7, A8, rom_addr; - uint8_t counter, data; uint8_t sum = sy - ypos; - counter = i; + uint8_t counter = i; if (hr) counter ^= 0x0f; - A8 = ((tile & 0x02) >> 1) ^ ((hr & hs) ^ hs); - A7 = ((((vr ^ ((sum & 0x10) >> 4)) & ((vsize & 0x10) >> 4)) ^ 0x01) & (tile & 0x01) ) ^ 0x01; - rom_addr = (counter >> 1) | ((sum & 0x0f) << 3) | (A7 << 7) | (A8 << 8) | ((tile >> 2) << 9); + uint32_t A8 = ((tile & 0x02) >> 1) ^ ((hr & hs) ^ hs); + uint32_t A7 = ((((vr ^ ((sum & 0x10) >> 4)) & ((vsize & 0x10) >> 4)) ^ 0x01) & (tile & 0x01) ) ^ 0x01; + uint32_t rom_addr = (counter >> 1) | ((sum & 0x0f) << 3) | (A7 << 7) | (A8 << 8) | ((tile >> 2) << 9); if (vr) rom_addr ^= (0x0f << 3); + uint8_t data; if (counter & 1) data = ROM[rom_addr] & 0x0f; else data = (ROM[rom_addr] & 0xf0) >> 4; if ((data != 0x0f) && (data != 0)) - bitmap.pix16(sy, xpos + i) = data | 0x10; + bitmap.pix(sy, xpos + i) = data | 0x10; if (hs) { @@ -91,7 +88,7 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) data = (ROM[rom_addr ^ 0x100] & 0xf0) >> 4; if ((data != 0x0f) && (data != 0)) - bitmap.pix16(sy, xpos + i + 16) = data | 0x10; + bitmap.pix(sy, xpos + i + 16) = data | 0x10; } } } @@ -106,22 +103,17 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) void changela_state::draw_obj1( bitmap_ind16 &bitmap ) { - int sx, sy; - - uint8_t* ROM = memregion("gfx2")->base(); - uint8_t* RAM = m_videoram; + uint8_t const *const ROM = memregion("gfx2")->base(); + uint8_t const *const RAM = m_videoram; uint8_t reg[4] = { 0 }; /* 4x4-bit registers (U58, U59) */ - uint8_t tile; uint8_t attrib = 0; - for (sy = 0; sy < 256; sy++) + for (int sy = 0; sy < 256; sy++) { - for (sx = 0; sx < 256; sx++) + for (int sx = 0; sx < 256; sx++) { - int c0, c1, col, sum; - /* 11 Bits: H1, H3, H4, H5, H6, H7, V3, V4, V5, V6, V7 */ int ram_addr = ((sx & 0xf8) >> 2) | ((sy & 0xf8) << 3); int tile_addr = RAM[ram_addr]; @@ -129,11 +121,12 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) if (!(RAM[ram_addr + 1] & 0x10) && (sx & 0x04)) /* D4=0 enables latch at U32 */ attrib = RAM[ram_addr + 1]; - tile = ROM[(tile_addr << 4) | ((sx & 0x04) >> 2) | ((sy & 0x07) << 1)]; + uint8_t tile = ROM[(tile_addr << 4) | ((sx & 0x04) >> 2) | ((sy & 0x07) << 1)]; reg[(sx & 0x0c) >> 2] = tile; - sum = (sx & 0x0f) + (attrib & 0x0f); /* 4-bit adder (U45) */ + int sum = (sx & 0x0f) + (attrib & 0x0f); /* 4-bit adder (U45) */ /* Multiplexors (U57) */ + int c0, c1; if ((sum & 0x03) == 0) { c0 = (reg[(sum & 0x0c) >> 2] & 0x08) >> 3; @@ -155,9 +148,9 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) c1 = (reg[(sum & 0x0c) >> 2] & 0x10) >> 4; } - col = c0 | (c1 << 1) | ((attrib & 0xc0) >> 4); + int col = c0 | (c1 << 1) | ((attrib & 0xc0) >> 4); if ((col & 0x07) != 0x07) - bitmap.pix16(sy, sx) = col | 0x20; + bitmap.pix(sy, sx) = col | 0x20; } } } @@ -170,20 +163,17 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) { - int sx, i, j; - - uint8_t* ROM = memregion("user2")->base(); - uint8_t* RAM = m_memory_devices.get() + 0x800; - uint8_t* TILE_ROM = memregion("gfx1")->base(); - uint8_t* TILE_RAM = m_memory_devices.get() + 0x1000; - uint8_t* PROM = memregion("proms")->base(); + uint8_t const *const ROM = memregion("user2")->base(); + uint8_t *const RAM = m_memory_devices.get() + 0x800; + uint8_t const *const TILE_ROM = memregion("gfx1")->base(); + uint8_t const *const TILE_RAM = m_memory_devices.get() + 0x1000; + uint8_t const *const PROM = memregion("proms")->base(); int preload = ((sy < 32) ? 1 : 0); uint8_t math_train[10] = { 0 }; uint8_t pre_train[3] = { 0 }; - uint8_t curr_state = 0; uint8_t prev_state = 0; uint8_t ram_count = 0; @@ -197,12 +187,9 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) m_v_count_river = (m_v_count_river + 1) & 0xff; /* ----- STATE MACHINE ----- */ - for (i = 0; i < 0x20; i++) + for (int i = 0; i < 0x20; i++) { - int rom_addr, ram_addr, ram_a5; - int mux45, mux61; - - curr_state = PROM[i]; + uint8_t curr_state = PROM[i]; /* Update Counters */ if (prev_state & 0x80) @@ -218,11 +205,11 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) if (prev_state & 0x10) hosc = (math_train[8] << 4) | math_train[9]; - rom_addr = m_slopeROM_bank | ((m_v_count_river & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); - ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; - ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); - mux45 = rom_count & 0x01; - mux61 = m_v_count_river & 0x01; + int rom_addr = m_slopeROM_bank | ((m_v_count_river & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); + int ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; + int ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); + int mux45 = rom_count & 0x01; + int mux61 = m_v_count_river & 0x01; switch (curr_state) { @@ -255,7 +242,7 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) /* Shift each item down the train */ if (curr_state & 0x02) { - for (j = 9; j > 0; j--) + for (int j = 9; j > 0; j--) { math_train[j] = math_train[j - 1]; } @@ -276,12 +263,9 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) int tile_h = (math_train[7] & 0x0f) | ((math_train[6] & 0x0f) << 4) | ((math_train[5] & 0x01) << 8); /* Burst of 16 10Mhz Clocks */ - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - int ram_addr, rom_addr; - int col; - - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (h_count > 0xff) { @@ -296,23 +280,21 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else col = (TILE_ROM[rom_addr] & 0xf0) >> 4; - bitmap.pix16(sy, sx) = col; + bitmap.pix(sy, sx) = col; } - for (sx = 16; sx < 256; sx++) + for (int sx = 16; sx < 256; sx++) { - int ram_addr, rom_addr; - int col; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (h_count > 0xff) { @@ -327,15 +309,16 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else col = (TILE_ROM[rom_addr] & 0xf0) >> 4; - bitmap.pix16(sy, sx) = col; + bitmap.pix(sy, sx) = col; } } } @@ -348,17 +331,15 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) { - int sx, i, j; - /* State machine */ - uint8_t* ROM = memregion("user2")->base(); - uint8_t* RAM = m_memory_devices.get() + 0x840 + 0x40 * tree_num; - uint8_t* PROM = memregion("proms")->base(); + uint8_t const *const ROM = memregion("user2")->base(); + uint8_t *const RAM = m_memory_devices.get() + 0x840 + 0x40 * tree_num; + uint8_t const *const PROM = memregion("proms")->base(); /* Tree Data */ - uint8_t* RAM2 = m_tree_ram.get() + 0x20 * tree_num; - uint8_t* TILE_ROM = (tree_num ? (memregion("user3")->base() + 0x1000) : (memregion("gfx1")->base() + 0x2000)); - uint8_t* TILE_RAM = (tree_num ? (memregion("user3")->base()) : (m_memory_devices.get() + 0x1800)); + uint8_t *const RAM2 = m_tree_ram.get() + 0x20 * tree_num; + uint8_t const *const TILE_ROM = (tree_num ? (memregion("user3")->base() + 0x1000) : (memregion("gfx1")->base() + 0x2000)); + uint8_t const *const TILE_RAM = (tree_num ? (memregion("user3")->base()) : (m_memory_devices.get() + 0x1800)); int preload = ((sy < 32) ? 1 : 0); @@ -366,7 +347,6 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) uint8_t pre_train[3] = { 0 }; uint8_t tree_train[3] = { 0 }; - uint8_t curr_state = 0; uint8_t prev_state = 0; uint8_t ram_count = 0; @@ -390,12 +370,9 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) m_v_count_tree = (m_v_count_tree + 1) & 0xff; /* ----- STATE MACHINE ----- */ - for (i = 0; i < 0x20; i++) + for (int i = 0; i < 0x20; i++) { - int rom_addr, ram_addr, ram_a5, ram2_addr; - int mux45, mux61; - - curr_state = PROM[i]; + uint8_t curr_state = PROM[i]; /* Update Counters */ if (prev_state & 0x80) @@ -414,12 +391,12 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) if (prev_state & 0x10) hosc = (math_train[8] << 4) | math_train[9]; - rom_addr = m_slopeROM_bank | ((m_v_count_tree & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); - ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; - ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); - ram2_addr = (ram_count << 1) | ((curr_state & 0x20) >> 5); - mux45 = rom_count & 0x01; - mux61 = m_v_count_tree & 0x01; + int rom_addr = m_slopeROM_bank | ((m_v_count_tree & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); + int ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; + int ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); + int ram2_addr = (ram_count << 1) | ((curr_state & 0x20) >> 5); + int mux45 = rom_count & 0x01; + int mux61 = m_v_count_tree & 0x01; switch(curr_state) { @@ -487,7 +464,7 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) /* Shift each item down the train */ if (curr_state & 0x02) { - for (j = 9; j > 0; j--) + for (int j = 9; j > 0; j--) math_train[j] = math_train[j-1]; } else @@ -507,11 +484,9 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 1; /* Burst of 16 10Mhz clocks */ - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - int ram_addr, rom_addr, col; - - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (h_count > 0xff) { @@ -526,14 +501,15 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); if (!(m_v_count_tree & 0x80) && (m_tree_en & (0x01 << tree_num)) && ((TILE_ROM[rom_addr] & 0xf0) == 0)) m_tree_on[tree_num] = 1; if (m_tree_on[tree_num]) { + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else @@ -543,15 +519,13 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 0; if (col != 0x0f && col != 0x00) - bitmap.pix16(sy, sx) = col | 0x30; + bitmap.pix(sy, sx) = col | 0x30; } } - for (sx = 16; sx < 256; sx++) + for (int sx = 16; sx < 256; sx++) { - int ram_addr, rom_addr, col; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (h_count > 0xff) { @@ -566,14 +540,15 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); if (!(m_v_count_tree & 0x80) && (m_tree_en & (0x01 << tree_num)) && ((TILE_ROM[rom_addr] & 0xf0) == 0)) m_tree_on[tree_num] = 1; if (m_tree_on[tree_num]) { + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else @@ -583,7 +558,7 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 0; if (col != 0x0f && col != 0x00) - bitmap.pix16(sy, sx) = col | 0x30; + bitmap.pix(sy, sx) = col | 0x30; } } @@ -644,7 +619,6 @@ e:|7 6 5 4 3 2 1 0 Hex|/RAMw /RAMr /ROM /AdderOutput AdderInput TrainInputs| TIMER_CALLBACK_MEMBER(changela_state::changela_scanline_callback) { int sy = param; - int sx; /* clear the current scanline first */ const rectangle rect(0, 255, sy, sy); @@ -659,32 +633,32 @@ TIMER_CALLBACK_MEMBER(changela_state::changela_scanline_callback) draw_tree(m_tree1_bitmap, sy, 1); /* Collision Detection */ - for (sx = 1; sx < 256; sx++) + for (int sx = 1; sx < 256; sx++) { - int riv_col, prev_col; - - if ((m_river_bitmap.pix16(sy, sx) == 0x08) - || (m_river_bitmap.pix16(sy, sx) == 0x09) - || (m_river_bitmap.pix16(sy, sx) == 0x0a)) + int riv_col; + if ((m_river_bitmap.pix(sy, sx) == 0x08) + || (m_river_bitmap.pix(sy, sx) == 0x09) + || (m_river_bitmap.pix(sy, sx) == 0x0a)) riv_col = 1; else riv_col = 0; - if ((m_river_bitmap.pix16(sy, sx-1) == 0x08) - || (m_river_bitmap.pix16(sy, sx-1) == 0x09) - || (m_river_bitmap.pix16(sy, sx-1) == 0x0a)) + int prev_col; + if ((m_river_bitmap.pix(sy, sx-1) == 0x08) + || (m_river_bitmap.pix(sy, sx-1) == 0x09) + || (m_river_bitmap.pix(sy, sx-1) == 0x0a)) prev_col = 1; else prev_col = 0; - if (m_obj0_bitmap.pix16(sy, sx) == 0x14) /* Car Outline Color */ + if (m_obj0_bitmap.pix(sy, sx) == 0x14) /* Car Outline Color */ { /* Tree 0 Collision */ - if (m_tree0_bitmap.pix16(sy, sx) != 0) + if (m_tree0_bitmap.pix(sy, sx) != 0) m_tree0_col = 1; /* Tree 1 Collision */ - if (m_tree1_bitmap.pix16(sy, sx) != 0) + if (m_tree1_bitmap.pix(sy, sx) != 0) m_tree1_col = 1; /* Hit Right Bank */ diff --git a/src/mame/video/channelf.cpp b/src/mame/video/channelf.cpp index c9d47bf65fd..9b8d254f79c 100644 --- a/src/mame/video/channelf.cpp +++ b/src/mame/video/channelf.cpp @@ -52,18 +52,16 @@ int channelf_state::recalc_palette_offset(int reg1, int reg2) uint32_t channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,col; - uint16_t ma=0,x; - int palette_offset; + uint16_t ma=0; - for(y = 0; y < 64; y++ ) + for (uint8_t y = 0; y < 64; y++ ) { - uint16_t *p = &bitmap.pix16(y); - palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); + uint16_t *p = &bitmap.pix(y); + int const palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); - for (x = ma; x < ma + 128; x++) + for (uint16_t x = ma; x < ma + 128; x++) { - col = palette_offset+(m_p_videoram[x|(y<<7)]&3); + uint8_t const col = palette_offset+(m_p_videoram[x|(y<<7)]&3); *p++ = colormap[col]; } ma+=128; diff --git a/src/mame/video/cheekyms.cpp b/src/mame/video/cheekyms.cpp index ffbb90db6aa..438084a922d 100644 --- a/src/mame/video/cheekyms.cpp +++ b/src/mame/video/cheekyms.cpp @@ -151,7 +151,6 @@ void cheekyms_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x; int scrolly = ((*m_port_80 >> 3) & 0x07); int flip = *m_port_80 & 0x80; @@ -168,9 +167,9 @@ uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm m_cm_tilemap->draw(screen, *m_bitmap_buffer, cliprect, 0, 0); /* draw the tilemap to the final bitmap applying the scroll to the man character */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int in_man_area; @@ -185,13 +184,13 @@ uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (in_man_area) { - if ((y + scrolly) < 27 * 8 && m_bitmap_buffer->pix16(y + scrolly, x) != 0) - bitmap.pix16(y, x) = m_bitmap_buffer->pix16(y + scrolly, x); + if ((y + scrolly) < 27 * 8 && m_bitmap_buffer->pix(y + scrolly, x) != 0) + bitmap.pix(y, x) = m_bitmap_buffer->pix(y + scrolly, x); } else { - if(m_bitmap_buffer->pix16(y, x) != 0) - bitmap.pix16(y, x) = m_bitmap_buffer->pix16(y, x); + if(m_bitmap_buffer->pix(y, x) != 0) + bitmap.pix(y, x) = m_bitmap_buffer->pix(y, x); } } } diff --git a/src/mame/video/circus.cpp b/src/mame/video/circus.cpp index e70aad8cb83..dfcfeb51ad5 100644 --- a/src/mame/video/circus.cpp +++ b/src/mame/video/circus.cpp @@ -54,35 +54,34 @@ void circus_state::draw_line( bitmap_ind16 &bitmap, const rectangle &cliprect, i if (x1 == x2) for (count = y2; count >= y1; count -= skip) - bitmap.pix16(count, x1) = 1; + bitmap.pix(count, x1) = 1; else for (count = x2; count >= x1; count -= skip) - bitmap.pix16(y1, count) = 1; + bitmap.pix(y1, count) = 1; } void circus_state::draw_sprite_collision( bitmap_ind16 &bitmap, const rectangle &cliprect ) { gfx_element *sprite_gfx = m_gfxdecode->gfx(1); const uint8_t *sprite_data = sprite_gfx->get_data(m_clown_z); - int sx, sy, dx, dy; - int pixel, collision = 0; + int collision = 0; // draw sprite and check collision on a pixel basis - for (sy = 0; sy < 16; sy++) + for (int sy = 0; sy < 16; sy++) { - dy = m_clown_x + sy-1; + int dy = m_clown_x + sy-1; if (dy>=0 && dy<bitmap.height()) { - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - dx = m_clown_y + sx; + int dx = m_clown_y + sx; if (dx>=0 && dx<bitmap.width()) { - pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; + int pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; if (pixel) { - collision |= bitmap.pix16(dy, dx); - bitmap.pix16(dy, dx) = m_palette->pen(pixel); + collision |= bitmap.pix(dy, dx); + bitmap.pix(dy, dx) = m_palette->pen(pixel); } } } diff --git a/src/mame/video/cloak.cpp b/src/mame/video/cloak.cpp index 92208ef7ac4..24dd7a086de 100644 --- a/src/mame/video/cloak.cpp +++ b/src/mame/video/cloak.cpp @@ -178,15 +178,13 @@ void cloak_state::video_start() void cloak_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - pen_t pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; + pen_t const pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; if (pen) - bitmap.pix16(y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen; + bitmap.pix(y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen; } } diff --git a/src/mame/video/cloud9.cpp b/src/mame/video/cloud9.cpp index c3debb52445..bb9cb18ae98 100644 --- a/src/mame/video/cloud9.cpp +++ b/src/mame/video/cloud9.cpp @@ -223,22 +223,21 @@ void cloud9_state::cloud9_bitmode_addr_w(offs_t offset, uint8_t data) uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteaddr = m_spriteram; - int flip = m_videolatch->q5_r() ? 0xff : 0x00; /* PLAYER2 */ - pen_t black = m_palette->black_pen(); - int x, y, offs; + uint8_t const *const spriteaddr = m_spriteram; + int const flip = m_videolatch->q5_r() ? 0xff : 0x00; /* PLAYER2 */ + pen_t const black = m_palette->black_pen(); /* draw the sprites */ m_spritebitmap.fill(0x00, cliprect); - for (offs = 0; offs < 0x20; offs++) + for (int offs = 0; offs < 0x20; offs++) if (spriteaddr[offs + 0x00] != 0) { - int x = spriteaddr[offs + 0x60]; - int y = 256 - 15 - spriteaddr[offs + 0x00]; - int xflip = spriteaddr[offs + 0x40] & 0x80; - int yflip = spriteaddr[offs + 0x40] & 0x40; - int which = spriteaddr[offs + 0x20]; - int color = 0; + int const x = spriteaddr[offs + 0x60]; + int const y = 256 - 15 - spriteaddr[offs + 0x00]; + int const xflip = spriteaddr[offs + 0x40] & 0x80; + int const yflip = spriteaddr[offs + 0x40] & 0x40; + int const which = spriteaddr[offs + 0x20]; + int const color = 0; m_gfxdecode->gfx(0)->transpen(m_spritebitmap,cliprect, which, color, xflip, yflip, x, y, 0); if (x >= 256 - 16) @@ -246,30 +245,28 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* if we're in the VBLANK region, just fill with black */ if (~m_syncprom[y] & 2) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } /* non-VBLANK region: merge the sprites and the bitmap */ else { - uint16_t *mosrc = &m_spritebitmap.pix16(y); - int effy = y ^ flip; - uint8_t *src[2]; + uint16_t const *const mosrc = &m_spritebitmap.pix(y); + int const effy = y ^ flip; /* two videoram arrays */ - src[0] = &m_videoram[0x4000 | (effy * 64)]; - src[1] = &m_videoram[0x0000 | (effy * 64)]; + uint8_t const *const src[2]{ &m_videoram[0x4000 | (effy * 64)], &m_videoram[0x0000 | (effy * 64)] }; /* loop over X */ - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) @@ -278,11 +275,11 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 /* otherwise, process normally */ else { - int effx = x ^ flip; + int const effx = x ^ flip; /* low 4 bits = left pixel, high 4 bits = right pixel */ uint8_t pix = (src[(effx >> 1) & 1][effx / 4] >> ((~effx & 1) * 4)) & 0x0f; - uint8_t mopix = mosrc[x]; + uint8_t const mopix = mosrc[x]; /* sprites have priority if sprite pixel != 0 or some other condition */ if (mopix != 0) diff --git a/src/mame/video/copsnrob.cpp b/src/mame/video/copsnrob.cpp index 109f13fcf9b..5ea31ff2c68 100644 --- a/src/mame/video/copsnrob.cpp +++ b/src/mame/video/copsnrob.cpp @@ -12,16 +12,12 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs, x, y; - /* redrawing the entire display is faster in this case */ - for (offs = m_videoram.bytes(); offs >= 0; offs--) + for (int offs = m_videoram.bytes(); offs >= 0; offs--) { - int sx,sy; - - sx = 31 - (offs % 32); - sy = offs / 32; + int const sx = 31 - (offs % 32); + int const sy = offs / 32; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[offs] & 0x3f,0, @@ -66,7 +62,7 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in care of the problem of displaying multiple beer trucks and of scrolling truck images smoothly off the top of the screen. */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { /* y is going up the screen, but the truck window RAM locations go down the screen. */ @@ -104,27 +100,25 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in They are flickered on/off every frame by the software, so don't play it with frameskip 1 or 3, as they could become invisible */ - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { - int bullet, mask1, mask2, val; - - val = m_bulletsram[x]; + int const val = m_bulletsram[x]; // Check for the most common case if (!(val & 0x0f)) continue; - mask1 = 0x01; - mask2 = 0x10; + int mask1 = 0x01; + int mask2 = 0x10; // Check each bullet - for (bullet = 0; bullet < 4; bullet++) + for (int bullet = 0; bullet < 4; bullet++) { if (val & mask1) { - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) if (m_bulletsram[y] & mask2) - bitmap.pix16(y, 256 - x) = 1; + bitmap.pix(y, 256 - x) = 1; } mask1 <<= 1; diff --git a/src/mame/video/cosmic.cpp b/src/mame/video/cosmic.cpp index f8fa7e1f4e5..12a9f6c6673 100644 --- a/src/mame/video/cosmic.cpp +++ b/src/mame/video/cosmic.cpp @@ -227,9 +227,9 @@ void cosmic_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect if (data & 0x80) { if (flip_screen()) - bitmap.pix16(255-y, 255-x) = pen; + bitmap.pix(255-y, 255-x) = pen; else - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } x++; @@ -308,7 +308,7 @@ void cosmic_state::cosmica_draw_starfield( screen_device &screen, bitmap_ind16 & /* RGB order is reversed -- bit 7=R, 6=G, 5=B */ int col = (map >> 7) | ((map >> 5) & 0x02) | ((map >> 3) & 0x04); - bitmap.pix16(y, x) = col; + bitmap.pix(y, x) = col; } x++; @@ -323,23 +323,20 @@ void cosmic_state::cosmica_draw_starfield( screen_device &screen, bitmap_ind16 & void cosmic_state::devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint8_t y; - uint8_t *horz_PROM = memregion("user2")->base(); - uint8_t *vert_PROM = memregion("user3")->base(); + uint8_t const *const horz_PROM = memregion("user2")->base(); + uint8_t const *const vert_PROM = memregion("user3")->base(); offs_t horz_addr = 0; uint8_t count = 0; uint8_t horz_data = 0; uint8_t vert_data; - for (y = 32; y < 224; y++) + for (int y = 32; y < 224; y++) { uint8_t x = 0; while (1) { - int x1; - /* for the vertical lines, each bit indicates if there should be a line at the x position */ vert_data = vert_PROM[x >> 3]; @@ -356,15 +353,15 @@ void cosmic_state::devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cli if (count == 0) horz_data = horz_PROM[horz_addr++]; - for (x1 = 0; x1 < 8; x1++) + for (int x1 = 0; x1 < 8; x1++) { if (!(vert_data & horz_data & 0x80)) /* NAND gate */ { /* blue */ if (flip_screen()) - bitmap.pix16(255-y, 255-x) = 4; + bitmap.pix(255-y, 255-x) = 4; else - bitmap.pix16(y, x) = 4; + bitmap.pix(y, x) = 4; } horz_data = (horz_data << 1) | 0x01; @@ -481,9 +478,9 @@ void cosmic_state::nomnlnd_draw_background( screen_device &screen, bitmap_ind16 if (color != 0) { if (flip_screen()) - bitmap.pix16(255-y, 255-x) = color; + bitmap.pix(255-y, 255-x) = color; else - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } x++; diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp index 16191c7f57e..1670851c092 100644 --- a/src/mame/video/cps1.cpp +++ b/src/mame/video/cps1.cpp @@ -3145,8 +3145,7 @@ void cps2_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitma void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - uint8_t *stars_rom = m_region_stars->base(); + uint8_t const *const stars_rom = m_region_stars->base(); if (!stars_rom && (m_stars_enabled[0] || m_stars_enabled[1])) { @@ -3158,7 +3157,7 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, if (m_stars_enabled[0]) { - for (offs = 0; offs < m_stars_rom_size / 2; offs++) + for (int offs = 0; offs < m_stars_rom_size / 2; offs++) { int col = stars_rom[8 * offs + 4]; if (col != 0x0f) @@ -3176,14 +3175,14 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0xa00 + col; + bitmap.pix(sy, sx) = 0xa00 + col; } } } if (m_stars_enabled[1]) { - for (offs = 0; offs < m_stars_rom_size / 2; offs++) + for (int offs = 0; offs < m_stars_rom_size / 2; offs++) { int col = stars_rom[8*offs]; if (col != 0x0f) @@ -3201,7 +3200,7 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0x800 + col; + bitmap.pix(sy, sx) = 0x800 + col; } } } diff --git a/src/mame/video/crbaloon.cpp b/src/mame/video/crbaloon.cpp index 2de79bf7b2f..d1da8d7cc97 100644 --- a/src/mame/video/crbaloon.cpp +++ b/src/mame/video/crbaloon.cpp @@ -118,12 +118,12 @@ void crbaloon_state::draw_sprite_and_check_collision(bitmap_ind16 &bitmap) /* draw the current pixel, but check collision first */ if (bit) { - if (bitmap.pix16(sy, sx) & 0x01) + if (bitmap.pix(sy, sx) & 0x01) /* compute the collision address -- the +1 is via observation of the game code, probably wrong for cocktail mode */ m_collision_address = ((((sy ^ 0xff) >> 3) << 5) | ((sx ^ 0xff) >> 3)) + 1; - bitmap.pix16(sy, sx) = (color << 1) | 1; + bitmap.pix(sy, sx) = (color << 1) | 1; } sx = sx + 1; diff --git a/src/mame/video/crgolf.cpp b/src/mame/video/crgolf.cpp index a12e514fc68..43d5bb8802f 100644 --- a/src/mame/video/crgolf.cpp +++ b/src/mame/video/crgolf.cpp @@ -68,13 +68,9 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 { int flip = m_screen_flip; - offs_t offs; - /* for each byte in the video RAM */ - for (offs = 0; offs < VIDEORAM_SIZE / 3; offs++) + for (offs_t offs = 0; offs < VIDEORAM_SIZE / 3; offs++) { - int i; - uint8_t y = (offs & 0x1fe0) >> 5; uint8_t x = (offs & 0x001f) << 3; @@ -92,7 +88,7 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 } /* for each pixel in the byte */ - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { offs_t color; uint8_t data_b = 0; @@ -114,7 +110,7 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 if (m_color_select) color = color | 0x10; - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; /* next pixel */ data_a0 = data_a0 << 1; diff --git a/src/mame/video/crt.cpp b/src/mame/video/crt.cpp index 68af26f59ba..d8ee79d1bde 100644 --- a/src/mame/video/crt.cpp +++ b/src/mame/video/crt.cpp @@ -134,19 +134,16 @@ void crt_device::eof() // void crt_device::update(bitmap_ind16 &bitmap) { - int i, p_i; - int y; - //if (m_decay_counter) { /* some time has elapsed: let's update the screen */ - for (y=0; y<m_window_height; y++) + for (int y=0; y<m_window_height; y++) { - uint16_t *line = &bitmap.pix16(y+m_window_offset_y); + uint16_t *const line = &bitmap.pix(y+m_window_offset_y); - p_i = -1; + int p_i = -1; - for (i=m_list_head[y]; (i != -1); i=m_list[i].next) + for (int i=m_list_head[y]; (i != -1); i=m_list[i].next) { crt_point *node = &m_list[i]; int x = (i % m_window_width) + m_window_offset_x; diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp index 243ebd384de..a8327bde897 100644 --- a/src/mame/video/cvs.cpp +++ b/src/mame/video/cvs.cpp @@ -135,13 +135,12 @@ VIDEO_START_MEMBER(cvs_state,cvs) uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 }; - offs_t offs; int scroll[8]; set_pens(); /* draw the background */ - for (offs = 0; offs < 0x0400; offs++) + for (offs_t offs = 0; offs < 0x0400; offs++) { int collision_color = 0x100; uint8_t code = m_video_ram[offs]; @@ -194,63 +193,56 @@ uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitma bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect); /* Bullet Hardware */ - for (offs = 8; offs < 256; offs++ ) + for (offs_t offs = 8; offs < 256; offs++ ) { if (m_bullet_ram[offs] != 0) { - int ct; - for (ct = 0; ct < 4; ct++) + for (int ct = 0; ct < 4; ct++) { int bx = 255 - 7 - m_bullet_ram[offs] - ct; /* Bullet/Object Collision */ - if ((s2636_0_bitmap.pix16(offs, bx) != 0) || - (s2636_1_bitmap.pix16(offs, bx) != 0) || - (s2636_2_bitmap.pix16(offs, bx) != 0)) + if ((s2636_0_bitmap.pix(offs, bx) != 0) || + (s2636_1_bitmap.pix(offs, bx) != 0) || + (s2636_2_bitmap.pix(offs, bx) != 0)) m_collision_register |= 0x08; /* Bullet/Background Collision */ - if (m_palette->pen_indirect(m_scrolled_collision_background.pix16(offs, bx))) + if (m_palette->pen_indirect(m_scrolled_collision_background.pix(offs, bx))) m_collision_register |= 0x80; - bitmap.pix16(offs, bx) = BULLET_STAR_PEN; + bitmap.pix(offs, bx) = BULLET_STAR_PEN; } } } /* mix and copy the S2636 images into the main bitmap, also check for collision */ + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - int y; - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - int x; + int pixel0 = s2636_0_bitmap.pix(y, x); + int pixel1 = s2636_1_bitmap.pix(y, x); + int pixel2 = s2636_2_bitmap.pix(y, x); + + int pixel = pixel0 | pixel1 | pixel2; - for (x = cliprect.left(); x <= cliprect.right(); x++) + if (S2636_IS_PIXEL_DRAWN(pixel)) { - int pixel0 = s2636_0_bitmap.pix16(y, x); - int pixel1 = s2636_1_bitmap.pix16(y, x); - int pixel2 = s2636_2_bitmap.pix16(y, x); + bitmap.pix(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel); - int pixel = pixel0 | pixel1 | pixel2; + /* S2636 vs. S2636 collision detection */ + if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01; + if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; + if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04; - if (S2636_IS_PIXEL_DRAWN(pixel)) + /* S2636 vs. background collision detection */ + if (m_palette->pen_indirect(m_scrolled_collision_background.pix(y, x))) { - bitmap.pix16(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel); - - /* S2636 vs. S2636 collision detection */ - if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01; - if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; - if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04; - - /* S2636 vs. background collision detection */ - if (m_palette->pen_indirect(m_scrolled_collision_background.pix16(y, x))) - { - if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; - if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20; - if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; - } + if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; + if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20; + if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; } } } @@ -275,21 +267,18 @@ void cvs_state::cvs_scroll_stars( ) void cvs_state::cvs_init_stars( ) { int generator = 0; - int x, y; /* precalculate the star background */ m_total_stars = 0; - for (y = 255; y >= 0; y--) + for (int y = 255; y >= 0; y--) { - for (x = 511; x >= 0; x--) + for (int x = 511; x >= 0; x--) { - int bit1, bit2; - generator <<= 1; - bit1 = (~generator >> 17) & 1; - bit2 = (generator >> 5) & 1; + int const bit1 = (~generator >> 17) & 1; + int const bit2 = (generator >> 5) & 1; if (bit1 ^ bit2) generator |= 1; @@ -328,8 +317,8 @@ void cvs_state::cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect y = ~y; if ((y >= cliprect.top()) && (y <= cliprect.bottom()) && - (update_always || (m_palette->pen_indirect(bitmap.pix16(y, x)) == 0))) - bitmap.pix16(y, x) = star_pen; + (update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0))) + bitmap.pix(y, x) = star_pen; } } } diff --git a/src/mame/video/cyberbal.cpp b/src/mame/video/cyberbal.cpp index 053cde7ae86..1f5cb34f233 100644 --- a/src/mame/video/cyberbal.cpp +++ b/src/mame/video/cyberbal.cpp @@ -233,13 +233,12 @@ uint32_t cyberbal_base_state::update_one_screen(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = curmob.first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not verified: logic is all controlled in a PAL - */ + // not verified: logic is all controlled in a PAL pf[x] = mo[x]; } } diff --git a/src/mame/video/cybstorm.cpp b/src/mame/video/cybstorm.cpp index 70c071be563..b27c73824c8 100644 --- a/src/mame/video/cybstorm.cpp +++ b/src/mame/video/cybstorm.cpp @@ -131,13 +131,13 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x]) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -149,7 +149,7 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* foreground playfield case */ if (pri[x] & 0x80) { - int pfpriority = (pri[x] >> 2) & 3; + int const pfpriority = (pri[x] >> 2) & 3; if (mopriority > pfpriority) pf[x] = (mo[x] & atari_motion_objects_device::DATA_MASK) | 0x1000; @@ -158,7 +158,7 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* background playfield case */ else { - int pfpriority = pri[x] & 3; + int const pfpriority = pri[x] & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -177,8 +177,8 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); int count = 0; for (int x = rect->left(); x <= rect->right() || (count && x < bitmap.width()); x++) { diff --git a/src/mame/video/dai.cpp b/src/mame/video/dai.cpp index 13891a8cda9..a5c7488b12a 100644 --- a/src/mame/video/dai.cpp +++ b/src/mame/video/dai.cpp @@ -50,12 +50,11 @@ void dai_state::dai_palette(palette_device &palette) const uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space &space = m_maincpu->space(AS_PROGRAM); - int i, j, k, l; - uint8_t* char_rom = memregion("chargen")->base(); + uint8_t const *const char_rom = memregion("chargen")->base(); - uint16_t dai_video_memory_start = 0xbfff; - uint16_t dai_scan_lines = 604; /* scan lines of PAL tv */ + uint16_t const dai_video_memory_start = 0xbfff; + uint16_t const dai_scan_lines = 604; /* scan lines of PAL tv */ uint16_t current_scan_line = 0; uint16_t current_video_memory_address = dai_video_memory_start; @@ -85,12 +84,8 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c 01 - four colour characters 10 - sixteen colour graphics 11 - sixteen colour characters */ - uint8_t unit_mode; - uint8_t current_data_1, current_data_2; - uint8_t current_colour; - while (current_scan_line < dai_scan_lines) { mode = space.read_byte(current_video_memory_address--); @@ -98,7 +93,7 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c line_repeat_count = mode & 0x0f; horizontal_resolution = (mode & 0x30) >> 4; display_mode = (mode & 0xc0) >> 6; - unit_mode = (colour & 0x40) >> 6; + uint8_t const unit_mode = (colour & 0x40) >> 6; if (colour & 0x80) m_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f; @@ -115,32 +110,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -154,32 +149,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -193,31 +188,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -231,31 +226,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -275,33 +270,33 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -316,33 +311,33 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -357,32 +352,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -396,32 +391,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -440,32 +435,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -479,32 +474,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -518,31 +513,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -556,31 +551,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -598,32 +593,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -637,32 +632,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -676,31 +671,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -713,31 +708,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } diff --git a/src/mame/video/darkmist.cpp b/src/mame/video/darkmist.cpp index 9cc0bbd7d45..4a213bf967d 100644 --- a/src/mame/video/darkmist.cpp +++ b/src/mame/video/darkmist.cpp @@ -103,12 +103,12 @@ void darkmist_state::mix_layer(screen_device &screen, bitmap_ind16 &bitmap, cons { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_temp_bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &m_temp_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t pix = (src[x] & 0xff); - uint16_t real = clut[pix]; + uint16_t const pix = (src[x] & 0xff); + uint16_t const real = clut[pix]; if (!(real & 0x40)) dest[x] = src[x]; diff --git a/src/mame/video/dassault.cpp b/src/mame/video/dassault.cpp index 5d8c4accad8..77e887cea3b 100644 --- a/src/mame/video/dassault.cpp +++ b/src/mame/video/dassault.cpp @@ -31,25 +31,21 @@ void dassault_state::video_start() void dassault_state::mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite_bitmap, const rectangle &cliprect, uint16_t pri, uint16_t primask, uint16_t penbase, uint8_t alpha) { - int y, x; - const pen_t *paldata = &m_palette->pen(0); + pen_t const *const paldata = &m_palette->pen(0); - uint16_t* srcline; - uint32_t* dstline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top(); y<=cliprect.bottom(); y++) { - srcline=&sprite_bitmap->pix16(y,0); - dstline=&bitmap.pix32(y,0); + uint16_t const *const srcline = &sprite_bitmap->pix(y, 0); + uint32_t *const dstline = &bitmap.pix(y, 0); - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left(); x<=cliprect.right(); x++) { uint16_t pix = srcline[x]; if ((pix & primask) != pri) continue; - if (pix&0xf) + if (pix & 0xf) { uint16_t pen = pix&0x1ff; if (pix & 0x800) pen += 0x200; diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp index 02f530d70d1..2f50d3877a3 100644 --- a/src/mame/video/dcheese.cpp +++ b/src/mame/video/dcheese.cpp @@ -6,10 +6,11 @@ **************************************************************************/ - #include "emu.h" #include "includes/dcheese.h" +#include <algorithm> + /************************************* * @@ -116,8 +117,8 @@ u32 dcheese_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co /* update the pixels */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); - u16 *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) & 0x1ff); + u16 *const dest = &bitmap.pix(y); + u16 const *const src = &m_dstbitmap->pix((y + m_blitter_vidparam[0x28/2]) & 0x1ff); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = src[x]; @@ -137,7 +138,7 @@ void dcheese_state::do_clear() { /* clear the requested scanlines */ for (int y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++) - memset(&m_dstbitmap->pix16(y & 0x1ff), 0, DSTBITMAP_WIDTH * 2); + std::fill_n(&m_dstbitmap->pix(y & 0x1ff), DSTBITMAP_WIDTH, 0); /* signal an IRQ when done (timing is just a guess) */ m_signal_irq_timer->adjust(m_screen->scan_period(), 1); @@ -168,7 +169,7 @@ void dcheese_state::do_blit() /* loop over target rows */ for (int y = ystart; y <= yend; y++) { - u16 *dst = &m_dstbitmap->pix16(y & 0x1ff); + u16 *const dst = &m_dstbitmap->pix(y & 0x1ff); /* loop over target columns */ for (int x = xstart; x <= xend; x++) diff --git a/src/mame/video/dday.cpp b/src/mame/video/dday.cpp index b18a56db2bd..71b6c51297d 100644 --- a/src/mame/video/dday.cpp +++ b/src/mame/video/dday.cpp @@ -302,19 +302,17 @@ uint32_t dday_state::screen_update_dday(screen_device &screen, bitmap_ind16 &bit if (m_sl_enable) { /* apply shadow */ - int x, y; - bitmap_ind16 &sl_bitmap = m_sl_tilemap->pixmap(); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t src_pixel = m_main_bitmap.pix16(y, x); + uint16_t src_pixel = m_main_bitmap.pix(y, x); - if (sl_bitmap.pix16(y, x) == 0xff) + if (sl_bitmap.pix(y, x) == 0xff) src_pixel += m_palette->entries(); - bitmap.pix16(y, x) = src_pixel; + bitmap.pix(y, x) = src_pixel; } } else diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp index ed80c87ec33..a4ed651c7b8 100644 --- a/src/mame/video/decbac06.cpp +++ b/src/mame/video/decbac06.cpp @@ -316,8 +316,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, src_y += cliprect.top(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *dstpix = &bitmap.pix16(y); - u8 *dstpri = &primap.pix8(y); + u16 *dstpix = &bitmap.pix(y); + u8 *dstpri = &primap.pix(y); if (row_scroll_enabled) src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3] & 0xf)) & (0x1ff >> (control1[3] & 0xf))]; else @@ -332,8 +332,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, if (col_scroll_enabled) column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2] & 0xf)) & (0x3f >> (control1[2] & 0xf))]; - const u16 p = src_bitmap.pix16((src_y + column_offset) & height_mask, src_x & width_mask); - const u8 colpri = flags_bitmap.pix8((src_y + column_offset) & height_mask, src_x & width_mask); + const u16 p = src_bitmap.pix((src_y + column_offset) & height_mask, src_x & width_mask); + const u8 colpri = flags_bitmap.pix((src_y + column_offset) & height_mask, src_x & width_mask); const bool is_drawn = ((flags & TILEMAP_DRAW_OPAQUE) || ((colpri & TILEMAP_PIXEL_LAYER0) && (flags & TILEMAP_DRAW_LAYER0)) || diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index 497ccc1bb37..39564a86c9d 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -494,21 +494,21 @@ void deco16ic_device::custom_tilemap_draw( else column_offset = 0; - u16 p = src_bitmap0->pix16((src_y + column_offset) & height_mask, src_x); - u8 f = src_flagsmap0->pix8((src_y + column_offset) & height_mask, src_x); + u16 p = src_bitmap0->pix((src_y + column_offset) & height_mask, src_x); + u8 f = src_flagsmap0->pix((src_y + column_offset) & height_mask, src_x); if (src_bitmap1) { - f |= src_flagsmap1->pix8((src_y + column_offset) & height_mask, src_x) & ~TILEMAP_DRAW_CATEGORY_MASK; + f |= src_flagsmap1->pix((src_y + column_offset) & height_mask, src_x) & ~TILEMAP_DRAW_CATEGORY_MASK; if (!m_mix_cb.isnull()) { - const u16 p2 = src_bitmap1->pix16((src_y + column_offset) & height_mask, src_x); + const u16 p2 = src_bitmap1->pix((src_y + column_offset) & height_mask, src_x); p = m_mix_cb(p, p2); } else { // does boogie wings actually use this, or is the tattoo assassin code correct in this mode? - p |= (src_bitmap1->pix16((src_y + column_offset) & height_mask, src_x) & combine_mask) << combine_shift; + p |= (src_bitmap1->pix((src_y + column_offset) & height_mask, src_x) & combine_mask) << combine_shift; } } src_x = (src_x + 1) & width_mask; @@ -525,7 +525,7 @@ void deco16ic_device::custom_tilemap_draw( else dest[x] = m_gfxdecode->palette().pen(p); if (screen.priority().valid()) { - u8 *pri = &screen.priority().pix8(y); + u8 *const pri = &screen.priority().pix(y); pri[x] = (pri[x] & pmask) | priority; } } diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index afc17a93a69..6a225cc1c42 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -261,11 +261,11 @@ void nslasher_state::mix_nslasher(screen_device &screen, bitmap_rgb32 &bitmap, c /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); - const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); - const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); - const u8* tilemapPri = &screen.priority().pix8(y); - u32* destLine = &bitmap.pix32(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix(y); + const u8* tilemapPri = &screen.priority().pix(y); + u32* destLine = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -465,11 +465,11 @@ void nslasher_state::mix_tattass(screen_device &screen, bitmap_rgb32 &bitmap, co /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); - const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); - const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); - const u8* tilemapPri = &screen.priority().pix8(y); - u32* destLine = &bitmap.pix32(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix(y); + const u8* tilemapPri = &screen.priority().pix(y); + u32* destLine = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/deco_mlc.cpp b/src/mame/video/deco_mlc.cpp index 40631a9622a..9c92baf65ef 100644 --- a/src/mame/video/deco_mlc.cpp +++ b/src/mame/video/deco_mlc.cpp @@ -546,8 +546,8 @@ u32 deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c for (int i = cliprect.top(); i <= cliprect.bottom(); i++) { - u32 *dest = &bitmap.pix32(i); - u8 *pri = &screen.priority().pix8(i); + u32 *dest = &bitmap.pix(i); + u8 *pri = &screen.priority().pix(i); /* printf("%d -", i); diff --git a/src/mame/video/deco_zoomspr.cpp b/src/mame/video/deco_zoomspr.cpp index 3413231f01d..e7c0871d883 100644 --- a/src/mame/video/deco_zoomspr.cpp +++ b/src/mame/video/deco_zoomspr.cpp @@ -119,21 +119,20 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( if( ex>sx ) { /* skip if inner loop doesn't draw anything */ - int y; /* case 1: no alpha */ if (alpha == 0xff) { { - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &temp_bitmap.pix32(y); - uint8_t *pri = &pri_bitmap.pix8(y); + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &temp_bitmap.pix(y); + uint8_t *const pri = &pri_bitmap.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if (c != transparent_color) @@ -161,16 +160,16 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( else { { - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &temp_bitmap.pix32(y); - uint8_t *pri = &pri_bitmap.pix8(y); - uint32_t *tmapcolor = &dest_bmp.pix32(y); + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &temp_bitmap.pix(y); + uint8_t *const pri = &pri_bitmap.pix(y); + uint32_t *const tmapcolor = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if (c != transparent_color) @@ -399,12 +398,12 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *src = &temp_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y); + uint32_t const *const src = &temp_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint32_t srcpix = src[x]; + uint32_t const srcpix = src[x]; if ((srcpix & 0xff000000) == 0xff000000) { diff --git a/src/mame/video/decocass.cpp b/src/mame/video/decocass.cpp index 5cbc3d5e104..a9b0e6ea8ae 100644 --- a/src/mame/video/decocass.cpp +++ b/src/mame/video/decocass.cpp @@ -279,13 +279,13 @@ void decocass_state::draw_special_priority(bitmap_ind16 &bitmap, bitmap_ind8 &pr (dy >= 0 && dy < 64 && dx >= 0 && dx < 64 && objdata1[dy * 64 + dx] != 0)) { pri2 = true; - if (BIT(m_mode_set, 5) && priority.pix8(y, x) == 0) // least priority? - bitmap.pix16(y, x) = color; + if (BIT(m_mode_set, 5) && priority.pix(y, x) == 0) // least priority? + bitmap.pix(y, x) = color; } } if (!pri2) - bitmap.pix16(y, x) |= 0x10; + bitmap.pix(y, x) |= 0x10; } } } @@ -313,7 +313,7 @@ void decocass_state::draw_center(bitmap_ind16 &bitmap, const rectangle &cliprect if (((sy + y) & m_color_center_bot & 3) == (sy & m_color_center_bot & 3)) for (x = 0; x < 256; x++) if (0 != (x & 16) || 0 != (m_center_h_shift_space & 1)) - bitmap.pix16(sy + y, (sx + x) & 255) = color; + bitmap.pix(sy + y, (sx + x) & 255) = color; } } @@ -572,16 +572,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, int missile_y_adjust, int missile_y_adjust_flip_screen, uint8_t *missile_ram, int interleave) { - int i, offs, x; - /* Draw the missiles (16 of them) seemingly with alternating colors * from the E302 latch (color_missiles) */ - for (i = 0, offs = 0; i < 8; i++, offs += 4 * interleave) + for (int i = 0, offs = 0; i < 8; i++, offs += 4 * interleave) { - int sx, sy; - - sy = 255 - missile_ram[offs + 0 * interleave]; - sx = 255 - missile_ram[offs + 2 * interleave]; + int sy = 255 - missile_ram[offs + 0 * interleave]; + int sx = 255 - missile_ram[offs + 2 * interleave]; if (flip_screen()) { sx = 240 - sx; @@ -589,12 +585,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, } sy -= missile_y_adjust; if (sy >= cliprect.top() && sy <= cliprect.bottom()) - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { if (sx >= cliprect.left() && sx <= cliprect.right()) { - bitmap.pix16(sy, sx) = (m_color_missiles & 7) | 8; - priority.pix8(sy, sx) |= 1 << 2; + bitmap.pix(sy, sx) = (m_color_missiles & 7) | 8; + priority.pix(sy, sx) |= 1 << 2; } sx++; } @@ -608,12 +604,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, } sy -= missile_y_adjust; if (sy >= cliprect.top() && sy <= cliprect.bottom()) - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { if (sx >= cliprect.left() && sx <= cliprect.right()) { - bitmap.pix16(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; - priority.pix8(sy, sx) |= 1 << 3; + bitmap.pix(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; + priority.pix(sy, sx) |= 1 << 3; } sx++; } @@ -657,19 +653,17 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, srcbitmap = &m_bg_tilemap_r->pixmap(); } - int y,x; - // printf("m_mode_set %d\n", m_mode_set & 0x3); // technically our y drawing probably shouldn't wrap / mask, but simply draw the 128pixel high 'edge' at the requested position // see note above this funciton - for (y=clip.top(); y<=clip.bottom(); y++) + for (int y=clip.top(); y<=clip.bottom(); y++) { int srcline = (y + scrolly) & 0x1ff; - uint16_t* src = &srcbitmap->pix16(srcline); - uint16_t* dst = &bitmap.pix16(y); + uint16_t const *const src = &srcbitmap->pix(srcline); + uint16_t *const dst = &bitmap.pix(y); - for (x=clip.left(); x<=clip.right(); x++) + for (int x=clip.left(); x<=clip.right(); x++) { int srccol = 0; @@ -683,7 +677,7 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, case 0x03: srccol = (x + scrollx) & 0x1ff; break; // hwy, burnrub etc. } - uint16_t pix = src[srccol]; + uint16_t const pix = src[srccol]; if ((pix & 0x3) || opaque) dst[x] = pix; diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp index 4d6f61a3238..6450af9e97d 100644 --- a/src/mame/video/decodmd1.cpp +++ b/src/mame/video/decodmd1.cpp @@ -261,37 +261,35 @@ void decodmd_type1_device::device_reset() uint32_t decodmd_type1_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { uint8_t ptr = 0; - uint8_t x,y,dot; - uint32_t data1,data2,data3,data4; - uint32_t col; if(m_frameswap) ptr = 0x80; - for(y=0;y<16;y++) // scanline + for(uint8_t y=0;y<16;y++) // scanline { - for(x=0;x<128;x+=64) + for(uint8_t x=0;x<128;x+=64) { - data1 = m_pixels[ptr]; - data2 = m_pixels[ptr+1]; - data3 = m_pixels[ptr+2]; - data4 = m_pixels[ptr+3]; - for(dot=0;dot<64;dot+=2) + uint32_t data1 = m_pixels[ptr]; + uint32_t data2 = m_pixels[ptr+1]; + uint32_t data3 = m_pixels[ptr+2]; + uint32_t data4 = m_pixels[ptr+3]; + for(uint8_t dot=0;dot<64;dot+=2) { + uint32_t col; if((data1 & 0x01) != (data3 & 0x01)) col = rgb_t(0x7f,0x55,0x00); else if (data1 & 0x01) // both are the same, so either high intensity or none at all col = rgb_t(0xff,0xaa,0x00); else col = rgb_t::black(); - bitmap.pix32(y,x+dot) = col; + bitmap.pix(y,x+dot) = col; if((data2 & 0x01) != (data4 & 0x01)) col = rgb_t(0x7f,0x55,0x00); else if (data2 & 0x01) // both are the same, so either high intensity or none at all col = rgb_t(0xff,0xaa,0x00); else col = rgb_t::black(); - bitmap.pix32(y,x+dot+1) = col; + bitmap.pix(y,x+dot+1) = col; data1 >>= 1; data2 >>= 1; data3 >>= 1; diff --git a/src/mame/video/decodmd2.cpp b/src/mame/video/decodmd2.cpp index 2bb975e2f61..81b3cad15ec 100644 --- a/src/mame/video/decodmd2.cpp +++ b/src/mame/video/decodmd2.cpp @@ -102,16 +102,15 @@ TIMER_DEVICE_CALLBACK_MEMBER(decodmd_type2_device::dmd_firq) MC6845_UPDATE_ROW( decodmd_type2_device::crtc_update_row ) { - uint8_t *RAM = m_ram->pointer(); - uint8_t intensity; + uint8_t const *const RAM = m_ram->pointer(); uint16_t addr = (ma & 0xfc00) + ((ma & 0x100)<<2) + (ra << 4); for (int x = 0; x < 128; x += 8) { for (int dot = 0; dot < 8; dot++) { - intensity = ((RAM[addr] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x200] >> (7-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + uint8_t intensity = ((RAM[addr] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x200] >> (7-dot) & 0x01); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } addr++; } diff --git a/src/mame/video/decodmd3.cpp b/src/mame/video/decodmd3.cpp index 34d26f5bde4..6a7a2a94902 100644 --- a/src/mame/video/decodmd3.cpp +++ b/src/mame/video/decodmd3.cpp @@ -110,12 +110,12 @@ MC6845_UPDATE_ROW( decodmd_type3_device::crtc_update_row ) for (int dot = 0; dot < 8; dot++) { intensity = ((RAM[addr + 1] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x801] >> (7-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } for (int dot = 8; dot < 16; dot++) { intensity = ((RAM[addr] >> (15-dot) & 0x01) << 1) | (RAM[addr + 0x800] >> (15-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } addr += 2; } diff --git a/src/mame/video/decospr.cpp b/src/mame/video/decospr.cpp index a86c21976b8..1d085dd5869 100644 --- a/src/mame/video/decospr.cpp +++ b/src/mame/video/decospr.cpp @@ -563,26 +563,22 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const if (!m_sprite_bitmap.valid()) fatalerror("decospr_device::inefficient_copy_sprite_bitmap with no m_sprite_bitmap\n"); - int y, x; - const pen_t *paldata = m_gfxdecode->palette().pens(); + pen_t const *const paldata = m_gfxdecode->palette().pens(); - uint16_t* srcline; - uint32_t* dstline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top();y<=cliprect.bottom();y++) { - srcline= &m_sprite_bitmap.pix16(y); - dstline= &bitmap.pix32(y); + uint16_t const *const srcline= &m_sprite_bitmap.pix(y); + uint32_t *const dstline= &bitmap.pix(y); if (alpha==0xff) { - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { - uint16_t pix = srcline[x]; + uint16_t const pix = srcline[x]; if (pix&0xf) { - if ((pix & priority_mask) ==pri ) + if ((pix & priority_mask) == pri) { dstline[x] = paldata[(pix&palmask) + colbase]; } @@ -591,16 +587,16 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const } else { - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { - uint16_t pix = srcline[x]; + uint16_t const pix = srcline[x]; if (pix&m_pixmask) { - if ((pix & priority_mask) ==pri ) + if ((pix & priority_mask) == pri) { - uint32_t pal1 = paldata[(pix&palmask) + colbase]; - uint32_t pal2 = dstline[x]; + uint32_t const pal1 = paldata[(pix&palmask) + colbase]; + uint32_t const pal2 = dstline[x]; dstline[x] = alpha_blend_r32(pal2, pal1, alpha); } } diff --git a/src/mame/video/deniam.cpp b/src/mame/video/deniam.cpp index 439c15026ae..c5676be36e1 100644 --- a/src/mame/video/deniam.cpp +++ b/src/mame/video/deniam.cpp @@ -236,9 +236,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] & 0x0f); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -255,9 +255,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16+(rom[i] >> 4); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -278,9 +278,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] >> 4); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -297,9 +297,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] & 0x0f); + screen.priority().pix(y, sx + x) = 8; } } x++; diff --git a/src/mame/video/dgn_beta.cpp b/src/mame/video/dgn_beta.cpp index 8d1795f2e72..1850f89f815 100644 --- a/src/mame/video/dgn_beta.cpp +++ b/src/mame/video/dgn_beta.cpp @@ -100,9 +100,9 @@ the access to the video memory is unclear to me at the moment. MC6845_UPDATE_ROW( dgn_beta_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *videoram = m_videoram; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const videoram = m_videoram; + uint32_t *p = &bitmap.pix(y); int i; if(IsTextMode) { diff --git a/src/mame/video/dkong.cpp b/src/mame/video/dkong.cpp index bab2c20a215..91dbfba9031 100644 --- a/src/mame/video/dkong.cpp +++ b/src/mame/video/dkong.cpp @@ -796,25 +796,22 @@ void dkong_state::radarscp_step(int line_cnt) void dkong_state::radarscp_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { const uint8_t *htable = nullptr; - int x,y; - uint8_t draw_ok; - uint16_t *pixel; if (m_hardware_type == HARDWARE_TRS01) htable = m_gfx4; - y = cliprect.min_y; + int y = cliprect.min_y; while (y <= cliprect.max_y) { - x = cliprect.min_x; + int x = cliprect.min_x; while (x <= cliprect.max_x) { - pixel = &bitmap.pix16(y, x); - draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02); + uint16_t *const pixel = &bitmap.pix(y, x); + uint8_t draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02); if (m_hardware_type == HARDWARE_TRS01) /* Check again from schematics */ draw_ok = draw_ok && !((htable[ (!m_rflip_sig<<7) | (x>>2)] >>2) & 0x01); if (draw_ok) - *pixel = *(&m_bg_bits.pix16(y, x)); + *pixel = m_bg_bits.pix(y, x); x++; } y++; @@ -823,21 +820,19 @@ void dkong_state::radarscp_draw_background(bitmap_ind16 &bitmap, const rectangle void dkong_state::radarscp_scanline(int scanline) { - const uint8_t *table = m_gfx3; + uint8_t const *const table = m_gfx3; int table_len = m_gfx3_len; - int x,y,offset; - uint16_t *pixel; const rectangle &visarea = m_screen->visible_area(); - y = scanline; + int y = scanline; radarscp_step(y); if (y <= visarea.min_y || y > visarea.max_y) m_counter = 0; - offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400; - x = 0; + int offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400; + int x = 0; while (x < m_screen->width()) { - pixel = &m_bg_bits.pix16(y, x); + uint16_t *const pixel = &m_bg_bits.pix(y, x); if ((m_counter < table_len) && (x == 4 * (table[m_counter|offset] & 0x7f))) { if ( m_star_ff && (table[m_counter|offset] & 0x80) ) /* star */ @@ -852,7 +847,7 @@ void dkong_state::radarscp_scanline(int scanline) *pixel = RADARSCP_BCK_COL_OFFSET + m_blue_level; x++; } - while ((m_counter < table_len) && ( x < 4 * (table[m_counter|offset] & 0x7f))) + while ((m_counter < table_len) && (x < 4 * (table[m_counter|offset] & 0x7f))) m_counter++; } diff --git a/src/mame/video/dogfgt.cpp b/src/mame/video/dogfgt.cpp index 154e2d2380a..a8e3ee9fa8f 100644 --- a/src/mame/video/dogfgt.cpp +++ b/src/mame/video/dogfgt.cpp @@ -116,9 +116,9 @@ void dogfgt_state::internal_bitmapram_w(offs_t offset, uint8_t data) color |= ((m_bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i; if (flip_screen()) - m_pixbitmap.pix16(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + m_pixbitmap.pix(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; else - m_pixbitmap.pix16(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + m_pixbitmap.pix(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; } } diff --git a/src/mame/video/dpb_combiner.cpp b/src/mame/video/dpb_combiner.cpp index 29819661e35..48440eeec02 100644 --- a/src/mame/video/dpb_combiner.cpp +++ b/src/mame/video/dpb_combiner.cpp @@ -206,7 +206,7 @@ void dpb7000_combiner_card_device::fsck_tick() { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x && x < 256; x++) { *dest++ = 0xff000000 | (m_lum_out << 16) | (m_lum_out << 8) | m_lum_out; diff --git a/src/mame/video/dribling.cpp b/src/mame/video/dribling.cpp index a8e40930674..510dccb5c5e 100644 --- a/src/mame/video/dribling.cpp +++ b/src/mame/video/dribling.cpp @@ -62,7 +62,7 @@ uint32_t dribling_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // loop over rows for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); // loop over columns for (int x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp index 0fd9007937c..6cdbf33beca 100644 --- a/src/mame/video/dynax.cpp +++ b/src/mame/video/dynax.cpp @@ -647,7 +647,6 @@ VIDEO_START_MEMBER(dynax_state,neruton) void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &cliprect, int i ) { int color; - int scrollx, scrolly; switch (i) { @@ -660,8 +659,8 @@ void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &clipr color += (m_blit_palbank & 0x0f) * 16; - scrollx = m_blit_scroll_x; - scrolly = m_blit_scroll_y; + int scrollx = m_blit_scroll_x; + int scrolly = m_blit_scroll_y; if (i == 1 && (m_layer_layout == LAYOUT_HANAMAI || m_layer_layout == LAYOUT_HNORIDUR)) { @@ -670,16 +669,16 @@ void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &clipr } { - int dy, length, pen; - uint8_t *src1 = m_pixmap[i][1].get(); - uint8_t *src2 = m_pixmap[i][0].get(); + uint8_t const *src1 = m_pixmap[i][1].get(); + uint8_t const *src2 = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { + int length, pen; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16((dy - scrolly) & 0xff); + uint16_t *const dstbase = &bitmap.pix((dy - scrolly) & 0xff); length = scrollx; dst = dstbase + 2 * (256 - length); @@ -736,17 +735,17 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli } { - int dy, length, pen; - uint8_t *src1 = m_pixmap[i][1].get(); - uint8_t *src2 = m_pixmap[i][0].get(); + uint8_t const *src1 = m_pixmap[i][1].get(); + uint8_t const *src2 = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { - int sy = ((dy - scrolly) & 0xff) + y; + int length, pen; + int const sy = ((dy - scrolly) & 0xff) + y; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16(sy); + uint16_t *const dstbase = &bitmap.pix(sy); if ((sy < cliprect.top()) || (sy > cliprect.bottom())) { @@ -784,7 +783,6 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli void dynax_state::mjdialq2_copylayer( bitmap_ind16 &bitmap, const rectangle &cliprect, int i ) { int color; - int scrollx, scrolly; switch (i) { @@ -795,19 +793,19 @@ void dynax_state::mjdialq2_copylayer( bitmap_ind16 &bitmap, const rectangle &cli color += (m_blit_palbank & 1) * 16; - scrollx = m_blit_scroll_x; - scrolly = m_blit_scroll_y; + int const scrollx = m_blit_scroll_x; + int const scrolly = m_blit_scroll_y; { - int dy, length, pen; - uint8_t *src = m_pixmap[i][0].get(); + uint8_t const *src = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { + int length, pen; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16((dy - scrolly) & 0xff); + uint16_t *const dstbase = &bitmap.pix((dy - scrolly) & 0xff); length = scrollx; dst = dstbase + 256 - length; diff --git a/src/mame/video/dynduke.cpp b/src/mame/video/dynduke.cpp index 6d6295411a4..2f0fff57946 100644 --- a/src/mame/video/dynduke.cpp +++ b/src/mame/video/dynduke.cpp @@ -164,9 +164,6 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr { /* The transparency / palette handling on the background layer is very strange */ bitmap_ind16 &bm = m_bg_layer->pixmap(); - int scrolly, scrollx; - int x,y; - /* if we're disabled, don't draw */ if (!m_back_enable) { @@ -174,8 +171,8 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr return; } - scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7); - scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7); + int scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7); + int scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7); if (flip_screen()) { @@ -183,14 +180,14 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr scrollx = 256 - scrollx; } - for (y=0;y<256;y++) + for (int y=0;y<256;y++) { int realy = (y + scrolly) & 0x1ff; - uint16_t *src = &bm.pix16(realy); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &bm.pix(realy); + uint16_t *const dst = &bitmap.pix(y); - for (x=0;x<256;x++) + for (int x=0;x<256;x++) { int realx = (x + scrollx) & 0x1ff; uint16_t srcdat = src[realx]; diff --git a/src/mame/video/elan_eu3a05vid.cpp b/src/mame/video/elan_eu3a05vid.cpp index 46f39a1975e..5ea11e30bd9 100644 --- a/src/mame/video/elan_eu3a05vid.cpp +++ b/src/mame/video/elan_eu3a05vid.cpp @@ -245,11 +245,11 @@ void elan_eu3a05vid_device::draw_sprites(screen_device &screen, bitmap_ind16 &bi if (flags & 0x08) // guess flipy { - row = &bitmap.pix16((y + (sizey - 1 - yy)) & 0xff); + row = &bitmap.pix((y + (sizey - 1 - yy)) & 0xff); } else { - row = &bitmap.pix16((y + yy) & 0xff); + row = &bitmap.pix((y + yy) & 0xff); } for (int xx = 0; xx < sizex; xx++) @@ -457,7 +457,7 @@ void elan_eu3a05vid_device::draw_tilemaps(screen_device& screen, bitmap_ind16& b tile += ((m_tile_gfxbase_lo_data | m_tile_gfxbase_hi_data << 8) << 5); - uint16_t* row = &bitmap.pix16(drawline); + uint16_t *const row = &bitmap.pix(drawline); if (m_vidctrl & 0x20) // 4bpp { diff --git a/src/mame/video/elan_eu3a14vid.cpp b/src/mame/video/elan_eu3a14vid.cpp index bf7d92eb0ac..9f31ef164fc 100644 --- a/src/mame/video/elan_eu3a14vid.cpp +++ b/src/mame/video/elan_eu3a14vid.cpp @@ -252,8 +252,8 @@ void elan_eu3a14vid_device::draw_background_tile(bitmap_ind16& bitmap, const rec // RAM tile layer has no scrolling? (or we've never seen it used / enabled) } - uint16_t* dst = &bitmap.pix16(ypos + y); - uint8_t* pridst = &m_prioritybitmap.pix8(ypos + y); + uint16_t *const dst = &bitmap.pix(ypos + y); + uint8_t *const pridst = &m_prioritybitmap.pix(ypos + y); for (int x = 0; x < xstride; x++) { @@ -692,8 +692,8 @@ void elan_eu3a14vid_device::draw_sprite_line(screen_device &screen, bitmap_ind16 if (ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - uint16_t* dst = &bitmap.pix16(ypos); - uint8_t* pridst = &m_prioritybitmap.pix8(ypos); + uint16_t *const dst = &bitmap.pix(ypos); + uint8_t *const pridst = &m_prioritybitmap.pix(ypos); int count = 0; for (int x = 0; x < 8/bppdiv;x++) diff --git a/src/mame/video/electron.cpp b/src/mame/video/electron.cpp index e506a4e930c..352e4710769 100644 --- a/src/mame/video/electron.cpp +++ b/src/mame/video/electron.cpp @@ -80,7 +80,7 @@ inline uint8_t electron_state::read_vram( uint16_t addr ) inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/eolith.cpp b/src/mame/video/eolith.cpp index c31fea64fc2..fa18bbb3709 100644 --- a/src/mame/video/eolith.cpp +++ b/src/mame/video/eolith.cpp @@ -34,7 +34,7 @@ uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; + bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; } } diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp index 91a0b77299f..886582a9a3e 100644 --- a/src/mame/video/epos.cpp +++ b/src/mame/video/epos.cpp @@ -89,13 +89,13 @@ uint32_t epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, if (flip_screen()) { - bitmap.pix32(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix32(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + bitmap.pix(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); } else { - bitmap.pix32(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix32(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + bitmap.pix(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); } } diff --git a/src/mame/video/eprom.cpp b/src/mame/video/eprom.cpp index fad474f1502..2150f9c37ff 100644 --- a/src/mame/video/eprom.cpp +++ b/src/mame/video/eprom.cpp @@ -221,8 +221,8 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -266,15 +266,15 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b * * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected */ - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int pfpriority = (pf[x] >> 4) & 3; - int forcemc0 = 0, shade = 1, pfm = 1, m7 = 0; + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 4) & 3; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) continue; /* compute the FORCEMC signal */ + int forcemc0 = 0; if (!(pf[x] & 8)) { if (((pfpriority == 3) && !(mopriority & 1)) || @@ -284,12 +284,14 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b } /* compute the SHADE signal */ + int shade = 1; if (((mo[x] & 0x0f) != 1) || ((mo[x] & 0xf0) == 0) || forcemc0) shade = 0; /* compute the PF/M signal */ + int pfm = 1; if ((mopriority == 3) || (pf[x] & 8) || (!(pfpriority & 1) && (mopriority & 2)) || @@ -299,6 +301,7 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b pfm = 0; /* compute the M7 signal */ + int m7 = 0; if ((mo[x] & 0x0f) == 1) m7 = 1; @@ -327,12 +330,12 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) @@ -368,13 +371,13 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int pfpriority = (pf[x] >> 5) & 3; + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 5) & 3; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -393,12 +396,12 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/equites.cpp b/src/mame/video/equites.cpp index 26f64b55e9b..a0193cdebeb 100644 --- a/src/mame/video/equites.cpp +++ b/src/mame/video/equites.cpp @@ -350,7 +350,7 @@ void splndrbt_state::splndrbt_draw_sprites(bitmap_ind16 &bitmap, const rectangle int pen = srcgfx[offset]; if ((transmask & (1 << pen)) == 0) - bitmap.pix16(y, bx) = paldata[pen]; + bitmap.pix(y, bx) = paldata[pen]; } } } @@ -383,9 +383,9 @@ void splndrbt_state::splndrbt_copy_bg(bitmap_ind16 &dst_bitmap, const rectangle if (dst_y >= cliprect.top() && dst_y <= cliprect.bottom()) { const uint8_t * const romline = &xrom[(dst_y ^ dinvert) << 5]; - const uint16_t * const src_line = &src_bitmap.pix16((src_y + scroll_y) & 0x1ff); - const uint8_t * const flags_line = &flags_bitmap.pix8((src_y + scroll_y) & 0x1ff); - uint16_t * const dst_line = &dst_bitmap.pix16(dst_y); + const uint16_t * const src_line = &src_bitmap.pix((src_y + scroll_y) & 0x1ff); + const uint8_t * const flags_line = &flags_bitmap.pix((src_y + scroll_y) & 0x1ff); + uint16_t * const dst_line = &dst_bitmap.pix(dst_y); int dst_x = 0; int src_x; diff --git a/src/mame/video/esripsys.cpp b/src/mame/video/esripsys.cpp index 9db24deaa78..fd6e4b33aeb 100644 --- a/src/mame/video/esripsys.cpp +++ b/src/mame/video/esripsys.cpp @@ -151,18 +151,17 @@ void esripsys_state::video_start() uint32_t esripsys_state::screen_update_esripsys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - struct line_buffer_t *line_buffer = m_line_buffer; - int x, y; + struct line_buffer_t *const line_buffer = m_line_buffer; - uint8_t *colour_buf = line_buffer[m_12sel ? 0 : 1].colour_buf.get(); - uint8_t *intensity_buf = line_buffer[m_12sel ? 0 : 1].intensity_buf.get(); - uint8_t *priority_buf = line_buffer[m_12sel ? 0 : 1].priority_buf.get(); + uint8_t *const colour_buf = line_buffer[m_12sel ? 0 : 1].colour_buf.get(); + uint8_t *const intensity_buf = line_buffer[m_12sel ? 0 : 1].intensity_buf.get(); + uint8_t *const priority_buf = line_buffer[m_12sel ? 0 : 1].priority_buf.get(); - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); - for (x = 0; x < 512; ++x) + for (int x = 0; x < 512; ++x) { int idx = colour_buf[x]; int r = (m_pal_ram[idx] & 0xf); diff --git a/src/mame/video/exidy.cpp b/src/mame/video/exidy.cpp index 8c7146a847d..2df9ef5470d 100644 --- a/src/mame/video/exidy.cpp +++ b/src/mame/video/exidy.cpp @@ -134,12 +134,10 @@ void exidy_state::draw_background() for (offs = 0; offs < 0x400; offs++) { - uint8_t cy; - pen_t on_pen_1, on_pen_2; - uint8_t y = offs >> 5 << 3; - uint8_t code = m_videoram[offs]; + uint8_t const code = m_videoram[offs]; + pen_t on_pen_1, on_pen_2; if (m_is_2bpp) { on_pen_1 = 4 + ((code >> 6) & 0x02); @@ -151,9 +149,8 @@ void exidy_state::draw_background() on_pen_2 = off_pen; /* unused */ } - for (cy = 0; cy < 8; cy++) + for (uint8_t cy = 0; cy < 8; cy++) { - int i; uint8_t x = offs << 3; if (m_is_2bpp) @@ -161,16 +158,16 @@ void exidy_state::draw_background() uint8_t data1 = m_characterram[0x000 | (code << 3) | cy]; uint8_t data2 = m_characterram[0x800 | (code << 3) | cy]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (data1 & 0x80) - m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; + m_background_bitmap.pix(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; else - m_background_bitmap.pix16(y, x) = off_pen; + m_background_bitmap.pix(y, x) = off_pen; - x = x + 1; - data1 = data1 << 1; - data2 = data2 << 1; + x++; + data1 <<= 1; + data2 <<= 1; } } /* 1bpp */ @@ -178,16 +175,16 @@ void exidy_state::draw_background() { uint8_t data = m_characterram[(code << 3) | cy]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen; + m_background_bitmap.pix(y, x) = (data & 0x80) ? on_pen_1 : off_pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } } - y = y + 1; + y++; } } } @@ -282,7 +279,6 @@ void exidy_state::check_collision() const rectangle clip(0, 15, 0, 15); int org_1_x = 0, org_1_y = 0; int org_2_x = 0, org_2_y = 0; - int sx, sy; int count = 0; /* if there is nothing to detect, bail */ @@ -312,27 +308,27 @@ void exidy_state::check_collision() m_motion_object_2_clip.fill(0xff, clip); if (sprite_1_enabled()) { - sx = org_2_x - org_1_x; - sy = org_2_y - org_1_y; + int sx = org_2_x - org_1_x; + int sy = org_2_y - org_1_y; m_gfxdecode->gfx(0)->transpen(m_motion_object_2_clip,clip, ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, 0, 0, sx, sy, 0); } /* scan for collisions */ - for (sy = 0; sy < 16; sy++) - for (sx = 0; sx < 16; sx++) + for (int sy = 0; sy < 16; sy++) + for (int sx = 0; sx < 16; sx++) { - if (m_motion_object_1_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_1_vid.pix(sy, sx) != 0xff) { uint8_t current_collision_mask = 0; /* check for background collision (M1CHAR) */ - if (m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0) + if (m_background_bitmap.pix(org_1_y + sy, org_1_x + sx) != 0) current_collision_mask |= 0x04; /* check for motion object collision (M1M2) */ - if (m_motion_object_2_clip.pix16(sy, sx) != 0xff) + if (m_motion_object_2_clip.pix(sy, sx) != 0xff) current_collision_mask |= 0x10; /* if we got one, trigger an interrupt */ @@ -340,10 +336,10 @@ void exidy_state::check_collision() timer_set(m_screen->time_until_pos(org_1_x + sx, org_1_y + sy), TIMER_COLLISION_IRQ, current_collision_mask); } - if (m_motion_object_2_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_2_vid.pix(sy, sx) != 0xff) { /* check for background collision (M2CHAR) */ - if (m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0) + if (m_background_bitmap.pix(org_2_y + sy, org_2_x + sx) != 0) if ((m_collision_mask & 0x08) && (count++ < 128)) timer_set(m_screen->time_until_pos(org_2_x + sx, org_2_y + sy), TIMER_COLLISION_IRQ, 0x08); } diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index 11c83976dfa..2106e4ac16e 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -306,7 +306,6 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c int image = (~sprite[3] & 0x3f); int xoffs = (~((sprite[1] << 8) | sprite[2]) & 0x1ff); int yoffs = (~sprite[0] & 0xff) + 1; - int x, y, sy; uint8_t *src; /* skip if out of range */ @@ -321,8 +320,8 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c xoffs -= 0x1ff; /* loop over y */ - sy = yoffs + scroll_offset; - for (y = 0; y < 16; y++, yoffs--, sy--) + int sy = yoffs + scroll_offset; + for (int y = 0; y < 16; y++, yoffs--, sy--) { /* wrap at the top and bottom of the screen */ if (sy >= VBSTART) @@ -341,7 +340,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c int currx = xoffs; /* loop over x */ - for (x = 0; x < 8; x++, old += 2) + for (int x = 0; x < 8; x++, old += 2) { int ipixel = *src++; int left = ipixel & 0xf0; @@ -353,7 +352,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { /* combine with the background */ pen = left | old[0]; - bitmap.pix16(yoffs, currx) = pen; + bitmap.pix(yoffs, currx) = pen; /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) @@ -366,7 +365,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { /* combine with the background */ pen = right | old[1]; - bitmap.pix16(yoffs, currx) = pen; + bitmap.pix(yoffs, currx) = pen; /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) diff --git a/src/mame/video/exterm.cpp b/src/mame/video/exterm.cpp index 7a6373fdff4..4049ab85571 100644 --- a/src/mame/video/exterm.cpp +++ b/src/mame/video/exterm.cpp @@ -64,9 +64,8 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(exterm_state::from_shiftreg_slave) TMS340X0_SCANLINE_IND16_CB_MEMBER(exterm_state::scanline_update) { - uint16_t *bgsrc = &m_master_videoram[(params->rowaddr << 8) & 0xff00]; - uint16_t *fgsrc = nullptr; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const bgsrc = &m_master_videoram[(params->rowaddr << 8) & 0xff00]; + uint16_t *const dest = &bitmap.pix(scanline); tms340x0_device::display_params fgparams; int coladdr = params->coladdr; int fgcoladdr = 0; @@ -75,6 +74,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(exterm_state::scanline_update) m_slave->get_display_params(&fgparams); /* compute info about the slave vram */ + uint16_t *fgsrc = nullptr; if (fgparams.enabled && scanline >= fgparams.veblnk && scanline < fgparams.vsblnk && fgparams.heblnk < fgparams.hsblnk) { fgsrc = &m_slave_videoram[((fgparams.rowaddr << 8) + (fgparams.yoffset << 7)) & 0xff80]; diff --git a/src/mame/video/fgoal.cpp b/src/mame/video/fgoal.cpp index fb9de83dec5..8152f58a0ad 100644 --- a/src/mame/video/fgoal.cpp +++ b/src/mame/video/fgoal.cpp @@ -40,11 +40,7 @@ void fgoal_state::video_start() uint32_t fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint8_t* VRAM = m_video_ram; - - int x; - int y; - int n; + uint8_t const *VRAM = m_video_ram; /* draw color overlay foreground and background */ @@ -83,31 +79,31 @@ uint32_t fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, /* the ball has a fixed color */ - for (y = m_ypos; y < m_ypos + 8; y++) + for (int y = m_ypos; y < m_ypos + 8; y++) { - for (x = m_xpos; x < m_xpos + 8; x++) + for (int x = m_xpos; x < m_xpos + 8; x++) { if (y < 256 && x < 256) { - m_fgbitmap.pix16(y, x) = 128 + 16; + m_fgbitmap.pix(y, x) = 128 + 16; } } } /* draw bitmap layer */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* p = &bitmap.pix16(y); + uint16_t *const p = &bitmap.pix(y); - const uint16_t* FG = &m_fgbitmap.pix16(y); - const uint16_t* BG = &m_bgbitmap.pix16(y); + uint16_t const *const FG = &m_fgbitmap.pix(y); + uint16_t const *const BG = &m_bgbitmap.pix(y); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { uint8_t v = *VRAM++; - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { if (v & (1 << n)) { diff --git a/src/mame/video/firetrk.cpp b/src/mame/video/firetrk.cpp index 935cc97ed66..800cb5dd5e2 100644 --- a/src/mame/video/firetrk.cpp +++ b/src/mame/video/firetrk.cpp @@ -318,13 +318,11 @@ void firetrk_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, u void firetrk_state::check_collision(int which) { - int y, x; - - for (y = playfield_window.top(); y <= playfield_window.bottom(); y++) - for (x = playfield_window.left(); x <= playfield_window.right(); x++) + for (int y = playfield_window.top(); y <= playfield_window.bottom(); y++) + for (int x = playfield_window.left(); x <= playfield_window.right(); x++) { - pen_t a = m_helper1.pix16(y, x); - pen_t b = m_helper2.pix16(y, x); + pen_t const a = m_helper1.pix(y, x); + pen_t const b = m_helper2.pix(y, x); if (b != 0xff && (m_color1_mask >> a) & 1) m_crash[which] = 1; diff --git a/src/mame/video/fm7.cpp b/src/mame/video/fm7.cpp index 16eede8b9c9..e942d086b8b 100644 --- a/src/mame/video/fm7.cpp +++ b/src/mame/video/fm7.cpp @@ -1424,8 +1424,6 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma uint8_t code_r2 = 0,code_g2 = 0,code_b2 = 0; uint8_t code_r3 = 0,code_g3 = 0,code_b3 = 0; uint8_t code_r4 = 0,code_g4 = 0,code_b4 = 0; - uint16_t col; - int y, x, b; uint16_t page = 0x0000; if(m_video.display_video_page != 0) @@ -1436,9 +1434,9 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma if(m_video.modestatus & 0x40) // 320x200 mode { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { if(!(m_video.multi_page & 0x40)) { @@ -1461,21 +1459,22 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma code_b3 = m_video_ram[0xc000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; code_b4 = m_video_ram[0xe000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { + uint16_t col; col = (((code_b >> b) & 0x01) ? 8 : 0) | (((code_b2 >> b) & 0x01) ? 4 : 0) | (((code_b3 >> b) & 0x01) ? 2 : 0) | (((code_b4 >> b) & 0x01) ? 1 : 0); col |= (((code_g >> b) & 0x01) ? 128 : 0) | (((code_g2 >> b) & 0x01) ? 64 : 0) | (((code_g3 >> b) & 0x01) ? 32 : 0) | (((code_g4 >> b) & 0x01) ? 16 : 0); col |= (((code_r >> b) & 0x01) ? 2048 : 0) | (((code_r2 >> b) & 0x01) ? 1024 : 0) | (((code_r3 >> b) & 0x01) ? 512 : 0) | (((code_r4 >> b) & 0x01) ? 256 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_av_palette->pen_color(col); + bitmap.pix(y, x*8+(7-b)) = m_av_palette->pen_color(col); } } } } else { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - for (x = 0; x < 80; x++) + for (int x = 0; x < 80; x++) { if(!(m_video.multi_page & 0x40)) code_r = m_video_ram[page + 0x8000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; @@ -1483,10 +1482,10 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma code_g = m_video_ram[page + 0x4000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; if(!(m_video.multi_page & 0x10)) code_b = m_video_ram[page + 0x0000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_palette->pen_color(col); + uint16_t col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); + bitmap.pix(y, x*8+(7-b)) = m_palette->pen_color(col); } } } diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp index d60da80b198..ef6515700e9 100644 --- a/src/mame/video/fmtowns.cpp +++ b/src/mame/video/fmtowns.cpp @@ -975,13 +975,10 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo void towns_state::draw_sprites(const rectangle* rect) { uint16_t sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff; - int n; - uint16_t x,y,attr,colour; uint16_t xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff; uint16_t yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff; uint32_t poffset,coffset; int linesize = m_video.towns_crtc_reg[24] * 4; - bool xflip, yflip, xhalfsize, yhalfsize, rotation; if(!(m_video.towns_sprite_reg[1] & 0x80)) return; @@ -998,17 +995,17 @@ void towns_state::draw_sprites(const rectangle* rect) for(int i = linesize; i < 0x20000; i += linesize) memcpy(vram + i, vram, linesize); - for(n=sprite_limit;n<1024;n++) + for(int n=sprite_limit;n<1024;n++) { - x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); - y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); - attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); - colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); - xflip = (attr & 0x2000) >> 13; - yflip = (attr & 0x1000) >> 12; - rotation = (attr & 0x4000) >> 14; - xhalfsize = (attr & 0x400) >> 10; - yhalfsize = (attr & 0x800) >> 11; + uint16_t x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); + uint16_t y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); + uint16_t attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); + uint16_t colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); + bool xflip = (attr & 0x2000) >> 13; + bool yflip = (attr & 0x1000) >> 12; + bool rotation = (attr & 0x4000) >> 14; + bool xhalfsize = (attr & 0x400) >> 10; + bool yhalfsize = (attr & 0x800) >> 11; if(attr & 0x8000) { @@ -1053,12 +1050,10 @@ void towns_state::draw_sprites(const rectangle* rect) void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { uint32_t off = 0; - int x; uint16_t colour; int hzoom = 1; int linesize; uint32_t scroll; - int pixel; int page = 0; bool sphscroll = !(m_video.towns_crtc_reg[28] & (layer ? 0x20 : 0x10)); @@ -1111,7 +1106,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const off += line * linesize; off &= ~1; - for(x=rect->min_x;x<rect->max_x;x+=hzoom) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom) { int offpage; int curoff; @@ -1128,8 +1123,8 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const colour = (m_towns_gfxvram[curoff+(offpage*0x40000)+1] << 8) | m_towns_gfxvram[curoff+(offpage*0x40000)]; if(!(m_video.towns_video_reg[0] & 0x10) || (m_video.towns_video_reg[1] & 0x01) != layer || colour < 0x8000) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = ((colour & 0x001f) << 3) | ((colour & 0x7c00) << 1) | ((colour & 0x03e0) << 14); @@ -1143,12 +1138,10 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline) { int off = 0; - int x; uint8_t colour; int hzoom = 1; int linesize; uint32_t scroll; - int pixel; int page = 0; bool sphscroll = !(m_video.towns_crtc_reg[28] & 0x10); @@ -1174,12 +1167,12 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect off += (subpix >> 1) & ~3; subpix = subpix & 7; - for(x=rect->min_x;x<rect->max_x;x+=hzoom) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom) { off &= 0x3ffff; colour = m_towns_gfxvram[off+(subpix >= 4 ? (subpix & 3)+0x40000 : subpix)]; - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = m_palette->pen(colour); subpix++; if(subpix == 8) { @@ -1194,12 +1187,8 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { int off = 0; - int x; - uint8_t colour; int hzoom = 1; - int linesize; uint32_t scroll; - int pixel; int page = 0; palette_device* pal = m_palette16[layer]; bool sphscroll = !(m_video.towns_crtc_reg[28] & (layer ? 0x20 : 0x10)); @@ -1215,6 +1204,7 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta // if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) // off = 0x20000; + int linesize; if(layer == 0) linesize = m_video.towns_crtc_reg[20] * 4; else @@ -1249,23 +1239,24 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta off += line * linesize; - for(x=rect->min_x;x<rect->max_x;x+=hzoom*2) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom*2) { if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer + uint8_t colour; colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0 || bottom_layer) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+hzoom+pixel) = pal->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+hzoom+pixel) = pal->pen(colour); } colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0 || bottom_layer) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = pal->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = pal->pen(colour); } off++; if ((off - (page * 0x20000)) % linesize == 0 && sphscroll) @@ -1275,7 +1266,6 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer) { - int line; int scanline; int bottom; int top; @@ -1294,7 +1284,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re switch(m_video.towns_video_reg[0] & 0x03) { case 0x01: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1306,7 +1296,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x02: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1318,7 +1308,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x03: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1343,7 +1333,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re switch(m_video.towns_video_reg[0] & 0x0c) { case 0x04: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1355,7 +1345,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x0c: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1376,11 +1366,7 @@ void towns_state::render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t uint32_t vram_addr; uint16_t linesize = m_video.towns_crtc_reg[24] * 4; uint8_t code_h,code_l; - uint8_t colour; - uint8_t data; - uint8_t temp; uint8_t* font_rom = m_user->base(); - int a,b; // all characters are 16 pixels high vram_addr = (x * 4) + (y * (linesize * 16)); @@ -1415,29 +1401,27 @@ void towns_state::render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t | 0x38000; } } - colour = attr & 0x07; + uint8_t colour = attr & 0x07; if(attr & 0x20) colour |= 0x08; - for(a=0;a<16;a++) // for each scanline + for(int a=0;a<16;a++) // for each scanline { + uint8_t data; if((attr & 0xc0) == 0) data = font_rom[0x180000 + rom_addr + a]; + else if((attr & 0xc0) == 0x80) + data = font_rom[0x180000 + rom_addr + (a*2)]; else - { - if((attr & 0xc0) == 0x80) - data = font_rom[0x180000 + rom_addr + (a*2)]; - else - data = font_rom[0x180000 + rom_addr + (a*2) + 1]; - } + data = font_rom[0x180000 + rom_addr + (a*2) + 1]; if(attr & 0x08) data = ~data; // inverse // and finally, put the data in VRAM - for(b=0;b<8;b+=2) + for(int b=0;b<8;b+=2) { - temp = 0; + uint8_t temp = 0; if(data & (1<<b)) temp |= ((colour & 0x0f) << 4); if(data & (1<<(b+1))) @@ -1469,11 +1453,11 @@ void towns_state::draw_text_layer() * * The video hardware renders text to VRAM layer 1, there is no separate text layer */ - int x,y,c = 0; + int c = 0; - for(y=0;y<40;y++) + for(int y=0;y<40;y++) { - for(x=0;x<80;x++) + for(int x=0;x<80;x++) { render_text_char(x,y,m_towns_txtvram[c],((m_towns_txtvram[c+0x2000] << 8)|(m_towns_txtvram[c+0x2001])),m_towns_txtvram[c+1]); c+=2; diff --git a/src/mame/video/gaelco2.cpp b/src/mame/video/gaelco2.cpp index e9c0368e8f5..26d8902f2cb 100644 --- a/src/mame/video/gaelco2.cpp +++ b/src/mame/video/gaelco2.cpp @@ -393,7 +393,7 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { /* get a pointer to the current line in the screen bitmap */ const int ypos = ((sy + ey * 16 + py) & 0x1ff); - u16 *srcy = &bitmap.pix16(ypos); + u16 *const srcy = &bitmap.pix(ypos); const int gfx_py = yflip ? (gfx->height() - 1 - py) : py; @@ -403,7 +403,7 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { /* get current pixel */ const int xpos = (((sx + ex * 16 + px) & 0x3ff) + spr_x_adjust) & 0x3ff; - u16 *pixel = srcy + xpos; + u16 *const pixel = srcy + xpos; const u16 src_color = *pixel; const int gfx_px = xflip ? (gfx->width() - 1 - px) : px; diff --git a/src/mame/video/gaelco3d.cpp b/src/mame/video/gaelco3d.cpp index 2010e5d2738..6a10b3d4ec9 100644 --- a/src/mame/video/gaelco3d.cpp +++ b/src/mame/video/gaelco3d.cpp @@ -210,8 +210,8 @@ void gaelco3d_state::gaelco3d_renderer::render_noz_noperspective(int32_t scanlin offs_t endmask = m_texture_size - 1; const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float uoz = (object.uoz_base + scanline * object.uoz_dy + startx * object.uoz_dx) * zbase; float voz = (object.voz_base + scanline * object.voz_dy + startx * object.voz_dx) * zbase; @@ -249,8 +249,8 @@ void gaelco3d_state::gaelco3d_renderer::render_normal(int32_t scanline, const ex const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; float z0 = object.z0; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float ooz = object.ooz_base + scanline * object.ooz_dy + startx * ooz_dx; float uoz = object.uoz_base + scanline * object.uoz_dy + startx * uoz_dx; @@ -299,8 +299,8 @@ void gaelco3d_state::gaelco3d_renderer::render_alphablend(int32_t scanline, cons const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; float z0 = object.z0; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float ooz = object.ooz_base + object.ooz_dy * scanline + startx * ooz_dx; float uoz = object.uoz_base + object.uoz_dy * scanline + startx * uoz_dx; @@ -454,7 +454,7 @@ uint32_t gaelco3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { int offs = (yv + y - cliprect.min_y) * 4096 + xv + x - cliprect.min_x; diff --git a/src/mame/video/gaelco_wrally_sprites.cpp b/src/mame/video/gaelco_wrally_sprites.cpp index c865e658a66..b1ade9e73e1 100644 --- a/src/mame/video/gaelco_wrally_sprites.cpp +++ b/src/mame/video/gaelco_wrally_sprites.cpp @@ -99,7 +99,7 @@ void gaelco_wrally_sprites_device::draw_sprites(const rectangle &cliprect, uint1 { /* get a pointer to the current line in the screen bitmap */ int ypos = ((sy + py) & 0x1ff); - uint16_t *srcy = &m_temp_bitmap_sprites.pix16(ypos); + uint16_t *const srcy = &m_temp_bitmap_sprites.pix(ypos); int gfx_py = yflip ? (gfx->height() - 1 - py) : py; @@ -109,7 +109,7 @@ void gaelco_wrally_sprites_device::draw_sprites(const rectangle &cliprect, uint1 { /* get current pixel */ int xpos = (((sx + px) & 0x3ff) - 0x0f) & 0x3ff; - uint16_t *pixel = srcy + xpos; + uint16_t *const pixel = srcy + xpos; int gfx_px = xflip ? (gfx->width() - 1 - px) : px; /* get asociated pen for the current sprite pixel */ @@ -152,8 +152,8 @@ void gaelco_wrally_sprites_device::mix_sprites(bitmap_ind16 &bitmap, const recta { for (int y = cliprect.min_y; y < cliprect.max_y; y++) { - const uint16_t* spriteptr = &m_temp_bitmap_sprites.pix16(y); - uint16_t* dstptr = &bitmap.pix16(y); + uint16_t const *const spriteptr = &m_temp_bitmap_sprites.pix(y); + uint16_t *const dstptr = &bitmap.pix(y); for (int x = cliprect.min_x; x < cliprect.max_x; x++) { diff --git a/src/mame/video/galastrm.cpp b/src/mame/video/galastrm.cpp index 07e23705512..63a1461ed91 100644 --- a/src/mame/video/galastrm.cpp +++ b/src/mame/video/galastrm.cpp @@ -209,7 +209,7 @@ void galastrm_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c void galastrm_renderer::tc0610_draw_scanline(s32 scanline, const extent_t& extent, const gs_poly_data& object, int threadid) { - u16 *framebuffer = &m_screenbits.pix16(scanline); + u16 *const framebuffer = &m_screenbits.pix(scanline); const s32 dudx = extent.param[0].dpdx; const s32 dvdx = extent.param[1].dpdx; @@ -217,7 +217,7 @@ void galastrm_renderer::tc0610_draw_scanline(s32 scanline, const extent_t& exten s32 v = extent.param[1].start; for (int x = extent.startx; x < extent.stopx; x++) { - framebuffer[x] = object.texbase->pix16(v >> 16, u >> 16); + framebuffer[x] = object.texbase->pix(v >> 16, u >> 16); u += dudx; v += dvdx; } @@ -466,8 +466,8 @@ u32 galastrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x = 0; x < priority_bitmap.width; x++) { - u8 *pri = &priority_bitmap.pix8(y, x); - if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x)) + u8 *pri = &priority_bitmap.pix(y, x); + if (!(*pri & 0x02) && m_tmpbitmaps.pix(y, x)) *pri |= 0x04; } } @@ -510,8 +510,8 @@ u32 galastrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x=0; x < priority_bitmap.width(); x++) { - u8 *pri = &priority_bitmap.pix8(y, x); - if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x)) + u8 *pri = &priority_bitmap.pix(y, x); + if (!(*pri & 0x02) && m_tmpbitmaps.pix(y, x)) *pri |= 0x04; } } diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp index 5a6377f8062..2b4d8506769 100644 --- a/src/mame/video/galaxia.cpp +++ b/src/mame/video/galaxia.cpp @@ -110,8 +110,6 @@ VIDEO_START_MEMBER(galaxia_state,astrowar) uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect); bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect); bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect); @@ -120,12 +118,12 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 cvs_update_stars(bitmap, cliprect, STAR_PEN, 1); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - bool bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); - bool background = (bitmap.pix16(y, x) & 3) != 0; + bool const bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); + bool const background = (bitmap.pix(y, x) & 3) != 0; // draw bullets (guesswork) if (bullet) @@ -134,16 +132,16 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 if (background) m_collision_register |= 0x80; // bullet size/color/priority is guessed - bitmap.pix16(y, x) = BULLET_PEN; - if (x) bitmap.pix16(y, x-1) = BULLET_PEN; + bitmap.pix(y, x) = BULLET_PEN; + if (x) bitmap.pix(y, x-1) = BULLET_PEN; } // copy the S2636 images into the main bitmap and check collision - int pixel0 = s2636_0_bitmap.pix16(y, x); - int pixel1 = s2636_1_bitmap.pix16(y, x); - int pixel2 = s2636_2_bitmap.pix16(y, x); + int const pixel0 = s2636_0_bitmap.pix(y, x); + int const pixel1 = s2636_1_bitmap.pix(y, x); + int const pixel2 = s2636_2_bitmap.pix(y, x); - int pixel = pixel0 | pixel1 | pixel2; + int const pixel = pixel0 | pixel1 | pixel2; if (S2636_IS_PIXEL_DRAWN(pixel)) { @@ -164,7 +162,7 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; } - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } @@ -176,8 +174,6 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // astrowar has only one S2636 - int x, y; - bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect); bitmap.fill(0, cliprect); @@ -185,43 +181,43 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { // draw bullets (guesswork) if (m_bullet_ram[y]) { - uint8_t pos = m_bullet_ram[y] ^ 0xff; + uint8_t const pos = m_bullet_ram[y] ^ 0xff; // background vs. bullet collision detection - if (m_temp_bitmap.pix16(y, pos) & 1) + if (m_temp_bitmap.pix(y, pos) & 1) m_collision_register |= 0x02; // bullet size/color/priority is guessed - bitmap.pix16(y, pos) = BULLET_PEN; - if (pos) bitmap.pix16(y, pos-1) = BULLET_PEN; + bitmap.pix(y, pos) = BULLET_PEN; + if (pos) bitmap.pix(y, pos-1) = BULLET_PEN; } - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { // NOTE: similar to zac2650.c, the sprite chip runs at a different frequency than the background generator // the exact timing ratio is unknown, so we'll have to do with guesswork - float s_ratio = 256.0f / 196.0f; + float const s_ratio = 256.0f / 196.0f; - float sx = x * s_ratio; + float const sx = x * s_ratio; if (int(sx + 0.5f) > cliprect.right()) break; // copy the S2636 bitmap into the main bitmap and check collision - int pixel = s2636_0_bitmap.pix16(y, x); + int const pixel = s2636_0_bitmap.pix(y, x); if (S2636_IS_PIXEL_DRAWN(pixel)) { // S2636 vs. background collision detection - if ((m_temp_bitmap.pix16(y, int(sx)) | m_temp_bitmap.pix16(y, int(sx + 0.5f))) & 1) + if ((m_temp_bitmap.pix(y, int(sx)) | m_temp_bitmap.pix(y, int(sx + 0.5f))) & 1) m_collision_register |= 0x01; - bitmap.pix16(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; - bitmap.pix16(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } diff --git a/src/mame/video/galaxian.cpp b/src/mame/video/galaxian.cpp index 51395d7a521..7f6d24c192c 100644 --- a/src/mame/video/galaxian.cpp +++ b/src/mame/video/galaxian.cpp @@ -905,7 +905,7 @@ void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) - bitmap.pix32(y, m_x_scale*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ star = m_stars[star_offs++]; @@ -913,8 +913,8 @@ void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) { - bitmap.pix32(y, m_x_scale*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, m_x_scale*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 2) = m_star_color[star & 0x3f]; } } } @@ -1150,15 +1150,15 @@ inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rect x *= m_x_scale; x += m_h0_start; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; x++; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; x++; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/video/galaxold.cpp b/src/mame/video/galaxold.cpp index 51b18fc6b55..7f3a46a8238 100644 --- a/src/mame/video/galaxold.cpp +++ b/src/mame/video/galaxold.cpp @@ -531,16 +531,13 @@ VIDEO_START_MEMBER(galaxold_state,pisces) #ifdef UNUSED_FUNCTION void galaxold_state::theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i; - - /* same as Galaxian, but all bullets are yellow */ - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { x--; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = BULLETS_COLOR_BASE; + bitmap.pix(y, x) = BULLETS_COLOR_BASE; } } @@ -1040,22 +1037,16 @@ void galaxold_state::drivfrcg_modify_color(uint8_t *color) void galaxold_state::galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i; - - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { x--; if (cliprect.contains(x, y)) { - int color; - - /* yellow missile, white shells (this is the terminology on the schematics) */ - color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); + int const color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } } @@ -1068,7 +1059,7 @@ void galaxold_state::scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangl if (cliprect.contains(x, y)) /* yellow bullets */ - bitmap.pix16(y, x) = BULLETS_COLOR_BASE; + bitmap.pix(y, x) = BULLETS_COLOR_BASE; } void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) @@ -1078,32 +1069,32 @@ void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle x = x - 6; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 32 + m_darkplnt_bullet_color; + bitmap.pix(y, x) = 32 + m_darkplnt_bullet_color; } void galaxold_state::dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i, color; - if (flip_screen_x()) x++; x = x - 6; /* bullets are 2 pixels wide */ - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { + int color; if (offs < 4*4) { color = BULLETS_COLOR_BASE; y--; } - else { + else + { color = BULLETS_COLOR_BASE + 1; x--; } if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } @@ -1368,7 +1359,7 @@ void galaxold_state::plot_star(bitmap_ind16 &bitmap, int x, int y, int color, co y = 255 - y; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_stars_colors_start + color; + bitmap.pix(y, x) = m_stars_colors_start + color; } void galaxold_state::noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/galaxy.cpp b/src/mame/video/galaxy.cpp index a74a5631566..ab6428a993b 100644 --- a/src/mame/video/galaxy.cpp +++ b/src/mame/video/galaxy.cpp @@ -18,7 +18,6 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) { address_space &space = m_maincpu->space(AS_PROGRAM); - int y, x; if (m_interrupts_enabled == true) { uint8_t dat = BIT(m_latch_value, 2, 4); @@ -43,17 +42,17 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = m_p_chargen[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; m_first = 0; } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; - - m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); - m_bitmap.pix16(y, x ) = BIT(m_code, 7); + int y = m_gal_cnt / 48 - 2; + int x = (m_gal_cnt % 48) * 8; + + m_bitmap.pix(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix(y, x ) = BIT(m_code, 7); } else { // Graphics mode @@ -70,8 +69,8 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = space.read_byte(addr) ^ 0xff; m_first = 0; } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; + int y = m_gal_cnt / 48 - 2; + int x = (m_gal_cnt % 48) * 8; /* hack - until calc of R is fixed in Z80 */ if (x == 11 * 8 && y == 0) @@ -83,14 +82,14 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = 0x00; /* end of hack */ - m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); - m_bitmap.pix16(y, x ) = BIT(m_code, 7); + m_bitmap.pix(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix(y, x ) = BIT(m_code, 7); } } m_gal_cnt++; diff --git a/src/mame/video/galpani2.cpp b/src/mame/video/galpani2.cpp index 2168e2d219a..186be0d1c63 100644 --- a/src/mame/video/galpani2.cpp +++ b/src/mame/video/galpani2.cpp @@ -78,13 +78,13 @@ void galpani2_state::copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const int y = + ( *m_bg8_scrolly[layer] + 0x200 - 0x0f5 ); uint16_t* ram = m_bg8[layer]; - const pen_t *clut = &m_bg8palette->pen(0); + pen_t const *const clut = &m_bg8palette->pen(0); for (int xx = 0; xx < 320; xx++) { for (int yy = 0; yy < 240; yy++) { uint16_t pen = ram[(((y + yy) & 0xff) * 512) + ((x + xx) & 0x1ff)]; - if (pen) bitmap.pix32(yy, xx) = clut[pen & 0xff]; + if (pen) bitmap.pix(yy, xx) = clut[pen & 0xff]; } } } @@ -101,13 +101,13 @@ void galpani2_state::copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const //int x = 0; //int y = 0; - const pen_t *clut = &m_bg15palette->pen(0); + pen_t const *const clut = &m_bg15palette->pen(0); for (int xx = 0; xx < 320; xx++) { for (int yy = 0; yy < 240; yy++) { uint16_t pen = ram[(xx * 0x800) + yy]; - bitmap.pix32(yy, xx) = clut[pen & 0x7fff]; + bitmap.pix(yy, xx) = clut[pen & 0x7fff]; } } } diff --git a/src/mame/video/galpanic.cpp b/src/mame/video/galpanic.cpp index 994ce0b799b..a306fc143b9 100644 --- a/src/mame/video/galpanic.cpp +++ b/src/mame/video/galpanic.cpp @@ -28,18 +28,18 @@ void galpanic_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mas int sy = offset / 256; int sx = offset % 256; - m_bitmap.pix16(sy, sx) = 1024 + (data >> 1); + m_bitmap.pix(sy, sx) = 1024 + (data >> 1); } void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { for (int offs = 0;offs < m_fgvideoram.bytes()/2;offs++) { - int sx = offs % 256; - int sy = offs / 256; - int color = m_fgvideoram[offs]; + int const sx = offs % 256; + int const sy = offs / 256; + int const color = m_fgvideoram[offs]; if (color) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } diff --git a/src/mame/video/galspnbl.cpp b/src/mame/video/galspnbl.cpp index d93f8387511..d1c1c611588 100644 --- a/src/mame/video/galspnbl.cpp +++ b/src/mame/video/galspnbl.cpp @@ -22,7 +22,7 @@ void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cli int const y = offs >> 9; int const x = offs & 0x1ff; - bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1); + bitmap.pix(y, x) = 1024 + (m_bgvideoram[offs] >> 1); } } @@ -36,8 +36,8 @@ void galspnbl_state::mix_sprite_layer(screen_device &screen, bitmap_ind16 &bitma { for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dd = &bitmap.pix16(y); - uint16_t *sd2 = &m_sprite_bitmap.pix16(y); + uint16_t *const dd = &bitmap.pix(y); + uint16_t const *const sd2 = &m_sprite_bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp index 70cfd554ac1..2aed5a48e83 100644 --- a/src/mame/video/gamate.cpp +++ b/src/mame/video/gamate.cpp @@ -274,7 +274,7 @@ uint32_t gamate_video_device::screen_update(screen_device &screen, bitmap_ind16 if (m_displayblank) pix = 0; - bitmap.pix16(y, x) = pix; + bitmap.pix(y, x) = pix; } } diff --git a/src/mame/video/gamecom.cpp b/src/mame/video/gamecom.cpp index ea987a07adc..41403441bbb 100644 --- a/src/mame/video/gamecom.cpp +++ b/src/mame/video/gamecom.cpp @@ -23,9 +23,8 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) } else { - uint8_t *line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; + uint8_t const *const line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; int pal[4]; - int i; switch( m_p_ram[SM8521_LCDC] & 0x30 ) { @@ -54,13 +53,13 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) pal[3] = 0; break; } - for( i = 0; i < 40; i++ ) + for( int i = 0; i < 40; i++ ) { uint8_t p = line[i]; - m_bitmap.pix16(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; - m_bitmap.pix16(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; - m_bitmap.pix16(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; - m_bitmap.pix16(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; + m_bitmap.pix(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; + m_bitmap.pix(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; + m_bitmap.pix(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; + m_bitmap.pix(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; } } diff --git a/src/mame/video/gameplan.cpp b/src/mame/video/gameplan.cpp index 85b8d5216a7..0438c012db5 100644 --- a/src/mame/video/gameplan.cpp +++ b/src/mame/video/gameplan.cpp @@ -96,16 +96,15 @@ void gameplan_state::leprechn_get_pens( pen_t *pens ) uint32_t gameplan_state::screen_update_gameplan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[GAMEPLAN_NUM_PENS]; - offs_t offs; gameplan_get_pens(pens); - for (offs = 0; offs < m_videoram_size; offs++) + for (offs_t offs = 0; offs < m_videoram_size; offs++) { uint8_t y = offs >> 8; uint8_t x = offs & 0xff; - bitmap.pix32(y, x) = pens[m_videoram[offs] & 0x07]; + bitmap.pix(y, x) = pens[m_videoram[offs] & 0x07]; } return 0; @@ -115,16 +114,15 @@ uint32_t gameplan_state::screen_update_gameplan(screen_device &screen, bitmap_rg uint32_t gameplan_state::screen_update_leprechn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[LEPRECHN_NUM_PENS]; - offs_t offs; leprechn_get_pens(pens); - for (offs = 0; offs < m_videoram_size; offs++) + for (offs_t offs = 0; offs < m_videoram_size; offs++) { uint8_t y = offs >> 8; uint8_t x = offs & 0xff; - bitmap.pix32(y, x) = pens[m_videoram[offs] & (LEPRECHN_NUM_PENS-1)]; + bitmap.pix(y, x) = pens[m_videoram[offs] & (LEPRECHN_NUM_PENS-1)]; } return 0; diff --git a/src/mame/video/gaplus.cpp b/src/mame/video/gaplus.cpp index 2691ff9bedc..ff72474ac4e 100644 --- a/src/mame/video/gaplus.cpp +++ b/src/mame/video/gaplus.cpp @@ -262,7 +262,7 @@ void gaplus_base_state::starfield_render(bitmap_ind16 &bitmap) if (x >= 0 && x < width && y >= 0 && y < height) { - bitmap.pix16(y, x) = m_stars[i].col; + bitmap.pix(y, x) = m_stars[i].col; } } } diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp index 87120366b7a..08603b09784 100644 --- a/src/mame/video/gauntlet.cpp +++ b/src/mame/video/gauntlet.cpp @@ -168,8 +168,8 @@ uint32_t gauntlet_state::screen_update_gauntlet(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/gic.cpp b/src/mame/video/gic.cpp index 9f9f8d8aff8..320b862d920 100644 --- a/src/mame/video/gic.cpp +++ b/src/mame/video/gic.cpp @@ -147,7 +147,7 @@ void gic_device::draw_char_left(int startx, int starty, uint8_t code, bitmap_ind uint8_t curry= starty+y; for(uint8_t x=0x20;x!=0;x=x/2){ if (current&x) - m_bitmap.pix16(curry,startx+nextx) = GIC_WHITE; + m_bitmap.pix(curry,startx+nextx) = GIC_WHITE; nextx++; } } @@ -161,15 +161,15 @@ void gic_device::draw_char_right(int startx, int starty, uint8_t code, bitmap_in uint8_t nextx=0; uint8_t curry= starty+y; - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; nextx++; for(uint8_t x=0x20;x!=0;x=x/2){ - m_bitmap.pix16(curry,startx+nextx) = (current&x)?GIC_WHITE:bg_col; + m_bitmap.pix(curry,startx+nextx) = (current&x)?GIC_WHITE:bg_col; nextx++; } - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; nextx++; - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; } } diff --git a/src/mame/video/gladiatr.cpp b/src/mame/video/gladiatr.cpp index 378c32228c2..bda3c5ed176 100644 --- a/src/mame/video/gladiatr.cpp +++ b/src/mame/video/gladiatr.cpp @@ -278,10 +278,10 @@ uint32_t ppking_state::screen_update_ppking(screen_device &screen, bitmap_ind16 int x = sx; int y = (sy + m_fg_scrolly) & 0x1ff; - uint16_t *dest = &bitmap.pix16(sy, sx); + uint16_t *dest = &bitmap.pix(sy, sx); while( x <= cliprect.max_x ) { - if( flagsbitmap.pix8(y, x)&TILEMAP_PIXEL_LAYER0 ) + if( flagsbitmap.pix(y, x)&TILEMAP_PIXEL_LAYER0 ) { *dest += 512; } diff --git a/src/mame/video/glass.cpp b/src/mame/video/glass.cpp index f0e0d89e453..c20835ac0f6 100644 --- a/src/mame/video/glass.cpp +++ b/src/mame/video/glass.cpp @@ -69,19 +69,17 @@ void glass_state::blitter_w(uint16_t data) /* fill the screen bitmap with the current picture */ { - int i, j; - - uint8_t *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; + uint8_t const *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; if ((m_blitter_command & 0x18) != 0) { - for (j = 0; j < 200; j++) + for (int j = 0; j < 200; j++) { - for (i = 0; i < 320; i++) + for (int i = 0; i < 320; i++) { - int color = *gfx; + int const color = *gfx; gfx++; - m_screen_bitmap->pix16(j, i) = color & 0xff; + m_screen_bitmap->pix(j, i) = color & 0xff; } } } diff --git a/src/mame/video/gomoku.cpp b/src/mame/video/gomoku.cpp index d9e3c77560b..17d6c6266af 100644 --- a/src/mame/video/gomoku.cpp +++ b/src/mame/video/gomoku.cpp @@ -121,7 +121,7 @@ void gomoku_state::video_start() if (bgdata & 0x01) color = 0x21; // board (brown) if (bgdata & 0x02) color = 0x20; // frame line (while) - m_bg_bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + m_bg_bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } @@ -170,7 +170,7 @@ uint32_t gomoku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else continue; - bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } @@ -198,7 +198,7 @@ uint32_t gomoku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else continue; - bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } } diff --git a/src/mame/video/gp9001.cpp b/src/mame/video/gp9001.cpp index 6a42ea9c6e7..04e9cac909a 100644 --- a/src/mame/video/gp9001.cpp +++ b/src/mame/video/gp9001.cpp @@ -778,8 +778,8 @@ void gp9001vdp_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip if (cliprect.contains(drawxx, drawyy)) { const u8 pix = srcdata[count]; - u16* dstptr = &bitmap.pix16(drawyy, drawxx); - u8* dstpri = &this->custom_priority_bitmap->pix8(drawyy, drawxx); + u16 *const dstptr = &bitmap.pix(drawyy, drawxx); + u8 *const dstpri = &this->custom_priority_bitmap->pix(drawyy, drawxx); if (priority >= dstpri[0]) { @@ -820,9 +820,9 @@ void gp9001vdp_device::draw_custom_tilemap( bitmap_ind16 &bitmap, const rectangl { const int realy = (y + scrolly) & 0x1ff; - u16* srcptr = &tmb.pix16(realy); - u16* dstptr = &bitmap.pix16(y); - u8* dstpriptr = &this->custom_priority_bitmap->pix8(y); + u16 const *const srcptr = &tmb.pix(realy); + u16 *const dstptr = &bitmap.pix(y); + u8 *const dstpriptr = &this->custom_priority_bitmap->pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/grchamp.cpp b/src/mame/video/grchamp.cpp index 32a359f7b87..c684ae199cb 100644 --- a/src/mame/video/grchamp.cpp +++ b/src/mame/video/grchamp.cpp @@ -115,15 +115,13 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) const rectangle &visarea = m_screen->visible_area(); int y0 = 240 - m_cpu0_out[3]; int x0 = 256 - m_cpu0_out[2]; - int x,y,sx,sy; - int pixel; int result = 0; if( which==0 ) { /* draw the current player sprite into a work bitmap */ - m_gfxdecode->gfx(4)->opaque(m_work_bitmap, + m_gfxdecode->gfx(4)->opaque(m_work_bitmap, m_work_bitmap.cliprect(), m_cpu0_out[4]&0xf, 1, /* color */ @@ -131,28 +129,28 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) 0,0 ); } - for( y = 0; y <32; y++ ) + for( int y = 0; y <32; y++ ) { - for( x = 0; x<32; x++ ) + for( int x = 0; x<32; x++ ) { - pixel = m_work_bitmap.pix16(y, x); - if( pixel != sprite_transp ){ - sx = x+x0; - sy = y+y0; + int pixel = m_work_bitmap.pix(y, x); + if( pixel != sprite_transp ) + { + int sx = x+x0; + int sy = y+y0; if(visarea->contains(sx, sy)) { // Collision check uses only 16 pens! - pixel = bitmap.pix16(sy, sx) % 16; + pixel = bitmap.pix(sy, sx) % 16; if( pixel != bgcolor ) { result = 1; /* flag collision */ /* wipe this pixel, so collision checks with the ** next layer work */ - bitmap.pix16(sy, sx) = bgcolor; + bitmap.pix(sy, sx) = bgcolor; } } } - } } return result?(1<<which):0; @@ -160,17 +158,15 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) void grchamp_state::draw_fog(bitmap_ind16 &bitmap, const rectangle &cliprect, int fog) { - int x,y,offs; - // Emulation of analog fog effect - for (x = 0; x < 100; x++) + for (int x = 0; x < 100; x++) { - offs = 0x40; + int offs = 0x40; if(x > (100-FOG_SIZE-1)) offs = 0x40*(x-(100-FOG_SIZE-1)); - for(y=16;y<240;y++) + for(int y=16;y<240;y++) { - bitmap.pix16(y, x) = bitmap.pix16(y, x) + offs; + bitmap.pix(y, x) = bitmap.pix(y, x) + offs; } } } @@ -179,8 +175,8 @@ void grchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect { gfx_element *gfx = m_gfxdecode->gfx(5); int bank = (m_cpu0_out[0] & 0x20) ? 0x40 : 0x00; - const uint8_t *source = m_spriteram + 0x40; - const uint8_t *finish = source + 0x40; + uint8_t const *source = m_spriteram + 0x40; + uint8_t const *const finish = source + 0x40; while (source < finish) { @@ -189,7 +185,7 @@ void grchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int color = source[2]; int code = source[1); - gfx->transpen(bitmap,cliprect, + gfx->transpen(bitmap,cliprect, bank + (code & 0x3f), color, code & 0x40, @@ -241,14 +237,13 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) const uint8_t *prom = memregion("proms")->base() + 0x20; gfx_element *gfx; int change = (m_cpu0_out[0] & 0x20) << 3; - int num; /* first clear to 0; this is done as the previous scanline was scanned */ memset(objdata, 0, 256); /* now draw the sprites; this is done during HBLANK */ gfx = m_gfxdecode->gfx(4); - for (num = 0; num < 16; num++) + for (int num = 0; num < 16; num++) { /* Each sprite is 4 bytes. The logic reads one byte every 2H: @@ -278,10 +273,9 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) /* the fourth byte is the X position */ int sx = m_spriteram[0x43 + dataoffs]; - int x; /* draw 16 pixels */ - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { int dx = ~(x + sx) & 0xff; @@ -300,7 +294,7 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) /* finally draw the text characters; this is done as we read out the object buffers */ gfx = m_gfxdecode->gfx(0); - for (num = 0; num < 32; num++) + for (int num = 0; num < 32; num++) { /* The logic reads one byte every 4H, 64 bytes total: @@ -316,10 +310,9 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) int color = (m_spriteram[0x01 + dataoffs] & 0x07) << 2; int code = m_videoram[hprime | ((dy & 0xf8) << 2)] + change; const uint8_t *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes(); - int x; /* draw 8 pixels */ - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { int pix = src[x ^ 7]; @@ -356,74 +349,67 @@ uint32_t grchamp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma rgb_t(RGB_MAX,RGB_MAX,RGB_MAX) }; - const pen_t *bgpen = m_palette->pens(); - const uint8_t *amedata = memregion("gfx5")->base(); - const uint8_t *headdata = memregion("gfx6")->base(); - const uint8_t *pldata = memregion("gfx7")->base(); - bitmap_ind16 &lpixmap = m_left_tilemap->pixmap(); - bitmap_ind16 &rpixmap = m_right_tilemap->pixmap(); - bitmap_ind16 &cpixmap = m_center_tilemap->pixmap(); - int lrxscroll, cxscroll, lyscroll, ryscroll, cyscroll; + pen_t const *const bgpen = m_palette->pens(); + uint8_t const *const amedata = memregion("gfx5")->base(); + uint8_t const *const headdata = memregion("gfx6")->base(); + uint8_t const *const pldata = memregion("gfx7")->base(); + bitmap_ind16 const &lpixmap = m_left_tilemap->pixmap(); + bitmap_ind16 const &rpixmap = m_right_tilemap->pixmap(); + bitmap_ind16 const &cpixmap = m_center_tilemap->pixmap(); int bgcolor = m_cpu1_out[3] & 0x10; int amebase = m_cpu0_out[4] >> 4; int plbase = m_cpu0_out[4] & 0x0f; - int cxmask; - int x, y; /* ensure that the tilemaps are the same size */ assert(lpixmap.width() == rpixmap.width() && lpixmap.width() == cpixmap.width()); assert(lpixmap.height() == rpixmap.height() && lpixmap.height() == cpixmap.height()); /* extract background scroll values; left and right share the same X scroll */ - lrxscroll = m_cpu1_out[0] + (m_cpu1_out[1] & 1) * 256; - lyscroll = m_cpu1_out[2]; - ryscroll = m_cpu1_out[7]; - cxscroll = m_cpu1_out[9] + (m_cpu1_out[10] & 1) * 256; - cyscroll = m_cpu1_out[11]; + int lrxscroll = m_cpu1_out[0] + (m_cpu1_out[1] & 1) * 256; + int lyscroll = m_cpu1_out[2]; + int ryscroll = m_cpu1_out[7]; + int cxscroll = m_cpu1_out[9] + (m_cpu1_out[10] & 1) * 256; + int cyscroll = m_cpu1_out[11]; /* determine the center background mask, controlled by attribute bit 0x20 */ - cxmask = (m_cpu1_out[3] & 0x20) ? 0xff : 0x1ff; + int cxmask = (m_cpu1_out[3] & 0x20) ? 0xff : 0x1ff; /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { /* select either left or right tilemaps based on Y */ - bitmap_ind16 &lrpixmap = (y < 128) ? lpixmap : rpixmap; + bitmap_ind16 const &lrpixmap = (y < 128) ? lpixmap : rpixmap; int lryscroll = (y < 128) ? lyscroll : ryscroll; /* get source/dest pointers */ /* the Y counter starts counting when VBLANK goes to 0, which is at Y=16 */ - uint16_t *lrsrc = &lrpixmap.pix16((lryscroll + y - 16) & 0xff); - uint16_t *csrc = &cpixmap.pix16((cyscroll + y - 16) & 0xff); - uint32_t *dest = &bitmap.pix32(y); + uint16_t const *const lrsrc = &lrpixmap.pix((lryscroll + y - 16) & 0xff); + uint16_t const *const csrc = &cpixmap.pix((cyscroll + y - 16) & 0xff); + uint32_t *const dest = &bitmap.pix(y); uint8_t objdata[256]; /* draw the objects for this scanline */ draw_objects(y, objdata); /* iterate over columns */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - rgb_t finalpix; int headbit = 0; int kill = 0; - int mydh, mydv; - int objpix; - int mvid; /* the X counter starts counting when HSYNC goes to 0 */ /* HYSYNC is high from X=304 through X=336; this means it has */ /* been counting from 336 through 384 before HBLANK is low */ - mvid = csrc[(cxscroll + x + (384-336)) & cxmask]; + int mvid = csrc[(cxscroll + x + (384-336)) & cxmask]; if ((mvid & 0x0f) == 0) mvid = lrsrc[(lrxscroll + x + (384-336)) & 0x1ff]; /* objdata contains the REDA/GREENA/BLUEA states */ - objpix = objdata[x]; + int objpix = objdata[x]; /* if the headlamp is visible, determine that now */ - mydh = (m_cpu0_out[2] - x) & 0xff; - mydv = (m_cpu0_out[3] - (y - 16)) & 0xff; + int mydh = (m_cpu0_out[2] - x) & 0xff; + int mydv = (m_cpu0_out[3] - (y - 16)) & 0xff; if ((m_cpu0_out[0] & 0x10) && (mydh & 0xc0) == 0xc0 && ((mydv ^ (mydv >> 1)) & 0x40) == 0) { int bits = headdata[((mydh & 0x38) >> 3) | @@ -490,7 +476,7 @@ uint32_t grchamp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* handle collision detection between MVID and OBJECT */ if (!(m_collide & 0x1000) && (objpix & 0x08) && (mvid & 0x0f) != 0) { -osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); + osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); m_collide = 0x1000 | 0x8000 | ((~y & 0x80) << 3) | ((~y & 0xf8) << 2) | ((~x & 0xf8) >> 3); } @@ -514,6 +500,8 @@ osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); real headlamp effect */ + rgb_t finalpix; + /* if the object data is non-zero, it gets priority */ if ((objpix & 7) != 0) finalpix = objpix_lookup[objpix & 7]; diff --git a/src/mame/video/gridlee.cpp b/src/mame/video/gridlee.cpp index 9a665c204b6..b5e4cf5320a 100644 --- a/src/mame/video/gridlee.cpp +++ b/src/mame/video/gridlee.cpp @@ -128,12 +128,10 @@ void gridlee_state::gridlee_palette_select_w(uint8_t data) uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const pen_t *pens = &m_palette->pen(m_palettebank_vis * 32); - uint8_t *gfx; - int x, y, i; + pen_t const *const pens = &m_palette->pen(m_palettebank_vis * 32); /* draw scanlines from the VRAM directly */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { /* non-flipped: draw directly from the bitmap */ if (!m_cocktail_flip) @@ -144,29 +142,27 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 { int srcy = GRIDLEE_VBSTART - 1 - y; uint8_t temp[256]; - int xx; - for (xx = 0; xx < 256; xx++) + for (int xx = 0; xx < 256; xx++) temp[xx] = m_local_videoram[srcy * 256 + 255 - xx]; draw_scanline8(bitmap, 0, y, 256, temp, pens + 16); } } /* draw the sprite images */ - gfx = memregion("gfx1")->base(); - for (i = 0; i < 32; i++) + uint8_t const *const gfx = memregion("gfx1")->base(); + for (int i = 0; i < 32; i++) { - uint8_t *sprite = m_spriteram + i * 4; - uint8_t *src; + const uint8_t *sprite = m_spriteram + i * 4; int image = sprite[0]; int ypos = sprite[2] + 17 + GRIDLEE_VBEND; int xpos = sprite[3]; /* get a pointer to the source image */ - src = &gfx[64 * image]; + const uint8_t *src = &gfx[64 * image]; /* loop over y */ - for (y = 0; y < 16; y++, ypos = (ypos + 1) & 255) + for (int y = 0; y < 16; y++, ypos = (ypos + 1) & 255) { int currxor = 0; @@ -182,7 +178,7 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 int currx = xpos; /* loop over x */ - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { int ipixel = *src++; int left = ipixel >> 4; @@ -190,12 +186,12 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 /* left pixel */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx ^ currxor) = pens[left]; + bitmap.pix(ypos, currx ^ currxor) = pens[left]; currx++; /* right pixel */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx ^ currxor) = pens[right]; + bitmap.pix(ypos, currx ^ currxor) = pens[right]; currx++; } } diff --git a/src/mame/video/h01x.cpp b/src/mame/video/h01x.cpp index f5fac3b4f4e..900dee4b01d 100644 --- a/src/mame/video/h01x.cpp +++ b/src/mame/video/h01x.cpp @@ -10,28 +10,27 @@ uint32_t h01x_state::screen_update_h01x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx; - uint16_t sy=0,ma=0,x; - uint8_t skip = 16; + uint16_t sy=0; + uint8_t const skip = 16; //screen.set_visible_area(0, 336-1, 0, 192-1); // 336*192 = 84*4 * 12*16 // 12*16*84 - // uint16_t *p = &bitmap.pix16(sy++); + // uint16_t *p = &bitmap.pix(sy++); // _PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<_PixelType *>(m_base) + y * m_rowpixels + x); } // set_raw(u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) // bitmap.rowpixels() == htotal // printf("%d ", bitmap.rowpixels()); - //uint16_t *p = &bitmap.pix16(0); - for(ra=0; ra<12; ra++) { - for(y=0; y<16; y++) { - ma = ra*84*16+y; - uint16_t *p = &bitmap.pix16(sy++); - for(x=ma; x<ma+84*skip; x+=skip) { - gfx = m_vram_ptr[x]; + //uint16_t *p = &bitmap.pix(0); + for(uint8_t ra=0; ra<12; ra++) { + for(uint8_t y=0; y<16; y++) { + uint16_t const ma = ra*84*16+y; + uint16_t *p = &bitmap.pix(sy++); + for(uint16_t x=ma; x<ma+84*skip; x+=skip) { + uint8_t const gfx = m_vram_ptr[x]; *p++ = BIT(gfx, 3); *p++ = BIT(gfx, 2); *p++ = BIT(gfx, 1); diff --git a/src/mame/video/harddriv.cpp b/src/mame/video/harddriv.cpp index 1a3b8b0f535..b8277e1d88d 100644 --- a/src/mame/video/harddriv.cpp +++ b/src/mame/video/harddriv.cpp @@ -409,15 +409,13 @@ static void display_speedups(void) TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) { - uint8_t *vram_base = &m_gsp_vram[(params->rowaddr << 12) & m_vram_mask]; + if (!m_gsp_vram) return; + uint8_t const *const vram_base = &m_gsp_vram[(params->rowaddr << 12) & m_vram_mask]; - if (!vram_base) return; - - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = (params->yoffset << 9) + ((params->coladdr & 0xff) << 4) - 15 + (m_gfx_finescroll & 0x0f); - int x; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0xfff)]; if (scanline == screen.visible_area().bottom()) @@ -427,15 +425,13 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_multisync) { - uint8_t *vram_base = &m_gsp_vram[(params->rowaddr << 11) & m_vram_mask]; - - if (!vram_base) return; + if (!m_gsp_vram) return; + uint8_t const *const vram_base = &m_gsp_vram[(params->rowaddr << 11) & m_vram_mask]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = (params->yoffset << 9) + ((params->coladdr & 0xff) << 3) - 7 + (m_gfx_finescroll & 0x07); - int x; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0x7ff)]; if (scanline == screen.visible_area().bottom()) diff --git a/src/mame/video/hec2hrp.cpp b/src/mame/video/hec2hrp.cpp index 9212b796b80..77011d332fe 100644 --- a/src/mame/video/hec2hrp.cpp +++ b/src/mame/video/hec2hrp.cpp @@ -45,7 +45,7 @@ void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, uint8_t *page, int ymax, int int ma = 0; for (int y = 0; y <= ymax; y++) { - uint16_t *pix = &bitmap.pix16(sy++); + uint16_t *pix = &bitmap.pix(sy++); for (int x = ma; x < ma + yram; x++) { uint8_t gfx = *(page + x); @@ -71,7 +71,7 @@ void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, uint8_t *page, int ymax, in int ma = 0; for (int y = 0; y <= ymax; y++) { - uint16_t *pix = &bitmap.pix16(sy++); + uint16_t *pix = &bitmap.pix(sy++); for (int x = ma; x < ma + yram; x++) { uint8_t gfx = *(page + x); diff --git a/src/mame/video/hnayayoi.cpp b/src/mame/video/hnayayoi.cpp index ec3c6f95924..8afb5f9359b 100644 --- a/src/mame/video/hnayayoi.cpp +++ b/src/mame/video/hnayayoi.cpp @@ -200,7 +200,7 @@ void hnayayoi_state::draw_layer_interleaved(bitmap_rgb32 &bitmap, const rectangl { uint8_t *src1 = &m_pixmap[left_pixmap][(row & 255) * 256]; uint8_t *src2 = &m_pixmap[right_pixmap][(row & 255) * 256]; - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); const pen_t *pal = &m_palette->pens()[palbase * 16]; diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp index 5b24b36ae62..86d76c647a6 100644 --- a/src/mame/video/hng64.cpp +++ b/src/mame/video/hng64.cpp @@ -240,11 +240,11 @@ do { void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t *tmap, const blit_parameters *blit, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound) { - const pen_t *clut = &m_palette->pen(blit->tilemap_priority_code >> 16); + pen_t const *const clut = &m_palette->pen(blit->tilemap_priority_code >> 16); bitmap_ind8 &priority_bitmap = screen.priority(); bitmap_rgb32 &destbitmap = *blit->bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - bitmap_ind8 &flagsmap = tmap->flagsmap(); + const bitmap_ind16 &srcbitmap = tmap->pixmap(); + const bitmap_ind8 &flagsmap = tmap->flagsmap(); const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; @@ -253,27 +253,16 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * uint8_t mask = blit->mask; uint8_t value = blit->value; uint8_t alpha = blit->alpha; - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; - uint32_t *dest; - uint8_t *pri; - const uint16_t *src; - const uint8_t *maskptr; /* pre-advance based on the cliprect */ startx += blit->cliprect.min_x * incxx + blit->cliprect.min_y * incyx; starty += blit->cliprect.min_x * incxy + blit->cliprect.min_y * incyy; /* extract start/end points */ - sx = blit->cliprect.min_x; - sy = blit->cliprect.min_y; - ex = blit->cliprect.max_x; - ey = blit->cliprect.max_y; + int sx = blit->cliprect.min_x; + int sy = blit->cliprect.min_y; + int ex = blit->cliprect.max_x; + int ey = blit->cliprect.max_y; /* optimized loop for the not rotated case */ if (incxy == 0 && incyx == 0 && !wraparound) @@ -296,15 +285,15 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * if (starty < heightshifted) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty >> 16; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty >> 16; /* get source and priority pointers */ - pri = &priority_bitmap.pix8(sy, sx); - src = &srcbitmap.pix16(cy); - maskptr = &flagsmap.pix8(cy); - dest = &destbitmap.pix32(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); + uint16_t const *const src = &srcbitmap.pix(cy); + uint8_t const *const maskptr = &flagsmap.pix(cy); + uint32_t *dest = &destbitmap.pix(sy, sx); /* loop over columns */ while (x <= ex && cx < widthshifted) @@ -337,21 +326,21 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * while (sy <= ey) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; /* get dest and priority pointers */ - dest = &destbitmap.pix32(sy, sx); - pri = &priority_bitmap.pix8(sy, sx); + uint32_t *dest = &destbitmap.pix(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) { /* plot if we match the mask */ - if ((flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); *pri = (*pri & (priority >> 8)) | priority; } @@ -377,22 +366,22 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * while (sy <= ey) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; /* get dest and priority pointers */ - dest = &destbitmap.pix32(sy, sx); - pri = &priority_bitmap.pix8(sy, sx); + uint32_t *dest = &destbitmap.pix(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) { /* plot if we're within the bitmap and we match the mask */ if (cx < widthshifted && cy < heightshifted) - if ((flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix16(cy >> 16, cx >> 16)); + HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix(cy >> 16, cx >> 16)); *pri = (*pri & (priority >> 8)) | priority; } @@ -573,11 +562,7 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, } // Set the transmask so our manual copy is correct - int transmask = 0x00; - if (bppBit) - transmask = 0xff; - else - transmask = 0xf; + const int transmask = bppBit ? 0xff : 0xf; if (floorModeBit == 0x0000) { @@ -614,7 +599,7 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, //if (lineCount < visarea.height()) //{ // for (int ii = 0; ii < visarea.width(); ii++) - // bitmap.pix32((visarea.height()-lineCount), ii) = 0xff00ff00; + // bitmap.pix((visarea.height()-lineCount), ii) = 0xff00ff00; //} // HACK : Clear RAM - this is "needed" in fatfurwa since it doesn't clear its own ram (buriki does) @@ -654,13 +639,13 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, // } // else // 'simple' mode with linescroll, used in some ss64_2 levels (assumed to be correct, but doesn't do much with it.. so could be wrong) { - int32_t xtopleft, xmiddle; - int32_t ytopleft, ymiddle; - for (int line=0; line < 448; line++) { clip.min_y = clip.max_y = line; + int32_t xtopleft, xmiddle; + int32_t ytopleft, ymiddle; + if (global_zoom_disable) // disable all scrolling / zoom (test screen) (maybe) { // If this bit is active the scroll registers don't seem valid at all? @@ -713,10 +698,6 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, */ - int32_t xtopleft,xmiddle, xalt; - int32_t ytopleft,ymiddle, yalt; - int xinc, xinc2, yinc, yinc2; - #if HNG64_VIDEO_DEBUG if (0) if (tm==2) @@ -732,53 +713,44 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, /*m_videoram[(0x4001c+(scrollbase<<4))/4]);*/ // unused? (dupe value on fatfurwa, 00 on rest) #endif + int32_t xtopleft = (m_videoram[(0x40000+(scrollbase<<4))/4]); + const int32_t xalt = (m_videoram[(0x40004+(scrollbase<<4))/4]); // middle screen point + const int32_t xmiddle = (m_videoram[(0x40010+(scrollbase<<4))/4]); - xtopleft = (m_videoram[(0x40000+(scrollbase<<4))/4]); - xalt = (m_videoram[(0x40004+(scrollbase<<4))/4]); // middle screen point - xmiddle = (m_videoram[(0x40010+(scrollbase<<4))/4]); - - ytopleft = (m_videoram[(0x40008+(scrollbase<<4))/4]); - yalt = (m_videoram[(0x40018+(scrollbase<<4))/4]); // middle screen point - ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); - - xinc = (xmiddle - xtopleft) / 512; - yinc = (ymiddle - ytopleft) / 512; - xinc2 = (xalt-xtopleft) / 512; - yinc2 = (yalt-ytopleft) /512; + int32_t ytopleft = (m_videoram[(0x40008+(scrollbase<<4))/4]); + const int32_t yalt = (m_videoram[(0x40018+(scrollbase<<4))/4]); // middle screen point + const int32_t ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); + const int xinc = (xmiddle - xtopleft) / 512; + const int yinc = (ymiddle - ytopleft) / 512; + const int xinc2 = (xalt-xtopleft) / 512; + const int yinc2 = (yalt-ytopleft) /512; /* manual copy = slooow */ if (BLEND_TEST) { - bitmap_ind16 &bm = tilemap->pixmap(); - int bmheight = bm.height(); - int bmwidth = bm.width(); - const pen_t *paldata = m_palette->pens(); - uint32_t* dstptr; - uint16_t* srcptr; - int xx,yy; - + const bitmap_ind16 &bm = tilemap->pixmap(); + const int bmheight = bm.height(); + const int bmwidth = bm.width(); + pen_t const *const paldata = m_palette->pens(); - int tmp = xtopleft; - int tmp2 = ytopleft; //printf("start %08x end %08x start %08x end %08x\n", xtopleft, xmiddle, ytopleft, ymiddle); - for (yy=0;yy<448;yy++) + for (int yy=0; yy<448; yy++) { - dstptr = &bitmap.pix32(yy); + uint32_t *dstptr = &bitmap.pix(yy); - tmp = xtopleft; - tmp2 = ytopleft; + int tmp = xtopleft; + int tmp2 = ytopleft; - for (xx=0;xx<512;xx++) + for (int xx=0; xx<512; xx++) { int realsrcx = (xtopleft>>16)&(bmwidth-1); int realsrcy = (ytopleft>>16)&(bmheight-1); - uint16_t pen; - srcptr = &bm.pix16(realsrcy); + uint16_t const *const srcptr = &bm.pix(realsrcy); - pen = srcptr[realsrcx]; + uint16_t pen = srcptr[realsrcx]; if (pen&transmask) *dstptr = paldata[pen]; @@ -807,10 +779,6 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, /* in this mode they can only specify the top left and middle screen points for each tilemap, this allows simple zooming, but not rotation */ - int32_t xtopleft,xmiddle; - int32_t ytopleft,ymiddle; - int xinc,yinc; - #if HNG64_VIDEO_DEBUG if (0) if (tm==2) @@ -821,6 +789,9 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, m_videoram[(0x4001c+(scrollbase<<4))/4]); #endif + int32_t xtopleft,xmiddle; + int32_t ytopleft,ymiddle; + if (global_zoom_disable) // disable all scrolling / zoom (test screen) (maybe) { /* If this bit is active the scroll registers don't seem valid at all? @@ -842,40 +813,35 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); // middle screen point } - xinc = (xmiddle - xtopleft) / 512; - yinc = (ymiddle - ytopleft) / 512; + const int xinc = (xmiddle - xtopleft) / 512; + const int yinc = (ymiddle - ytopleft) / 512; /* manual copy = slooow */ if (BLEND_TEST) { - bitmap_ind16 &bm = tilemap->pixmap(); - int bmheight = bm.height(); - int bmwidth = bm.width(); - const pen_t *paldata = m_palette->pens(); - uint32_t* dstptr; - uint16_t* srcptr; - int xx,yy; + const bitmap_ind16 &bm = tilemap->pixmap(); + const int bmheight = bm.height(); + const int bmwidth = bm.width(); + pen_t const *const paldata = m_palette->pens(); int tmp = xtopleft; //printf("start %08x end %08x start %08x end %08x\n", xtopleft, xmiddle, ytopleft, ymiddle); - for (yy=0;yy<448;yy++) + for (int yy=0; yy<448; yy++) { int realsrcy = (ytopleft>>16)&(bmheight-1); - dstptr = &bitmap.pix32(yy); - srcptr = &bm.pix16(realsrcy); + uint32_t *dstptr = &bitmap.pix(yy); + uint16_t const *const srcptr = &bm.pix(realsrcy); xtopleft = tmp; - for (xx=0;xx<512;xx++) + for (int xx=0; xx<512; xx++) { int realsrcx = (xtopleft>>16)&(bmwidth-1); - uint16_t pen; - - pen = srcptr[realsrcx]; + uint16_t pen = srcptr[realsrcx]; if (pen&transmask) *dstptr = paldata[pen]; @@ -980,15 +946,13 @@ uint32_t hng64_state::screen_update_hng64(screen_device &screen, bitmap_rgb32 &b // 3d gets drawn next if(!(m_fbcontrol[0] & 0x01)) { - int x, y; - // Blit the color buffer into the primary bitmap - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *src = &m_poly_renderer->colorBuffer3d().pix32(y, cliprect.min_x); - uint32_t *dst = &bitmap.pix32(y, cliprect.min_x); + const uint32_t *src = &m_poly_renderer->colorBuffer3d().pix(y, cliprect.min_x); + uint32_t *dst = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if(*src & 0xff000000) *dst = *src; @@ -1139,13 +1103,12 @@ void hng64_state::tcram_w(offs_t offset, uint32_t data, uint32_t mem_mask) if(offset == 0x02) { - uint16_t min_x, min_y, max_x, max_y; rectangle visarea = m_screen->visible_area(); - min_x = (hng64_tcram[1] & 0xffff0000) >> 16; - min_y = (hng64_tcram[1] & 0x0000ffff) >> 0; - max_x = (hng64_tcram[2] & 0xffff0000) >> 16; - max_y = (hng64_tcram[2] & 0x0000ffff) >> 0; + const uint16_t min_x = (hng64_tcram[1] & 0xffff0000) >> 16; + const uint16_t min_y = (hng64_tcram[1] & 0x0000ffff) >> 0; + const uint16_t max_x = (hng64_tcram[2] & 0xffff0000) >> 16; + const uint16_t max_y = (hng64_tcram[2] & 0x0000ffff) >> 0; if(max_x == 0 || max_y == 0) // bail out if values are invalid, Fatal Fury WA sets this to disable the screen. { @@ -1173,8 +1136,6 @@ uint32_t hng64_state::tcram_r(offs_t offset) // Very much a work in progress - no hard testing has been done void hng64_state::transition_control( bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - // float colorScaleR, colorScaleG, colorScaleB; int32_t finR, finG, finB; @@ -1192,11 +1153,11 @@ void hng64_state::transition_control( bitmap_rgb32 &bitmap, const rectangle &cli brigG = (int32_t)((m_tcram[0x0000000a] >> 8) & 0xff); brigB = (int32_t)((m_tcram[0x0000000a] >> 16) & 0xff); - for (i = cliprect.min_x; i < cliprect.max_x; i++) + for (int i = cliprect.min_x; i < cliprect.max_x; i++) { - for (j = cliprect.min_y; j < cliprect.max_y; j++) + for (int j = cliprect.min_y; j < cliprect.max_y; j++) { - rgb_t* thePixel = reinterpret_cast<rgb_t *>(&bitmap.pix32(j, i)); + rgb_t* thePixel = reinterpret_cast<rgb_t *>(&bitmap.pix(j, i)); finR = (int32_t)thePixel->r(); finG = (int32_t)thePixel->g(); diff --git a/src/mame/video/hng64_3d.hxx b/src/mame/video/hng64_3d.hxx index 46a12c13a8b..444911ff4c3 100644 --- a/src/mame/video/hng64_3d.hxx +++ b/src/mame/video/hng64_3d.hxx @@ -1206,7 +1206,7 @@ void hng64_poly_renderer::render_scanline(int32_t scanline, const extent_t& exte const float dt = extent.param[6].dpdx; // Pointers to the pixel buffers - uint32_t* colorBuffer = &m_colorBuffer3d.pix32(scanline, extent.startx); + uint32_t* colorBuffer = &m_colorBuffer3d.pix(scanline, extent.startx); float* depthBuffer = &m_depthBuffer3d[(scanline * m_state.m_screen->visible_area().width()) + extent.startx]; const uint8_t *textureOffset = &m_state.m_texturerom[renderData.texIndex * 1024 * 1024]; @@ -1226,7 +1226,7 @@ void hng64_poly_renderer::render_scanline(int32_t scanline, const extent_t& exte if ((renderData.debugColor & 0xff000000) == 0x01000000) { // ST color mode - *colorBuffer = rgb_t(255, (uint8_t)(sCorrect*255.0f), (uint8_t)(tCorrect*255.0f), (uint8_t)(0)); + *colorBuffer = rgb_t(255, uint8_t(sCorrect*255.0f), uint8_t(tCorrect*255.0f), uint8_t(0)); } else if ((renderData.debugColor & 0xff000000) == 0x02000000) { diff --git a/src/mame/video/hp48.cpp b/src/mame/video/hp48.cpp index 0f224bae73d..572610024ef 100644 --- a/src/mame/video/hp48.cpp +++ b/src/mame/video/hp48.cpp @@ -192,7 +192,7 @@ uint32_t hp48_state::screen_update_hp48(screen_device &screen, bitmap_ind16 &bit acc += m_screens[ i ][ y ][ x+8 ]; } acc = (acc * 255) / (33 * HP48_NB_SCREENS); - bitmap.pix16(y, x ) = acc; + bitmap.pix(y, x ) = acc; } } diff --git a/src/mame/video/hyhoo.cpp b/src/mame/video/hyhoo.cpp index c953b2011c1..aeac3bc32ac 100644 --- a/src/mame/video/hyhoo.cpp +++ b/src/mame/video/hyhoo.cpp @@ -67,18 +67,11 @@ void hyhoo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void hyhoo_state::hyhoo_gfxdraw() { - uint8_t *GFX = memregion("gfx1")->base(); + uint8_t const *const GFX = memregion("gfx1")->base(); - int x, y; - int dx1, dx2, dy; int startx, starty; int sizex, sizey; int skipx, skipy; - int ctrx, ctry; - int gfxaddr, gfxlen; - uint8_t color, color1, color2; - int r, g, b; - pen_t pen; m_nb1413m3->m_busyctr = 0; @@ -109,12 +102,12 @@ void hyhoo_state::hyhoo_gfxdraw() skipy = -1; } - gfxlen = memregion("gfx1")->bytes(); - gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); + int const gfxlen = memregion("gfx1")->bytes(); + int gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); - for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) + for (int y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) { - for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) + for (int x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) { if ((gfxaddr > (gfxlen - 1))) { @@ -124,11 +117,11 @@ void hyhoo_state::hyhoo_gfxdraw() gfxaddr = 0; } - color = GFX[gfxaddr++]; + uint8_t color = GFX[gfxaddr++]; - dx1 = (2 * x + 0) & 0x1ff; - dx2 = (2 * x + 1) & 0x1ff; - dy = y & 0xff; + int dx1 = (2 * x + 0) & 0x1ff; + int dx2 = (2 * x + 1) & 0x1ff; + int dy = y & 0xff; if (m_highcolorflag & 0x04) { @@ -143,14 +136,14 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbbggrrr // dst xxbbbxxx_ggxxxrrr - r = ((color & 0x07) >> 0) & 0x07; - g = ((color & 0x18) >> 3) & 0x03; - b = ((color & 0xe0) >> 5) & 0x07; + int r = ((color & 0x07) >> 0) & 0x07; + int g = ((color & 0x18) >> 3) & 0x03; + int b = ((color & 0xe0) >> 5) & 0x07; - pen = rgb_t(pal6bit(r), pal5bit(g), pal5bit(b)); + pen_t pen = rgb_t(pal6bit(r), pal5bit(g), pal5bit(b)); - m_tmpbitmap.pix32(dy, dx1) = m_tmpbitmap.pix32(dy, dx1) | pen; - m_tmpbitmap.pix32(dy, dx2) = m_tmpbitmap.pix32(dy, dx2) | pen; + m_tmpbitmap.pix(dy, dx1) |= pen; + m_tmpbitmap.pix(dy, dx2) |= pen; } else { @@ -159,20 +152,21 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((color & 0x07) >> 0) & 0x07; - g = ((color & 0x38) >> 3) & 0x07; - b = ((color & 0xc0) >> 6) & 0x03; + int r = ((color & 0x07) >> 0) & 0x07; + int g = ((color & 0x38) >> 3) & 0x07; + int b = ((color & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx1) = pen; - m_tmpbitmap.pix32(dy, dx2) = pen; + m_tmpbitmap.pix(dy, dx1) = pen; + m_tmpbitmap.pix(dy, dx2) = pen; } } } else { // lookup table mode + uint8_t color1, color2; if (m_blitter_direction_x) { @@ -192,13 +186,13 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((~m_clut[color1] & 0x07) >> 0) & 0x07; - g = ((~m_clut[color1] & 0x38) >> 3) & 0x07; - b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03; + int r = ((~m_clut[color1] & 0x07) >> 0) & 0x07; + int g = ((~m_clut[color1] & 0x38) >> 3) & 0x07; + int b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx1) = pen; + m_tmpbitmap.pix(dy, dx1) = pen; } if (m_clut[color2]) @@ -206,13 +200,13 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((~m_clut[color2] & 0x07) >> 0) & 0x07; - g = ((~m_clut[color2] & 0x38) >> 3) & 0x07; - b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03; + int r = ((~m_clut[color2] & 0x07) >> 0) & 0x07; + int g = ((~m_clut[color2] & 0x38) >> 3) & 0x07; + int b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx2) = pen; + m_tmpbitmap.pix(dy, dx2) = pen; } } diff --git a/src/mame/video/igs017_igs031.cpp b/src/mame/video/igs017_igs031.cpp index 9248d9074df..a214d93d2e4 100644 --- a/src/mame/video/igs017_igs031.cpp +++ b/src/mame/video/igs017_igs031.cpp @@ -305,8 +305,8 @@ void igs017_igs031_device::draw_sprite(bitmap_ind16 &bitmap, const rectangle &cl { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * dimx; - u16 *dest = &bitmap.pix16(y); + u8 const *const source = source_base + y_index * dimx; + u16 *const dest = &bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { diff --git a/src/mame/video/ikki.cpp b/src/mame/video/ikki.cpp index 38ad37c38f5..f50ab80ac84 100644 --- a/src/mame/video/ikki.cpp +++ b/src/mame/video/ikki.cpp @@ -97,10 +97,10 @@ void ikki_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t const pen = m_sprite_bitmap.pix16(y, x); + uint16_t const pen = m_sprite_bitmap.pix(y, x); if (m_palette->pen_indirect(pen) != 0x100) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } } } diff --git a/src/mame/video/itech8.cpp b/src/mame/video/itech8.cpp index 003b0d2aab3..e89e5ef5496 100644 --- a/src/mame/video/itech8.cpp +++ b/src/mame/video/itech8.cpp @@ -587,9 +587,7 @@ void grmatch_state::palette_update() uint32_t itech8_state::screen_update_2layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -601,19 +599,19 @@ uint32_t itech8_state::screen_update_2layer(screen_device &screen, bitmap_rgb32 return 0; } - /* there are two layers: */ - /* top layer @ 0x00000 is only 4bpp, colors come from the first 16 palettes */ - /* bottom layer @ 0x20000 is full 8bpp */ - page_offset = m_tms34061->m_display.dispstart & 0x0ffff; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two layers: + // top layer @ 0x00000 is only 4bpp, colors come from the first 16 palettes + // bottom layer @ 0x20000 is full 8bpp + uint32_t const page_offset = m_tms34061->m_display.dispstart & 0x0ffff; + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base0 = &m_tms34061->m_display.vram[(0x00000 + page_offset + y * 256) & VRAM_MASK]; - uint8_t *base2 = &m_tms34061->m_display.vram[(0x20000 + page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base0 = &m_tms34061->m_display.vram[(0x00000 + page_offset + y * 256) & VRAM_MASK]; + uint8_t const *const base2 = &m_tms34061->m_display.vram[(0x20000 + page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int pix0 = base0[x] & 0x0f; + int const pix0 = base0[x] & 0x0f; dest[x] = pens[pix0 ? pix0 : base2[x]]; } } @@ -633,22 +631,22 @@ uint32_t grmatch_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma return 0; } - /* there are two layers: */ - /* top layer @ 0x00000 is 4bpp, colors come from TMS34070, enabled via palette control */ - /* bottom layer @ 0x20000 is 4bpp, colors come from TMS34070, enabled via palette control */ - /* 4bpp pixels are packed 2 to a byte */ - /* xscroll is set via a separate register */ - uint32_t page_offset = (m_tms34061->m_display.dispstart & 0x0ffff) | m_xscroll; + // there are two layers: + // top layer @ 0x00000 is 4bpp, colors come from TMS34070, enabled via palette control + // bottom layer @ 0x20000 is 4bpp, colors come from TMS34070, enabled via palette control + // 4bpp pixels are packed 2 to a byte + // xscroll is set via a separate register + uint32_t const page_offset = (m_tms34061->m_display.dispstart & 0x0ffff) | m_xscroll; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base0 = &m_tms34061->m_display.vram[0x00000 + ((page_offset + y * 256) & 0xffff)]; - uint8_t *base2 = &m_tms34061->m_display.vram[0x20000 + ((page_offset + y * 256) & 0xffff)]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base0 = &m_tms34061->m_display.vram[0x00000 + ((page_offset + y * 256) & 0xffff)]; + uint8_t const *const base2 = &m_tms34061->m_display.vram[0x20000 + ((page_offset + y * 256) & 0xffff)]; + uint32_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - uint8_t pix0 = base0[x / 2]; - uint8_t pix2 = base2[x / 2]; + uint8_t const pix0 = base0[x / 2]; + uint8_t const pix2 = base2[x / 2]; if ((pix0 & 0xf0) != 0) dest[x] = m_palette[0][pix0 >> 4]; @@ -667,9 +665,7 @@ uint32_t grmatch_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -681,15 +677,15 @@ uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 & return 0; } - /* there are two pages, each of which is a full 8bpp */ - /* page index is selected by the top bit of the page_select register */ - page_offset = ((m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two pages, each of which is a full 8bpp + // page index is selected by the top bit of the page_select register + uint32_t const page_offset = ((m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = pens[base[x]]; } return 0; @@ -698,9 +694,7 @@ uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 & uint32_t itech8_state::screen_update_2page_large(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -712,18 +706,18 @@ uint32_t itech8_state::screen_update_2page_large(screen_device &screen, bitmap_r return 0; } - /* there are two pages, each of which is a full 8bpp */ - /* the low 4 bits come from the bitmap directly */ - /* the upper 4 bits were latched on each write into a separate bitmap */ - /* page index is selected by the top bit of the page_select register */ - page_offset = ((~m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two pages, each of which is a full 8bpp + // the low 4 bits come from the bitmap directly + // the upper 4 bits were latched on each write into a separate bitmap + // page index is selected by the top bit of the page_select register + uint32_t const page_offset = ((~m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; - uint8_t *latch = &m_tms34061->m_display.latchram[(page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; + uint8_t const *const latch = &m_tms34061->m_display.latchram[(page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { dest[x + 0] = pens[(latch[x/2] & 0xf0) | (base[x/2] >> 4)]; dest[x + 1] = pens[((latch[x/2] << 4) & 0xf0) | (base[x/2] & 0x0f)]; diff --git a/src/mame/video/jaguar.cpp b/src/mame/video/jaguar.cpp index bb745c11dc7..b9a9b89cffb 100644 --- a/src/mame/video/jaguar.cpp +++ b/src/mame/video/jaguar.cpp @@ -775,7 +775,7 @@ void jaguar_state::scanline_update(int param) /* only run if video is enabled and we are past the "display begin" */ if ((m_gpu_regs[VMODE] & 1) && vc >= (m_gpu_regs[VDB] & 0x7ff)) { - uint32_t *dest = &m_screen_bitmap.pix32(vc >> 1); + uint32_t *dest = &m_screen_bitmap.pix(vc >> 1); int maxx = visarea.right(); int hde = effective_hvalue(m_gpu_regs[HDE]) >> 1; uint16_t x,scanline[760]; diff --git a/src/mame/video/jedi.cpp b/src/mame/video/jedi.cpp index ea68c645413..709ea5dd73c 100644 --- a/src/mame/video/jedi.cpp +++ b/src/mame/video/jedi.cpp @@ -124,7 +124,7 @@ void jedi_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect) { for (int y = cliprect.top(); y <= cliprect.bottom(); y++) for(int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix32(y, x) = m_palette->pen(bitmap.pix32(y, x)); + bitmap.pix(y, x) = m_palette->pen(bitmap.pix(y, x)); } @@ -223,8 +223,8 @@ void jedi_state::draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle the next pixel just uses the current value directly. After we done with a pixel save it for later in the line buffer RAM */ const u8 bg_tempcol = prom1[(bg_last_col << 4) | bg_col]; - bitmap.pix32(y, x + 0) = tx_col1 | prom2[(background_line_buffer[x + 0] << 4) | bg_tempcol]; - bitmap.pix32(y, x + 1) = tx_col2 | prom2[(background_line_buffer[x + 1] << 4) | bg_col]; + bitmap.pix(y, x + 0) = tx_col1 | prom2[(background_line_buffer[x + 0] << 4) | bg_tempcol]; + bitmap.pix(y, x + 1) = tx_col2 | prom2[(background_line_buffer[x + 1] << 4) | bg_col]; background_line_buffer[x + 0] = bg_tempcol; background_line_buffer[x + 1] = bg_col; @@ -296,7 +296,7 @@ void jedi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) x = x & 0x1ff; if (col) - bitmap.pix32(y, x) = (bitmap.pix32(y, x) & 0x30f) | col; + bitmap.pix(y, x) = (bitmap.pix(y, x) & 0x30f) | col; /* next pixel */ if (flip_x) diff --git a/src/mame/video/jpmimpct.cpp b/src/mame/video/jpmimpct.cpp index 2edc65cbd58..798316cfcec 100644 --- a/src/mame/video/jpmimpct.cpp +++ b/src/mame/video/jpmimpct.cpp @@ -107,14 +107,13 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_state::from_shiftreg) TMS340X0_SCANLINE_RGB32_CB_MEMBER(jpmimpct_state::scanline_update) { - uint16_t *vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { - uint16_t pixels = vram[coladdr++ & 0xff]; + uint16_t const pixels = vram[coladdr++ & 0xff]; dest[x + 0] = m_palette->pen(pixels & 0xff); dest[x + 1] = m_palette->pen(pixels >> 8); } diff --git a/src/mame/video/k001005.cpp b/src/mame/video/k001005.cpp index 55ae7629a90..b0477c51b21 100644 --- a/src/mame/video/k001005.cpp +++ b/src/mame/video/k001005.cpp @@ -880,12 +880,11 @@ void k001005_renderer::render_polygons() void k001005_renderer::draw_scanline_2d(int32_t scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; - int x; - for (x = extent.startx; x < extent.stopx; x++) + for (int x = extent.startx; x < extent.stopx; x++) { if (color & 0xff000000) { @@ -906,8 +905,8 @@ void k001005_renderer::draw_scanline_2d_tex(int32_t scanline, const extent_t &ex float v = extent.param[POLY_V].start; float du = extent.param[POLY_U].dpdx; float dv = extent.param[POLY_V].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; int texture_mirror_x = extradata.texture_mirror_x; int texture_mirror_y = extradata.texture_mirror_y; @@ -949,8 +948,8 @@ void k001005_renderer::draw_scanline(int32_t scanline, const extent_t &extent, c float dbri = extent.param[POLY_BRI].dpdx; float fog = extent.param[POLY_FOG].start; float dfog = extent.param[POLY_FOG].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; int poly_light_r = extradata.light_r + extradata.ambient_r; @@ -1039,8 +1038,8 @@ void k001005_renderer::draw_scanline_tex(int32_t scanline, const extent_t &exten int poly_fog_g = extradata.fog_g; int poly_fog_b = extradata.fog_b; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); int *x_mirror_table = m_tex_mirror_table[texture_mirror_x][texture_width].get(); int *y_mirror_table = m_tex_mirror_table[texture_mirror_y][texture_height].get(); @@ -1113,8 +1112,8 @@ void k001005_renderer::draw_scanline_gouraud_blend(int32_t scanline, const exten float db = extent.param[POLY_B].dpdx; float a = extent.param[POLY_A].start; float da = extent.param[POLY_A].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -1161,14 +1160,12 @@ void k001005_renderer::draw_scanline_gouraud_blend(int32_t scanline, const exten void k001005_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - for (j = cliprect.min_y; j <= cliprect.max_y; j++) + for (int j = cliprect.min_y; j <= cliprect.max_y; j++) { - uint32_t *bmp = &bitmap.pix32(j); - uint32_t *src = &m_fb[m_fb_page^1]->pix32(j); + uint32_t *const bmp = &bitmap.pix(j); + uint32_t const *const src = &m_fb[m_fb_page^1]->pix(j); - for (i = cliprect.min_x; i <= cliprect.max_x; i++) + for (int i = cliprect.min_x; i <= cliprect.max_x; i++) { if (src[i] & 0xff000000) { diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp index bf3105d065b..bb00c46e75c 100644 --- a/src/mame/video/k001604.cpp +++ b/src/mame/video/k001604.cpp @@ -256,7 +256,7 @@ void k001604_device::draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cli // loop over columns while (x <= ex) { - *dest = clut[pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x)]; + *dest = clut[pixmap.pix(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x)]; // advance in X cx += incxx; @@ -322,7 +322,7 @@ void k001604_device::draw_front_layer( screen_device &screen, bitmap_rgb32 &bitm // loop over columns while (x <= ex) { - uint16_t pix = pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); + uint16_t pix = pixmap.pix(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); if ((pix & 0xff) != 0) { *dest = clut[pix]; diff --git a/src/mame/video/k053246_k053247_k055673.cpp b/src/mame/video/k053246_k053247_k055673.cpp index 93bf4ac03b5..26845ed68d3 100644 --- a/src/mame/video/k053246_k053247_k055673.cpp +++ b/src/mame/video/k053246_k053247_k055673.cpp @@ -496,7 +496,7 @@ void k053247_device::zdrawgfxzoom32GP( pal_base = palette().pens() + m_gfx->colorbase() + (color % m_gfx->colors()) * granularity; shd_base = palette().shadow_table(); - dst_ptr = &bitmap.pix32(0); + dst_ptr = &bitmap.pix(0); dst_pitch = bitmap.rowpixels(); dst_minx = cliprect.min_x; dst_maxx = cliprect.max_x; diff --git a/src/mame/video/k053250.cpp b/src/mame/video/k053250.cpp index 6363569a761..6022f059d68 100644 --- a/src/mame/video/k053250.cpp +++ b/src/mame/video/k053250.cpp @@ -151,16 +151,16 @@ inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t * // calculate target increment for horizontal scanlines which is exactly one dst_adv = 1; dst_offset = dst_length; - pri_base = &priority.pix8(linepos, dst_start + dst_offset); - dst_base = &bitmap.pix32(linepos, dst_start + dst_length); + pri_base = &priority.pix(linepos, dst_start + dst_offset); + dst_base = &bitmap.pix(linepos, dst_start + dst_length); } else { // calculate target increment for vertical scanlines which is the bitmap's pitch value dst_adv = bitmap.rowpixels(); dst_offset= dst_length * dst_adv; - pri_base = &priority.pix8(dst_start, linepos + dst_offset); - dst_base = &bitmap.pix32(dst_start, linepos + dst_offset); + pri_base = &priority.pix(dst_start, linepos + dst_offset); + dst_base = &bitmap.pix(dst_start, linepos + dst_offset); } // generalized diff --git a/src/mame/video/k053250_ps.cpp b/src/mame/video/k053250_ps.cpp index 9f62bd0b0fb..dfb35d4531a 100644 --- a/src/mame/video/k053250_ps.cpp +++ b/src/mame/video/k053250_ps.cpp @@ -195,16 +195,16 @@ inline void k053250ps_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t // calculate target increment for horizontal scanlines which is exactly one dst_adv = 1; dst_offset = dst_length; - pri_base = &priority.pix8(linepos, dst_start + dst_offset); - dst_base = &bitmap.pix32(linepos, dst_start + dst_length); + pri_base = &priority.pix(linepos, dst_start + dst_offset); + dst_base = &bitmap.pix(linepos, dst_start + dst_length); } else { // calculate target increment for vertical scanlines which is the bitmap's pitch value dst_adv = bitmap.rowpixels(); dst_offset= dst_length * dst_adv; - pri_base = &priority.pix8(dst_start, linepos + dst_offset); - dst_base = &bitmap.pix32(dst_start, linepos + dst_offset); + pri_base = &priority.pix(dst_start, linepos + dst_offset); + dst_base = &bitmap.pix(dst_start, linepos + dst_offset); } // generalized diff --git a/src/mame/video/k053936.cpp b/src/mame/video/k053936.cpp index 3be4ff7a48e..a86814041c2 100644 --- a/src/mame/video/k053936.cpp +++ b/src/mame/video/k053936.cpp @@ -589,7 +589,7 @@ static inline void K053936GP_copyroz32clip( running_machine &machine, // adjust entry points and other loop constants dst_pitch = dst_bitmap.rowpixels(); - dst_base = &dst_bitmap.pix32(0); + dst_base = &dst_bitmap.pix(0); dst_base2 = sy * dst_pitch + sx + tx; ecx = tx = -tx; @@ -598,7 +598,7 @@ static inline void K053936GP_copyroz32clip( running_machine &machine, cmask = colormask[tilebpp]; src_pitch = src_bitmap.rowpixels(); - src_base = &src_bitmap.pix16(0); + src_base = &src_bitmap.pix(0); src_size = src_bitmap.width() * src_bitmap.height(); dst_size = dst_bitmap.width() * dst_bitmap.height(); dst_ptr = 0;//dst_base; diff --git a/src/mame/video/k054156_k054157_k056832.cpp b/src/mame/video/k054156_k054157_k056832.cpp index 26bc2f48982..0d50a5a3933 100644 --- a/src/mame/video/k054156_k054157_k056832.cpp +++ b/src/mame/video/k054156_k054157_k056832.cpp @@ -1177,8 +1177,8 @@ int k056832_device::update_linemap( screen_device &screen, BitmapClass &bitmap, { tile_data tileinfo = {0}; - dst_ptr = &pixmap->pix16(line); - xpr_ptr = &xprmap.pix8(line); + dst_ptr = &pixmap->pix(line); + xpr_ptr = &xprmap.pix(line); if (!all_dirty) { @@ -2106,8 +2106,8 @@ int k056832_device::altK056832_update_linemap(screen_device &screen, bitmap_rgb3 { tile_data tileinfo = {0}; - dst_ptr = &pixmap->pix16(line); - xpr_ptr = &xprmap.pix8(line); + dst_ptr = &pixmap->pix(line); + xpr_ptr = &xprmap.pix(line); if (!all_dirty) { diff --git a/src/mame/video/k054338.cpp b/src/mame/video/k054338.cpp index 11374ee01b4..8e0e61fd5c3 100644 --- a/src/mame/video/k054338.cpp +++ b/src/mame/video/k054338.cpp @@ -110,7 +110,7 @@ void k054338_device::fill_backcolor(bitmap_rgb32 &bitmap, const rectangle &clipr } else { - uint32_t *dst_ptr = &bitmap.pix32(cliprect.min_y); + uint32_t *dst_ptr = &bitmap.pix(cliprect.min_y); int dst_pitch = bitmap.rowpixels(); if ((mode & 0x01) == 0) // vertical gradient fill diff --git a/src/mame/video/k057714.cpp b/src/mame/video/k057714.cpp index 6e336987041..a61711be54a 100644 --- a/src/mame/video/k057714.cpp +++ b/src/mame/video/k057714.cpp @@ -370,7 +370,7 @@ void k057714_device::draw_frame(int frame, bitmap_ind16 &bitmap, const rectangle for (int j = 0; j < height; j++) { - uint16_t *d = &bitmap.pix16(j + m_frame[frame].y, m_frame[frame].x); + uint16_t *const d = &bitmap.pix(j + m_frame[frame].y, m_frame[frame].x); int li = (j * fb_pitch); for (int i = 0; i < width; i++) { diff --git a/src/mame/video/k1ge.cpp b/src/mame/video/k1ge.cpp index eb3d5d44447..0dec7b55d8a 100644 --- a/src/mame/video/k1ge.cpp +++ b/src/mame/video/k1ge.cpp @@ -243,13 +243,12 @@ void k1ge_device::draw_sprite_plane( uint16_t *p, uint16_t priority, int line, i void k1ge_device::draw( int line ) { - uint16_t *p = &m_bitmap->pix16(line); + uint16_t *const p = &m_bitmap->pix(line); uint16_t oowcol = m_vram[0x012] & 0x07; - int i; if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) { - for( i = 0; i < 160; i++ ) + for( int i = 0; i < 160; i++ ) { p[i] = oowcol; } @@ -258,7 +257,7 @@ void k1ge_device::draw( int line ) { uint16_t col = ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) ? m_vram[0x118] & 0x07 : 0; - for ( i = 0; i < 160; i++ ) + for ( int i = 0; i < 160; i++ ) p[i] = col; if ( m_vram[0x030] & 0x80 ) @@ -296,12 +295,12 @@ void k1ge_device::draw( int line ) draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); } - for( i = 0; i < m_wba_h; i++ ) + for( int i = 0; i < m_wba_h; i++ ) { p[i] = oowcol; } - for( i = m_wba_h + m_wsi_h; i < 160; i++ ) + for( int i = m_wba_h + m_wsi_h; i < 160; i++ ) { p[i] = oowcol; } @@ -605,17 +604,16 @@ void k2ge_device::k1ge_draw_sprite_plane( uint16_t *p, uint16_t priority, int li void k2ge_device::draw( int line ) { - uint16_t *p = &m_bitmap->pix16(line); + uint16_t *const p = &m_bitmap->pix(line); uint16_t col = 0; uint16_t oowcol; - int i; oowcol = ( m_vram[0x012] & 0x07 ) * 2; oowcol = m_vram[0x3f0 + oowcol ] | ( m_vram[0x3f1 + oowcol ] << 8 ); if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) { - for( i = 0; i < 160; i++ ) + for( int i = 0; i < 160; i++ ) { p[i] = oowcol; } @@ -630,7 +628,7 @@ void k2ge_device::draw( int line ) col = m_vram[0x3e0 + col ] | ( m_vram[0x3e1 + col ] << 8 ); /* Set the bacground color */ - for ( i = 0; i < 160; i++ ) + for ( int i = 0; i < 160; i++ ) { p[i] = col; } @@ -712,12 +710,12 @@ void k2ge_device::draw( int line ) } } - for ( i = 0; i < m_wba_h; i++ ) + for ( int i = 0; i < m_wba_h; i++ ) { p[i] = oowcol; } - for ( i = m_wba_h + m_wsi_h; i < 160; i++ ) + for ( int i = m_wba_h + m_wsi_h; i < 160; i++ ) { p[i] = oowcol; } diff --git a/src/mame/video/kaneko16.cpp b/src/mame/video/kaneko16.cpp index 4f4aff0ed8b..a52fa9ebeb2 100644 --- a/src/mame/video/kaneko16.cpp +++ b/src/mame/video/kaneko16.cpp @@ -132,7 +132,7 @@ void kaneko16_berlwall_state::video_start() if ((r & 0x10) && (b & 0x10)) g = (g - 1) & 0x1f; /* decrease with wraparound */ - m_bg15_bitmap[screen].pix16(y, x) = ((g << 10) | (r << 5) | b) & 0x7fff; + m_bg15_bitmap[screen].pix(y, x) = ((g << 10) | (r << 5) | b) & 0x7fff; } } } @@ -197,16 +197,15 @@ void kaneko16_berlwall_state::render_15bpp_bitmap(bitmap_rgb32 &bitmap, const re scrolly -= 0xff - 0x08; } - const pen_t *pal = m_bgpalette->pens(); - u16* srcbitmap; - u32* dstbitmap; + pen_t const *const pal = m_bgpalette->pens(); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - if (!flip) srcbitmap = &m_bg15_bitmap[screen].pix16( (y - scrolly) & 0xff ); - else srcbitmap = &m_bg15_bitmap[screen].pix16( 255 - ((y - scrolly) & 0xff) ); + u16 const *srcbitmap; + if (!flip) srcbitmap = &m_bg15_bitmap[screen].pix( (y - scrolly) & 0xff ); + else srcbitmap = &m_bg15_bitmap[screen].pix( 255 - ((y - scrolly) & 0xff) ); - dstbitmap = &bitmap.pix32(y); + u32 *const dstbitmap = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/kaneko_spr.cpp b/src/mame/video/kaneko_spr.cpp index 1bd0c19d02f..80800d4665e 100644 --- a/src/mame/video/kaneko_spr.cpp +++ b/src/mame/video/kaneko_spr.cpp @@ -304,9 +304,9 @@ void kaneko16_sprite_device::draw_sprites_custom(const rectangle &clip,gfx_eleme { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &m_sprites_bitmap.pix16(y); - u8 *pri = &m_sprites_maskmap.pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &m_sprites_bitmap.pix(y); + u8 *const pri = &m_sprites_maskmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -549,18 +549,15 @@ void kaneko16_sprite_device::copybitmap(bitmap_rgb32 &bitmap, const rectangle &c template<class BitmapClass> void kaneko16_sprite_device::copybitmap_common(BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap) { - const pen_t *pal = gfx(0)->palette().pens(); + pen_t const *const pal = gfx(0)->palette().pens(); - typename BitmapClass::pixel_t *dstbitmap; - int rgb; - if (sizeof(*dstbitmap) == 2) rgb = 0; - else rgb = 1; + constexpr bool rgb = sizeof(typename BitmapClass::pixel_t) != 2; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - dstbitmap = &bitmap.pix(y); - u8 *dstprimap = &priority_bitmap.pix8(y); - u16* srcbitmap = &m_sprites_bitmap.pix16(y); + typename BitmapClass::pixel_t *const dstbitmap = &bitmap.pix(y); + u8 *const dstprimap = &priority_bitmap.pix(y); + u16 *const srcbitmap = &m_sprites_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/kangaroo.cpp b/src/mame/video/kangaroo.cpp index 89425997add..bd40a7141a5 100644 --- a/src/mame/video/kangaroo.cpp +++ b/src/mame/video/kangaroo.cpp @@ -141,14 +141,13 @@ uint32_t kangaroo_state::screen_update_kangaroo(screen_device &screen, bitmap_rg uint8_t enab = (m_video_control[9] & 0x04); uint8_t pria = (~m_video_control[9] & 0x02); uint8_t prib = (~m_video_control[9] & 0x01); - int x, y; /* iterate over pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint8_t effxa = scrollx + ((x / 2) ^ xora); uint8_t effya = scrolly + (y ^ xora); diff --git a/src/mame/video/kaypro.cpp b/src/mame/video/kaypro.cpp index f2e41fc47a1..b579a0f4484 100644 --- a/src/mame/video/kaypro.cpp +++ b/src/mame/video/kaypro.cpp @@ -29,24 +29,23 @@ u32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bi During the "off" period of blanking, the first half is used. Only 5 pixels are connected from the rom to the shift register, the remaining pixels are held high. */ - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]^0x80; + u8 chr = m_vram[x]^0x80; /* Take care of flashing characters */ if ((chr < 0x80) && (m_framecnt & 0x08)) @@ -73,24 +72,23 @@ u32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bi u32 kaypro_state::screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]; + u8 chr = m_vram[x]; /* Take care of flashing characters */ if ((chr > 0x7f) && (m_framecnt & 0x08)) @@ -137,32 +135,29 @@ u32 kaypro_state::screen_update_kaypro484(screen_device &screen, bitmap_rgb32 &b MC6845_UPDATE_ROW( kaypro_state::kaypro484_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u32 *p = &bitmap.pix32(y); - u16 x; - u8 gfx,fg,bg; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) // for each character + for (u16 x = 0; x < x_count; x++) // for each character { u8 inv=0; if (x == cursor_x) inv=0xff; - u16 mem = (ma + x) & 0x7ff; - u8 chr = m_vram[mem]; - u8 attr = m_vram[mem | 0x800]; + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; + u8 const attr = m_vram[mem | 0x800]; + u8 fg, bg; if ((attr & 3) == 3) { fg = 0; bg = 2; } - else - if ((attr & 3) == 2) + else if ((attr & 3) == 2) { fg = 2; bg = 0; } - else - if ((attr & 3) == 1) + else if ((attr & 3) == 1) { fg = 0; bg = 1; @@ -178,6 +173,7 @@ MC6845_UPDATE_ROW( kaypro_state::kaypro484_update_row ) fg = bg; /* get pattern of pixels for that character scanline */ + u8 gfx; if ( (ra == 15) & (BIT(attr, 3)) ) /* underline */ gfx = 0xff; else diff --git a/src/mame/video/kc.cpp b/src/mame/video/kc.cpp index 52b37fbbe3b..b9ccc6cdbea 100644 --- a/src/mame/video/kc.cpp +++ b/src/mame/video/kc.cpp @@ -69,19 +69,17 @@ WRITE_LINE_MEMBER( kc_state::video_toggle_blink_state ) /* draw 8 pixels */ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t colour_byte, uint8_t gfx_byte) { - int pens[4]; - int px; - if (m_high_resolution) { /* High resolution: 4 colors for block */ - pens[0] = 0; // black - pens[1] = 2; // red - pens[2] = 5; // cyan - pens[3] = 7; // white + int const pens[4] = { + 0, // black + 2, // red + 5, // cyan + 7 }; // white - px = x; + int px = x; for (int a=0; a<8; a++) { @@ -89,7 +87,7 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) { - bitmap.pix16(y, px) = pen; + bitmap.pix(y, px) = pen; } px++; @@ -121,10 +119,9 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c foreground_pen = background_pen; } - pens[0] = background_pen; - pens[1] = foreground_pen; + int const pens[2] = { background_pen, foreground_pen }; - px = x; + int px = x; for (int a=0; a<8; a++) { @@ -132,10 +129,10 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) { - bitmap.pix16(y, px) = pen; + bitmap.pix(y, px) = pen; } px++; - gfx_byte = gfx_byte<<1; + gfx_byte <<= 1; } } } diff --git a/src/mame/video/klax.cpp b/src/mame/video/klax.cpp index a99221d701c..4ec30e3ae40 100644 --- a/src/mame/video/klax.cpp +++ b/src/mame/video/klax.cpp @@ -98,8 +98,8 @@ u32 klax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - const u16 *mo = &mobitmap.pix16(y); - u16 *pf = &bitmap.pix16(y); + u16 const *const mo = &mobitmap.pix(y); + u16 *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/konamigx.cpp b/src/mame/video/konamigx.cpp index 3f3cef92899..3f246d148c8 100644 --- a/src/mame/video/konamigx.cpp +++ b/src/mame/video/konamigx.cpp @@ -284,7 +284,7 @@ void konamigx_state::konamigx_mixer_init(screen_device &screen, int objdma) m_gx_objdma = 0; m_gx_primode = 0; - m_gx_objzbuf = &screen.priority().pix8(0); + m_gx_objzbuf = &screen.priority().pix(0); m_gx_shdzbuf = std::make_unique<uint8_t[]>(GX_ZBUFSIZE); gx_objpool = auto_alloc_array(machine(), struct GX_OBJ, GX_MAX_OBJECTS); @@ -327,7 +327,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap, int cltc_shdpri, /*prflp,*/ disp; // buffer can move when it's resized, so refresh the pointer - m_gx_objzbuf = &screen.priority().pix8(0); + m_gx_objzbuf = &screen.priority().pix(0); // abort if object database failed to initialize objpool = gx_objpool; @@ -778,22 +778,21 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_2(screen_device &screen, bi { if (extra_bitmap) // soccer superstars roz layer { - int xx,yy; int width = screen.width(); int height = screen.height(); - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); // the output size of the roz layer has to be doubled horizontally // so that it aligns with the sprites and normal tilemaps. This appears // to be done as a post-processing / mixing step effect // // - todo, use the pixeldouble_output I just added for vsnet instead? - for (yy=0;yy<height;yy++) + for (int yy=0;yy<height;yy++) { - uint16_t* src = &extra_bitmap->pix16(yy); - uint32_t* dst = &bitmap.pix32(yy); + uint16_t const *const src = &extra_bitmap->pix(yy); + uint32_t *const dst = &bitmap.pix(yy); int shiftpos = 0; - for (xx=0;xx<width;xx+=2) + for (int xx=0;xx<width;xx+=2) { uint16_t dat = src[(((xx/2)+shiftpos))%width]; if (dat&0xff) @@ -1462,29 +1461,27 @@ uint32_t konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rg /* Hack! draw type-1 roz layer here for testing purposes only */ if (m_gx_specialrozenable == 1) { - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); // hack, draw the roz tilemap if W is held if ( machine().input().code_pressed(KEYCODE_W) ) { - int y,x; - // make it flicker, to compare positioning //if (screen.frame_number() & 1) { - for (y=0;y<256;y++) + for (int y=0;y<256;y++) { - //uint32_t* dst = &bitmap.pix32(y); + //uint32_t *const dst = &bitmap.pix(y); // ths K053936 rendering should probably just be flipped // this is just kludged to align the racing force 2d logo - uint16_t* src = &m_gxtype1_roz_dstbitmap2->pix16(y); - //uint16_t* src = &m_gxtype1_roz_dstbitmap->pix16(y); + uint16_t const *const src = &m_gxtype1_roz_dstbitmap2->pix(y); + //uint16_t const *const src = &m_gxtype1_roz_dstbitmap->pix(y); - uint32_t* dst = &bitmap.pix32((256+16)-y); + uint32_t *const dst = &bitmap.pix((256+16)-y); - for (x=0;x<512;x++) + for (int x=0;x<512;x++) { - uint16_t dat = src[x]; + uint16_t const dat = src[x]; dst[x] = paldata[dat]; } } diff --git a/src/mame/video/ladybug.cpp b/src/mame/video/ladybug.cpp index 13171816a7f..622423fbad3 100644 --- a/src/mame/video/ladybug.cpp +++ b/src/mame/video/ladybug.cpp @@ -207,7 +207,7 @@ void zerohour_stars_device::draw(bitmap_ind16 &bitmap, rectangle const &cliprect if (cliprect.contains(xloc, yloc) && (hcond == vcond)) { if (((state & 0x000ff) == 0x000ff) && !feedback && (xloc >= firstx) && (xloc <= lastx)) - bitmap.pix16(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f); + bitmap.pix(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f); } // update LFSR state diff --git a/src/mame/video/laserbat.cpp b/src/mame/video/laserbat.cpp index 0dae5a95f7d..09af495c61b 100644 --- a/src/mame/video/laserbat.cpp +++ b/src/mame/video/laserbat.cpp @@ -177,8 +177,8 @@ uint32_t laserbat_state_base::screen_update_laserbat(screen_device &screen, bitm for (int y = cliprect.min_y; cliprect.max_y >= y; y++) { - uint16_t const *const src = &m_bitmap.pix16(flip_y ? (offs_y - y) : y); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &m_bitmap.pix(flip_y ? (offs_y - y) : y); + uint16_t *dst = &bitmap.pix(y); for (int x = cliprect.min_x; cliprect.max_x >= x; x++) { dst[x] = uint16_t(m_gfxmix->read(src[flip_x ? (offs_x - x) : x])); @@ -223,7 +223,7 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) int const max_x = m_screen->visible_area().max_x; int const x_offset = min_x - (8 * 3); int const y_offset = m_screen->visible_area().min_y - 8; - uint16_t *const row = &m_bitmap.pix16(y); + uint16_t *const row = &m_bitmap.pix(y); // wait for next scanline m_scanline_timer->adjust(m_screen->time_until_pos(y + 1, 0)); @@ -241,9 +241,9 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) m_pvi[1]->render_next_line(); m_pvi[2]->render_next_line(); } - uint16_t const *const pvi1_row = &m_pvi[0]->bitmap().pix16(y); - uint16_t const *const pvi2_row = &m_pvi[1]->bitmap().pix16(y); - uint16_t const *const pvi3_row = &m_pvi[2]->bitmap().pix16(y); + uint16_t const *const pvi1_row = &m_pvi[0]->bitmap().pix(y); + uint16_t const *const pvi2_row = &m_pvi[1]->bitmap().pix(y); + uint16_t const *const pvi3_row = &m_pvi[2]->bitmap().pix(y); // don't draw outside the visible area m_bitmap.plot_box(0, y, m_bitmap.width(), 1, 0); diff --git a/src/mame/video/lasso.cpp b/src/mame/video/lasso.cpp index edc07e73df0..cd3c1d81cab 100644 --- a/src/mame/video/lasso.cpp +++ b/src/mame/video/lasso.cpp @@ -303,14 +303,10 @@ void lasso_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - offs_t offs; pen_t pen = 0x3f; - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int bit; - uint8_t data; - uint8_t x; uint8_t y = offs >> 5; if (flip_screen_y()) @@ -319,23 +315,23 @@ void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) if ((y < cliprect.min_y) || (y > cliprect.max_y)) continue; - x = (offs & 0x1f) << 3; - data = m_bitmap_ram[offs]; + uint8_t x = (offs & 0x1f) << 3; + uint8_t data = m_bitmap_ram[offs]; if (flip_screen_x()) x = ~x; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x)) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; if (flip_screen_x()) - x = x - 1; + x--; else - x = x + 1; + x++; - data = data << 1; + data <<= 1; } } } diff --git a/src/mame/video/lazercmd.cpp b/src/mame/video/lazercmd.cpp index 818e8abdfcd..7971c9cf3bf 100644 --- a/src/mame/video/lazercmd.cpp +++ b/src/mame/video/lazercmd.cpp @@ -28,25 +28,23 @@ int lazercmd_state::vert_scale(int data) /* meadows lanes normaly use 2x2 pixels and lazer command uses either */ void lazercmd_state::plot_pattern( bitmap_ind16 &bitmap, int x, int y ) { - int xbit, ybit, size; - - size = 2; + int size = 2; if (ioport("DSW")->read() & 0x40) { size = 4; } - for (ybit = 0; ybit < 2; ybit++) + for (int ybit = 0; ybit < 2; ybit++) { if (y + ybit < 0 || y + ybit >= VERT_RES * VERT_CHR) return; - for (xbit = 0; xbit < size; xbit++) + for (int xbit = 0; xbit < size; xbit++) { if (x + xbit < 0 || x + xbit >= HORZ_RES * HORZ_CHR) continue; - bitmap.pix16(y + ybit, x + xbit) = 4; + bitmap.pix(y + ybit, x + xbit) = 4; } } } diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp index e0e33b33c03..6a8b3d065c0 100644 --- a/src/mame/video/leland.cpp +++ b/src/mame/video/leland.cpp @@ -450,7 +450,7 @@ u32 leland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con /* for each scanline in the visible region */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *const dst = &bitmap.pix16(y); + u16 *const dst = &bitmap.pix(y); u8 const *const fg_src = &m_video_ram[y << 8]; /* for each pixel on the scanline */ diff --git a/src/mame/video/lemmings.cpp b/src/mame/video/lemmings.cpp index 5851be91a0a..aa8fa71ab43 100644 --- a/src/mame/video/lemmings.cpp +++ b/src/mame/video/lemmings.cpp @@ -68,22 +68,20 @@ WRITE_LINE_MEMBER(lemmings_state::screen_vblank_lemmings) // RAM based void lemmings_state::lemmings_pixel_0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - int sx, sy, src, old; - - old = m_pixel_data[0][offset]; + int const old = m_pixel_data[0][offset]; COMBINE_DATA(&m_pixel_data[0][offset]); - src = m_pixel_data[0][offset]; + int const src = m_pixel_data[0][offset]; if (old == src) return; - sy = (offset << 1) >> 11; - sx = (offset << 1) & 0x7ff; + int const sy = (offset << 1) >> 11; + int const sx = (offset << 1) & 0x7ff; if (sx > 2047 || sy > 255) return; - m_bitmap0.pix16(sy, sx + 0) = ((src >> 8) & 0xf) | 0x100; - m_bitmap0.pix16(sy, sx + 1) = ((src >> 0) & 0xf) | 0x100; + m_bitmap0.pix(sy, sx + 0) = ((src >> 8) & 0xf) | 0x100; + m_bitmap0.pix(sy, sx + 1) = ((src >> 0) & 0xf) | 0x100; } // RAM based tiles for the FG tilemap @@ -115,16 +113,15 @@ void lemmings_state::lemmings_vram_w(offs_t offset, uint16_t data, uint16_t mem_ void lemmings_state::lemmings_copy_bitmap(bitmap_rgb32& bitmap, int* xscroll, int* yscroll, const rectangle& cliprect) { - int y,x; - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); - for (y=cliprect.top(); y<cliprect.bottom();y++) + for (int y=cliprect.top(); y<cliprect.bottom();y++) { - uint32_t* dst = &bitmap.pix32(y,0); + uint32_t *const dst = &bitmap.pix(y,0); - for (x=cliprect.left(); x<cliprect.right();x++) + for (int x=cliprect.left(); x<cliprect.right();x++) { - uint16_t src = m_bitmap0.pix16((y-*yscroll)&0xff,(x-*xscroll)&0x7ff); + uint16_t const src = m_bitmap0.pix((y-*yscroll)&0xff,(x-*xscroll)&0x7ff); if (src!=0x100) dst[x] = paldata[src]; diff --git a/src/mame/video/lethalj.cpp b/src/mame/video/lethalj.cpp index d813632965b..0eda14955c9 100644 --- a/src/mame/video/lethalj.cpp +++ b/src/mame/video/lethalj.cpp @@ -187,22 +187,22 @@ void lethalj_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) TMS340X0_SCANLINE_IND16_CB_MEMBER(lethalj_state::scanline_update) { - uint16_t *src = &m_screenram[(m_vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_screenram[(m_vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; - int x; /* blank palette: fill with white */ if (m_blank_palette) { - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = 0x7fff; if (scanline == screen.visible_area().max_y) m_blank_palette = 0; - return; } - - /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x++) - dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; + else + { + /* copy the non-blanked portions of this scanline */ + for (int x = params->heblnk; x < params->hsblnk; x++) + dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; + } } diff --git a/src/mame/video/liberatr.cpp b/src/mame/video/liberatr.cpp index 82c5cbcdc25..0c5cdbb8ad6 100644 --- a/src/mame/video/liberatr.cpp +++ b/src/mame/video/liberatr.cpp @@ -249,35 +249,29 @@ void liberatr_state::get_pens(pen_t *pens) void liberatr_state::draw_planet(bitmap_rgb32 &bitmap, pen_t *pens) { - uint8_t latitude; - - uint8_t *buffer = m_planets[m_planet_select].frames[*m_planet_frame]; + uint8_t const *buffer = m_planets[m_planet_select].frames[*m_planet_frame]; /* for each latitude */ - for (latitude = 0; latitude < 0x80; latitude++) + for (uint8_t latitude = 0; latitude < 0x80; latitude++) { - uint8_t segment; - /* grab the color value for the base (if any) at this latitude */ - uint8_t base_color = m_base_ram[latitude >> 3] ^ 0x0f; + uint8_t const base_color = m_base_ram[latitude >> 3] ^ 0x0f; - uint8_t segment_count = *buffer++; + uint8_t const segment_count = *buffer++; uint8_t x = *buffer++; - uint8_t y = 64 + latitude; + uint8_t const y = 64 + latitude; /* run through the segments, drawing its color until its x_array value comes up. */ - for (segment = 0; segment < segment_count; segment++) + for (uint8_t segment = 0; segment < segment_count; segment++) { - uint8_t i; - uint8_t color = *buffer++; uint8_t segment_length = *buffer++; if ((color & 0x0c) == 0x0c) color = base_color; - for (i = 0; i < segment_length; i++, x++) - bitmap.pix32(y, x) = pens[color]; + for (uint8_t i = 0; i < segment_length; i++, x++) + bitmap.pix(y, x) = pens[color]; } } } @@ -285,17 +279,15 @@ void liberatr_state::draw_planet(bitmap_rgb32 &bitmap, pen_t *pens) void liberatr_state::draw_bitmap(bitmap_rgb32 &bitmap, pen_t *pens) { - offs_t offs; - - for (offs = 0; offs < 0x10000; offs++) + for (offs_t offs = 0; offs < 0x10000; offs++) { - uint8_t data = m_videoram[offs]; + uint8_t const data = m_videoram[offs]; - uint8_t y = offs >> 8; - uint8_t x = offs & 0xff; + uint8_t const y = offs >> 8; + uint8_t const x = offs & 0xff; if (data) - bitmap.pix32(y, x) = pens[(data >> 5) | 0x10]; + bitmap.pix(y, x) = pens[(data >> 5) | 0x10]; } } diff --git a/src/mame/video/light.cpp b/src/mame/video/light.cpp index 8092c1db2ca..50fdb9e004b 100644 --- a/src/mame/video/light.cpp +++ b/src/mame/video/light.cpp @@ -132,10 +132,10 @@ void light_video_device::device_reset() uint32_t light_video_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - const uint8_t *src = &m_framebuffer[0]; + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint8_t const *src = &m_framebuffer[0]; for (uint32_t y = 0; y < y_res; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); for (uint32_t x = 0; x < x_res; x++) { *dst++ = pens[*src++]; } diff --git a/src/mame/video/lockon.cpp b/src/mame/video/lockon.cpp index 09051177dc3..f3513693800 100644 --- a/src/mame/video/lockon.cpp +++ b/src/mame/video/lockon.cpp @@ -166,23 +166,19 @@ void lockon_state::lockon_scene_v_scr_w(uint16_t data) void lockon_state::scene_draw( ) { - uint32_t y; - /* 3bpp characters */ const uint8_t *const gfx1 = memregion("gfx2")->base(); const uint8_t *const gfx2 = gfx1 + 0x10000; const uint8_t *const gfx3 = gfx1 + 0x20000; const uint8_t *const clut = gfx1 + 0x30000; - for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) + for (uint32_t y = 0; y < FRAMEBUFFER_MAX_Y; ++y) { - uint32_t x; uint32_t d0 = 0, d1 = 0, d2 = 0; uint32_t colour = 0; uint32_t y_offs; uint32_t x_offs; uint32_t y_gran; - uint16_t *bmpaddr; uint32_t ram_mask = 0x7ff; y_offs = (y + m_scroll_v) & 0x1ff; @@ -208,9 +204,9 @@ void lockon_state::scene_draw( ) d2 = *(gfx3 + tileidx); } - bmpaddr = &m_back_buffer->pix16(y); + uint16_t *bmpaddr = &m_back_buffer->pix(y); - for (x = 0; x < FRAMEBUFFER_MAX_X; ++x) + for (uint32_t x = 0; x < FRAMEBUFFER_MAX_X; ++x) { uint32_t x_gran = (x_offs & 7) ^ 7; uint32_t col; @@ -315,7 +311,7 @@ void lockon_state::ground_draw( ) /* TODO: Clean up and emulate CS of GFX ROMs? */ for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) { - uint16_t *bmpaddr = &m_back_buffer->pix16(y); + uint16_t *bmpaddr = &m_back_buffer->pix(y); uint8_t ls163; uint32_t clut_addr; uint32_t gfx_addr; @@ -426,38 +422,23 @@ do { \ void lockon_state::objects_draw( ) { - uint32_t offs; - const uint8_t *const romlut = memregion("user1")->base(); const uint16_t *const chklut = (uint16_t*)memregion("user2")->base(); const uint8_t *const gfxrom = memregion("gfx5")->base(); const uint8_t *const sproms = memregion("proms")->base() + 0x800; - for (offs = 0; offs < m_object_ram.bytes(); offs += 4) + for (uint32_t offs = 0; offs < m_object_ram.bytes(); offs += 4) { - uint32_t y; - uint32_t xpos; - uint32_t ypos; - uint32_t xsize; - uint32_t ysize; - uint32_t xflip; - uint32_t yflip; - uint32_t scale; - uint32_t pal; - uint32_t lines; - uint32_t opsta; - uint32_t opsta15_8; - /* Retrieve the object attributes */ - ypos = m_object_ram[offs] & 0x03ff; - xpos = m_object_ram[offs + 3] & 0x07ff; - ysize = (m_object_ram[offs] >> 10) & 0x3; - xsize = (m_object_ram[offs] >> 12) & 0x3; - yflip = BIT(m_object_ram[offs], 14); - xflip = BIT(m_object_ram[offs], 15); - scale = m_object_ram[offs + 1] & 0xff; - pal = (m_object_ram[offs + 1] >> 8) & 0x7f; - opsta = m_object_ram[offs + 2]; + uint32_t ypos = m_object_ram[offs] & 0x03ff; + uint32_t xpos = m_object_ram[offs + 3] & 0x07ff; + uint32_t ysize = (m_object_ram[offs] >> 10) & 0x3; + uint32_t xsize = (m_object_ram[offs] >> 12) & 0x3; + uint32_t yflip = BIT(m_object_ram[offs], 14); + uint32_t xflip = BIT(m_object_ram[offs], 15); + uint32_t scale = m_object_ram[offs + 1] & 0xff; + uint32_t pal = (m_object_ram[offs + 1] >> 8) & 0x7f; + uint32_t opsta = m_object_ram[offs + 2]; if (m_iden) { @@ -466,14 +447,14 @@ void lockon_state::objects_draw( ) } /* How many lines will this sprite occupy? The PAL @ IC154 knows... */ - lines = scale >> (3 - ysize); + uint32_t lines = scale >> (3 - ysize); - opsta15_8 = opsta & 0xff00; + uint32_t opsta15_8 = opsta & 0xff00; /* Account for line buffering */ ypos -=1; - for (y = 0; y < FRAMEBUFFER_MAX_Y; y++) + for (uint32_t y = 0; y < FRAMEBUFFER_MAX_Y; y++) { uint32_t cy = (y + ypos) & 0x3ff; uint32_t optab; @@ -481,7 +462,7 @@ void lockon_state::objects_draw( ) uint32_t tile; uint8_t cnt; uint32_t yidx; - uint16_t *line = &m_back_buffer->pix16(y); + uint16_t *line = &m_back_buffer->pix(y); uint32_t px = xpos; /* Outside the limits? */ @@ -683,8 +664,6 @@ do { \ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint32_t y; - /* Counters */ uint32_t cxy = m_xsal & 0xff; uint32_t cyy = m_ysal & 0x1ff; @@ -704,11 +683,10 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect uint32_t axy_en = !BIT(m_dx0ll, 8); uint32_t ayy_en = !BIT(m_dy0ll, 8); - for (y = 0; y <= cliprect.max_y; ++y) + for (uint32_t y = 0; y <= cliprect.max_y; ++y) { uint32_t carry; - uint16_t *dst = &bitmap.pix16(y); - uint32_t x; + uint16_t *dst = &bitmap.pix(y); uint32_t cx = cxy; uint32_t cy = cyy; @@ -716,12 +694,12 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect uint8_t axx = axy; uint8_t ayx = ayy; - for (x = 0; x <= cliprect.max_x; ++x) + for (uint32_t x = 0; x <= cliprect.max_x; ++x) { cx &= 0x1ff; cy &= 0x1ff; - *dst++ = m_front_buffer->pix16(cy, cx); + *dst++ = m_front_buffer->pix(cy, cx); if (axx_en) INCREMENT(axx, cx); @@ -787,12 +765,10 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint8_t *tile_rom = memregion("gfx3")->base(); - uint32_t offs; + uint8_t const *const tile_rom = memregion("gfx3")->base(); - for (offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) + for (uint32_t offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) { - uint32_t y; uint32_t y_pos; uint32_t x_pos; uint32_t y_size; @@ -825,7 +801,7 @@ void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) else y_size = 8; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (uint32_t y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint32_t xt; uint32_t cy; @@ -866,7 +842,7 @@ void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) if (x <= cliprect.max_x) { - uint16_t *dst = &bitmap.pix16(y, x); + uint16_t *const dst = &bitmap.pix(y, x); if (BIT(gfx_strip, px ^ 7) && *dst > 255) *dst = colour; diff --git a/src/mame/video/lordgun.cpp b/src/mame/video/lordgun.cpp index 755a09a887c..84b686eda1b 100644 --- a/src/mame/video/lordgun.cpp +++ b/src/mame/video/lordgun.cpp @@ -309,12 +309,10 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma // Scrolling - int x, y; - m_tilemap[0]->set_scrollx(0, *m_scroll_x[0] ); m_tilemap[0]->set_scrolly(0, *m_scroll_y[0] ); - for (y = 0; y < 0x200; y++) + for (int y = 0; y < 0x200; y++) m_tilemap[1]->set_scrollx(y, (*m_scroll_x[1]) + m_scrollram[y * 4/2 + 2/2]); m_tilemap[1]->set_scrolly(0, *m_scroll_y[1] ); @@ -331,8 +329,7 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma pen_t trans_pen = 0 * 0x800 + 0x3f; // pri = 0, pen = 3f (transparent) - int l; - for (l = 0; l < 5; l++) + for (int l = 0; l < 5; l++) m_bitmaps[l]->fill(trans_pen, cliprect); if (layers_ctrl & 1) m_tilemap[0]->draw(screen, *m_bitmaps[0], cliprect, 0, 0); @@ -348,18 +345,18 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma // layer index (0-3, 4 for sprites) -> priority address bit const int layer2bit[5] = {0,1,2,4,3}; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t pens[5]; int pri_addr = 0; // bits 0-4: layer transparency - for (l = 0; l < 5; l++) + for (int l = 0; l < 5; l++) { - pens[l] = m_bitmaps[l]->pix16(y, x); + pens[l] = m_bitmaps[l]->pix(y, x); if (pens[l] == trans_pen) pri_addr |= 1 << layer2bit[l]; } @@ -375,9 +372,9 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma pri_addr &= 0x7fff; - l = pri2layer[m_priority_ram[pri_addr] & 7]; + int l = pri2layer[m_priority_ram[pri_addr] & 7]; - bitmap.pix16(y, x) = pens[l] & 0x7ff; + bitmap.pix(y, x) = pens[l] & 0x7ff; } } diff --git a/src/mame/video/lviv.cpp b/src/mame/video/lviv.cpp index e53ccfd9768..65aeb6ced32 100644 --- a/src/mame/video/lviv.cpp +++ b/src/mame/video/lviv.cpp @@ -63,18 +63,19 @@ uint32_t lviv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int x = 0; x < 256; x += 4) { const uint8_t data = m_vram[(y << 6) | (x >> 2)]; + int pen; - int pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; - bitmap.pix16(y, x + 0) = pen; + pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; + bitmap.pix(y, x + 0) = pen; pen = m_colortable[0][((data & 0x04) >> 2) | ((data & 0x40) >> (2+3))]; - bitmap.pix16(y, x + 1) = pen; + bitmap.pix(y, x + 1) = pen; pen = m_colortable[0][((data & 0x02) >> 1) | ((data & 0x20) >> (1+3))]; - bitmap.pix16(y, x + 2) = pen; + bitmap.pix(y, x + 2) = pen; pen = m_colortable[0][((data & 0x01) >> 0) | ((data & 0x10) >> (0+3))]; - bitmap.pix16(y, x + 3) = pen; + bitmap.pix(y, x + 3) = pen; } } return 0; diff --git a/src/mame/video/m10.cpp b/src/mame/video/m10.cpp index 3a0a233c961..5cb29654aca 100644 --- a/src/mame/video/m10.cpp +++ b/src/mame/video/m10.cpp @@ -86,12 +86,12 @@ void m10_state::m15_chargen_w(offs_t offset, uint8_t data) } -inline void m10_state::plot_pixel_m10( bitmap_ind16 &bm, int x, int y, int col ) +inline void m10_state::plot_pixel_m10(bitmap_ind16 &bm, int x, int y, int col) { if (!m_flip) - bm.pix16(y, x) = col; + bm.pix(y, x) = col; else - bm.pix16((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND), + bm.pix((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND), (IREMM10_HBSTART - 1) - (x - IREMM10_HBEND)) = col; // only when flip_screen(?) } diff --git a/src/mame/video/m57.cpp b/src/mame/video/m57.cpp index 1fbd130292e..524ef9d1c45 100644 --- a/src/mame/video/m57.cpp +++ b/src/mame/video/m57.cpp @@ -170,36 +170,35 @@ void m57_state::m57_flipscreen_w(uint8_t data) void m57_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y,x; - int16_t scrolly; - // from 64 to 127: not wrapped - for (y = 64; y < 128; y++) + for (int y = 64; y < 128; y++) m_bg_tilemap->set_scrollx(y, m_scrollram[0x40]); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); // from 128 to 255: wrapped - for (y = 128; y <= cliprect.max_y; y++) + for (int y = 128; y <= cliprect.max_y; y++) { - scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8); + int16_t const scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8); if (scrolly >= 0) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if ((x + scrolly) <= cliprect.max_x) - bitmap.pix16(y, x) = bitmap.pix16(y, x + scrolly); + bitmap.pix(y, x) = bitmap.pix(y, x + scrolly); else - bitmap.pix16(y, x) = bitmap.pix16(y, cliprect.max_x); + bitmap.pix(y, x) = bitmap.pix(y, cliprect.max_x); } - } else { - for (x = cliprect.max_x; x >= cliprect.min_x; x--) + } + else + { + for (int x = cliprect.max_x; x >= cliprect.min_x; x--) { if ((x + scrolly) >= cliprect.min_x) - bitmap.pix16(y, x) = bitmap.pix16(y, x + scrolly); + bitmap.pix(y, x) = bitmap.pix(y, x + scrolly); else - bitmap.pix16(y, x) = bitmap.pix16(y, cliprect.min_x); + bitmap.pix(y, x) = bitmap.pix(y, cliprect.min_x); } } } diff --git a/src/mame/video/m58.cpp b/src/mame/video/m58.cpp index f39d9936556..c986639b8ec 100644 --- a/src/mame/video/m58.cpp +++ b/src/mame/video/m58.cpp @@ -125,8 +125,8 @@ void m58_state::scroll_panel_w(offs_t offset, uint8_t data) col = (data >> i) & 0x11; col = ((col >> 3) | col) & 3; - m_scroll_panel_bitmap.pix16(sy, sx + i) = 0x100 + (sy & 0xfc) + col; - m_scroll_panel_bitmap.pix16(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen + m_scroll_panel_bitmap.pix(sy, sx + i) = 0x100 + (sy & 0xfc) + col; + m_scroll_panel_bitmap.pix(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen } } diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp index 12ad7e3af40..33625b9359e 100644 --- a/src/mame/video/mac.cpp +++ b/src/mame/video/mac.cpp @@ -77,23 +77,17 @@ VIDEO_START_MEMBER(mac_state,mac) uint32_t mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint32_t const video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + uint16_t const *video_ram = (const uint16_t *) (m_ram->pointer() + video_base); - video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const uint16_t *) (m_ram->pointer() + video_base); - - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + uint16_t const word = *(video_ram++); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -104,24 +98,17 @@ uint32_t mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitma uint32_t mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = m_screen_buffer ? 0x8000 : 0; - video_base += (MAC_H_VIS/8); - video_ram = (const uint16_t *) &m_vram[video_base/4]; + uint32_t const video_base = (m_screen_buffer ? 0x8000 : 0) + (MAC_H_VIS/8); + uint16_t const *const video_ram = (const uint16_t *) &m_vram[video_base/4]; - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -132,21 +119,16 @@ uint32_t mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &b uint32_t mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_ram = (const uint16_t *) m_vram16.target(); + uint16_t const *const video_ram = (const uint16_t *) m_vram16.target(); - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = video_ram[((y * 640)/16) + ((x/16))]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * 640)/16) + ((x/16))]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -157,21 +139,16 @@ uint32_t mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &b uint32_t mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint16_t const *const video_ram = (const uint16_t *) m_vram.target(); - video_ram = (const uint16_t *) m_vram.target(); - - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = video_ram[((y * 640)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * 640)/16) + ((x/16)^1)]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -182,18 +159,15 @@ uint32_t mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 & uint32_t mac_state::screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *line; - int y, x; - uint8_t pixels; - uint8_t *vram8 = (uint8_t *)m_vram.target(); + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *line = &bitmap.pix(y); - for (x = 0; x < 640/4; x++) + for (int x = 0; x < 640/4; x++) { - pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; *line++ = ((pixels>>6)&3); *line++ = ((pixels>>4)&3); @@ -359,9 +333,8 @@ VIDEO_START_MEMBER(mac_state,macv8) uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - uint8_t *vram8 = (uint8_t *)m_ram->pointer(); + uint8_t const *vram8 = (uint8_t *)m_ram->pointer(); + int hres, vres; switch (m_rbv_montype) { @@ -392,14 +365,12 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi { case 0: // 1bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0xfe|(pixels>>7)]; *scanline++ = m_rbv_palette[0xfe|((pixels>>6)&1)]; @@ -416,14 +387,12 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 1: // 2bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; @@ -436,15 +405,13 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 2: // 4bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; @@ -455,15 +422,13 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 3: // 8bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -475,9 +440,7 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - + int hres, vres; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -501,15 +464,14 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * 0x400) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * 0x400) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -526,15 +488,14 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; @@ -547,16 +508,15 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; @@ -567,16 +527,15 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -588,9 +547,7 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - + int hres, vres; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -614,15 +571,14 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * 1024) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * 1024) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -639,15 +595,14 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; @@ -660,16 +615,15 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; @@ -680,16 +634,15 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -702,9 +655,7 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres, stride; - + int hres, vres, stride; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -734,15 +685,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -759,15 +709,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; @@ -780,16 +729,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; @@ -800,16 +747,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -818,16 +763,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 4: // 16bpp { - uint16_t *vram16 = (uint16_t *)m_vram.target(); - uint16_t pixels; + uint16_t const *const vram16 = (uint16_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x++) { - pixels = vram16[(y * stride) + (x^1)]; + uint16_t const pixels = vram16[(y * stride) + (x^1)]; *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); } } @@ -1047,23 +990,19 @@ void mac_state::dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask) uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - switch (m_dafb_mode) { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x+=8) { - pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; *scanline++ = m_rbv_palette[(pixels>>7)&1]; *scanline++ = m_rbv_palette[(pixels>>6)&1]; @@ -1080,16 +1019,15 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/4; x++) { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[((pixels>>6)&3)]; *scanline++ = m_rbv_palette[((pixels>>4)&3)]; @@ -1102,17 +1040,15 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/2; x++) { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels>>4)]; *scanline++ = m_rbv_palette[(pixels&0xf)]; @@ -1123,17 +1059,15 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x++) { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -1141,13 +1075,11 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b break; case 4: // 24 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - uint32_t *base; - - scanline = &bitmap.pix32(y); - base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + uint32_t const *base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; + for (int x = 0; x < 640; x++) { *scanline++ = *base++; } @@ -1160,19 +1092,16 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b uint32_t mac_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)/* Color PowerBooks using an off-the-shelf WD video chipset */ { - uint32_t *scanline; - int x, y; - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); // vram8 += 0x40000; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } diff --git a/src/mame/video/madalien.cpp b/src/mame/video/madalien.cpp index 7c1c2154b3c..8303131ca6a 100644 --- a/src/mame/video/madalien.cpp +++ b/src/mame/video/madalien.cpp @@ -209,8 +209,8 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr if ((hx < cliprect.left()) || (hx > cliprect.right())) continue; - if (m_headlight_bitmap->pix16(y, x) != 0) - bitmap.pix16(hy, hx) |= 8; + if (m_headlight_bitmap->pix(y, x) != 0) + bitmap.pix(hy, hx) |= 8; } } } @@ -277,7 +277,7 @@ uint32_t madalien_state::screen_update_madalien(screen_device &screen, bitmap_in for (y = cliprect.top(); y <= cliprect.bottom(); y++) for (x = min_x; x <= max_x; x++) if ((x >= cliprect.left()) && (x <= cliprect.right())) - bitmap.pix16(y, x) |= 8; + bitmap.pix(y, x) |= 8; } draw_headlight(bitmap, cliprect, flip); diff --git a/src/mame/video/magmax.cpp b/src/mame/video/magmax.cpp index 06d8643b448..0f216c1ed05 100644 --- a/src/mame/video/magmax.cpp +++ b/src/mame/video/magmax.cpp @@ -145,7 +145,7 @@ uint32_t magmax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap /*priority: background over sprites*/ if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c)) - m_bitmap.pix16(v, h) = line_data[h]; + m_bitmap.pix(v, h) = line_data[h]; } if (m_flipscreen) diff --git a/src/mame/video/malzak.cpp b/src/mame/video/malzak.cpp index efc9f7ce1b3..48745186ec7 100644 --- a/src/mame/video/malzak.cpp +++ b/src/mame/video/malzak.cpp @@ -95,20 +95,20 @@ uint32_t malzak_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { int sx = x / 2; - int s2636_pix_0 = s2636_0_bitmap.pix16(sy, sx); - int s2636_pix_1 = s2636_1_bitmap.pix16(sy, sx); - rgb_t trom_pix = m_trom_bitmap->pix32(y, x); - rgb_t play_pix = m_playfield_bitmap->pix32(sy, sx); + int s2636_pix_0 = s2636_0_bitmap.pix(sy, sx); + int s2636_pix_1 = s2636_1_bitmap.pix(sy, sx); + rgb_t trom_pix = m_trom_bitmap->pix(y, x); + rgb_t play_pix = m_playfield_bitmap->pix(sy, sx); // SAA5050 > s2636[1] > s2636[0] > playfield if (trom_pix != rgb_t::black()) - bitmap.pix32(y, x) = trom_pix; + bitmap.pix(y, x) = trom_pix; else if (S2636_IS_PIXEL_DRAWN(s2636_pix_1)) - bitmap.pix32(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_1)]; + bitmap.pix(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_1)]; else if (S2636_IS_PIXEL_DRAWN(s2636_pix_0)) - bitmap.pix32(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_0)]; + bitmap.pix(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_0)]; else - bitmap.pix32(y, x) = play_pix; + bitmap.pix(y, x) = play_pix; } } diff --git a/src/mame/video/mappy.cpp b/src/mame/video/mappy.cpp index 215f2d281a5..744ba14f4d2 100644 --- a/src/mame/video/mappy.cpp +++ b/src/mame/video/mappy.cpp @@ -507,7 +507,6 @@ void mappy_state::phozon_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cli uint32_t mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &sprite_bitmap = m_sprite_bitmap; - int x,y; m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); @@ -519,14 +518,14 @@ uint32_t mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 m_bg_tilemap->draw(screen, bitmap, cliprect, 1,0); /* sprite color 0/1 still has priority over that (ghost eyes in Pac 'n Pal) */ - for (y = 0;y < sprite_bitmap.height();y++) + for (int y = 0;y < sprite_bitmap.height();y++) { - for (x = 0;x < sprite_bitmap.width();x++) + for (int x = 0;x < sprite_bitmap.width();x++) { - int spr_entry = sprite_bitmap.pix16(y, x); + int spr_entry = sprite_bitmap.pix(y, x); int spr_pen = m_palette->pen_indirect(spr_entry); if (spr_pen == 0 || spr_pen == 1) - bitmap.pix16(y, x) = spr_entry; + bitmap.pix(y, x) = spr_entry; } } return 0; diff --git a/src/mame/video/maria.cpp b/src/mame/video/maria.cpp index 341ed274573..25e5c497dba 100644 --- a/src/mame/video/maria.cpp +++ b/src/mame/video/maria.cpp @@ -291,8 +291,7 @@ void atari_maria_device::draw_scanline() // draw line buffer to screen m_active_buffer = !m_active_buffer; // switch buffers - uint16_t *scanline; - scanline = &m_bitmap.pix16(m_screen->vpos()); + uint16_t *const scanline = &m_bitmap.pix(m_screen->vpos()); for (int i = 0; i < 160; i++) diff --git a/src/mame/video/mbc55x.cpp b/src/mame/video/mbc55x.cpp index c9ab2aac277..4f586d8e4e0 100644 --- a/src/mame/video/mbc55x.cpp +++ b/src/mame/video/mbc55x.cpp @@ -95,21 +95,12 @@ void mbc55x_state::video_debug(int ref, const std::vector<std::string> ¶ms) MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - uint8_t *ram = &m_ram->pointer()[0]; - uint8_t *red = &m_video_mem[RED_PLANE_OFFSET]; - uint8_t *blue = &m_video_mem[BLUE_PLANE_OFFSET]; - uint8_t *green; - int offset; - uint8_t rpx,gpx,bpx; - uint8_t rb,gb,bb; - - int x_pos; - int pixelno; - uint8_t bitno; - uint8_t shifts; - uint8_t colour; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + + uint8_t const *const ram = &m_ram->pointer()[0]; + uint8_t const *const red = &m_video_mem[RED_PLANE_OFFSET]; + uint8_t const *const blue = &m_video_mem[BLUE_PLANE_OFFSET]; + uint8_t const *green; switch(m_vram_page) { @@ -124,30 +115,30 @@ MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) if(DEBUG_SET(DEBUG_LINES)) logerror("MC6845_UPDATE_ROW: ma=%d, ra=%d, y=%d, x_count=%d\n",ma,ra,y,x_count); - offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; + int offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; if(DEBUG_SET(DEBUG_LINES)) logerror("offset=%05X\n",offset); - for(x_pos=0; x_pos<x_count; x_pos++) + for(int x_pos=0; x_pos<x_count; x_pos++) { uint16_t mem = (offset+(x_pos*4)) % COLOUR_PLANE_SIZE; - rpx=red[mem]; - gpx=green[mem]; - bpx=blue[mem]; + uint8_t rpx=red[mem]; + uint8_t gpx=green[mem]; + uint8_t bpx=blue[mem]; - bitno=0x80; - shifts=7; + uint8_t bitno=0x80; + uint8_t shifts=7; - for(pixelno=0; pixelno<8; pixelno++) + for(int pixelno=0; pixelno<8; pixelno++) { - rb=(rpx & bitno) >> shifts; - gb=(gpx & bitno) >> shifts; - bb=(bpx & bitno) >> shifts; + uint8_t rb=(rpx & bitno) >> shifts; + uint8_t gb=(gpx & bitno) >> shifts; + uint8_t bb=(bpx & bitno) >> shifts; - colour=(rb<<2) | (gb<<1) | (bb<<0); + uint8_t colour=(rb<<2) | (gb<<1) | (bb<<0); - bitmap.pix32(y, (x_pos*8)+pixelno)=palette[colour]; + bitmap.pix(y, (x_pos*8)+pixelno)=palette[colour]; //logerror("set pixel (%d,%d)=%d\n",y, ((x_pos*8)+pixelno),colour); bitno=bitno>>1; shifts--; diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp index 42098b97bc9..56416f6b3bd 100644 --- a/src/mame/video/mbee.cpp +++ b/src/mame/video/mbee.cpp @@ -270,7 +270,7 @@ MC6845_UPDATE_ROW( mbee_state::crtc_update_row ) if ((monopal==0) && !BIT(m_features, 0)) monopal = 2; - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); u8 inv, attr=0, gfx, fg=96+monopal, bg=96, col=0; u16 mem, x, chr; diff --git a/src/mame/video/mcatadv.cpp b/src/mame/video/mcatadv.cpp index 38b7da27c53..56d20dde833 100644 --- a/src/mame/video/mcatadv.cpp +++ b/src/mame/video/mcatadv.cpp @@ -84,8 +84,8 @@ void mcatadv_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, c if ((drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y)) { - u16 *destline = &bitmap.pix16(drawypos); - u8 *priline = &screen.priority().pix8(drawypos); + u16 *const destline = &bitmap.pix(drawypos); + u8 *const priline = &screen.priority().pix(drawypos); for (int xcnt = xstart; xcnt != xend; xcnt += xinc) { diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp index 294bc7cabf8..c6e32759101 100644 --- a/src/mame/video/mcd212.cpp +++ b/src/mame/video/mcd212.cpp @@ -1215,15 +1215,14 @@ void mcd212_device::draw_scanline(int y) uint8_t plane_a_r[768], plane_a_g[768], plane_a_b[768]; uint8_t plane_b_r[768], plane_b_g[768], plane_b_b[768]; uint32_t out[768]; - uint32_t *scanline = &m_bitmap.pix32(y); - int x; process_vsr(0, plane_a_r, plane_a_g, plane_a_b); process_vsr(1, plane_b_r, plane_b_g, plane_b_b); mix_lines(plane_a_r, plane_a_g, plane_a_b, plane_b_r, plane_b_g, plane_b_b, out); - for(x = 0; x < 384; x++) + uint32_t *const scanline = &m_bitmap.pix(y); + for(int x = 0; x < 384; x++) { scanline[x] = out[x*2]; } diff --git a/src/mame/video/mcr.cpp b/src/mame/video/mcr.cpp index 48738c0eeef..ee0aa745b42 100644 --- a/src/mame/video/mcr.cpp +++ b/src/mame/video/mcr.cpp @@ -272,9 +272,9 @@ void mcr_state::render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) if (sy >= cliprect.min_y && sy <= cliprect.max_y) { - const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); - uint16_t *dst = &bitmap.pix16(sy); - uint8_t *pri = &screen.priority().pix8(sy); + uint8_t const *const src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); + uint16_t *const dst = &bitmap.pix(sy); + uint8_t *const pri = &screen.priority().pix(sy); /* loop over columns */ for (int x = 0; x < 32; x++) @@ -339,9 +339,9 @@ void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) if (sy >= 2 && sy >= cliprect.min_y && sy <= cliprect.max_y) { - const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); - uint16_t *dst = &bitmap.pix16(sy); - uint8_t *pri = &screen.priority().pix8(sy); + uint8_t const *const src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); + uint16_t *const dst = &bitmap.pix(sy); + uint8_t *const pri = &screen.priority().pix(sy); /* loop over columns */ for (int x = 0; x < 32; x++) diff --git a/src/mame/video/megasys1.cpp b/src/mame/video/megasys1.cpp index 8a6f6a30d3d..6c1b3b144dd 100644 --- a/src/mame/video/megasys1.cpp +++ b/src/mame/video/megasys1.cpp @@ -334,17 +334,17 @@ void megasys1_state::monkelf_scroll1_w(offs_t offset, u16 data, u16 mem_mask) void megasys1_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *decodegfx = m_gfxdecode->gfx(0); - u16 colorbase = decodegfx->colorbase(); + u16 const colorbase = decodegfx->colorbase(); for (int y = cliprect.min_y;y <= cliprect.max_y;y++) { - u16* srcline = &m_sprite_buffer_bitmap.pix16(y); - u16* dstline = &bitmap.pix16(y); - u8 *prio = &screen.priority().pix8(y); + u16 const *const srcline = &m_sprite_buffer_bitmap.pix(y); + u16 *const dstline = &bitmap.pix(y); + u8 const *const prio = &screen.priority().pix(y); for (int x = cliprect.min_x;x <= cliprect.max_x;x++) { - u16 pixel = srcline[x]; + u16 const pixel = srcline[x]; if ((pixel & 0xf) != 0xf) { @@ -366,11 +366,11 @@ void megasys1_state::partial_clear_sprite_bitmap(screen_device &screen, bitmap_i { for (int y = cliprect.min_y;y <= cliprect.max_y;y++) { - u16* srcline = &m_sprite_buffer_bitmap.pix16(y); + u16 *const srcline = &m_sprite_buffer_bitmap.pix(y); for (int x = cliprect.min_x;x <= cliprect.max_x;x++) { - u16 pixel = srcline[x]; + u16 const pixel = srcline[x]; srcline[x] = pixel & 0x7fff; // wipe our 'drawn here' marker otherwise trails will always have priority over new sprites, which is incorrect. // guess, very unclear from the video refernece we have, used when removing p47 trails @@ -397,9 +397,9 @@ inline void megasys1_state::draw_16x16_priority_sprite(screen_device &screen, bi for (s32 y = 0; y < 16; y++, sy++, sx-=16) { - // u16 *dest = &bitmap.pix16(sy)+ sx; - // u8 *prio = &screen.priority().pix8(sy) + sx; - u16* dest = &m_sprite_buffer_bitmap.pix16(sy)+ sx; + // u16 *const dest = &bitmap.pix(sy)+ sx; + // u8 *const prio = &screen.priority().pix(sy) + sx; + u16 *const dest = &m_sprite_buffer_bitmap.pix(sy)+ sx; for (s32 x = 0; x < 16; x++, sx++) { diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp index 0d3c1be9ed9..d3271d9d4e8 100644 --- a/src/mame/video/mermaid.cpp +++ b/src/mame/video/mermaid.cpp @@ -220,18 +220,14 @@ uint8_t mermaid_state::collision_check( rectangle& rect ) { uint8_t data = 0; - int x; - int y; - - for (y = rect.top(); y <= rect.bottom(); y++) - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) { - uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)) & 0x3f; - uint16_t b = m_palette->pen_indirect(m_helper2.pix16(y, x)) & 0x3f; + uint16_t const a = m_palette->pen_indirect(m_helper.pix(y, x)) & 0x3f; + uint16_t const b = m_palette->pen_indirect(m_helper2.pix(y, x)) & 0x3f; - if (b) - if (a) - data |= 0x01; + if (b && a) + data |= 0x01; } return data; diff --git a/src/mame/video/micro3d.cpp b/src/mame/video/micro3d.cpp index 79e9422b9e2..75f92bf901a 100644 --- a/src/mame/video/micro3d.cpp +++ b/src/mame/video/micro3d.cpp @@ -66,21 +66,18 @@ void micro3d_state::video_reset() TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update) { - uint16_t *src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; + uint16_t *dest = &bitmap.pix(scanline); int coladdr = params->coladdr; int sd_11_7 = (m_creg & 0x1f) << 7; - int x; - - uint16_t *frame_src; scanline = std::max((scanline - params->veblnk), 0); - frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); + uint16_t const *frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); /* TODO: XFER3DK - X/Y offsets for 3D */ /* Copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pix = src[coladdr++ & 0x1ff]; diff --git a/src/mame/video/midtunit.cpp b/src/mame/video/midtunit.cpp index afea37e9f7c..94594884e38 100644 --- a/src/mame/video/midtunit.cpp +++ b/src/mame/video/midtunit.cpp @@ -849,8 +849,8 @@ skipdma: TMS340X0_SCANLINE_IND16_CB_MEMBER(midtunit_video_device::scanline_update) { - uint16_t *src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; /* copy the non-blanked portions of this scanline */ @@ -861,8 +861,8 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(midtunit_video_device::scanline_update) TMS340X0_SCANLINE_IND16_CB_MEMBER(midxunit_video_device::scanline_update) { uint32_t fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 3; - uint16_t *src = &m_local_videoram[fulladdr & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[fulladdr & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); /* copy the non-blanked portions of this scanline */ for (int x = params->heblnk; x < params->hsblnk; x++) diff --git a/src/mame/video/midtview.ipp b/src/mame/video/midtview.ipp index 046a193e8d3..f59a101be40 100644 --- a/src/mame/video/midtview.ipp +++ b/src/mame/video/midtview.ipp @@ -266,7 +266,7 @@ uint32_t midtunit_video_device::debug_screen_update(screen_device &screen, bitma const pen_t *pens = m_debug_palette->pens(); for (int y = 0; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *dest = &bitmap.pix(y); uint16_t *src = &m_debug_videoram[y * 512]; for (int x = 0; x < cliprect.max_x; x++) { diff --git a/src/mame/video/midvunit.cpp b/src/mame/video/midvunit.cpp index 53c51aa6e31..4d8b8e977b6 100644 --- a/src/mame/video/midvunit.cpp +++ b/src/mame/video/midvunit.cpp @@ -548,7 +548,7 @@ uint32_t midvunit_state::midvunit_textureram_r(offs_t offset) uint32_t midvunit_state::screen_update_midvunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, width, xoffs; + int width, xoffs; uint32_t offset; m_poly->wait("Refresh Time"); @@ -574,10 +574,10 @@ uint32_t midvunit_state::screen_update_midvunit(screen_device &screen, bitmap_in offset += 512 * (cliprect.min_y - screen.visible_area().min_y); /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); - for (x = 0; x < width; x++) + uint16_t *dest = &bitmap.pix(y, cliprect.min_x); + for (int x = 0; x < width; x++) *dest++ = m_videoram[offset + x] & 0x7fff; offset += 512; } diff --git a/src/mame/video/midyunit.cpp b/src/mame/video/midyunit.cpp index fe3233e827f..e535d74ab75 100644 --- a/src/mame/video/midyunit.cpp +++ b/src/mame/video/midyunit.cpp @@ -557,13 +557,12 @@ TIMER_CALLBACK_MEMBER(midyunit_state::autoerase_line) TMS340X0_SCANLINE_IND16_CB_MEMBER(midyunit_state::scanline_update) { - uint16_t *src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; - int x; /* adjust the display address to account for ignored bits */ - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_pen_map[src[coladdr++ & 0x1ff]]; /* handle autoerase on the previous line */ diff --git a/src/mame/video/midzeus.cpp b/src/mame/video/midzeus.cpp index a633b565e1e..a75ac49ba13 100644 --- a/src/mame/video/midzeus.cpp +++ b/src/mame/video/midzeus.cpp @@ -281,7 +281,7 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma int xoffs = screen.visible_area().min_x; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = WAVERAM_READPIX(base, y, x - xoffs) & 0x7fff; } @@ -302,10 +302,10 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint8_t tex = get_texel_8bit(base, y, x, m_texel_width); + uint8_t const tex = get_texel_8bit(base, y, x, m_texel_width); dest[x] = (tex << 8) | tex; } } diff --git a/src/mame/video/mikromik.cpp b/src/mame/video/mikromik.cpp index 90c779d5179..ee2fb0f8fe3 100644 --- a/src/mame/video/mikromik.cpp +++ b/src/mame/video/mikromik.cpp @@ -19,7 +19,6 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) int compl_in = rvv; // reverse video int hlt_in = hlgt; // highlight; int color; // 0 = black, 1 = dk green, 2 = lt green; on MikroMikko 1, "highlight" is actually the darker shade of green - int i, qh, video_in; int d7 = BIT(romdata, 7); // save MSB (1 indicates that this is a Visual Attribute or Special Code instead of a normal display character) int d6 = BIT(romdata, 6); // save also first and last char bitmap bits before shifting out the MSB @@ -37,19 +36,19 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) // Step 2: Make sure i8275_device::recompute_parameters() is called in i8275_device::device_start() // Step 3: Fill in missing 2 pixels in the screen bitmap by repeating last column of the char bitmap // (works better with MikroMikko 1 font than duplicating the first and the last column) - qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB - video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; + int qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB + int video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; color = (hlt_in ? 1 : 2) * (video_in ^ compl_in); - bitmap.pix32(y, x + 8) = m_palette->pen(color); - bitmap.pix32(y, x + 9) = m_palette->pen(color); + bitmap.pix(y, x + 8) = m_palette->pen(color); + bitmap.pix(y, x + 9) = m_palette->pen(color); } - for (i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline + for (int i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline { - qh = BIT(data, i); - video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; + int qh = BIT(data, i); + int video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; color = (hlt_in ? 1 : 2)*(video_in ^ compl_in); - bitmap.pix32(y, x + i) = m_palette->pen(color); + bitmap.pix(y, x + i) = m_palette->pen(color); } } } @@ -75,7 +74,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels ) uint16_t data = m_video_ram[address >> 1]; for (int i = 0; i < 16; i++) { - if (BIT(data, i)) bitmap.pix32(y, x + i) = m_palette->pen(2); + if (BIT(data, i)) bitmap.pix(y, x + i) = m_palette->pen(2); } } diff --git a/src/mame/video/mmdisplay2.cpp b/src/mame/video/mmdisplay2.cpp index b3f33d21780..74bd90c4139 100644 --- a/src/mame/video/mmdisplay2.cpp +++ b/src/mame/video/mmdisplay2.cpp @@ -70,7 +70,7 @@ void mephisto_display_module2_device::lcd_palette(palette_device &palette) const HD44780_PIXEL_UPDATE(mephisto_display_module2_device::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line*9 + 1 + y, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(line*9 + 1 + y, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/video/model1.cpp b/src/mame/video/model1.cpp index 9d4c8d428da..0de31d90bc4 100644 --- a/src/mame/video/model1.cpp +++ b/src/mame/video/model1.cpp @@ -91,7 +91,7 @@ void model1_state::view_t::project_point_direct(point_t *p) const void model1_state::draw_hline(bitmap_rgb32 &bitmap, int x1, int x2, int y, int color) { - uint32_t *base = &bitmap.pix32(y); + uint32_t *const base = &bitmap.pix(y); while(x1 <= x2) { base[x1] = color; @@ -101,7 +101,7 @@ void model1_state::draw_hline(bitmap_rgb32 &bitmap, int x1, int x2, int y, int c void model1_state::draw_hline_moired(bitmap_rgb32 &bitmap, int x1, int x2, int y, int color) { - uint32_t *base = &bitmap.pix32(y); + uint32_t *const base = &bitmap.pix(y); while(x1 <= x2) { if((x1^y) & 1) @@ -407,7 +407,7 @@ void model1_state::draw_line(bitmap_rgb32 &bitmap, model1_state::view_t *view, i { if (x >= view->x1 && x <= view->x2 && y >= view->y1 && y <= view->y2) { - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; } x += s1x; y += s1y; @@ -421,7 +421,7 @@ void model1_state::draw_line(bitmap_rgb32 &bitmap, model1_state::view_t *view, i } if (x >= view->x1 && x <= view->x2 && y >= view->y1 && y <= view->y2) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } #endif diff --git a/src/mame/video/model2.cpp b/src/mame/video/model2.cpp index 427db401050..3e4478a85e4 100644 --- a/src/mame/video/model2.cpp +++ b/src/mame/video/model2.cpp @@ -948,15 +948,14 @@ void model2_state::draw_framebuffer( bitmap_rgb32 &bitmap, const rectangle &clip { for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int r,g,b; int offset = (x + xoffs) + (y + yoffs)*512; - b = (fbvram[offset] >> 0) & 0x1f; - r = (fbvram[offset] >> 5) & 0x1f; - g = (fbvram[offset] >> 10) & 0x1f; + int b = (fbvram[offset] >> 0) & 0x1f; + int r = (fbvram[offset] >> 5) & 0x1f; + int g = (fbvram[offset] >> 10) & 0x1f; r = pal5bit(r); g = pal5bit(g); b = pal5bit(b); - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/video/model2rd.hxx b/src/mame/video/model2rd.hxx index 53325c06b14..7c878868fac 100644 --- a/src/mame/video/model2rd.hxx +++ b/src/mame/video/model2rd.hxx @@ -60,8 +60,7 @@ void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_ex { #if !defined( MODEL2_TRANSLUCENT) model2_state *state = object.state; - bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap; - u32 *p = &destmap->pix32(scanline); + u32 *const p = &m_destmap.pix(scanline); // u8 *gamma_value = &state->m_gamma_table[0]; /* extract color information */ @@ -119,8 +118,7 @@ void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_ex void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid) { model2_state *state = object.state; - bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap; - u32 *p = &destmap->pix32(scanline); + u32 *const p = &m_destmap.pix(scanline); u32 tex_width = object.texwidth; u32 tex_height = object.texheight; diff --git a/src/mame/video/model3.cpp b/src/mame/video/model3.cpp index d2ebec94fa9..918653160ca 100644 --- a/src/mame/video/model3.cpp +++ b/src/mame/video/model3.cpp @@ -245,12 +245,11 @@ TILE_GET_INFO_MEMBER(model3_state::tile_info_layer3_8bit) { MODEL3_TILE_INFO8(0x #ifdef UNUSED_FUNCTION void model3_state::draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - for(y = cliprect.min_y; y <= cliprect.max_y; y++) + for(int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *d = &bitmap.pix16(y); + uint16_t *const d = &bitmap.pix(y); int index = (y*2)*2048; - for(x = cliprect.min_x; x <= cliprect.max_x; x++) { + for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t pix = m_texture_ram[0][index]; index+=4; if(pix != 0) { @@ -292,8 +291,8 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i for (int y = y1; y <= y2; y++) { - uint32_t* dst = &bitmap.pix32(y); - uint16_t* src = &pixmap.pix16(iy & 0x1ff); + uint32_t *const dst = &bitmap.pix(y); + uint16_t const *const src = &pixmap.pix(iy & 0x1ff); int rowscroll = BYTE_REVERSE16(rowscroll_ram[((layer * 0x200) + y) ^ NATIVE_ENDIAN_VALUE_LE_BE(3,0)]) & 0x7fff; if (rowscroll & 0x100) @@ -2024,14 +2023,12 @@ void model3_state::real3d_traverse_display_list() void model3_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - for (j = cliprect.min_y; j <= cliprect.max_y; ++j) + for (int j = cliprect.min_y; j <= cliprect.max_y; ++j) { - uint32_t *dst = &bitmap.pix32(j); - uint32_t *src = &m_fb->pix32(j); + uint32_t *const dst = &bitmap.pix(j); + uint32_t const *const src = &m_fb->pix(j); - for (i = cliprect.min_x; i <= cliprect.max_x; ++i) + for (int i = cliprect.min_x; i <= cliprect.max_x; ++i) { if (src[i] & 0xff000000) { @@ -2191,8 +2188,8 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris void model3_renderer::draw_scanline_solid(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); float z = extent.param[0].start; float dz = extent.param[0].dpdx; @@ -2221,8 +2218,8 @@ void model3_renderer::draw_scanline_solid(int32_t scanline, const extent_t &exte void model3_renderer::draw_scanline_solid_trans(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); float z = extent.param[0].start; float dz = extent.param[0].dpdx; @@ -2289,8 +2286,8 @@ do { void model3_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2333,8 +2330,8 @@ void model3_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent void model3_renderer::draw_scanline_tex_colormod(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2380,8 +2377,8 @@ void model3_renderer::draw_scanline_tex_colormod(int32_t scanline, const extent_ void model3_renderer::draw_scanline_tex_contour(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2432,8 +2429,8 @@ void model3_renderer::draw_scanline_tex_contour(int32_t scanline, const extent_t void model3_renderer::draw_scanline_tex_trans(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2481,8 +2478,8 @@ void model3_renderer::draw_scanline_tex_trans(int32_t scanline, const extent_t & void model3_renderer::draw_scanline_tex_alpha(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; diff --git a/src/mame/video/momoko.cpp b/src/mame/video/momoko.cpp index a6ed40f4971..de5e4a5982d 100644 --- a/src/mame/video/momoko.cpp +++ b/src/mame/video/momoko.cpp @@ -70,8 +70,6 @@ void momoko_state::flipscreen_w(u8 data) void momoko_state::draw_bg_pri(bitmap_ind16 &bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri) { - int px, py; - for (int sy = 0; sy < 8; sy++) { const u32 gfxadr = chr * 16 + sy * 2; @@ -83,16 +81,14 @@ void momoko_state::draw_bg_pri(bitmap_ind16 &bitmap, int chr, int col, int flipx for (int sx = 0; sx < 4; sx++) { const u8 dot = (d0 & 0x08) | ((d0 & 0x80) >> 5) | ((d1 & 0x08) >> 2) | ((d1 & 0x80) >> 7); - if (flipx == 0) px = sx + xx * 4 + x; - else px = 7 - sx - xx * 4 + x; - if (flipy == 0) py = sy + y; - else py = 7 - sy + y; + const int px = (flipx == 0) ? (sx + xx * 4 + x) : (7 - sx - xx * 4 + x); + const int py = (flipy == 0) ? (sy + y) : (7 - sy + y); if (dot >= pri) - bitmap.pix16(py, px) = col * 16 + dot + 256; + bitmap.pix(py, px) = col * 16 + dot + 256; - d0 = d0 << 1; - d1 = d1 << 1; + d0 <<= 1; + d1 <<= 1; } } } diff --git a/src/mame/video/ms32.cpp b/src/mame/video/ms32.cpp index 9b49f28cd9a..5336bb60258 100644 --- a/src/mame/video/ms32.cpp +++ b/src/mame/video/ms32.cpp @@ -422,28 +422,20 @@ u32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitmap, the priority ram, probably for per-pixel / pen mixing, or more levels than are supported here.. I don't know, it will need hw tests I think */ { - int xx, yy; int width = screen.width(); int height = screen.height(); - const pen_t *paldata = m_palette->pens(); - - u16* srcptr_tile; - u8* srcptr_tilepri; - u16* srcptr_spri; - //u8* srcptr_spripri; - - u32* dstptr_bitmap; + pen_t const *const paldata = m_palette->pens(); bitmap.fill(0, cliprect); - for (yy=0;yy<height;yy++) + for (int yy=0;yy<height;yy++) { - srcptr_tile = &m_temp_bitmap_tilemaps.pix16(yy); - srcptr_tilepri = &screen.priority().pix8(yy); - srcptr_spri = &m_temp_bitmap_sprites.pix16(yy); - //srcptr_spripri = &m_temp_bitmap_sprites_pri.pix8(yy); - dstptr_bitmap = &bitmap.pix32(yy); - for (xx=0;xx<width;xx++) + u16 const *const srcptr_tile = &m_temp_bitmap_tilemaps.pix(yy); + u8 const *const srcptr_tilepri = &screen.priority().pix(yy); + u16 const *const srcptr_spri = &m_temp_bitmap_sprites.pix(yy); + //u8 const *const srcptr_spripri = &m_temp_bitmap_sprites_pri.pix(yy); + u32 *const dstptr_bitmap = &bitmap.pix(yy); + for (int xx=0;xx<width;xx++) { u16 src_tile = srcptr_tile[xx]; u8 src_tilepri = srcptr_tilepri[xx]; diff --git a/src/mame/video/mw8080bw.cpp b/src/mame/video/mw8080bw.cpp index d7479eb8824..cf86bf10f13 100644 --- a/src/mame/video/mw8080bw.cpp +++ b/src/mame/video/mw8080bw.cpp @@ -21,7 +21,7 @@ uint32_t mw8080bw_state::screen_update_mw8080bw(screen_device &screen, bitmap_rg { // plot the current pixel pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; // next pixel video_data = video_data >> 1; @@ -34,7 +34,7 @@ uint32_t mw8080bw_state::screen_update_mw8080bw(screen_device &screen, bitmap_rg for (int i = 0; i < 4; i++) { pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -144,7 +144,7 @@ uint32_t spcenctr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm if (m_brightness > (pen & 0xff)) pen = rgb_t(m_brightness, m_brightness, m_brightness); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; center = center + 1; width = width + ((center & 0x80) ? -1 : 1); @@ -166,7 +166,7 @@ uint32_t spcenctr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else pen = rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -266,7 +266,7 @@ uint32_t mw8080bw_state::screen_update_phantom2(screen_device &screen, bitmap_rg else pen = bit ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; /* move to next pixel -- if ripple carry is currently set, prepare for loading the shift register */ @@ -300,7 +300,7 @@ uint32_t mw8080bw_state::screen_update_phantom2(screen_device &screen, bitmap_rg for (i = 0; i < 4; i++) { pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -365,9 +365,9 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen; + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; // next pixel video_data = video_data >> 1; @@ -382,9 +382,9 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen; + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } diff --git a/src/mame/video/mz700.cpp b/src/mame/video/mz700.cpp index e2749ec0cc3..e110e986185 100644 --- a/src/mame/video/mz700.cpp +++ b/src/mame/video/mz700.cpp @@ -17,18 +17,18 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx,col,bg=0,fg=0,oldcol=0x7e; - uint16_t sy=0,ma=0,x,chr; + uint8_t bg=0,fg=0,oldcol=0x7e; + uint16_t sy=0,ma=0; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - col = m_colorram[x]; + uint8_t col = m_colorram[x]; if (col != oldcol) { oldcol = col; @@ -36,8 +36,8 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitm bg = col & 7; fg = (col >> 3) & 7; } - chr = m_videoram[x] | (BIT(col, 7)<<8); - gfx = m_p_chargen[(chr<<3) | ra ]; + uint16_t chr = m_videoram[x] | (BIT(col, 7)<<8); + uint8_t gfx = m_p_chargen[(chr<<3) | ra ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -72,20 +72,18 @@ uint32_t mz_state::screen_update_mz800(screen_device &screen, bitmap_ind16 &bitm } else { - int x, y; - - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - bitmap.pix16(y, x * 8 + 0) = BIT(m_videoram[x * 8 + y], 0) ? 7 : 0; - bitmap.pix16(y, x * 8 + 1) = BIT(m_videoram[x * 8 + y], 1) ? 7 : 0; - bitmap.pix16(y, x * 8 + 2) = BIT(m_videoram[x * 8 + y], 2) ? 7 : 0; - bitmap.pix16(y, x * 8 + 3) = BIT(m_videoram[x * 8 + y], 3) ? 7 : 0; - bitmap.pix16(y, x * 8 + 4) = BIT(m_videoram[x * 8 + y], 4) ? 7 : 0; - bitmap.pix16(y, x * 8 + 5) = BIT(m_videoram[x * 8 + y], 5) ? 7 : 0; - bitmap.pix16(y, x * 8 + 6) = BIT(m_videoram[x * 8 + y], 6) ? 7 : 0; - bitmap.pix16(y, x * 8 + 7) = BIT(m_videoram[x * 8 + y], 7) ? 7 : 0; + bitmap.pix(y, x * 8 + 0) = BIT(m_videoram[x * 8 + y], 0) ? 7 : 0; + bitmap.pix(y, x * 8 + 1) = BIT(m_videoram[x * 8 + y], 1) ? 7 : 0; + bitmap.pix(y, x * 8 + 2) = BIT(m_videoram[x * 8 + y], 2) ? 7 : 0; + bitmap.pix(y, x * 8 + 3) = BIT(m_videoram[x * 8 + y], 3) ? 7 : 0; + bitmap.pix(y, x * 8 + 4) = BIT(m_videoram[x * 8 + y], 4) ? 7 : 0; + bitmap.pix(y, x * 8 + 5) = BIT(m_videoram[x * 8 + y], 5) ? 7 : 0; + bitmap.pix(y, x * 8 + 6) = BIT(m_videoram[x * 8 + y], 6) ? 7 : 0; + bitmap.pix(y, x * 8 + 7) = BIT(m_videoram[x * 8 + y], 7) ? 7 : 0; } } } diff --git a/src/mame/video/mz80.cpp b/src/mame/video/mz80.cpp index 3b0c5045e1a..e4ae83a5311 100644 --- a/src/mame/video/mz80.cpp +++ b/src/mame/video/mz80.cpp @@ -38,19 +38,18 @@ uint32_t mz80_state::screen_update_mz80k(screen_device &screen, bitmap_ind16 &bi { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0,ma=0; + uint16_t sy=0,ma=0; - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); @@ -73,19 +72,18 @@ uint32_t mz80_state::screen_update_mz80kj(screen_device &screen, bitmap_ind16 &b { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0,ma=0; + uint16_t sy=0,ma=0; - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0); @@ -108,19 +106,18 @@ uint32_t mz80_state::screen_update_mz80a(screen_device &screen, bitmap_ind16 &bi { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); + uint16_t sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x&0x7ff]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x&0x7ff]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/video/n64.cpp b/src/mame/video/n64.cpp index 2a1ba864bff..e0723dfa953 100644 --- a/src/mame/video/n64.cpp +++ b/src/mame/video/n64.cpp @@ -240,7 +240,7 @@ void n64_periphs::video_update16(bitmap_rgb32 &bitmap) { for(int32_t j = 0; j < vres; j++) { - uint32_t* d = &bitmap.pix32(j); + uint32_t *const d = &bitmap.pix(j); for(int32_t i = 0; i < hres; i++) { @@ -289,7 +289,7 @@ void n64_periphs::video_update32(bitmap_rgb32 &bitmap) { for (int32_t j = 0; j < vres; j++) { - uint32_t* d = &bitmap.pix32(j); + uint32_t *const d = &bitmap.pix(j); for (int32_t i = 0; i < hres; i++) { uint32_t pix = *frame_buffer32++; diff --git a/src/mame/video/n8080.cpp b/src/mame/video/n8080.cpp index 393b89a8ed6..7d7a7147d02 100644 --- a/src/mame/video/n8080.cpp +++ b/src/mame/video/n8080.cpp @@ -128,20 +128,15 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { uint8_t mask = flip_screen() ? 0xff : 0x00; - int x; - int y; + uint8_t const *pRAM = m_videoram; + uint8_t const *const pPROM = memregion("proms")->base(); - const uint8_t* pRAM = m_videoram; - const uint8_t* pPROM = memregion("proms")->base(); - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y ^ mask); + uint16_t *const pLine = &bitmap.pix(y ^ mask); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - int n; - uint8_t color = 0; if (m_red_screen) @@ -172,7 +167,7 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm color = ufo_color[cycle % 6]; } - for (n = color + 1; n < 8; n++) + for (int n = color + 1; n < 8; n++) { if (~val & (1 << n)) { @@ -181,7 +176,7 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } } - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { pLine[(x + n) ^ mask] = (pRAM[x >> 3] & (1 << n)) ? color : 0; } @@ -197,21 +192,15 @@ uint32_t sheriff_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { uint8_t mask = flip_screen() ? 0xff : 0x00; - const uint8_t* pPROM = memregion("proms")->base(); - - int x; - int y; - - const uint8_t* pRAM = m_videoram; + uint8_t const *pRAM = m_videoram; + uint8_t const *const pPROM = memregion("proms")->base(); - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y ^ mask); + uint16_t *const pLine = &bitmap.pix(y ^ mask); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - int n; - uint8_t color = pPROM[32 * (y >> 3) + (x >> 3)]; if (m_sheriff_color_mode == 1 && !(color & 8)) @@ -223,7 +212,7 @@ uint32_t sheriff_state::screen_update(screen_device &screen, bitmap_ind16 &bitma if (m_sheriff_color_mode == 3) color = 7; - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { pLine[(x + n) ^ mask] = ((pRAM[x >> 3] >> n) & 1) ? (color & 7) : 0; } @@ -245,18 +234,15 @@ uint32_t helifire_state::screen_update(screen_device &screen, bitmap_ind16 &bitm unsigned saved_mv = m_mv; unsigned saved_sc = m_sc; - int x; - int y; - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int level = 120 + wave[m_mv & 7]; /* draw sky */ - for (x = level; x < 256; x++) + for (int x = level; x < 256; x++) { pLine[x] = 0x200 + 8 + SUN_BRIGHTNESS + x - level; } @@ -291,20 +277,18 @@ uint32_t helifire_state::screen_update(screen_device &screen, bitmap_ind16 &bitm /* draw sea */ - for (x = 0; x < level; x++) + for (int x = 0; x < level; x++) { pLine[x] = 8 + SEA_BRIGHTNESS + x; } /* draw foreground */ - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { int offset = 32 * y + (x >> 3); - int n; - - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { if (flip_screen()) { diff --git a/src/mame/video/namco_c355spr.cpp b/src/mame/video/namco_c355spr.cpp index cd06bfe1664..570c6a92e7d 100644 --- a/src/mame/video/namco_c355spr.cpp +++ b/src/mame/video/namco_c355spr.cpp @@ -111,8 +111,8 @@ void namco_c355spr_device::zdrawgfxzoom( { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -140,8 +140,8 @@ void namco_c355spr_device::copybitmap(bitmap_ind16 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *dest = &dest_bmp.pix16(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -174,8 +174,8 @@ void namco_c355spr_device::copybitmap(bitmap_ind16 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *dest = &dest_bmp.pix16(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -213,9 +213,9 @@ void namco_c355spr_device::copybitmap(bitmap_rgb32 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *srcrender = &m_screenbitmap.pix16(y); - u32 *dest = &dest_bmp.pix32(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const srcrender = &m_screenbitmap.pix(y); + u32 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -251,9 +251,9 @@ void namco_c355spr_device::copybitmap(bitmap_rgb32 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *srcrender = &m_screenbitmap.pix16(y); - u32 *dest = &dest_bmp.pix32(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const srcrender = &m_screenbitmap.pix(y); + u32 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) diff --git a/src/mame/video/namcona1.cpp b/src/mame/video/namcona1.cpp index 4fcab2c581d..6cedb59394a 100644 --- a/src/mame/video/namcona1.cpp +++ b/src/mame/video/namcona1.cpp @@ -295,10 +295,10 @@ void namcona1_state::pdraw_tile( { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - const u8 *mask_addr = mask_base + y_index * mask->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &screen.priority().pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u8 const *const mask_addr = mask_base + y_index * mask->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &screen.priority().pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -506,8 +506,8 @@ void namcona1_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap //const pen_t *paldata = &m_palette->pen(m_bg_tilemap[which]->palette_offset()); const pen_t *paldata = &m_palette->pen(0); - draw_pixel_line(cliprect, &bitmap.pix16(line), - &screen.priority().pix8(line), + draw_pixel_line(cliprect, &bitmap.pix(line), + &screen.priority().pix(line), m_videoram + ydata + 25, paldata); } diff --git a/src/mame/video/namcos21_3d.cpp b/src/mame/video/namcos21_3d.cpp index 9858a9afcf4..a6f8921c094 100644 --- a/src/mame/video/namcos21_3d.cpp +++ b/src/mame/video/namcos21_3d.cpp @@ -59,14 +59,12 @@ void namcos21_3d_device::swap_and_clear_poly_framebuffer() void namcos21_3d_device::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const rectangle &clip, int zlo, int zhi) { /* blit the visible framebuffer */ - int sy; - for (sy = clip.top(); sy <= clip.bottom(); sy++) + for (int sy = clip.top(); sy <= clip.bottom(); sy++) { - uint16_t *dest = &bitmap.pix16(sy); - const uint16_t *pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy; - const uint16_t *pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy; - int sx; - for (sx = clip.left(); sx <= clip.right(); sx++) + uint16_t *const dest = &bitmap.pix(sy); + uint16_t const *const pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy; + uint16_t const *const pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy; + for (int sx = clip.left(); sx <= clip.right(); sx++) { int z = pZ[sx]; //if( pZ[sx]!=0x7fff ) diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp index 27354f16379..0fb23435b92 100644 --- a/src/mame/video/namcos22.cpp +++ b/src/mame/video/namcos22.cpp @@ -52,12 +52,12 @@ void namcos22_renderer::renderscanline_uvi_full(int32_t scanline, const extent_t int penmask = 0xff; int penshift = 0; int prioverchar = extra.prioverchar; - u32 *dest = &extra.destbase->pix32(scanline); - u8 *primap = &extra.primap->pix8(scanline); - u16 *ttmap = m_state.m_texture_tilemap; - u8 *ttattr = m_state.m_texture_tileattr.get(); - u8 *ttdata = m_state.m_texture_tiledata; - u8 *tt_ayx_to_pixel = m_state.m_texture_ayx_to_pixel.get(); + u32 *const dest = &extra.destbase->pix(scanline); + u8 *const primap = &extra.primap->pix(scanline); + u16 *const ttmap = m_state.m_texture_tilemap; + u8 *const ttattr = m_state.m_texture_tileattr.get(); + u8 *const ttdata = m_state.m_texture_tiledata; + u8 *const tt_ayx_to_pixel = m_state.m_texture_ayx_to_pixel.get(); if (extra.cmode & 4) { @@ -194,9 +194,9 @@ void namcos22_renderer::renderscanline_sprite(int32_t scanline, const extent_t & int fadefactor = 0xff - extra.fadefactor; rgbaint_t fogcolor(extra.fogcolor); rgbaint_t fadecolor(extra.fadecolor); - u8 *source = (u8 *)extra.source + y_index * extra.line_modulo; - u32 *dest = &extra.destbase->pix32(scanline); - u8 *primap = &extra.primap->pix8(scanline); + u8 *const source = (u8 *)extra.source + y_index * extra.line_modulo; + u32 *const dest = &extra.destbase->pix(scanline); + u8 *const primap = &extra.primap->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -1946,9 +1946,9 @@ void namcos22s_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb // mix textlayer with poly/sprites for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *src = &m_mix_bitmap->pix16(y); - u32 *dest = &bitmap.pix32(y); - u8 *pri = &screen.priority().pix8(y); + u16 const *const src = &m_mix_bitmap->pix(y); + u32 *const dest = &bitmap.pix(y); + u8 const *const pri = &screen.priority().pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { // skip if transparent or under poly/sprite @@ -2019,9 +2019,9 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 // mix textlayer with polys + do final mix for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *src = &m_mix_bitmap->pix16(y); - u32 *dest = &bitmap.pix32(y); - u8 *pri = &screen.priority().pix8(y); + u16 const *const src = &m_mix_bitmap->pix(y); + u32 *const dest = &bitmap.pix(y); + u8 const *const pri = &screen.priority().pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { u32 pixel = dest[x]; @@ -2404,7 +2404,7 @@ u32 namcos22s_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb32 const u8 *blut = (const u8 *)&m_mixer[0x300/4]; for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dest = &bitmap.pix32(y); + u32 *const dest = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { int rgb = dest[x]; diff --git a/src/mame/video/namcos2_roz.cpp b/src/mame/video/namcos2_roz.cpp index 04f7f96ce4f..88ba624009f 100644 --- a/src/mame/video/namcos2_roz.cpp +++ b/src/mame/video/namcos2_roz.cpp @@ -75,7 +75,7 @@ draw_roz_helper_block(const struct roz_param *rozInfo, int destx, int desty, int end_incrx = rozInfo->incyx - (width * rozInfo->incxx); int end_incry = rozInfo->incyy - (width * rozInfo->incxy); - uint16_t *dest = &destbitmap.pix16(desty, destx); + uint16_t *dest = &destbitmap.pix(desty, destx); int dest_rowinc = destbitmap.rowpixels() - width; while (desty < desty_end) @@ -96,9 +96,9 @@ draw_roz_helper_block(const struct roz_param *rozInfo, int destx, int desty, goto L_SkipPixel; } - if (flagsbitmap.pix8(ypos, xpos) & TILEMAP_PIXEL_LAYER0) + if (flagsbitmap.pix(ypos, xpos) & TILEMAP_PIXEL_LAYER0) { - *dest = srcbitmap.pix16(ypos, xpos) + rozInfo->color; + *dest = srcbitmap.pix(ypos, xpos) + rozInfo->color; } L_SkipPixel: diff --git a/src/mame/video/namcos2_sprite.cpp b/src/mame/video/namcos2_sprite.cpp index 7d2f2f434b7..2e6f48abf91 100644 --- a/src/mame/video/namcos2_sprite.cpp +++ b/src/mame/video/namcos2_sprite.cpp @@ -117,9 +117,9 @@ void namcos2_sprite_device::zdrawgfxzoom( { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; /* this code was previously shared with the c355 where this was needed if (m_palxor) diff --git a/src/mame/video/nbmj8688.cpp b/src/mame/video/nbmj8688.cpp index 75ab83fd15a..e4b8f58dffa 100644 --- a/src/mame/video/nbmj8688.cpp +++ b/src/mame/video/nbmj8688.cpp @@ -244,7 +244,7 @@ void nbmj8688_state::vramflip() void nbmj8688_state::update_pixel(int x, int y) { int color = m_videoram[(y * 512) + x]; - m_tmpbitmap->pix16(y, x) = color; + m_tmpbitmap->pix(y, x) = color; } void nbmj8688_state::writeram_low(int x, int y, int color) diff --git a/src/mame/video/nbmj8891.cpp b/src/mame/video/nbmj8891.cpp index b041106f96d..4b82c47ace7 100644 --- a/src/mame/video/nbmj8891.cpp +++ b/src/mame/video/nbmj8891.cpp @@ -296,13 +296,13 @@ void nbmj8891_state::vramflip(int vram) void nbmj8891_state::update_pixel0(int x, int y) { uint8_t color = m_videoram0[(y * m_screen->width()) + x]; - m_tmpbitmap0.pix16(y, x) = color; + m_tmpbitmap0.pix(y, x) = color; } void nbmj8891_state::update_pixel1(int x, int y) { uint8_t color = m_videoram1[(y * m_screen->width()) + x]; - m_tmpbitmap1.pix16(y, x) = (color == 0x7f) ? 0xff : color; + m_tmpbitmap1.pix(y, x) = (color == 0x7f) ? 0xff : color; } void nbmj8891_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj8900.cpp b/src/mame/video/nbmj8900.cpp index faf75765d88..f6a1e8deff1 100644 --- a/src/mame/video/nbmj8900.cpp +++ b/src/mame/video/nbmj8900.cpp @@ -188,13 +188,13 @@ void nbmj8900_state::vramflip(int vram) void nbmj8900_state::update_pixel0(int x, int y) { uint8_t color = m_videoram0[(y * m_screen_width) + x]; - m_tmpbitmap0.pix16(y, x) = m_palette->pen(color); + m_tmpbitmap0.pix(y, x) = m_palette->pen(color); } void nbmj8900_state::update_pixel1(int x, int y) { uint8_t color = m_videoram1[(y * m_screen_width) + x]; - m_tmpbitmap1.pix16(y, x) = m_palette->pen(color); + m_tmpbitmap1.pix(y, x) = m_palette->pen(color); } void nbmj8900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj8991.cpp b/src/mame/video/nbmj8991.cpp index e13e5bfb832..5f6862b5a37 100644 --- a/src/mame/video/nbmj8991.cpp +++ b/src/mame/video/nbmj8991.cpp @@ -131,20 +131,18 @@ void nbmj8991_state::clut_w(offs_t offset, uint8_t data) ******************************************************************************/ void nbmj8991_state::vramflip() { - int x, y; - uint8_t color1, color2; int width = m_screen->width(); int height = m_screen->height(); if (m_flipscreen == m_flipscreen_old) return; - for (y = 0; y < height / 2; y++) + for (int y = 0; y < height / 2; y++) { - for (x = 0; x < width / 2; x++) + for (int x = 0; x < width / 2; x++) { // rotate 180 degrees ( 0, 0) - ( 511, 511) - color1 = m_videoram[(y * width) + x]; - color2 = m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; + uint8_t color1 = m_videoram[(y * width) + x]; + uint8_t color2 = m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; m_videoram[(y * width) + x] = color2; m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)] = color1; // rotate 180 degrees ( 512, 0) - (1023, 511) @@ -162,7 +160,7 @@ void nbmj8991_state::vramflip() void nbmj8991_state::update_pixel(int x, int y) { uint8_t color = m_videoram[(y * m_screen->width()) + x]; - m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix(y, x) = color; } void nbmj8991_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj9195.cpp b/src/mame/video/nbmj9195.cpp index 153b420987f..17446bcc76b 100644 --- a/src/mame/video/nbmj9195.cpp +++ b/src/mame/video/nbmj9195.cpp @@ -176,7 +176,7 @@ void nbmj9195_state::vramflip(int vram) void nbmj9195_state::update_pixel(int vram, int x, int y) { uint16_t color = m_videoram[vram][(y * m_screen->width()) + x]; - m_tmpbitmap[vram].pix16(y, x) = color; + m_tmpbitmap[vram].pix(y, x) = color; } void nbmj9195_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nc.cpp b/src/mame/video/nc.cpp index 4770ee94f7c..4da4e3d583e 100644 --- a/src/mame/video/nc.cpp +++ b/src/mame/video/nc.cpp @@ -69,7 +69,7 @@ uint32_t nc_state::screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, for (int b = 0; b < 8; b++) { - bitmap.pix16(y, x) = pens[(byte>>7) & 0x01]; + bitmap.pix(y, x) = pens[(byte>>7) & 0x01]; byte = byte<<1; x++; } diff --git a/src/mame/video/neogeo_spr.cpp b/src/mame/video/neogeo_spr.cpp index b069f8fc143..19dabfc457d 100644 --- a/src/mame/video/neogeo_spr.cpp +++ b/src/mame/video/neogeo_spr.cpp @@ -181,7 +181,7 @@ void neosprite_base_device::draw_fixed_layer(bitmap_rgb32 &bitmap, int scanline) uint8_t* gfx_base = m_fixed_layer_source ? m_region_fixed : m_region_fixedbios->base(); uint32_t addr_mask = ( m_fixed_layer_source ? m_region_fixed_size : m_region_fixedbios->bytes() ) - 1; uint16_t *video_data = &m_videoram_drawsource[0x7000 | (scanline >> 3)]; - uint32_t *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, NEOGEO_HBEND); int garouoffsets[32]; int banked = m_fixed_layer_source && (addr_mask > 0x1ffff); @@ -414,7 +414,7 @@ void neosprite_base_device::draw_sprites(bitmap_rgb32 &bitmap, int scanline) /* draw the line - no wrap-around */ if (x <= 0x01f0) { - uint32_t *pixel_addr = &bitmap.pix32(scanline, x + NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, x + NEOGEO_HBEND); for (int i = 0; i < 0x10; i++) { @@ -436,7 +436,7 @@ void neosprite_base_device::draw_sprites(bitmap_rgb32 &bitmap, int scanline) else { int x_save = x; - uint32_t *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, NEOGEO_HBEND); for (int i = 0; i < 0x10; i++) { diff --git a/src/mame/video/newbrain.cpp b/src/mame/video/newbrain.cpp index 714326050b0..56e7c072b17 100644 --- a/src/mame/video/newbrain.cpp +++ b/src/mame/video/newbrain.cpp @@ -121,10 +121,10 @@ void newbrain_state::do_screen_update(bitmap_rgb32 &bitmap, const rectangle &cli uint8_t sr = gr ? grsr : vsr; int color = BIT(sr, 7) ^ m_rv; - bitmap.pix32(y, x++) = m_palette->pen(color); + bitmap.pix(y, x++) = m_palette->pen(color); if (columns == 40) { - bitmap.pix32(y, x++) = m_palette->pen(color); + bitmap.pix(y, x++) = m_palette->pen(color); } grsr <<= 1; diff --git a/src/mame/video/nick.cpp b/src/mame/video/nick.cpp index 9aa6c940924..ddaf8c0aff2 100644 --- a/src/mame/video/nick.cpp +++ b/src/mame/video/nick.cpp @@ -192,7 +192,7 @@ void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param, if (scanline < ENTERPRISE_SCREEN_HEIGHT) { /* set write address for line */ - m_dest = &m_bitmap.pix32(scanline); + m_dest = &m_bitmap.pix(scanline); m_dest_pos = 0; m_dest_max_pos = m_bitmap.width(); diff --git a/src/mame/video/ninjakd2.cpp b/src/mame/video/ninjakd2.cpp index 700172ce5a9..2ec95db5dff 100644 --- a/src/mame/video/ninjakd2.cpp +++ b/src/mame/video/ninjakd2.cpp @@ -352,7 +352,7 @@ void ninjakd2_state::erase_sprites( bitmap_ind16 &bitmap) { for (int x = 0; x < m_sprites_bitmap.width(); ++x) { - uint16_t* const ptr = &m_sprites_bitmap.pix16(y, x); + uint16_t *const ptr = &m_sprites_bitmap.pix(y, x); if ( (*m_stencil_compare_function)(*ptr) ) *ptr = 0xf; } } diff --git a/src/mame/video/nitedrvr.cpp b/src/mame/video/nitedrvr.cpp index d33c8472bfa..0ccd49114c6 100644 --- a/src/mame/video/nitedrvr.cpp +++ b/src/mame/video/nitedrvr.cpp @@ -16,7 +16,7 @@ void nitedrvr_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, i { for (int x = bx; x < ex; x++) if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; } } diff --git a/src/mame/video/niyanpai.cpp b/src/mame/video/niyanpai.cpp index 3c14c3e1610..6aa036fa502 100644 --- a/src/mame/video/niyanpai.cpp +++ b/src/mame/video/niyanpai.cpp @@ -159,7 +159,7 @@ void niyanpai_state::vramflip(int vram) void niyanpai_state::update_pixel(int vram, int x, int y) { uint16_t color = m_videoram[vram][(y * m_screen->width()) + x]; - m_tmpbitmap[vram].pix16(y, x) = color; + m_tmpbitmap[vram].pix(y, x) = color; } void niyanpai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/offtwall.cpp b/src/mame/video/offtwall.cpp index f71c058acf6..d60f75dc519 100644 --- a/src/mame/video/offtwall.cpp +++ b/src/mame/video/offtwall.cpp @@ -89,13 +89,12 @@ uint32_t offtwall_state::screen_update_offtwall(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not yet verified - */ + // not yet verified pf[x] = mo[x]; } } diff --git a/src/mame/video/ojankohs.cpp b/src/mame/video/ojankohs.cpp index db98c744a4b..57509869188 100644 --- a/src/mame/video/ojankohs.cpp +++ b/src/mame/video/ojankohs.cpp @@ -208,18 +208,14 @@ void ojankohs_state::ojankoc_flipscreen(int data) void ojankohs_state::ojankoc_videoram_w(offs_t offset, uint8_t data) { - int i; - uint8_t x, y, xx, px, py ; - uint8_t color, color1, color2; - m_videoram[offset] = data; - color1 = m_videoram[offset & 0x3fff]; - color2 = m_videoram[offset | 0x4000]; + uint8_t color1 = m_videoram[offset & 0x3fff]; + uint8_t color2 = m_videoram[offset | 0x4000]; - y = offset >> 6; - x = (offset & 0x3f) << 2; - xx = 0; + uint8_t y = offset >> 6; + uint8_t x = (offset & 0x3f) << 2; + uint8_t xx = 0; if (m_flipscreen) { @@ -228,14 +224,14 @@ void ojankohs_state::ojankoc_videoram_w(offs_t offset, uint8_t data) xx = 3; } - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { - color = ((color1 & 0x01) >> 0) | ((color1 & 0x10) >> 3) | ((color2 & 0x01) << 2) | ((color2 & 0x10) >> 1); + uint8_t color = ((color1 & 0x01) >> 0) | ((color1 & 0x10) >> 3) | ((color2 & 0x01) << 2) | ((color2 & 0x10) >> 1); - px = x + (i ^ xx); - py = y; + uint8_t px = x + (i ^ xx); + uint8_t py = y; - m_tmpbitmap.pix16(py, px) = color; + m_tmpbitmap.pix(py, px) = color; color1 >>= 1; color2 >>= 1; diff --git a/src/mame/video/orion.cpp b/src/mame/video/orion.cpp index b806f87b150..44e49a2afd0 100644 --- a/src/mame/video/orion.cpp +++ b/src/mame/video/orion.cpp @@ -74,7 +74,7 @@ uint32_t orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 break; } } - bitmap.pix16(y, x*8+(7-b)) = color; + bitmap.pix(y, x*8+(7-b)) = color; } } } diff --git a/src/mame/video/osi.cpp b/src/mame/video/osi.cpp index d06540810e6..222f3fdd560 100644 --- a/src/mame/video/osi.cpp +++ b/src/mame/video/osi.cpp @@ -65,7 +65,7 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; } - bitmap.pix16(y, x++) = color; + bitmap.pix(y, x++) = color; charrom_data <<= 1; } @@ -98,8 +98,8 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; } - bitmap.pix16(y, x++) = color; - bitmap.pix16(y, x++) = color; + bitmap.pix(y, x++) = color; + bitmap.pix(y, x++) = color; charrom_data <<= 1; } @@ -128,7 +128,7 @@ uint32_t uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int bit = 0; bit < 8; bit++) { - bitmap.pix16(y, x) = BIT(charrom_data, 7); + bitmap.pix(y, x) = BIT(charrom_data, 7); x++; charrom_data <<= 1; } diff --git a/src/mame/video/p2000t.cpp b/src/mame/video/p2000t.cpp index ad34ae63073..380ee26a143 100644 --- a/src/mame/video/p2000t.cpp +++ b/src/mame/video/p2000t.cpp @@ -22,14 +22,14 @@ void p2000m_state::video_start() uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; - int offs, sx, sy, code, loop; + uint8_t const *const videoram = m_videoram; - for (offs = 0; offs < 80 * 24; offs++) + for (int offs = 0; offs < 80 * 24; offs++) { - sy = (offs / 80) * 20; - sx = (offs % 80) * 12; + int sy = (offs / 80) * 20; + int sx = (offs % 80) * 12; + int code; if ((m_frame_count > 25) && (videoram[offs + 2048] & 0x40)) code = 32; else @@ -49,10 +49,10 @@ uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 if (videoram[offs] & 0x80) { - for (loop = 0; loop < 12; loop++) + for (int loop = 0; loop < 12; loop++) { - bitmap.pix16(sy + 18, sx + loop) = 0; /* cursor */ - bitmap.pix16(sy + 19, sx + loop) = 0; /* cursor */ + bitmap.pix(sy + 18, sx + loop) = 0; /* cursor */ + bitmap.pix(sy + 19, sx + loop) = 0; /* cursor */ } } } diff --git a/src/mame/video/pacland.cpp b/src/mame/video/pacland.cpp index 30164aeb8bb..7f5be3f9e11 100644 --- a/src/mame/video/pacland.cpp +++ b/src/mame/video/pacland.cpp @@ -334,9 +334,9 @@ void pacland_state::draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const r /* now copy the fg_bitmap to the destination wherever the sprite pixel allows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint8_t *pri = &screen.priority().pix8(y); - uint16_t *src = &m_fg_bitmap.pix16(y); - uint16_t *dst = &bitmap.pix16(y); + uint8_t const *const pri = &screen.priority().pix(y); + uint16_t *const src = &m_fg_bitmap.pix(y); + uint16_t *const dst = &bitmap.pix(y); /* only copy if the priority bitmap is 0 (no high priority sprite) and the source pixel is not the invalid pen; also clear to 0xffff when finished */ @@ -382,8 +382,8 @@ uint32_t pacland_state::screen_update(screen_device &screen, bitmap_ind16 &bitma draw_sprites(screen, m_sprite_bitmap, cliprect, flip, 2); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *spr = &m_sprite_bitmap.pix16(y); - uint16_t *bmp = &bitmap.pix16(y); + uint16_t *const spr = &m_sprite_bitmap.pix(y); + uint16_t const *const bmp = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* clear to 0 if "m_sprite_bitmap" and "bitmap" are different, diff --git a/src/mame/video/paradise.cpp b/src/mame/video/paradise.cpp index 47a012fece8..3aa0a65333a 100644 --- a/src/mame/video/paradise.cpp +++ b/src/mame/video/paradise.cpp @@ -137,15 +137,13 @@ TILE_GET_INFO_MEMBER(paradise_state::get_tile_info_2) void paradise_state::pixmap_w(offs_t offset, uint8_t data) { - int x, y; - m_videoram[offset] = data; - x = (offset & 0x7f) << 1; - y = (offset >> 7); + int x = (offset & 0x7f) << 1; + int y = (offset >> 7); - m_tmpbitmap.pix16(y, x + 0) = 0x80f - (data >> 4); - m_tmpbitmap.pix16(y, x + 1) = 0x80f - (data & 0x0f); + m_tmpbitmap.pix(y, x + 0) = 0x80f - (data >> 4); + m_tmpbitmap.pix(y, x + 1) = 0x80f - (data & 0x0f); } diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp index 8e30aa709a4..c15ea0eea58 100644 --- a/src/mame/video/pastelg.cpp +++ b/src/mame/video/pastelg.cpp @@ -286,7 +286,7 @@ uint32_t pastelg_common_state::screen_update(screen_device &screen, bitmap_ind16 for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) - bitmap.pix16(y, x) = m_videoram[(y * width) + x]; + bitmap.pix(y, x) = m_videoram[(y * width) + x]; } else bitmap.fill(0, cliprect); diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp index 9dc539435cf..2e1d6433c81 100644 --- a/src/mame/video/pc080sn.cpp +++ b/src/mame/video/pc080sn.cpp @@ -362,16 +362,13 @@ static u16 topspeed_get_road_pixel_color( u16 pixel, u16 color ) void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u8 priority, u16 *color_ctrl_ram, u8 pmask) { - u16 *dst16, *src16; - u8 *tsrc; u16 scanline[1024]; /* won't be called by a wide-screen game, but just in case... */ - bitmap_ind16 &srcbitmap = m_tilemap[layer]->pixmap(); - bitmap_ind8 &flagsbitmap = m_tilemap[layer]->flagsmap(); + bitmap_ind16 const &srcbitmap = m_tilemap[layer]->pixmap(); + bitmap_ind8 const &flagsbitmap = m_tilemap[layer]->flagsmap(); - u16 a, color; - int sx, x_index; - int y_index, src_y_index, row_index; + int sx; + int y_index; int flip = 0; @@ -395,21 +392,21 @@ void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &b for (int y = min_y; y <= max_y; y++) { - src_y_index = y_index & 0x1ff; /* tilemaps are 512 px up/down */ - row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff; - color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff]; + int src_y_index = y_index & 0x1ff; /* tilemaps are 512 px up/down */ + int row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff; + u16 color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff]; - x_index = sx - (m_bgscroll_ram[layer][row_index]); + int x_index = sx - (m_bgscroll_ram[layer][row_index]); - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + u16 const *const src16 = &srcbitmap.pix(src_y_index); + u8 const *const tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) { for (int i = 0; i < screen_width; i++) { - a = src16[x_index & width_mask]; + u16 a = src16[x_index & width_mask]; #ifdef TOPSPEED_ROAD_COLORS a = topspeed_get_road_pixel_color(a, color); #endif @@ -423,7 +420,7 @@ void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &b { if (tsrc[x_index & width_mask]) { - a = src16[x_index & width_mask]; + u16 a = src16[x_index & width_mask]; #ifdef TOPSPEED_ROAD_COLORS a = topspeed_get_road_pixel_color(a,color); #endif diff --git a/src/mame/video/pc4.cpp b/src/mame/video/pc4.cpp index 4e427652b5b..6f8b1e8543e 100644 --- a/src/mame/video/pc4.cpp +++ b/src/mame/video/pc4.cpp @@ -30,12 +30,12 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (m_ddram[char_pos] <= 0x10) { //draw CGRAM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); + bitmap.pix(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); } else { //draw CGROM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); + bitmap.pix(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); } @@ -45,12 +45,12 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c //draw the cursor if (m_cursor_on) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + 7, i * 6 + x) = 1; + bitmap.pix(l*9 + 7, i * 6 + x) = 1; if (!m_blink && m_blink_on) for (int y=0; y<7; y++) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + y, i * 6 + x) = 1; + bitmap.pix(l*9 + y, i * 6 + x) = 1; } } diff --git a/src/mame/video/pc6001.cpp b/src/mame/video/pc6001.cpp index 8dcb5121ed0..2874283e3fe 100644 --- a/src/mame/video/pc6001.cpp +++ b/src/mame/video/pc6001.cpp @@ -135,9 +135,6 @@ void pc6001sr_state::video_start() /* this is known as gfx mode 4 */ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr) { - int x,y,xi; - int fgcol,color; - int col_setting; static const uint8_t pen_gattr[4][4] = { { 0, 1, 6, 2 }, //Red / Blue { 0, 6, 1, 2 }, //Blue / Red @@ -150,38 +147,38 @@ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect { 0, 5, 2, 7 }, //Pink / Green { 0, 2, 5, 7 }, //Green / Pink }; - col_setting = m_io_mode4_dsw->read() & 7; + int col_setting = m_io_mode4_dsw->read() & 7; if((attr & 0x0c) != 0x0c) popmessage("Mode 4 vram attr != 0x0c, contact MESSdev"); - for(y=0;y<192;y++) + for(int y=0;y<192;y++) { - for(x=0;x<32;x++) + for(int x=0;x<32;x++) { int tile = m_video_ram[(x+(y*32))+0x200]; if(col_setting == 0x00) //monochrome { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - fgcol = (attr & 2) ? 7 : 2; + int fgcol = (attr & 2) ? 7 : 2; - color = ((tile)>>(7-xi) & 1) ? fgcol : 0; + int color = ((tile)>>(7-xi) & 1) ? fgcol : 0; - bitmap.pix16((y+24), (x*8+xi)+32) = m_palette->pen(color); + bitmap.pix((y+24), (x*8+xi)+32) = m_palette->pen(color); } } else { - for(xi=0;xi<4;xi++) + for(int xi=0;xi<4;xi++) { - fgcol = ((tile)>>(6-(xi*2)) & 3); + int fgcol = ((tile)>>(6-(xi*2)) & 3); - color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); + int color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); - bitmap.pix16((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); - bitmap.pix16((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); + bitmap.pix((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); + bitmap.pix((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); } } } @@ -190,8 +187,6 @@ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr) { - int color,x,y,xi,yi; - int shrink_x = 2*4; int shrink_y = (attr & 8) ? 1 : 2; int w = (shrink_x == 8) ? 32 : 16; @@ -199,22 +194,21 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre if(attr & 4) { - for(y=0;y<(192/shrink_y);y++) + for(int y=0;y<(192/shrink_y);y++) { - for(x=0;x<w;x++) + for(int x=0;x<w;x++) { int tile = m_video_ram[(x+(y*32))+0x200]; - for(yi=0;yi<shrink_y;yi++) + for(int yi=0;yi<shrink_y;yi++) { - for(xi=0;xi<shrink_x;xi++) + for(int xi=0;xi<shrink_x;xi++) { - int i; - i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; - color = ((tile >> i) & 3)+8; + int i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; + int color = ((tile >> i) & 3)+8; color+= col_bank; - bitmap.pix16(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); } } } @@ -222,24 +216,23 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre } else /* TODO: clean this up */ { - for(y=0;y<(192/shrink_y);y+=3) + for(int y=0;y<(192/shrink_y);y+=3) { - for(x=0;x<w;x++) + for(int x=0;x<w;x++) { int tile = m_video_ram[(x+((y/3)*32))+0x200]; - for(yi=0;yi<shrink_y;yi++) + for(int yi=0;yi<shrink_y;yi++) { - for(xi=0;xi<shrink_x;xi++) + for(int xi=0;xi<shrink_x;xi++) { - int i; - i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; - color = ((tile >> i) & 3)+8; + int i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; + int color = ((tile >> i) & 3)+8; color+= col_bank; - bitmap.pix16((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); } } } @@ -249,19 +242,17 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr) { - int color,pen,xi,yi; - + int pen; if(attr & 0x10) //2x2 squares on a single cell pen = (tile & 0x70)>>4; else //2x3 pen = (tile & 0xc0) >> 6 | (attr & 2)<<1; - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int i; - i = (xi & 4)>>2; //x-axis + int i = (xi & 4)>>2; //x-axis if(attr & 0x10) //2x2 { i+= (yi >= 6) ? 2 : 0; //y-axis @@ -272,24 +263,24 @@ void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect i+= (yi & 8)>>1; //y-axis 2 } - color = ((tile >> i) & 1) ? pen+8 : 0; + int color = ((tile >> i) & 1) ? pen+8 : 0; - bitmap.pix16(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); + bitmap.pix(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); } } } void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847) { - int xi,yi,pen,fgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int fgcol,color; if(has_mc6847) { fgcol = (attr & 2) ? 0x12 : 0x10; @@ -310,19 +301,18 @@ void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect color = pen ? fgcol : 0; } - bitmap.pix16(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); + bitmap.pix(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); } } } void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847) { - int x,y,color; - - for(y=0;y<240;y++) + for(int y=0;y<240;y++) { - for(x=0;x<320;x++) + for(int x=0;x<320;x++) { + int color; if(!has_mc6847) //mk2 border color is always black color = 0; else if((attr & 0x90) == 0x80) //2bpp @@ -332,17 +322,14 @@ void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,in else color = 0; //FIXME: other modes not yet checked - bitmap.pix16(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); } } } void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847) { - int x,y; - int tile,attr; - - attr = m_video_ram[0]; + int attr = m_video_ram[0]; draw_border(bitmap,cliprect,attr,has_mc6847); @@ -359,11 +346,11 @@ void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &clip } else // text mode { - for(y=0;y<16;y++) + for(int y=0;y<16;y++) { - for(x=0;x<32;x++) + for(int x=0;x<32;x++) { - tile = m_video_ram[(x+(y*32))+0x200]; + int tile = m_video_ram[(x+(y*32))+0x200]; attr = m_video_ram[(x+(y*32)) & 0x1ff]; if(attr & 0x40) @@ -388,20 +375,16 @@ uint32_t pc6001_state::screen_update_pc6001(screen_device &screen, bitmap_ind16 uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,tile,attr; - /* note: bitmap mode have priority over everything else, check American Truck */ if(m_exgfx_bitmap_mode) { - int count,color,i; + int count = 0; - count = 0; - - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<160;x+=4) + for(int x=0;x<160;x+=4) { - for(i=0;i<4;i++) + for(int i=0;i<4;i++) { int pen[2]; #if 0 @@ -417,16 +400,16 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ pen[0] = m_video_ram[count+0x0000] >> (6-i*2) & 3; pen[1] = m_video_ram[count+0x2000] >> (6-i*2) & 3; - color = 0x10; + int color = 0x10; color |= ((pen[0] & 1) << 2); color |= ((pen[0] & 2) >> 1); color |= ((pen[1] & 1) << 1); color |= ((pen[1] & 2) << 2); if (cliprect.contains((x+i)*2+0, y)) - bitmap.pix16(y, (x+i)*2+0) = m_palette->pen(color); + bitmap.pix(y, (x+i)*2+0) = m_palette->pen(color); if (cliprect.contains((x+i)*2+1, y)) - bitmap.pix16(y, (x+i)*2+1) = m_palette->pen(color); + bitmap.pix(y, (x+i)*2+1) = m_palette->pen(color); } count++; @@ -435,15 +418,13 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } else if(m_exgfx_2bpp_mode) { - int count,color,i; - - count = 0; + int count = 0; - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<320;x+=8) + for(int x=0;x<320;x+=8) { - for(i=0;i<8;i++) + for(int i=0;i<8;i++) { int pen[2]; #if 0 @@ -456,6 +437,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ pen[0] = m_video_ram[count+0x0000] >> (7-i) & 1; pen[1] = m_video_ram[count+0x2000] >> (7-i) & 1; + int color; if(m_bgcol_bank & 4) //PC-6001 emulation mode { color = 0x08; @@ -472,7 +454,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } if (cliprect.contains(x+i, y)) - bitmap.pix16(y, (x+i)) = m_palette->pen(color); + bitmap.pix(y, (x+i)) = m_palette->pen(color); } count++; @@ -482,12 +464,11 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } else if(m_exgfx_text_mode) { - int xi,yi,pen,fgcol,bgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); - for(y=0;y<20;y++) + for(int y=0;y<20;y++) { - for(x=0;x<40;x++) + for(int x=0;x<40;x++) { /* exgfx attr format: @@ -496,23 +477,23 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ ---- xxxx fg color Note that the exgfx banks a different gfx ROM */ - tile = m_video_ram[(x+(y*40))+0x400] + 0x200; - attr = m_video_ram[(x+(y*40)) & 0x3ff]; - tile+= ((attr & 0x80) << 1); + int tile = m_video_ram[(x+(y*40))+0x400] + 0x200; + int attr = m_video_ram[(x+(y*40)) & 0x3ff]; + tile += ((attr & 0x80) << 1); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + int fgcol = (attr & 0x0f) + 0x10; + int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - color = pen ? fgcol : bgcol; + int color = pen ? fgcol : bgcol; if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); } } } @@ -529,35 +510,33 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,tile,attr; - int xi,yi,pen,fgcol,bgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); bitmap.fill(0,cliprect); if(m_sr_text_mode == true) // text mode { - for(y=0;y<m_sr_text_rows;y++) + for(int y=0;y<m_sr_text_rows;y++) { - for(x=0;x<40;x++) + for(int x=0;x<40;x++) { - tile = m_video_ram[(x+(y*40))*2+0]; - attr = m_video_ram[(x+(y*40))*2+1]; - tile+= ((attr & 0x80) << 1); + int tile = m_video_ram[(x+(y*40))*2+0]; + int attr = m_video_ram[(x+(y*40))*2+1]; + tile += ((attr & 0x80) << 1); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + int fgcol = (attr & 0x0f) + 0x10; + int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - color = pen ? fgcol : bgcol; + int color = pen ? fgcol : bgcol; if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); } } } @@ -565,9 +544,9 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in } else //4bpp bitmap mode (TODO) { - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<320;x+=2) + for(int x=0;x<320;x+=2) { uint32_t vram_addr; @@ -576,15 +555,15 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in else vram_addr = x+y*256; - color = (m_gvram[vram_addr] & 0xf0) >> 4; + int color; + color = (m_gvram[vram_addr] & 0xf0) >> 4; if (cliprect.contains(x, y+0)) - bitmap.pix16((y+0), (x+0)) = m_palette->pen(color+0x10); + bitmap.pix((y+0), (x+0)) = m_palette->pen(color+0x10); color = (m_gvram[vram_addr] & 0x0f); - if (cliprect.contains(x+1, y+0)) - bitmap.pix16((y+0), (x+1)) = m_palette->pen(color+0x10); + bitmap.pix((y+0), (x+1)) = m_palette->pen(color+0x10); } } } diff --git a/src/mame/video/pc9801.cpp b/src/mame/video/pc9801.cpp index bddd9e7129e..b069e2af0c4 100644 --- a/src/mame/video/pc9801.cpp +++ b/src/mame/video/pc9801.cpp @@ -41,43 +41,40 @@ uint32_t pc9801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi; - int res_x,res_y; - uint8_t pen; - uint8_t colors16_mode; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(m_video_ff[DISPLAY_REG] == 0) //screen is off return; - colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; + uint8_t colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; if(m_ex_video_ff[ANALOG_256_MODE]) { uint8_t *ext_gvram = (uint8_t *)m_ext_gvram.target(); - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - res_x = x + xi; - res_y = y; + int res_x = x + xi; + int res_y = y; - pen = ext_gvram[(address >> 1)*16+xi+(m_vram_disp*0x40000)]; + uint8_t pen = ext_gvram[(address >> 1)*16+xi+(m_vram_disp*0x40000)]; - bitmap.pix32(res_y, res_x) = palette[pen + 0x20]; + bitmap.pix(res_y, res_x) = palette[pen + 0x20]; } } else { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - res_x = x + xi; - res_y = y; + int res_x = x + xi; + int res_y = y; + uint8_t pen; pen = ((m_video_ram_2[((address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 1 : 0; pen|= ((m_video_ram_2[((address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 2 : 0; pen|= ((m_video_ram_2[((address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 4 : 0; if(m_ex_video_ff[ANALOG_16_MODE]) pen|= ((m_video_ram_2[((address & 0x7fff) + (0) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 8 : 0; - bitmap.pix32(res_y, res_x) = palette[pen + colors16_mode]; + bitmap.pix(res_y, res_x) = palette[pen + colors16_mode]; } } } @@ -90,40 +87,24 @@ UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi; - int x; - uint8_t char_size; -// uint8_t interlace_on; - uint16_t tile; - uint8_t kanji_lr; - uint8_t kanji_sel; - uint8_t x_step; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(m_video_ff[DISPLAY_REG] == 0) //screen is off return; -// interlace_on = m_video_ff[INTERLACE_REG]; - char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - tile = 0; +// uint8_t interlace_on = m_video_ff[INTERLACE_REG]; + uint8_t char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - for(x=0;x<pitch;x+=x_step) + uint8_t x_step; + for(int x=0;x<pitch;x+=x_step) { - uint8_t tile_data,secret,reverse,u_line,v_line,blink; - uint8_t color; - uint8_t attr; - int pen; - uint32_t tile_addr; - uint8_t knj_tile; - uint8_t gfx_mode; - - tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); + uint32_t tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); - kanji_sel = 0; - kanji_lr = 0; + uint8_t kanji_sel = 0; + uint8_t kanji_lr = 0; - tile = m_video_ram_1[tile_addr & 0xfff] & 0xff; - knj_tile = m_video_ram_1[tile_addr & 0xfff] >> 8; + uint16_t tile = m_video_ram_1[tile_addr & 0xfff] & 0xff; + uint8_t knj_tile = m_video_ram_1[tile_addr & 0xfff] >> 8; if(knj_tile) { /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it. @@ -150,36 +131,33 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { /* Rori Rori Rolling definitely uses different colors for brake stop PCG elements, assume that all attributes are recalculated on different strips */ - attr = (m_video_ram_1[((tile_addr+kanji_lr) & 0xfff) | 0x1000] & 0xff); + uint8_t attr = (m_video_ram_1[((tile_addr+kanji_lr) & 0xfff) | 0x1000] & 0xff); - secret = (attr & 1) ^ 1; - blink = attr & 2; - reverse = attr & 4; - u_line = attr & 8; - v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10; - gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0; - color = (attr & 0xe0) >> 5; + uint8_t secret = (attr & 1) ^ 1; + uint8_t blink = attr & 2; + uint8_t reverse = attr & 4; + uint8_t u_line = attr & 8; + uint8_t v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10; + uint8_t gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0; + uint8_t color = (attr & 0xe0) >> 5; - for(yi=0;yi<lr;yi++) + for(int yi=0;yi<lr;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - - res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1); - res_y = y+yi - (m_txt_scroll_reg[3] % 20); + int res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1); + int res_y = y+yi - (m_txt_scroll_reg[3] % 20); if(!m_screen->visible_area().contains(res_x, res_y)) continue; - tile_data = 0; + uint8_t tile_data = 0; if(!secret) { /* TODO: priority */ if(gfx_mode) { - int gfx_bit; tile_data = 0; /* @@ -193,6 +171,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) 33337777 */ + int gfx_bit; gfx_bit = (xi & 4); gfx_bit+= (yi & (2 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); gfx_bit+= (yi & (4 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); @@ -216,13 +195,14 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) if(blink && m_screen->frame_number() & 0x10) tile_data = 0; + int pen; if(yi >= char_size) pen = -1; else pen = (tile_data >> (7-xi) & 1) ? color : -1; if(pen != -1) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; if(m_video_ff[WIDTH40_REG]) { @@ -230,7 +210,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) continue; if(pen != -1) - bitmap.pix32(res_y, res_x+1) = palette[pen]; + bitmap.pix(res_y, res_x+1) = palette[pen]; } } } diff --git a/src/mame/video/pc_t1t.cpp b/src/mame/video/pc_t1t.cpp index 6f122e2638c..28ec71c1fd4 100644 --- a/src/mame/video/pc_t1t.cpp +++ b/src/mame/video/pc_t1t.cpp @@ -185,8 +185,8 @@ void pc_t1t_device::pcjr_palette(palette_device &palette) const MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); if ( y == 0 ) logerror("t1000_text_inten_update_row\n"); for (int i = 0; i < x_count; i++) @@ -203,22 +203,22 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) data = 0xFF; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { @@ -244,24 +244,23 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff; uint8_t chr = m_displayram[ offset ]; @@ -285,157 +284,152 @@ MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) else data = ((i == cursor_x) && (m_pc_framecnt & 8)) ? 0xff: 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_4bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; + uint8_t data = vid[offset]; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; - data = vid[ offset + 1 ]; + data = vid[offset + 1]; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; + uint8_t data = vid[offset]; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 6) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 4) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 2) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 0) & 0x03)]]; - data = vid[ offset+1 ]; + data = vid[offset + 1]; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 6) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 4) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 2) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 0) & 0x03)]]; } } MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjr_gfx_2bpp_high_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data0 = vid[ offset ]; - uint8_t data1 = vid[ offset + 1 ]; - - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x08 ) >> 3 ) | ( ( data1 & 0x08 ) >> 2 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x04 ) >> 2 ) | ( ( data1 & 0x04 ) >> 1 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x02 ) >> 1 ) | ( ( data1 & 0x02 ) ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x01 ) ) | ( ( data1 & 0x01 ) << 1 ) ) ]]; p++; + uint8_t data0 = vid[offset]; + uint8_t data1 = vid[offset + 1]; + + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 7) & 0x01) | ((data1 >> 6) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 6) & 0x01) | ((data1 >> 5) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 5) & 0x01) | ((data1 >> 4) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 4) & 0x01) | ((data1 >> 3) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 3) & 0x01) | ((data1 >> 2) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 2) & 0x01) | ((data1 >> 1) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 1) & 0x01) | ((data1 >> 0) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 0) & 0x01) | ((data1 << 1) & 0x02)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_tga_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n"); - for ( i = 0; i < x_count; i++ ) + if (y == 0) logerror("t1000_gfx_2bpp_tga_update_row\n"); + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; - uint16_t data2 = ( vid[ offset + 1 ] ) << 1; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x20 ) | ( data & 0x10 ) ) >> 4 ) ]]; p++; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x10 ) | ( data & 0x08 ) ) >> 3 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x08 ) | ( data & 0x04 ) ) >> 2 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x04 ) | ( data & 0x02 ) ) >> 1 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( data2 & 0x02 ) | ( data & 0x01 ) ) ]]; p++; + uint8_t data = vid[offset]; + uint8_t data2 = vid[offset + 1] << 1; + + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x100) | (data & 0x80)) >> 7)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x080) | (data & 0x40)) >> 6)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x040) | (data & 0x20)) >> 5)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x020) | (data & 0x10)) >> 4)]]; + + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x010) | (data & 0x08)) >> 3)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x008) | (data & 0x04)) >> 2)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x004) | (data & 0x02)) >> 1)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x002) | (data & 0x01)) >> 0)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_1bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - uint8_t fg = m_palette_base + m_reg.data[0x11]; - uint8_t bg = m_palette_base + m_reg.data[0x10]; - int i; - - if ( y == 0 ) logerror("t1000_gfx_1bpp_update_row\n"); - for ( i = 0; i < x_count; i++ ) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); + uint8_t fg = m_palette_base + m_reg.data[0x11]; + uint8_t bg = m_palette_base + m_reg.data[0x10]; + + if (y == 0) logerror("t1000_gfx_1bpp_update_row\n"); + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - - data = vid[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + uint8_t data = vid[offset]; + + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; + + data = vid[offset + 1]; + + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp index 4e7a9362730..e472116b2cc 100644 --- a/src/mame/video/pcd.cpp +++ b/src/mame/video/pcd.cpp @@ -182,7 +182,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) data = ~data; for(int i = 0; i < 16; i++) { - bitmap.pix32(y, x++) = palette().pen(BIT(data, 15) ? 1 : 0); + bitmap.pix(y, x++) = palette().pen(BIT(data, 15) ? 1 : 0); data <<= 1; } } @@ -209,8 +209,8 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) for(int i = 0; i < 8; i++) { rgb_t pix = palette().pen(BIT(data, 7) ? fgnd : bgnd); - bitmap.pix32(y, x++) = pix; - bitmap.pix32(y, x++) = pix; + bitmap.pix(y, x++) = pix; + bitmap.pix(y, x++) = pix; data <<= 1; } } @@ -229,7 +229,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) for (int i = 0; i < 8; i++) { rgb_t pix = palette().pen(BIT(data, 7) ? 1 : 0); - bitmap.pix32(y, x++) = pix; + bitmap.pix(y, x++) = pix; data <<= 1; } } diff --git a/src/mame/video/pcw.cpp b/src/mame/video/pcw.cpp index 05eeb1a68b7..f0ee1903f5f 100644 --- a/src/mame/video/pcw.cpp +++ b/src/mame/video/pcw.cpp @@ -25,7 +25,7 @@ inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /*************************************************************************** @@ -211,12 +211,12 @@ uint32_t pcw_state::screen_update_pcw_printer(screen_device &screen, bitmap_ind1 rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); feed = -(m_paper_feed / 2); copyscrollbitmap(bitmap,*m_prn_output,0,nullptr,1,&feed,rect); - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; return 0; } diff --git a/src/mame/video/pcw16.cpp b/src/mame/video/pcw16.cpp index 35177c807b8..1fb7c6eb2f5 100644 --- a/src/mame/video/pcw16.cpp +++ b/src/mame/video/pcw16.cpp @@ -55,7 +55,7 @@ static constexpr rgb_t pcw16_palette[PCW16_NUM_COLOURS] = inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* Initialise the palette */ diff --git a/src/mame/video/pdp1.cpp b/src/mame/video/pdp1.cpp index 793f9ea5a56..cbdb3031fbd 100644 --- a/src/mame/video/pdp1.cpp +++ b/src/mame/video/pdp1.cpp @@ -29,7 +29,7 @@ inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } /* @@ -356,13 +356,12 @@ enum void pdp1_typewriter_device::linefeed() { uint8_t buf[typewriter_window_width]; - int y; assert(typewriter_window_width <= m_bitmap.width()); assert(typewriter_window_height <= m_bitmap.height()); - for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) + for (int y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - std::copy_n(&m_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); + std::copy_n(&m_bitmap.pix(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_bitmap, 0, y, typewriter_window_width, buf, m_driver_state->m_palette->pens()); } diff --git a/src/mame/video/pgm.cpp b/src/mame/video/pgm.cpp index 28b579390e1..fab7088207e 100644 --- a/src/mame/video/pgm.cpp +++ b/src/mame/video/pgm.cpp @@ -229,8 +229,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -252,8 +252,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -289,8 +289,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -435,8 +435,8 @@ void pgm_state::draw_sprite_new_basic(int wide, int high, int xpos, int ypos, in if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line_basic(wide, dest, destpri, cliprect, flip, xpos, pri, realxsize, palt, true); } else diff --git a/src/mame/video/pgm2.cpp b/src/mame/video/pgm2.cpp index 3c7dc40e10e..e235549f8c7 100644 --- a/src/mame/video/pgm2.cpp +++ b/src/mame/video/pgm2.cpp @@ -10,7 +10,7 @@ inline void pgm2_state::draw_sprite_pixel(const rectangle &cliprect, u32 palette { u16 const pix = m_sprites_colour[palette_offset] & 0x3f; // there are some stray 0xff bytes in some roms, so mask u16 const pendat = pix + (pal * 0x40); - u16* dstptr_bitmap = &m_sprite_bitmap.pix16(realy); + u16 *const dstptr_bitmap = &m_sprite_bitmap.pix(realy); dstptr_bitmap[realx] = pendat; } } @@ -270,14 +270,12 @@ void pgm2_state::copy_sprites_from_bitmap(bitmap_rgb32 &bitmap, const rectangle { pri <<= 12; - const pen_t *paldata = m_sp_palette->pens(); - u16* srcptr_bitmap; - u32* dstptr_bitmap; + pen_t const *const paldata = m_sp_palette->pens(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - srcptr_bitmap = &m_sprite_bitmap.pix16(y); - dstptr_bitmap = &bitmap.pix32(y); + u16 const *const srcptr_bitmap = &m_sprite_bitmap.pix(y); + u32 *const dstptr_bitmap = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/pitnrun.cpp b/src/mame/video/pitnrun.cpp index a9ff5caa885..7ab1327869f 100644 --- a/src/mame/video/pitnrun.cpp +++ b/src/mame/video/pitnrun.cpp @@ -104,7 +104,7 @@ void pitnrun_state::spotlights() int datapix = ROM[128*16*i + x + y*16]; for(int b=0; b<8; b++) { - m_tmp_bitmap[i]->pix16(y, x*8 + (7 - b)) = (datapix & 1); + m_tmp_bitmap[i]->pix(y, x*8 + (7 - b)) = (datapix & 1); datapix>>=1; } } diff --git a/src/mame/video/pk8000.cpp b/src/mame/video/pk8000.cpp index e47b81066fe..9f5f3ccc5c5 100644 --- a/src/mame/video/pk8000.cpp +++ b/src/mame/video/pk8000.cpp @@ -104,7 +104,6 @@ void pk8000_base_state::_84_portc_w(uint8_t data) uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *videomem) { - int x,y,j,b; uint16_t offset = (m_video_mode & 0xc0) << 8; rectangle my_rect; my_rect.set(0, 256+32-1, 0, 192+32-1); @@ -116,36 +115,36 @@ uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bi // Text mode if (BIT(m_video_mode,5)==0){ // 32 columns - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t chr = videomem[x +(y*32) + ((m_text_start & 0x0f) << 10)+offset] ; uint8_t color= m_color[chr>>3]; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t code = videomem[((chr<<3) + j) + ((m_chargen_start & 0x0e) << 10)+offset]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { uint8_t col = (code >> b) & 0x01 ? (color & 0x0f) : ((color>>4) & 0x0f); - bitmap.pix16((y*8)+j+16, x*8+(7-b)+16) = col; + bitmap.pix((y*8)+j+16, x*8+(7-b)+16) = col; } } } } } else { // 40 columns - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 42; x++) + for (int x = 0; x < 42; x++) { uint8_t chr = videomem[x +(y*64) + ((m_text_start & 0x0e) << 10)+offset] ; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t code = videomem[((chr<<3) + j) + ((m_chargen_start & 0x0e) << 10)+offset]; - for (b = 2; b < 8; b++) + for (int b = 2; b < 8; b++) { uint8_t col = ((code >> b) & 0x01) ? (m_video_color) & 0x0f : (m_video_color>>4) & 0x0f; - bitmap.pix16((y*8)+j+16, x*6+(7-b)+16+8) = col; + bitmap.pix((y*8)+j+16, x*6+(7-b)+16+8) = col; } } } @@ -153,21 +152,21 @@ uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bi } } else { //Graphics - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { uint16_t off_color = (((~m_color_start) & 0x08) << 10)+offset + ((y>>3)<<11); uint16_t off_code = (((~m_video_start) & 0x08) << 10)+offset + ((y>>3)<<11); - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t chr = videomem[x +(y*32) + ((m_chargen_start & 0x0e) << 10)+offset] ; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t color= videomem[((chr<<3) + j)+off_color]; uint8_t code = videomem[((chr<<3) + j)+off_code]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { uint8_t col = (code >> b) & 0x01 ? (color & 0x0f) : ((color>>4) & 0x0f); - bitmap.pix16((y*8)+j+16, x*8+(7-b)+16) = col; + bitmap.pix((y*8)+j+16, x*8+(7-b)+16) = col; } } } diff --git a/src/mame/video/pk8020.cpp b/src/mame/video/pk8020.cpp index b4915f1135b..5ac06457619 100644 --- a/src/mame/video/pk8020.cpp +++ b/src/mame/video/pk8020.cpp @@ -135,17 +135,17 @@ void pk8020_state::gzu_w(offs_t offset, uint8_t data) uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); for (int y = 0; y < 16; y++) { for (int x = 0; x < 64; x++) { - uint8_t chr = ram[x +(y*64) + 0x40000]; - uint8_t attr= ram[x +(y*64) + 0x40400]; + uint8_t const chr = ram[x +(y*64) + 0x40000]; + uint8_t const attr= ram[x +(y*64) + 0x40400]; for (int j = 0; j < 16; j++) { - uint32_t addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); + uint32_t const addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); uint8_t code1 = ram[addr]; uint8_t code2 = ram[addr + 0x4000]; uint8_t code3 = ram[addr + 0x8000]; @@ -157,7 +157,7 @@ uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00); col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00); col |= (((code1 >> b) & 0x01) ? 0x01 : 0x00); - bitmap.pix16((y*16)+j, x*8+(7-b)) = col; + bitmap.pix((y*16)+j, x*8+(7-b)) = col; } } } diff --git a/src/mame/video/playmark.cpp b/src/mame/video/playmark.cpp index dd6eff32dd6..834a363b4b1 100644 --- a/src/mame/video/playmark.cpp +++ b/src/mame/video/playmark.cpp @@ -437,24 +437,20 @@ void playmark_state::bigtwinb_draw_sprites( screen_device &screen, bitmap_ind16 void playmark_state::draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int x, y, count; - int color; - uint8_t *pri; - - count = 0; - for (y = 0; y < 512; y++) + int count = 0; + for (int y = 0; y < 512; y++) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { - color = m_bgvideoram[count] & 0xff; + int const color = m_bgvideoram[count] & 0xff; if (color) { if (m_bg_full_size) { - bitmap.pix16((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color; + bitmap.pix((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color; - pri = &screen.priority().pix8((y + m_bgscrolly) & 0x1ff); + uint8_t *const pri = &screen.priority().pix((y + m_bgscrolly) & 0x1ff); pri[(x + m_bgscrollx) & 0x1ff] |= 2; } else @@ -462,9 +458,9 @@ void playmark_state::draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, c /* 50% size */ if(!(x % 2) && !(y % 2)) { - bitmap.pix16((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color; + bitmap.pix((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color; - pri = &screen.priority().pix8((y / 2 + m_bgscrolly) & 0x1ff); + uint8_t *const pri = &screen.priority().pix((y / 2 + m_bgscrolly) & 0x1ff); pri[(x / 2 + m_bgscrollx) & 0x1ff] |= 2; } } diff --git a/src/mame/video/pocketc.cpp b/src/mame/video/pocketc.cpp index dc845f029df..2226b23bbbd 100644 --- a/src/mame/video/pocketc.cpp +++ b/src/mame/video/pocketc.cpp @@ -44,5 +44,5 @@ void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, con for (int i = 0; i < 5; i++, y++) for (int j = 0; fig[i][j]; j++) if (fig[i][j] != ' ') - bitmap.pix16(y, x + j) = color; + bitmap.pix(y, x + j) = color; } diff --git a/src/mame/video/polepos.cpp b/src/mame/video/polepos.cpp index eeaf594a590..a6bfbcf6679 100644 --- a/src/mame/video/polepos.cpp +++ b/src/mame/video/polepos.cpp @@ -416,7 +416,7 @@ void polepos_state::zoom_sprite(bitmap_ind16 &bitmap,int big, int pen = src[offs/2 ^ flipx]; if (!((transmask >> pen) & 1)) - bitmap.pix16(yy, xx) = pen + coloroffs; + bitmap.pix(yy, xx) = pen + coloroffs; } offs++; diff --git a/src/mame/video/policetr.cpp b/src/mame/video/policetr.cpp index 4fd79e3f28f..1b0ff34ee5d 100644 --- a/src/mame/video/policetr.cpp +++ b/src/mame/video/policetr.cpp @@ -97,8 +97,8 @@ void policetr_state::render_display_list(offs_t offset) { for (int y = 0; y < dsth; y++) { - uint8_t *dst = &m_dstbitmap->pix8(dsty + y,dstx); - memset(dst, pixel, dstw); + uint8_t *dst = &m_dstbitmap->pix(dsty + y,dstx); + std::fill_n(dst, dstw, pixel); } } } @@ -110,8 +110,8 @@ void policetr_state::render_display_list(offs_t offset) uint32_t cury = srcy; for (int y = 0; y < dsth; y++, cury += srcystep) { - const uint8_t *src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH]; - uint8_t *dst = &m_dstbitmap->pix8((dsty + y), dstx); + uint8_t const *const src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH]; + uint8_t *const dst = &m_dstbitmap->pix((dsty + y), dstx); /* loop over columns */ for (int x = 0, curx = srcx; x < dstw; x++, curx += srcxstep) @@ -181,7 +181,7 @@ void policetr_state::video_w(offs_t offset, uint32_t data, uint32_t mem_mask) /* latch 0x50 allows a direct write to the destination bitmap */ case 0x50: if (ACCESSING_BITS_24_31 && m_dst_xoffs < DSTBITMAP_WIDTH && m_dst_yoffs < DSTBITMAP_HEIGHT) - m_dstbitmap->pix8(m_dst_yoffs,m_dst_xoffs) = data >> 24; + m_dstbitmap->pix(m_dst_yoffs,m_dst_xoffs) = data >> 24; break; /* log anything else */ @@ -306,13 +306,13 @@ uint32_t policetr_state::video_r() uint32_t policetr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { const int width = cliprect.width(); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); /* render all the scanlines from the dstbitmap to MAME's bitmap */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint8_t *src = &m_dstbitmap->pix8(y,cliprect.min_x); - uint32_t *dst = &bitmap.pix32(y,cliprect.min_x); + uint8_t const *src = &m_dstbitmap->pix(y,cliprect.min_x); + uint32_t *dst = &bitmap.pix(y,cliprect.min_x); //draw_scanline8(bitmap, cliprect.min_x, y, width, src, nullptr); for (int x = 0; x < width; x++, dst++, src++) *dst = palette[*src]; diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp index 45d09c0ab12..edb10dc7b1f 100644 --- a/src/mame/video/popeye.cpp +++ b/src/mame/video/popeye.cpp @@ -383,14 +383,14 @@ void tnx1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from + bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from else { // TODO: confirm the memory layout int sx = x + (2 * (m_background_scroll[0] | ((m_background_scroll[2] & 1) << 8))) + 0x70; int shift = (sx & 0x200) / 0x80; - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } @@ -409,14 +409,14 @@ void tpp1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from + bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from else { // TODO: confirm the memory layout int sx = x + (2 * m_background_scroll[0]) + 0x70; int shift = (sy & 4); - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } @@ -435,14 +435,14 @@ void tpp2_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf; + bitmap.pix(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf; else { // TODO: confirm the memory layout int sx = x + (2 * m_background_scroll[0]) + 0x70; int shift = (sy & 4); - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index 1584ac823a4..dd237df28e3 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -2420,7 +2420,7 @@ inline void powervr2_device::render_hline(bitmap_rgb32 &bitmap, texinfo *ti, int offl[idx] += ddx * dodx[idx]; } - tdata = &bitmap.pix32(y, xxl); + tdata = &bitmap.pix(y, xxl); wbufline = &wbuffer[y][xxl]; while(xxl < xxr) { @@ -2881,13 +2881,12 @@ void powervr2_device::render_to_accumulation_buffer(bitmap_rgb32 &bitmap, const /* 0555KRGB = 0 */ void powervr2_device::fb_convert_0555krgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2902,13 +2901,12 @@ void powervr2_device::fb_convert_0555krgb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_0555krgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2923,13 +2921,12 @@ void powervr2_device::fb_convert_0555krgb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_0555krgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2944,13 +2941,12 @@ void powervr2_device::fb_convert_0555krgb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_0555krgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2964,13 +2960,12 @@ void powervr2_device::fb_convert_0555krgb_to_888rgb32(address_space &space, int /* 0565RGB = 1 */ void powervr2_device::fb_convert_0565rgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2985,13 +2980,12 @@ void powervr2_device::fb_convert_0565rgb_to_555rgb(address_space &space, int x,i void powervr2_device::fb_convert_0565rgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3006,13 +3000,12 @@ void powervr2_device::fb_convert_0565rgb_to_565rgb(address_space &space, int x,i void powervr2_device::fb_convert_0565rgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3027,13 +3020,12 @@ void powervr2_device::fb_convert_0565rgb_to_888rgb24(address_space &space, int x void powervr2_device::fb_convert_0565rgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3047,13 +3039,12 @@ void powervr2_device::fb_convert_0565rgb_to_888rgb32(address_space &space, int x /* 1555ARGB = 3 */ void powervr2_device::fb_convert_1555argb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3068,13 +3059,12 @@ void powervr2_device::fb_convert_1555argb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_1555argb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3089,13 +3079,12 @@ void powervr2_device::fb_convert_1555argb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_1555argb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3110,13 +3099,12 @@ void powervr2_device::fb_convert_1555argb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_1555argb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3130,13 +3118,12 @@ void powervr2_device::fb_convert_1555argb_to_888rgb32(address_space &space, int /* 888RGB = 4 */ void powervr2_device::fb_convert_888rgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3151,13 +3138,12 @@ void powervr2_device::fb_convert_888rgb_to_555rgb(address_space &space, int x,in void powervr2_device::fb_convert_888rgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3172,13 +3158,12 @@ void powervr2_device::fb_convert_888rgb_to_565rgb(address_space &space, int x,in void powervr2_device::fb_convert_888rgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3193,13 +3178,12 @@ void powervr2_device::fb_convert_888rgb_to_888rgb24(address_space &space, int x, void powervr2_device::fb_convert_888rgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3214,13 +3198,12 @@ void powervr2_device::fb_convert_888rgb_to_888rgb32(address_space &space, int x, /* 8888ARGB = 6 */ void powervr2_device::fb_convert_8888argb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3235,13 +3218,12 @@ void powervr2_device::fb_convert_8888argb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_8888argb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3256,13 +3238,12 @@ void powervr2_device::fb_convert_8888argb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_8888argb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3277,13 +3258,12 @@ void powervr2_device::fb_convert_8888argb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_8888argb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3403,16 +3383,11 @@ void powervr2_device::pvr_accumulationbuffer_to_framebuffer(address_space &space void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle &cliprect) { - int x,y,dy,xi; - uint32_t addrp; - uint32_t *fbaddr; - uint32_t c; - uint32_t r,g,b; + int dy,xi; uint8_t interlace_on = ((spg_control & 0x10) >> 4); int32_t ystart_f1 = (vo_starty & 0x3ff) << interlace_on; //int32_t ystart_f2 = (vo_starty >> 16) & 0x3ff; int32_t hstart = (vo_startx & 0x3ff); - int res_x,res_y; // rectangle fbclip; uint8_t unpackmode = (fb_r_ctrl & 0x0000000c) >>2; // aka fb_depth @@ -3443,29 +3418,29 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & { case 0x00: // 0555 RGB 16-bit, Cleo Fortune Plus // should upsample back to 8-bit output using fb_concat - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x03e0) >> 2; - r = (c & 0x7c00) >> 7; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x03e0) >> 2; + uint32_t r = (c & 0x7c00) >> 7; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); addrp+=2; @@ -3473,17 +3448,17 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; + int res_x = x + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x03e0) >> 2; - r = (c & 0x7c00) >> 7; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x03e0) >> 2; + uint32_t r = (c & 0x7c00) >> 7; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3491,32 +3466,32 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } } } - break; + case 0x01: // 0565 RGB 16-bit // should upsample back to 8-bit output using fb_concat - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x07e0) >> 3; - r = (c & 0xf800) >> 8; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x07e0) >> 3; + uint32_t r = (c & 0xf800) >> 8; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; //res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3526,16 +3501,16 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x07e0) >> 3; - r = (c & 0xf800) >> 8; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x07e0) >> 3; + uint32_t r = (c & 0xf800) >> 8; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3546,34 +3521,31 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & break; case 0x02: ; // 888 RGB 24-bit - suchie3, Soul Calibur - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - b = c; + uint32_t b =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - g = c; + uint32_t g =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); - r = c; + uint32_t r =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3582,20 +3554,17 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - b = c; + uint32_t b =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - g = c; + uint32_t g =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); - r = c; + uint32_t r =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3607,30 +3576,30 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & break; case 0x03: // 0888 ARGB 32-bit - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); - b = (c & 0x0000ff) >> 0; - g = (c & 0x00ff00) >> 8; - r = (c & 0xff0000) >> 16; + uint32_t b = (c & 0x0000ff) >> 0; + uint32_t g = (c & 0x00ff00) >> 8; + uint32_t r = (c & 0xff0000) >> 16; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3639,16 +3608,16 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); - b = (c & 0x0000ff) >> 0; - g = (c & 0x00ff00) >> 8; - r = (c & 0xff0000) >> 16; + uint32_t b = (c & 0x0000ff) >> 0; + uint32_t g = (c & 0x00ff00) >> 8; + uint32_t r = (c & 0xff0000) >> 16; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3665,23 +3634,19 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & #if DEBUG_PALRAM void powervr2_device::debug_paletteram() { - uint64_t pal; - uint32_t r,g,b; - int i; - //popmessage("%02x",pal_ram_ctrl); - for(i=0;i<0x400;i++) + for(int i=0;i<0x400;i++) { - pal = palette[i]; + uint64_t pal = palette[i]; switch(pal_ram_ctrl) { case 0: //argb1555 <- guilty gear uses this mode { //a = (pal & 0x8000)>>15; - r = (pal & 0x7c00)>>10; - g = (pal & 0x03e0)>>5; - b = (pal & 0x001f)>>0; + uint32_t r = (pal & 0x7c00)>>10; + uint32_t g = (pal & 0x03e0)>>5; + uint32_t b = (pal & 0x001f)>>0; //a = a ? 0xff : 0x00; m_palette->set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b)); } @@ -3689,27 +3654,27 @@ void powervr2_device::debug_paletteram() case 1: //rgb565 { //a = 0xff; - r = (pal & 0xf800)>>11; - g = (pal & 0x07e0)>>5; - b = (pal & 0x001f)>>0; + uint32_t r = (pal & 0xf800)>>11; + uint32_t g = (pal & 0x07e0)>>5; + uint32_t b = (pal & 0x001f)>>0; m_palette->set_pen_color(i, pal5bit(r), pal6bit(g), pal5bit(b)); } break; case 2: //argb4444 { //a = (pal & 0xf000)>>12; - r = (pal & 0x0f00)>>8; - g = (pal & 0x00f0)>>4; - b = (pal & 0x000f)>>0; + uint32_t r = (pal & 0x0f00)>>8; + uint32_t g = (pal & 0x00f0)>>4; + uint32_t b = (pal & 0x000f)>>0; m_palette->set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b)); } break; case 3: //argb8888 { //a = (pal & 0xff000000)>>20; - r = (pal & 0x00ff0000)>>16; - g = (pal & 0x0000ff00)>>8; - b = (pal & 0x000000ff)>>0; + uint32_t r = (pal & 0x00ff0000)>>16; + uint32_t g = (pal & 0x0000ff00)>>8; + uint32_t b = (pal & 0x000000ff)>>0; m_palette->set_pen_color(i, r, g, b); } break; @@ -3838,7 +3803,6 @@ uint32_t powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bit // static int useframebuffer=1; // const rectangle &visarea = screen.visible_area(); -// int y,x; #if DEBUG_PALRAM debug_paletteram(); @@ -3846,12 +3810,12 @@ uint32_t powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bit // copy our fake framebuffer bitmap (where things have been rendered) to the screen #if 0 - for (y = visarea->min_y ; y <= visarea->max_y ; y++) + for (int y = visarea->min_y ; y <= visarea->max_y ; y++) { - for (x = visarea->min_x ; x <= visarea->max_x ; x++) + for (int x = visarea->min_x ; x <= visarea->max_x ; x++) { - uint32_t* src = &fake_accumulationbuffer_bitmap->pix32(y, x); - uint32_t* dst = &bitmap.pix32(y, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y, x); + uint32_t *const dst = &bitmap.pix(y, x); dst[0] = src[0]; } } diff --git a/src/mame/video/pp01.cpp b/src/mame/video/pp01.cpp index 7afc209d8da..eff118c6b2d 100644 --- a/src/mame/video/pp01.cpp +++ b/src/mame/video/pp01.cpp @@ -27,7 +27,7 @@ uint32_t pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bit for (int b = 0; b < 8; b++) { uint8_t const col = (BIT(code_r, b) << 2) | (BIT(code_g, b) << 1) | (BIT(code_b, b) << 0); - bitmap.pix16(y, x*8+(7-b)) = col; + bitmap.pix(y, x*8+(7-b)) = col; } } } diff --git a/src/mame/video/psikyosh.cpp b/src/mame/video/psikyosh.cpp index beaf8088fdf..219a70b416e 100644 --- a/src/mame/video/psikyosh.cpp +++ b/src/mame/video/psikyosh.cpp @@ -342,7 +342,7 @@ void psikyosh_state::draw_bglayerscroll(u8 const layer, bitmap_rgb32 &bitmap, co g_profiler.start(PROFILER_USER2); u32 tilemap_line[32 * 16]; u32 scr_line[64 * 8]; - std::copy_n(&m_bg_bitmap.pix32(tilemap_scanline, 0), 0x200, tilemap_line); + std::copy_n(&m_bg_bitmap.pix(tilemap_scanline, 0), 0x200, tilemap_line); g_profiler.stop(); /* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */ @@ -514,8 +514,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + (y_index) * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -536,7 +536,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -560,8 +560,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -582,7 +582,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -607,8 +607,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -629,7 +629,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -664,7 +664,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl for (int ypixel = 0; ypixel < gfx->height(); ypixel++) { const u8 *source = code_base + ypixel * gfx->rowbytes(); - u8 *dest = &m_zoom_bitmap.pix8(ypixel + ytile*gfx->height()); + u8 *dest = &m_zoom_bitmap.pix(ypixel + ytile*gfx->height()); for (int xpixel = 0; xpixel < gfx->width(); xpixel++) { @@ -738,9 +738,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -756,8 +756,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -778,9 +778,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -796,8 +796,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -818,9 +818,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -836,8 +836,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -1008,7 +1008,7 @@ void psikyosh_state::prelineblend(bitmap_rgb32 &bitmap, const rectangle &cliprec g_profiler.start(PROFILER_USER8); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dstline = &bitmap.pix32(y); + u32 *dstline = &bitmap.pix(y); /* linefill[y] & 0xff does what? */ for (int x = cliprect.left(); x <= cliprect.right(); x++) @@ -1032,7 +1032,7 @@ void psikyosh_state::postlineblend(bitmap_rgb32 &bitmap, const rectangle &clipre g_profiler.start(PROFILER_USER8); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dstline = &bitmap.pix32(y); + u32 *dstline = &bitmap.pix(y); if (lineblend[y] & 0x80) /* solid */ { diff --git a/src/mame/video/qix.cpp b/src/mame/video/qix.cpp index 87ef3557296..5a10f61d378 100644 --- a/src/mame/video/qix.cpp +++ b/src/mame/video/qix.cpp @@ -281,8 +281,8 @@ MC6845_BEGIN_UPDATE( qix_state::crtc_begin_update ) MC6845_UPDATE_ROW( qix_state::crtc_update_row ) { - uint32_t *dest = &bitmap.pix32(y); - pen_t *pens = &m_pens[m_palette_bank << 8]; + uint32_t *const dest = &bitmap.pix(y); + pen_t const *const pens = &m_pens[m_palette_bank << 8]; /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 6) & 0xf800) | ((ra << 8) & 0x0700); diff --git a/src/mame/video/quasar.cpp b/src/mame/video/quasar.cpp index ad399cdd07c..742256f8cfd 100644 --- a/src/mame/video/quasar.cpp +++ b/src/mame/video/quasar.cpp @@ -108,7 +108,7 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 for (int ox = 0; ox < 8; ox++) for (int oy = 0; oy < 8; oy++) - bitmap.pix16(y + oy, x + ox) = forecolor; + bitmap.pix(y + oy, x + ox) = forecolor; // Main Screen m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, @@ -144,10 +144,10 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 int const bx = 255 - 9 - m_bullet_ram[offs] - ct; // bullet/object Collision - if (s2636_0_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x04; - if (s2636_2_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x08; + if (s2636_0_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x04; + if (s2636_2_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x08; - bitmap.pix16(offs, bx) = 7; + bitmap.pix(offs, bx) = 7; } } } @@ -158,18 +158,18 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 { for (int x = cliprect.left(); x <= cliprect.right(); x++) { - int const pixel0 = s2636_0_bitmap.pix16(y, x); - int const pixel1 = s2636_1_bitmap.pix16(y, x); - int const pixel2 = s2636_2_bitmap.pix16(y, x); + int const pixel0 = s2636_0_bitmap.pix(y, x); + int const pixel1 = s2636_1_bitmap.pix(y, x); + int const pixel2 = s2636_2_bitmap.pix(y, x); int const pixel = pixel0 | pixel1 | pixel2; if (S2636_IS_PIXEL_DRAWN(pixel)) { - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel); /* S2636 vs. background collision detection */ - if (m_palette->pen_indirect(m_collision_background.pix16(y, x))) + if (m_palette->pen_indirect(m_collision_background.pix(y, x))) { if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01; if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; diff --git a/src/mame/video/raiden2.cpp b/src/mame/video/raiden2.cpp index ad98fbe44fd..ff06d5906be 100644 --- a/src/mame/video/raiden2.cpp +++ b/src/mame/video/raiden2.cpp @@ -322,12 +322,12 @@ void raiden2_state::blend_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (layer == -1) return; - const pen_t *pens = &m_palette->pen(0); + pen_t const *const pens = &m_palette->pen(0); layer <<= 14; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *src = &source.pix16(y, cliprect.min_x); - u32 *dst = &bitmap.pix32(y, cliprect.min_x); + const u16 *src = &source.pix(y, cliprect.min_x); + u32 *dst = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { u16 val = *src++; diff --git a/src/mame/video/rallyx.cpp b/src/mame/video/rallyx.cpp index 081f07da6f1..740b587b6b8 100644 --- a/src/mame/video/rallyx.cpp +++ b/src/mame/video/rallyx.cpp @@ -411,8 +411,8 @@ void rallyx_state::plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, i if (flip_screen_y()) y = 255 - y; - if (m_palette->pen_indirect(bitmap.pix16(y, x) % 0x144) == 0) - bitmap.pix16(y, x) = STARS_COLOR_BASE + color; + if (m_palette->pen_indirect(bitmap.pix(y, x) % 0x144) == 0) + bitmap.pix(y, x) = STARS_COLOR_BASE + color; } void rallyx_state::draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect ) diff --git a/src/mame/video/rampart.cpp b/src/mame/video/rampart.cpp index 0d1175045da..1277d658e76 100644 --- a/src/mame/video/rampart.cpp +++ b/src/mame/video/rampart.cpp @@ -76,8 +76,8 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1 for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -101,13 +101,13 @@ void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle /* update any dirty scanlines */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const uint16_t *src = &m_bitmap[256 * y]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &m_bitmap[256 * y]; + uint16_t *const dst = &bitmap.pix(y); /* regenerate the line */ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { - int bits = src[(x - 8) / 2]; + int const bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; dst[x + 1] = bits & 0xff; } diff --git a/src/mame/video/redalert.cpp b/src/mame/video/redalert.cpp index 3e216dec401..a29f0f612bd 100644 --- a/src/mame/video/redalert.cpp +++ b/src/mame/video/redalert.cpp @@ -260,16 +260,11 @@ VIDEO_START_MEMBER(redalert_state,ww3) uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_redalert_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -280,6 +275,7 @@ uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rg offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -291,30 +287,29 @@ uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rg charmap_data_2 = m_charmap_videoram[0x0800 | charmap_data_base]; } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if ((*m_video_control ^ m_control_xor) & 0x04) - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; else - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } @@ -351,16 +346,11 @@ void redalert_state::demoneye_bitmap_layer_w(offs_t offset, uint8_t data) uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_demoneye_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -371,6 +361,7 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -386,30 +377,29 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg //charmap_data_1 = m_charmap_videoram[0x1400 | charmap_data_base]; //charmap_data_2 = m_charmap_videoram[0x1800 | charmap_data_base]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if (*m_video_control & 0x04) - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } @@ -450,7 +440,7 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg int y_dst = 8*width - (y_block*8+iy); int x_dst = 8*width - (x_block*8+7-ix); ccc=pens[NUM_CHARMAP_PENS+ccc]; - bitmap.pix32(y+y_dst, x+x_dst) = ccc; + bitmap.pix(y+y_dst, x+x_dst) = ccc; } l0<<=1; @@ -478,16 +468,11 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_panther_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -498,6 +483,7 @@ uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -509,30 +495,29 @@ uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb charmap_data_2 = m_charmap_videoram[0x0800 | charmap_data_base]; } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if ((*m_video_control ^ m_control_xor) & 0x04) - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; else - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } diff --git a/src/mame/video/redclash.cpp b/src/mame/video/redclash.cpp index 631baba737d..c23f67bda3f 100644 --- a/src/mame/video/redclash.cpp +++ b/src/mame/video/redclash.cpp @@ -232,7 +232,7 @@ void redclash_state::draw_bullets( bitmap_ind16 &bitmap, const rectangle &clipre } if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0x19; + bitmap.pix(sy, sx) = 0x19; } } diff --git a/src/mame/video/relief.cpp b/src/mame/video/relief.cpp index 38e25ce71d4..b8a4d405eb2 100644 --- a/src/mame/video/relief.cpp +++ b/src/mame/video/relief.cpp @@ -108,9 +108,9 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -136,13 +136,13 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 * * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected */ - int cs0 = 0; - int cs1 = 1; /* compute the CS0 signal */ + int cs0 = 0; cs0 = ((mo[x] & 0x0f) == 0); /* compute the CS1 signal */ + int cs1 = 1; if ((!cs0 && (mo[x] & 0xe0) == 0xe0) || ((mo[x] & 0xf0) == 0xe0) || (!pri[x] && !cs0) || diff --git a/src/mame/video/rltennis.cpp b/src/mame/video/rltennis.cpp index 84debeca2f1..6a393babd55 100644 --- a/src/mame/video/rltennis.cpp +++ b/src/mame/video/rltennis.cpp @@ -154,10 +154,6 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) int x_src_step=(m_blitter[BLT_FLAGS] & BLTFLAG_SRC_X_DIR)?1:-1; int y_src_step=(m_blitter[BLT_FLAGS] & BLTFLAG_SRC_Y_DIR)?1:-1; - int x,y; - - int idx_x,idx_y; - int blit_w=src_x1-src_x0; int blit_h=src_y1-src_y0; @@ -193,9 +189,9 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) force_blit=true; } - for( x=dst_x0, idx_x=0 ; idx_x<=blit_w1; x+=x_dst_step, idx_x++ ) + for( int x=dst_x0, idx_x=0 ; idx_x<=blit_w1; x+=x_dst_step, idx_x++ ) { - for( y=dst_y0, idx_y=0 ; idx_y<=blit_h1;y+=y_dst_step, idx_y++) + for( int y=dst_y0, idx_y=0 ; idx_y<=blit_h1;y+=y_dst_step, idx_y++) { int xx=src_x0+(x_src_step*idx_x); int yy=src_y0+(y_src_step*idx_y); @@ -213,7 +209,7 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) if((pix || force_blit)&& screen_x >0 && y >0 && screen_x < 512 && y < 256 ) { - m_tmp_bitmap[layer]->pix16(y , screen_x ) = pix; + m_tmp_bitmap[layer]->pix(y , screen_x ) = pix; } } } diff --git a/src/mame/video/rm380z.cpp b/src/mame/video/rm380z.cpp index 0c03a6805a0..f7ead5a4c27 100644 --- a/src/mame/video/rm380z.cpp +++ b/src/mame/video/rm380z.cpp @@ -271,16 +271,14 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit } } - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); - *dest=chval; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c) = chval; } } // last pixel of underline if (attrUnder&&(!attrRev)) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); - *dest=attrRev?0:1; + bitmap.pix((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX) = attrRev?0:1; } // if reversed, print another column of pixels on the right @@ -288,8 +286,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int r=0;r<RM380Z_CHDIMY;r++) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); - *dest=1; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX) = 1; } } } @@ -319,20 +316,16 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit } } - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); - *dest=chval; - *dest2=chval; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c) = chval; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1) = chval; } } // last 2 pixels of underline if (attrUnder) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1); - *dest=attrRev?0:1; - *dest2=attrRev?0:1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)) = attrRev?0:1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1) = attrRev?0:1; } // if reversed, print another 2 columns of pixels on the right @@ -340,10 +333,8 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int r=0;r<RM380Z_CHDIMY;r++) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1); - *dest=1; - *dest2=1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)) = 1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1) = 1; } } } @@ -357,8 +348,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int c=0;c<RM380Z_CHDIMX;c++) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); - *dest=m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c) = m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; } } } @@ -368,10 +358,8 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int c=0;c<(RM380Z_CHDIMX*2);c+=2) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); - *dest=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; - *dest2=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c) = m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1) = m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; } } } @@ -409,22 +397,21 @@ void rm380z_state::update_screen(bitmap_ind16 &bitmap) // This needs the attributes etc from above to be added uint32_t rm380z_state::screen_update_rm480z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *chargen = memregion("chargen")->base(); - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint8_t const *const chargen = memregion("chargen")->base(); + uint16_t sy=0,ma=0; - for (y = 0; y < RM380Z_SCREENROWS; y++) + for (uint8_t y = 0; y < RM380Z_SCREENROWS; y++) { - for (ra = 0; ra < 11; ra++) + for (uint8_t ra = 0; ra < 11; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 10) { - chr = m_vramchars[x]; + uint8_t chr = m_vramchars[x]; gfx = chargen[(chr<<4) | ra ]; } /* Display a scanline of a character */ diff --git a/src/mame/video/rmnimbus.cpp b/src/mame/video/rmnimbus.cpp index b4faeedf0a1..c7b4d385d02 100644 --- a/src/mame/video/rmnimbus.cpp +++ b/src/mame/video/rmnimbus.cpp @@ -105,9 +105,9 @@ uint8_t rmnimbus_state::get_pixel(uint16_t x, uint16_t y) if((x<640) && (y<250)) { if(IS_80COL) - result=m_video_mem.pix16(y, x) >> 2; + result=m_video_mem.pix(y, x) >> 2; else - result=m_video_mem.pix16(y, x*2); + result=m_video_mem.pix(y, x*2); } return result; @@ -295,9 +295,9 @@ void rmnimbus_state::set_pixel(uint16_t x, uint16_t y, uint8_t colour) if((x<640) && (y<250)) { if(IS_XOR) - m_video_mem.pix16(y, x)^=colour; + m_video_mem.pix(y, x)^=colour; else - m_video_mem.pix16(y, x)=colour; + m_video_mem.pix(y, x)=colour; } } @@ -344,7 +344,7 @@ void rmnimbus_state::move_pixel_line(uint16_t x, uint16_t y, uint8_t pixels) { if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) logerror("x=%d\n",x + i); - m_video_mem.pix16(m_yline, x + i) = m_video_mem.pix16(y, x + i); + m_video_mem.pix(m_yline, x + i) = m_video_mem.pix(y, x + i); } } diff --git a/src/mame/video/rockrage.cpp b/src/mame/video/rockrage.cpp index baf4d3f7551..02fe31a1a7b 100644 --- a/src/mame/video/rockrage.cpp +++ b/src/mame/video/rockrage.cpp @@ -70,7 +70,7 @@ uint32_t rockrage_state::screen_update_rockrage(screen_device &screen, bitmap_in { m_k007342->tilemap_update(); - bitmap.fill(rgb_t::black(), cliprect); + bitmap.fill(0, cliprect); m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); // Tutankhamen eyes go below sprites m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); diff --git a/src/mame/video/rohga.cpp b/src/mame/video/rohga.cpp index 51921233c0e..9c6c6c2b343 100644 --- a/src/mame/video/rohga.cpp +++ b/src/mame/video/rohga.cpp @@ -89,8 +89,8 @@ void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &clipre for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* srcline = &sprite_bitmap->pix16(y,0); - u32* dstline = &bitmap.pix32(y,0); + u16 const *const srcline = &sprite_bitmap->pix(y,0); + u32 *const dstline = &bitmap.pix(y,0); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -168,11 +168,11 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap, for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16 *srcline1 = &sprite_bitmap1->pix16(y,0); - const u16 *srcline2 = &sprite_bitmap2->pix16(y,0); - const u8 *srcpriline = &priority_bitmap->pix8(y,0); + u16 const *const srcline1 = &sprite_bitmap1->pix(y,0); + u16 const *const srcline2 = &sprite_bitmap2->pix(y,0); + u8 const *const srcpriline = &priority_bitmap->pix(y,0); - u32* dstline = &bitmap.pix32(y,0); + u32 *const dstline = &bitmap.pix(y,0); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/route16.cpp b/src/mame/video/route16.cpp index 9d2dc225ac8..97b71c584cd 100644 --- a/src/mame/video/route16.cpp +++ b/src/mame/video/route16.cpp @@ -87,13 +87,13 @@ uint32_t route16_state::screen_update_route16(screen_device &screen, bitmap_rgb3 uint8_t final_color = (color1 | color2) & 0x07; if (m_flipscreen) - bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color); + bitmap.pix(255 - y, 255 - x) = m_palette->pen_color(final_color); else - bitmap.pix32(y, x) = m_palette->pen_color(final_color); + bitmap.pix(y, x) = m_palette->pen_color(final_color); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } @@ -134,13 +134,13 @@ uint32_t route16_state::screen_update_jongpute(screen_device &screen, bitmap_rgb uint8_t final_color = (color1 | color2) & 0x07; if (m_flipscreen) - bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color); + bitmap.pix(255 - y, 255 - x) = m_palette->pen_color(final_color); else - bitmap.pix32(y, x) = m_palette->pen_color(final_color); + bitmap.pix(y, x) = m_palette->pen_color(final_color); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } diff --git a/src/mame/video/rpunch.cpp b/src/mame/video/rpunch.cpp index 90870ee22e1..02e7dcfbd28 100644 --- a/src/mame/video/rpunch.cpp +++ b/src/mame/video/rpunch.cpp @@ -102,7 +102,7 @@ u8 rpunch_state::pixmap_r(offs_t offset) const int sy = offset >> 8; const int sx = (offset & 0xff) << 1; - return ((m_pixmap->pix16(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix16(sy & 0xff, sx | 1) & 0xf); + return ((m_pixmap->pix(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix(sy & 0xff, sx | 1) & 0xf); } void rpunch_state::pixmap_w(offs_t offset, u8 data) @@ -110,8 +110,8 @@ void rpunch_state::pixmap_w(offs_t offset, u8 data) const int sy = offset >> 8; const int sx = (offset & 0xff) << 1; - m_pixmap->pix16(sy & 0xff, sx & ~1) = ((data & 0xf0) >> 4); - m_pixmap->pix16(sy & 0xff, sx | 1) = (data & 0x0f); + m_pixmap->pix(sy & 0xff, sx & ~1) = ((data & 0xf0) >> 4); + m_pixmap->pix(sy & 0xff, sx | 1) = (data & 0x0f); } void rpunch_state::videoram_w(offs_t offset, u16 data, u16 mem_mask) @@ -252,8 +252,8 @@ void rpunch_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *src = &m_pixmap->pix16(y & 0xff); - u16 *dst = &bitmap.pix16(y); + u16 const *const src = &m_pixmap->pix(y & 0xff); + u16 *const dst = &bitmap.pix(y); for(int x = cliprect.min_x / 4; x <= cliprect.max_x; x++) { const u16 pix = src[(x + 4) & 0x1ff]; diff --git a/src/mame/video/segag80r.cpp b/src/mame/video/segag80r.cpp index b3bc8eae218..2fbed33e1ca 100644 --- a/src/mame/video/segag80r.cpp +++ b/src/mame/video/segag80r.cpp @@ -670,7 +670,6 @@ void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectang int xoffset = (m_spaceod_bg_control & 0x02) ? 0x10 : 0x00; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* The H and V counters on this board are independent of the ones on */ /* the main board. The H counter starts counting from 0 when EXT BLK */ @@ -679,14 +678,14 @@ void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectang /* 240, giving us an offset of (262-240) = 22 scanlines. */ /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = (y + m_spaceod_vcounter + 22) ^ flipmask; - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = ((x + m_spaceod_hcounter) ^ flipmask) + xoffset; uint8_t fgpix = m_paletteram[dst[x]]; @@ -726,7 +725,6 @@ void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rec int flipmask = (m_video_control & 0x08) ? 0xff : 0x00; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* if disabled, draw nothing */ if (!m_bg_enable) @@ -736,14 +734,14 @@ void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rec } /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = m_bg_scrolly + (((y ^ flipmask) + (flipmask & 0xe0)) & 0xff); - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = m_bg_scrollx + (x ^ flipmask); dst[x] = src[effx & xmask]; @@ -766,7 +764,6 @@ void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rec int flipmask = (m_video_control & 0x08) ? 0x3ff : 0x000; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* if disabled, draw nothing */ if (!m_bg_enable) @@ -776,14 +773,14 @@ void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rec } /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = (y + m_bg_scrolly) ^ flipmask; - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = (x + m_bg_scrollx) ^ flipmask; dst[x] = src[effx & xmask]; diff --git a/src/mame/video/segaic16.cpp b/src/mame/video/segaic16.cpp index 8577151a4b5..2c060d0c947 100644 --- a/src/mame/video/segaic16.cpp +++ b/src/mame/video/segaic16.cpp @@ -1539,23 +1539,22 @@ void segaic16_video_device::rotate_draw(int which, bitmap_ind16 &bitmap, const r int32_t dxx = (info->buffer[0x3f6] << 16) | info->buffer[0x3f7]; int32_t dxy = (info->buffer[0x3f8] << 16) | info->buffer[0x3f9]; int32_t dyx = (info->buffer[0x3fa] << 16) | info->buffer[0x3fb]; - int x, y; /* advance forward based on the clip rect */ currx += dxx * (cliprect.min_x + 27) + dxy * cliprect.min_y; curry += dyx * (cliprect.min_x + 27) + dyy * cliprect.min_y; /* loop over screen Y coordinates */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &srcbitmap.pix16(0); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t *dest = &bitmap.pix(y); + uint16_t const *const src = &srcbitmap.pix(0); + uint8_t *pri = &priority_bitmap.pix(y); int32_t tx = currx; int32_t ty = curry; /* loop over screen X coordinates */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* fetch the pixel from the source bitmap */ int sx = (tx >> 14) & 0x1ff; diff --git a/src/mame/video/segaic16_road.cpp b/src/mame/video/segaic16_road.cpp index 290d1b15c5f..35d31cb4057 100644 --- a/src/mame/video/segaic16_road.cpp +++ b/src/mame/video/segaic16_road.cpp @@ -91,7 +91,7 @@ static void segaic16_road_hangon_draw(segaic16_road_device::road_info *info, bit /* loop over scanlines */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); const u16 control = roadram[0x000 + y]; int hpos = roadram[0x100 + (control & 0xff)]; const u16 color0 = roadram[0x200 + (control & 0xff)]; @@ -364,7 +364,7 @@ static void segaic16_road_outrun_draw(segaic16_road_device::road_info *info, bit // { 0x80,0x81,0x81,0x83,0,0,0,0x00 }, // { 0x81,0x87,0x87,0x8f,0,0,0,0x00 } }; - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); const u16 data0 = roadram[0x000 + y]; const u16 data1 = roadram[0x100 + y]; diff --git a/src/mame/video/segaic24.cpp b/src/mame/video/segaic24.cpp index 805f6bb4cb1..3b07c9e8fa3 100644 --- a/src/mame/video/segaic24.cpp +++ b/src/mame/video/segaic24.cpp @@ -103,16 +103,13 @@ void segas24_tile_device::device_start() void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind8 &tm, bitmap_ind16 &dm, const uint16_t *mask, uint16_t tpri, uint8_t lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) { - int y; - const uint16_t *source = &bm.pix16(sy, sx); - const uint8_t *trans = &tm.pix8(sy, sx); - uint8_t *prib = &screen.priority().pix8(0); - uint16_t *dest = &dm.pix16(0); + const uint16_t *source = &bm.pix(sy, sx); + const uint8_t *trans = &tm.pix(sy, sx); + uint8_t *prib = &screen.priority().pix(yy1, xx1); + uint16_t *dest = &dm.pix(yy1, xx1); tpri |= TILEMAP_PIXEL_LAYER0; - dest += yy1*dm.rowpixels() + xx1; - prib += yy1*screen.priority().rowpixels() + xx1; mask += yy1*4; yy2 -= yy1; @@ -122,7 +119,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit mask++; } - for(y=0; y<yy2; y++) { + for(int y=0; y<yy2; y++) { const uint16_t *src = source; const uint8_t *srct = trans; uint16_t *dst = dest; @@ -142,8 +139,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x=0; x<128; x++) { + for(int x=0; x<128; x++) { if(*srct++ == tpri) { *dst = *src; *pr |= lpri; @@ -162,8 +158,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=0; x<128; x+=8) { + for(int x=0; x<128; x+=8) { if(!(m & 0x8000)) { int xx; for(xx=0; xx<8; xx++) @@ -185,8 +180,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x = cur_x; x<llx1; x++) { + for(int x = cur_x; x<llx1; x++) { if(*srct++ == tpri) { *dst = *src; *pr |= lpri; @@ -205,8 +199,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=cur_x; x<llx1; x++) { + for(int x=cur_x; x<llx1; x++) { if(*srct++ == tpri && !(m & (0x8000 >> (x >> 3)))) { *dst = *src; *pr |= lpri; @@ -237,15 +230,13 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind8 &tm, bitmap_rgb32 &dm, const uint16_t *mask, uint16_t tpri, uint8_t lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) { - int y; - const uint16_t *source = &bm.pix16(sy, sx); - const uint8_t *trans = &tm.pix8(sy, sx); - uint32_t *dest = &dm.pix32(0); - const pen_t *pens = palette().pens(); + const uint16_t *source = &bm.pix(sy, sx); + const uint8_t *trans = &tm.pix(sy, sx); + uint32_t *dest = &dm.pix(yy1, xx1); + const pen_t *const pens = palette().pens(); tpri |= TILEMAP_PIXEL_LAYER0; - dest += yy1*dm.rowpixels() + xx1; mask += yy1*4; yy2 -= yy1; @@ -255,7 +246,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit mask++; } - for(y=0; y<yy2; y++) { + for(int y=0; y<yy2; y++) { const uint16_t *src = source; const uint8_t *srct = trans; uint32_t *dst = dest; @@ -274,8 +265,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x=0; x<128; x++) { + for(int x=0; x<128; x++) { if(*srct++ == tpri) *dst = pens[*src]; src++; @@ -290,11 +280,9 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=0; x<128; x+=8) { + for(int x=0; x<128; x+=8) { if(!(m & 0x8000)) { - int xx; - for(xx=0; xx<8; xx++) + for(int xx=0; xx<8; xx++) if(srct[xx] == tpri) dst[xx] = pens[src[xx]]; } @@ -310,8 +298,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x = cur_x; x<llx1; x++) { + for(int x = cur_x; x<llx1; x++) { if(*srct++ == tpri) *dst = pens[*src]; src++; @@ -603,16 +590,14 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect { uint16_t curspr = 0; int countspr = 0; - int seen; uint8_t pmt[4]; - int i; uint16_t *sprd[0x2000], *clip[0x2000]; uint16_t *cclip = nullptr; - for(i=0; i<4; i++) + for(int i=0; i<4; i++) pmt[i] = 0xff << (1+spri[3-i]); - for(seen = 0; seen < 0x2000; seen++) { + for(int seen = 0; seen < 0x2000; seen++) { uint16_t *source; uint16_t type; @@ -647,7 +632,6 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect for(countspr--; countspr >= 0; countspr--) { uint16_t *source, *pix; int x, y, sx, sy; - int px, py; uint16_t colors[16]; int flipx, flipy; int zoomx, zoomy; @@ -719,7 +703,7 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect sy = 1 << ((source[4] & 0x7000) >> 12); pix = &sprite_ram[(source[3] & 0x3fff)* 0x8]; - for(px=0; px<8; px++) { + for(int px=0; px<8; px++) { int c; c = pix[px] >> 8; pm[px*2] = pmt[c>>6]; @@ -738,38 +722,36 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect xmod = 0x20; ymod = 0x20; - for(py=0; py<sy; py++) { + for(int py=0; py<sy; py++) { int xmod1 = xmod; int xpos1 = x; int ypos1 = y, ymod1 = ymod; - for(px=0; px<sx; px++) { + for(int px=0; px<sx; px++) { int xmod2 = xmod1, xpos2 = xpos1; - int zy; addoffset = 0x10*(flipx ? sx-px-1 : px) + 0x10*sx*(flipy ? sy-py-1 : py) + (flipy ? 7*2 : 0); newoffset = offset + addoffset; ymod1 = ymod; ypos1 = y; - for(zy=0; zy<8; zy++) { + for(int zy=0; zy<8; zy++) { ymod1 += zoomy; while(ymod1 >= 0x40) { if((ypos1 >= min_y && ypos1 <= max_y) ^ clip_reverse_y) { - int zx; xmod2 = xmod1; xpos2 = xpos1; - for(zx=0; zx<8; zx++) { + for(int zx=0; zx<8; zx++) { xmod2 += zoomx; while(xmod2 >= 0x40) { if(xpos2 >= min_x && xpos2 <= max_x) { int zx1 = flipx ? 7-zx : zx; uint32_t neweroffset = (newoffset+(zx1>>2))&0x1ffff; // crackdown sometimes attempts to use data past the end of spriteram int c = (sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf; - uint8_t *pri = &priority_bitmap.pix8(ypos1, xpos2); + uint8_t *pri = &priority_bitmap.pix(ypos1, xpos2); if(!(*pri & pm[c])) { c = colors[c]; if(c) { - uint16_t *dst = &bitmap.pix16(ypos1, xpos2); + uint16_t *dst = &bitmap.pix(ypos1, xpos2); if(c==1) *dst = (*dst) | 0x2000; else diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp index 58ae7d70632..177a383f851 100644 --- a/src/mame/video/segas32.cpp +++ b/src/mame/video/segas32.cpp @@ -668,21 +668,14 @@ inline void segas32_state::get_tilemaps(int bgnum, tilemap_t **tilemaps) void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect, int bgnum) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - tilemap_t *tilemaps[4]; - uint32_t srcx, srcx_start, srcy; - uint32_t srcxstep, srcystep; - int dstxstep, dstystep; - int opaque; - int x, y; /* get the tilemaps */ + tilemap_t *tilemaps[4]; get_tilemaps(bgnum, tilemaps); /* configure the layer */ - opaque = 0; + int opaque = 0; //opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_Z) && bgnum == 0) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1; @@ -692,13 +685,15 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la compute_tilemap_flips(bgnum, flipx, flipy); /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + int clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* extract the X/Y step values (these are in destination space!) */ - dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + int dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + int dstystep; if (m_videoram[0x1ff00/2] & 0x4000) dstystep = m_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; else @@ -711,13 +706,13 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la dstystep = 0x80; /* compute high-precision reciprocals (in 12.20 format) */ - srcxstep = (0x200 << 20) / dstxstep; - srcystep = (0x200 << 20) / dstystep; + uint32_t srcxstep = (0x200 << 20) / dstxstep; + uint32_t srcystep = (0x200 << 20) / dstystep; /* start with the fractional scroll offsets, in source coordinates */ - srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; + uint32_t srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; srcx_start += (m_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; - srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; + uint32_t srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; srcy += (m_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; /* then account for the destination center coordinates */ @@ -746,32 +741,30 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la } /* loop over the target rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ if (clipdraw || extents[1] <= cliprect.max_x) { int transparent = 0; - uint16_t *src[2]; /* look up the pages and get their source pixmaps */ - bitmap_ind16 &tm0 = tilemaps[((srcy >> 27) & 2) + 0]->pixmap(); - bitmap_ind16 &tm1 = tilemaps[((srcy >> 27) & 2) + 1]->pixmap(); - src[0] = &tm0.pix16((srcy >> 20) & 0xff); - src[1] = &tm1.pix16((srcy >> 20) & 0xff); + bitmap_ind16 const &tm0 = tilemaps[((srcy >> 27) & 2) + 0]->pixmap(); + bitmap_ind16 const &tm1 = tilemaps[((srcy >> 27) & 2) + 1]->pixmap(); + uint16_t const *const src[2] = { &tm0.pix((srcy >> 20) & 0xff), &tm1.pix((srcy >> 20) & 0xff) }; /* loop over extents */ - srcx = srcx_start; + uint32_t srcx = srcx_start; while (1) { /* if we're drawing on this extent, draw it */ if (clipdraw) { - for (x = extents[0]; x < extents[1]; x++) + for (int x = extents[0]; x < extents[1]; x++) { uint16_t pix = src[(srcx >> 29) & 1][(srcx >> 20) & 0x1ff]; srcx += srcxstep; @@ -785,7 +778,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); srcx += srcxstep * pixels; transparent += pixels; } @@ -827,22 +820,14 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect, int bgnum) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - tilemap_t *tilemaps[4]; - int rowscroll, rowselect; - int xscroll, yscroll; - uint16_t *table; - int srcx, srcy; - int opaque; - int x, y; /* get the tilemaps */ + tilemap_t *tilemaps[4]; get_tilemaps(bgnum, tilemaps); /* configure the layer */ - opaque = 0; + int opaque = 0; //opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_C) && bgnum == 2) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_V) && bgnum == 3) opaque = 1; @@ -854,39 +839,40 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + int clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine if row scroll and/or row select is enabled */ - rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; - rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; + int rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; + int rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; if ((m_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) rowscroll = rowselect = 0; /* get a pointer to the table */ - table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; + uint16_t const *const table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; /* start with screen-wide X and Y scrolls */ - xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); - yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); + int xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); + int yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); /* render the tilemap into its bitmap */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ if (clipdraw || extents[1] <= cliprect.max_x) { int transparent = 0; - uint16_t *src[2]; int srcxstep; /* if we're not flipped, things are straightforward */ + int srcx; if (!flipx) { srcx = cliprect.min_x + xscroll; @@ -898,6 +884,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat srcxstep = -1; } + int srcy; if (!flipy) { srcy = yscroll + y; @@ -916,10 +903,9 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* look up the pages and get their source pixmaps */ - bitmap_ind16 &tm0 = tilemaps[((srcy >> 7) & 2) + 0]->pixmap(); - bitmap_ind16 &tm1 = tilemaps[((srcy >> 7) & 2) + 1]->pixmap(); - src[0] = &tm0.pix16(srcy & 0xff); - src[1] = &tm1.pix16(srcy & 0xff); + bitmap_ind16 const &tm0 = tilemaps[((srcy >> 7) & 2) + 0]->pixmap(); + bitmap_ind16 const &tm1 = tilemaps[((srcy >> 7) & 2) + 1]->pixmap(); + uint16_t const *const src[2] = { &tm0.pix(srcy & 0xff), &tm1.pix(srcy & 0xff) }; /* loop over extents */ while (1) @@ -927,7 +913,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* if we're drawing on this extent, draw it */ if (clipdraw) { - for (x = extents[0]; x < extents[1]; x++, srcx += srcxstep) + for (int x = extents[0]; x < extents[1]; x++, srcx += srcxstep) { uint16_t pix = src[(srcx >> 9) & 1][srcx & 0x1ff]; if ((pix & 0x0f) == 0 && !opaque) @@ -940,7 +926,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); srcx += srcxstep * pixels; transparent += pixels; } @@ -979,41 +965,35 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect) { bitmap_ind16 &bitmap = layer.bitmap; - uint16_t *tilebase; - uint16_t *gfxbase; - int startx, starty; - int endx, endy; - int x, y, iy; - int flip; /* determine if we're flipped */ - flip = (m_videoram[0x1ff00/2] >> 9) & 1; + int flip = (m_videoram[0x1ff00/2] >> 9) & 1; /* determine the base of the tilemap and graphics data */ - tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; - gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; + uint16_t const *const tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; + uint16_t const *const gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; /* compute start/end tile numbers */ - startx = cliprect.min_x / 8; - starty = cliprect.min_y / 8; - endx = cliprect.max_x / 8; - endy = cliprect.max_y / 8; + int startx = cliprect.min_x / 8; + int starty = cliprect.min_y / 8; + int endx = cliprect.max_x / 8; + int endy = cliprect.max_y / 8; /* loop over tiles */ - for (y = starty; y <= endy; y++) - for (x = startx; x <= endx; x++) + for (int y = starty; y <= endy; y++) + for (int x = startx; x <= endx; x++) { int tile = tilebase[y * 64 + x]; - uint16_t *src = &gfxbase[(tile & 0x1ff) * 16]; + uint16_t const *src = &gfxbase[(tile & 0x1ff) * 16]; int color = (tile & 0xfe00) >> 5; /* non-flipped case */ if (!flip) { - uint16_t *dst = &bitmap.pix16(y * 8, x * 8); + uint16_t *dst = &bitmap.pix(y * 8, x * 8); /* loop over rows */ - for (iy = 0; iy < 8; iy++) + for (int iy = 0; iy < 8; iy++) { int pixels = *src++; int pix; @@ -1071,10 +1051,10 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la int effdstx = visarea.max_x - x * 8; int effdsty = visarea.max_y - y * 8; - uint16_t *dst = &bitmap.pix16(effdsty, effdstx); + uint16_t *dst = &bitmap.pix(effdsty, effdstx); /* loop over rows */ - for (iy = 0; iy < 8; iy++) + for (int iy = 0; iy < 8; iy++) { int pixels = *src++; int pix; @@ -1137,33 +1117,28 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - int xscroll, yscroll; - int color; - int x, y; - int bpp; /* configure the layer */ - bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; + int bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; - clipout = (m_videoram[0x1ff02/2] >> 10) & 1; - clips = 0x10; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; + int clipout = (m_videoram[0x1ff02/2] >> 10) & 1; + int clips = 0x10; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine x/y scroll */ - xscroll = m_videoram[0x1ff88/2] & 0x1ff; - yscroll = m_videoram[0x1ff8a/2] & 0x1ff; - color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); + int xscroll = m_videoram[0x1ff88/2] & 0x1ff; + int yscroll = m_videoram[0x1ff8a/2] & 0x1ff; + int color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); /* loop over target rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ @@ -1180,8 +1155,8 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in /* 8bpp mode case */ if (bpp == 8) { - uint8_t *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; - for (x = extents[0]; x < extents[1]; x++) + uint8_t const *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; + for (int x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; int pix = src[BYTE_XOR_LE(effx)] + color; @@ -1194,8 +1169,8 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in /* 4bpp mode case */ else { - uint16_t *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; - for (x = extents[0]; x < extents[1]; x++) + uint16_t const *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; + for (int x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; int pix = ((src[effx / 4] >> (4 * (effx & 3))) & 0x0f) + color; @@ -1210,7 +1185,7 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); transparent += pixels; } @@ -1241,11 +1216,10 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in void segas32_state::update_background(segas32_state::layer_info &layer, const rectangle &cliprect) { bitmap_ind16 &bitmap = layer.bitmap; - int x, y; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); int color; /* determine the color */ @@ -1260,7 +1234,7 @@ void segas32_state::update_background(segas32_state::layer_info &layer, const re /* if the color doesn't match, fill */ if (dst[cliprect.min_x] != color) - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = color; } } @@ -1429,7 +1403,7 @@ void segas32_state::sprite_swap_buffers() } \ } -int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) +int segas32_state::draw_one_sprite(uint16_t const *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) { static const int transparency_masks[4][4] = { @@ -1467,9 +1441,9 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r int color = 0x8000 | (data[7] & (bpp8 ? 0x7f00 : 0x7ff0)); int hzoom, vzoom; int xdelta = 1, ydelta = 1; - int x, y, xtarget, ytarget, yacc = 0, pix, transmask; + int xtarget, ytarget, yacc = 0, pix, transmask; const uint32_t *spritedata; - uint32_t addrmask, curaddr; + uint32_t addrmask; uint16_t indtable[16]; /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */ @@ -1484,8 +1458,8 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r /* create the local palette for the indirect case */ if (indirect) { - uint16_t *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; - for (x = 0; x < 16; x++) + uint16_t const *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; + for (int x = 0; x < 16; x++) indtable[x] = (src[x] & (bpp8 ? 0xfff0 : 0xffff)) | ((m_sprite_control_latched[0x0a/2] & 1) ? 0x8000 : 0x0000); } @@ -1560,21 +1534,21 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r } /* loop from top to bottom */ - for (y = ypos; y != ytarget; y += ydelta) + for (int y = ypos; y != ytarget; y += ydelta) { /* skip drawing if not within the inclusive cliprect */ if (y >= clipin.min_y && y <= clipin.max_y) { int do_clipout = (y >= clipout.min_y && y <= clipout.max_y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); int xacc = 0; /* 4bpp case */ if (!bpp8) { /* start at the word before because we preincrement below */ - curaddr = addr - 1; - for (x = xpos; x != xtarget; ) + uint32_t curaddr = addr - 1; + for (int x = xpos; x != xtarget; ) { uint32_t pixels = spritedata[++curaddr & addrmask]; @@ -1598,8 +1572,8 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r else { /* start at the word before because we preincrement below */ - curaddr = addr - 1; - for (x = xpos; x != xtarget; ) + uint32_t curaddr = addr - 1; + for (int x = xpos; x != xtarget; ) { uint32_t pixels = spritedata[++curaddr & addrmask]; @@ -1635,7 +1609,6 @@ void segas32_state::sprite_render_list() int xoffs = 0, yoffs = 0; int numentries = 0; int spritenum = 0; - uint16_t *sprite; g_profiler.start(PROFILER_USER2); @@ -1655,7 +1628,7 @@ void segas32_state::sprite_render_list() while (numentries++ < 0x20000/16) { /* top two bits are a command */ - sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; + uint16_t const *const sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; switch (sprite[0] >> 14) { /* command 0 = draw sprite */ @@ -1764,7 +1737,7 @@ inline uint16_t *segas32_state::get_layer_scanline(int layer, int scanline) { if (m_layer_data[layer].transparent[scanline]) return (layer == MIXER_LAYER_SPRITES) ? m_solid_ffff.get() : m_solid_0000.get(); - return &m_layer_data[layer].bitmap.pix16(scanline); + return &m_layer_data[layer].bitmap.pix(scanline); } void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t enablemask) @@ -1781,14 +1754,6 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c uint8_t mixshift; /* shift from control reg */ uint8_t coloroffs; /* color offset index */ } layerorder[16][8], layersort[8]; - uint8_t sprgroup_shift, sprgroup_mask, sprgroup_or; - int numlayers, laynum, groupnum; - int rgboffs[3][3]; - int sprpixmask, sprshadowmask; - int sprx, spry, sprx_start; - int sprdx, sprdy; - int sprshadow; - int x, y, i; /* if we are the second monitor on multi32, swap in the proper sprite bank */ if (which == 1) @@ -1799,6 +1764,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* extract the RGB offsets */ + int rgboffs[3][3]; rgboffs[0][0] = (int8_t)(m_mixer_control[which][0x40/2] << 2) >> 2; rgboffs[0][1] = (int8_t)(m_mixer_control[which][0x42/2] << 2) >> 2; rgboffs[0][2] = (int8_t)(m_mixer_control[which][0x44/2] << 2) >> 2; @@ -1810,6 +1776,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c rgboffs[2][2] = 0; /* determine the sprite grouping parameters first */ + uint8_t sprgroup_shift, sprgroup_mask, sprgroup_or; switch (m_mixer_control[which][0x4c/2] & 0x0f) { default: @@ -1833,13 +1800,13 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c case 0xe: sprgroup_shift = 11; sprgroup_mask = 0x07; sprgroup_or = 0x00; break; case 0xf: sprgroup_shift = 10; sprgroup_mask = 0x0f; sprgroup_or = 0x00; break; } - sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; - sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; - sprshadow = 0x7ffe & sprpixmask; + int sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; + int sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; + int sprshadow = 0x7ffe & sprpixmask; /* extract info about TEXT, NBG0-3, and BITMAP layers, which all follow the same pattern */ - numlayers = 0; - for (laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) + int numlayers = 0; + for (int laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) { int priority = m_mixer_control[which][0x20/2 + laynum] & 0x0f; if ((enablemask & (1 << laynum)) && priority != 0) @@ -1866,8 +1833,8 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c numlayers++; /* now bubble sort the list by effective priority */ - for (laynum = 0; laynum < numlayers; laynum++) - for (i = laynum + 1; i < numlayers; i++) + for (int laynum = 0; laynum < numlayers; laynum++) + for (int i = laynum + 1; i < numlayers; i++) if (layersort[i].effpri > layersort[laynum].effpri) { mixer_layer_info temp = layersort[i]; @@ -1876,7 +1843,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* for each possible sprite group, insert the sprites into the list at the appropriate point */ - for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) + for (int groupnum = 0; groupnum <= sprgroup_mask; groupnum++) { int effgroup = sprgroup_or | groupnum; int priority = m_mixer_control[which][0x00/2 + effgroup] & 0x0f; @@ -1885,7 +1852,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c int dstnum = 0; /* make a copy of the sorted list, finding a location for the sprite entry */ - for (laynum = 0; laynum < numlayers; laynum++) + for (int laynum = 0; laynum < numlayers; laynum++) { if (effpri > layersort[laynum].effpri && sprindex == numlayers) sprindex = dstnum++; @@ -1904,10 +1871,10 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c layerorder[groupnum][sprindex].sprblendmask = 0; layerorder[groupnum][sprindex].coloroffs = compute_color_offsets(which, (m_mixer_control[which][0x3e/2] >> 6) & 1, (m_mixer_control[which][0x4c/2] >> 15) & 1); } -/*\ +/* { static const char *const layname[] = { "TEXT", "NBG0", "NBG1", "NBG2", "NBG3", "BITM", "SPRI", "LINE" }; - for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) + for (int groupnum = 0; groupnum <= sprgroup_mask; groupnum++) { osd_printf_debug("%X: ", groupnum); for (i = 0; i <= numlayers; i++) @@ -1918,6 +1885,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c /* based on the sprite controller flip bits, the data is scanned to us in different */ /* directions; account for this */ + int sprx_start, sprdx; if (m_sprite_control_latched[0x04/2] & 1) { sprx_start = cliprect.max_x; @@ -1929,6 +1897,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c sprdx = 1; } + int spry, sprdy; if (m_sprite_control_latched[0x04/2] & 2) { spry = cliprect.max_y; @@ -1941,9 +1910,9 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++, spry += sprdy) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++, spry += sprdy) { - uint32_t *dest = &bitmap.pix32(y, xoffs); + uint32_t *const dest = &bitmap.pix(y, xoffs); uint16_t *layerbase[8]; /* get the starting address for each layer */ @@ -1957,18 +1926,15 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c layerbase[MIXER_LAYER_BACKGROUND] = get_layer_scanline(MIXER_LAYER_BACKGROUND, y); /* loop over columns */ - for (x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) + for (int x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) { - mixer_layer_info *first; - int *rgbdelta; - int firstpix; - int sprpix, sprgroup; - int r, g, b; + mixer_layer_info const *first; + int laynum, firstpix; int shadow = 0; /* first grab the current sprite pixel and determine the group */ - sprpix = layerbase[MIXER_LAYER_SPRITES][sprx]; - sprgroup = (sprpix >> sprgroup_shift) & sprgroup_mask; + int sprpix = layerbase[MIXER_LAYER_SPRITES][sprx]; + int sprgroup = (sprpix >> sprgroup_shift) & sprgroup_mask; /* now scan the layers to find the topmost non-transparent pixel */ for (first = &layerorder[sprgroup][0]; ; first++) @@ -2002,15 +1968,15 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c firstpix = m_paletteram[which][(first->palbase + ((firstpix >> first->mixshift) & 0xfff0) + (firstpix & 0x0f)) & 0x3fff]; /* compute R, G, B */ - rgbdelta = &rgboffs[first->coloroffs][0]; - r = ((firstpix >> 0) & 0x1f) + rgbdelta[0]; - g = ((firstpix >> 5) & 0x1f) + rgbdelta[1]; - b = ((firstpix >> 10) & 0x1f) + rgbdelta[2]; + int const *rgbdelta = &rgboffs[first->coloroffs][0]; + int r = ((firstpix >> 0) & 0x1f) + rgbdelta[0]; + int g = ((firstpix >> 5) & 0x1f) + rgbdelta[1]; + int b = ((firstpix >> 10) & 0x1f) + rgbdelta[2]; /* if there are potential blends, keep looking */ if (first->blendmask != 0) { - mixer_layer_info *second; + mixer_layer_info const *second; int secondpix; /* now scan the layers to find the topmost non-transparent pixel */ diff --git a/src/mame/video/seibuspi.cpp b/src/mame/video/seibuspi.cpp index 5a496feeb0f..1654ecf74c2 100644 --- a/src/mame/video/seibuspi.cpp +++ b/src/mame/video/seibuspi.cpp @@ -443,8 +443,8 @@ void seibuspi_state::drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &clipre // draw for (int y = y1; y <= y2; y++) { - u32 *dest = &bitmap.pix32(y); - u8 *pri = &primap.pix8(y); + u32 *const dest = &bitmap.pix(y); + u8 *const pri = &primap.pix(y); int src_i = (py * width) + px; py += yd; @@ -567,9 +567,9 @@ void seibuspi_state::combine_tilemap(bitmap_rgb32 &bitmap, const rectangle &clip if (rowscroll) rx += rowscroll[(y + 19) & yscroll_mask]; // adder value probably not hardcoded but came from CRTC - u32 *dest = &bitmap.pix32(y); - const u16 *src = &pen_bitmap.pix16((y + sy) & yscroll_mask); - const u8 *flags = &flags_bitmap.pix8((y + sy) & yscroll_mask); + u32 *dest = &bitmap.pix(y); + const u16 *src = &pen_bitmap.pix((y + sy) & yscroll_mask); + const u8 *flags = &flags_bitmap.pix((y + sy) & yscroll_mask); for (int x = cliprect.min_x + rx; x <= cliprect.max_x + rx; x++) { if (opaque || (flags[x & xscroll_mask] & (TILEMAP_PIXEL_LAYER0 | TILEMAP_PIXEL_LAYER1))) diff --git a/src/mame/video/senjyo.cpp b/src/mame/video/senjyo.cpp index c52e56294ea..78e587b8800 100644 --- a/src/mame/video/senjyo.cpp +++ b/src/mame/video/senjyo.cpp @@ -182,10 +182,10 @@ void senjyo_state::draw_bgbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect { if (flip) for (int y = 0;y < 256;y++) - bitmap.pix32(y, 255 - x) = m_palette->pen_color(384 + pen); + bitmap.pix(y, 255 - x) = m_palette->pen_color(384 + pen); else for (int y = 0;y < 256;y++) - bitmap.pix32(y, x) = m_palette->pen_color(384 + pen); + bitmap.pix(y, x) = m_palette->pen_color(384 + pen); count += 0x10; if (count >= strwid) @@ -215,7 +215,7 @@ void senjyo_state::draw_radar(bitmap_rgb32 &bitmap, const rectangle &cliprect) } if (cliprect.contains(sx, sy)) - bitmap.pix32(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); + bitmap.pix(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); } } diff --git a/src/mame/video/seta.cpp b/src/mame/video/seta.cpp index 154252c713d..52f09b2cd98 100644 --- a/src/mame/video/seta.cpp +++ b/src/mame/video/seta.cpp @@ -655,24 +655,24 @@ void seta_state::draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectang const bitmap_ind16 &src_bitmap = tilemap->pixmap(); const int opaque_mask = gfx_tilemap->granularity() - 1; const int pixel_effect_mask = gfx_tilemap->colorbase() + (gfx_tilemap->colors() - 1) * gfx_tilemap->granularity(); - int p; const int width_mask = src_bitmap.width() - 1; const int height_mask = src_bitmap.height() - 1; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { + int p; if (!flipscreen) { - p = src_bitmap.pix16((y + scrolly) & height_mask, (x + scrollx) & width_mask); + p = src_bitmap.pix((y + scrolly) & height_mask, (x + scrollx) & width_mask); } else { - p = src_bitmap.pix16((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask); + p = src_bitmap.pix((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask); } // draw not transparent pixels diff --git a/src/mame/video/seta2.cpp b/src/mame/video/seta2.cpp index e165212cf96..cea97916aa6 100644 --- a/src/mame/video/seta2.cpp +++ b/src/mame/video/seta2.cpp @@ -318,7 +318,7 @@ inline void seta2_state::drawgfx_line(bitmap_ind16& bitmap, const rectangle& cli if (!use_shadow) shadow = 0; - uint16_t* dest = &bitmap.pix16(screenline); + uint16_t *const dest = &bitmap.pix(screenline); int minx = cliprect.min_x << 16; int maxx = (cliprect.max_x + 1) << 16; @@ -927,7 +927,7 @@ void staraudi_state::draw_rgbram(bitmap_ind16 &bitmap) { int offs = x * 2/2 + y * 0x400/2; uint32_t data = ((m_rgbram[offs + 0x40000/2] & 0xff) << 16) | m_rgbram[offs]; - bitmap.pix16(y, x) = (data & 0x7fff); + bitmap.pix(y, x) = (data & 0x7fff); } } } diff --git a/src/mame/video/shuuz.cpp b/src/mame/video/shuuz.cpp index dc62d134373..8c2013e8c4a 100644 --- a/src/mame/video/shuuz.cpp +++ b/src/mame/video/shuuz.cpp @@ -88,8 +88,8 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -107,10 +107,10 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, * +PFS7*(LBD7&LBD6)*!M3*!O13 * */ - int o13 = ((pf[x] & 0xf0) == 0xf0); - int mopf = 0; + int const o13 = ((pf[x] & 0xf0) == 0xf0); /* compute the MO/PF signal */ + int mopf = 0; if ((!(pf[x] & 0x80) && ((mo[x] & 0xc0) != 0xc0) && ((mo[x] & 0x0e) != 0x00) && !o13) || ((pf[x] & 0x80) && ((mo[x] & 0xc0) == 0xc0) && ((mo[x] & 0x0e) != 0x00) && !o13)) mopf = 1; diff --git a/src/mame/video/sidearms.cpp b/src/mame/video/sidearms.cpp index 20fef5fa3b4..01d4dddeea1 100644 --- a/src/mame/video/sidearms.cpp +++ b/src/mame/video/sidearms.cpp @@ -207,17 +207,16 @@ void sidearms_state::draw_sprites_region(bitmap_ind16 &bitmap, const rectangle & void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) { - int x, y, i; uint32_t hadd_283, vadd_283, _hflop_74a_n, _hcount_191, _vcount_191; uint8_t *sf_rom; uint16_t *lineptr; int pixadv, lineadv; // clear starfield background - lineptr = &bitmap.pix16(16, 64); + lineptr = &bitmap.pix(16, 64); lineadv = bitmap.rowpixels(); - for (i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } + for (int i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } // bail if not Side Arms or the starfield has been disabled if (m_gameid || !m_staron) return; @@ -240,16 +239,16 @@ void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) } else { - lineptr = &bitmap.pix16(255, 512 - 1); + lineptr = &bitmap.pix(255, 512 - 1); pixadv = -1; lineadv = -lineadv + 512; } - for (y=0; y<256; y++) // 8-bit V-clock input + for (int y=0; y<256; y++) // 8-bit V-clock input { - for (x=0; x<512; lineptr+=pixadv,x++) // 9-bit H-clock input + for (int x=0; x<512; lineptr+=pixadv,x++) // 9-bit H-clock input { - i = hadd_283; // store horizontal adder's previous state in i + int i = hadd_283; // store horizontal adder's previous state in i hadd_283 = _hcount_191 + (x & 0xff); // add lower 8 bits and preserve carry if (x<64 || x>447 || y<16 || y>239) continue; // clip rejection @@ -277,31 +276,31 @@ void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) #else // optimized loop if (!m_flipon) { - lineptr = &bitmap.pix16(16, 64); + lineptr = &bitmap.pix(16, 64); pixadv = 1; lineadv = lineadv - 384; } else { - lineptr = &bitmap.pix16(239, 512 - 64 - 1); + lineptr = &bitmap.pix(239, 512 - 64 - 1); pixadv = -1; lineadv = -lineadv + 384; } - for (y=16; y<240; y++) // 8-bit V-clock input (clipped against vertical visible area) + for (int y=16; y<240; y++) // 8-bit V-clock input (clipped against vertical visible area) { // inner loop pre-entry conditioning hadd_283 = (_hcount_191 + 64) & ~0x1f; vadd_283 = _vcount_191 + y; - i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) + int i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) i |= (_hflop_74a_n^(hadd_283>>8)) << 3; // to starfield EPROM A03 (1 bit) i |= hadd_283>>5 & 7; // to starfield EPROM A00-A02 (3 bits) m_latch_374 = sf_rom[i + 0x3000]; // lines A12-A13 are always high hadd_283 = _hcount_191 + 63; - for (x=64; x<448; lineptr+=pixadv,x++) // 9-bit H-clock input (clipped against horizontal visible area) + for (int x=64; x<448; lineptr+=pixadv,x++) // 9-bit H-clock input (clipped against horizontal visible area) { i = hadd_283; // store horizontal adder's previous state in i hadd_283 = _hcount_191 + (x & 0xff); // add lower 8 bits and preserve carry diff --git a/src/mame/video/sknsspr.cpp b/src/mame/video/sknsspr.cpp index 12e70d8536f..43e305321a7 100644 --- a/src/mame/video/sknsspr.cpp +++ b/src/mame/video/sknsspr.cpp @@ -158,7 +158,7 @@ void sknsspr_device::skns_sprite_kludge(int x, int y) #define z_draw_pixel() \ u8 val = src[xs >> 16]; \ if(val) \ - bitmap.pix16(yd>>16, xd>>16) = val + colour; + bitmap.pix(yd>>16, xd>>16) = val + colour; #define z_x_dst(op) \ old = xd; \ @@ -474,81 +474,72 @@ void sknsspr_device::skns_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl sx >>= 6; sy >>= 6; if (!xflip && !yflip) { - int xx,yy; - - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+xx < (cliprect.max_x+1)) && (sx+xx >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+yy < (cliprect.max_y+1)) && (sy+yy >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+yy, sx+xx) = pix+ NewColour; // change later + bitmap.pix(sy+yy, sx+xx) = pix+ NewColour; // change later } } } } } else if (!xflip && yflip) { - int xx,yy; sy -= ysize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+xx < (cliprect.max_x+1)) && (sx+xx >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+(ysize-1-yy) < (cliprect.max_y+1)) && (sy+(ysize-1-yy) >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+(ysize-1-yy), sx+xx) = pix+ NewColour; // change later + bitmap.pix(sy+(ysize-1-yy), sx+xx) = pix+ NewColour; // change later } } } } } else if (xflip && !yflip) { - int xx,yy; sx -= xsize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ( (sx+(xsize-1-xx) < (cliprect.max_x+1)) && (sx+(xsize-1-xx) >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+yy < (cliprect.max_y+1)) && (sy+yy >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+yy, sx+(xsize-1-xx)) = pix+ NewColour; // change later + bitmap.pix(sy+yy, sx+(xsize-1-xx)) = pix+ NewColour; // change later } } } } } else if (xflip && yflip) { - int xx,yy; sx -= xsize; sy -= ysize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+(xsize-1-xx) < (cliprect.max_x+1)) && (sx+(xsize-1-xx) >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+(ysize-1-yy) < (cliprect.max_y+1)) && (sy+(ysize-1-yy) >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+(ysize-1-yy), sx+(xsize-1-xx)) = pix+ NewColour; // change later + bitmap.pix(sy+(ysize-1-yy), sx+(xsize-1-xx)) = pix+ NewColour; // change later } } } diff --git a/src/mame/video/skullxbo.cpp b/src/mame/video/skullxbo.cpp index 757b920645b..0d1e5e926ba 100644 --- a/src/mame/video/skullxbo.cpp +++ b/src/mame/video/skullxbo.cpp @@ -243,8 +243,8 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -275,11 +275,11 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in +!CRAMD*LBMISC*(LBPIX!=0) */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - int mopix = mo[x] & 0x1f; - int pfcolor = (pf[x] >> 4) & 0x0f; - int pfpix = pf[x] & 0x0f; - int o17 = ((pf[x] & 0xc8) == 0xc8); + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopix = mo[x] & 0x1f; + int const pfcolor = (pf[x] >> 4) & 0x0f; + int const pfpix = pf[x] & 0x0f; + int const o17 = ((pf[x] & 0xc8) == 0xc8); /* implement the equations */ if ((mopriority == 0 && !o17 && mopix >= 2) || diff --git a/src/mame/video/skyfox.cpp b/src/mame/video/skyfox.cpp index 80a79461e0e..b16bd5bc831 100644 --- a/src/mame/video/skyfox.cpp +++ b/src/mame/video/skyfox.cpp @@ -220,7 +220,7 @@ void skyfox_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre but when strict compared on "1UP START" screen, it seems the blinking pattern in each star may be different. */ if (((m_bg_ctrl >> 4) & 3) != (pen & 3) || !blinking) - bitmap.pix16(y % 256, x % 512) = pen; + bitmap.pix(y % 256, x % 512) = pen; } } diff --git a/src/mame/video/skyraid.cpp b/src/mame/video/skyraid.cpp index 103b38cb0f0..7e15caa40e3 100644 --- a/src/mame/video/skyraid.cpp +++ b/src/mame/video/skyraid.cpp @@ -110,20 +110,17 @@ void skyraid_state::draw_missiles(bitmap_ind16 &bitmap, const rectangle &cliprec void skyraid_state::draw_trapezoid(bitmap_ind16& dst, bitmap_ind16& src) { - const uint8_t* p = memregion("user2")->base(); + uint8_t const *const p = memregion("user2")->base(); - int x; - int y; - - for (y = 0; y < dst.height(); y++) + for (int y = 0; y < dst.height(); y++) { - uint16_t* pSrc = &src.pix16(y); - uint16_t* pDst = &dst.pix16(y); + uint16_t const *const pSrc = &src.pix(y); + uint16_t *const pDst = &dst.pix(y); - int x1 = 0x000 + p[(y & ~1) + 0]; - int x2 = 0x100 + p[(y & ~1) + 1]; + int const x1 = 0x000 + p[(y & ~1) + 0]; + int const x2 = 0x100 + p[(y & ~1) + 1]; - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) pDst[x] = pSrc[128 * (x - x1) / (x2 - x1)]; } } diff --git a/src/mame/video/spacefb.cpp b/src/mame/video/spacefb.cpp index aee54f523b3..845fc6f2525 100644 --- a/src/mame/video/spacefb.cpp +++ b/src/mame/video/spacefb.cpp @@ -146,7 +146,6 @@ void spacefb_state::get_starfield_pens(pen_t *pens) void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; pen_t pens[NUM_STARFIELD_PENS]; get_starfield_pens(pens); @@ -154,21 +153,17 @@ void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, /* the shift register is always shifting -- do the portion in the top VBLANK */ if (cliprect.min_y == screen.visible_area().min_y) { - int i; - /* one cycle delay introduced by IC10 D flip-flop at the end of the VBLANK */ int clock_count = (SPACEFB_HBSTART - SPACEFB_HBEND) * SPACEFB_VBEND - 1; - for (i = 0; i < clock_count; i++) + for (int i = 0; i < clock_count; i++) shift_star_generator(); } /* visible region of the screen */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - int x; - - for (x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) + for (int x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) { if (m_object_present_map[(y * bitmap.width()) + x] == 0) { @@ -177,9 +172,9 @@ void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, ((m_star_shift_reg & 0x1c0ff) == 0x0c0d7) || ((m_star_shift_reg & 0x1c0ff) == 0x0c0bb) || ((m_star_shift_reg & 0x1c0ff) == 0x0c0db)) - bitmap.pix32(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; + bitmap.pix(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; else - bitmap.pix32(y, x) = pens[0]; + bitmap.pix(y, x) = pens[0]; } shift_star_generator(); @@ -254,20 +249,17 @@ void spacefb_state::get_sprite_pens(pen_t *pens) void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) { - uint8_t sy; - - uint8_t *gfx = memregion("gfx2")->base(); + uint8_t const *const gfx = memregion("gfx2")->base(); uint8_t code = m_videoram[offs + 0x0200] & 0x3f; uint8_t y = ~m_videoram[offs + 0x0100] - 2; - for (sy = 0; sy < 4; sy++) + for (uint8_t sy = 0; sy < 4; sy++) { - uint8_t sx, dy; - uint8_t data = gfx[(code << 2) | sy]; uint8_t x = m_videoram[offs + 0x0000]; + uint8_t dy; if (flip) dy = ~y; else @@ -275,53 +267,49 @@ void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, co if ((dy > cliprect.min_y) && (dy < cliprect.max_y)) { - for (sx = 0; sx < 4; sx++) + for (uint8_t sx = 0; sx < 4; sx++) { if (data & 0x01) { uint16_t dx; - if (flip) dx = (255 - x) * 2; else dx = x * 2; - bitmap.pix32(dy, dx + 0) = pen; - bitmap.pix32(dy, dx + 1) = pen; + bitmap.pix(dy, dx + 0) = pen; + bitmap.pix(dy, dx + 1) = pen; m_object_present_map[(dy * bitmap.width()) + dx + 0] = 1; m_object_present_map[(dy * bitmap.width()) + dx + 1] = 1; } - x = x + 1; - data = data >> 1; + x++; + data >>= 1; } } - y = y + 1; + y++; } } void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) { - uint8_t sy; - - uint8_t *gfx = memregion("gfx1")->base(); + uint8_t const *const gfx = memregion("gfx1")->base(); uint8_t code = ~m_videoram[offs + 0x0200]; uint8_t color_base = (~m_videoram[offs + 0x0300] & 0x0f) << 2; uint8_t y = ~m_videoram[offs + 0x0100] - 2; - for (sy = 0; sy < 8; sy++) + for (uint8_t sy = 0; sy < 8; sy++) { - uint8_t sx, dy; - uint8_t data1 = gfx[0x0000 | (code << 3) | (sy ^ 0x07)]; uint8_t data2 = gfx[0x0800 | (code << 3) | (sy ^ 0x07)]; uint8_t x = m_videoram[offs + 0x0000] - 3; + uint8_t dy; if (flip) dy = ~y; else @@ -329,33 +317,30 @@ void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, if ((dy > cliprect.min_y) && (dy < cliprect.max_y)) { - for (sx = 0; sx < 8; sx++) + for (uint8_t sx = 0; sx < 8; sx++) { uint16_t dx; - uint8_t data; - pen_t pen; - if (flip) dx = (255 - x) * 2; else dx = x * 2; - data = ((data1 << 1) & 0x02) | (data2 & 0x01); - pen = pens[color_base | data]; + uint8_t data = ((data1 << 1) & 0x02) | (data2 & 0x01); + pen_t pen = pens[color_base | data]; - bitmap.pix32(dy, dx + 0) = pen; - bitmap.pix32(dy, dx + 1) = pen; + bitmap.pix(dy, dx + 0) = pen; + bitmap.pix(dy, dx + 1) = pen; m_object_present_map[(dy * bitmap.width()) + dx + 0] = (data != 0); m_object_present_map[(dy * bitmap.width()) + dx + 1] = (data != 0); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } - y = y + 1; + y++; } } diff --git a/src/mame/video/special.cpp b/src/mame/video/special.cpp index da59ddee831..8e4e52c34f7 100644 --- a/src/mame/video/special.cpp +++ b/src/mame/video/special.cpp @@ -21,7 +21,7 @@ uint32_t special_state::screen_update_special(screen_device &screen, bitmap_ind1 { uint8_t const code = m_vram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = BIT(code, b); + bitmap.pix(y, x*8+(7-b)) = BIT(code, b); } } return 0; @@ -35,7 +35,7 @@ uint32_t special_state::screen_update_specialp(screen_device &screen, bitmap_ind { uint8_t const code = m_vram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = BIT(code, b); + bitmap.pix(y, x*8+(7-b)) = BIT(code, b); } } return 0; @@ -75,7 +75,7 @@ uint32_t special_state::screen_update_specimx(screen_device &screen, bitmap_ind1 uint8_t const code = m_ram->pointer()[0x9000 + y + x*256]; uint8_t const color = m_specimx_colorram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f; + bitmap.pix(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f; } } return 0; @@ -100,25 +100,21 @@ void special_state::erik_palette(palette_device &palette) const uint32_t special_state::screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1, code2, color1, color2; - int y, x, b; - uint8_t *erik_video_ram_p1, *erik_video_ram_p2; + uint8_t const *const erik_video_ram_p1 = m_ram->pointer() + 0x9000; + uint8_t const *const erik_video_ram_p2 = m_ram->pointer() + 0xd000; - erik_video_ram_p1 = m_ram->pointer() + 0x9000; - erik_video_ram_p2 = m_ram->pointer() + 0xd000; - - for (x = 0; x < 48; x++) + for (int x = 0; x < 48; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - code1 = erik_video_ram_p1[y + x*256]; - code2 = erik_video_ram_p2[y + x*256]; + uint8_t code1 = erik_video_ram_p1[y + x*256]; + uint8_t code2 = erik_video_ram_p2[y + x*256]; - for (b = 7; b >= 0; b--) + for (int b = 7; b >= 0; b--) { - color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; - color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; - bitmap.pix16(y, x*8+(7-b)) = color1 | color2; + uint8_t color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; + uint8_t color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; + bitmap.pix(y, x*8+(7-b)) = color1 | color2; } } } diff --git a/src/mame/video/spectrum.cpp b/src/mame/video/spectrum.cpp index e3a0226ee74..c3a594ce967 100644 --- a/src/mame/video/spectrum.cpp +++ b/src/mame/video/spectrum.cpp @@ -123,7 +123,7 @@ WRITE_LINE_MEMBER(spectrum_state::screen_vblank_spectrum) inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -235,7 +235,7 @@ void spectrum_state::spectrum_UpdateScreenBitmap(bool eof) { // this can/must be optimised if ((scrx & 7) == 0) { - uint16_t *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x); + uint16_t *bm = &m_screen_bitmap.pix(m_previous_screen_y, m_previous_screen_x); uint8_t attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800); uint8_t scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3)); uint16_t ink = (attr & 0x07) + ((attr >> 3) & 0x08); @@ -284,7 +284,7 @@ void spectrum_state::spectrum_UpdateBorderBitmap() do { - m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; + m_border_bitmap.pix(m_previous_border_y, m_previous_border_x) = border; m_previous_border_x += 1; diff --git a/src/mame/video/splash.cpp b/src/mame/video/splash.cpp index b2f3417cd00..fb8264a6780 100644 --- a/src/mame/video/splash.cpp +++ b/src/mame/video/splash.cpp @@ -151,7 +151,7 @@ void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) } if (sy >= cliprect.min_y && sy <= cliprect.max_y && sx-9 >= cliprect.min_x && sx-9 <= cliprect.max_x) - bitmap.pix16(sy, sx-9) = 0x300+(color^colxor); + bitmap.pix(sy, sx-9) = 0x300+(color^colxor); } } diff --git a/src/mame/video/sprint2.cpp b/src/mame/video/sprint2.cpp index 40b713ac18b..96e04846aa5 100644 --- a/src/mame/video/sprint2.cpp +++ b/src/mame/video/sprint2.cpp @@ -80,13 +80,10 @@ uint8_t sprint2_state::collision_check(rectangle& rect) { uint8_t data = 0; - int x; - int y; - - for (y = rect.top(); y <= rect.bottom(); y++) - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) { - uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)); + uint16_t const a = m_palette->pen_indirect(m_helper.pix(y, x)); if (a == 0) data |= 0x40; diff --git a/src/mame/video/sprint4.cpp b/src/mame/video/sprint4.cpp index 183a91fd058..b6a1ef1b74a 100644 --- a/src/mame/video/sprint4.cpp +++ b/src/mame/video/sprint4.cpp @@ -117,7 +117,7 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank) for (int y = rect.top(); y <= rect.bottom(); y++) for (int x = rect.left(); x <= rect.right(); x++) - if (m_palette->pen_indirect(m_helper.pix16(y, x)) != 0) + if (m_palette->pen_indirect(m_helper.pix(y, x)) != 0) m_collision[i] = 1; } diff --git a/src/mame/video/sprint8.cpp b/src/mame/video/sprint8.cpp index 7b3db9843fc..724d9f4f1ab 100644 --- a/src/mame/video/sprint8.cpp +++ b/src/mame/video/sprint8.cpp @@ -172,8 +172,8 @@ WRITE_LINE_MEMBER(sprint8_state::screen_vblank) for (int y = visarea.top(); y <= visarea.bottom(); y++) { - const uint16_t* p1 = &m_helper1.pix16(y); - const uint16_t* p2 = &m_helper2.pix16(y); + uint16_t const *const p1 = &m_helper1.pix(y); + uint16_t const *const p2 = &m_helper2.pix(y); for (int x = visarea.left(); x <= visarea.right(); x++) if (p1[x] != 0x20 && p2[x] == 0x23) diff --git a/src/mame/video/sspeedr.cpp b/src/mame/video/sspeedr.cpp index 63fa97d3d9c..95849c78231 100644 --- a/src/mame/video/sspeedr.cpp +++ b/src/mame/video/sspeedr.cpp @@ -126,11 +126,11 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) if (counter_x & 2) { - bitmap.pix16(y, x) = m_track[offset] / 16; + bitmap.pix(y, x) = m_track[offset] / 16; } else { - bitmap.pix16(y, x) = m_track[offset] % 16; + bitmap.pix(y, x) = m_track[offset] % 16; } } @@ -138,7 +138,7 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) for (; y < 128 + m_track_vert[1]; y++) { - bitmap.pix16(y, x) = flag ? 15 : 0; + bitmap.pix(y, x) = flag ? 15 : 0; } // lower landscape @@ -154,11 +154,11 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) if (counter_x & 2) { - bitmap.pix16(y, x) = m_track[offset] / 16; + bitmap.pix(y, x) = m_track[offset] / 16; } else { - bitmap.pix16(y, x) = m_track[offset] % 16; + bitmap.pix(y, x) = m_track[offset] % 16; } } } diff --git a/src/mame/video/ssv.cpp b/src/mame/video/ssv.cpp index 4b65573544c..47f9f031654 100644 --- a/src/mame/video/ssv.cpp +++ b/src/mame/video/ssv.cpp @@ -171,7 +171,7 @@ void ssv_state::drawgfx_line(bitmap_ind16 &bitmap, const rectangle &cliprect, in const uint8_t gfxbppmask = BPP_MASK_TABLE[gfx & 0x07].gfx_mask; const uint8_t gfxshift = BPP_MASK_TABLE[gfx & 0x07].gfx_shift; - uint16_t *dest = &bitmap.pix16(realline); + uint16_t *const dest = &bitmap.pix(realline); const int x0 = flipx ? (base_sx + gfxelement->width() - 1) : base_sx; const int x1 = flipx ? (base_sx - 1) : (x0 + gfxelement->width()); diff --git a/src/mame/video/stactics.cpp b/src/mame/video/stactics.cpp index ddeef5ff89e..fee32be9139 100644 --- a/src/mame/video/stactics.cpp +++ b/src/mame/video/stactics.cpp @@ -214,17 +214,14 @@ void stactics_state::update_beam() inline int stactics_state::get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint8_t x, uint8_t y_scroll) { - uint8_t code; - uint8_t gfx; - /* compute effective row */ y = y - y_scroll; /* get the character code at the given pixel */ - code = videoram[((y >> 3) << 5) | (x >> 3)]; + uint8_t code = videoram[((y >> 3) << 5) | (x >> 3)]; /* get the gfx byte */ - gfx = videoram[0x800 | (code << 3) | (y & 0x07)]; + uint8_t gfx = videoram[0x800 | (code << 3) | (y & 0x07)]; /* return the appropriate pixel within the byte */ return (gfx >> (~x & 0x07)) & 0x01; @@ -233,17 +230,13 @@ inline int stactics_state::get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - bitmap.fill(0, cliprect); /* for every row */ - for (y = 0; y < 0x100; y++) + for (int y = 0; y < 0x100; y++) { - int x; - /* for every pixel on the row */ - for (x = 0; x < 0x100; x++) + for (int x = 0; x < 0x100; x++) { /* get the pixels for the four planes */ int pixel_b = get_pixel_on_plane(m_videoram_b, y, x, 0); @@ -269,7 +262,7 @@ void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clip /* plot if visible */ if ((sy >= 0) && (sy < 0x100) && (sx >= 0) && (sx < 0x100)) - bitmap.pix16(sy, sx) = pen; + bitmap.pix(sy, sx) = pen; } } } diff --git a/src/mame/video/starcrus.cpp b/src/mame/video/starcrus.cpp index f3a9875741e..ca7122e3068 100644 --- a/src/mame/video/starcrus.cpp +++ b/src/mame/video/starcrus.cpp @@ -105,7 +105,7 @@ int starcrus_state::collision_check_s1s2() for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) /* Condition 1 - ship 1 = ship 2 */ - if ((m_ship1_vid->pix16(sy, sx) == 1) && (m_ship2_vid->pix16(sy, sx) == 1)) + if ((m_ship1_vid->pix(sy, sx) == 1) && (m_ship2_vid->pix(sy, sx) == 1)) return 1; return 0; @@ -158,7 +158,7 @@ int starcrus_state::collision_check_p1p2() for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) /* Condition 1 - proj 1 = proj 2 */ - if ((m_proj1_vid->pix16(sy, sx) == 1) && (m_proj2_vid->pix16(sy, sx) == 1)) + if ((m_proj1_vid->pix(sy, sx) == 1) && (m_proj2_vid->pix(sy, sx) == 1)) return 1; return 0; @@ -219,13 +219,13 @@ int starcrus_state::collision_check_s1p1p2() /* Now check for collisions */ for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) - if (m_ship1_vid->pix16(sy, sx) == 1) + if (m_ship1_vid->pix(sy, sx) == 1) { /* Condition 1 - ship 1 = proj 1 */ - if (m_proj1_vid->pix16(sy, sx) == 1) + if (m_proj1_vid->pix(sy, sx) == 1) return 1; /* Condition 2 - ship 1 = proj 2 */ - if (m_proj2_vid->pix16(sy, sx) == 1) + if (m_proj2_vid->pix(sy, sx) == 1) return 1; } @@ -286,13 +286,13 @@ int starcrus_state::collision_check_s2p1p2() /* Now check for collisions */ for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) - if (m_ship2_vid->pix16(sy, sx) == 1) + if (m_ship2_vid->pix(sy, sx) == 1) { /* Condition 1 - ship 2 = proj 1 */ - if (m_proj1_vid->pix16(sy, sx) == 1) + if (m_proj1_vid->pix(sy, sx) == 1) return 1; /* Condition 2 - ship 2 = proj 2 */ - if (m_proj2_vid->pix16(sy, sx) == 1) + if (m_proj2_vid->pix(sy, sx) == 1) return 1; } diff --git a/src/mame/video/starfield_05xx.cpp b/src/mame/video/starfield_05xx.cpp index 2fb46fd0b24..cdba1b1c7ba 100644 --- a/src/mame/video/starfield_05xx.cpp +++ b/src/mame/video/starfield_05xx.cpp @@ -642,7 +642,7 @@ void starfield_05xx_device::draw_starfield(bitmap_ind16 &bitmap, const rectangle color |= (m_lfsr<<2)&0x20; color = (~color)&0x3F; - bitmap.pix16(y, dx) = STARS_COLOR_BASE + color; + bitmap.pix(y, dx) = STARS_COLOR_BASE + color; } } } diff --git a/src/mame/video/starfire.cpp b/src/mame/video/starfire.cpp index 435a0daf108..b87e215dfd5 100644 --- a/src/mame/video/starfire.cpp +++ b/src/mame/video/starfire.cpp @@ -242,14 +242,14 @@ TIMER_CALLBACK_MEMBER(starfire_base_state::scanline_callback) int data = pix[0]; int color = col[0]; - m_screen_bitmap.pix32(y, x + 0) = pens[color | ((data >> 2) & 0x20)]; - m_screen_bitmap.pix32(y, x + 1) = pens[color | ((data >> 1) & 0x20)]; - m_screen_bitmap.pix32(y, x + 2) = pens[color | ((data >> 0) & 0x20)]; - m_screen_bitmap.pix32(y, x + 3) = pens[color | ((data << 1) & 0x20)]; - m_screen_bitmap.pix32(y, x + 4) = pens[color | ((data << 2) & 0x20)]; - m_screen_bitmap.pix32(y, x + 5) = pens[color | ((data << 3) & 0x20)]; - m_screen_bitmap.pix32(y, x + 6) = pens[color | ((data << 4) & 0x20)]; - m_screen_bitmap.pix32(y, x + 7) = pens[color | ((data << 5) & 0x20)]; + m_screen_bitmap.pix(y, x + 0) = pens[color | ((data >> 2) & 0x20)]; + m_screen_bitmap.pix(y, x + 1) = pens[color | ((data >> 1) & 0x20)]; + m_screen_bitmap.pix(y, x + 2) = pens[color | ((data >> 0) & 0x20)]; + m_screen_bitmap.pix(y, x + 3) = pens[color | ((data << 1) & 0x20)]; + m_screen_bitmap.pix(y, x + 4) = pens[color | ((data << 2) & 0x20)]; + m_screen_bitmap.pix(y, x + 5) = pens[color | ((data << 3) & 0x20)]; + m_screen_bitmap.pix(y, x + 6) = pens[color | ((data << 4) & 0x20)]; + m_screen_bitmap.pix(y, x + 7) = pens[color | ((data << 5) & 0x20)]; pix += 256; col += 256; diff --git a/src/mame/video/starshp1.cpp b/src/mame/video/starshp1.cpp index 4ea20f955cf..eb55d4c57cc 100644 --- a/src/mame/video/starshp1.cpp +++ b/src/mame/video/starshp1.cpp @@ -146,16 +146,13 @@ void starshp1_state::draw_starfield(bitmap_ind16 &bitmap) * really needed by the game. Not emulated. */ - int x; - int y; - - for (y = 0; y < bitmap.height(); y++) + for (int y = 0; y < bitmap.height(); y++) { - const uint16_t* p = m_LSFR.get() + (uint16_t) (512 * y); + uint16_t const *const p = m_LSFR.get() + (uint16_t) (512 * y); - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); - for (x = 0; x < bitmap.width(); x++) + for (int x = 0; x < bitmap.width(); x++) if ((p[x] & 0x5b56) == 0x5b44) pLine[x] = (p[x] & 0x0400) ? 0x0e : 0x0f; } @@ -217,15 +214,13 @@ void starshp1_state::draw_spaceship(bitmap_ind16 &bitmap, const rectangle &clipr void starshp1_state::draw_phasor(bitmap_ind16 &bitmap) { - int i; - - for (i = 128; i < 240; i++) + for (int i = 128; i < 240; i++) if (i >= get_sprite_vpos(13)) { - bitmap.pix16(i, 2 * i + 0) = 0x10; - bitmap.pix16(i, 2 * i + 1) = 0x10; - bitmap.pix16(i, 2 * (255 - i) + 0) = 0x10; - bitmap.pix16(i, 2 * (255 - i) + 1) = 0x10; + bitmap.pix(i, 2 * i + 0) = 0x10; + bitmap.pix(i, 2 * i + 1) = 0x10; + bitmap.pix(i, 2 * (255 - i) + 0) = 0x10; + bitmap.pix(i, 2 * (255 - i) + 1) = 0x10; } } @@ -248,9 +243,9 @@ void starshp1_state::draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l) { if (y >= 0 && y <= bitmap.height() - 1) { - const uint16_t* p = m_LSFR.get() + (uint16_t) (512 * y); + uint16_t const *const p = m_LSFR.get() + uint16_t(512 * y); - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int h1 = x - 2 * l; int h2 = x + 2 * l; @@ -305,7 +300,7 @@ int starshp1_state::spaceship_collision(bitmap_ind16 &bitmap, const rectangle &r { for (int y = rect.top(); y <= rect.bottom(); y++) { - const uint16_t* pLine = &m_helper.pix16(y); + uint16_t const *const pLine = &m_helper.pix(y); for (int x = rect.left(); x <= rect.right(); x++) if (pLine[x] != 0) diff --git a/src/mame/video/stfight_dev.cpp b/src/mame/video/stfight_dev.cpp index 40f2f590bd1..6757fd77d9b 100644 --- a/src/mame/video/stfight_dev.cpp +++ b/src/mame/video/stfight_dev.cpp @@ -285,8 +285,8 @@ void stfight_video_device::mix_txlayer(screen_device &screen, bitmap_ind16 &bitm { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &bitmap2.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &bitmap2.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (src[x] == -1) diff --git a/src/mame/video/stic.cpp b/src/mame/video/stic.cpp index c6e12e1e1a5..df3499999ce 100644 --- a/src/mame/video/stic.cpp +++ b/src/mame/video/stic.cpp @@ -516,21 +516,19 @@ const tiny_rom_entry *stic_device::device_rom_region() const void stic_device::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - int w, h; - // output scaling x *= m_x_scale; y *= m_y_scale; color = SET_COLOR(color); - for (h = 0; h < m_y_scale; h++) - for (w = 0; w < m_x_scale; w++) - bitmap.pix16(y + h, x + w) = color; + for (int h = 0; h < m_y_scale; h++) + for (int w = 0; w < m_x_scale; w++) + bitmap.pix(y + h, x + w) = color; } uint32_t stic_device::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y) { - return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale)); + return GET_COLOR(bitmap.pix(y * m_y_scale, x * m_x_scale)); } void stic_device::intv_plot_box(bitmap_ind16 &bitmap, int x, int y, int w, int h, int color) diff --git a/src/mame/video/super80.cpp b/src/mame/video/super80.cpp index ccd746c115b..1f19578ece7 100644 --- a/src/mame/video/super80.cpp +++ b/src/mame/video/super80.cpp @@ -85,7 +85,7 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF { @@ -141,7 +141,7 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -191,7 +191,7 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -245,7 +245,7 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -372,7 +372,7 @@ uint32_t super80v_state::screen_update_super80v(screen_device &screen, bitmap_rg MC6845_UPDATE_ROW( super80v_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) // for each character { diff --git a/src/mame/video/superqix.cpp b/src/mame/video/superqix.cpp index 99105c30c24..da863200d39 100644 --- a/src/mame/video/superqix.cpp +++ b/src/mame/video/superqix.cpp @@ -99,8 +99,8 @@ void superqix_state_base::superqix_bitmapram_w(offs_t offset, uint8_t data) m_bitmapram[offset] = data; - m_fg_bitmap[0]->pix16(y, x) = data >> 4; - m_fg_bitmap[0]->pix16(y, x + 1) = data & 0x0f; + m_fg_bitmap[0]->pix(y, x) = data >> 4; + m_fg_bitmap[0]->pix(y, x + 1) = data & 0x0f; } } @@ -113,8 +113,8 @@ void superqix_state_base::superqix_bitmapram2_w(offs_t offset, uint8_t data) m_bitmapram2[offset] = data; - m_fg_bitmap[1]->pix16(y, x) = data >> 4; - m_fg_bitmap[1]->pix16(y, x + 1) = data & 0x0f; + m_fg_bitmap[1]->pix(y, x) = data >> 4; + m_fg_bitmap[1]->pix(y, x + 1) = data & 0x0f; } } diff --git a/src/mame/video/suprloco.cpp b/src/mame/video/suprloco.cpp index 49b76042936..203fe9d38b0 100644 --- a/src/mame/video/suprloco.cpp +++ b/src/mame/video/suprloco.cpp @@ -155,7 +155,7 @@ inline void suprloco_state::draw_pixel(bitmap_ind16 &bitmap,const rectangle &cli } if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } diff --git a/src/mame/video/suprnova.cpp b/src/mame/video/suprnova.cpp index 802c622ab41..a38456e3f84 100644 --- a/src/mame/video/suprnova.cpp +++ b/src/mame/video/suprnova.cpp @@ -11,21 +11,12 @@ void skns_state::draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const rectangle &cliprect, tilemap_t *tmap, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, uint32_t* scrollram) { //bitmap_ind16 *destbitmap = bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - bitmap_ind8 &srcbitmapflags = tmap->flagsmap(); + const bitmap_ind16 &srcbitmap = tmap->pixmap(); + const bitmap_ind8 &srcbitmapflags = tmap->flagsmap(); const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; const int heightshifted = srcbitmap.height() << 16; - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; - uint16_t *dest; - uint8_t* destflags; // uint8_t *pri; //const uint16_t *src; //const uint8_t *maskptr; @@ -36,55 +27,53 @@ void skns_state::draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const starty += cliprect.min_x * incxy + cliprect.min_y * incyy; /* extract start/end points */ - sx = cliprect.min_x; - sy = cliprect.min_y; - ex = cliprect.max_x; - ey = cliprect.max_y; + int sx = cliprect.min_x; + int sy = cliprect.min_y; + int ex = cliprect.max_x; + int ey = cliprect.max_y; + /* loop over rows */ + while (sy <= ey) { - /* loop over rows */ - while (sy <= ey) - { - /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + /* initialize X counters */ + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; - /* get dest and priority pointers */ - dest = &bitmap.pix16(sy, sx); - destflags = &bitmapflags.pix8(sy, sx); + /* get dest and priority pointers */ + uint16_t *dest = &bitmap.pix(sy, sx); + uint8_t *destflags = &bitmapflags.pix(sy, sx); - /* loop over columns */ - while (x <= ex) + /* loop over columns */ + while (x <= ex) + { + if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. { - if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. + if (columnscroll) { - if (columnscroll) - { - dest[0] = srcbitmap.pix16(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); - destflags[0] = srcbitmapflags.pix8(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); - } - else - { - dest[0] = srcbitmap.pix16((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); - destflags[0] = srcbitmapflags.pix8((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); - } + dest[0] = srcbitmap.pix(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); + destflags[0] = srcbitmapflags.pix(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); + } + else + { + dest[0] = srcbitmap.pix((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); + destflags[0] = srcbitmapflags.pix((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); } - - /* advance in X */ - cx += incxx; - cy += incxy; - x++; - dest++; - destflags++; -// pri++; } - /* advance in Y */ - startx += incyx; - starty += incyy; - sy++; + /* advance in X */ + cx += incxx; + cy += incxy; + x++; + dest++; + destflags++; +// pri++; } + + /* advance in Y */ + startx += incyx; + starty += incyy; + sy++; } } @@ -467,12 +456,10 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, m_tilemap_bitmapflags_higher.fill(0); { - int supernova_pri_a; - int supernova_pri_b; int tran = 0; - supernova_pri_a = (m_v3_regs[0x10/4] & 0x0002)>>1; - supernova_pri_b = (m_v3_regs[0x34/4] & 0x0002)>>1; + int supernova_pri_a = (m_v3_regs[0x10/4] & 0x0002)>>1; + int supernova_pri_b = (m_v3_regs[0x34/4] & 0x0002)>>1; //popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b); @@ -481,39 +468,32 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, draw_a(m_tilemap_bitmap_higher,m_tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; { - int x,y; - uint8_t* srcflags, *src2flags; - uint16_t* src, *src2, *src3; - uint32_t* dst; - uint16_t pri, pri2, pri3; uint16_t bgpri; - const pen_t *clut = &m_palette->pen(0); + pen_t const *const clut = &m_palette->pen(0); // int drawpri; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - src = &m_tilemap_bitmap_lower.pix16(y); - srcflags = &m_tilemap_bitmapflags_lower.pix8(y); + uint16_t const *const src = &m_tilemap_bitmap_lower.pix(y); + uint8_t const *const srcflags = &m_tilemap_bitmapflags_lower.pix(y); - src2 = &m_tilemap_bitmap_higher.pix16(y); - src2flags = &m_tilemap_bitmapflags_higher.pix8(y); + uint16_t const *const src2 = &m_tilemap_bitmap_higher.pix(y); + uint8_t const *const src2flags = &m_tilemap_bitmapflags_higher.pix(y); - src3 = &m_sprite_bitmap.pix16(y); + uint16_t const *const src3 = &m_sprite_bitmap.pix(y); - dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { uint16_t pendata = src[x]&0x7fff; uint16_t pendata2 = src2[x]&0x7fff; uint16_t bgpendata; uint16_t pendata3 = m_alt_enable_sprites ? src3[x]&0x3fff : 0; - uint32_t coldat; - - pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); - pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); - pri3 = ((src3[x]&0xc000)>>12)+3; + uint16_t pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); + uint16_t pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); + uint16_t pri3 = ((src3[x]&0xc000)>>12)+3; // work out which layers bg pixel has the higher priority // note, can the bg layers be blended?? sarukani uses an alpha pen for @@ -560,6 +540,7 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, } // if the sprites are higher than the bg pixel + uint32_t coldat; if (pri3 > bgpri) { if (pendata3&0xff) diff --git a/src/mame/video/system1.cpp b/src/mame/video/system1.cpp index c02ccd4fa27..e13a2cb618c 100644 --- a/src/mame/video/system1.cpp +++ b/src/mame/video/system1.cpp @@ -419,7 +419,7 @@ void system1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* iterate over all rows of the sprite */ for (int y = top; y < bottom; y++) { - u16 *destbase = &bitmap.pix16(y); + u16 *const destbase = &bitmap.pix(y); /* advance by the row counter */ srcaddr += stride; @@ -515,16 +515,14 @@ void system1_state::video_update_common(screen_device &screen, bitmap_ind16 &bit /* iterate over rows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *fgbase = &fgpixmap.pix16(y & 0xff); - const u16 *sprbase = &m_sprite_bitmap.pix16(y & 0xff); - u16 *dstbase = &bitmap.pix16(y); + const u16 *const fgbase = &fgpixmap.pix(y & 0xff); + const u16 *const sprbase = &m_sprite_bitmap.pix(y & 0xff); + u16 *const dstbase = &bitmap.pix(y); const int bgy = (y + bgyscroll) & 0x1ff; const int bgxscroll = bgrowscroll[y >> 3 & 0x1f]; - const u16 *bgbase[2]; /* get the base of the left and right pixmaps for the effective background Y */ - bgbase[0] = &bgpixmaps[(bgy >> 8) * 2 + 0]->pix16(bgy & 0xff); - bgbase[1] = &bgpixmaps[(bgy >> 8) * 2 + 1]->pix16(bgy & 0xff); + const u16 *const bgbase[2] = { &bgpixmaps[(bgy >> 8) * 2 + 0]->pix(bgy & 0xff), &bgpixmaps[(bgy >> 8) * 2 + 1]->pix(bgy & 0xff) }; /* iterate over pixels */ for (int x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/taito_b.cpp b/src/mame/video/taito_b.cpp index f401f246a71..e5a6f90e5f4 100644 --- a/src/mame/video/taito_b.cpp +++ b/src/mame/video/taito_b.cpp @@ -13,8 +13,8 @@ void hitice_state::pixelram_w(offs_t offset, uint16_t data, uint16_t mem_mask) if (ACCESSING_BITS_0_7) { /* bit 15 of pixel_scroll[0] is probably flip screen */ - m_pixel_bitmap->pix16(sy, 2 * sx + 0) = m_b_fg_color_base * 16 + (data & 0xff); - m_pixel_bitmap->pix16(sy, 2 * sx + 1) = m_b_fg_color_base * 16 + (data & 0xff); + m_pixel_bitmap->pix(sy, 2 * sx + 0) = m_b_fg_color_base * 16 + (data & 0xff); + m_pixel_bitmap->pix(sy, 2 * sx + 1) = m_b_fg_color_base * 16 + (data & 0xff); } } @@ -106,9 +106,8 @@ uint32_t taitob_state::screen_update_taitob(screen_device &screen, bitmap_ind16 uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *palette = m_palette->pens(); + pen_t const *const palette = m_palette->pens(); uint8_t const video_control = m_tc0180vcu->get_videoctrl(); - int x, y; /* Video blanked? */ if (!(video_control & 0x20)) @@ -128,9 +127,9 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_tc0180vcu->draw_framebuffer(*m_realpunc_bitmap, cliprect, 0); /* Copy the intermediate bitmap to the output bitmap, applying the palette */ - for (y = 0; y <= cliprect.max_y; y++) - for (x = 0; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = palette[m_realpunc_bitmap->pix16(y, x)]; + for (int y = 0; y <= cliprect.max_y; y++) + for (int x = 0; x <= cliprect.max_x; x++) + bitmap.pix(y, x) = palette[m_realpunc_bitmap->pix(y, x)]; /* Draw the 15bpp raw CRTC frame buffer directly to the output bitmap */ if (m_realpunc_video_ctrl & 0x0002) @@ -140,29 +139,28 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_hd63484->update_screen(screen, *m_realpunc_bitmap, cliprect); - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) + for (int x = 0; x <= cliprect.max_x; x++) { - int r, g, b; - uint16_t srcpix = m_realpunc_bitmap->pix16(cliprect.min_y + y, cliprect.min_x + x); + uint16_t srcpix = m_realpunc_bitmap->pix(cliprect.min_y + y, cliprect.min_x + x); - r = (BIT(srcpix, 1)) | ((srcpix >> 11) & 0x1e); - g = (BIT(srcpix, 2)) | ((srcpix >> 7) & 0x1e); - b = (BIT(srcpix, 3)) | ((srcpix >> 3) & 0x1e); + int r = (BIT(srcpix, 1)) | ((srcpix >> 11) & 0x1e); + int g = (BIT(srcpix, 2)) | ((srcpix >> 7) & 0x1e); + int b = (BIT(srcpix, 3)) | ((srcpix >> 3) & 0x1e); if (srcpix) - bitmap.pix32(y, x) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(y, x) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); } } } /* Draw the 15bpp raw output of the camera ADCs (TODO) */ else if (m_realpunc_video_ctrl & 0x0004) { - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = rgb_t(0x00, 0x00, 0x00); + for (int x = 0; x <= cliprect.max_x; x++) + bitmap.pix(y, x) = rgb_t(0x00, 0x00, 0x00); } } @@ -175,12 +173,12 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_tc0180vcu->tilemap_draw(screen, *m_realpunc_bitmap, cliprect, 2, 0); /* Merge the indexed layers with the output bitmap */ - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) + for (int x = 0; x <= cliprect.max_x; x++) { - if (m_realpunc_bitmap->pix16(y, x)) - bitmap.pix32(y, x) = palette[m_realpunc_bitmap->pix16(y, x)]; + if (m_realpunc_bitmap->pix(y, x)) + bitmap.pix(y, x) = palette[m_realpunc_bitmap->pix(y, x)]; } } diff --git a/src/mame/video/taito_f2.cpp b/src/mame/video/taito_f2.cpp index 4ece4e7b83f..a9477c0d9c4 100644 --- a/src/mame/video/taito_f2.cpp +++ b/src/mame/video/taito_f2.cpp @@ -357,9 +357,9 @@ void taitof2_state::taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_i { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -419,9 +419,9 @@ void taitof2_state::taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_i { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/taito_f3.cpp b/src/mame/video/taito_f3.cpp index 73a5df2a6df..5318be6c6f9 100644 --- a/src/mame/video/taito_f3.cpp +++ b/src/mame/video/taito_f3.cpp @@ -1354,7 +1354,7 @@ inline void taito_f3_state::draw_scanlines( yadvp = -yadvp; } - u8 *dstp0 = &m_pri_alp_bitmap.pix8(ty, x); + u8 *dstp0 = &m_pri_alp_bitmap.pix(ty, x); m_pdest_2a = m_alpha_level_2ad ? 0x10 : 0; m_pdest_2b = m_alpha_level_2bd ? 0x20 : 0; @@ -1366,7 +1366,7 @@ inline void taito_f3_state::draw_scanlines( m_tr_3b =(m_alpha_level_3bs == 0 && m_alpha_level_3bd == 255) ? -1 : 1; { - u32 *dsti0 = &bitmap.pix32(ty, x); + u32 *dsti0 = &bitmap.pix(ty, x); while (1) { int cx = 0; @@ -1909,11 +1909,11 @@ void taito_f3_state::get_line_ram_info(tilemap_t *tmap, int sx, int sy, int pos, /* set pixmap index */ line_t->x_count[y]=x_index_fx & 0xffff; // Fractional part - line_t->src_s[y] = src_s = &srcbitmap.pix16(y_index); + line_t->src_s[y] = src_s = &srcbitmap.pix(y_index); line_t->src_e[y] = &src_s[m_width_mask + 1]; line_t->src[y] = &src_s[x_index_fx >> 16]; - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap.pix8(y_index); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap.pix(y_index); line_t->tsrc[y] = &tsrc_s[x_index_fx >> 16]; } @@ -2022,16 +2022,16 @@ void taito_f3_state::get_vram_info(tilemap_t *vram_tilemap, tilemap_t *pixel_til /* set pixmap index */ line_t->x_count[y] = 0xffff; if (usePixelLayer) - line_t->src_s[y] = src_s = &srcbitmap_pixel.pix16(sy & 0xff); + line_t->src_s[y] = src_s = &srcbitmap_pixel.pix(sy & 0xff); else - line_t->src_s[y] = src_s = &srcbitmap_vram.pix16(sy & 0x1ff); + line_t->src_s[y] = src_s = &srcbitmap_vram.pix(sy & 0x1ff); line_t->src_e[y] = &src_s[vram_width_mask + 1]; line_t->src[y] = &src_s[sx]; if (usePixelLayer) - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_pixel.pix8(sy & 0xff); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_pixel.pix(sy & 0xff); else - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_vram.pix8(sy & 0x1ff); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_vram.pix(sy & 0x1ff); line_t->tsrc[y] = &tsrc_s[sx]; } @@ -2537,8 +2537,8 @@ inline void taito_f3_state::f3_drawgfx(bitmap_rgb32 &dest_bmp, const rectangle & int y = ey - sy; const int x = (ex - sx - 1) | (m_tile_opaque_sp[code % gfx->elements()] << 4); const u8 *source0 = code_base + y_index * 16 + x_index_base; - u32 *dest0 = &dest_bmp.pix32(sy, sx); - u8 *pri0 = &m_pri_alp_bitmap.pix8(sy, sx); + u32 *dest0 = &dest_bmp.pix(sy, sx); + u8 *pri0 = &m_pri_alp_bitmap.pix(sy, sx); const int yadv = dest_bmp.rowpixels(); const int yadvp = m_pri_alp_bitmap.rowpixels(); dy = dy * 16; @@ -2686,8 +2686,8 @@ inline void taito_f3_state::f3_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectang for (int y = sy; y < ey; y++) { const u8 *source = code_base + (y_index >> 16) * 16; - u32 *dest = &dest_bmp.pix32(y); - u8 *pri = &m_pri_alp_bitmap.pix8(y); + u32 *dest = &dest_bmp.pix(y); + u8 *pri = &m_pri_alp_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/taito_helper.cpp b/src/mame/video/taito_helper.cpp index 58c2b3a666c..6785ce576be 100644 --- a/src/mame/video/taito_helper.cpp +++ b/src/mame/video/taito_helper.cpp @@ -9,8 +9,8 @@ void taitoic_drawscanline( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask) { - u16 *dsti = &bitmap.pix16(y, x); - u8 *dstp = &priority.pix8(y, x); + u16 *dsti = &bitmap.pix(y, x); + u8 *dstp = &priority.pix(y, x); int length = cliprect.width(); src += cliprect.min_x; diff --git a/src/mame/video/taitoair.cpp b/src/mame/video/taitoair.cpp index 3449b002491..f4953002e38 100644 --- a/src/mame/video/taitoair.cpp +++ b/src/mame/video/taitoair.cpp @@ -172,7 +172,7 @@ void taitoair_state::fill_slope(bitmap_ind16 &bitmap, const rectangle &cliprect, while (xx1 <= xx2) { - bitmap.pix16(y1, xx1) = base_color + grad_col; + bitmap.pix(y1, xx1) = base_color + grad_col; xx1++; } } diff --git a/src/mame/video/taitojc.cpp b/src/mame/video/taitojc.cpp index 382d5cfe2bf..529d0773e87 100644 --- a/src/mame/video/taitojc.cpp +++ b/src/mame/video/taitojc.cpp @@ -123,7 +123,6 @@ void taitojc_state::taitojc_char_w(offs_t offset, uint32_t data, uint32_t mem_ma void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t w1, uint32_t w2, uint8_t bank_type) { int x, y, width, height, palette; - int i, j; int x1, x2, y1, y2; int ix, iy; uint32_t address; @@ -212,11 +211,11 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, return; } - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); - for (i=x1; i < x2; i++) + for (int i=x1; i < x2; i++) { d[i] = 0x78; //TODO: black @@ -228,12 +227,12 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, } else if(!color_depth) // Densha de Go 2/2X "credit text", 4bpp { - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); int index = (iy * (width / 2)) + ix; - for (i=x1; i < x2; i+=2) + for (int i=x1; i < x2; i+=2) { uint8_t pen = (v[BYTE4_XOR_BE(index)] & 0xf0) >> 4; if (pen != 0) @@ -252,12 +251,12 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, else // 8bpp { { - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); int index = (iy * width) + ix; - for (i=x1; i < x2; i++) + for (int i=x1; i < x2; i++) { uint8_t pen = v[BYTE4_XOR_BE(index)]; if (pen != 0) diff --git a/src/mame/video/taitosj.cpp b/src/mame/video/taitosj.cpp index dd453d64d44..2987d159824 100644 --- a/src/mame/video/taitosj.cpp +++ b/src/mame/video/taitosj.cpp @@ -269,7 +269,7 @@ inline gfx_element * taitosj_state::get_sprite_gfx_element(uint8_t which) int taitosj_state::check_sprite_sprite_bitpattern(int sx1, int sy1, int which1,int sx2, int sy2, int which2) { - int x, y, minx, miny, maxx = 16, maxy = 16; + int minx, miny, maxx = 16, maxy = 16; offs_t offs1 = which1 * 4; offs_t offs2 = which2 * 4; @@ -318,10 +318,10 @@ int taitosj_state::check_sprite_sprite_bitpattern(int sx1, int sy1, int which1,i m_spriteram[SPRITE_RAM_PAGE_OFFSET + offs2 + 2] & 0x02, sx2, sy2, 0); - for (y = miny; y < maxy; y++) - for (x = minx; x < maxx; x++) - if ((m_sprite_sprite_collbitmap1.pix16(y, x) != TRANSPARENT_PEN) && - (m_sprite_sprite_collbitmap2.pix16(y, x) != TRANSPARENT_PEN)) + for (int y = miny; y < maxy; y++) + for (int x = minx; x < maxx; x++) + if ((m_sprite_sprite_collbitmap1.pix(y, x) != TRANSPARENT_PEN) && + (m_sprite_sprite_collbitmap2.pix(y, x) != TRANSPARENT_PEN)) return 1; /* collided */ return 0; @@ -439,7 +439,6 @@ void taitosj_state::calculate_sprite_areas(int *sprites_on, rectangle *sprite_ar int taitosj_state::check_sprite_layer_bitpattern(int which, rectangle *sprite_areas) { - int y, x; offs_t offs = which * 4; int result = 0; /* no collisions */ @@ -463,17 +462,17 @@ int taitosj_state::check_sprite_layer_bitpattern(int which, rectangle *sprite_ar flip_x, flip_y, 0,0,0); - for (y = miny; y < maxy; y++) - for (x = minx; x < maxx; x++) - if (m_sprite_layer_collbitmap1.pix16(y - miny, x - minx) != TRANSPARENT_PEN) /* is there anything to check for ? */ + for (int y = miny; y < maxy; y++) + for (int x = minx; x < maxx; x++) + if (m_sprite_layer_collbitmap1.pix(y - miny, x - minx) != TRANSPARENT_PEN) /* is there anything to check for ? */ { - if (check_layer_1 && (m_sprite_layer_collbitmap2[0].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_1 && (m_sprite_layer_collbitmap2[0].pix(y, x) != TRANSPARENT_PEN)) result |= 0x01; /* collided with layer 1 */ - if (check_layer_2 && (m_sprite_layer_collbitmap2[1].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_2 && (m_sprite_layer_collbitmap2[1].pix(y, x) != TRANSPARENT_PEN)) result |= 0x02; /* collided with layer 2 */ - if (check_layer_3 && (m_sprite_layer_collbitmap2[2].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_3 && (m_sprite_layer_collbitmap2[2].pix(y, x) != TRANSPARENT_PEN)) result |= 0x04; /* collided with layer 3 */ } @@ -485,10 +484,8 @@ void taitosj_state::check_sprite_layer_collision(int *sprites_on, rectangle *spr { if (SPRITES_ON) { - int which; - /* check each sprite */ - for (which = 0; which < 0x20; which++) + for (int which = 0; which < 0x20; which++) { if ((which >= 0x10) && (which <= 0x17)) continue; /* no sprites here */ diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp index 1f1aae3220d..2d77a22b2ff 100644 --- a/src/mame/video/tank8.cpp +++ b/src/mame/video/tank8.cpp @@ -195,8 +195,6 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) // on falling edge if (!state) { - int x; - int y; const rectangle &visarea = m_screen->visible_area(); m_tilemap->draw(*m_screen, m_helper1, visarea, 0, 0); @@ -207,21 +205,19 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) draw_sprites(m_helper2, visarea); draw_bullets(m_helper3, visarea); - for (y = visarea.top(); y <= visarea.bottom(); y++) + for (int y = visarea.top(); y <= visarea.bottom(); y++) { int _state = 0; - const uint16_t* p1 = &m_helper1.pix16(y); - const uint16_t* p2 = &m_helper2.pix16(y); - const uint16_t* p3 = &m_helper3.pix16(y); + uint16_t const *const p1 = &m_helper1.pix(y); + uint16_t const *const p2 = &m_helper2.pix(y); + uint16_t const *const p3 = &m_helper3.pix(y); if ((m_screen->frame_number() ^ y) & 1) continue; /* video display is interlaced */ - for (x = visarea.left(); x <= visarea.right(); x++) + for (int x = visarea.left(); x <= visarea.right(); x++) { - uint8_t index; - /* neither wall nor mine */ if ((p1[x] != 0x11) && (p1[x] != 0x13)) { @@ -246,6 +242,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) if (_state) continue; + uint8_t index; if (p3[x] != 8) { index = ((p3[x] & ~0x01) >> 1) | 0x18; diff --git a/src/mame/video/tatsumi.cpp b/src/mame/video/tatsumi.cpp index 6114e9cc8be..cf9c9272170 100644 --- a/src/mame/video/tatsumi.cpp +++ b/src/mame/video/tatsumi.cpp @@ -63,14 +63,14 @@ void tatsumi_state::apply_shadow_bitmap(bitmap_rgb32 &bitmap, const rectangle &c { for(int x=cliprect.min_x;x<cliprect.max_x;x++) { - uint8_t shadow = shadow_bitmap.pix8(y, x); + uint8_t shadow = shadow_bitmap.pix(y, x); // xor_output is enabled during Chen boss fight (where shadows have more brightness than everything else) // TODO: transition before fighting him should also black out all the background tilemaps too!? // (more evidence that we need to mix with color bank 0x1400 instead of doing true RGB mixing). if(shadow ^ xor_output) { - rgb_t shadow_pen = bitmap.pix32(y, x); - bitmap.pix32(y, x) = rgb_t(shadow_pen.r() >> 1,shadow_pen.g() >> 1, shadow_pen.b() >> 1); + rgb_t shadow_pen = bitmap.pix(y, x); + bitmap.pix(y, x) = rgb_t(shadow_pen.r() >> 1,shadow_pen.g() >> 1, shadow_pen.b() >> 1); } } } @@ -96,8 +96,6 @@ inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, co gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy, int scalex, int scaley, int rotate, int write_priority_only ) { - rectangle myclip; - if (!scalex || !scaley) return; /* @@ -108,215 +106,194 @@ inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, co */ /* KW 991012 -- Added code to force clip to bitmap boundary */ - myclip = clip; + rectangle myclip = clip; myclip &= dest_bmp.cliprect(); + if( gfx ) { - if( gfx ) + const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); + const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors())); + const uint8_t *code_base = gfx->get_data(code % gfx->elements()); + + int block_size = 8 * scalex; + int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; + int sprite_screen_width = ((ssx&0xffff)+block_size)>>16; + + if (sprite_screen_width && sprite_screen_height) { - const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); - const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors())); - const uint8_t *code_base = gfx->get_data(code % gfx->elements()); + /* compute sprite increment per screen pixel */ + int dx = (gfx->width()<<16)/sprite_screen_width; + int dy = (gfx->height()<<16)/sprite_screen_height; + + int sx;//=ssx>>16; + int sy;//=ssy>>16; - int block_size = 8 * scalex; - int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; - int sprite_screen_width = ((ssx&0xffff)+block_size)>>16; - if (sprite_screen_width && sprite_screen_height) +// int ex = sx+sprite_screen_width; +// int ey = sy+sprite_screen_height; + + int incxx=0x10000;//(int)((float)dx * cos(theta)); +// int incxy=0x0;//(int)((float)dy * -sin(theta)); + int incyx=0x0;//(int)((float)dx * sin(theta)); +// int incyy=0x10000;//(int)((float)dy * cos(theta)); + + if (flipx) { - /* compute sprite increment per screen pixel */ - int dx = (gfx->width()<<16)/sprite_screen_width; - int dy = (gfx->height()<<16)/sprite_screen_height; + } - int sx;//=ssx>>16; - int sy;//=ssy>>16; + if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16; + if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16; + int ex = sx+sprite_screen_width; + int ey = sy+sprite_screen_height; + int x_index_base; + if( flipx ) + { + x_index_base = (sprite_screen_width-1)*dx; + dx = -dx; + incxx=-incxx; + incyx=-incyx; + } + else + { + x_index_base = 0; + } -// int ex = sx+sprite_screen_width; -// int ey = sy+sprite_screen_height; + int y_index; + if( flipy ) + { + y_index = (sprite_screen_height-1)*dy; + dy = -dy; + } + else + { + y_index = 0; + } - int x_index_base; - int y_index; - int ex,ey; + if( sx < myclip.min_x) + { /* clip left */ + int pixels = myclip.min_x-sx; + sx += pixels; + x_index_base += pixels*dx; + } + if( sy < myclip.min_y ) + { /* clip top */ + int pixels = myclip.min_y-sy; + sy += pixels; + y_index += pixels*dy; + } + /* NS 980211 - fixed incorrect clipping */ + if( ex > myclip.max_x+1 ) + { /* clip right */ + int pixels = ex-myclip.max_x-1; + ex -= pixels; + } + if( ey > myclip.max_y+1 ) + { /* clip bottom */ + int pixels = ey-myclip.max_y-1; + ey -= pixels; + } - int incxx=0x10000;//(int)((float)dx * cos(theta)); -// int incxy=0x0;//(int)((float)dy * -sin(theta)); - int incyx=0x0;//(int)((float)dx * sin(theta)); -// int incyy=0x10000;//(int)((float)dy * cos(theta)); + if( ex>sx ) + { /* skip if inner loop doesn't draw anything */ +#if 0 + int startx=0; + int starty=0; - if (flipx) - { - } +// int incxx=0x10000; +// int incxy=0; +// int incyx=0; +// int incyy=0x10000; + double theta=rotate * ((2.0 * M_PI)/512.0); + double c=cos(theta); + double s=sin(theta); - if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16; - if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16; - ex = sx+sprite_screen_width; - ey = sy+sprite_screen_height; - if( flipx ) - { - x_index_base = (sprite_screen_width-1)*dx; - dx = -dx; - incxx=-incxx; - incyx=-incyx; - } - else + // if (ey-sy > 0) + // dy=dy / (ey-sy); { - x_index_base = 0; - } + float angleAsRadians=(float)rotate * (7.28f / 512.0f); + //float ccx = cosf(angleAsRadians); + //float ccy = sinf(angleAsRadians); + float a=0; - if( flipy ) - { - y_index = (sprite_screen_height-1)*dy; - dy = -dy; - } - else - { - y_index = 0; } - if( sx < myclip.min_x) - { /* clip left */ - int pixels = myclip.min_x-sx; - sx += pixels; - x_index_base += pixels*dx; - } - if( sy < myclip.min_y ) - { /* clip top */ - int pixels = myclip.min_y-sy; - sy += pixels; - y_index += pixels*dy; - } - /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) - { /* clip right */ - int pixels = ex-myclip.max_x-1; - ex -= pixels; - } - if( ey > myclip.max_y+1 ) - { /* clip bottom */ - int pixels = ey-myclip.max_y-1; - ey -= pixels; - } + for( int y=sy; y<ey; y++ ) + { + uint32_t *const dest = &dest_bmp.pix(y); + int cx = startx; + int cy = starty; - if( ex>sx ) - { /* skip if inner loop doesn't draw anything */ - int y; -#if 0 + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { + const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes(); + int c = source[(cx >> 16)]; + if( c != transparent_color ) { - int startx=0; - int starty=0; - -// int incxx=0x10000; -// int incxy=0; -// int incyx=0; -// int incyy=0x10000; - double theta=rotate * ((2.0 * M_PI)/512.0); - double c=cos(theta); - double s=sin(theta); - - - // if (ey-sy > 0) - // dy=dy / (ey-sy); - { - float angleAsRadians=(float)rotate * (7.28f / 512.0f); - //float ccx = cosf(angleAsRadians); - //float ccy = sinf(angleAsRadians); - float a=0; - - } - - for( y=sy; y<ey; y++ ) - { - uint32_t *dest = &dest_bmp.pix32(y); - int cx = startx; - int cy = starty; - - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) - { - const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes(); - int c = source[(cx >> 16)]; - if( c != transparent_color ) - { - if (write_priority_only) - dest[x]=shadow_pens[c]; - else - dest[x]=pal[c]; - } - cx += incxx; - cy += incxy; - } - startx += incyx; - starty += incyy; - } + if (write_priority_only) + dest[x]=shadow_pens[c]; + else + dest[x]=pal[c]; } + cx += incxx; + cy += incxy; } + startx += incyx; + starty += incyy; + } #endif #if 1 // old + for( int y=sy; y<ey; y++ ) + { + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + typename BitmapClass::pixel_t *const dest = &dest_bmp.pix(y); + + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { + int c = source[x_index>>16]; + if( c ) { - for( y=sy; y<ey; y++ ) - { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - typename BitmapClass::pixel_t *dest = &dest_bmp.pix(y); - - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) - { - int c = source[x_index>>16]; - if( c ) - { - // Only draw shadow pens if writing priority buffer - if (write_priority_only) - dest[x]=shadow_pens[c]; - else if (!shadow_pens[c]) - dest[x]=pal[c]; - } - x_index += dx; - } - - y_index += dy; - } + // Only draw shadow pens if writing priority buffer + if (write_priority_only) + dest[x]=shadow_pens[c]; + else if (!shadow_pens[c]) + dest[x]=pal[c]; } + x_index += dx; } -#endif + + y_index += dy; } +#endif } } } } -static void mycopyrozbitmap_core(bitmap_ind8 &bitmap,bitmap_rgb32 &srcbitmap, +static void mycopyrozbitmap_core(bitmap_ind8 &bitmap, const bitmap_rgb32 &srcbitmap, int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy, const rectangle &clip, int transparent_color) { } -static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, +static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap, const bitmap_rgb32 &srcbitmap, int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy, const rectangle &clip, int transparent_color) { - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; // const int xmask = srcbitmap.width()-1; // const int ymask = srcbitmap.height()-1; const int widthshifted = srcwidth << 16; const int heightshifted = srcheight << 16; - uint32_t *dest; uint32_t startx=0; uint32_t starty=0; - sx = dstx; - sy = dsty; - ex = dstx + srcwidth; - ey = dsty + srcheight; + int sx = dstx; + int sy = dsty; + int ex = dstx + srcwidth; + int ey = dsty + srcheight; if (sx<clip.min_x) sx=clip.min_x; if (ex>clip.max_x) ex=clip.max_x; @@ -327,16 +304,16 @@ static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, { while (sy <= ey) { - x = sx; - cx = startx; - cy = starty; - dest = &bitmap.pix32(sy, sx); + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; + uint32_t *dest = &bitmap.pix(sy, sx); while (x <= ex) { if (cx < widthshifted && cy < heightshifted) { - int c = srcbitmap.pix32(cy >> 16, cx >> 16); + int c = srcbitmap.pix(cy >> 16, cx >> 16); if (c != transparent_color) *dest = c; @@ -357,17 +334,8 @@ static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, template<class BitmapClass> void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank) { - int offs, flip_x, flip_y, x, y, color; - int w, h, index, lines, scale, rotate; - uint8_t *src1, *src2; - - int y_offset; - - int render_x, render_y; - int extent_x, extent_y; - // Sprite data is double buffered - for (offs = rambank;offs < rambank + 0x800;offs += 6) + for (int offs = rambank;offs < rambank + 0x800;offs += 6) { /* Sprite RAM itself uses an index into two ROM tables to actually draw the object. @@ -401,15 +369,15 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, Bytes 2/3: Tile index to start fetching tiles from (increments per tile). */ - y = m_spriteram[offs+3]; - x = m_spriteram[offs+2]; - scale = m_spriteram[offs+4] & 0x1ff; - color = m_spriteram[offs+1] >> 3 & 0x1ff; - flip_x = m_spriteram[offs+1] & 0x8000; - flip_y = m_spriteram[offs+1] & 0x4000; - rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now + int y = m_spriteram[offs+3]; + int x = m_spriteram[offs+2]; + int scale = m_spriteram[offs+4] & 0x1ff; + int color = m_spriteram[offs+1] >> 3 & 0x1ff; + int flip_x = m_spriteram[offs+1] & 0x8000; + int flip_y = m_spriteram[offs+1] & 0x4000; + int rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now - index = m_spriteram[offs]; + int index = m_spriteram[offs]; // if (m_spriteram[offs+1]&0x7) // color=machine().rand()%0xff; @@ -421,16 +389,16 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, if (index >= 0x4000) continue; - src1 = m_rom_sprite_lookup[0] + (index * 4); - src2 = m_rom_sprite_lookup[1] + (index * 4); + uint8_t const *src1 = m_rom_sprite_lookup[0] + (index * 4); + uint8_t const *src2 = m_rom_sprite_lookup[1] + (index * 4); - lines = src1[2]; - y_offset = src1[0]&0xf8; + int lines = src1[2]; + int y_offset = src1[0]&0xf8; lines -= y_offset; - render_x = x << 16; - render_y = y << 16; + int render_x = x << 16; + int render_y = y << 16; scale = scale << 9; /* 0x80 becomes 0x10000 */ if (flip_y) @@ -444,10 +412,10 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, m_temp_bitmap.fill(0); } - extent_x = extent_y = 0; + int extent_x = 0, extent_y = 0; src1 += 4; - h = 0; + int h = 0; while (lines > 0) { int base, x_offs, x_width, x_pos, draw_this_line = 1; @@ -478,7 +446,7 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, else x_pos = x_offs; - for (w = 0; w < x_width; w++) { + for (int w = 0; w < x_width; w++) { if (rotate) roundupt_drawgfxzoomrotate( m_temp_bitmap,cliprect,m_gfxdecode->gfx(0), @@ -550,10 +518,9 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, void tatsumi_state::update_cluts(int fake_palette_offset, int object_base, int length) { - int i; const uint8_t* bank1 = m_rom_clut[0]; const uint8_t* bank2 = m_rom_clut[1]; - for (i=0; i<length; i+=8) + for (int i=0; i<length; i+=8) { m_palette->set_pen_color(fake_palette_offset+i+0,m_palette->pen_color(bank1[1]+object_base)); m_shadow_pen_array[i+0]=(bank1[1]==255); @@ -598,22 +565,20 @@ void apache3_state::apache3_road_x_w(offs_t offset, uint8_t data) void apache3_state::draw_sky(bitmap_rgb32 &bitmap,const rectangle &cliprect, int palette_base, int start_offset) { - // all todo - int x,y; - + // all TODO if (start_offset&0x8000) start_offset=-(0x10000 - start_offset); start_offset=-start_offset; start_offset-=48; - for (y=0; y<256; y++) { - for (x=0; x<320; x++) { + for (int y=0; y<256; y++) { + for (int x=0; x<320; x++) { int col=palette_base + y + start_offset; if (col<palette_base) col=palette_base; if (col>palette_base+127) col=palette_base+127; - bitmap.pix32(y, x) = m_palette->pen(col); + bitmap.pix(y, x) = m_palette->pen(col); } } } @@ -623,12 +588,10 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) { if (0) { - int x, y; - uint16_t gva = 0x180; // TODO uint8_t sky_val = m_apache3_rotate_ctrl[1] & 0xff; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint16_t rgdb = 0;//m_apache3_road_x_ram[gva & 0xff]; uint16_t gha = 0xf60; // test @@ -637,9 +600,9 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) if (gva & 0x100) { /* Sky */ - for (x = cliprect.min_x; x <= cliprect.max_x; ++x) + for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - dst.pix32(y, x) = m_palette->pen(0x100 + (sky_val & 0x7f)); + dst.pix(y, x) = m_palette->pen(0x100 + (sky_val & 0x7f)); /* Update horizontal counter? */ gha = (gha + 1) & 0xfff; @@ -648,28 +611,23 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) else { /* Ground */ - for (x = cliprect.min_x; x <= cliprect.max_x; ++x) + for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - uint8_t colour; - uint16_t hval; - uint8_t pixels; - int pix_sel; - - hval = (rgdb + gha) & 0xfff; // Not quite + uint16_t hval = (rgdb + gha) & 0xfff; // Not quite if (hval & 0x800) hval ^= 0x1ff; // TEST //else //hval = hval; - pixels = m_apache3_g_ram[(((gva & 0xff) << 7) | ((hval >> 2) & 0x7f))]; - pix_sel = hval & 3; + uint8_t pixels = m_apache3_g_ram[(((gva & 0xff) << 7) | ((hval >> 2) & 0x7f))]; + int pix_sel = hval & 3; - colour = (pixels >> (pix_sel << 1)) & 3; + uint8_t colour = (pixels >> (pix_sel << 1)) & 3; colour = (BIT(hval, 11) << 4) | (colour << 2) | ln; /* Draw the pixel */ - dst.pix32(y, x) = m_palette->pen(0x200 + colour); + dst.pix(y, x) = m_palette->pen(0x200 + colour); /* Update horizontal counter */ gha = (gha + 1) & 0xfff; @@ -823,8 +781,6 @@ pos is 11.5 fixed point 0x80 */ - int y,x; - int visible_line=0; const uint16_t *data = m_road_ctrl_ram; // Road layer enable (?) @@ -836,12 +792,12 @@ pos is 11.5 fixed point data+=0x400; // Apply clipping: global screen + local road y offsets - y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); + int y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); data+=y*4; - visible_line=0; + int visible_line=0; - for (/*y=0*/; y<cliprect.max_y+1; y++) + for ( ; y<cliprect.max_y+1; y++) { // TODO: tunnels road drawing has a different format? // shift is always 0x88** while data[3] is a variable argument with bit 15 always on @@ -850,7 +806,7 @@ pos is 11.5 fixed point int pal = 4; //(data[3]>>8)&0xf; int step=((data[1]&0xff)<<8)|((data[1]&0xff00)>>8); int samplePos=0; - const uint16_t* linedata=m_road_pixel_ram;// + (0x100 * pal); + uint16_t const *const linedata=m_road_pixel_ram;// + (0x100 * pal); int startPos=0, endPos=0; int palette_byte;//=m_road_color_ram[visible_line/8]; @@ -890,11 +846,13 @@ offset is from last pixel of first road segment? if (step) startPos=((shift<<8) + 0x80 )/ step; + int x; + /* Fill in left of road segment */ for (x=0; (x < startPos) && (x < cliprect.max_x+1); x++) { int col = linedata[0]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col); } /* If startpos is negative, clip it and adjust the sampling position accordingly */ @@ -918,7 +876,7 @@ offset is from last pixel of first road segment? //if ((samplePos>>11) > 0x7f) // col=linedata[0x7f]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col); samplePos+=step; } @@ -946,7 +904,7 @@ offset is from last pixel of first road segment? //if ((samplePos>>11) > 0x7f) // col=linedata[0x7f]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col + 32); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col + 32); } if (endPos<0) @@ -974,7 +932,7 @@ offset is from last pixel of first road segment? if ((samplePos>>11) > 0x7f) col=linedata[0x7f + 0x200]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col + 32); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col + 32); samplePos+=step; } @@ -1016,10 +974,9 @@ void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &clipr color &= 0xf; if(cliprect.contains(x, y+y_scroll) && color) - bitmap.pix32(y+y_scroll, x) = m_palette->pen(color+color_base); + bitmap.pix(y+y_scroll, x) = m_palette->pen(color+color_base); } } - } uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/taxidriv.cpp b/src/mame/video/taxidriv.cpp index 148e133c12e..ddf06c509a5 100644 --- a/src/mame/video/taxidriv.cpp +++ b/src/mame/video/taxidriv.cpp @@ -13,10 +13,6 @@ void taxidriv_state::spritectrl_w(offs_t offset, uint8_t data) uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - int sx,sy; - - if (m_bghide) { bitmap.fill(0, cliprect); @@ -28,10 +24,10 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } else { - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(3)->opaque(bitmap,cliprect, m_vram3[offs], @@ -40,10 +36,10 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm (sx*8-m_scroll[0])&0xff,(sy*8-m_scroll[1])&0xff); } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, m_vram2[offs]+256*m_vram2[offs+0x400], @@ -54,62 +50,56 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (m_spritectrl[2] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; - - sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff; + int sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff; - color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } if (m_spritectrl[5] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; + int sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff; - sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff; - - color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } if (m_spritectrl[8] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; - - sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff; + int sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff; - color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, m_vram1[offs], @@ -118,25 +108,23 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm sx*8,sy*8,0); } - for (offs = 0;offs < 0x2000;offs++) + for (int offs = 0;offs < 0x2000;offs++) { - int color; - - sx = (offs/2) % 64; - sy = (offs/2) / 64; + int sx = (offs/2) % 64; + int sy = (offs/2) / 64; - color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03; if (color) { - bitmap.pix16(sy, sx) = 2 * color; + bitmap.pix(sy, sx) = 2 * color; } } } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, m_vram0[offs], diff --git a/src/mame/video/tc0080vco.cpp b/src/mame/video/tc0080vco.cpp index 7c56dd25701..91726187a2d 100644 --- a/src/mame/video/tc0080vco.cpp +++ b/src/mame/video/tc0080vco.cpp @@ -603,8 +603,8 @@ void tc0080vco_device::bg0_tilemap_draw(screen_device &screen, bitmap_ind16 &bit int x_index = sx - ((m_bgscroll_ram[row_index] << 16)); - u16 *src16 = &srcbitmap.pix16(src_y_index); - u8 *tsrc = &flagsbitmap.pix8(src_y_index); + u16 const *src16 = &srcbitmap.pix(src_y_index); + u8 const *tsrc = &flagsbitmap.pix(src_y_index); u16 *dst16 = scanline; int x_step = zoomx; diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index 2417b1146e1..3fa49244a91 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -630,7 +630,7 @@ void tc0100scn_base_device::tilemap_update() void tc0100scn_base_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u8 priority, u8 pmask ) { const bitmap_ind16 &src_bitmap = tmap->pixmap(); - int width_mask, height_mask, x, y, p; + int width_mask, height_mask; int column_offset, src_x = 0, src_y = 0; int scrollx_delta = - tmap->scrolldx(); int scrolly_delta = - tmap->scrolldy(); @@ -646,24 +646,24 @@ void tc0100scn_base_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 src_y += cliprect.top(); // Row offsets are 'screen space' 0-255 regardless of Y scroll - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { src_x = (m_fgscrollx - m_fgscroll_ram[(y + scrolly_delta) & 0x1ff] + scrollx_delta + cliprect.min_x) & width_mask; if (m_ctrl[0x7] & 1) // Flipscreen src_x = (256 - 64 - src_x) & width_mask; // Col offsets are 'tilemap' space 0-511, and apply to blocks of 8 pixels at once - for (x = 0; x < cliprect.width(); x++) + for (int x = 0; x < cliprect.width(); x++) { column_offset = m_colscroll_ram[(src_x & 0x3ff) / 8]; - p = src_bitmap.pix16((src_y - column_offset) & height_mask, src_x); + int p = src_bitmap.pix((src_y - column_offset) & height_mask, src_x); if ((p & 0xf)!= 0 || (flags & TILEMAP_DRAW_OPAQUE)) { - bitmap.pix16(y, x + cliprect.min_x) = p; + bitmap.pix(y, x + cliprect.min_x) = p; if (screen.priority().valid()) { - u8 *pri = &screen.priority().pix8(y); + u8 *pri = &screen.priority().pix(y); pri[x + cliprect.min_x] = (pri[x + cliprect.min_x] & pmask) | priority; } } diff --git a/src/mame/video/tc0180vcu.cpp b/src/mame/video/tc0180vcu.cpp index fb3df9474de..db1a846e134 100644 --- a/src/mame/video/tc0180vcu.cpp +++ b/src/mame/video/tc0180vcu.cpp @@ -285,7 +285,7 @@ uint16_t tc0180vcu_device::framebuffer_word_r(offs_t offset) int sy = offset >> 8; int sx = 2 * (offset & 0xff); - return (m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 0) << 8) | m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 1); + return (m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 0) << 8) | m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 1); } void tc0180vcu_device::framebuffer_word_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -294,9 +294,9 @@ void tc0180vcu_device::framebuffer_word_w(offs_t offset, uint16_t data, uint16_t int sx = 2 * (offset & 0xff); if (ACCESSING_BITS_8_15) - m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 0) = data >> 8; + m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 0) = data >> 8; if (ACCESSING_BITS_0_7) - m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 1) = data & 0xff; + m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 1) = data & 0xff; } TILE_GET_INFO_MEMBER(tc0180vcu_device::get_bg_tile_info) @@ -521,7 +521,6 @@ void tc0180vcu_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip void tc0180vcu_device::draw_framebuffer( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { rectangle myclip = cliprect; - int x, y; g_profiler.start(PROFILER_USER1); @@ -538,14 +537,12 @@ g_profiler.start(PROFILER_USER1); if (m_video_control & 0x10) /*flip screen*/ { /*popmessage("1. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst; + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(bitmap.height()-1-y, myclip.max_x); - dst = &bitmap.pix16(bitmap.height()-1-y, myclip.max_x); - - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -558,12 +555,12 @@ g_profiler.start(PROFILER_USER1); } else { - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst = &bitmap.pix16(y, myclip.min_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(y, myclip.min_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -580,14 +577,12 @@ g_profiler.start(PROFILER_USER1); if (m_video_control & 0x10) /*flip screen*/ { /*popmessage("3. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ - for (y = myclip.min_y ;y <= myclip.max_y; y++) + for (int y = myclip.min_y ;y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst; - - dst = &bitmap.pix16(bitmap.height()-1-y, myclip.max_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(bitmap.height()-1-y, myclip.max_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -600,12 +595,12 @@ g_profiler.start(PROFILER_USER1); } else { - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst = &bitmap.pix16(y, myclip.min_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(y, myclip.min_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; diff --git a/src/mame/video/tc0480scp.cpp b/src/mame/video/tc0480scp.cpp index d3914e0c4f9..081f918cc2e 100644 --- a/src/mame/video/tc0480scp.cpp +++ b/src/mame/video/tc0480scp.cpp @@ -623,15 +623,12 @@ void tc0480scp_device::bg01_draw(screen_device &screen, bitmap_ind16 &bitmap, co } else /* zoom */ { - u16 *dst16, *src16; - u8 *tsrc; u16 scanline[512]; u32 sx; - bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); + const bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); int flip = m_pri_reg & 0x40; - int y_index, src_y_index, row_index; - int x_index, x_step; + int y_index; u16 screen_width = 512; //cliprect.width(); u16 min_y = cliprect.min_y; @@ -660,20 +657,20 @@ void tc0480scp_device::bg01_draw(screen_device &screen, bitmap_ind16 &bitmap, co for (int y = min_y; y <= max_y; y++) { - src_y_index = (y_index >> 16) & 0x1ff; + int src_y_index = (y_index >> 16) & 0x1ff; /* row areas are the same in flipscreen, so we must read in reverse */ - row_index = src_y_index; + int row_index = src_y_index; if (flip) row_index = 0x1ff - row_index; - x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); + int x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + const u16 *src16 = &srcbitmap.pix(src_y_index); + const u8 *tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; - x_step = zoomx; + int x_step = zoomx; if (flags & TILEMAP_DRAW_OPAQUE) { @@ -744,10 +741,8 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); - u16 *dst16, *src16; - u8 *tsrc; - int y_index, src_y_index, row_index, row_zoom; - int sx, x_index, x_step; + int y_index; + int sx; u32 zoomx, zoomy; u16 scanline[512]; int flipscreen = m_pri_reg & 0x40; @@ -786,29 +781,31 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co for (int y = min_y; y <= max_y; y++) { + int src_y_index; if (!flipscreen) src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][(y - m_y_offset) & 0x1ff]) & 0x1ff; else /* colscroll area is back to front in flipscreen */ src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][0x1ff - ((y - m_y_offset) & 0x1ff)]) & 0x1ff; /* row areas are the same in flipscreen, so we must read in reverse */ - row_index = src_y_index; + int row_index = src_y_index; if (flipscreen) row_index = 0x1ff - row_index; + int row_zoom; if (m_pri_reg & (layer - 1)) /* bit0 enables for BG2, bit1 for BG3 */ row_zoom = m_rowzoom_ram[layer][row_index]; else row_zoom = 0; - x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); + int x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); /* flawed calc ?? */ x_index -= (m_x_offset - 0x1f + layer * 4) * ((row_zoom & 0xff) << 8); /* We used to kludge 270 multiply factor, before adjusting x_index instead */ - x_step = zoomx; + int x_step = zoomx; if (row_zoom) /* need to reduce x_step */ { if (!(row_zoom & 0xff00)) @@ -817,9 +814,9 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co x_step -= (((row_zoom & 0xff) * 256) & 0xffff); } - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + const u16 *src16 = &srcbitmap.pix(src_y_index); + const u8 *tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) { diff --git a/src/mame/video/tc0780fpa.cpp b/src/mame/video/tc0780fpa.cpp index 046a03f8750..3cc9da0d271 100644 --- a/src/mame/video/tc0780fpa.cpp +++ b/src/mame/video/tc0780fpa.cpp @@ -52,8 +52,8 @@ void tc0780fpa_renderer::render_solid_scan(int32_t scanline, const extent_t &ext float z = extent.param[0].start; int color = extent.param[1].start; float dz = extent.param[0].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -75,8 +75,8 @@ void tc0780fpa_renderer::render_shade_scan(int32_t scanline, const extent_t &ext float color = extent.param[1].start; float dz = extent.param[0].dpdx; float dcolor = extent.param[1].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -104,8 +104,8 @@ void tc0780fpa_renderer::render_texture_scan(int32_t scanline, const extent_t &e float du = extent.param[1].dpdx; float dv = extent.param[2].dpdx; float dcolor = extent.param[3].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); int tex_wrap_x = extradata.tex_wrap_x; int tex_wrap_y = extradata.tex_wrap_y; int tex_base_x = extradata.tex_base_x; diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp index 063d0f09a12..912b0078101 100644 --- a/src/mame/video/tceptor.cpp +++ b/src/mame/video/tceptor.cpp @@ -485,13 +485,11 @@ void tceptor_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* if SPR_MASK_COLOR pen is used, restore pixels from previous bitmap */ if (need_mask) { - int x, y; - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - if (m_palette->pen_indirect(bitmap.pix16(y, x)) == SPR_MASK_COLOR) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + if (m_palette->pen_indirect(bitmap.pix(y, x)) == SPR_MASK_COLOR) // restore pixel - bitmap.pix16(y, x) = m_temp_bitmap.pix16(y, x); + bitmap.pix(y, x) = m_temp_bitmap.pix(y, x); } } diff --git a/src/mame/video/tecmo_mix.cpp b/src/mame/video/tecmo_mix.cpp index abcdbca4017..ea40b7c9550 100644 --- a/src/mame/video/tecmo_mix.cpp +++ b/src/mame/video/tecmo_mix.cpp @@ -72,20 +72,17 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, //int frame = (screen.frame_number()) & 1; // note this game has no tx layer, comments relate to other drivers - int y, x; - const pen_t *paldata = palette.pens(); + pen_t const *const paldata = palette.pens(); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dd = &bitmap.pix32(y); - uint16_t *sd2 = &bitmap_sp->pix16(y); - uint16_t *fg = &bitmap_fg->pix16(y); - uint16_t *bg = &bitmap_bg->pix16(y); - uint16_t *tx = nullptr; - if (bitmap_tx != nullptr) - tx = &bitmap_tx->pix16(y); - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + uint32_t *const dd = &bitmap.pix(y); + uint16_t *const sd2 = &bitmap_sp->pix(y); + uint16_t *const fg = &bitmap_fg->pix(y); + uint16_t *const bg = &bitmap_bg->pix(y); + uint16_t *const tx = bitmap_tx ? &bitmap_tx->pix(y) : nullptr; + + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t sprpixel = (sd2[x]); diff --git a/src/mame/video/tecmosys.cpp b/src/mame/video/tecmosys.cpp index b2ef9b96da4..f51d8749d4d 100644 --- a/src/mame/video/tecmosys.cpp +++ b/src/mame/video/tecmosys.cpp @@ -130,7 +130,7 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext else ressy = ycnt; const u32 srcoffs = address + (ressy * xsize); - u16* dstptr = &m_sprite_bitmap.pix16(drawy); + u16 *const dstptr = &m_sprite_bitmap.pix(drawy); for (int drawx = drawx_base, xcnt = srcx; (drawx <= cliprect.max_x) && (xcnt < xsize); xcnt++, drawx++) { @@ -184,7 +184,7 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext else ressy = ycnt; const u32 srcoffs = address + (ressy * xsize); - u16* dstptr = &m_sprite_bitmap.pix16(drawy >> 8); + u16 *const dstptr = &m_sprite_bitmap.pix(drawy >> 8); for (int drawx = drawx_base, xcnt = srcx; (drawx < scaled_cliprect.max_x) && (xcnt < xsize); xcnt++, drawx += zoomx) { @@ -204,17 +204,14 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext void tecmosys_state::tilemap_copy_to_compose(u16 pri, const rectangle &cliprect) { - int y,x; - u16 *srcptr; - u16 *dstptr; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - srcptr = &m_tmp_tilemap_renderbitmap.pix16(y); - dstptr = &m_tmp_tilemap_composebitmap.pix16(y); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + u16 const *const srcptr = &m_tmp_tilemap_renderbitmap.pix(y); + u16 *const dstptr = &m_tmp_tilemap_composebitmap.pix(y); + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { if ((srcptr[x]&0xf)!=0x0) - dstptr[x] = (srcptr[x]&0x7ff) | pri; + dstptr[x] = (srcptr[x]&0x7ff) | pri; } } } @@ -226,10 +223,10 @@ void tecmosys_state::do_final_mix(bitmap_rgb32 &bitmap, const rectangle &cliprec for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - u16 const *const srcptr = &m_tmp_tilemap_composebitmap.pix16(y); - u16 const *const srcptr2 = &m_sprite_bitmap.pix16(y); + u16 const *const srcptr = &m_tmp_tilemap_composebitmap.pix(y); + u16 const *const srcptr2 = &m_sprite_bitmap.pix(y); - u32 *const dstptr = &bitmap.pix32(y); + u32 *const dstptr = &bitmap.pix(y); for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { u16 const pri = srcptr[x] & 0xc000; diff --git a/src/mame/video/thief.cpp b/src/mame/video/thief.cpp index 25fdb7e1e71..1a16e5b6bf4 100644 --- a/src/mame/video/thief.cpp +++ b/src/mame/video/thief.cpp @@ -101,10 +101,8 @@ void thief_state::video_start(){ } uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ - uint8_t *videoram = m_videoram.get(); - uint32_t offs; int flipscreen = m_video_control&1; - const uint8_t *source = videoram; + const uint8_t *source = m_videoram.get(); if (m_tms->screen_reset()) { @@ -115,17 +113,16 @@ uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &b if( m_video_control&4 ) /* visible page */ source += 0x2000*4; - for( offs=0; offs<0x2000; offs++ ){ + for( uint32_t offs=0; offs<0x2000; offs++ ){ int ypos = offs/32; int xpos = (offs%32)*8; int plane0 = source[0x2000*0+offs]; int plane1 = source[0x2000*1+offs]; int plane2 = source[0x2000*2+offs]; int plane3 = source[0x2000*3+offs]; - int bit; if( flipscreen ){ - for( bit=0; bit<8; bit++ ){ - bitmap.pix16(0xff - ypos, 0xff - (xpos+bit)) = + for( int bit=0; bit<8; bit++ ){ + bitmap.pix(0xff - ypos, 0xff - (xpos+bit)) = (((plane0<<bit)&0x80)>>7) | (((plane1<<bit)&0x80)>>6) | (((plane2<<bit)&0x80)>>5) | @@ -133,8 +130,8 @@ uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &b } } else { - for( bit=0; bit<8; bit++ ){ - bitmap.pix16(ypos, xpos+bit) = + for( int bit=0; bit<8; bit++ ){ + bitmap.pix(ypos, xpos+bit) = (((plane0<<bit)&0x80)>>7) | (((plane1<<bit)&0x80)>>6) | (((plane2<<bit)&0x80)>>5) | diff --git a/src/mame/video/thunderj.cpp b/src/mame/video/thunderj.cpp index e5628e9a555..db6dc0fc7ff 100644 --- a/src/mame/video/thunderj.cpp +++ b/src/mame/video/thunderj.cpp @@ -120,9 +120,9 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -184,19 +184,19 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in * +MPX0*!CS1*CS0 * +!CS1*!CS0*APIX0 */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - int pfm = 0; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) continue; /* determine pf/m signal */ + int pfm = 0; if ((mo[x] & 0xff) == 1) pfm = 1; else if (pf[x] & 8) { - int pfpriority = (pri[x] & 0x80) ? ((pri[x] >> 2) & 3) : (pri[x] & 3); + int const pfpriority = (pri[x] & 0x80) ? ((pri[x] >> 2) & 3) : (pri[x] & 3); if (((pfpriority == 3) && !(mopriority & 1)) || ((pfpriority & 1) && (mopriority == 0)) || ((pfpriority & 2) && !(mopriority & 2))) @@ -218,12 +218,12 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/ti85.cpp b/src/mame/video/ti85.cpp index 65a9697d431..8bdf1283dec 100644 --- a/src/mame/video/ti85.cpp +++ b/src/mame/video/ti85.cpp @@ -145,39 +145,36 @@ void ti85_state::video_start() uint32_t ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space &space = m_maincpu->space(AS_PROGRAM); - int x,y,b; - int brightnes; - int lcdmem; if (!m_LCD_status || !m_timer_interrupt_mask) { - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) - for (b=0; b<8; b++) - bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6]; + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) + for (int b=0; b<8; b++) + bitmap.pix(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6]; return 0; } - lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; + int lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; memcpy (m_frames.get(), m_frames.get()+m_ti_video_memory_size, sizeof (uint8_t) * (m_ti_number_of_frames-1) * m_ti_video_memory_size); - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) *(m_frames.get()+(m_ti_number_of_frames-1)*m_ti_video_memory_size+y*m_ti_screen_x_size+x) = space.read_byte(lcdmem+y*m_ti_screen_x_size+x); - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) - for (b=0; b<8; b++) + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) + for (int b=0; b<8; b++) { - brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + int brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); - bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes]; + bitmap.pix(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes]; } return 0; } diff --git a/src/mame/video/tia.cpp b/src/mame/video/tia.cpp index d3c939aa5b7..36ee0175fbc 100644 --- a/src/mame/video/tia.cpp +++ b/src/mame/video/tia.cpp @@ -701,9 +701,6 @@ void tia_video_device::setup_pXgfx(void) void tia_video_device::update_bitmap(int next_x, int next_y) { - int x; - int y; - uint8_t linePF[160]; uint8_t lineP0[160]; uint8_t lineP1[160]; @@ -753,16 +750,14 @@ void tia_video_device::update_bitmap(int next_x, int next_y) } } - for (y = prev_y; y <= next_y; y++) + for (int y = prev_y; y <= next_y; y++) { - uint16_t* p; - int x1 = prev_x; int x2 = next_x; int colx1; /* Check if we have crossed a line boundary */ - if ( y != prev_y ) { + if (y != prev_y ) { int redraw_line = 0; HMOVE_started_previous = HMOVE_INACTIVE; @@ -952,19 +947,18 @@ void tia_video_device::update_bitmap(int next_x, int next_y) if (collision_check(lineM0, lineM1, colx1, x2)) CXPPMM |= 0x40; - p = &helper[current_bitmap].pix16(y % screen_height, 34); + uint16_t *p = &helper[current_bitmap].pix(y % screen_height, 34); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { p[x] = temp[x]; } if ( x2 == 160 && y % screen_height == (screen_height - 1) ) { - int t_y; - for ( t_y = 0; t_y < buffer.height(); t_y++ ) { - uint16_t* l0 = &helper[current_bitmap].pix16(t_y); - uint16_t* l1 = &helper[1 - current_bitmap].pix16(t_y); - uint32_t* l2 = &buffer.pix32(t_y); + for ( int t_y = 0; t_y < buffer.height(); t_y++ ) { + uint16_t* l0 = &helper[current_bitmap].pix(t_y); + uint16_t* l1 = &helper[1 - current_bitmap].pix(t_y); + uint32_t* l2 = &buffer.pix(t_y); int t_x; for( t_x = 0; t_x < buffer.width(); t_x++ ) { if ( l0[t_x] != l1[t_x] ) { @@ -1321,7 +1315,7 @@ void tia_video_device::HMOVE_w(uint8_t data) } if (curr_y < screen_height) { - memset(&helper[current_bitmap].pix16(curr_y, 34), 0, 16); + memset(&helper[current_bitmap].pix(curr_y, 34), 0, 16); } prev_x = 8; diff --git a/src/mame/video/timex.cpp b/src/mame/video/timex.cpp index e0d811f24d0..24b8c4a4a47 100644 --- a/src/mame/video/timex.cpp +++ b/src/mame/video/timex.cpp @@ -22,7 +22,7 @@ inline void timex_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* Update FLASH status for ts2068. Assumes flash update every 1/2s. */ diff --git a/src/mame/video/tmnt.cpp b/src/mame/video/tmnt.cpp index 64a297f9de4..d4f9f3895b3 100644 --- a/src/mame/video/tmnt.cpp +++ b/src/mame/video/tmnt.cpp @@ -650,7 +650,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[0] >= 0x30 && m_layerpri[1] < 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k052109->tilemap_draw(screen, bitmap, cliprect, m_sorted_layer[1], 0, 2); @@ -658,7 +658,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[1] >= 0x30 && m_layerpri[2] < 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k052109->tilemap_draw(screen, bitmap, cliprect, m_sorted_layer[2], 0, 4); @@ -666,7 +666,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[2] >= 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k053245->sprites_draw(bitmap, cliprect, screen.priority()); diff --git a/src/mame/video/toaplan1.cpp b/src/mame/video/toaplan1.cpp index 369c5bd0486..5fd0be9203e 100644 --- a/src/mame/video/toaplan1.cpp +++ b/src/mame/video/toaplan1.cpp @@ -742,9 +742,9 @@ void toaplan1_state::draw_sprite_custom(screen_device &screen, bitmap_rgb32 &des { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/toaplan2.cpp b/src/mame/video/toaplan2.cpp index de02afcda96..9a542579022 100644 --- a/src/mame/video/toaplan2.cpp +++ b/src/mame/video/toaplan2.cpp @@ -274,8 +274,8 @@ u32 toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_ind16 & { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16* src_vdp0 = &bitmap.pix16(y); - const u16* src_vdp1 = &m_secondary_render_bitmap.pix16(y); + u16 *const src_vdp0 = &bitmap.pix(y); + u16 const *const src_vdp1 = &m_secondary_render_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/toaplan_scu.cpp b/src/mame/video/toaplan_scu.cpp index 84afffe2d0a..a7bb72c6e3b 100644 --- a/src/mame/video/toaplan_scu.cpp +++ b/src/mame/video/toaplan_scu.cpp @@ -93,12 +93,12 @@ void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, u void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) { - const pen_t *pens = &palette().pen(gfx(0)->colorbase()); + pen_t const *const pens = &palette().pen(gfx(0)->colorbase()); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *srcline = &m_temp_spritebitmap.pix16(y); - u32 *dstline = &bitmap.pix32(y); + u16 const *const srcline = &m_temp_spritebitmap.pix(y); + u32 *const dstline = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/toobin.cpp b/src/mame/video/toobin.cpp index ea0a163b78c..d1fe95c1e7e 100644 --- a/src/mame/video/toobin.cpp +++ b/src/mame/video/toobin.cpp @@ -218,13 +218,13 @@ uint32_t toobin_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); - const pen_t *palette = m_palette->pens(); + pen_t const *const palette = m_palette->pens(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *dest = &bitmap.pix32(y); - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &m_pfbitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint32_t *const dest = &bitmap.pix(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t const *const pf = &m_pfbitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint16_t pix = pf[x]; diff --git a/src/mame/video/triplhnt.cpp b/src/mame/video/triplhnt.cpp index f3775c905d4..0937758003f 100644 --- a/src/mame/video/triplhnt.cpp +++ b/src/mame/video/triplhnt.cpp @@ -88,27 +88,21 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec rect &= cliprect; /* check for collisions and copy sprite */ - + for (int x = rect.left(); x <= rect.right(); x++) { - int x; - int y; - - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) { - for (y = rect.top(); y <= rect.bottom(); y++) - { - pen_t a = m_helper.pix16(y, x); - pen_t b = bitmap.pix16(y, x); + pen_t const a = m_helper.pix(y, x); + pen_t const b = bitmap.pix(y, x); - if (a == 2 && b == 7) - { - hit_code = j; - hit_line = y; - } - - if (a != 1) - bitmap.pix16(y, x) = a; + if (a == 2 && b == 7) + { + hit_code = j; + hit_line = y; } + + if (a != 1) + bitmap.pix(y, x) = a; } } } diff --git a/src/mame/video/trs80.cpp b/src/mame/video/trs80.cpp index 9ad2452dd26..8fd52de2dda 100644 --- a/src/mame/video/trs80.cpp +++ b/src/mame/video/trs80.cpp @@ -14,10 +14,9 @@ /* 7 or 8-bit video, 32/64 characters per line = trs80, trs80l2, sys80 */ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; - uint8_t cols = BIT(m_mode, 0) ? 32 : 64; - uint8_t skip = BIT(m_mode, 0) ? 2 : 1; + uint16_t sy=0,ma=0; + uint8_t const cols = BIT(m_mode, 0) ? 32 : 64; + uint8_t const skip = BIT(m_mode, 0) ? 2 : 1; if (m_mode != m_size_store) { @@ -25,19 +24,19 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -52,6 +51,7 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b if (BIT(m_mode, 1) & (chr < 32)) chr+=64; // if g,j,p,q,y; lower the descender + uint8_t gfx; if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) { if ((ra < 10) && (ra > 1)) @@ -86,10 +86,9 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b /* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; - uint8_t cols = BIT(m_mode, 0) ? 32 : 64; - uint8_t skip = BIT(m_mode, 0) ? 2 : 1; + uint16_t sy=0,ma=0; + uint8_t const cols = BIT(m_mode, 0) ? 32 : 64; + uint8_t const skip = BIT(m_mode, 0) ? 2 : 1; if (m_mode != m_size_store) { @@ -97,19 +96,19 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -124,7 +123,7 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 if (BIT(m_mode, 1) && (chr < 32)) chr+=64; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra ]; + uint8_t gfx = m_p_chargen[(chr<<4) | ra ]; /* Display a scanline of a character (6 pixels) */ *p++ = BIT(gfx, 7); @@ -145,8 +144,7 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { static const uint16_t rows[] = { 0, 0x200, 0x100, 0x300, 1, 0x201, 0x101, 0x301 }; - uint8_t chr,gfx,gfxbit,bg=7,fg=0; - uint16_t sy=0,ma=0,x,y,ra; + uint16_t sy=0,ma=0; uint8_t cols = BIT(m_lnw_mode, 1) ? 80 : 64; /* Although the OS can select 32-character mode, it is not supported by hardware */ @@ -156,6 +154,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } + uint8_t bg=7,fg=0; if (BIT(m_lnw_mode, 1)) { bg = 0; @@ -165,19 +164,19 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b switch (m_lnw_mode & 0x06) { case 0: // MODE 0 - for (y = 0; y < 16; y++) + for (uint16_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint16_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit) ? fg : bg; *p++ = BIT(chr, gfxbit) ? fg : bg; @@ -190,6 +189,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b else { /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[(chr<<1) | rows[ra] ]; else @@ -210,15 +210,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b break; case 0x02: // MODE 1 - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; /* Display 6 pixels in normal region */ *p++ = BIT(gfx, 0) ? fg : bg; *p++ = BIT(gfx, 1) ? fg : bg; @@ -228,9 +228,9 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b *p++ = BIT(gfx, 5) ? fg : bg; } - for (x = 0; x < 0x10; x++) + for (uint16_t x = 0; x < 0x10; x++) { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + uint8_t gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; /* Display 6 pixels in extended region */ *p++ = BIT(gfx, 0) ? fg : bg; *p++ = BIT(gfx, 1) ? fg : bg; @@ -246,15 +246,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b case 0x04: // MODE 2 /* it seems the text video ram can have an effect in this mode, not explained clearly, so not emulated */ - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; /* Display 6 pixels in normal region */ fg = (gfx & 0x38) >> 3; *p++ = fg; @@ -273,15 +273,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b /* the manual does not explain at all how colour is determined for the extended area. Further, the background colour is not mentioned anywhere. Black is assumed. */ - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; fg = (m_p_videoram[ x | y ] & 0x38) >> 3; /* Display 6 pixels in normal region */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -293,9 +293,9 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b *p++ = BIT(gfx, 5) ? fg : bg; } - for (x = 0; x < 0x10; x++) + for (uint16_t x = 0; x < 0x10; x++) { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + uint8_t gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; fg = (m_p_gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; /* Display 6 pixels in extended region */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -316,8 +316,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b /* lores characters are in the character generator. Each character is 8x16. */ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; uint8_t cols = BIT(m_mode, 0) ? 32 : 64; uint8_t skip = BIT(m_mode, 0) ? 2 : 1; @@ -327,18 +326,18 @@ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 screen.set_visible_area(0, cols*8-1, 0, 16*16-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; + uint8_t gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 0); diff --git a/src/mame/video/trs80m3.cpp b/src/mame/video/trs80m3.cpp index 28fc64012dc..4b44cc62534 100644 --- a/src/mame/video/trs80m3.cpp +++ b/src/mame/video/trs80m3.cpp @@ -39,8 +39,7 @@ void trs80m3_state::port_88_w(offs_t offset, uint8_t data) /* 8-bit video, 32/64/40/80 characters per line = trs80m3, trs80m4. */ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; uint8_t skip=1; uint8_t cols = BIT(m_mode, 2) ? 80 : 64; uint8_t rows = BIT(m_mode, 2) ? 24 : 16; @@ -60,18 +59,19 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 screen.set_visible_area(0, s_cols*8-1, 0, rows*lines-1); } - for (y = 0; y < rows; y++) + for (uint8_t y = 0; y < rows; y++) { - for (ra = 0; ra < lines; ra++) + for (uint8_t ra = 0; ra < lines; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + cols; x+=skip) + for (uint16_t x = ma; x < ma + cols; x+=skip) { - chr = m_p_videoram[x+m_start_address]; + uint8_t chr = m_p_videoram[x+m_start_address]; if (((chr & 0xc0) == 0xc0) && (~m_mode & 8)) { + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[((chr&mask)<<3) | ra ]; else @@ -86,10 +86,9 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 *p++ = BIT(gfx, 1); *p++ = BIT(gfx, 0); } - else - if ((chr & 0x80) && (~m_mode & 8)) + else if ((chr & 0x80) && (~m_mode & 8)) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -104,6 +103,7 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 else { /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[((chr&0x7f)<<3) | ra ]; else diff --git a/src/mame/video/truco.cpp b/src/mame/video/truco.cpp index ba885d7c4d6..ac2019b3914 100644 --- a/src/mame/video/truco.cpp +++ b/src/mame/video/truco.cpp @@ -42,7 +42,7 @@ uint32_t truco_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { int const pixel = (videoram[x >> 1] >> ((x & 1) ? 0 : 4)) & 0x0f; - bitmap.pix32(y, x) = m_palette->pen(pixel); + bitmap.pix(y, x) = m_palette->pen(pixel); } videoram += 0x80; diff --git a/src/mame/video/tubep.cpp b/src/mame/video/tubep.cpp index af4b49d0e76..3273086647f 100644 --- a/src/mame/video/tubep.cpp +++ b/src/mame/video/tubep.cpp @@ -572,15 +572,13 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b pen_t pen_base = 32; //change it later - uint32_t v; uint8_t *text_gfx_base = memregion("gfx1")->base(); uint8_t *romBxx = memregion("user1")->base() + 0x2000*m_background_romsel; /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect.min_y, cliprect.max_y+1); */ - for (v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ + for (uint32_t v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ { - uint32_t h; uint32_t sp_data0=0,sp_data1=0,sp_data2=0; // It appears there is a 1 pixel delay when renderer switches from background to sprite/text, @@ -588,7 +586,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b // See the gameplay video on the PCB. https://www.youtube.com/watch?v=xxONzbUOOsw bool prev_text_or_sprite_pixel = true; - for (h = 0*8; h < 32*8; h++) + for (uint32_t h = 0*8; h < 32*8; h++) { bool draw_text_or_sprite_pixel = false; @@ -606,7 +604,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b if (text_gfx_data & (0x80 >> (h & 0x07))) { - bitmap.pix16(v, h) = (m_textram[text_offs + 1] & 0x0f) | m_color_A4; + bitmap.pix(v, h) = (m_textram[text_offs + 1] & 0x0f) | m_color_A4; draw_text_or_sprite_pixel = true; } else @@ -652,12 +650,12 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b draw_text_or_sprite_pixel = true; } - bitmap.pix16(v, h) = pen_base + bg_data*64 + romB_data_h; + bitmap.pix(v, h) = pen_base + bg_data*64 + romB_data_h; } // text and sprite drop shadow if (draw_text_or_sprite_pixel && !prev_text_or_sprite_pixel && h > 0) - bitmap.pix16(v, h - 1) = 0x0; + bitmap.pix(v, h - 1) = 0x0; prev_text_or_sprite_pixel = draw_text_or_sprite_pixel; } } @@ -744,7 +742,6 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 { int DISP_ = m_DISP^1; - uint32_t v; uint8_t *text_gfx_base = memregion("gfx1")->base(); uint8_t *rom13D = memregion("user1")->base(); uint8_t *rom11BD = rom13D+0x1000; @@ -754,9 +751,8 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 /* especially read from ROM19C can be done once per 8 pixels*/ /* and the data could be bitswapped beforehand */ - for (v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ + for (uint32_t v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ { - uint32_t h; uint32_t sp_data0=0,sp_data1=0,sp_data2=0; uint8_t pal14h4_pin19; uint8_t pal14h4_pin18; @@ -769,7 +765,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 pal14h4_pin13 = (rom19C[addr] >> ((v&7)^7) ) &1; pal14h4_pin19 = (ram_data>>13) & 1; - for (h = 0*8; h < 32*8; h++) + for (uint32_t h = 0*8; h < 32*8; h++) { offs_t text_offs; uint8_t text_code; @@ -784,7 +780,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 text_gfx_data = text_gfx_base[(text_code << 3) | (v & 0x07)]; if (text_gfx_data & (0x80 >> (h & 0x07))) - bitmap.pix16(v, h) = 0x10 | (m_textram[text_offs + 1] & 0x0f); + bitmap.pix(v, h) = 0x10 | (m_textram[text_offs + 1] & 0x0f); else { uint32_t sp_data; @@ -795,7 +791,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 sp_data = sp_data1; if (sp_data != 0x0f) - bitmap.pix16(v, h) = 0x00 + sp_data; + bitmap.pix(v, h) = 0x00 + sp_data; else { uint32_t bg_data; @@ -848,7 +844,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 color_bank = (pal14h4_pin13 & ((bg_data&0x08)>>3) & ((bg_data&0x04)>>2) & (((bg_data&0x02)>>1)^1) & (bg_data&0x01) ) | (pal14h4_pin18 & ((bg_data&0x08)>>3) & ((bg_data&0x04)>>2) & ((bg_data&0x02)>>1) & ((bg_data&0x01)^1) ) | (pal14h4_pin19); - bitmap.pix16(v, h) = 0x20 + color_bank*0x10 + bg_data; + bitmap.pix(v, h) = 0x20 + color_bank*0x10 + bg_data; } } } diff --git a/src/mame/video/tunhunt.cpp b/src/mame/video/tunhunt.cpp index 588f6253274..a5712f2afa1 100644 --- a/src/mame/video/tunhunt.cpp +++ b/src/mame/video/tunhunt.cpp @@ -223,10 +223,10 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl const int color = ((span_data >> 6) & 0x3) ^ 0x3; int count = (span_data & 0x1f) + 1; while (count-- && x < 256) - tmpbitmap.pix16(line, x++) = color; + tmpbitmap.pix(line, x++) = color; } while (x < 256) - tmpbitmap.pix16(line, x++) = 0; + tmpbitmap.pix(line, x++) = 0; } int scaley; @@ -303,7 +303,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect) } } if (x >= cliprect.left() && x <= cliprect.right()) - bitmap.pix16(0xff-y, x) = color; + bitmap.pix(0xff-y, x) = color; } } } diff --git a/src/mame/video/turbo.cpp b/src/mame/video/turbo.cpp index d52f2d9fdfa..723aa15054e 100644 --- a/src/mame/video/turbo.cpp +++ b/src/mame/video/turbo.cpp @@ -352,22 +352,21 @@ uint32_t turbo_state::turbo_get_sprite_bits(uint8_t road, sprite_info *sprinfo) uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr1114 = &m_proms[0x000]; - const uint8_t *pr1115 = &m_proms[0x020]; - const uint8_t *pr1116 = &m_proms[0x040]; - const uint8_t *pr1117 = &m_proms[0x060]; - const uint8_t *pr1118 = &m_proms[0x100]; - const uint8_t *pr1121 = &m_proms[0x600]; - const uint8_t *pr1122 = &m_proms[0x800]; - const uint8_t *pr1123 = &m_proms[0xc00]; - int x, y; + uint8_t const *const pr1114 = &m_proms[0x000]; + uint8_t const *const pr1115 = &m_proms[0x020]; + uint8_t const *const pr1116 = &m_proms[0x040]; + uint8_t const *const pr1117 = &m_proms[0x060]; + uint8_t const *const pr1118 = &m_proms[0x100]; + uint8_t const *const pr1121 = &m_proms[0x600]; + uint8_t const *const pr1122 = &m_proms[0x800]; + uint8_t const *const pr1123 = &m_proms[0xc00]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); - int sel, coch, babit, slipar_acciar, area, offs, areatmp, road = 0; + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); + int road = 0; sprite_info sprinfo; /* compute the Y sum between opa and the current scanline (p. 141) */ @@ -382,25 +381,22 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b turbo_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - int bacol, red, grn, blu, priority, foreraw, forebits, mx, ix; int xx = x / TURBO_X_SCALE; - uint8_t carry; - uint32_t sprbits; - uint16_t he; /* load the bitmask from the sprite position for both halves of the sprites (p. 139) */ - he = m_sprite_position[xx] | (m_sprite_position[xx + 0x100] << 8); + uint16_t he = m_sprite_position[xx] | (m_sprite_position[xx + 0x100] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* compute the X sum between opb and the current column; only the carry matters (p. 141) */ - carry = (xx + m_turbo_opb) >> 8; + uint8_t carry = (xx + m_turbo_opb) >> 8; /* the carry selects which inputs to use (p. 141) */ + int sel, coch; if (carry) { sel = m_turbo_ipb; @@ -413,6 +409,7 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b } /* look up AREA1 and AREA2 (p. 142) */ + int area, offs, areatmp; offs = va | /* A0- A7 = VA0-VA7 */ ((sel & 0x0f) << 8); /* A8-A11 = SEL0-3 */ @@ -447,27 +444,27 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* compute the final area value and look it up in IC18/PR1115 (p. 144) */ /* note: SLIPAR is 0 on the road surface only */ /* ACCIAR is 0 on the road surface and the striped edges only */ - babit = pr1115[area]; - slipar_acciar = babit & 0x30; + int babit = pr1115[area]; + int slipar_acciar = babit & 0x30; if (!road && (slipar_acciar & 0x20)) road = 1; /* also use the coch value to look up color info in IC13/PR1114 and IC21/PR1117 (p. 144) */ offs = (coch & 0x0f) | /* A0-A3: CONT0-3 = COCH0-3 */ ((m_turbo_fbcol & 0x01) << 4); /* A4: COL0 */ - bacol = pr1114[offs] | (pr1117[offs] << 8); + int bacol = pr1114[offs] | (pr1117[offs] << 8); /* at this point, do the character lookup; due to the shift register loading in */ /* the sync PROM, we latch character 0 during pixel 6 and start clocking in pixel */ /* 8, effectively shifting the display by 8; at pixel 0x108, the color latch is */ /* forced clear and isn't touched until the next shift register load */ - foreraw = (xx < 8 || xx >= 0x108) ? 0 : fore[xx - 8]; + int foreraw = (xx < 8 || xx >= 0x108) ? 0 : fore[xx - 8]; /* perform the foreground color table lookup in IC99/PR1118 (p. 137) */ - forebits = pr1118[foreraw]; + int forebits = pr1118[foreraw]; /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { /* iterate over live sprites and update them */ /* the final 32-bit value is: */ @@ -475,18 +472,18 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* CDG0-7 = D8 -D15 */ /* CDR0-7 = D16-D23 */ /* PLB0-7 = D24-D31 */ - sprbits = turbo_get_sprite_bits(road, &sprinfo); + uint32_t sprbits = turbo_get_sprite_bits(road, &sprinfo); /* perform collision detection here via lookup in IC20/PR1116 (p. 144) */ m_turbo_collision |= pr1116[((sprbits >> 24) & 7) | (slipar_acciar >> 1)]; /* look up the sprite priority in IC11/PR1122 (p. 144) */ - priority = ((sprbits & 0xfe000000) >> 25) | /* A0-A6: PLB1-7 */ + int priority = ((sprbits & 0xfe000000) >> 25) | /* A0-A6: PLB1-7 */ ((m_turbo_fbpla & 0x07) << 7); /* A7-A9: PLA0-2 */ priority = pr1122[priority]; /* use that to look up the overall priority in IC12/PR1123 (p. 144) */ - mx = (priority & 7) | /* A0-A2: PR-1122 output, bits 0-2 */ + int mx = (priority & 7) | /* A0-A2: PR-1122 output, bits 0-2 */ ((sprbits & 0x01000000) >> 21) | /* A3: PLB0 */ ((foreraw & 0x80) >> 3) | /* A4: PLBE */ ((forebits & 0x08) << 2) | /* A5: PLBF */ @@ -496,19 +493,19 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* the MX output selects one of 16 inputs; build up a 16-bit pattern to match */ /* these in red, green, and blue (p. 144) */ - red = ((sprbits & 0x0000ff) >> 0) | /* D0- D7: CDR0-CDR7 */ + int red = ((sprbits & 0x0000ff) >> 0) | /* D0- D7: CDR0-CDR7 */ ((forebits & 0x01) << 8) | /* D8: CDRF */ ((bacol & 0x001f) << 9) | /* D9-D13: BAR0-BAR4 */ (1 << 14) | /* D14: 1 */ (0 << 15); /* D15: 0 */ - grn = ((sprbits & 0x00ff00) >> 8) | /* D0- D7: CDG0-CDG7 */ + int grn = ((sprbits & 0x00ff00) >> 8) | /* D0- D7: CDG0-CDG7 */ ((forebits & 0x02) << 7) | /* D8: CDGF */ ((bacol & 0x03e0) << 4) | /* D9-D13: BAG0-BAG4 */ (1 << 14) | /* D14: 1 */ (0 << 15); /* D15: 0 */ - blu = ((sprbits & 0xff0000) >> 16) | /* D0- D7: CDB0-CDB7 */ + int blu = ((sprbits & 0xff0000) >> 16) | /* D0- D7: CDB0-CDB7 */ ((forebits & 0x04) << 6) | /* D8: CDBF */ ((bacol & 0x7c00) >> 1) | /* D9-D13: BAB0-BAB4 */ (1 << 14) | /* D14: 1 */ @@ -703,17 +700,16 @@ uint32_t turbo_state::subroc3d_get_sprite_bits(sprite_info *sprinfo, uint8_t *pl uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr1419 = &m_proms[0x000]; - const uint8_t *pr1620 = &m_proms[0x200]; - const uint8_t *pr1450 = &m_proms[0x500]; - const uint8_t *pr1454 = &m_proms[0x920]; - int x, y; + uint8_t const *const pr1419 = &m_proms[0x000]; + uint8_t const *const pr1620 = &m_proms[0x200]; + uint8_t const *const pr1450 = &m_proms[0x500]; + uint8_t const *const pr1454 = &m_proms[0x920]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); sprite_info sprinfo; /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ @@ -721,47 +717,48 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 subroc3d_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - int offs, finalbits, ix; uint8_t xx = x / TURBO_X_SCALE; - uint8_t foreraw, forebits, mux, cd, plb, mplb; - uint16_t he; - uint32_t sprbits; /* load the bitmask from the sprite position for both halves of the sprites (p. 143) */ - he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); + uint16_t he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* at this point, do the character lookup */ + uint8_t foreraw; if (!m_subroc3d_flip) foreraw = fore[xx]; else foreraw = fore[(pr1454[(xx >> 3) & 0x1f] << 3) | (xx & 0x07)]; /* perform the foreground color table lookup in IC62/PR1620 (p. 141) */ - forebits = pr1620[foreraw]; + uint8_t forebits = pr1620[foreraw]; /* MPLB is set based on the high bit of the raw foreground data, as an OR over the output */ /* of the foreground color PROM */ - mplb = (foreraw & 0x80) || ((forebits & 0x0f) == 0); + uint8_t mplb = (foreraw & 0x80) || ((forebits & 0x0f) == 0); /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { + int offs; + /* iterate over live sprites and update them */ /* the final 32-bit value is: */ /* CDA0-7 = D0 -D7 */ /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); + uint8_t plb; + uint32_t sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); /* MUX0-3 is selected by PLY0-3 and the sprite enable bits, and is the output */ /* of IC21/PR1450 (p. 141), unless MPLB = 0, in which case the values are grounded (p. 141) */ + uint8_t mux; if (mplb) { offs = (plb ^ 0xff) | /* A0-A7: /PLB0-7 */ @@ -773,9 +770,10 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 /* CD0-3 are selected from the sprite bits and MUX0-2 (p. 141) */ sprbits = (sprbits >> (mux & 0x07)) & 0x01010101; - cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; + uint8_t cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; /* MUX3 selects either CD0-3 or the foreground output (p. 141) */ + int finalbits; if (mux & 0x08) finalbits = cd; else @@ -802,26 +800,23 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) { - const uint8_t *pr5196 = &m_proms[0x100]; - int sprnum; + uint8_t const *const pr5196 = &m_proms[0x100]; /* initialize the line enable signals to 0 */ info->ve = 0; info->lst = 0; /* compute the sprite information, which was done on the previous scanline during HBLANK */ - for (sprnum = 0; sprnum < 16; sprnum++) + for (int sprnum = 0; sprnum < 16; sprnum++) { - uint8_t *rambase = &m_spriteram[sprnum * 8]; + uint8_t *const rambase = &m_spriteram[sprnum * 8]; int level = sprnum & 7; - uint8_t clo, chi; - uint32_t sum; /* perform the first ALU to see if we are within the scanline */ - sum = y + (rambase[0]/* ^ 0xff*/); - clo = (sum >> 8) & 1; + uint32_t sum = y + (rambase[0]/* ^ 0xff*/); + uint8_t clo = (sum >> 8) & 1; sum += (y << 8) + ((rambase[1]/* ^ 0xff*/) << 8); - chi = (sum >> 16) & 1; + uint8_t chi = (sum >> 16) & 1; /* the AND of the low carry and the inverse of the high carry clocks an enable bit */ /* for this sprite; note that the logic in the Turbo schematics is reversed here */ @@ -830,7 +825,6 @@ void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) int xscale = rambase[2] ^ 0xff; int yscale = rambase[3];// ^ 0xff; uint16_t offset = rambase[6] + (rambase[7] << 8); - int offs; /* mark this entry enabled */ info->ve |= 1 << sprnum; @@ -838,7 +832,7 @@ void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) /* look up the low byte of the sum plus the yscale value in */ /* IC50/PR1119 to determine if we write back the sum of the */ /* offset and the rowbytes this scanline (p. 138) */ - offs = (sum & 0xff) | /* A0-A7 = AL0-AL7 */ + int offs = (sum & 0xff) | /* A0-A7 = AL0-AL7 */ ((yscale & 0x08) << 5); /* A8-A9 = /RO11-/RO12 */ /* one of the bits is selected based on the low 7 bits of yscale */ @@ -870,12 +864,11 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb */ static const uint8_t plb_end[16] = { 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,2 }; uint32_t sprdata = 0; - int level; *plb = 0; /* loop over all live levels */ - for (level = 0; level < 8; level++) + for (int level = 0; level < 8; level++) if (sprinfo->lst & (1 << level)) { /* latch the data and advance the offset */ @@ -887,12 +880,11 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb while (sprinfo->frac[level] >= 0x800000) { uint32_t offs = sprinfo->offset[level]; - uint8_t pixdata; /* bit 0 controls which half of the byte to use */ /* bits 1-13 go to address lines */ /* bit 14 selects which of the two ROMs to read from */ - pixdata = m_spriteroms[(level << 15) | ((offs >> 1) & 0x7fff)] >> ((~offs & 1) * 4); + uint8_t pixdata = m_spriteroms[(level << 15) | ((offs >> 1) & 0x7fff)] >> ((~offs & 1) * 4); sprinfo->latched[level] = sprite_expand[pixdata & 0x0f] << level; sprinfo->plb[level] = (plb_end[pixdata & 0x0f] & 1) << level; @@ -920,16 +912,15 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr5194 = &m_proms[0x000]; - const uint8_t *pr5198 = &m_proms[0x500]; - const uint8_t *pr5199 = &m_proms[0x700]; - int x, y; + uint8_t const *const pr5194 = &m_proms[0x000]; + uint8_t const *const pr5198 = &m_proms[0x500]; + uint8_t const *const pr5199 = &m_proms[0x700]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); sprite_info sprinfo; /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ @@ -937,33 +928,30 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 buckrog_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - uint8_t foreraw, forebits, cd, plb, star, mux; uint8_t xx = x / TURBO_X_SCALE; - uint16_t he; - uint32_t sprbits; - int palbits, offs, ix; + int offs; /* load the bitmask from the sprite position for both halves of the sprites (p. 143) */ - he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); + uint16_t he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* at this point, do the character lookup and the foreground color table lookup in IC93/PR1598 (SH 5/5)*/ - foreraw = fore[(pr5194[((xx >> 3) - 1) & 0x1f] << 3) | (xx & 0x07)]; + uint8_t foreraw = fore[(pr5194[((xx >> 3) - 1) & 0x1f] << 3) | (xx & 0x07)]; offs = ((foreraw & 0x03) << 0) | /* A0-A1: BIT0-1 */ ((foreraw & 0xf8) >> 1) | /* A2-A6: BANK3-7 */ ((m_buckrog_fchg & 0x03) << 7); /* A7-A9: FCHG0-2 */ - forebits = pr5198[offs]; + uint8_t forebits = pr5198[offs]; /* fetch the STAR bit */ - star = m_buckrog_bitmap_ram[y * 256 + xx]; + uint8_t star = m_buckrog_bitmap_ram[y * 256 + xx]; /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { /* iterate over live sprites and update them */ /* the final 32-bit value is: */ @@ -971,9 +959,11 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); + uint8_t plb; + uint32_t sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); /* the PLB bits go into an LS148 8-to-1 decoder and become MUX0-3 (PROM board SH 2/10) */ + uint8_t mux; if (plb == 0) mux = 8; else @@ -988,11 +978,12 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 /* MUX then selects one of the sprites and selects CD0-3 */ sprbits = (sprbits >> (mux & 0x07)) & 0x01010101; - cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; + uint8_t cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; /* this info goes into an LS148 8-to-3 decoder to determine the priorities (SH 5/5) */ /* priority 7 is if bit 0x80 of the foreground color is 0; CHNG = 0 */ + int palbits; if (!(forebits & 0x80)) { palbits = ((forebits & 0x3c) << 2) | diff --git a/src/mame/video/turrett.cpp b/src/mame/video/turrett.cpp index c03e5ec440b..7672daf96c5 100644 --- a/src/mame/video/turrett.cpp +++ b/src/mame/video/turrett.cpp @@ -44,7 +44,7 @@ uint32_t turrett_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint16_t *src = &vram[y * X_VISIBLE + cliprect.min_x]; - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); + uint16_t *dest = &bitmap.pix(y, cliprect.min_x); if (m_video_fade != 0) { diff --git a/src/mame/video/tutankhm.cpp b/src/mame/video/tutankhm.cpp index 9487065e945..f3503f5c802 100644 --- a/src/mame/video/tutankhm.cpp +++ b/src/mame/video/tutankhm.cpp @@ -48,7 +48,7 @@ uint32_t tutankhm_state::screen_update_tutankhm_bootleg(screen_device &screen, b for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x / GALAXIAN_XSCALE; x <= cliprect.max_x / GALAXIAN_XSCALE; x++) { @@ -75,9 +75,9 @@ uint32_t tutankhm_state::screen_update_tutankhm_bootleg(screen_device &screen, b if (m_stars_enabled && enab && (shifted & 0x02) == 0 && (star & 0x80) != 0 && x > 63) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } else if (shifted) @@ -101,7 +101,7 @@ uint32_t tutankhm_state::screen_update_tutankhm_scramble(screen_device &screen, for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x / GALAXIAN_XSCALE; x <= cliprect.max_x / GALAXIAN_XSCALE; x++) { @@ -392,7 +392,7 @@ void tutankhm_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0) - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ star = m_stars[star_offs++]; @@ -400,8 +400,8 @@ void tutankhm_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 star_offs = 0; if (enable_star && (star & 0x80) != 0) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } } } diff --git a/src/mame/video/twin16.cpp b/src/mame/video/twin16.cpp index a85a9e018b0..d64d6824edc 100644 --- a/src/mame/video/twin16.cpp +++ b/src/mame/video/twin16.cpp @@ -274,7 +274,6 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { int xpos = source[1]; int ypos = source[2]; - int x,y; int pal_base = ((attributes&0xf)+0x10)*16; int height = 16<<((attributes>>6)&0x3); @@ -335,15 +334,15 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co if( ypos>=256 ) ypos -= 65536; /* slow slow slow, but it's ok for now */ - for( y=0; y<height; y++, pen_data += width/4 ) + for( int y=0; y<height; y++, pen_data += width/4 ) { int sy = (flipy)?(ypos+height-1-y):(ypos+y); if( sy>=cliprect.min_y && sy<=cliprect.max_y ) { - uint16_t *dest = &bitmap.pix16(sy); - uint8_t *pdest = &screen.priority().pix8(sy); + uint16_t *const dest = &bitmap.pix(sy); + uint8_t *const pdest = &screen.priority().pix(sy); - for( x=0; x<width; x++ ) + for( int x=0; x<width; x++ ) { int sx = (flipx)?(xpos+width-1-x):(xpos+x); if( sx>=cliprect.min_x && sx<=cliprect.max_x ) diff --git a/src/mame/video/tx0.cpp b/src/mame/video/tx0.cpp index 1e7c5c0a147..a797864d4a0 100644 --- a/src/mame/video/tx0.cpp +++ b/src/mame/video/tx0.cpp @@ -19,7 +19,7 @@ inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } /* @@ -346,13 +346,12 @@ enum void tx0_state::tx0_typewriter_linefeed() { uint8_t buf[typewriter_window_width]; - int y; assert(typewriter_window_width <= m_typewriter_bitmap.width()); assert(typewriter_window_height <= m_typewriter_bitmap.height()); - for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) + for (int y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - std::copy_n(&m_typewriter_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); + std::copy_n(&m_typewriter_bitmap.pix(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/tx1.cpp b/src/mame/video/tx1.cpp index e11b7bb806d..306da618218 100644 --- a/src/mame/video/tx1.cpp +++ b/src/mame/video/tx1.cpp @@ -1123,14 +1123,13 @@ WRITE_LINE_MEMBER(tx1_state::screen_vblank_tx1) void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) { - int x, y; - uint8_t *chr_pal = &m_proms[0x900]; + uint8_t const *const chr_pal = &m_proms[0x900]; int x_offset = screen * 256; - for (y = 0; y < 240; ++y) + for (int y = 0; y < 240; ++y) { - uint16_t *bmp_addr = &bitmap.pix16(y); + uint16_t *bmp_addr = &bitmap.pix(y); uint32_t bmp_offset = y * 768 + x_offset; @@ -1138,7 +1137,7 @@ void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) uint8_t *rod_addr = m_rod_bmp.get() + bmp_offset; uint8_t *obj_addr = m_obj_bmp.get() + bmp_offset; - for (x = 0; x < 256; ++x) + for (int x = 0; x < 256; ++x) { uint8_t out_val; uint32_t char_val = chr_addr[x]; @@ -2918,10 +2917,9 @@ void tx1_state::buggyboy_scolst_w(uint16_t data) void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) { - uint8_t *chr_pal = &m_proms[0x400]; + uint8_t const *const chr_pal = &m_proms[0x400]; uint32_t bmp_stride; uint32_t x_offset; - uint32_t y; if (screen < 0) { @@ -2934,10 +2932,8 @@ void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) x_offset = 256 * screen; } - for (y = 0; y < 240; ++y) + for (uint32_t y = 0; y < 240; ++y) { - uint32_t x; - uint32_t bmp_offset = y * bmp_stride + x_offset; uint8_t *chr_addr = m_chr_bmp.get() + bmp_offset; @@ -2947,9 +2943,9 @@ void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) uint32_t sky_en = BIT(m_vregs.sky, 7); uint32_t sky_val = (((m_vregs.sky & 0x7f) + y) >> 2) & 0x3f; - uint16_t *bmp_addr = &bitmap.pix16(y); + uint16_t *bmp_addr = &bitmap.pix(y); - for (x = 0; x < 256; ++x) + for (uint32_t x = 0; x < 256; ++x) { uint32_t out_val; diff --git a/src/mame/video/ultratnk.cpp b/src/mame/video/ultratnk.cpp index b6bd759460c..d5dc308c3d8 100644 --- a/src/mame/video/ultratnk.cpp +++ b/src/mame/video/ultratnk.cpp @@ -122,7 +122,7 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank) for (int y = rect.top(); y <= rect.bottom(); y++) for (int x = rect.left(); x <= rect.right(); x++) - if (m_palette->pen_indirect(m_helper.pix16(y, x)) != BG) + if (m_palette->pen_indirect(m_helper.pix(y, x)) != BG) m_collision[i] = 1; } diff --git a/src/mame/video/usgames.cpp b/src/mame/video/usgames.cpp index b9c65025012..af8721edf66 100644 --- a/src/mame/video/usgames.cpp +++ b/src/mame/video/usgames.cpp @@ -34,7 +34,7 @@ void usgames_state::charram_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW(usgames_state::update_row) { - uint32_t *pix = &bitmap.pix32(y); + uint32_t *pix = &bitmap.pix(y); ra &= 0x07; for (int x = 0; x < x_count; x++) diff --git a/src/mame/video/uv201.cpp b/src/mame/video/uv201.cpp index 4ad0ac9c746..82710b3dcf7 100644 --- a/src/mame/video/uv201.cpp +++ b/src/mame/video/uv201.cpp @@ -81,7 +81,7 @@ ((_y >= cliprect.min_y) && (_y <= cliprect.max_y)) #define DRAW_PIXEL(_scanline, _dot) \ - if (IS_VISIBLE(_scanline)) bitmap.pix32((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; + if (IS_VISIBLE(_scanline)) bitmap.pix((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; diff --git a/src/mame/video/v1050.cpp b/src/mame/video/v1050.cpp index d2f5096562f..b045e93f1c7 100644 --- a/src/mame/video/v1050.cpp +++ b/src/mame/video/v1050.cpp @@ -57,15 +57,13 @@ void v1050_state::videoram_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) { - int column, bit; - - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { uint16_t address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column); uint8_t data = m_video_ram[address & V1050_VIDEORAM_MASK]; uint8_t attr = (m_attr & 0xfc) | (m_attr_ram[address] & 0x03); - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; int color = BIT(data, 7); @@ -82,7 +80,7 @@ MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) /* display blank */ if (attr & V1050_ATTR_BLANK) color = 0; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); data <<= 1; } diff --git a/src/mame/video/vc4000.cpp b/src/mame/video/vc4000.cpp index 5d4c1325266..fa52c41fd20 100644 --- a/src/mame/video/vc4000.cpp +++ b/src/mame/video/vc4000.cpp @@ -382,27 +382,23 @@ static const char led[20][12+1] = void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line) { - static const int digit_to_segment[0x10]={ - 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff - }; + static const int digit_to_segment[0x10]={ 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff }; - int i=line,j; + int i=line; - for (j=0; j<sizeof(led[0])-1; j++) + for (int j=0; j<sizeof(led[0])-1; j++) { if (led[i][j] != ' ' && digit_to_segment[d]&(1<<(led[i][j]-'a')) ) - bitmap.pix16(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; + bitmap.pix(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; } } inline void vc4000_state::vc4000_collision_plot(uint8_t *collision, uint8_t data, uint8_t color, int scale) { - int i,j,m; - - for (j=0,m=0x80; j<8; j++, m>>=1) + for (int j=0, m=0x80; j<8; j++, m>>=1) { if (data&m) - for (i=0; i<scale; i++, collision++) *collision|=color; + for (int i=0; i<scale; i++, collision++) *collision|=color; else collision+=scale; } @@ -576,7 +572,6 @@ inline void vc4000_state::vc4000_draw_grid(uint8_t *collision) INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) { - int x,y,i; uint8_t collision[400]={0}; // better alloca or gcc feature of non constant long automatic arrays const rectangle &visarea = m_screen->visible_area(); assert(ARRAY_LENGTH(collision) >= m_screen->width()); @@ -604,7 +599,7 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) vc4000_draw_grid(collision); /* init object colours */ - for (i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; + for (int i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; /* calculate object colours and OR overlapping object colours */ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[0]); @@ -612,20 +607,20 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[2]); vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[3]); - for (i=visarea.min_x; i<visarea.max_x; i++) + for (int i=visarea.min_x; i<visarea.max_x; i++) { m_video.sprite_collision|=m_sprite_collision[collision[i]]; m_video.background_collision|=m_background_collision[collision[i]]; /* display final object colours */ if (m_objects[i] < 8) - m_bitmap->pix16(m_video.line, i) = m_objects[i]; + m_bitmap->pix(m_video.line, i) = m_objects[i]; } - y = m_video.reg.d.score_control&1?200:20; + int y = m_video.reg.d.score_control&1?200:20; if ((m_video.line>=y)&&(m_video.line<y+20)) { - x = 60; + int x = 60; vc4000_draw_digit(*m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y); vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); if (m_video.reg.d.score_control&2) x -= 16; diff --git a/src/mame/video/vector06.cpp b/src/mame/video/vector06.cpp index 9acc3d1c823..285583f030a 100644 --- a/src/mame/video/vector06.cpp +++ b/src/mame/video/vector06.cpp @@ -15,36 +15,33 @@ uint32_t vector06_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1,code2,code3,code4; - uint8_t col; - int y, x, b,draw_y; - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); - u16 width = (m_video_mode) ? 512 : 256; + u16 const width = (m_video_mode) ? 512 : 256; rectangle screen_area(0,width+64-1,0,256+64-1); // fill border color bitmap.fill(m_color_index, screen_area); // draw image - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { // port A of 8255 also used as scroll - draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; - code1 = ram[0x8000 + x*256 + y]; - code2 = ram[0xa000 + x*256 + y]; - code3 = ram[0xc000 + x*256 + y]; - code4 = ram[0xe000 + x*256 + y]; - for (b = 0; b < 8; b++) + int const draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; + uint8_t const code1 = ram[0x8000 + x*256 + y]; + uint8_t const code2 = ram[0xa000 + x*256 + y]; + uint8_t const code3 = ram[0xc000 + x*256 + y]; + uint8_t const code4 = ram[0xe000 + x*256 + y]; + for (int b = 0; b < 8; b++) { - col = BIT(code1, b) * 8 + BIT(code2, b) * 4 + BIT(code3, b)* 2+ BIT(code4, b); + uint8_t const col = BIT(code1, b) * 8 + BIT(code2, b) * 4 + BIT(code3, b)* 2+ BIT(code4, b); if (!m_video_mode) - bitmap.pix16(draw_y, x*8+(7-b)+32) = col; + bitmap.pix(draw_y, x*8+(7-b)+32) = col; else { - bitmap.pix16(draw_y, x*16+(7-b)*2+1+32) = BIT(code2, b) * 2; - bitmap.pix16(draw_y, x*16+(7-b)*2+32) = BIT(code3, b) * 2; + bitmap.pix(draw_y, x*16+(7-b)*2+1+32) = BIT(code2, b) * 2; + bitmap.pix(draw_y, x*16+(7-b)*2+32) = BIT(code3, b) * 2; } } } diff --git a/src/mame/video/vicdual.cpp b/src/mame/video/vicdual.cpp index bbf4c0636cb..a0b0b6a25cd 100644 --- a/src/mame/video/vicdual.cpp +++ b/src/mame/video/vicdual.cpp @@ -38,8 +38,6 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi while (1) { - pen_t pen; - if ((x & 0x07) == 0) { offs_t offs; @@ -55,12 +53,12 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi } /* plot the current pixel */ - pen = (video_data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + pen_t pen = (video_data & 0x80) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = pen; /* next pixel */ - video_data = video_data << 1; - x = x + 1; + video_data <<= 1; + x++; /* end of line? */ if (x == 0) @@ -72,7 +70,7 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi } /* next row */ - y = y + 1; + y++; } } @@ -82,7 +80,7 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *color_prom = (uint8_t *)m_proms->base(); + uint8_t const *const color_prom = (uint8_t *)m_proms->base(); uint8_t x = 0; uint8_t y = cliprect.min_y; uint8_t video_data = 0; @@ -91,16 +89,13 @@ uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 while (1) { - pen_t pen; - if ((x & 0x07) == 0) { offs_t offs; - uint8_t char_code; /* read the character code */ offs = (y >> 3 << 5) | (x >> 3); - char_code = m_videoram[offs]; + uint8_t char_code = m_videoram[offs]; /* read the appropriate line of the character ram */ offs = (char_code << 3) | (y & 0x07); @@ -116,12 +111,12 @@ uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 back_pen = choose_pen(x, y, back_pen); /* plot the current pixel */ - pen = (video_data & 0x80) ? fore_pen : back_pen; - bitmap.pix32(y, x) = pen; + pen_t pen = (video_data & 0x80) ? fore_pen : back_pen; + bitmap.pix(y, x) = pen; /* next pixel */ - video_data = video_data << 1; - x = x + 1; + video_data <<= 1; + x++; /* end of line? */ if (x == 0) diff --git a/src/mame/video/victory.cpp b/src/mame/video/victory.cpp index 68545d6016d..c8179b29e18 100644 --- a/src/mame/video/victory.cpp +++ b/src/mame/video/victory.cpp @@ -1095,7 +1095,6 @@ uint32_t victory_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { int bgcollmask = (m_video_control & 4) ? 4 : 7; int count = 0; - int x, y; /* copy the palette from palette RAM */ set_palette(); @@ -1105,15 +1104,15 @@ uint32_t victory_state::screen_update(screen_device &screen, bitmap_ind16 &bitma update_background(); /* blend the bitmaps and do collision detection */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t *scanline = &bitmap.pix16(y); + uint16_t *scanline = &bitmap.pix(y); uint8_t sy = m_scrolly + y; uint8_t *fg = &m_fgbitmap[y * 256]; uint8_t *bg = &m_bgbitmap[sy * 256]; /* do the blending */ - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { int fpix = *fg++; int bpix = bg[(x + m_scrollx) & 255]; diff --git a/src/mame/video/vindictr.cpp b/src/mame/video/vindictr.cpp index dae56f5d4cd..1cdd69d0ee4 100644 --- a/src/mame/video/vindictr.cpp +++ b/src/mame/video/vindictr.cpp @@ -215,8 +215,8 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -229,7 +229,7 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in MOG3-1 = ~MAT3-1 if MAT6==1 and MSD3==1 */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -255,8 +255,8 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/volfied.cpp b/src/mame/video/volfied.cpp index dcee9a9142d..d99365cadcb 100644 --- a/src/mame/video/volfied.cpp +++ b/src/mame/video/volfied.cpp @@ -113,7 +113,7 @@ void volfied_state::refresh_pixel_layer( bitmap_ind16 &bitmap ) else color |= p[x] & 0xf; - bitmap.pix16(y, x - 1) = color; + bitmap.pix(y, x - 1) = color; } p += 512; diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp index f70e2c58b95..3429879e962 100644 --- a/src/mame/video/vtvideo.cpp +++ b/src/mame/video/vtvideo.cpp @@ -595,18 +595,18 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, // Double, 'double_height + double_width', then normal. if (double_width) { - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1)) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + (b << 1)) = bit; if (double_height) { - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; + bitmap.pix(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; } } else { - bitmap.pix16(y_preset, x_preset + b) = bit; + bitmap.pix(y_preset, x_preset + b) = bit; } } // for (8 bit) @@ -614,21 +614,21 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, if (double_width) { // double chars: 18 or 20 bits - bitmap.pix16(y_preset, DOUBLE_x_preset + 16) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 17) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 16) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 17) = bit; if (m_columns == 80) { - bitmap.pix16(y_preset, DOUBLE_x_preset + 18) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 19) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 18) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 19) = bit; } } else { // normal chars: 9 or 10 bits - bitmap.pix16(y_preset, x_preset + 8) = bit; + bitmap.pix(y_preset, x_preset + 8) = bit; if (m_columns == 80) - bitmap.pix16(y_preset, x_preset + 9) = bit; + bitmap.pix(y_preset, x_preset + 9) = bit; } /* The DEC terminals use a single ROM bitmap font and @@ -652,27 +652,27 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, { if (double_width) { - if (bitmap.pix16(y_preset, DOUBLE_x_preset + b) == fg_intensity) + if (bitmap.pix(y_preset, DOUBLE_x_preset + b) == fg_intensity) { prev_bit = fg_intensity; } else { if (prev_bit == fg_intensity) - bitmap.pix16(y_preset, DOUBLE_x_preset + b) = fg_intensity; + bitmap.pix(y_preset, DOUBLE_x_preset + b) = fg_intensity; prev_bit = back_intensity; } } else { - if (bitmap.pix16(y_preset, x_preset + b) == fg_intensity) + if (bitmap.pix(y_preset, x_preset + b) == fg_intensity) { prev_bit = fg_intensity; } else { if (prev_bit == fg_intensity) - bitmap.pix16(y_preset, x_preset + b) = fg_intensity; + bitmap.pix(y_preset, x_preset + b) = fg_intensity; prev_bit = back_intensity; } } diff --git a/src/mame/video/warpwarp.cpp b/src/mame/video/warpwarp.cpp index 53685316957..d4b05326db0 100644 --- a/src/mame/video/warpwarp.cpp +++ b/src/mame/video/warpwarp.cpp @@ -245,7 +245,7 @@ void warpwarp_state::warpwarp_videoram_w(offs_t offset, uint8_t data) inline void warpwarp_state::plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) { if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } void warpwarp_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen) diff --git a/src/mame/video/wecleman.cpp b/src/mame/video/wecleman.cpp index e771a50e8ce..2a7ec37d4cc 100644 --- a/src/mame/video/wecleman.cpp +++ b/src/mame/video/wecleman.cpp @@ -542,29 +542,21 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c }; - const uint8_t *src_ptr; - const pen_t *pal_ptr, *rgb_ptr; - - int scrollx, sy, sx; - int mdy, tdy, i; - - rgb_ptr = m_palette->pens(); + pen_t const *const rgb_ptr = m_palette->pens(); if (priority == 0x02) { // draw sky; each scanline is assumed to be dword aligned - for (sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) + for (int sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) { - uint32_t *dst = &bitmap.pix32(sy+BMP_PAD, BMP_PAD); - uint32_t pix; - uint16_t road; + uint32_t *const dst = &bitmap.pix(sy+BMP_PAD, BMP_PAD); - road = m_roadram[sy]; + uint16_t road = m_roadram[sy]; if ((road>>8) != 0x02) continue; - pix = rgb_ptr[(m_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0]; + uint32_t pix = rgb_ptr[(m_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0]; - for (sx = 0; sx < DST_WIDTH; sx++) + for (int sx = 0; sx < DST_WIDTH; sx++) dst[sx] = pix; } } @@ -573,23 +565,21 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c // draw road pen_t road_rgb[48]; - for (i=0; i<48; i++) + for (int i=0; i<48; i++) { int color = road_color[i]; road_rgb[i] = color ? rgb_ptr[color] : 0xffffffff; } - for (sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) + for (int sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) { - uint32_t *dst = &bitmap.pix32(sy+BMP_PAD, BMP_PAD); - uint32_t pix; - uint16_t road; + uint32_t *const dst = &bitmap.pix(sy+BMP_PAD, BMP_PAD); - road = m_roadram[sy]; + uint16_t road = m_roadram[sy]; if ((road>>8) != 0x04) continue; road &= YMASK; - src_ptr = m_gfxdecode->gfx(1)->get_data((road << 3)); + uint8_t const *const src_ptr = m_gfxdecode->gfx(1)->get_data((road << 3)); m_gfxdecode->gfx(1)->get_data((road << 3) + 1); m_gfxdecode->gfx(1)->get_data((road << 3) + 2); m_gfxdecode->gfx(1)->get_data((road << 3) + 3); @@ -597,20 +587,20 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c m_gfxdecode->gfx(1)->get_data((road << 3) + 5); m_gfxdecode->gfx(1)->get_data((road << 3) + 6); m_gfxdecode->gfx(1)->get_data((road << 3) + 7); - mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels(); - tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels(); + int mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels(); + int tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels(); - scrollx = m_roadram[sy+YSIZE] + (0x18 - 0xe00); + int scrollx = m_roadram[sy+YSIZE] + (0x18 - 0xe00); - pal_ptr = road_rgb + ((m_roadram[sy+(YSIZE*2)]<<3) & 8); + pen_t const *const pal_ptr = road_rgb + ((m_roadram[sy+(YSIZE*2)]<<3) & 8); - for (sx = 0; sx < DST_WIDTH; sx++, scrollx++) + for (int sx = 0; sx < DST_WIDTH; sx++, scrollx++) { if (scrollx >= 0 && scrollx < XSIZE) { pen_t temp; - pix = src_ptr[scrollx]; + uint32_t pix = src_ptr[scrollx]; dst[sx] = pal_ptr[pix]; temp = pal_ptr[pix + 16]; @@ -643,45 +633,35 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, int tmw_l2, int tmh_l2, // tilemap width and height in log(2) int alpha, int pal_offset ) // alpha(0-3f), # of color codes to shift { - const uint8_t *src_ptr; - uint16_t *tmap_ptr; - uint32_t *dst_base, *dst_ptr; - const pen_t *pal_base, *pal_ptr; - - int tilew, tileh; - int tmskipx, tmskipy, tmscanx, tmmaskx, tmmasky; - int dx, dy; - int i, j, tx, ty; - if (alpha > 0x1f) return; - tilew = gfx->width(); - tileh = gfx->height(); + int const tilew = gfx->width(); + int const tileh = gfx->height(); - tmmaskx = (1<<tmw_l2) - 1; - tmmasky = (1<<tmh_l2) - 1; + int const tmmaskx = (1<<tmw_l2) - 1; + int const tmmasky = (1<<tmh_l2) - 1; scrollx &= ((tilew<<tmw_l2) - 1); scrolly &= ((tileh<<tmh_l2) - 1); - tmskipx = scrollx / tilew; - dx = -(scrollx & (tilew-1)); - tmskipy = scrolly / tileh; - dy = -(scrolly & (tileh-1)); + int tmskipx = scrollx / tilew; + int const dx = -(scrollx & (tilew-1)); + int tmskipy = scrolly / tileh; + int const dy = -(scrolly & (tileh-1)); - dst_base = &bitmap.pix32(y0+dy, x0+dx); + uint32_t *dst_base = &bitmap.pix(y0+dy, x0+dx); - pal_base = m_palette->pens() + pal_offset * gfx->granularity(); + pen_t const *const pal_base = m_palette->pens() + pal_offset * gfx->granularity(); alpha <<= 6; dst_base += 8; - for (i = 0; i < ycount; i++) + for (int i = 0; i < ycount; i++) { - tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2); - tmscanx = tmskipx; + uint16_t const *const tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2); + int tmscanx = tmskipx; - for (j = 0; j < xcount; j++) + for (int j = 0; j < xcount; j++) { uint16_t tiledata = tmap_ptr[tmscanx++ & tmmaskx]; @@ -691,29 +671,28 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, // Wec Le Mans specific: decodes tile color in EAX uint16_t tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12); - src_ptr = gfx->get_data(tile_index); - pal_ptr = pal_base + tile_color * gfx->granularity(); - dst_ptr = dst_base + j * tilew; + uint8_t const *src_ptr = gfx->get_data(tile_index); + pen_t const *const pal_ptr = pal_base + tile_color * gfx->granularity(); + uint32_t *dst_ptr = dst_base + j * tilew; /* alpha case */ if (alpha > 0) { - for (ty = 0; ty < tileh; ty++) + for (int ty = 0; ty < tileh; ty++) { - for (tx = 0; tx < tilew; tx++) + for (int tx = 0; tx < tilew; tx++) { uint8_t srcpix = *src_ptr++; pen_t srcrgb = pal_ptr[srcpix]; uint32_t dstrgb = dst_ptr[tx]; - int sr, sg, sb, dr, dg, db; - sr = (srcrgb >> 3) & 0x1f; - sg = (srcrgb >> 11) & 0x1f; - sb = (srcrgb >> 19) & 0x1f; + int sr = (srcrgb >> 3) & 0x1f; + int sg = (srcrgb >> 11) & 0x1f; + int sb = (srcrgb >> 19) & 0x1f; - dr = (dstrgb >> 3) & 0x1f; - dg = (dstrgb >> 11) & 0x1f; - db = (dstrgb >> 19) & 0x1f; + int dr = (dstrgb >> 3) & 0x1f; + int dg = (dstrgb >> 11) & 0x1f; + int db = (dstrgb >> 19) & 0x1f; dr = (m_t32x32pm[dr - sr + alpha] >> 5) + dr; dg = (m_t32x32pm[dg - sg + alpha] >> 5) + dg; @@ -728,9 +707,9 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, /* non-alpha case */ else { - for (ty = 0; ty < tileh; ty++) + for (int ty = 0; ty < tileh; ty++) { - for (tx = 0; tx < tilew; tx++) + for (int tx = 0; tx < tilew; tx++) dst_ptr[tx] = pal_ptr[*src_ptr++]; dst_ptr += bitmap.rowpixels(); } diff --git a/src/mame/video/welltris.cpp b/src/mame/video/welltris.cpp index 3e1c60d8234..f02af708da4 100644 --- a/src/mame/video/welltris.cpp +++ b/src/mame/video/welltris.cpp @@ -85,15 +85,12 @@ void welltris_state::video_start() void welltris_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int pixdata; + for (int y = 0; y < 256; y++) { + for (int x = 0; x < 512 / 2; x++) { + int pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - for (y = 0; y < 256; y++) { - for (x = 0; x < 512 / 2; x++) { - pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - - bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; - bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; } } } diff --git a/src/mame/video/wgp.cpp b/src/mame/video/wgp.cpp index 50d77ff8f8e..f0e7b5c857d 100644 --- a/src/mame/video/wgp.cpp +++ b/src/mame/video/wgp.cpp @@ -453,8 +453,8 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const static inline void bryan2_drawscanline(bitmap_ind16 &bitmap, int x, int y, int length, const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask = 0xff) { - u16 *dsti = &bitmap.pix16(y, x); - u8 *dstp = &priority.pix8(y, x); + u16 *dsti = &bitmap.pix(y, x); + u8 *dstp = &priority.pix(y, x); if (transparent) { @@ -558,8 +558,8 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons x_step += (((0x7f - row_zoom) << 8) & 0xffff); } - u16 *src16 = &srcbitmap.pix16(src_y_index); - u8 *tsrc = &flagsbitmap.pix8(src_y_index); + const u16 *const src16 = &srcbitmap.pix(src_y_index); + const u8 *const tsrc = &flagsbitmap.pix(src_y_index); u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) diff --git a/src/mame/video/williams.cpp b/src/mame/video/williams.cpp index ec10b269a3e..0ca0c180aad 100644 --- a/src/mame/video/williams.cpp +++ b/src/mame/video/williams.cpp @@ -209,22 +209,21 @@ void williams2_state::video_start() uint32_t williams_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { rgb_t pens[16]; - int x, y; /* precompute the palette */ - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) pens[x] = m_palette->pen_color(m_paletteram[x]); /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ - for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; dest[x+0] = pens[pix >> 4]; dest[x+1] = pens[pix & 0x0f]; } @@ -249,8 +248,8 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int erase_behind = m_video_control & m_scanline_control[y] & 2; - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* latch a new color0 pen? */ if (m_video_control & m_scanline_control[y] & 1) @@ -259,7 +258,7 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; /* clear behind us if requested */ if (erase_behind) @@ -288,13 +287,13 @@ uint32_t williams2_state::screen_update(screen_device &screen, bitmap_rgb32 &bit /* loop over rows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; @@ -322,13 +321,13 @@ uint32_t mysticm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 1; x < 16; x++) pens[x] = m_palette->pen_color(color_decode(m_fg_color, 1, y) * 16 + x); - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; diff --git a/src/mame/video/wolfpack.cpp b/src/mame/video/wolfpack.cpp index 276f053dca5..ecbaea61e32 100644 --- a/src/mame/video/wolfpack.cpp +++ b/src/mame/video/wolfpack.cpp @@ -163,31 +163,24 @@ void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprec { int count = 0; - int x; - int y; - - - m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, + m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, m_torpedo_pic, 0, 0, 0, 2 * (244 - m_torpedo_h), 224 - m_torpedo_v, 0); - for (y = 16; y < 224 - m_torpedo_v; y++) + for (int y = 16; y < 224 - m_torpedo_v; y++) { - int x1; - int x2; - if (y % 16 == 1) count = (count - 1) & 7; - x1 = 248 - m_torpedo_h - count; - x2 = 248 - m_torpedo_h + count; + int const x1 = 248 - m_torpedo_h - count; + int const x2 = 248 - m_torpedo_h + count; - for (x = 2 * x1; x < 2 * x2; x++) + for (int x = 2 * x1; x < 2 * x2; x++) if (m_LFSR[(m_current_index + 0x300 * y + x) % 0x8000]) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; } } @@ -220,7 +213,7 @@ void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, c { for (int y = cliprect.top(); y <= (std::min)(cliprect.bottom(), 127); y++) { - uint16_t* p = &bitmap.pix16(y); + uint16_t *const p = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) p[x] = palette.pen_indirect(p[x]) | 0x08; @@ -286,7 +279,7 @@ WRITE_LINE_MEMBER(wolfpack_state::screen_vblank) if (y < 0 || y >= m_helper.height()) continue; - if (m_helper.pix16(y, x)) + if (m_helper.pix(y, x)) m_collision = 1; } } diff --git a/src/mame/video/wswan.cpp b/src/mame/video/wswan.cpp index de674a5a738..541e1277f42 100644 --- a/src/mame/video/wswan.cpp +++ b/src/mame/video/wswan.cpp @@ -307,11 +307,11 @@ void wswan_video_device::draw_background() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else { /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } } @@ -320,9 +320,9 @@ void wswan_video_device::draw_background() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -416,10 +416,10 @@ void wswan_video_device::draw_foreground_0() if (col) { // if (m_color_mode) { - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; // } else { // /* Hmmmm, what should we do here... Is this correct?? */ -// m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; +// m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; // } } } @@ -428,9 +428,9 @@ void wswan_video_device::draw_foreground_0() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -525,10 +525,10 @@ void wswan_video_device::draw_foreground_2() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -536,9 +536,9 @@ void wswan_video_device::draw_foreground_2() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -632,10 +632,10 @@ void wswan_video_device::draw_foreground_3() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -643,9 +643,9 @@ void wswan_video_device::draw_foreground_3() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -775,10 +775,10 @@ void wswan_video_device::handle_sprites(int mask) if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -786,9 +786,9 @@ void wswan_video_device::handle_sprites(int mask) if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } diff --git a/src/mame/video/x1.cpp b/src/mame/video/x1.cpp index af20bf5577d..e9946209f01 100644 --- a/src/mame/video/x1.cpp +++ b/src/mame/video/x1.cpp @@ -41,23 +41,23 @@ void x1_state::x1_draw_pixel(bitmap_rgb32 &bitmap, int y, int x, uint16_t pen, u if(width && height) { - bitmap.pix32(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); } else if(width) { - bitmap.pix32(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); } else if(height) { - bitmap.pix32(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); } else - bitmap.pix32(y+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+m_xstart) = m_palette->pen(pen); } #define mc6845_h_char_total (m_crtc_vreg[0]) diff --git a/src/mame/video/x68k.cpp b/src/mame/video/x68k.cpp index 170ba8f38da..661a16c55a5 100644 --- a/src/mame/video/x68k.cpp +++ b/src/mame/video/x68k.cpp @@ -51,7 +51,7 @@ rgb_t x68k_state::GGGGGRRRRRBBBBBI(uint32_t raw) inline void x68k_state::plot_pixel(bitmap_rgb32 &bitmap, int x, int y, uint32_t color) { - bitmap.pix32(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* bitmap_rgb32* ::x68k_get_gfx_page(int pri,int type) @@ -219,7 +219,7 @@ void x68k_state::draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle r + (((m_tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); // Colour 0 is displayable if the text layer is at the priority level 2 if((m_pcgpalette->pen(colour) & 0xffffff) || ((m_video.reg[1] & 0x0c00) == 0x0800)) - bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); + bitmap.pix(line, pixel) = m_pcgpalette->pen(colour); bit--; if(bit < 0) { @@ -234,17 +234,15 @@ void x68k_state::draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle r bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, uint8_t priority) { int pixel; - int page; uint32_t loc; // location in GVRAM uint32_t lineoffset; uint16_t xscr,yscr; uint16_t colour = 0; int shift; - int scanline; bool blend, ret = false; uint16_t *pal = (uint16_t *)m_gfxpalette->basemem().base(); - for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline + for(int scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline { if(m_crtc->is_1024x1024()) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer { @@ -275,11 +273,11 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui if(colour || (priority == 3)) { if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - bitmap.pix16(scanline, pixel) = colour; - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; } } loc++; @@ -291,7 +289,7 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(m_video.reg[2] & (1 << priority)) { - page = m_video.gfxlayer_pri[priority]; + int page = m_video.gfxlayer_pri[priority]; // adjust for scroll registers switch(m_video.reg[0] & 0x03) { @@ -317,23 +315,23 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(ret) { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + if(blend && bitmap.pix(scanline, pixel)) + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + bitmap.pix(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - m_special.pix16(scanline, pixel) = 0; - bitmap.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; } } - else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix16(scanline, pixel)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix(scanline, pixel)) { - bitmap.pix16(scanline, pixel) = m_special.pix16(scanline, pixel); - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = m_special.pix(scanline, pixel); + m_special.pix(scanline, pixel) = 0; } loc++; loc &= 0x1ff; @@ -363,23 +361,23 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(ret) { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + if(blend && bitmap.pix(scanline, pixel)) + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + bitmap.pix(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - bitmap.pix16(scanline, pixel) = colour; - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; } } - else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix16(scanline, pixel)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix(scanline, pixel)) { - bitmap.pix16(scanline, pixel) = m_special.pix16(scanline, pixel); - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = m_special.pix(scanline, pixel); + m_special.pix(scanline, pixel) = 0; } loc++; loc &= 0x1ff; @@ -395,7 +393,7 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { colour = m_gvram[lineoffset + loc]; if(colour || (priority == 3)) - bitmap.pix16(scanline, pixel) = colour; + bitmap.pix(scanline, pixel) = colour; loc++; loc &= 0x1ff; } @@ -435,13 +433,13 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) { if((m_video.reg[0] & 0x03) == 3) { - colour = m_gfxbitmap.pix16(scanline, pixel); + colour = m_gfxbitmap.pix(scanline, pixel); if(colour || (m_video.gfx_pri == 2)) - bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI(colour); + bitmap.pix(scanline, pixel) = GGGGGRRRRRBBBBBI(colour); } else if(gfxblend) { - colour = m_gfxbitmap.pix16(scanline, pixel); + colour = m_gfxbitmap.pix(scanline, pixel); if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) blend = true; else @@ -449,14 +447,14 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) if(colour || (m_video.gfx_pri == 2)) { if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); else - bitmap.pix32(scanline, pixel) = pal555(colour, 6, 11, 1); + bitmap.pix(scanline, pixel) = pal555(colour, 6, 11, 1); } } else { - colour = m_gfxbitmap.pix16(scanline, pixel) & 0xff; + colour = m_gfxbitmap.pix(scanline, pixel) & 0xff; if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) { blend = true; @@ -467,9 +465,9 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) if((colour && (m_gfxpalette->pen(colour) & 0xffffff)) || (m_video.gfx_pri == 2)) { if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); else - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); + bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour); } } } @@ -733,9 +731,9 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { - uint8_t colour = m_pcgbitmap.pix16(scanline, pixel) & 0xff; + uint8_t colour = m_pcgbitmap.pix(scanline, pixel) & 0xff; if((colour && (m_pcgpalette->pen(colour) & 0xffffff)) || ((m_video.reg[1] & 0x3000) == 0x2000)) - bitmap.pix32(scanline, pixel) = m_pcgpalette->pen(colour); + bitmap.pix(scanline, pixel) = m_pcgpalette->pen(colour); } } } @@ -757,9 +755,9 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { - colour = m_special.pix16(scanline, pixel) & 0xff; + colour = m_special.pix(scanline, pixel) & 0xff; if(colour) - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour & ~1); + bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour & ~1); } } } diff --git a/src/mame/video/xavix.cpp b/src/mame/video/xavix.cpp index a276ec4c662..3e5fa11035a 100644 --- a/src/mame/video/xavix.cpp +++ b/src/mame/video/xavix.cpp @@ -754,7 +754,7 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, co if ((col >= cliprect.min_x && col <= cliprect.max_x)) { - uint16_t* zyposptr = &m_zbuffer.pix16(ypos); + uint16_t *const zyposptr = &m_zbuffer.pix(ypos); if (zval >= zyposptr[col]) { @@ -762,7 +762,7 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, co if ((m_palram_sh[pen] & 0x1f) < 24) // hue values 24-31 are transparent { - uint32_t* yposptr = &bitmap.pix32(ypos); + uint32_t *const yposptr = &bitmap.pix(ypos); yposptr[col] = paldata[pen]; zyposptr[col] = zval; @@ -867,8 +867,8 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int x = 0; x < width; x++) { - uint32_t* yposptr = &bitmap.pix32(y); - uint16_t* zyposptr = &m_zbuffer.pix16(y); + uint32_t *const yposptr = &bitmap.pix(y); + uint16_t *const zyposptr = &m_zbuffer.pix(y); uint8_t dat = 0; for (int i = 0; i < bpp; i++) diff --git a/src/mame/video/xmen.cpp b/src/mame/video/xmen.cpp index 929d5b76cde..913f33100e4 100644 --- a/src/mame/video/xmen.cpp +++ b/src/mame/video/xmen.cpp @@ -106,8 +106,8 @@ uint32_t xmen_state::screen_update_xmen6p_left(screen_device &screen, bitmap_ind { for(int y = 0; y < 32 * 8; y++) { - uint16_t* line_dest = &bitmap.pix16(y); - uint16_t* line_src = &m_screen_left->pix16(y); + uint16_t *const line_dest = &bitmap.pix(y); + uint16_t const *const line_src = &m_screen_left->pix(y); for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; @@ -120,8 +120,8 @@ uint32_t xmen_state::screen_update_xmen6p_right(screen_device &screen, bitmap_in { for(int y = 0; y < 32 * 8; y++) { - uint16_t* line_dest = &bitmap.pix16(y); - uint16_t* line_src = &m_screen_right->pix16(y); + uint16_t *const line_dest = &bitmap.pix(y); + uint16_t const *const line_src = &m_screen_right->pix(y); for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; diff --git a/src/mame/video/xybots.cpp b/src/mame/video/xybots.cpp index a512800da3d..9da142807b9 100644 --- a/src/mame/video/xybots.cpp +++ b/src/mame/video/xybots.cpp @@ -98,8 +98,8 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -117,9 +117,9 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 else GPC(P3-0) = ~MOCOL3-0 */ - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) ^ 15; - int pfcolor = (pf[x] >> 4) & 0x0f; - int prien = ((mo[x] & 0x0f) > 1); + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) ^ 15; + int const pfcolor = (pf[x] >> 4) & 0x0f; + int const prien = ((mo[x] & 0x0f) > 1); if (prien) { diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index a095f703de2..3d7c47724ea 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -1221,21 +1221,19 @@ inline void ygv608_device::draw_layer_roz(screen_device &screen, bitmap_ind16 &b void ygv608_device::ygv608_draw_mosaic(bitmap_ind16 &bitmap, const rectangle &cliprect, int n) { - int x, y, mask; - if (n <= 0) { return; } // mask to drop the lowest n-bits - mask = ~((1 << n) - 1); + int const mask = ~((1 << n) - 1); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - bitmap.pix16(y, x) = bitmap.pix16(y & mask, x & mask); + bitmap.pix(y, x) = bitmap.pix(y & mask, x & mask); } } } diff --git a/src/mame/video/z88.cpp b/src/mame/video/z88.cpp index ce89fb011bb..3619cd33847 100644 --- a/src/mame/video/z88.cpp +++ b/src/mame/video/z88.cpp @@ -15,7 +15,7 @@ inline void z88_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint16_t color) { if (x < Z88_SCREEN_WIDTH) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } // convert absolute offset into correct address to get data from diff --git a/src/mame/video/zac2650.cpp b/src/mame/video/zac2650.cpp index 1102d31c7c3..8fdbe48d159 100644 --- a/src/mame/video/zac2650.cpp +++ b/src/mame/video/zac2650.cpp @@ -51,7 +51,6 @@ uint8_t zac2650_state::tinvader_port_0_r() int zac2650_state::SpriteCollision(int first,int second) { int Checksum=0; - int x,y; const rectangle &visarea = m_screen->visible_area(); if((m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (m_s2636_0_ram[second * 0x10 + 10] < 0xf0)) @@ -70,12 +69,12 @@ int zac2650_state::SpriteCollision(int first,int second) /* Get fingerprint */ - for (x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++) + for (int y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - Checksum += m_spritebitmap.pix16(y, x); + Checksum += m_spritebitmap.pix(y, x); } } @@ -89,12 +88,12 @@ int zac2650_state::SpriteCollision(int first,int second) /* Remove fingerprint */ - for (x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = fy; y < fy +m_gfxdecode->gfx(expand)->height(); y++) + for (int y = fy; y < fy +m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - Checksum -= m_spritebitmap.pix16(y, x); + Checksum -= m_spritebitmap.pix(y, x); } } @@ -137,7 +136,6 @@ void zac2650_state::video_start() void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; const rectangle &visarea = m_screen->visible_area(); /* -------------------------------------------------------------- */ @@ -156,7 +154,7 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect // for collision detection checking copybitmap(m_bitmap,bitmap,0,0,0,0,visarea); - for(offs=0;offs<0x50;offs+=0x10) + for(int offs=0;offs<0x50;offs+=0x10) { if((m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30)) { @@ -164,7 +162,6 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int expand = ((m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1; int bx = (m_s2636_0_ram[offs+10] * 4) - 22; int by = (m_s2636_0_ram[offs+12] * 3) + 3; - int x,y; /* Sprite->Background collision detection */ m_gfxdecode->gfx(expand)->transpen(bitmap,cliprect, @@ -173,12 +170,12 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect 0,0, bx,by, 0); - for (x = bx; x < bx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = bx; x < bx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = by; y < by +m_gfxdecode->gfx(expand)->height(); y++) + for (int y = by; y < by +m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - if (bitmap.pix16(y, x) != m_bitmap.pix16(y, x)) + if (bitmap.pix(y, x) != m_bitmap.pix(y, x)) { m_CollisionBackground = 0x80; break; diff --git a/src/mame/video/zaxxon.cpp b/src/mame/video/zaxxon.cpp index b85421f90e8..b9985fd4d41 100644 --- a/src/mame/video/zaxxon.cpp +++ b/src/mame/video/zaxxon.cpp @@ -304,7 +304,6 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre int ymask = pixmap.height() - 1; int flipmask = m_flip_screen ? 0xff : 0x00; int flipoffs = m_flip_screen ? 0x38 : 0x40; - int x, y; /* the starting X value is offset by 1 pixel (normal) or 7 pixels */ /* (flipped) due to a delay in the loading */ @@ -314,25 +313,23 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre flipoffs += 7; /* loop over visible rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); - int srcx, srcy, vf; - uint16_t *src; + uint16_t *const dst = &bitmap.pix(y); /* VF = flipped V signals */ - vf = y ^ flipmask; + int vf = y ^ flipmask; /* base of the source row comes from VF plus the scroll value */ /* this is done by the 3 4-bit adders at U56, U74, U75 */ - srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; - src = &pixmap.pix16(srcy & ymask); + int srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; + uint16_t const *src = &pixmap.pix(srcy & ymask); /* loop over visible columns */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* start with HF = flipped H signals */ - srcx = x ^ flipmask; + int srcx = x ^ flipmask; if (skew) { /* position within source row is a two-stage addition */ diff --git a/src/mame/video/zx.cpp b/src/mame/video/zx.cpp index d5fd7ef136d..7ce719a7e1c 100644 --- a/src/mame/video/zx.cpp +++ b/src/mame/video/zx.cpp @@ -67,7 +67,7 @@ void zx_state::refresh_w(offs_t offset, uint8_t data) if(m_ula_char_buffer & 0x80) pixels = ~pixels; if(x < 384-8 && y < 311) { - uint16_t *dest = &m_bitmap_render->pix16(y, x); + uint16_t *dest = &m_bitmap_render->pix(y, x); for(int i=0; i<8; i++) *dest++ |= pixels & (0x80 >> i) ? 1 : 0; } diff --git a/src/mame/video/zx8301.cpp b/src/mame/video/zx8301.cpp index 5904091ee2a..3e7e858f1d0 100644 --- a/src/mame/video/zx8301.cpp +++ b/src/mame/video/zx8301.cpp @@ -261,7 +261,7 @@ void zx8301_device::draw_line_mode4(bitmap_rgb32 &bitmap, int y, uint16_t da) int green = BIT(byte_high, 7); int color = (green << 1) | red; - bitmap.pix32(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; + bitmap.pix(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; byte_high <<= 1; byte_low <<= 1; @@ -306,8 +306,8 @@ void zx8301_device::draw_line_mode8(bitmap_rgb32 &bitmap, int y, uint16_t da) flash_color = color; } - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix(y, x++) = PALETTE_ZX8301[color]; byte_high <<= 2; byte_low <<= 2; diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp index 82f70c17672..b8a60aee200 100644 --- a/src/osd/modules/font/font_dwrite.cpp +++ b/src/osd/modules/font/font_dwrite.cpp @@ -146,7 +146,7 @@ HRESULT SaveBitmap2(bitmap_argb32 &bitmap, const WCHAR *filename) uint32_t* pRow = pBitmap.get() + (y * bitmap.width()); for (int x = 0; x < bitmap.width(); x++) { - uint32_t pixel = bitmap.pix32(y, x); + uint32_t pixel = bitmap.pix(y, x); pRow[x] = (pixel == 0xFFFFFFFF) ? rgb_t(0xFF, 0x00, 0x00, 0x00) : rgb_t(0xFF, 0xFF, 0xFF, 0xFF); } } @@ -570,7 +570,7 @@ public: // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &pixels[(y + actbounds.min_y) * bmwidth]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index a473b71b35a..08c1f076970 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -174,7 +174,7 @@ bool osd_font_sdl::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_ // copy the rendered character image into it for (int y = 0; y < bitmap.height(); y++) { - std::uint32_t *const dstrow = &bitmap.pix32(y); + std::uint32_t *const dstrow = &bitmap.pix(y); std::uint8_t const *const srcrow = reinterpret_cast<std::uint8_t const *>(drawsurf->pixels) + (y * drawsurf->pitch); for (int x = 0; x < drawsurf->w; x++) diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp index 95f10c0a051..4cb286c9deb 100644 --- a/src/osd/modules/font/font_windows.cpp +++ b/src/osd/modules/font/font_windows.cpp @@ -28,6 +28,7 @@ namespace { + class osd_font_windows : public osd_font { public: @@ -260,7 +261,7 @@ bool osd_font_windows::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, int32_t // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &bits[(y + actbounds.min_y) * rowbytes]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 78e3e2f226f..fc653073ecd 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -115,7 +115,7 @@ public: for (int y = 0; y < m_height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &m_frame.pix32(y); + uint32_t *dst = &m_frame.pix(y); for (int x = 0; x < m_width; x++) { @@ -343,7 +343,7 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface) for (int y = 0; y < height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &snapshot.pix32(y); + uint32_t *dst = &snapshot.pix(y); for (int x = 0; x < width; x++) { diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 3052d5fcbca..39f11a26d37 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -957,7 +957,7 @@ void renderer_bgfx::update_recording() int i = 0; for (int y = 0; y < m_avi_bitmap.height(); y++) { - uint32_t *dst = &m_avi_bitmap.pix32(y); + uint32_t *dst = &m_avi_bitmap.pix(y); for (int x = 0; x < m_avi_bitmap.width(); x++) { diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 0444bea3da1..06f2373f5ca 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -507,7 +507,7 @@ public: if (m_info.height == 524/2 || m_info.height == 624/2) { vbi_metadata vbi; - vbi_parse_all(&subbitmap.pix16(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); + vbi_parse_all(&subbitmap.pix(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); vbi_metadata_pack(&m_ldframedata[framenum * VBI_PACKED_BYTES], framenum, &vbi); } @@ -2641,9 +2641,11 @@ static void do_extract_ld(parameters_map ¶ms) report_error(1, "Unable to open file (%s)", output_file_str->second->c_str()); // create the codec configuration - avhuff_decompress_config avconfig; + avhuff_decoder::config avconfig; + bitmap_yuy16 avvideo; std::vector<int16_t> audio_data[16]; uint32_t actsamples; + avconfig.video = &avvideo; avconfig.maxsamples = max_samples_per_frame; avconfig.actsamples = &actsamples; for (int chnum = 0; chnum < ARRAY_LENGTH(audio_data); chnum++) @@ -2659,7 +2661,7 @@ static void do_extract_ld(parameters_map ¶ms) progress(framenum == input_start, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); // set up the fake bitmap for this frame - avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); + avvideo.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the hunk into the buffers diff --git a/src/tools/ldresample.cpp b/src/tools/ldresample.cpp index 57c20f7777c..a7dd165c2f9 100644 --- a/src/tools/ldresample.cpp +++ b/src/tools/ldresample.cpp @@ -237,8 +237,8 @@ static chd_error create_chd(chd_file_compressor &file, const char *filename, chd static bool read_chd(chd_file &file, uint32_t field, movie_info &info, uint32_t soundoffs) { // configure the codec - avhuff_decompress_config avconfig; - avconfig.video.wrap(info.bitmap, info.bitmap.cliprect()); + avhuff_decoder::config avconfig; + avconfig.video = &info.bitmap; avconfig.maxsamples = info.lsound.size(); avconfig.actsamples = &info.samples; avconfig.audio[0] = &info.lsound[soundoffs]; diff --git a/src/tools/ldverify.cpp b/src/tools/ldverify.cpp index deee9afba36..e8df214734c 100644 --- a/src/tools/ldverify.cpp +++ b/src/tools/ldverify.cpp @@ -235,8 +235,10 @@ static int read_chd(void *file, int frame, bitmap_yuy16 &bitmap, int16_t *lsound for (int fieldnum = 0; fieldnum < interlace_factor; fieldnum++) { // make a fake bitmap for this field - avhuff_decompress_config avconfig; - avconfig.video.wrap(&bitmap.pix16(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + bitmap_yuy16 video; + video.wrap(&bitmap.pix(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + avhuff_decoder::config avconfig; + avconfig.video = &video; // configure the codec uint32_t numsamples; @@ -320,7 +322,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) // parse the VBI data vbi_metadata metadata; - vbi_parse_all(&bitmap.pix16(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); + vbi_parse_all(&bitmap.pix(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); // if we have data in both 17 and 18, it should match if (metadata.line17 != 0 && metadata.line18 != 0 && metadata.line17 != metadata.line18) @@ -484,11 +486,11 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) { for (int x = 16; x < 720 - 16; x++) { - yhisto[bitmap.pix16(y, x) >> 8]++; + yhisto[bitmap.pix(y, x) >> 8]++; if (x % 2 == 0) - cbhisto[bitmap.pix16(y, x) & 0xff]++; + cbhisto[bitmap.pix(y, x) & 0xff]++; else - crhisto[bitmap.pix16(y, x) & 0xff]++; + crhisto[bitmap.pix(y, x) & 0xff]++; } pixels += 720 - 16 - 16; } diff --git a/src/tools/pngcmp.cpp b/src/tools/pngcmp.cpp index eb56d4a7ee7..e490d1c6811 100644 --- a/src/tools/pngcmp.cpp +++ b/src/tools/pngcmp.cpp @@ -76,8 +76,6 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img osd_file::error filerr; png_error pngerr; int error = 100; - bool bitmaps_differ; - int x, y; /* open the source image */ filerr = util::core_file::open(imgfile1, OPEN_FLAG_READ, file); @@ -114,15 +112,17 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img } /* if the sizes are different, we differ; otherwise start off assuming we are the same */ + bool bitmaps_differ; bitmaps_differ = (bitmap2.width() != bitmap1.width() || bitmap2.height() != bitmap1.height()); /* compare scanline by scanline */ - for (y = 0; y < bitmap2.height() && !bitmaps_differ; y++) + for (int y = 0; y < bitmap2.height() && !bitmaps_differ; y++) { - uint32_t *base = &bitmap1.pix32(y); - uint32_t *curr = &bitmap2.pix32(y); + uint32_t const *base = &bitmap1.pix(y); + uint32_t const *curr = &bitmap2.pix(y); /* scan the scanline */ + int x; for (x = 0; x < bitmap2.width(); x++) if (*base++ != *curr++) break; @@ -148,16 +148,16 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img /* now copy and compare each set of bitmaps */ int curheight = std::max(bitmap1.height(), bitmap2.height()); /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(y); - uint32_t *dst2 = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(y); + uint32_t *dst2 = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp index f45351272a7..5bebc733197 100644 --- a/src/tools/regrep.cpp +++ b/src/tools/regrep.cpp @@ -607,7 +607,6 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT]; summary_file *curfile; std::string title("MAME Regressions"); - std::string tempname; int listnum, bucknum; util::core_file::ptr indexfile; int count = 0, total; @@ -686,7 +685,7 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st *buckettailptr[bucknum] = nullptr; /* output header */ - tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); if (!indexfile) { @@ -721,10 +720,9 @@ static int compare_screenshots(summary_file *curfile) bitmap_argb32 bitmaps[MAX_COMPARES]; int unique[MAX_COMPARES]; int numunique = 0; - int listnum; /* iterate over all files and load their bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->status[listnum] == STATUS_SUCCESS) { std::string fullname; @@ -756,6 +754,7 @@ static int compare_screenshots(summary_file *curfile) } /* now find all the different bitmap types */ + int listnum; for (listnum = 0; listnum < list_count; listnum++) { curfile->matchbitmap[listnum] = 0xff; @@ -774,8 +773,8 @@ static int compare_screenshots(summary_file *curfile) /* compare scanline by scanline */ for (int y = 0; y < this_bitmap.height() && !bitmaps_differ; y++) { - uint32_t *base = &base_bitmap.pix32(y); - uint32_t *curr = &this_bitmap.pix32(y); + uint32_t const *base = &base_bitmap.pix(y); + uint32_t const *curr = &this_bitmap.pix(y); /* scan the scanline */ int x; @@ -831,11 +830,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, bitmap_argb32 bitmaps[MAX_COMPARES]; std::string srcimgname; std::string dstfilename; - std::string tempname; bitmap_argb32 finalbitmap; int width, height, maxwidth; int bitmapcount = 0; - int listnum, bmnum; util::core_file::ptr file; osd_file::error filerr; png_error pngerr; @@ -847,10 +844,10 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, srcimgname = string_format("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); /* open and load all unique bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->matchbitmap[listnum] == listnum) { - tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); /* open the source image */ filerr = util::core_file::open(tempname, OPEN_FLAG_READ, file); @@ -871,7 +868,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* determine the size of the final bitmap */ height = width = 0; maxwidth = bitmaps[0].width(); - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { int curwidth; @@ -891,24 +888,23 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* now copy and compare each set of bitmaps */ starty = 0; - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { - bitmap_argb32 &bitmap1 = bitmaps[0]; - bitmap_argb32 &bitmap2 = bitmaps[bmnum]; + bitmap_argb32 const &bitmap1 = bitmaps[0]; + bitmap_argb32 const &bitmap2 = bitmaps[bmnum]; int curheight = std::max(bitmap1.height(), bitmap2.height()); - int x, y; /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(starty + y, 0); - uint32_t *dst2 = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(starty + y, 0); + uint32_t *dst2 = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; |