diff options
Diffstat (limited to 'src/devices/video')
54 files changed, 832 insertions, 1049 deletions
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..f58106fb5c4 100644 --- a/src/devices/video/ef9340_1.cpp +++ b/src/devices/video/ef9340_1.cpp @@ -16,7 +16,6 @@ This is implemented with a callback. The datasheet explains how to hook up TODO: - busy state (right now it is immediate) - internal display timing (on g7400, most of it is done externally) -- read slice from internal ROM - window boxing - Y zoom @@ -35,7 +34,7 @@ TODO: DEFINE_DEVICE_TYPE(EF9340_1, ef9340_1_device, "ef9340_1", "Thomson EF9340+EF9341") -ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, EF9340_1, tag, owner, clock) , device_video_interface(mconfig, *this) , m_charset(*this, "ef9340_1") @@ -46,7 +45,7 @@ ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, ROM_START( ef9340_1 ) - ROM_REGION( 0xA00, "ef9340_1", 0 ) + ROM_REGION( 0xa00, "ef9340_1", 0 ) ROM_LOAD( "charset_ef9340_1.rom", 0x0000, 0x0a00, BAD_DUMP CRC(8de85988) SHA1(f8e3892234da6626eb4302e171179ada5a51fca8) ) // taken from datasheet ROM_END @@ -66,10 +65,10 @@ void ef9340_1_device::device_start() screen().register_screen_bitmap(m_tmp_bitmap); m_line_timer = timer_alloc(TIMER_LINE); - m_line_timer->adjust( screen().time_until_pos(0, 0), 0, screen().scan_period() ); + m_line_timer->adjust(screen().time_until_pos(0, 0), 0, screen().scan_period()); m_blink_timer = timer_alloc(TIMER_BLINK); - m_blink_timer->adjust( screen().time_until_pos(0, 0), 0, screen().frame_period() ); + m_blink_timer->adjust(screen().time_until_pos(0, 0), 0, screen().frame_period()); // zerofill m_ef9341.TA = 0; @@ -109,7 +108,7 @@ void ef9340_1_device::device_start() void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch ( id ) + switch (id) { case TIMER_LINE: ef9340_scanline(screen().vpos()); @@ -129,27 +128,27 @@ void ef9340_1_device::device_timer(emu_timer &timer, device_timer_id id, int par } -uint16_t ef9340_1_device::ef9340_get_c_addr(uint8_t x, uint8_t y) +u16 ef9340_1_device::ef9340_get_c_addr(u8 x, u8 y) { - if ( ( y & 0x18 ) == 0x18 ) + if ((y & 0x18) == 0x18) { - return 0x318 | ( ( x & 0x38 ) << 2 ) | ( x & 0x07 ); + return 0x318 | ((x & 0x38) << 2) | (x & 0x07); } - if ( x & 0x20 ) + if (x & 0x20) { - return 0x300 | ( ( y & 0x07 ) << 5 ) | ( y & 0x18 ) | ( x & 0x07 ); + return 0x300 | ((y & 0x07) << 5) | (y & 0x18) | (x & 0x07); } - return ( y & 0x1f ) << 5 | ( x & 0x1f ); + return (y & 0x1f) << 5 | (x & 0x1f); } void ef9340_1_device::ef9340_inc_c() { m_ef9340.X++; - if ( m_ef9340.X == 40 || m_ef9340.X == 48 || m_ef9340.X == 56 || m_ef9340.X == 64 ) + if (m_ef9340.X == 40 || m_ef9340.X == 48 || m_ef9340.X == 56 || m_ef9340.X == 64) { - m_ef9340.Y = ( m_ef9340.Y + 1 ) & 0x1f; - if ( m_ef9340.Y == 24 ) + m_ef9340.Y = (m_ef9340.Y + 1) & 0x1f; + if (m_ef9340.Y == 24) { m_ef9340.Y = 0; } @@ -158,27 +157,27 @@ void ef9340_1_device::ef9340_inc_c() } -void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) +void ef9340_1_device::ef9341_write(u8 command, u8 b, u8 data) { - LOG("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data ); + LOG("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data); - if ( command ) + if (command) { - if ( b ) + if (b) { m_ef9341.TB = data; m_ef9341.busy = true; - switch( m_ef9341.TB & 0xE0 ) + switch (m_ef9341.TB & 0xe0) { case 0x00: /* Begin row */ m_ef9340.X = 0; - m_ef9340.Y = m_ef9341.TA & 0x1F; + m_ef9340.Y = m_ef9341.TA & 0x1f; break; case 0x20: /* Load Y */ - m_ef9340.Y = m_ef9341.TA & 0x1F; + m_ef9340.Y = m_ef9341.TA & 0x1f; break; case 0x40: /* Load X */ - m_ef9340.X = m_ef9341.TA & 0x3F; + m_ef9340.X = m_ef9341.TA & 0x3f; break; case 0x60: /* INC C */ ef9340_inc_c(); @@ -186,13 +185,13 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) case 0x80: /* Load M */ m_ef9340.M = m_ef9341.TA; break; - case 0xA0: /* Load R */ + case 0xa0: /* Load R */ m_ef9340.R = m_ef9341.TA; break; - case 0xC0: /* Load Y0 */ - m_ef9340.Y0 = m_ef9341.TA & 0x3F; + case 0xc0: /* Load Y0 */ + m_ef9340.Y0 = m_ef9341.TA & 0x3f; break; - case 0xE0: /* Not interpreted */ + case 0xe0: /* Not interpreted */ break; } m_ef9341.busy = false; @@ -204,13 +203,13 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) } else { - if ( b ) + if (b) { - uint16_t addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff; + u16 addr = ef9340_get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff; m_ef9341.TB = data; m_ef9341.busy = true; - switch ( m_ef9340.M & 0xE0 ) + switch (m_ef9340.M & 0xe0) { case 0x00: /* Write */ m_ram_a[addr] = m_ef9341.TA; @@ -225,15 +224,15 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) case 0x80: /* Write slice */ { - uint8_t a = m_ram_a[addr]; - uint8_t b = m_ram_b[addr]; - uint8_t slice = m_ef9340.M & 0x0f; + u8 a = m_ram_a[addr]; + u8 b = m_ram_b[addr]; + u8 slice = m_ef9340.M & 0x0f; if (b >= 0xa0) m_write_exram(a << 12 | b << 4 | slice, m_ef9341.TA); // Increment slice number - m_ef9340.M = ( m_ef9340.M & 0xf0) | ( ( slice + 1 ) % 10 ); + m_ef9340.M = (m_ef9340.M & 0xf0) | ((slice + 1) % 10); } break; @@ -250,15 +249,15 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data ) } -uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) +u8 ef9340_1_device::ef9341_read(u8 command, u8 b) { - uint8_t data; + u8 data; - LOG("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A" ); + LOG("ef9341 %s read, t%s\n", command ? "command" : "data", b ? "B" : "A"); - if ( command ) + if (command) { - if ( b ) + if (b) { data = 0; } @@ -269,13 +268,13 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) } else { - if ( b ) + if (b) { - uint16_t addr = ef9340_get_c_addr( m_ef9340.X, m_ef9340.Y ) & 0x3ff; + u16 addr = ef9340_get_c_addr(m_ef9340.X, m_ef9340.Y) & 0x3ff; data = m_ef9341.TB; m_ef9341.busy = true; - switch ( m_ef9340.M & 0xE0 ) + switch (m_ef9340.M & 0xe0) { case 0x20: /* Read */ m_ef9341.TA = m_ram_a[addr]; @@ -288,22 +287,22 @@ uint8_t ef9340_1_device::ef9341_read( uint8_t command, uint8_t b ) m_ef9341.TB = m_ram_b[addr]; break; - case 0xA0: /* Read slice */ + case 0xa0: /* Read slice */ { - uint8_t a = m_ram_a[addr]; - uint8_t b = m_ram_b[addr]; - uint8_t slice = m_ef9340.M & 0x0f; + u8 a = m_ram_a[addr]; + u8 b = m_ram_b[addr]; + u8 slice = m_ef9340.M & 0x0f; m_ef9341.TA = 0xff; m_ef9341.TB = 0xff; if (b >= 0xa0) m_ef9341.TA = m_read_exram(a << 12 | b << 4 | slice); - else - logerror("ef9341 read slice from internal\n"); + else if (b < 0x80 && slice < 10) + m_ef9341.TA = m_charset[(((a & 0x80) | (b & 0x7f)) * 10) + slice]; // Increment slice number - m_ef9340.M = ( m_ef9340.M & 0xf0) | ( ( slice + 1 ) % 10 ); + m_ef9340.M = (m_ef9340.M & 0xf0) | ((slice + 1) % 10); } break; @@ -338,14 +337,14 @@ void ef9340_1_device::ef9340_scanline(int vpos) if (m_ef9340.R & 0x01 && vpos < max_vpos) { int y_row = 0; - uint16_t char_data = 0x00; - uint8_t fg = 0; - uint8_t bg = 0; + u16 char_data = 0x00; + u8 fg = 0; + u8 bg = 0; bool underline = false; bool blank = false; bool w_parity = false; - if ( vpos < 10 ) + if (vpos < 10) { // Service row if (m_ef9340.R & 0x08) @@ -357,7 +356,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; } } @@ -370,9 +369,9 @@ void ef9340_1_device::ef9340_scanline(int vpos) for (int x = 0; x < 40; x++) { int s = slice; - uint16_t addr = ef9340_get_c_addr(x, y_row); - uint8_t a = m_ram_a[addr]; - uint8_t b = m_ram_b[addr]; + u16 addr = ef9340_get_c_addr(x, y_row); + u8 a = m_ram_a[addr]; + u8 b = m_ram_b[addr]; bool blink = m_ef9340.R & 0x80 && m_ef9340.blink; bool cursor = m_ef9340.R & 0x10 && x == m_ef9340.X && y_row == m_ef9340.Y; bool invert = cursor && !blink; @@ -465,8 +464,8 @@ 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; + u16 d = blank ? 0 : (char_data & 1) ? fg : bg; + m_tmp_bitmap.pix(m_offset_y + vpos, m_offset_x + x*8 + i) = d | 8; char_data >>= 1; } @@ -480,7 +479,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 @@ -494,12 +493,12 @@ void ef9340_1_device::ef9340_scanline(int vpos) } -uint32_t ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 ef9340_1_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // 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/ef9340_1.h b/src/devices/video/ef9340_1.h index 61d1eb6d584..2d9a6671d27 100644 --- a/src/devices/video/ef9340_1.h +++ b/src/devices/video/ef9340_1.h @@ -18,7 +18,7 @@ class ef9340_1_device : public device_t, public: // construction/destruction template <typename T> - ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&screen_tag) + ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock, T &&screen_tag) : ef9340_1_device(mconfig, tag, owner, clock) { set_screen(std::forward<T>(screen_tag)); @@ -29,13 +29,13 @@ public: auto write_exram() { return m_write_exram.bind(); } // ADR0-ADR3 in a0-a3, B in a4-a11, A in a12-a19 auto read_exram() { return m_read_exram.bind(); } // " - ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + ef9340_1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); inline bitmap_ind16 *get_bitmap() { return &m_tmp_bitmap; } - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void ef9341_write( uint8_t command, uint8_t b, uint8_t data ); - uint8_t ef9341_read( uint8_t command, uint8_t b ); + void ef9341_write(u8 command, u8 b, u8 data); + u8 ef9341_read(u8 command, u8 b); protected: // device-level overrides @@ -43,7 +43,7 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual const tiny_rom_entry *device_rom_region() const override; - inline uint16_t ef9340_get_c_addr(uint8_t x, uint8_t y); + inline u16 ef9340_get_c_addr(u8 x, u8 y); inline void ef9340_inc_c(); void ef9340_scanline(int vpos); @@ -55,7 +55,7 @@ protected: emu_timer *m_line_timer; emu_timer *m_blink_timer; - required_region_ptr<uint8_t> m_charset; + required_region_ptr<u8> m_charset; bitmap_ind16 m_tmp_bitmap; @@ -64,25 +64,25 @@ protected: struct { - uint8_t TA; - uint8_t TB; + u8 TA; + u8 TB; bool busy; } m_ef9341; struct { - uint8_t X; - uint8_t Y; - uint8_t Y0; - uint8_t R; - uint8_t M; + u8 X; + u8 Y; + u8 Y0; + u8 R; + u8 M; bool blink; int blink_prescaler; bool h_parity; } m_ef9340; - uint8_t m_ram_a[0x400]; - uint8_t m_ram_b[0x400]; + u8 m_ram_a[0x400]; + u8 m_ram_b[0x400]; devcb_write8 m_write_exram; devcb_read8 m_read_exram; 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..4272f3dfeac 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -24,13 +24,13 @@ DEFINE_DEVICE_TYPE(I8245, i8245_device, "i8245", "Intel 8245") // i8244_device - constructor //------------------------------------------------- -i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +i8244_device::i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : i8244_device(mconfig, I8244, tag, owner, clock) { } -i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) +i8244_device::i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, type, tag, owner, clock) , device_sound_interface(mconfig, *this) , device_video_interface(mconfig, *this) @@ -40,7 +40,7 @@ i8244_device::i8244_device(const machine_config &mconfig, device_type type, cons } -i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +i8245_device::i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : i8244_device(mconfig, I8245, tag, owner, clock) { } @@ -135,7 +135,7 @@ void i8244_device::device_start() memset(m_vdc.reg, 0, 0x100); save_pointer(NAME(m_vdc.reg), 0x100); - memset( m_collision_map, 0, sizeof( m_collision_map ) ); + memset(m_collision_map, 0, sizeof(m_collision_map)); save_item(NAME(m_collision_map)); save_item(NAME(m_x_beam_pos)); @@ -174,13 +174,13 @@ void i8244_device::i8244_palette(palette_device &palette) const { 0xff, 0xff, 0xff } // I R G B }; - palette.set_pen_colors( 0, i8244_colors ); + palette.set_pen_colors(0, i8244_colors); } void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - switch ( id ) + switch (id) { case TIMER_HBLANK_START: // hblank starts (updates sound shift register) @@ -199,25 +199,25 @@ void i8244_device::device_timer(emu_timer &timer, device_timer_id id, int param, } -offs_t i8244_device::fix_register_mirrors( offs_t offset ) +offs_t i8244_device::fix_register_mirrors(offs_t offset) { // quad x/y registers are mirrored for each quad - if ( ( offset & 0xC2 ) == 0x40 ) + if ((offset & 0xc2) == 0x40) { - offset &= ~0x0C; + offset &= ~0x0c; } // registers $A0-$AF are mirrored at $B0-$BF - if ( ( offset & 0xE0 ) == 0xA0 ) + if ((offset & 0xe0) == 0xa0) { offset &= ~0x10; } - return offset & 0xFF; + return offset & 0xff; } -bool i8244_device::invalid_register( offs_t offset, bool rw ) +bool i8244_device::invalid_register(offs_t offset, bool rw) { // object x/y/attr registers are not accessible when display is enabled // (sprite shape registers still are) @@ -280,9 +280,9 @@ bool i8244_device::invalid_register( offs_t offset, bool rw ) } -uint8_t i8244_device::read(offs_t offset) +u8 i8244_device::read(offs_t offset) { - uint8_t data; + u8 data; offset = fix_register_mirrors(offset); @@ -337,7 +337,7 @@ uint8_t i8244_device::read(offs_t offset) } -void i8244_device::write(offs_t offset, uint8_t data) +void i8244_device::write(offs_t offset, u8 data) { offset = fix_register_mirrors(offset); @@ -470,7 +470,7 @@ void i8244_device::write_cx(int x, bool cx) } -uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* Draw background color */ bitmap.fill(bitswap<3>(m_vdc.s.color,3,4,5), cliprect); @@ -478,28 +478,28 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int scanline = cliprect.min_y; scanline <= cliprect.max_y; scanline++) { /* Clear collision map */ - memset( m_collision_map, 0, sizeof( m_collision_map ) ); + memset(m_collision_map, 0, sizeof(m_collision_map)); /* Display grid if enabled */ - if ( m_vdc.s.control & 0x08 ) + if (m_vdc.s.control & 0x08) { - uint16_t color = bitswap<4>(m_vdc.s.color,6,0,1,2); + u16 color = bitswap<4>(m_vdc.s.color,6,0,1,2); int x_grid_offset = 13; int y_grid_offset = 24; int width = 16; int height = 24; - int w = ( m_vdc.s.control & 0x80 ) ? width : 2; + int w = (m_vdc.s.control & 0x80) ? width : 2; /* Draw horizontal part of the grid */ - for ( int y = 0; y < 9; y++ ) + for (int y = 0; y < 9; y++) { - if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3 ) + if (y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3) { - for ( int i = 0; i < 9; i++ ) + for (int i = 0; i < 9; i++) { - if ( BIT(m_vdc.s.hgrid[1][i] << 8 | m_vdc.s.hgrid[0][i], y) ) + if (BIT(m_vdc.s.hgrid[1][i] << 8 | m_vdc.s.hgrid[0][i], y)) { - for ( int k = 0; k < width + 2; k++ ) + for (int k = 0; k < width + 2; k++) { int x = (x_grid_offset + i * width + k) * 2; @@ -507,8 +507,8 @@ 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; + m_collision_map[px] |= 0x20; + bitmap.pix(scanline, px) = color; } } } @@ -518,15 +518,15 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Draw dots part of the grid */ - if ( m_vdc.s.control & 0x40 ) + if (m_vdc.s.control & 0x40) { - for ( int y = 0; y < 9; y++ ) + for (int y = 0; y < 9; y++) { - if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3 ) + if (y_grid_offset + y * height <= scanline && scanline < y_grid_offset + y * height + 3) { - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - for ( int k = 0; k < 2; k++ ) + for (int k = 0; k < 2; k++) { int x = (x_grid_offset + i * width + k) * 2; @@ -534,8 +534,8 @@ 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; + m_collision_map[px] |= 0x20; + bitmap.pix(scanline, px) = color; } } } @@ -545,15 +545,15 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Draw vertical part of the grid */ - for( int j = 1, y = 0; y < 8; y++, j <<= 1 ) + for (int j = 1, y = 0; y < 8; y++, j <<= 1) { - if ( y_grid_offset + y * height <= scanline && scanline < y_grid_offset + ( y + 1 ) * height ) + if (y_grid_offset + y * height <= scanline && scanline < y_grid_offset + (y + 1) * height) { - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - if ( m_vdc.s.vgrid[i] & j ) + if (m_vdc.s.vgrid[i] & j) { - for ( int k = 0; k < w; k++ ) + for (int k = 0; k < w; k++) { int x = (x_grid_offset + i * width + k) * 2; @@ -561,8 +561,8 @@ 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; + m_collision_map[px] |= 0x10; + bitmap.pix(scanline, px) = color; } } } @@ -573,37 +573,37 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Display objects if enabled */ - if ( m_vdc.s.control & 0x20 && scanline <= 242 ) + if (m_vdc.s.control & 0x20 && scanline <= 242) { /* Quad objects */ - for ( int i = ARRAY_LENGTH( m_vdc.s.quad ) - 1; i >= 0; i-- ) + for (int i = ARRAY_LENGTH(m_vdc.s.quad) - 1; i >= 0; i--) { int y = m_vdc.s.quad[i].single[0].y; // Character height is always determined by the height of the 4th character - int height = 8 - ( ( ( y >> 1 ) + m_vdc.s.quad[i].single[3].ptr ) & 7 ); + int height = 8 - (((y >> 1) + m_vdc.s.quad[i].single[3].ptr) & 7); if (height == 1) height = 8; - if ( y <= scanline && scanline < y + height * 2 ) + if (y <= scanline && scanline < y + height * 2) { int x = (m_vdc.s.quad[i].single[0].x + 5) * 2; - for ( int j = 0; j < ARRAY_LENGTH( m_vdc.s.quad[0].single ); j++, x += 16 ) + for (int j = 0; j < ARRAY_LENGTH(m_vdc.s.quad[0].single); j++, x += 16) { - uint16_t color = 8 + ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 ); - int offset = ( m_vdc.s.quad[i].single[j].ptr | ( ( m_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 ); - uint8_t chr = m_charset[ offset & 0x1FF ]; + u16 color = 8 + ((m_vdc.s.quad[i].single[j].color >> 1) & 0x07); + int offset = (m_vdc.s.quad[i].single[j].ptr | ((m_vdc.s.quad[i].single[j].color & 0x01) << 8)) + (y >> 1) + ((scanline - y) >> 1); + u8 chr = m_charset[offset & 0x1ff]; - for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 ) + for (u8 m = 0x80; m > 0; m >>= 1, x += 2) { - if ( chr & m ) + if (chr & m) { for (int px = x; px < x + 2; px++) { if (cliprect.contains(px, scanline)) { // Check collision with self - u8 colx = m_collision_map[ px ]; + u8 colx = m_collision_map[px]; if (colx & 0x80) { colx &= ~0x80; @@ -618,8 +618,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (m_vdc.s.collision & 0x80) m_collision_status |= colx; - m_collision_map[ px ] |= 0x80; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x80; + bitmap.pix(scanline, px) = color; } } } @@ -629,29 +629,29 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Regular foreground objects */ - for ( int i = ARRAY_LENGTH( m_vdc.s.foreground ) - 1; i >= 0; i-- ) + for (int i = ARRAY_LENGTH(m_vdc.s.foreground) - 1; i >= 0; i--) { int y = m_vdc.s.foreground[i].y; - int height = 8 - ( ( ( y >> 1 ) + m_vdc.s.foreground[i].ptr ) & 7 ); + int height = 8 - (((y >> 1) + m_vdc.s.foreground[i].ptr) & 7); if (height == 1) height = 8; - if ( y <= scanline && scanline < y + height * 2 ) + if (y <= scanline && scanline < y + height * 2) { - uint16_t color = 8 + ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 ); - int offset = ( m_vdc.s.foreground[i].ptr | ( ( m_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 ); - uint8_t chr = m_charset[ offset & 0x1FF ]; + u16 color = 8 + ((m_vdc.s.foreground[i].color >> 1) & 0x07); + int offset = (m_vdc.s.foreground[i].ptr | ((m_vdc.s.foreground[i].color & 0x01) << 8)) + (y >> 1) + ((scanline - y) >> 1); + u8 chr = m_charset[offset & 0x1ff]; int x = (m_vdc.s.foreground[i].x + 5) * 2; - for ( uint8_t m = 0x80; m > 0; m >>= 1, x += 2 ) + for (u8 m = 0x80; m > 0; m >>= 1, x += 2) { - if ( chr & m ) + if (chr & m) { for (int px = x; px < x + 2; px++) { if (cliprect.contains(px, scanline)) { // Check collision with self - u8 colx = m_collision_map[ px ]; + u8 colx = m_collision_map[px]; if (colx & 0x80) { colx &= ~0x80; @@ -666,8 +666,8 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (m_vdc.s.collision & 0x80) m_collision_status |= colx; - m_collision_map[ px ] |= 0x80; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= 0x80; + bitmap.pix(scanline, px) = color; } } } @@ -676,30 +676,30 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* Sprites */ - for ( int i = ARRAY_LENGTH( m_vdc.s.sprites ) - 1; i >= 0; i-- ) + for (int i = ARRAY_LENGTH(m_vdc.s.sprites) - 1; i >= 0; i--) { int y = m_vdc.s.sprites[i].y; int height = 8; bool zoom_enable = bool(m_vdc.s.sprites[i].color & 4); int zoom_px = zoom_enable ? 4 : 2; - if ( y <= scanline && scanline < y + height * zoom_px ) + if (y <= scanline && scanline < y + height * zoom_px) { - uint16_t color = 8 + ( ( m_vdc.s.sprites[i].color >> 3 ) & 0x07 ); - uint8_t chr = m_vdc.s.shape[i][ ( ( scanline - y ) / zoom_px ) ]; + u16 color = 8 + ((m_vdc.s.sprites[i].color >> 3) & 0x07); + u8 chr = m_vdc.s.shape[i][((scanline - y) / zoom_px)]; int x = (m_vdc.s.sprites[i].x + 5) * 2; int x_shift = 0; - switch ( m_vdc.s.sprites[i].color & 0x03 ) + switch (m_vdc.s.sprites[i].color & 0x03) { case 1: // Xg attribute set x_shift = 1; break; case 2: // S attribute set - x_shift = ( ( ( scanline - y ) / zoom_px ) & 0x01 ) ^ 0x01; + x_shift = (((scanline - y) / zoom_px) & 0x01) ^ 0x01; break; case 3: // Xg and S attributes set - x_shift = ( ( scanline - y ) / zoom_px ) & 0x01; + x_shift = ((scanline - y) / zoom_px) & 0x01; break; default: break; @@ -707,9 +707,9 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap x += x_shift * (zoom_px / 2); - for ( uint8_t m = 0x01; m > 0; m <<= 1, x += zoom_px ) + for (u8 m = 0x01; m > 0; m <<= 1, x += zoom_px) { - if ( chr & m ) + if (chr & m) { for (int px = x; px < x + zoom_px; px++) { @@ -718,15 +718,15 @@ uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap u8 mask = 1 << i; // Check if we collide with an already drawn source object - if (m_vdc.s.collision & m_collision_map[ px ]) + if (m_vdc.s.collision & m_collision_map[px]) m_collision_status |= mask; // Check if an already drawn object would collide with us if (m_vdc.s.collision & mask) - m_collision_status |= m_collision_map[ px ]; + m_collision_status |= m_collision_map[px]; - m_collision_map[ px ] |= mask; - bitmap.pix16( scanline, px ) = color; + m_collision_map[px] |= mask; + bitmap.pix(scanline, px) = color; } } } @@ -783,9 +783,9 @@ void i8244_device::sound_update() // loop sound signal |= feedback << 23; - m_vdc.s.shift3 = signal & 0xFF; - m_vdc.s.shift2 = ( signal >> 8 ) & 0xFF; - m_vdc.s.shift1 = ( signal >> 16 ) & 0xFF; + m_vdc.s.shift3 = signal & 0xff; + m_vdc.s.shift2 = (signal >> 8) & 0xff; + m_vdc.s.shift1 = (signal >> 16) & 0xff; // sound interrupt if (++m_sh_count == 24) diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index 3568f5a613d..565ed13826f 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -27,68 +27,68 @@ class i8244_device : public device_t { public: // construction/destruction - i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + i8244_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // configuration helpers auto irq_cb() { return m_irq_func.bind(); } i8244_device &set_screen_size(int width, int height, int cropx = 0, int cropy = 0); - uint8_t read(offs_t offset); - void write(offs_t offset, uint8_t data); + u8 read(offs_t offset); + void write(offs_t offset, u8 data); void write_cx(int x, bool cx); // CX pin on current scanline int vblank(); int hblank(); void i8244_palette(palette_device &palette) const; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); protected: union vdc_t { - uint8_t reg[0x100]; + u8 reg[0x100]; struct { // 0x00 struct { - uint8_t y,x,color,unused; + u8 y,x,color,unused; } sprites[4]; // 0x10 struct { - uint8_t y,x,ptr,color; + u8 y,x,ptr,color; } foreground[12]; // 0x40 struct { struct { - uint8_t y,x,ptr,color; + u8 y,x,ptr,color; } single[4]; } quad[4]; // 0x80 - uint8_t shape[4][8]; + u8 shape[4][8]; // 0xa0 - uint8_t control; - uint8_t status; - uint8_t collision; - uint8_t color; - uint8_t y; - uint8_t x; - uint8_t unused; - uint8_t shift1; - uint8_t shift2; - uint8_t shift3; - uint8_t sound; - uint8_t unused2[5+0x10]; + u8 control; + u8 status; + u8 collision; + u8 color; + u8 y; + u8 x; + u8 unused; + u8 shift1; + u8 shift2; + u8 shift3; + u8 sound; + u8 unused2[5+0x10]; // 0xc0 - uint8_t hgrid[2][0x10]; - uint8_t vgrid[0x10]; - uint8_t unused3[0x10]; + u8 hgrid[2][0x10]; + u8 vgrid[0x10]; + u8 unused3[0x10]; } s; }; - i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + i8244_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); // device-level overrides virtual void device_config_complete() override; @@ -103,8 +103,8 @@ protected: int get_y_beam(); int get_x_beam(); - offs_t fix_register_mirrors( offs_t offset ); - bool invalid_register( offs_t offset, bool rw ); + offs_t fix_register_mirrors(offs_t offset); + bool invalid_register(offs_t offset, bool rw); /* timers */ static constexpr device_timer_id TIMER_VBLANK_START = 0; @@ -113,7 +113,7 @@ protected: // callbacks devcb_write_line m_irq_func; - required_region_ptr<uint8_t> m_charset; + required_region_ptr<u8> m_charset; emu_timer *m_hblank_timer; emu_timer *m_vblank_timer; @@ -135,12 +135,12 @@ protected: int m_bgate_start; vdc_t m_vdc; - uint8_t m_collision_map[0x200]; + u8 m_collision_map[0x200]; - uint8_t m_x_beam_pos = 0; - uint8_t m_y_beam_pos = 0; - uint8_t m_control_status = 0; - uint8_t m_collision_status = 0; + u8 m_x_beam_pos = 0; + u8 m_y_beam_pos = 0; + u8 m_control_status = 0; + u8 m_collision_status = 0; bool m_sh_written = false; bool m_sh_pending = false; @@ -155,7 +155,7 @@ class i8245_device : public i8244_device { public: // construction/destruction - i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + i8245_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: virtual void set_default_params() override; diff --git a/src/devices/video/imagetek_i4100.cpp b/src/devices/video/imagetek_i4100.cpp index 030314636c1..8c0eaff1011 100644 --- a/src/devices/video/imagetek_i4100.cpp +++ b/src/devices/video/imagetek_i4100.cpp @@ -59,7 +59,7 @@ 8 to 64 (independently for width and height) with an 8 pixel granularity. The "tile" address is a multiple of 8x8 pixels. - Each sprite can be shrinked to ~1/4 or enlarged to ~32x following + Each sprite can be shrunk to ~1/4 or enlarged to ~32x following an exponential curve of sizes (with one zoom value for both width and height) @@ -295,7 +295,7 @@ imagetek_i4300_device::imagetek_i4300_device(const machine_config &mconfig, cons //------------------------------------------------- // device_add_mconfig - device-specific machine -// configuration addiitons +// configuration additions //------------------------------------------------- void imagetek_i4100_device::device_add_mconfig(machine_config &config) @@ -331,6 +331,10 @@ void imagetek_i4100_device::expand_gfx1() void imagetek_i4100_device::device_start() { m_inited_hack = false; + + m_screen_blank = false; + m_screen_flip = false; + save_item(NAME(m_rombank)); save_item(NAME(m_crtc_unlock)); save_item(NAME(m_sprite_count)); @@ -395,7 +399,7 @@ void imagetek_i4100_device::vram_2_w(offs_t offset, uint16_t data, uint16_t mem_ /* Some game uses almost only the blitter to write to the tilemaps. The CPU can only access a "window" of 512x256 pixels in the upper left corner of the big tilemap */ -// TODO: Puzzlet, Sankokushi & Lady Killer contradicts with aformentioned description (more like RMW?) +// TODO: Puzzlet, Sankokushi & Lady Killer contradicts with aforementioned description (more like RMW?) static inline offs_t RMW_OFFS(offs_t offset) { @@ -923,8 +927,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 +1204,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) { |