diff options
Diffstat (limited to 'src')
1268 files changed, 13413 insertions, 15607 deletions
diff --git a/src/devices/bus/a2bus/a2bus.cpp b/src/devices/bus/a2bus/a2bus.cpp index ae5dbf82643..e09671f8f16 100644 --- a/src/devices/bus/a2bus/a2bus.cpp +++ b/src/devices/bus/a2bus/a2bus.cpp @@ -205,8 +205,6 @@ uint8_t a2bus_device::get_a2bus_nmi_mask() void a2bus_device::set_irq_line(int state, int slot) { - m_out_irq_cb(state); - if (state == CLEAR_LINE) { m_slot_irq_mask &= ~(1<<slot); @@ -215,6 +213,8 @@ void a2bus_device::set_irq_line(int state, int slot) { m_slot_irq_mask |= (1<<slot); } + + m_out_irq_cb(state); } void a2bus_device::set_nmi_line(int state, int slot) diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp index f9de57897f8..1ef164aff41 100644 --- a/src/devices/bus/a2bus/a2mcms.cpp +++ b/src/devices/bus/a2bus/a2mcms.cpp @@ -206,7 +206,7 @@ mcms_device::mcms_device(const machine_config &mconfig, const char *tag, device_ void mcms_device::device_start() { m_write_irq.resolve(); - m_stream = stream_alloc_legacy(0, 2, 31250); + m_stream = stream_alloc(0, 2, 31250); m_timer = timer_alloc(0, nullptr); m_clrtimer = timer_alloc(1, nullptr); m_enabled = false; @@ -252,20 +252,19 @@ void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param, } } -void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; int i, v; uint16_t wptr; int8_t sample; int32_t mixL, mixR; - outL = outputs[1]; - outR = outputs[0]; + auto &outL = outputs[1]; + auto &outR = outputs[0]; if (m_enabled) { - for (i = 0; i < samples; i++) + for (i = 0; i < outL.samples(); i++) { mixL = mixR = 0; @@ -286,16 +285,14 @@ void mcms_device::sound_stream_update_legacy(sound_stream &stream, stream_sample } } - outL[i] = (mixL * m_mastervol)>>9; - outR[i] = (mixR * m_mastervol)>>9; + outL.put_int(i, mixL * m_mastervol, 32768 << 9); + outR.put_int(i, mixR * m_mastervol, 32768 << 9); } } else { - for (i = 0; i < samples; i++) - { - outL[i] = outR[i] = 0; - } + outL.fill(0); + outR.fill(0); } } diff --git a/src/devices/bus/a2bus/a2mcms.h b/src/devices/bus/a2bus/a2mcms.h index 11e8b332ee0..487c6ddb7a7 100644 --- a/src/devices/bus/a2bus/a2mcms.h +++ b/src/devices/bus/a2bus/a2mcms.h @@ -42,7 +42,7 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/devices/bus/a2bus/a2ultraterm.cpp b/src/devices/bus/a2bus/a2ultraterm.cpp index 7b6caa40624..e8d5972e4ec 100644 --- a/src/devices/bus/a2bus/a2ultraterm.cpp +++ b/src/devices/bus/a2bus/a2ultraterm.cpp @@ -304,11 +304,10 @@ void a2bus_videx160_device::write_c800(uint16_t offset, uint8_t data) MC6845_UPDATE_ROW( a2bus_videx160_device::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); uint8_t chr = m_ram[ offset ]; diff --git a/src/devices/bus/a2bus/a2videoterm.cpp b/src/devices/bus/a2bus/a2videoterm.cpp index b0fda659783..839fa19e74a 100644 --- a/src/devices/bus/a2bus/a2videoterm.cpp +++ b/src/devices/bus/a2bus/a2videoterm.cpp @@ -347,7 +347,7 @@ void a2bus_videx80_device::write_c800(uint16_t offset, uint8_t data) MC6845_UPDATE_ROW( a2bus_videx80_device::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; //( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; for (int i = 0; i < x_count; i++) diff --git a/src/devices/bus/a2bus/computereyes2.cpp b/src/devices/bus/a2bus/computereyes2.cpp index b8a80819023..b8dcab00373 100644 --- a/src/devices/bus/a2bus/computereyes2.cpp +++ b/src/devices/bus/a2bus/computereyes2.cpp @@ -196,22 +196,22 @@ void a2bus_computereyes2_device::write_c0nx(uint8_t offset, uint8_t data) m_x = m_y = 0; std::fill_n(m_a2_bitmap, 280*193, 0); - m_bitmap = &m_picture->get_bitmap(); - if (m_bitmap) + const bitmap_argb32 &bitmap = m_picture->get_bitmap(); + if (bitmap.valid()) { // convert arbitrary sized ARGB32 image to a 188x193 image with 256 levels of grayscale - double stepx = (double)m_bitmap->width() / 188.0; - double stepy = (double)m_bitmap->height() / 193.0; + double stepx = (double)bitmap.width() / 188.0; + double stepy = (double)bitmap.height() / 193.0; for (int y = 0; y < 193; y++) { for (int x = 0; x < 280; x++) { - u32 pixel = m_bitmap->pix((int)((double)y * stepy), (int)((double)x * stepx)); - double mono = ((0.2126 * (double)(((pixel>>16) & 0xff) / 255.0)) + - (0.7152 * (double)(((pixel>>8) & 0xff) / 255.0)) + - (0.0722 * (double)((pixel& 0xff) / 255.0))); - m_a2_bitmap[(y*280)+x] = (u8)(mono * 255.0); + u32 pixel = bitmap.pix(int((double)y * stepy), int((double)x * stepx)); + double mono = ((0.2126 * double(((pixel>>16) & 0xff) / 255.0)) + + (0.7152 * double(((pixel>>8) & 0xff) / 255.0)) + + (0.0722 * double((pixel& 0xff) / 255.0))); + m_a2_bitmap[(y*280)+x] = u8(mono * 255.0); } } } diff --git a/src/devices/bus/a2bus/computereyes2.h b/src/devices/bus/a2bus/computereyes2.h index 31856f08813..a69600b6de2 100644 --- a/src/devices/bus/a2bus/computereyes2.h +++ b/src/devices/bus/a2bus/computereyes2.h @@ -46,7 +46,6 @@ private: u8 m_a2_bitmap[280*193]; u8 m_threshold; bool m_bActive; - bitmap_argb32 *m_bitmap; }; // device type definition diff --git a/src/devices/bus/a2gameio/computereyes.cpp b/src/devices/bus/a2gameio/computereyes.cpp index 1c587f54254..af597361c8e 100644 --- a/src/devices/bus/a2gameio/computereyes.cpp +++ b/src/devices/bus/a2gameio/computereyes.cpp @@ -82,23 +82,22 @@ WRITE_LINE_MEMBER(apple2_compeyes_device::an0_w) std::fill_n(m_a2_bitmap, 280*192, 0); - m_bitmap = &m_picture->get_bitmap(); - if (m_bitmap) + const bitmap_argb32 &bitmap = m_picture->get_bitmap(); + if (bitmap.valid()) { // convert arbitrary sized ARGB32 image to a 280x192 image with 256 levels of grayscale - double stepx = (double)m_bitmap->width() / 280.0; - double stepy = (double)m_bitmap->height() / 192.0; - + double stepx = (double)bitmap.width() / 280.0; + double stepy = (double)bitmap.height() / 192.0; for (int y = 0; y < 192; y++) { for (int x = 0; x < 280; x++) { - u32 pixel = m_bitmap->pix((int)((double)y * stepy), (int)((double)x * stepx)); - double mono = ((0.2126 * (double)(((pixel>>16) & 0xff) / 255.0)) + - (0.7152 * (double)(((pixel>>8) & 0xff) / 255.0)) + - (0.0722 * (double)((pixel& 0xff) / 255.0))); - m_a2_bitmap[(y*280)+x] = (u8)(mono * 255.0); + u32 pixel = bitmap.pix(int((double)y * stepy), int((double)x * stepx)); + double mono = ((0.2126 * double(((pixel>>16) & 0xff) / 255.0)) + + (0.7152 * double(((pixel>>8) & 0xff) / 255.0)) + + (0.0722 * double((pixel& 0xff) / 255.0))); + m_a2_bitmap[(y*280)+x] = u8(mono * 255.0); } } } diff --git a/src/devices/bus/a2gameio/computereyes.h b/src/devices/bus/a2gameio/computereyes.h index 6aef78796a6..9445ce4df25 100644 --- a/src/devices/bus/a2gameio/computereyes.h +++ b/src/devices/bus/a2gameio/computereyes.h @@ -41,7 +41,6 @@ private: required_device<picture_image_device> m_picture; int m_x, m_y, m_an1, m_an2, m_an3, m_level; u8 m_a2_bitmap[280*192]; - bitmap_argb32 *m_bitmap; }; // device type declaration diff --git a/src/devices/bus/acorn/system/vdu40.cpp b/src/devices/bus/acorn/system/vdu40.cpp index dcee8cd9b53..7bc8629ac35 100644 --- a/src/devices/bus/acorn/system/vdu40.cpp +++ b/src/devices/bus/acorn/system/vdu40.cpp @@ -93,7 +93,7 @@ void acorn_vdu40_device::device_reset() MC6845_UPDATE_ROW(acorn_vdu40_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); diff --git a/src/devices/bus/acorn/system/vdu80.cpp b/src/devices/bus/acorn/system/vdu80.cpp index 5cf995d8d3c..77bad0bf32c 100644 --- a/src/devices/bus/acorn/system/vdu80.cpp +++ b/src/devices/bus/acorn/system/vdu80.cpp @@ -172,7 +172,7 @@ void acorn_vdu80_device::device_reset() MC6845_UPDATE_ROW(acorn_vdu80_device::crtc_update_row) { uint8_t invert = BIT(m_links->read(), 1); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int column = 0; column < x_count; column++) { diff --git a/src/devices/bus/bbc/1mhzbus/m5000.h b/src/devices/bus/bbc/1mhzbus/m5000.h index bf11943d7cd..d2507ab4abe 100644 --- a/src/devices/bus/bbc/1mhzbus/m5000.h +++ b/src/devices/bus/bbc/1mhzbus/m5000.h @@ -63,8 +63,8 @@ private: bool m_disable; bool m_modulate; - stream_sample_t m_sam_l[16]; - stream_sample_t m_sam_r[16]; + int32_t m_sam_l[16]; + int32_t m_sam_r[16]; emu_timer *m_dsp_timer; diff --git a/src/devices/bus/bbc/userport/lcd.cpp b/src/devices/bus/bbc/userport/lcd.cpp index cdc70bc35fe..f5f92270ca9 100644 --- a/src/devices/bus/bbc/userport/lcd.cpp +++ b/src/devices/bus/bbc/userport/lcd.cpp @@ -87,7 +87,7 @@ HD44780_PIXEL_UPDATE(bbc_lcd_device::lcd_pixel_update) } if (line < 4) - bitmap.pix16(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2; + bitmap.pix(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2; } } diff --git a/src/devices/bus/c64/xl80.cpp b/src/devices/bus/c64/xl80.cpp index 8f0f35b523f..6bfa6e9d8cd 100644 --- a/src/devices/bus/c64/xl80.cpp +++ b/src/devices/bus/c64/xl80.cpp @@ -85,12 +85,12 @@ const tiny_rom_entry *c64_xl80_device::device_rom_region() const MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int column = 0; column < x_count; column++) { - uint8_t code = m_ram[((ma + column) & 0x7ff)]; - uint16_t addr = (code << 3) | (ra & 0x07); + uint8_t const code = m_ram[((ma + column) & 0x7ff)]; + uint16_t const addr = (code << 3) | (ra & 0x07); uint8_t data = m_char_rom->base()[addr & 0x7ff]; if (column == cursor_x) @@ -100,10 +100,10 @@ MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; + int const x = (column * 8) + bit; + int const color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/devices/bus/centronics/epson_lx810l.cpp b/src/devices/bus/centronics/epson_lx810l.cpp index 1d9c0ac8577..2744ea3e3ac 100644 --- a/src/devices/bus/centronics/epson_lx810l.cpp +++ b/src/devices/bus/centronics/epson_lx810l.cpp @@ -575,9 +575,9 @@ WRITE_LINE_MEMBER( epson_lx810l_device::co0_w ) */ if (m_real_cr_pos < m_bitmap.width()) { for (int i = 0; i < 9; i++) { - unsigned int y = bitmap_line(i); + unsigned int const y = bitmap_line(i); if ((m_printhead & (1<<(8-i))) != 0) - m_bitmap.pix32(y, m_real_cr_pos + CR_OFFSET) = 0x000000; + m_bitmap.pix(y, m_real_cr_pos + CR_OFFSET) = 0x000000; } } } diff --git a/src/devices/bus/coco/coco_ssc.cpp b/src/devices/bus/coco/coco_ssc.cpp index 63f6e90fcc5..3677010648f 100644 --- a/src/devices/bus/coco/coco_ssc.cpp +++ b/src/devices/bus/coco/coco_ssc.cpp @@ -130,7 +130,7 @@ namespace virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream* m_stream; @@ -535,25 +535,25 @@ cocossc_sac_device::cocossc_sac_device(const machine_config &mconfig, const char void cocossc_sac_device::device_start() { - m_stream = stream_alloc_legacy(1, 1, machine().sample_rate()); + m_stream = stream_alloc(1, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void cocossc_sac_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cocossc_sac_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t const *src = inputs[0]; - stream_sample_t *dst = outputs[0]; + auto &src = inputs[0]; + auto &dst = outputs[0]; - double n = samples; + double n = dst.samples(); - while (samples--) + for (int sampindex = 0; sampindex < n; sampindex++) { - m_rms[m_index] += ( (double)*src * (double)*src ); - *dst++ = (*src++); + m_rms[m_index] += src.get(sampindex) * src.get(sampindex); + dst.put(sampindex, src.get(sampindex)); } m_rms[m_index] = m_rms[m_index] / n; @@ -576,7 +576,7 @@ bool cocossc_sac_device::sound_activity_circuit_output() average /= 16.0; - if( average > 10400.0 ) + if( average > 0.317 ) return true; return false; diff --git a/src/devices/bus/compis/hrg.cpp b/src/devices/bus/compis/hrg.cpp index 7aa8aa72f7e..1612729e706 100644 --- a/src/devices/bus/compis/hrg.cpp +++ b/src/devices/bus/compis/hrg.cpp @@ -51,11 +51,11 @@ void compis_uhrg_device::uhrg_map(address_map &map) UPD7220_DISPLAY_PIXELS_MEMBER( compis_hrg_device::display_pixels ) { - uint16_t i,gfx = m_video_ram[(address & 0x7fff) >> 1]; - const pen_t *pen = m_palette->pens(); + uint16_t const gfx = m_video_ram[(address & 0x7fff) >> 1]; + pen_t const *const pen = m_palette->pens(); - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; + for(uint16_t i=0; i<16; i++) + bitmap.pix(y, x + i) = pen[BIT(gfx, i)]; } @@ -65,11 +65,11 @@ UPD7220_DISPLAY_PIXELS_MEMBER( compis_hrg_device::display_pixels ) UPD7220_DISPLAY_PIXELS_MEMBER( compis_uhrg_device::display_pixels ) { - uint16_t i,gfx = m_video_ram[(address & 0x1ffff) >> 1]; - const pen_t *pen = m_palette->pens(); + uint16_t const gfx = m_video_ram[(address & 0x1ffff) >> 1]; + pen_t const *const pen = m_palette->pens(); - for(i=0; i<16; i++) - bitmap.pix32(y, x + i) = pen[BIT(gfx, i)]; + for(uint16_t i=0; i<16; i++) + bitmap.pix(y, x + i) = pen[BIT(gfx, i)]; } diff --git a/src/devices/bus/comx35/clm.cpp b/src/devices/bus/comx35/clm.cpp index ebf7e1f271e..192e5989a36 100644 --- a/src/devices/bus/comx35/clm.cpp +++ b/src/devices/bus/comx35/clm.cpp @@ -104,8 +104,8 @@ MC6845_UPDATE_ROW( comx_clm_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - uint8_t code = m_video_ram[((ma + column) & 0x7ff)]; - uint16_t addr = (code << 3) | (ra & 0x07); + uint8_t const code = m_video_ram[((ma + column) & 0x7ff)]; + uint16_t const addr = (code << 3) | (ra & 0x07); uint8_t data = m_char_rom->base()[addr & 0x7ff]; if (BIT(ra, 3) && column == cursor_x) @@ -115,9 +115,9 @@ MC6845_UPDATE_ROW( comx_clm_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de); data <<= 1; } diff --git a/src/devices/bus/ecbbus/grip.cpp b/src/devices/bus/ecbbus/grip.cpp index 97a33298171..659bab524ad 100644 --- a/src/devices/bus/ecbbus/grip.cpp +++ b/src/devices/bus/ecbbus/grip.cpp @@ -179,35 +179,33 @@ MC6845_UPDATE_ROW( ecb_grip21_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - uint16_t address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); - uint8_t data = m_video_ram[address]; + uint16_t const address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); + uint8_t const data = m_video_ram[address]; for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = (m_flash ? 0 : BIT(data, bit)) && de; + int const x = (column * 8) + bit; + int const color = (m_flash ? 0 : BIT(data, bit)) && de; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(color); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(color); } } } /* MC6845_UPDATE_ROW( ecb_grip21_device::grip5_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int column, bit; - - for (column = 0; column < x_count; column++) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + for (int column = 0; column < x_count; column++) { - uint16_t address = (m_dpage << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); - uint8_t data = m_video_ram[address]; + uint16_t const address = (m_dpage << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07); + uint8_t const data = m_video_ram[address]; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = m_flash ? 0 : BIT(data, bit); + int const x = (column * 8) + bit; + int const color = m_flash ? 0 : BIT(data, bit); - bitmap.pix32(y, x) = palette[color]; + bitmap.pix(y, x) = palette[color]; } } } diff --git a/src/devices/bus/einstein/pipe/tk02.cpp b/src/devices/bus/einstein/pipe/tk02.cpp index b0cf5998131..74cd880e151 100644 --- a/src/devices/bus/einstein/pipe/tk02.cpp +++ b/src/devices/bus/einstein/pipe/tk02.cpp @@ -185,14 +185,14 @@ MC6845_UPDATE_ROW( tk02_device::crtc_update_row ) if (i == cursor_x) data ^= 0xff; - bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, i * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, i * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, i * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, i * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, i * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, i * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, i * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, i * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/devices/bus/electron/mode7.cpp b/src/devices/bus/electron/mode7.cpp index 103c861c4ae..408b6a92300 100644 --- a/src/devices/bus/electron/mode7.cpp +++ b/src/devices/bus/electron/mode7.cpp @@ -195,7 +195,7 @@ void electron_mode7_device::expbus_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW(electron_mode7_device::crtc_update_row) { - uint32_t* p = &bitmap.pix32(y); + uint32_t* p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); diff --git a/src/devices/bus/gio64/newport.cpp b/src/devices/bus/gio64/newport.cpp index 1be643afddd..142947b4ae0 100644 --- a/src/devices/bus/gio64/newport.cpp +++ b/src/devices/bus/gio64/newport.cpp @@ -1302,7 +1302,7 @@ uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32 /* loop over rows and copy to the destination */ for (int y = cliprect.min_y, sy = y_start; y <= cliprect.max_y && sy < y_end; y++, sy++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); const uint32_t *src_rgbci = m_rb2->rgbci(y); const uint32_t *src_cidaux = m_rb2->cidaux(y); diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp index bd96c95852d..eb73c56c6f4 100644 --- a/src/devices/bus/hp_dio/hp98543.cpp +++ b/src/devices/bus/hp_dio/hp98543.cpp @@ -235,7 +235,7 @@ uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 & } for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { uint8_t tmp = m_vram[y * m_h_pix + x]; diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp index 842a7a78229..e5aced877d8 100644 --- a/src/devices/bus/hp_dio/hp98544.cpp +++ b/src/devices/bus/hp_dio/hp98544.cpp @@ -165,26 +165,20 @@ WRITE_LINE_MEMBER(dio16_98544_device::int_w) uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int startx, starty, endx, endy; - - if (!m_topcat->has_changed()) return UPDATE_HAS_NOT_CHANGED; for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { uint8_t tmp = m_vram[y * m_h_pix + x]; *scanline++ = tmp ? rgb_t(255,255,255) : rgb_t(0, 0, 0); } } + int startx, starty, endx, endy; m_topcat->get_cursor_pos(startx, starty, endx, endy); - - for (int y = starty; y <= endy; y++) { - uint32_t *scanline = &bitmap.pix32(y); - memset(scanline + startx, 0xff, (endx - startx) << 2); - } + bitmap.fill(rgb_t(255, 255, 255), rectangle(startx, endx, starty, endy)); return 0; } diff --git a/src/devices/bus/hp_dio/hp98550.cpp b/src/devices/bus/hp_dio/hp98550.cpp index 738926eae77..38f70d2d670 100644 --- a/src/devices/bus/hp_dio/hp98550.cpp +++ b/src/devices/bus/hp_dio/hp98550.cpp @@ -218,7 +218,7 @@ uint32_t dio32_98550_device::screen_update(screen_device &screen, bitmap_rgb32 & mask |= ce->plane_enabled(); for (int y = 0; y < m_v_pix; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < m_h_pix; x++) { const int offset = y * m_fb_width +x; diff --git a/src/devices/bus/iq151/grafik.cpp b/src/devices/bus/iq151/grafik.cpp index 304bcf87b43..497012cf2cd 100644 --- a/src/devices/bus/iq151/grafik.cpp +++ b/src/devices/bus/iq151/grafik.cpp @@ -178,7 +178,7 @@ void iq151_grafik_device::video_update(bitmap_ind16 &bitmap, const rectangle &cl { for (int ra = 0; ra < 8; ra++) { - bitmap.pix16(y, x*8 + ra) |= BIT(m_videoram[(32*8 -1 - y)*64 + x], ra); + bitmap.pix(y, x*8 + ra) |= BIT(m_videoram[(32*8 -1 - y)*64 + x], ra); } } } diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp index d5bf2da1f8b..e0962048411 100644 --- a/src/devices/bus/iq151/minigraf.cpp +++ b/src/devices/bus/iq151/minigraf.cpp @@ -162,7 +162,7 @@ void iq151_minigraf_device::plotter_update(uint8_t control) // if pen is down draws a point if (m_pen) - m_paper->pix16(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; + m_paper->pix(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; m_control = control; } diff --git a/src/devices/bus/iq151/ms151a.cpp b/src/devices/bus/iq151/ms151a.cpp index 447c9f0d43a..651e82bfe6f 100644 --- a/src/devices/bus/iq151/ms151a.cpp +++ b/src/devices/bus/iq151/ms151a.cpp @@ -164,5 +164,5 @@ void iq151_ms151a_device::plotter_update(uint8_t offset, uint8_t data) // if pen is down draws a point if (m_pen) - m_paper->pix16(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; + m_paper->pix(((PAPER_HEIGHT-PAPER_MAX_Y)/2) + m_posy, ((PAPER_WIDTH-PAPER_MAX_X)/2) + m_posx) = 1; } diff --git a/src/devices/bus/iq151/video32.cpp b/src/devices/bus/iq151/video32.cpp index fce21b963e9..2d3f75b66ed 100644 --- a/src/devices/bus/iq151/video32.cpp +++ b/src/devices/bus/iq151/video32.cpp @@ -126,7 +126,7 @@ void iq151_video32_device::video_update(bitmap_ind16 &bitmap, const rectangle &c { for (int ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (int x = ma; x < ma + 32; x++) { diff --git a/src/devices/bus/iq151/video64.cpp b/src/devices/bus/iq151/video64.cpp index a965abbd19e..487bf63ca33 100644 --- a/src/devices/bus/iq151/video64.cpp +++ b/src/devices/bus/iq151/video64.cpp @@ -140,7 +140,7 @@ void iq151_video64_device::video_update(bitmap_ind16 &bitmap, const rectangle &c { for (int ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (int x = ma; x < ma + 64; x++) { diff --git a/src/devices/bus/isa/aga.cpp b/src/devices/bus/isa/aga.cpp index 244fbc0bb66..81e6ba053fe 100644 --- a/src/devices/bus/isa/aga.cpp +++ b/src/devices/bus/isa/aga.cpp @@ -288,7 +288,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; if (y == 0) logerror("mda_text_inten_update_row\n"); @@ -345,7 +345,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; if (y == 0) logerror("mda_text_blink_update_row\n"); @@ -402,7 +402,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_inten_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -431,7 +431,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_inten_alt_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -459,7 +459,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { uint16_t const offset = ((ma + i) << 1) & 0x3fff; @@ -491,7 +491,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_text_blink_alt_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -526,7 +526,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row ) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t const *const videoram = m_videoram.get(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_gfx_4bppl_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -551,7 +551,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); if (y == 0) logerror("cga_gfx_4bpph_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -584,7 +584,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); //if (y == 0) logerror("cga_gfx_2bpp_update_row\n"); for (int i = 0; i < x_count; i++) { @@ -609,7 +609,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_1bpp_update_row ) { uint8_t const *const videoram = m_videoram.get(); rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint8_t const fg = m_cga_color_select & 0x0f; if (y == 0) logerror("cga_gfx_1bpp_update_row\n"); diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index ff30f3690ad..52a0407f065 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -469,47 +469,43 @@ isa8_cga_superimpose_device::isa8_cga_superimpose_device(const machine_config &m template<bool blink, bool si, bool comp, bool alt, int width> MC6845_UPDATE_ROW( isa8_cga_device::cga_text ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_text_8",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_text_8",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff; - uint8_t chr = videoram[ offset ]; - uint8_t attr = videoram[ offset +1 ]; - uint8_t data = m_chr_gen[ chr * width + ra ]; + uint16_t const offset = ((ma + i) << 1) & 0x3fff; + uint8_t const chr = videoram[offset]; + uint8_t const attr = videoram[offset +1]; + uint8_t data = m_chr_gen[chr * width + ra]; uint16_t fg, bg; - uint8_t xi; - if ( comp ) + if (comp) { - fg = 0x10 + ( attr & 0x0F ); - bg = alt ? 0 : ( 0x10 + ( ( attr >> 4 ) & 0x07 ) ); + fg = 0x10 + (attr & 0x0f); + bg = alt ? 0 : (0x10 + ((attr >> 4) & 0x07)); } else { fg = attr & 0x0F; - bg = alt ? 0 : ( ( attr >> 4 ) & ( blink ? 0x07 : 0x0f ) ); + bg = alt ? 0 : ((attr >> 4) & (blink ? 0x07 : 0x0f)); } - if ( ( i == cursor_x ) && ( m_framecnt & 0x08 ) ) - data = 0xFF; - else if ( blink && ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((i == cursor_x) && (m_framecnt & 0x08)) + data = 0xff; + else if (blink && (attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; - bg = ( attr >> 4 ) & 0x07; + bg = (attr >> 4) & 0x07; } - for(xi=0;xi<8;xi++) + for (int xi = 0; xi < 8; xi++) { - uint8_t pen_data, dot; - - dot = (data & (1 << (7-xi))); - pen_data = dot ? fg : bg; - if(!si || (pen_data || dot)) + uint8_t const dot = (data & (1 << (7 - xi))); + uint8_t const pen_data = dot ? fg : bg; + if (!si || (pen_data || dot)) *p = palette[pen_data]; p++; } @@ -521,28 +517,29 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_text ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bppl_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((y & 1) << 13); + uint8_t data; + + data = videoram[offset]; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; - data = videoram[ offset + 1 ]; + data = videoram[offset + 1]; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; } } @@ -580,37 +577,37 @@ static const uint8_t yc_lut[16][8] = MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bpph_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; - - if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( y & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data >> 4]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; - *p = palette[data & 0x0F]; p++; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((y & 1) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + + data = videoram[offset + 1]; + + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data >> 4]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; + *p++ = palette[data & 0x0f]; } } @@ -623,28 +620,29 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_4bpph_update_row ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_2bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - if ( y == 0 ) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint8_t data; + + data = videoram[offset]; - *p = palette[m_palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ data & 0x03 ]]; p++; + *p++ = palette[m_palette_lut_2bpp[(data >> 6) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 4) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 2) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[ data & 0x03]]; - data = videoram[ offset+1 ]; + data = videoram[offset + 1]; - *p = palette[m_palette_lut_2bpp[ ( data >> 6 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 4 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ ( data >> 2 ) & 0x03 ]]; p++; - *p = palette[m_palette_lut_2bpp[ data & 0x03 ]]; p++; + *p++ = palette[m_palette_lut_2bpp[(data >> 6) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 4) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[(data >> 2) & 0x03]]; + *p++ = palette[m_palette_lut_2bpp[ data & 0x03]]; } } @@ -658,37 +656,38 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_2bpp_update_row ) MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_1bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0f; - if ( y == 0 ) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 1 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; + + data = videoram[offset + 1]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; } } @@ -961,205 +960,200 @@ void isa8_cga_device::io_write(offs_t offset, uint8_t data) // proc = cga_pgfx_4bpp; // -//static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, -// int x, int y, int offs) -//{ -// int color, values[2]; -// int i; -// -// if (cga.plantronics & 0x40) -// { -// values[0] = videoram[offs | 0x4000]; -// values[1] = videoram[offs]; -// } -// else -// { -// values[0] = videoram[offs]; -// values[1] = videoram[offs | 0x4000]; -// } -// for (i=3; i>=0; i--) -// { -// color = ((values[0] & 0x3) << 1) | -// ((values[1] & 2) >> 1) | -// ((values[1] & 1) << 3); -// bitmap.pix16(y, x+i) = Machine->pens[color]; -// values[0]>>=2; -// values[1]>>=2; -// } -//} -// -// -// +#if 0 +static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, int x, int y, int offs) +{ + int values[2]; + + if (cga.plantronics & 0x40) + { + values[0] = videoram[offs | 0x4000]; + values[1] = videoram[offs]; + } + else + { + values[0] = videoram[offs]; + values[1] = videoram[offs | 0x4000]; + } + for (int i = 3; i >= 0; i--) + { + int const color = + ((values[0] & 0x3) << 1) | + ((values[1] & 2) >> 1) | + ((values[1] & 1) << 3); + bitmap.pix(y, x + i) = Machine->pens[color]; + values[0] >>= 2; + values[1] >>= 2; + } +} +#endif + + ///*************************************************************************** // Draw graphics mode with 640x200 pixels (default) with 2 bits/pixel. // Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 // Second plane at CGA_base + 0x4000 / 0x6000 -//***************************************************************************/ -// -//static void cga_pgfx_4bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) -//{ -// int i, sx, sy, sh; -// int offs = mscrtc6845_get_start(crtc)*2; -// int lines = mscrtc6845_get_char_lines(crtc); -// int height = mscrtc6845_get_char_height(crtc); -// int columns = mscrtc6845_get_char_columns(crtc)*2; -// -// for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) -// { -// for (sh=0; sh<height; sh++, offs|=0x2000) -// { -// // char line 0 used as a12 line in graphic mode -// if (!(sh & 1)) -// { -// for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) -// { -// pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); -// } -// } -// else -// { -// for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) -// { -// pgfx_plot_unit_4bpp(bitmap, sx*4, sy*height+sh, i); -// } -// } -// } -// } -//} -// -// -// -//static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, -// int x, int y, const uint16_t *palette, int offs) -//{ -// int i; -// uint8_t bmap[2], values[2]; -// uint16_t *dest; -// -// if (cga.plantronics & 0x40) -// { -// values[0] = videoram[offs]; -// values[1] = videoram[offs | 0x4000]; -// } -// else -// { -// values[0] = videoram[offs | 0x4000]; -// values[1] = videoram[offs]; -// } -// bmap[0] = bmap[1] = 0; -// for (i=3; i>=0; i--) -// { -// bmap[0] = bmap[0] << 1; if (values[0] & 0x80) bmap[0] |= 1; -// bmap[0] = bmap[0] << 1; if (values[1] & 0x80) bmap[0] |= 1; -// bmap[1] = bmap[1] << 1; if (values[0] & 0x08) bmap[1] |= 1; -// bmap[1] = bmap[1] << 1; if (values[1] & 0x08) bmap[1] |= 1; -// values[0] = values[0] << 1; -// values[1] = values[1] << 1; -// } -// -// dest = &bitmap.pix16(y, x); -// *(dest++) = palette[(bmap[0] >> 6) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 4) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 2) & 0x03]; -// *(dest++) = palette[(bmap[0] >> 0) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 6) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 4) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 2) & 0x03]; -// *(dest++) = palette[(bmap[1] >> 0) & 0x03]; -//} -// -// -// +//**************************************************************************** + +#if 0 +static void cga_pgfx_4bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) +{ + int offs = mscrtc6845_get_start(crtc) * 2; + int const lines = mscrtc6845_get_char_lines(crtc); + int const height = mscrtc6845_get_char_height(crtc); + int columns = mscrtc6845_get_char_columns(crtc) * 2; + + for (int sy = 0; sy < lines; sy++, offs = (offs + columns) & 0x1fff) + { + for (int sh = 0; sh < height; sh++, offs |= 0x2000) + { + // char line 0 used as a12 line in graphic mode + if (!(sh & 1)) + { + for (int i = offs, sx = 0; sx < columns; sx++, i = (i + 1) & 0x1fff) + { + pgfx_plot_unit_4bpp(bitmap, sx * 4, sy * height + sh, i); + } + } + else + { + for (int i = offs | 0x2000, sx = 0; sx < columns; sx++, i = ((i + 1) & 0x1fff) | 0x2000) + { + pgfx_plot_unit_4bpp(bitmap, sx * 4, sy * height + sh, i); + } + } + } + } +} +#endif + + +#if 0 +static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, int x, int y, const uint16_t *palette, int offs) +{ + uint8_t values[2]; + if (cga.plantronics & 0x40) + { + values[0] = videoram[offs]; + values[1] = videoram[offs | 0x4000]; + } + else + { + values[0] = videoram[offs | 0x4000]; + values[1] = videoram[offs]; + } + uint8_t bmap[2] = { 0, 0 }; + for (int i = 3; i >= 0; i--) + { + bmap[0] = (bmap[0] << 1) | BIT(values[0], 7); + bmap[0] = (bmap[0] << 1) | BIT(values[1], 7); + bmap[1] = (bmap[1] << 1) | BIT(values[0], 3); + bmap[1] = (bmap[1] << 1) | BIT(values[1], 3); + values[0] <<= 1; + values[1] <<= 1; + } + + uint16_t *dest = &bitmap.pix(y, x); + *dest++ = palette[(bmap[0] >> 6) & 0x03]; + *dest++ = palette[(bmap[0] >> 4) & 0x03]; + *dest++ = palette[(bmap[0] >> 2) & 0x03]; + *dest++ = palette[(bmap[0] >> 0) & 0x03]; + *dest++ = palette[(bmap[1] >> 6) & 0x03]; + *dest++ = palette[(bmap[1] >> 4) & 0x03]; + *dest++ = palette[(bmap[1] >> 2) & 0x03]; + *dest++ = palette[(bmap[1] >> 0) & 0x03]; +} +#endif + + ///*************************************************************************** // Draw graphics mode with 320x200 pixels (default) with 2 bits/pixel. // Even scanlines are from CGA_base + 0x0000, odd from CGA_base + 0x2000 // cga fetches 2 byte per mscrtc6845 access (not modeled here)! -//***************************************************************************/ -// -//static void cga_pgfx_2bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) -//{ -// int i, sx, sy, sh; -// int offs = mscrtc6845_get_start(crtc)*2; -// int lines = mscrtc6845_get_char_lines(crtc); -// int height = mscrtc6845_get_char_height(crtc); -// int columns = mscrtc6845_get_char_columns(crtc)*2; -// int colorset = cga.color_select & 0x3F; -// const uint16_t *palette; -// -// /* Most chipsets use bit 2 of the mode control register to -// * access a third palette. But not consistently. */ -// pc_cga_check_palette(); -// switch(CGA_CHIPSET) -// { -// /* The IBM Professional Graphics Controller behaves like -// * the PC1512, btw. */ -// case CGA_CHIPSET_PC1512: -// if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; -// break; -// -// case CGA_CHIPSET_IBM: -// case CGA_CHIPSET_PC200: -// case CGA_CHIPSET_ATI: -// case CGA_CHIPSET_PARADISE: -// if (cga.mode_control & 4) colorset = (colorset & 0x1F) + 64; -// break; -// } -// -// -// /* The fact that our palette is located in cga_colortable is a vestigial -// * aspect from when we were doing that ugly trick where drawgfx() would -// * handle graphics drawing. Truthfully, we should probably be using -// * palette_set_color_rgb() here and not doing the palette lookup in the loop -// */ -// palette = &cga_colortable[256*2 + 16*2] + colorset * 4; -// -// for (sy=0; sy<lines; sy++,offs=(offs+columns)&0x1fff) { -// -// for (sh=0; sh<height; sh++) -// { -// if (!(sh&1)) { // char line 0 used as a12 line in graphic mode -// for (i=offs, sx=0; sx<columns; sx++, i=(i+1)&0x1fff) -// { -// pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); -// } -// } -// else -// { -// for (i=offs|0x2000, sx=0; sx<columns; sx++, i=((i+1)&0x1fff)|0x2000) -// { -// pgfx_plot_unit_2bpp(bitmap, sx*8, sy*height+sh, palette, i); -// } -// } -// } -// } -//} +//**************************************************************************** + +#if 0 +static void cga_pgfx_2bpp(bitmap_ind16 &bitmap, struct mscrtc6845 *crtc) +{ + int offs = mscrtc6845_get_start(crtc) * 2; + int const lines = mscrtc6845_get_char_lines(crtc); + int const height = mscrtc6845_get_char_height(crtc); + int const columns = mscrtc6845_get_char_columns(crtc) * 2; + + /* Most chipsets use bit 2 of the mode control register to access a third palette. But not consistently. */ + int colorset = cga.color_select & 0x3f; + pc_cga_check_palette(); + switch (CGA_CHIPSET) + { + /* The IBM Professional Graphics Controller behaves like the PC1512, btw. */ + case CGA_CHIPSET_PC1512: + if ((colorset < 32) && (cga.mode_control & 4)) colorset += 64; + break; + + case CGA_CHIPSET_IBM: + case CGA_CHIPSET_PC200: + case CGA_CHIPSET_ATI: + case CGA_CHIPSET_PARADISE: + if (cga.mode_control & 4) colorset = (colorset & 0x1f) + 64; + break; + } + + /* The fact that our palette is located in cga_colortable is a vestigial + * aspect from when we were doing that ugly trick where drawgfx() would + * handle graphics drawing. Truthfully, we should probably be using + * palette_set_color_rgb() here and not doing the palette lookup in the loop + */ + uint16_t const *const palette = &cga_colortable[256*2 + 16*2] + colorset * 4; + + for (int sy = 0; sy < lines; sy++, offs = (offs + columns) & 0x1fff) + { + + for (int sh = 0; sh < height; sh++) + { + if (!(sh & 1)) // char line 0 used as a12 line in graphic mode + { + for (int i = offs, sx = 0; sx < columns; sx++, i = (i + 1) & 0x1fff) + { + pgfx_plot_unit_2bpp(bitmap, sx * 8, sy * height + sh, palette, i); + } + } + else + { + for (int i = offs | 0x2000, sx = 0; sx < columns; sx++, i= ((i + 1) & 0x1fff) | 0x2000) + { + pgfx_plot_unit_2bpp(bitmap, sx * 8, sy * height + sh, palette, i); + } + } + } + } +} +#endif MC6845_UPDATE_ROW( isa8_cga_pc1512_device::pc1512_gfx_4bpp_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint16_t offset_base = ra << 13; - int j; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint16_t const offset_base = ra << 13; - if ( y == 0 ) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); - for ( j = 0; j < x_count; j++ ) + if (y == 0) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); + for (int j = 0; j < x_count; j++) { - uint16_t offset = offset_base | ( ( ma + j ) & 0x1FFF ); - uint16_t i = ( m_color_select & 8 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[3] | offset ] << 3 : 0; - uint16_t r = ( m_color_select & 4 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[2] | offset ] << 2 : 0; - uint16_t g = ( m_color_select & 2 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[1] | offset ] << 1 : 0; - uint16_t b = ( m_color_select & 1 ) ? videoram[ isa8_cga_pc1512_device::vram_offset[0] | offset ] : 0; - - *p = palette[( ( i & 0x400 ) | ( r & 0x200 ) | ( g & 0x100 ) | ( b & 0x80 ) ) >> 7]; p++; - *p = palette[( ( i & 0x200 ) | ( r & 0x100 ) | ( g & 0x080 ) | ( b & 0x40 ) ) >> 6]; p++; - *p = palette[( ( i & 0x100 ) | ( r & 0x080 ) | ( g & 0x040 ) | ( b & 0x20 ) ) >> 5]; p++; - *p = palette[( ( i & 0x080 ) | ( r & 0x040 ) | ( g & 0x020 ) | ( b & 0x10 ) ) >> 4]; p++; - *p = palette[( ( i & 0x040 ) | ( r & 0x020 ) | ( g & 0x010 ) | ( b & 0x08 ) ) >> 3]; p++; - *p = palette[( ( i & 0x020 ) | ( r & 0x010 ) | ( g & 0x008 ) | ( b & 0x04 ) ) >> 2]; p++; - *p = palette[( ( i & 0x010 ) | ( r & 0x008 ) | ( g & 0x004 ) | ( b & 0x02 ) ) >> 1]; p++; - *p = palette[ ( i & 0x008 ) | ( r & 0x004 ) | ( g & 0x002 ) | ( b & 0x01 ) ]; p++; + uint16_t const offset = offset_base | ((ma + j) & 0x1fff); + uint16_t const i = (m_color_select & 8) ? videoram[isa8_cga_pc1512_device::vram_offset[3] | offset] << 3 : 0; + uint16_t const r = (m_color_select & 4) ? videoram[isa8_cga_pc1512_device::vram_offset[2] | offset] << 2 : 0; + uint16_t const g = (m_color_select & 2) ? videoram[isa8_cga_pc1512_device::vram_offset[1] | offset] << 1 : 0; + uint16_t const b = (m_color_select & 1) ? videoram[isa8_cga_pc1512_device::vram_offset[0] | offset] : 0; + + *p++ = palette[((i & 0x400) | (r & 0x200) | (g & 0x100) | (b & 0x80) ) >> 7]; + *p++ = palette[((i & 0x200) | (r & 0x100) | (g & 0x080) | (b & 0x40) ) >> 6]; + *p++ = palette[((i & 0x100) | (r & 0x080) | (g & 0x040) | (b & 0x20) ) >> 5]; + *p++ = palette[((i & 0x080) | (r & 0x040) | (g & 0x020) | (b & 0x10) ) >> 4]; + *p++ = palette[((i & 0x040) | (r & 0x020) | (g & 0x010) | (b & 0x08) ) >> 3]; + *p++ = palette[((i & 0x020) | (r & 0x010) | (g & 0x008) | (b & 0x04) ) >> 2]; + *p++ = palette[((i & 0x010) | (r & 0x008) | (g & 0x004) | (b & 0x02) ) >> 1]; + *p++ = palette[ (i & 0x008) | (r & 0x004) | (g & 0x002) | (b & 0x01) ]; } } @@ -1500,31 +1494,38 @@ void isa8_wyse700_device::device_reset() uint32_t isa8_wyse700_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - if (m_control & 0x08) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; + if (m_control & 0x08) + { + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0F; uint32_t addr = 0; - for (int y = 0; y < 800; y++) { - uint8_t *src = &m_vram[addr]; + for (int y = 0; y < 800; y++) + { + uint8_t const *src = &m_vram[addr]; - if (y & 1) { + if (y & 1) + { src += 0x10000; addr += 160; } - for (int x = 0; x < (1280 / 8); x++) { + for (int x = 0; x < (1280 / 8); x++) + { uint8_t val = src[x]; - for (int i = 0; i < 8; i++) { - bitmap.pix32(y,x*8+i) = (val & 0x80) ? palette[fg] : palette[0x00]; + for (int i = 0; i < 8; i++) + { + bitmap.pix(y, x * 8 + i) = (val & 0x80) ? palette[fg] : palette[0x00]; val <<= 1; } } } - } else { + return 0; + } + else + { return isa8_cga_device::screen_update(screen, bitmap, cliprect); } - return 0; } @@ -1837,7 +1838,7 @@ uint8_t isa8_cga_m24_device::io_read(offs_t offset) MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) { - if(m_mode2 & 1) + if (m_mode2 & 1) { m24_gfx_1bpp_m24_update_row(bitmap, cliprect, ma, ra, y, x_count, cursor_x, de, hbp, vbp); return; @@ -1847,7 +1848,7 @@ MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) return; y = m_y; - if(m_y >= bitmap.height()) + if (m_y >= bitmap.height()) return; switch (m_update_row_type) @@ -1885,37 +1886,38 @@ MC6845_UPDATE_ROW(isa8_cga_m24_device::crtc_update_row) MC6845_UPDATE_ROW( isa8_cga_m24_device::m24_gfx_1bpp_m24_update_row ) { - uint8_t *videoram = &m_vram[m_start_offset]; - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t fg = m_color_select & 0x0F; - int i; + uint8_t const *const videoram = &m_vram[m_start_offset]; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const fg = m_color_select & 0x0f; - if ( y == 0 ) CGA_LOG(1,"m24_gfx_1bpp_m24_update_row",("\n")); - for ( i = 0; i < x_count; i++ ) + if (y == 0) CGA_LOG(1,"m24_gfx_1bpp_m24_update_row",("\n")); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ( ma + i ) << 1 ) & 0x1fff ) | ( ( ra & 3 ) << 13 ); - uint8_t data = videoram[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; - - data = videoram[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : 0]; p++; - *p = palette[( data & 0x40 ) ? fg : 0]; p++; - *p = palette[( data & 0x20 ) ? fg : 0]; p++; - *p = palette[( data & 0x10 ) ? fg : 0]; p++; - *p = palette[( data & 0x08 ) ? fg : 0]; p++; - *p = palette[( data & 0x04 ) ? fg : 0]; p++; - *p = palette[( data & 0x02 ) ? fg : 0]; p++; - *p = palette[( data & 0x01 ) ? fg : 0]; p++; + uint16_t const offset = (((ma + i) << 1 ) & 0x1fff) | ((ra & 3) << 13); + uint8_t data; + + data = videoram[offset]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; + + data = videoram[offset + 1]; + + *p++ = palette[(data & 0x80) ? fg : 0]; + *p++ = palette[(data & 0x40) ? fg : 0]; + *p++ = palette[(data & 0x20) ? fg : 0]; + *p++ = palette[(data & 0x10) ? fg : 0]; + *p++ = palette[(data & 0x08) ? fg : 0]; + *p++ = palette[(data & 0x04) ? fg : 0]; + *p++ = palette[(data & 0x02) ? fg : 0]; + *p++ = palette[(data & 0x01) ? fg : 0]; } } diff --git a/src/devices/bus/isa/ega.cpp b/src/devices/bus/isa/ega.cpp index e3d75e4070a..45d169f3dff 100644 --- a/src/devices/bus/isa/ega.cpp +++ b/src/devices/bus/isa/ega.cpp @@ -783,7 +783,7 @@ WRITE_LINE_MEMBER( isa8_ega_device::vblank_changed ) CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_graphics ) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); LOG("%s: y = %d, x_count = %d, ma = %d, ra = %d\n", FUNCNAME, y, x_count, ma, ra ); @@ -844,12 +844,11 @@ CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_graphics ) CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_text ) { - uint16_t *p = &bitmap.pix16(y); - int i; + uint16_t *p = &bitmap.pix(y); LOG("%s: y = %d, x_count = %d, ma = %d, ra = %d\n", FUNCNAME, y, x_count, ma, ra ); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ma + i; uint8_t chr = m_plane[0][ offset ]; @@ -901,8 +900,6 @@ CRTC_EGA_ROW_UPDATE( isa8_ega_device::pc_ega_text ) void isa8_ega_device::change_mode() { - int clock, pixels; - m_video_mode = 0; /* Check for graphics mode */ @@ -938,8 +935,8 @@ void isa8_ega_device::change_mode() } /* Check for changes to the crtc input clock and number of pixels per clock */ - clock = ( ( m_misc_output & 0x0c ) ? 16257000 : 14318181 ); - pixels = ( ( m_sequencer.data[0x01] & 0x01 ) ? 8 : 9 ); + int clock = ( ( m_misc_output & 0x0c ) ? 16257000 : 14318181 ); + int pixels = ( ( m_sequencer.data[0x01] & 0x01 ) ? 8 : 9 ); if ( m_sequencer.data[0x01] & 0x08 ) { diff --git a/src/devices/bus/isa/eis_hgb107x.cpp b/src/devices/bus/isa/eis_hgb107x.cpp index 32aeac02c3e..25b16a38fe3 100644 --- a/src/devices/bus/isa/eis_hgb107x.cpp +++ b/src/devices/bus/isa/eis_hgb107x.cpp @@ -420,10 +420,6 @@ inline int isa8_epc_mda_device::get_yres() MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; - // Get som debug data from a couple of rows now and then if ( y < (16 * 0 + 0x20) && (m_framecnt & 0xff) == 0 ) { @@ -436,7 +432,7 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { for (int i = 0; i < get_xres(); i++) { - bitmap.pix32(y, i) = rgb_t::black(); + bitmap.pix(y, i) = rgb_t::black(); } } @@ -449,14 +445,17 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) // Text modes using one of two 9x16 fonts in character rom else { + uint32_t *p = &bitmap.pix(y); + uint16_t chr_base = ra; + // Adjust row pointer if in monochrome text mode as we insert two scanlines per row of characters (see below) if (m_vmode & VM_MONO) { - p = &bitmap.pix32((y / 14) * 16 + y % 14); + p = &bitmap.pix((y / 14) * 16 + y % 14); } // Loop over each character in a row - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; uint8_t chr = m_videoram[ offset ]; @@ -555,14 +554,14 @@ MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { if (chr >= 0xb3 && chr <= 0xdf) // Handle the meta graphics characters { - bitmap.pix32(row + 1, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; - bitmap.pix32(row + 2, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; + bitmap.pix(row + 1, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; + bitmap.pix(row + 2, j + i * 9) = (*m_pal)[( data & (0x80 >> j) ) || (j == 8 && (data & 0x01)) ? fg : bg]; } else { // Handle underline - bitmap.pix32(row + 1, j + i * 9) =(*m_pal)[( attr & ATTR_FOREG ) == ATTR_ULINE ? fg : bg]; - bitmap.pix32(row + 2, j + i * 9) = (*m_pal)[bg]; + bitmap.pix(row + 1, j + i * 9) =(*m_pal)[( attr & ATTR_FOREG ) == ATTR_ULINE ? fg : bg]; + bitmap.pix(row + 2, j + i * 9) = (*m_pal)[bg]; } } } diff --git a/src/devices/bus/isa/ex1280.cpp b/src/devices/bus/isa/ex1280.cpp index 84c8bb8d269..2d9153616e9 100644 --- a/src/devices/bus/isa/ex1280.cpp +++ b/src/devices/bus/isa/ex1280.cpp @@ -144,15 +144,15 @@ void isa16_ex1280_device::vram_w(offs_t offset, uint16_t data, uint16_t mem_mask TMS340X0_SCANLINE_RGB32_CB_MEMBER(isa16_ex1280_device::scanline_update) { - uint16_t *src = &m_vram[params->rowaddr << 8]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_ramdac->pens(); + uint16_t const *const src = &m_vram[params->rowaddr << 8]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_ramdac->pens(); int coladdr = params->coladdr << 1; /* copy the non-blanked portions of this scanline */ for (int x = params->heblnk; x < params->hsblnk; x += 4) { - uint16_t pixels = src[coladdr++]; + uint16_t const pixels = src[coladdr++]; dest[x + 0] = pens[pixels & 0x0f]; dest[x + 1] = pens[(pixels >> 4) & 0x0f]; dest[x + 2] = pens[(pixels >> 8) & 0x0f]; diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp index a1c3f39612e..237211047a2 100644 --- a/src/devices/bus/isa/gus.cpp +++ b/src/devices/bus/isa/gus.cpp @@ -243,29 +243,26 @@ void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param, v } } -void gf1_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gf1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int x,y; + int x; //uint32_t count; - stream_sample_t* outputl = outputs[0]; - stream_sample_t* outputr = outputs[1]; - memset( outputl, 0x00, samples * sizeof(*outputl) ); - memset( outputr, 0x00, samples * sizeof(*outputr) ); + auto &outputl = outputs[0]; + auto &outputr = outputs[1]; + + outputl.fill(0); + outputr.fill(0); for(x=0;x<32;x++) // for each voice { - stream_sample_t* left = outputl; - stream_sample_t* right = outputr; uint16_t vol = (m_volume_table[(m_voice[x].current_vol & 0xfff0) >> 4]); - for(y=samples-1; y>=0; y--) + for (int sampindex = 0; sampindex < outputl.samples(); sampindex++) { uint32_t current = m_voice[x].current_addr >> 9; // TODO: implement proper panning - (*left) += ((m_voice[x].sample) * (vol/8192.0)); - (*right) += ((m_voice[x].sample) * (vol/8192.0)); - left++; - right++; + outputl.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192); + outputr.add_int(sampindex, m_voice[x].sample * vol, 32768 * 8192); if((!(m_voice[x].voice_ctrl & 0x40)) && (m_voice[x].current_addr >= m_voice[x].end_addr) && !m_voice[x].rollover && !(m_voice[x].voice_ctrl & 0x01)) { if(m_voice[x].vol_ramp_ctrl & 0x04) @@ -403,7 +400,7 @@ void gf1_device::device_start() m_wave_ram.resize(1024*1024); memset(&m_wave_ram[0], 0, 1024*1024); - m_stream = stream_alloc_legacy(0,2,clock() / (14 * 16)); + m_stream = stream_alloc(0,2,clock() / (14 * 16)); // init timers m_timer1 = timer_alloc(ADLIB_TIMER1); diff --git a/src/devices/bus/isa/gus.h b/src/devices/bus/isa/gus.h index 3f637bee84d..be8dbbdbe2d 100644 --- a/src/devices/bus/isa/gus.h +++ b/src/devices/bus/isa/gus.h @@ -123,7 +123,7 @@ public: // optional information overrides virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; protected: // voice-specific registers diff --git a/src/devices/bus/isa/mach32.cpp b/src/devices/bus/isa/mach32.cpp index 602147aa060..e9f4ad8d197 100644 --- a/src/devices/bus/isa/mach32.cpp +++ b/src/devices/bus/isa/mach32.cpp @@ -180,11 +180,8 @@ uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma return 0; uint32_t src = (m_cursor_address & 0x000fffff) << 2; - uint32_t* dst; // destination pixel - uint8_t x,y,z; - uint32_t colour0; - uint32_t colour1; + uint32_t colour0, colour1; if(depth == 8) { colour0 = pen(m_cursor_colour0_b); @@ -197,18 +194,18 @@ uint32_t mach32_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma } // draw hardware pointer (64x64 max) - for(y=0;y<64;y++) + for(uint8_t y=0;y<64;y++) { - dst = &bitmap.pix32(m_cursor_vertical + y, m_cursor_horizontal); - for(x=0;x<64;x+=8) + uint32_t *dst = &bitmap.pix(m_cursor_vertical + y, m_cursor_horizontal); + for(uint8_t x=0;x<64;x+=8) { - uint16_t bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); + uint16_t const bits = (vga.memory[(src+0) % vga.svga_intf.vram_size] | ((vga.memory[(src+1) % vga.svga_intf.vram_size]) << 8)); - for(z=0;z<8;z++) + for(uint8_t z=0;z<8;z++) { if(((z + x) > (m_cursor_offset_horizontal-1)) && (y < (63 - m_cursor_offset_vertical))) { - uint8_t val = (bits >> (z*2)) & 0x03; + uint8_t const val = (bits >> (z*2)) & 0x03; switch(val) { case 0: // cursor colour 0 diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp index cf4a6aa3803..ae61e78e116 100644 --- a/src/devices/bus/isa/mda.cpp +++ b/src/devices/bus/isa/mda.cpp @@ -225,27 +225,26 @@ void isa8_mda_device::device_reset() ***************************************************************************/ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ chr_base + chr * 8 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[chr_base + chr * 8]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: bg = 2; @@ -255,36 +254,36 @@ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) bg = 2; fg = 1; break; - case 0xF0: + case 0xf0: bg = 3; fg = 0; break; - case 0xF8: + case 0xf8: bg = 3; fg = 1; break; } - if ( ( i == cursor_x && ( m_framecnt & 0x08 ) ) || ( attr & 0x07 ) == 0x01 ) + if ((i == cursor_x && (m_framecnt & 0x08)) || (attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - if ( ( chr & 0xE0 ) == 0xC0 ) + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; + if ((chr & 0xe0) == 0xc0) { - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x01) ? fg : bg]; } else { - *p = palette[bg]; p++; + *p++ = palette[bg]; } } } @@ -298,75 +297,74 @@ MC6845_UPDATE_ROW( isa8_mda_device::mda_text_inten_update_row ) MC6845_UPDATE_ROW( isa8_mda_device::mda_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = (ra & 0x08) ? 0x800 | (ra & 0x07) : ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ chr_base + chr * 8 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[chr_base + chr * 8]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: - case 0xF0: + case 0xf0: bg = 2; fg = 0; break; case 0x78: - case 0xF8: + case 0xf8: bg = 2; fg = 1; break; } - if ( ( attr & 0x07 ) == 0x01 ) + if ((attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - if ( i == cursor_x ) + if (i == cursor_x) { - if ( m_framecnt & 0x08 ) + if (m_framecnt & 0x08) { - data = 0xFF; + data = 0xff; } } else { - if ( ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - if ( ( chr & 0xE0 ) == 0xC0 ) + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; + if ((chr & 0xe0) == 0xc0) { - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x01) ? fg : bg]; } else { - *p = palette[bg]; p++; + *p++ = palette[bg]; } } } @@ -631,34 +629,36 @@ void isa8_hercules_device::device_reset() MC6845_UPDATE_ROW( isa8_hercules_device::hercules_gfx_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t gfx_base = ( ( m_mode_control & 0x80 ) ? 0x8000 : 0x0000 ) | ( ( ra & 0x03 ) << 13 ); - int i; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const gfx_base = ((m_mode_control & 0x80) ? 0x8000 : 0x0000) | ((ra & 0x03) << 13); + + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint8_t data = m_videoram[ gfx_base + ( ( ma + i ) << 1 ) ]; - - *p = palette[( data & 0x80 ) ? 2 : 0]; p++; - *p = palette[( data & 0x40 ) ? 2 : 0]; p++; - *p = palette[( data & 0x20 ) ? 2 : 0]; p++; - *p = palette[( data & 0x10 ) ? 2 : 0]; p++; - *p = palette[( data & 0x08 ) ? 2 : 0]; p++; - *p = palette[( data & 0x04 ) ? 2 : 0]; p++; - *p = palette[( data & 0x02 ) ? 2 : 0]; p++; - *p = palette[( data & 0x01 ) ? 2 : 0]; p++; - - data = m_videoram[ gfx_base + ( ( ma + i ) << 1 ) + 1 ]; - - *p = palette[( data & 0x80 ) ? 2 : 0]; p++; - *p = palette[( data & 0x40 ) ? 2 : 0]; p++; - *p = palette[( data & 0x20 ) ? 2 : 0]; p++; - *p = palette[( data & 0x10 ) ? 2 : 0]; p++; - *p = palette[( data & 0x08 ) ? 2 : 0]; p++; - *p = palette[( data & 0x04 ) ? 2 : 0]; p++; - *p = palette[( data & 0x02 ) ? 2 : 0]; p++; - *p = palette[( data & 0x01 ) ? 2 : 0]; p++; + uint8_t data; + + data = m_videoram[gfx_base + ((ma + i) << 1)]; + + *p++ = palette[(data & 0x80) ? 2 : 0]; + *p++ = palette[(data & 0x40) ? 2 : 0]; + *p++ = palette[(data & 0x20) ? 2 : 0]; + *p++ = palette[(data & 0x10) ? 2 : 0]; + *p++ = palette[(data & 0x08) ? 2 : 0]; + *p++ = palette[(data & 0x04) ? 2 : 0]; + *p++ = palette[(data & 0x02) ? 2 : 0]; + *p++ = palette[(data & 0x01) ? 2 : 0]; + + data = m_videoram[gfx_base + ((ma + i) << 1) + 1]; + + *p++ = palette[(data & 0x80) ? 2 : 0]; + *p++ = palette[(data & 0x40) ? 2 : 0]; + *p++ = palette[(data & 0x20) ? 2 : 0]; + *p++ = palette[(data & 0x10) ? 2 : 0]; + *p++ = palette[(data & 0x08) ? 2 : 0]; + *p++ = palette[(data & 0x04) ? 2 : 0]; + *p++ = palette[(data & 0x02) ? 2 : 0]; + *p++ = palette[(data & 0x01) ? 2 : 0]; } } @@ -816,27 +816,26 @@ void isa8_ec1840_0002_device::device_reset() MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ (chr_base + chr * 16) << 1 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[(chr_base + chr * 16) << 1]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: bg = 2; @@ -846,29 +845,29 @@ MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) bg = 2; fg = 1; break; - case 0xF0: + case 0xf0: bg = 3; fg = 0; break; - case 0xF8: + case 0xf8: bg = 3; fg = 1; break; } - if ( ( i == cursor_x && ( m_framecnt & 0x08 ) ) || ( attr & 0x07 ) == 0x01 ) + if ((i == cursor_x && (m_framecnt & 0x08)) || (attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; } } @@ -880,68 +879,67 @@ MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_inten_update_row ) MC6845_UPDATE_ROW( isa8_ec1840_0002_device::mda_lowres_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint16_t chr_base = ra; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint16_t const chr_base = ra; - if ( y == 0 ) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); - for ( i = 0; i < x_count; i++ ) + if (y == 0) LOGROW("%11.6f: %-24s\n", machine().time().as_double(), FUNCNAME); + for (int i = 0; i < x_count; i++) { - uint16_t offset = ( ( ma + i ) << 1 ) & 0x0FFF; - uint8_t chr = m_videoram[ offset ]; - uint8_t attr = m_videoram[ offset + 1 ]; - uint8_t data = m_chr_gen[ (chr_base + chr * 16) << 1 ]; - uint8_t fg = ( attr & 0x08 ) ? 3 : 2; + uint16_t const offset = ((ma + i) << 1) & 0x0fff; + uint8_t const chr = m_videoram[offset]; + uint8_t const attr = m_videoram[offset + 1]; + uint8_t data = m_chr_gen[(chr_base + chr * 16) << 1]; + uint8_t fg = (attr & 0x08) ? 3 : 2; uint8_t bg = 0; - if ( ( attr & ~0x88 ) == 0 ) + if ((attr & ~0x88) == 0) { data = 0x00; } - switch( attr ) + switch (attr) { case 0x70: - case 0xF0: + case 0xf0: bg = 2; fg = 0; break; case 0x78: - case 0xF8: + case 0xf8: bg = 2; fg = 1; break; } - if ( ( attr & 0x07 ) == 0x01 ) + if ((attr & 0x07) == 0x01) { - data = 0xFF; + data = 0xff; } - if ( i == cursor_x ) + if (i == cursor_x) { - if ( m_framecnt & 0x08 ) + if (m_framecnt & 0x08) { - data = 0xFF; + data = 0xff; } } else { - if ( ( attr & 0x80 ) && ( m_framecnt & 0x10 ) ) + if ((attr & 0x80) && (m_framecnt & 0x10)) { data = 0x00; } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[(data & 0x80) ? fg : bg]; + *p++ = palette[(data & 0x40) ? fg : bg]; + *p++ = palette[(data & 0x20) ? fg : bg]; + *p++ = palette[(data & 0x10) ? fg : bg]; + *p++ = palette[(data & 0x08) ? fg : bg]; + *p++ = palette[(data & 0x04) ? fg : bg]; + *p++ = palette[(data & 0x02) ? fg : bg]; + *p++ = palette[(data & 0x01) ? fg : bg]; } } diff --git a/src/devices/bus/isa/num9rev.cpp b/src/devices/bus/isa/num9rev.cpp index 07a35ee073c..632eb8b544b 100644 --- a/src/devices/bus/isa/num9rev.cpp +++ b/src/devices/bus/isa/num9rev.cpp @@ -36,7 +36,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) color.set_r(pal->entry_color(m_ram[addr] | ((overlay & 0xf) << 8)).r()); color.set_g(pal->entry_color(m_ram[addr + 0x40000] | ((overlay & 0xf0) << 4)).g()); color.set_b(pal->entry_color(m_ram[addr + 0x80000] | (overlay & 0xf00)).b()); - bitmap.pix32(y, x + i) = color; + bitmap.pix(y, x + i) = color; } } else @@ -44,7 +44,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( isa8_number_9_rev_device::hgdc_display_pixels ) if(((address << 3) + 16) > (1024*1024)) return; for(int i = 0; i < 16; i++) - bitmap.pix32(y, x + i) = pal->entry_color(m_ram[(address << 4) + i]); + bitmap.pix(y, x + i) = pal->entry_color(m_ram[(address << 4) + i]); } } diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp index 1366bc92dbc..f204333f9f2 100644 --- a/src/devices/bus/isa/pgc.cpp +++ b/src/devices/bus/isa/pgc.cpp @@ -401,14 +401,11 @@ uint8_t isa8_pgc_device::init_r() uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *p; - uint8_t *v; - for (int y = 0; y < PGC_DISP_VERT; y++) { // XXX address translation happens in hardware - v = &m_vram[y * 1024]; - p = &bitmap.pix16(y + PGC_VERT_START, PGC_HORZ_START); + uint8_t const *v = &m_vram[y * 1024]; + uint16_t *p = &bitmap.pix(y + PGC_VERT_START, PGC_HORZ_START); for (int x = 0; x < PGC_DISP_HORZ; x++) { diff --git a/src/devices/bus/isa/trident.cpp b/src/devices/bus/isa/trident.cpp index 0d64df5ba27..5fc2d2d6d19 100644 --- a/src/devices/bus/isa/trident.cpp +++ b/src/devices/bus/isa/trident.cpp @@ -212,29 +212,22 @@ void trident_vga_device::device_reset() uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t cur_mode; - svga_device::screen_update(screen,bitmap,cliprect); - cur_mode = pc_vga_choosevideomode(); + uint8_t const cur_mode = pc_vga_choosevideomode(); // draw hardware graphics cursor if(tri.cursor_ctrl & 0x80) // if cursor is enabled { - uint32_t src; - uint32_t* dst; - uint8_t val; - int x,y; - uint16_t cx = tri.cursor_x & 0x0fff; - uint16_t cy = tri.cursor_y & 0x0fff; - uint32_t bg_col; - uint32_t fg_col; - uint8_t cursor_size = (tri.cursor_ctrl & 0x01) ? 64 : 32; + uint16_t const cx = tri.cursor_x & 0x0fff; + uint16_t const cy = tri.cursor_y & 0x0fff; + uint8_t const cursor_size = (tri.cursor_ctrl & 0x01) ? 64 : 32; if(cur_mode == SCREEN_OFF || cur_mode == TEXT_MODE || cur_mode == MONO_MODE || cur_mode == CGA_MODE || cur_mode == EGA_MODE) return 0; // cursor only works in VGA or SVGA modes - src = tri.cursor_loc * 1024; // start address is in units of 1024 bytes + uint32_t src = tri.cursor_loc * 1024; // start address is in units of 1024 bytes + uint32_t bg_col, fg_col; if(cur_mode == RGB16_MODE) { bg_col = tri.cursor_bg; @@ -246,11 +239,11 @@ uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 & fg_col = pen(tri.cursor_fg & 0xff); } - for(y=0;y<cursor_size;y++) + for(int y=0;y<cursor_size;y++) { uint8_t bitcount = 31; - dst = &bitmap.pix32(cy + y, cx); - for(x=0;x<cursor_size;x++) + uint32_t *const dst = &bitmap.pix(cy + y, cx); + for(int x=0;x<cursor_size;x++) { uint32_t bitb = (vga.memory[(src+3) % vga.svga_intf.vram_size] | ((vga.memory[(src+2) % vga.svga_intf.vram_size]) << 8) @@ -260,7 +253,7 @@ uint32_t trident_vga_device::screen_update(screen_device &screen, bitmap_rgb32 & | ((vga.memory[(src+6) % vga.svga_intf.vram_size]) << 8) | ((vga.memory[(src+5) % vga.svga_intf.vram_size]) << 16) | ((vga.memory[(src+4) % vga.svga_intf.vram_size]) << 24)); - val = (BIT(bita << 1,bitcount+1) << 1 | BIT(bitb,bitcount)); + uint8_t const val = (BIT(bita << 1,bitcount+1) << 1 | BIT(bitb,bitcount)); if(tri.cursor_ctrl & 0x40) { // X11 mode switch(val) diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp index 833d1d3820f..6d9dd93b4ed 100644 --- a/src/devices/bus/macpds/pds_tpdfpd.cpp +++ b/src/devices/bus/macpds/pds_tpdfpd.cpp @@ -154,27 +154,23 @@ void macpds_sedisplay_device::device_timer(emu_timer &timer, device_timer_id tid uint32_t macpds_sedisplay_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = m_vram.get(); - vram = m_vram.get(); - - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * (1024/8)) + (x^1)]; - - *scanline++ = m_palette[((pixels>>7)&0x1)^1]; - *scanline++ = m_palette[((pixels>>6)&0x1)^1]; - *scanline++ = m_palette[((pixels>>5)&0x1)^1]; - *scanline++ = m_palette[((pixels>>4)&0x1)^1]; - *scanline++ = m_palette[((pixels>>3)&0x1)^1]; - *scanline++ = m_palette[((pixels>>2)&0x1)^1]; - *scanline++ = m_palette[((pixels>>1)&0x1)^1]; - *scanline++ = m_palette[(pixels&1)^1]; + uint8_t const pixels = vram[(y * (1024/8)) + (x^1)]; + + *scanline++ = m_palette[BIT(~pixels, 7)]; + *scanline++ = m_palette[BIT(~pixels, 6)]; + *scanline++ = m_palette[BIT(~pixels, 5)]; + *scanline++ = m_palette[BIT(~pixels, 4)]; + *scanline++ = m_palette[BIT(~pixels, 3)]; + *scanline++ = m_palette[BIT(~pixels, 2)]; + *scanline++ = m_palette[BIT(~pixels, 1)]; + *scanline++ = m_palette[BIT(~pixels, 0)]; } } diff --git a/src/devices/bus/mtx/sdx.cpp b/src/devices/bus/mtx/sdx.cpp index e413e997f5b..09e7199ac53 100644 --- a/src/devices/bus/mtx/sdx.cpp +++ b/src/devices/bus/mtx/sdx.cpp @@ -417,7 +417,7 @@ MC6845_UPDATE_ROW(mtx_sdxcpm_device::crtc_update_row) int color = BIT(data, 7) ? fg : bg; - bitmap.pix32(y, x) = pen[de ? color : 0]; + bitmap.pix(y, x) = pen[de ? color : 0]; data <<= 1; } diff --git a/src/devices/bus/nasbus/avc.cpp b/src/devices/bus/nasbus/avc.cpp index f7bc8e95596..f4590b2ac3f 100644 --- a/src/devices/bus/nasbus/avc.cpp +++ b/src/devices/bus/nasbus/avc.cpp @@ -120,7 +120,7 @@ MC6845_UPDATE_ROW( nascom_avc_device::crtc_update_row ) } // plot the pixel - bitmap.pix32(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); + bitmap.pix(y, x) = m_palette->pen_color((b << 2) | (g << 1) | (r << 0)); } } diff --git a/src/devices/bus/nubus/laserview.cpp b/src/devices/bus/nubus/laserview.cpp index 2c58b6e8dc3..7e802b58988 100644 --- a/src/devices/bus/nubus/laserview.cpp +++ b/src/devices/bus/nubus/laserview.cpp @@ -117,30 +117,26 @@ void nubus_laserview_device::device_reset() uint32_t nubus_laserview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - if (!m_vbl_disable) { raise_slot_irq(); } - for (y = 0; y < 600; y++) + for (int y = 0; y < 600; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 832/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 832/8; x++) { - pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * 104) + (BYTE4_XOR_BE(x)) + 0x20]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_48gc.cpp b/src/devices/bus/nubus/nubus_48gc.cpp index 9105414f3e0..b9b831c6de2 100644 --- a/src/devices/bus/nubus/nubus_48gc.cpp +++ b/src/devices/bus/nubus/nubus_48gc.cpp @@ -12,6 +12,9 @@ #include "nubus_48gc.h" #include "screen.h" +#include <algorithm> + + #define VRAM_SIZE (0x200000) // 2 megs, maxed out #define GC48_SCREEN_NAME "48gc_screen" @@ -152,10 +155,7 @@ void jmfb_device::device_timer(emu_timer &timer, device_timer_id tid, int param, uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline, *base; - int x, y; - uint8_t *vram8 = &m_vram[0]; - uint8_t pixels; + uint8_t const *const vram8 = &m_vram[0xa00]; // first time? kick off the VBL timer if (!m_screen) @@ -164,37 +164,35 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, m_timer->adjust(m_screen->time_until_pos(479, 0), 0); } - vram8 += 0xa00; - switch (m_mode) { case 0: // 1bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < m_xres/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/8; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < m_xres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/4; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>6)&0x3]; *scanline++ = m_palette[(pixels>>4)&0x3]; @@ -205,13 +203,12 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, break; case 2: // 4 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < m_xres/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres/2; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)&0xf]; *scanline++ = m_palette[pixels&0xf]; @@ -220,27 +217,22 @@ uint32_t jmfb_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, break; case 3: // 8 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < m_xres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < m_xres; x++) { - pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } break; case 4: // 24 bpp - for (y = 0; y < m_yres; y++) + for (int y = 0; y < m_yres; y++) { - scanline = &bitmap.pix32(y); - base = (uint32_t *)&m_vram[y * m_stride]; - for (x = 0; x < m_xres; x++) - { - *scanline++ = *base++; - } + uint32_t const *base = (uint32_t *)&m_vram[y * m_stride]; + std::copy_n(base, m_xres, &bitmap.pix(y)); } break; } diff --git a/src/devices/bus/nubus/nubus_cb264.cpp b/src/devices/bus/nubus/nubus_cb264.cpp index db964ec2055..db1fd821a11 100644 --- a/src/devices/bus/nubus/nubus_cb264.cpp +++ b/src/devices/bus/nubus/nubus_cb264.cpp @@ -17,6 +17,9 @@ #include "nubus_cb264.h" #include "screen.h" +#include <algorithm> + + #define CB264_SCREEN_NAME "cb264_screen" #define CB264_ROM_REGION "cb264_rom" @@ -122,10 +125,6 @@ void nubus_cb264_device::device_reset() uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline, *base; - int x, y; - uint8_t pixels; - if (!m_cb264_vbl_disable) { raise_slot_irq(); @@ -134,12 +133,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & switch (m_cb264_mode) { case 0: // 1 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0x80]; *scanline++ = m_palette[(pixels<<1)&0x80]; @@ -154,12 +153,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 1: // 2 bpp (3f/7f/bf/ff) - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xc0]; *scanline++ = m_palette[(pixels<<2)&0xc0]; @@ -170,13 +169,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xf0]; *scanline++ = m_palette[(pixels<<4)&0xf0]; @@ -185,13 +183,12 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = m_vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -200,16 +197,11 @@ uint32_t nubus_cb264_device::screen_update(screen_device &screen, bitmap_rgb32 & case 4: // 24 bpp case 7: // ??? { - uint32_t *vram32 = (uint32_t *)&m_vram[0]; + uint32_t const *const vram32 = (uint32_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/nubus_m2hires.cpp b/src/devices/bus/nubus/nubus_m2hires.cpp index 851537685d2..e913c0cb0cb 100644 --- a/src/devices/bus/nubus/nubus_m2hires.cpp +++ b/src/devices/bus/nubus/nubus_m2hires.cpp @@ -137,41 +137,37 @@ void nubus_m2hires_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x20]; + uint8_t const *const vram = &m_vram[0x20]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -182,13 +178,13 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640/2; x++) + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels&0xf0)>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -197,13 +193,13 @@ uint32_t nubus_m2hires_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640; x++) + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_m2video.cpp b/src/devices/bus/nubus/nubus_m2video.cpp index f557d7631b0..60728d7dd15 100644 --- a/src/devices/bus/nubus/nubus_m2video.cpp +++ b/src/devices/bus/nubus/nubus_m2video.cpp @@ -139,21 +139,17 @@ void nubus_m2video_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x20]; + uint8_t const *const vram = &m_vram[0x20]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -168,12 +164,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -184,13 +180,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -199,13 +194,12 @@ uint32_t nubus_m2video_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_radiustpd.cpp b/src/devices/bus/nubus/nubus_radiustpd.cpp index f6d152be059..89518f0d223 100644 --- a/src/devices/bus/nubus/nubus_radiustpd.cpp +++ b/src/devices/bus/nubus/nubus_radiustpd.cpp @@ -139,27 +139,23 @@ void nubus_radiustpd_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_radiustpd_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = &m_vram[0x200]; - vram = &m_vram[0x200]; - - for (y = 0; y < 880; y++) + for (int y = 0; y < 880; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp index b7a29b6f537..6ca1f9f4489 100644 --- a/src/devices/bus/nubus/nubus_spec8.cpp +++ b/src/devices/bus/nubus/nubus_spec8.cpp @@ -144,21 +144,17 @@ void nubus_spec8s3_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[0x400]; + uint8_t const *const vram = &m_vram[0x400]; switch (m_mode) { case 0: // 1 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/8; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0x80]; *scanline++ = m_palette[(pixels<<1)&0x80]; @@ -173,12 +169,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/4; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xc0]; *scanline++ = m_palette[(pixels<<2)&0xc0]; @@ -189,13 +185,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1024/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels&0xf0]; *scanline++ = m_palette[(pixels<<4)&0xf0]; @@ -204,13 +199,12 @@ uint32_t nubus_spec8s3_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1024; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_specpdq.cpp b/src/devices/bus/nubus/nubus_specpdq.cpp index 891defaa336..c00938c6102 100644 --- a/src/devices/bus/nubus/nubus_specpdq.cpp +++ b/src/devices/bus/nubus/nubus_specpdq.cpp @@ -157,22 +157,18 @@ void nubus_specpdq_device::device_timer(emu_timer &timer, device_timer_id tid, i uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - // first time? kick off the VBL timer - vram = &m_vram[0x9000]; + uint8_t const *const vram = &m_vram[0x9000]; switch (m_mode) { case 0: // 1 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0x80)]; *scanline++ = m_palette_val[((pixels<<1)&0x80)]; @@ -187,12 +183,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 1: // 2 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/4; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0xc0)]; *scanline++ = m_palette_val[((pixels<<2)&0xc0)]; @@ -203,13 +199,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 2: // 4 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[(pixels&0xf0)]; *scanline++ = m_palette_val[((pixels<<4)&0xf0)]; @@ -218,13 +213,12 @@ uint32_t nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 break; case 3: // 8 bpp - for (y = 0; y < 844; y++) + for (int y = 0; y < 844; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x++) { - pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette_val[pixels]; } } diff --git a/src/devices/bus/nubus/nubus_vikbw.cpp b/src/devices/bus/nubus/nubus_vikbw.cpp index 1c25795cd45..18c94f9ba5b 100644 --- a/src/devices/bus/nubus/nubus_vikbw.cpp +++ b/src/devices/bus/nubus/nubus_vikbw.cpp @@ -117,30 +117,26 @@ void nubus_vikbw_device::device_reset() uint32_t nubus_vikbw_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - if (!m_vbl_disable) { raise_slot_irq(); } - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024/8; x++) { - pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } diff --git a/src/devices/bus/nubus/nubus_wsportrait.cpp b/src/devices/bus/nubus/nubus_wsportrait.cpp index 2f56488bf48..9894e0d7906 100644 --- a/src/devices/bus/nubus/nubus_wsportrait.cpp +++ b/src/devices/bus/nubus/nubus_wsportrait.cpp @@ -137,42 +137,38 @@ void nubus_wsportrait_device::device_timer(emu_timer &timer, device_timer_id tid uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - // first time? kick off the VBL timer - vram = &m_vram[0x80]; + uint8_t const *const vram = &m_vram[0x80]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[((pixels>>7)&0x1)]; - *scanline++ = m_palette[((pixels>>6)&0x1)]; - *scanline++ = m_palette[((pixels>>5)&0x1)]; - *scanline++ = m_palette[((pixels>>4)&0x1)]; - *scanline++ = m_palette[((pixels>>3)&0x1)]; - *scanline++ = m_palette[((pixels>>2)&0x1)]; - *scanline++ = m_palette[((pixels>>1)&0x1)]; - *scanline++ = m_palette[(pixels&1)]; + uint8_t const pixels = vram[(y * 128) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 256) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -183,13 +179,12 @@ uint32_t nubus_wsportrait_device::screen_update(screen_device &screen, bitmap_rg break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels&0xf0)>>4)]; *scanline++ = m_palette[(pixels&0xf)]; diff --git a/src/devices/bus/nubus/pds30_30hr.cpp b/src/devices/bus/nubus/pds30_30hr.cpp index 2fe4687fc44..dde2348abc6 100644 --- a/src/devices/bus/nubus/pds30_30hr.cpp +++ b/src/devices/bus/nubus/pds30_30hr.cpp @@ -139,41 +139,37 @@ void nubus_xceed30hr_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[1024]; + uint8_t const *const vram = &m_vram[1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -184,13 +180,12 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -199,13 +194,12 @@ uint32_t nubus_xceed30hr_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } diff --git a/src/devices/bus/nubus/pds30_cb264.cpp b/src/devices/bus/nubus/pds30_cb264.cpp index aa0ca1df648..388aa5f54d5 100644 --- a/src/devices/bus/nubus/pds30_cb264.cpp +++ b/src/devices/bus/nubus/pds30_cb264.cpp @@ -10,6 +10,9 @@ #include "pds30_cb264.h" #include "screen.h" +#include <algorithm> + + #define CB264SE30_SCREEN_NAME "cb264_screen" #define CB264SE30_ROM_REGION "cb264_rom" @@ -133,21 +136,17 @@ void nubus_cb264se30_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[8*1024]; + uint8_t const *const vram = &m_vram[8*1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -162,12 +161,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -178,13 +177,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -193,13 +191,12 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -207,17 +204,11 @@ uint32_t nubus_cb264se30_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 24 bpp { - uint32_t *vram32 = (uint32_t *)&m_vram[0]; - uint32_t *base; + uint32_t const *const vram32 = (uint32_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/pds30_mc30.cpp b/src/devices/bus/nubus/pds30_mc30.cpp index 20969a5a6b7..87992723319 100644 --- a/src/devices/bus/nubus/pds30_mc30.cpp +++ b/src/devices/bus/nubus/pds30_mc30.cpp @@ -13,6 +13,9 @@ #include "pds30_mc30.h" #include "screen.h" +#include <algorithm> + + #define XCEEDMC30_SCREEN_NAME "x30hr_screen" #define XCEEDMC30_ROM_REGION "x30hr_rom" @@ -135,41 +138,37 @@ void nubus_xceedmc30_device::device_timer(emu_timer &timer, device_timer_id tid, uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[4*1024]; + uint8_t const *const vram = &m_vram[4*1024]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; - - *scanline++ = m_palette[(pixels>>7)&1]; - *scanline++ = m_palette[(pixels>>6)&1]; - *scanline++ = m_palette[(pixels>>5)&1]; - *scanline++ = m_palette[(pixels>>4)&1]; - *scanline++ = m_palette[(pixels>>3)&1]; - *scanline++ = m_palette[(pixels>>2)&1]; - *scanline++ = m_palette[(pixels>>1)&1]; - *scanline++ = m_palette[pixels&1]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + + *scanline++ = m_palette[BIT(pixels, 7)]; + *scanline++ = m_palette[BIT(pixels, 6)]; + *scanline++ = m_palette[BIT(pixels, 5)]; + *scanline++ = m_palette[BIT(pixels, 4)]; + *scanline++ = m_palette[BIT(pixels, 3)]; + *scanline++ = m_palette[BIT(pixels, 2)]; + *scanline++ = m_palette[BIT(pixels, 1)]; + *scanline++ = m_palette[BIT(pixels, 0)]; } } break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[((pixels>>6)&3)]; *scanline++ = m_palette[((pixels>>4)&3)]; @@ -180,13 +179,13 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640/2; x++) + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels>>4)]; *scanline++ = m_palette[(pixels&0xf)]; @@ -195,13 +194,13 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 640; x++) + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -209,17 +208,11 @@ uint32_t nubus_xceedmc30_device::screen_update(screen_device &screen, bitmap_rgb case 4: // 24 bpp { - uint32_t *vram32 = (uint32_t *)vram; - uint32_t *base; + uint32_t const *const vram32 = (uint32_t *)vram; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - base = &vram32[y * 1024]; - for (x = 0; x < 640; x++) - { - *scanline++ = *base++; - } + std::copy_n(&vram32[y * 1024], 640, &bitmap.pix(y)); } } break; diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp index b251a57c33c..83fd8512704 100644 --- a/src/devices/bus/nubus/pds30_procolor816.cpp +++ b/src/devices/bus/nubus/pds30_procolor816.cpp @@ -139,21 +139,17 @@ void nubus_procolor816_device::device_timer(emu_timer &timer, device_timer_id ti uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; - - vram = &m_vram[4]; + uint8_t const *const vram = &m_vram[4]; switch (m_mode) { case 0: // 1 bpp? - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/8; x++) { - pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/8) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; @@ -168,12 +164,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 1: // 2 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/4; x++) { - pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/4) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xc0)]; *scanline++ = m_palette[((pixels<<2)&0xc0)]; @@ -184,13 +180,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 2: // 4 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640/2; x++) { - pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640/2) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0xf0)]; *scanline++ = m_palette[((pixels&0x0f)<<4)]; @@ -199,13 +194,12 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r break; case 3: // 8 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * 640) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[pixels]; } } @@ -213,16 +207,15 @@ uint32_t nubus_procolor816_device::screen_update(screen_device &screen, bitmap_r case 4: // 15 bpp { - uint16_t *vram16 = (uint16_t *)&m_vram[0]; - uint16_t pixels; + uint16_t const *const vram16 = (uint16_t *)&m_vram[0]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram16[(y * 640) + (x^1)]; - *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); + uint16_t const pixels = vram16[(y * 640) + BYTE_XOR_BE(x)]; + *scanline++ = rgb_t(pal5bit((pixels>>10) & 0x1f), pal5bit((pixels>>5) & 0x1f), pal5bit(pixels & 0x1f)); } } } diff --git a/src/devices/bus/nubus/pds30_sigmalview.cpp b/src/devices/bus/nubus/pds30_sigmalview.cpp index c509b908064..e04e4b2e297 100644 --- a/src/devices/bus/nubus/pds30_sigmalview.cpp +++ b/src/devices/bus/nubus/pds30_sigmalview.cpp @@ -132,18 +132,14 @@ void nubus_lview_device::device_timer(emu_timer &timer, device_timer_id tid, int uint32_t nubus_lview_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, *vram; + uint8_t const *const vram = &m_vram[0x20]; - vram = &m_vram[0x20]; - - for (y = 0; y < 600; y++) + for (int y = 0; y < 600; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 832/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 832/8; x++) { - pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram[(y * (832/8)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_palette[(pixels&0x80)]; *scanline++ = m_palette[((pixels<<1)&0x80)]; diff --git a/src/devices/bus/odyssey2/4in1.cpp b/src/devices/bus/odyssey2/4in1.cpp index f0eefac089b..dfadbf2c1ab 100644 --- a/src/devices/bus/odyssey2/4in1.cpp +++ b/src/devices/bus/odyssey2/4in1.cpp @@ -22,7 +22,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_4IN1, o2_4in1_device, "o2_4in1", "Odyssey 2 Videopac 4 // o2_4in1_device - constructor //------------------------------------------------- -o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_4in1_device::o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_4IN1, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/4in1.h b/src/devices/bus/odyssey2/4in1.h index 09cfa626b38..2840361bfe0 100644 --- a/src/devices/bus/odyssey2/4in1.h +++ b/src/devices/bus/odyssey2/4in1.h @@ -21,7 +21,7 @@ class o2_4in1_device : public device_t, { public: // construction/destruction - o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_4in1_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/chess.cpp b/src/devices/bus/odyssey2/chess.cpp index f954ca93340..6ff1ff76dd2 100644 --- a/src/devices/bus/odyssey2/chess.cpp +++ b/src/devices/bus/odyssey2/chess.cpp @@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_CHESS, o2_chess_device, "o2_chess", "Odyssey 2 Videopa // o2_chess_device - constructor //------------------------------------------------- -o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_chess_device::o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_CHESS, tag, owner, clock), device_o2_cart_interface(mconfig, *this), m_maincpu(*this, "maincpu"), diff --git a/src/devices/bus/odyssey2/chess.h b/src/devices/bus/odyssey2/chess.h index d4e861e2a64..0b37c50684c 100644 --- a/src/devices/bus/odyssey2/chess.h +++ b/src/devices/bus/odyssey2/chess.h @@ -24,7 +24,7 @@ class o2_chess_device : public device_t, { public: // construction/destruction - o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_chess_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/homecomp.cpp b/src/devices/bus/odyssey2/homecomp.cpp index 352d0f2a452..23c6f6c31f7 100644 --- a/src/devices/bus/odyssey2/homecomp.cpp +++ b/src/devices/bus/odyssey2/homecomp.cpp @@ -30,7 +30,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_HOMECOMP, o2_homecomp_device, "o2_homecomp", "Odyssey // o2_homecomp_device - constructor //------------------------------------------------- -o2_homecomp_device::o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_homecomp_device::o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_HOMECOMP, tag, owner, clock), device_o2_cart_interface(mconfig, *this), m_maincpu(*this, "maincpu"), diff --git a/src/devices/bus/odyssey2/homecomp.h b/src/devices/bus/odyssey2/homecomp.h index f530cd36375..6ecc67f1184 100644 --- a/src/devices/bus/odyssey2/homecomp.h +++ b/src/devices/bus/odyssey2/homecomp.h @@ -25,7 +25,7 @@ class o2_homecomp_device : public device_t, { public: // construction/destruction - o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_homecomp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/ktaa.cpp b/src/devices/bus/odyssey2/ktaa.cpp index 24d62c81796..4f1fba25153 100644 --- a/src/devices/bus/odyssey2/ktaa.cpp +++ b/src/devices/bus/odyssey2/ktaa.cpp @@ -18,7 +18,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_KTAA, o2_ktaa_device, "o2_ktaa", "Odyssey 2 Homebrew K // o2_ktaa_device - constructor //------------------------------------------------- -o2_ktaa_device::o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_ktaa_device::o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_KTAA, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/ktaa.h b/src/devices/bus/odyssey2/ktaa.h index e1ac477e445..53ce2296941 100644 --- a/src/devices/bus/odyssey2/ktaa.h +++ b/src/devices/bus/odyssey2/ktaa.h @@ -21,7 +21,7 @@ class o2_ktaa_device : public device_t, { public: // construction/destruction - o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_ktaa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/rally.cpp b/src/devices/bus/odyssey2/rally.cpp index 7bdec3502b3..42dcdc0b26f 100644 --- a/src/devices/bus/odyssey2/rally.cpp +++ b/src/devices/bus/odyssey2/rally.cpp @@ -26,7 +26,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_RALLY, o2_rally_device, "o2_rally", "Odyssey 2 Videopa // o2_rally_device - constructor //------------------------------------------------- -o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_rally_device::o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_RALLY, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/rally.h b/src/devices/bus/odyssey2/rally.h index 81de2673ae6..8d359362dce 100644 --- a/src/devices/bus/odyssey2/rally.h +++ b/src/devices/bus/odyssey2/rally.h @@ -21,7 +21,7 @@ class o2_rally_device : public device_t, { public: // construction/destruction - o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_rally_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/rom.cpp b/src/devices/bus/odyssey2/rom.cpp index f54398914e3..12f8fa9b128 100644 --- a/src/devices/bus/odyssey2/rom.cpp +++ b/src/devices/bus/odyssey2/rom.cpp @@ -16,7 +16,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_STD, o2_rom_device, "o2_rom", "Odyssey 2 Standard Cart // o2_rom_device - constructor //------------------------------------------------- -o2_rom_device::o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_rom_device::o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_STD, tag, owner, clock), device_o2_cart_interface(mconfig, *this) { } diff --git a/src/devices/bus/odyssey2/rom.h b/src/devices/bus/odyssey2/rom.h index 74e742a38d8..204d96030ce 100644 --- a/src/devices/bus/odyssey2/rom.h +++ b/src/devices/bus/odyssey2/rom.h @@ -21,7 +21,7 @@ class o2_rom_device : public device_t, { public: // construction/destruction - o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/slot.cpp b/src/devices/bus/odyssey2/slot.cpp index 2e020342366..5f0f30e2f35 100644 --- a/src/devices/bus/odyssey2/slot.cpp +++ b/src/devices/bus/odyssey2/slot.cpp @@ -50,7 +50,7 @@ device_o2_cart_interface::~device_o2_cart_interface() //------------------------------------------------- // o2_cart_slot_device - constructor //------------------------------------------------- -o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +o2_cart_slot_device::o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_CART_SLOT, tag, owner, clock) , device_image_interface(mconfig, *this) , device_single_card_slot_interface<device_o2_cart_interface>(mconfig, *this) @@ -148,7 +148,7 @@ image_init_result o2_cart_slot_device::call_load() } else { - uint32_t size = length(); + u32 size = length(); fread(m_cart->m_rom, size); m_type = (size == 0x4000) ? O2_RALLY : O2_STD; @@ -174,7 +174,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft if (hook.image_file()) { const char *slot_string; - uint32_t size = hook.image_file()->size(); + u32 size = hook.image_file()->size(); int type = (size == 0x4000) ? O2_RALLY : O2_STD; slot_string = o2_get_slot(type); @@ -190,7 +190,7 @@ std::string o2_cart_slot_device::get_default_card_software(get_default_card_soft read_rom** -------------------------------------------------*/ -uint8_t o2_cart_slot_device::read_rom04(offs_t offset) +u8 o2_cart_slot_device::read_rom04(offs_t offset) { if (m_cart) return m_cart->read_rom04(offset); @@ -198,7 +198,7 @@ uint8_t o2_cart_slot_device::read_rom04(offs_t offset) return 0xff; } -uint8_t o2_cart_slot_device::read_rom0c(offs_t offset) +u8 o2_cart_slot_device::read_rom0c(offs_t offset) { if (m_cart) return m_cart->read_rom0c(offset); @@ -210,13 +210,13 @@ uint8_t o2_cart_slot_device::read_rom0c(offs_t offset) io -------------------------------------------------*/ -void o2_cart_slot_device::io_write(offs_t offset, uint8_t data) +void o2_cart_slot_device::io_write(offs_t offset, u8 data) { if (m_cart) m_cart->io_write(offset, data); } -uint8_t o2_cart_slot_device::io_read(offs_t offset) +u8 o2_cart_slot_device::io_read(offs_t offset) { if (m_cart) return m_cart->io_read(offset); diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index 0717ce973f2..4c65fafe01e 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -37,30 +37,30 @@ public: virtual ~device_o2_cart_interface(); // reading and writing - virtual uint8_t read_rom04(offs_t offset) { return 0xff; } - virtual uint8_t read_rom0c(offs_t offset) { return 0xff; } - virtual void write_p1(uint8_t data) { } - virtual void write_p2(uint8_t data) { } + virtual u8 read_rom04(offs_t offset) { return 0xff; } + virtual u8 read_rom0c(offs_t offset) { return 0xff; } + virtual void write_p1(u8 data) { } + virtual void write_p2(u8 data) { } - virtual void io_write(offs_t offset, uint8_t data) { } - virtual uint8_t io_read(offs_t offset) { return 0xff; } + virtual void io_write(offs_t offset, u8 data) { } + virtual u8 io_read(offs_t offset) { return 0xff; } virtual DECLARE_READ_LINE_MEMBER(t0_read) { return 0; } virtual int b_read() { return -1; } virtual void cart_init() { } // called after loading ROM - uint8_t* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; } - uint32_t get_rom_size() { return m_rom ? m_rom.bytes() : 0; } + u8* get_rom_base() { return m_rom ? &m_rom[0] : nullptr; } + u32 get_rom_size() { return m_rom ? m_rom.bytes() : 0; } - uint8_t* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; } - uint32_t get_voice_size() { return m_voice ? m_voice.bytes() : 0; } + u8* get_voice_base() { return m_voice ? &m_voice[0] : nullptr; } + u32 get_voice_size() { return m_voice ? m_voice.bytes() : 0; } protected: device_o2_cart_interface(const machine_config &mconfig, device_t &device); - optional_shared_ptr<uint8_t> m_rom; - optional_shared_ptr<uint8_t> m_exrom; - optional_shared_ptr<uint8_t> m_voice; + optional_shared_ptr<u8> m_rom; + optional_shared_ptr<u8> m_exrom; + optional_shared_ptr<u8> m_voice; }; @@ -82,7 +82,7 @@ public: set_fixed(false); } - o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); virtual ~o2_cart_slot_device(); // image-level overrides @@ -105,15 +105,15 @@ public: device_o2_cart_interface* cart() { return m_cart; } // reading and writing - uint8_t read_rom04(offs_t offset); - uint8_t read_rom0c(offs_t offset); - void io_write(offs_t offset, uint8_t data); - uint8_t io_read(offs_t offset); + u8 read_rom04(offs_t offset); + u8 read_rom0c(offs_t offset); + void io_write(offs_t offset, u8 data); + u8 io_read(offs_t offset); DECLARE_READ_LINE_MEMBER(t0_read) { if (m_cart) return m_cart->t0_read(); else return 0; } int b_read(); - void write_p1(uint8_t data) { if (m_cart) m_cart->write_p1(data); } - void write_p2(uint8_t data) { if (m_cart) m_cart->write_p2(data); } + void write_p1(u8 data) { if (m_cart) m_cart->write_p1(data); } + void write_p2(u8 data) { if (m_cart) m_cart->write_p2(data); } protected: // device-level overrides diff --git a/src/devices/bus/odyssey2/voice.cpp b/src/devices/bus/odyssey2/voice.cpp index f741946dfa0..927b8fcc05e 100644 --- a/src/devices/bus/odyssey2/voice.cpp +++ b/src/devices/bus/odyssey2/voice.cpp @@ -24,7 +24,7 @@ DEFINE_DEVICE_TYPE(O2_ROM_VOICE, o2_voice_device, "o2_voice", "Odyssey 2 The Voi // o2_voice_device - constructor //------------------------------------------------- -o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +o2_voice_device::o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, O2_ROM_VOICE, tag, owner, clock), device_o2_cart_interface(mconfig, *this), m_speech(*this, "speech"), diff --git a/src/devices/bus/odyssey2/voice.h b/src/devices/bus/odyssey2/voice.h index 829267fd439..b717334149a 100644 --- a/src/devices/bus/odyssey2/voice.h +++ b/src/devices/bus/odyssey2/voice.h @@ -22,7 +22,7 @@ class o2_voice_device : public device_t, { public: // construction/destruction - o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + o2_voice_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); virtual void cart_init() override; diff --git a/src/devices/bus/s100/dg640.cpp b/src/devices/bus/s100/dg640.cpp index 7f79983f17d..f6adb27cfa8 100644 --- a/src/devices/bus/s100/dg640.cpp +++ b/src/devices/bus/s100/dg640.cpp @@ -39,28 +39,26 @@ void dg640_device::device_start() uint32_t dg640_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // attributes bit 0 = flash, bit 1 = lores. Also bit 7 of the character = reverse-video (text only). - uint8_t y,ra,chr,gfx,attr,inv,gfxbit; - uint16_t sy=0,ma=0,x; - bool flash; + uint16_t sy=0,ma=0; m_framecnt++; - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - attr = m_p_attribram[x]; - chr = m_p_videoram[x]; - flash = BIT(m_framecnt, 4) & BIT(attr, 0); + uint8_t attr = m_p_attribram[x]; + uint8_t chr = m_p_videoram[x]; + bool flash = BIT(m_framecnt, 4) & BIT(attr, 0); if (BIT(attr, 1)) // lores gfx - can flash { if (flash) chr = 0; // blank part of flashing - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c) >> 1; /* Display one line of a lores character (8 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -74,11 +72,11 @@ uint32_t dg640_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else { - gfx = 0; + uint8_t gfx = 0; if (!flash) { - inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed + uint8_t inv = BIT(chr, 7) ? 0xff : 0; // text with bit 7 high is reversed chr &= 0x7f; gfx = inv; diff --git a/src/devices/bus/s100/polyvti.cpp b/src/devices/bus/s100/polyvti.cpp index 973e89c0693..242d13a8fe2 100644 --- a/src/devices/bus/s100/polyvti.cpp +++ b/src/devices/bus/s100/polyvti.cpp @@ -119,22 +119,22 @@ u32 poly_vti_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { u8 r = b/5; if (l==0 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,5) ? 0 : 1; if (l==0 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,2) ? 0 : 1; if (l==1 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,4) ? 0 : 1; if (l==1 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,1) ? 0 : 1; if (l==2 && r==0) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,3) ? 0 : 1; if (l==2 && r==1) - bitmap.pix16(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; + bitmap.pix(y*15+j, xpos+b ) = BIT(code,0) ? 0 : 1; } } } @@ -156,11 +156,11 @@ u32 poly_vti_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, } for (int b = 0; b < 7; b++) - bitmap.pix16(y*15+j, xpos+b ) = (l >> (6-b)) & 1; + bitmap.pix(y*15+j, xpos+b ) = (l >> (6-b)) & 1; - bitmap.pix16(y*15+j, xpos+7 ) = 0; - bitmap.pix16(y*15+j, xpos+8 ) = 0; - bitmap.pix16(y*15+j, xpos+9 ) = 0; + bitmap.pix(y*15+j, xpos+7 ) = 0; + bitmap.pix(y*15+j, xpos+8 ) = 0; + bitmap.pix(y*15+j, xpos+9 ) = 0; } } xpos += 10; diff --git a/src/devices/bus/sbus/bwtwo.cpp b/src/devices/bus/sbus/bwtwo.cpp index 55d9f92b7b6..c034d43e05f 100644 --- a/src/devices/bus/sbus/bwtwo.cpp +++ b/src/devices/bus/sbus/bwtwo.cpp @@ -10,6 +10,9 @@ #include "bwtwo.h" #include "screen.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SBUS_BWTWO, sbus_bwtwo_device, "bwtwo", "Sun bwtwo SBus Video") void sbus_bwtwo_device::mem_map(address_map &map) @@ -72,14 +75,14 @@ void sbus_bwtwo_device::install_device() uint32_t sbus_bwtwo_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *line = &m_vram[0]; + uint8_t const *line = &m_vram[0]; for (int y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 1152/8; x++) { - memcpy(scanline, m_mono_lut[*line], sizeof(uint32_t) * 8); + std::copy_n(m_mono_lut[*line], 8, scanline); line++; scanline += 8; } diff --git a/src/devices/bus/sbus/cgsix.cpp b/src/devices/bus/sbus/cgsix.cpp index 5d7bd715efd..65a24e1b505 100644 --- a/src/devices/bus/sbus/cgsix.cpp +++ b/src/devices/bus/sbus/cgsix.cpp @@ -171,12 +171,12 @@ void sbus_cgsix_device::device_reset() uint32_t sbus_cgsix_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_ramdac->pens(); - uint8_t *vram = (uint8_t *)&m_vram[0]; + pen_t const *const pens = m_ramdac->pens(); + uint8_t const *const vram = (uint8_t *)&m_vram[0]; for (int16_t y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); const bool cursor_row_hit = (y >= m_cursor_y && y < (m_cursor_y + 32)); for (int16_t x = 0; x < 1152; x++) { diff --git a/src/devices/bus/sbus/cgthree.cpp b/src/devices/bus/sbus/cgthree.cpp index 5ffe6a885c5..ad0ba5c1467 100644 --- a/src/devices/bus/sbus/cgthree.cpp +++ b/src/devices/bus/sbus/cgthree.cpp @@ -67,12 +67,12 @@ void sbus_cgthree_device::install_device() uint32_t sbus_cgthree_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_ramdac->pens(); - uint8_t *vram = (uint8_t *)&m_vram[0]; + pen_t const *const pens = m_ramdac->pens(); + uint8_t const *const vram = (uint8_t *)&m_vram[0]; for (int y = 0; y < 900; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 1152; x++) { const uint8_t pixel = vram[y * 1152 + BYTE4_XOR_BE(x)]; diff --git a/src/devices/bus/svi3x8/slot/sv806.cpp b/src/devices/bus/svi3x8/slot/sv806.cpp index bc4dafbd415..5a7d858d38b 100644 --- a/src/devices/bus/svi3x8/slot/sv806.cpp +++ b/src/devices/bus/svi3x8/slot/sv806.cpp @@ -94,7 +94,7 @@ void sv806_device::device_start() MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -103,14 +103,14 @@ MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) if (i == cursor_x) data = 0xff; - bitmap.pix32(y, i * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, i * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, i * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, i * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, i * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, i * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, i * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, i * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, i * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, i * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, i * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, i * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, i * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, i * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, i * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, i * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/devices/bus/tanbus/mpvdu.cpp b/src/devices/bus/tanbus/mpvdu.cpp index e9f4fe766eb..28cd0b988f9 100644 --- a/src/devices/bus/tanbus/mpvdu.cpp +++ b/src/devices/bus/tanbus/mpvdu.cpp @@ -149,7 +149,7 @@ uint8_t tanbus_mpvdu_device::videoram_r(offs_t offset) MC6845_UPDATE_ROW(tanbus_mpvdu_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); @@ -165,11 +165,11 @@ MC6845_UPDATE_ROW(tanbus_mpvdu_device::crtc_update_row) m_trom->tr6_w(1); m_trom->tr6_w(0); - int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + int const col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; + int const r = BIT(col, 0) * 0xff; + int const g = BIT(col, 1) * 0xff; + int const b = BIT(col, 2) * 0xff; *p++ = rgb_t(r, g, b); } diff --git a/src/devices/bus/tanbus/ravdu.cpp b/src/devices/bus/tanbus/ravdu.cpp index 80664797081..b93b1a41c35 100644 --- a/src/devices/bus/tanbus/ravdu.cpp +++ b/src/devices/bus/tanbus/ravdu.cpp @@ -161,7 +161,7 @@ uint8_t tanbus_ravdu_device::videoram_r(offs_t offset) MC6845_UPDATE_ROW(tanbus_ravdu_device::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); m_trom->lose_w(1); m_trom->lose_w(0); @@ -178,11 +178,11 @@ MC6845_UPDATE_ROW(tanbus_ravdu_device::crtc_update_row) m_trom->tr6_w(1); m_trom->tr6_w(0); - int col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); + int const col = m_trom->get_rgb() ^ ((column == cursor_x) ? 7 : 0); - int r = BIT(col, 0) * 0xff; - int g = BIT(col, 1) * 0xff; - int b = BIT(col, 2) * 0xff; + int const r = BIT(col, 0) * 0xff; + int const g = BIT(col, 1) * 0xff; + int const b = BIT(col, 2) * 0xff; *p++ = rgb_t(r, g, b); } diff --git a/src/devices/bus/tanbus/tanhrg.cpp b/src/devices/bus/tanbus/tanhrg.cpp index 1c8ffc87ab5..b857e84ac69 100644 --- a/src/devices/bus/tanbus/tanhrg.cpp +++ b/src/devices/bus/tanbus/tanhrg.cpp @@ -323,16 +323,13 @@ void tanbus_tanhrgc_device::set_inhibit_lines(offs_t offset, int &inhram, int &i uint32_t tanbus_tanhrg_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t offset; - uint32_t *p; - for (int y = 0; y < 256; y++) { - p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int x = 0; x < 256; x++) { - offset = (y * 32) + (x / 8); + uint16_t const offset = (y * 32) + (x / 8); *p++ = m_palette->pen_color(BIT(m_videoram[offset], x & 7)); } @@ -344,21 +341,17 @@ uint32_t tanbus_tanhrg_device::screen_update(screen_device &screen, bitmap_rgb32 uint32_t tanbus_tanhrgc_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t r, g, b; - uint16_t offset; - uint32_t *p; - for (int y = 0; y < 256; y++) { - p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (int x = 0; x < 256; x++) { - offset = (y * 32) + (x / 8); + uint16_t const offset = (y * 32) + (x / 8); - r = m_videoram[0x0000 | offset]; - b = m_videoram[0x2000 | offset]; - g = m_videoram[0x4000 | offset]; + uint8_t const r = m_videoram[0x0000 | offset]; + uint8_t const b = m_videoram[0x2000 | offset]; + uint8_t const g = m_videoram[0x4000 | offset]; *p++ = m_palette->pen_color(BIT(b, x & 7) << 2 | BIT(g, x & 7) << 1 | BIT(r, x & 7)); } diff --git a/src/devices/bus/tanbus/tug8082.cpp b/src/devices/bus/tanbus/tug8082.cpp index 1e4ad1a4504..582ab726c8e 100644 --- a/src/devices/bus/tanbus/tug8082.cpp +++ b/src/devices/bus/tanbus/tug8082.cpp @@ -241,18 +241,14 @@ WRITE_LINE_MEMBER(tanbus_tug8082_device::vdu_irq_w) uint32_t tanbus_tug8082_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; + pen_t const *const pen = m_palette->pens(); - const pen_t *pen = m_palette->pens(); - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 64; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 64; x++) { - pixels = m_videoram[(y * 64) + x]; + uint8_t const pixels = m_videoram[(y * 64) + x]; for (int i = 0; i < 8; ++i) *scanline++ = pen[BIT(pixels, 7 - i)]; diff --git a/src/devices/bus/ti99/internal/992board.cpp b/src/devices/bus/ti99/internal/992board.cpp index 031f82d7fe5..2f01c025cb6 100644 --- a/src/devices/bus/ti99/internal/992board.cpp +++ b/src/devices/bus/ti99/internal/992board.cpp @@ -202,7 +202,7 @@ void video992_device::device_timer(emu_timer &timer, device_timer_id id, int par } int vpos = raw_vpos * m_vertical_size / screen().height(); - uint32_t *p = &m_tmpbmp.pix32(vpos); + uint32_t *p = &m_tmpbmp.pix(vpos); bool endofline = false; int linelength = 0; diff --git a/src/devices/bus/vic20/videopak.cpp b/src/devices/bus/vic20/videopak.cpp index 187224721be..1f2b3c35431 100644 --- a/src/devices/bus/vic20/videopak.cpp +++ b/src/devices/bus/vic20/videopak.cpp @@ -77,7 +77,7 @@ MC6845_UPDATE_ROW( vic20_video_pak_device::crtc_update_row ) int x = (column * 8) + bit; int color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/devices/bus/wangpc/lvc.cpp b/src/devices/bus/wangpc/lvc.cpp index 4d31a7b9367..1fd3c0610d4 100644 --- a/src/devices/bus/wangpc/lvc.cpp +++ b/src/devices/bus/wangpc/lvc.cpp @@ -62,17 +62,17 @@ MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row ) { for (int column = 0; column < x_count; column++) { - offs_t addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f)); + offs_t const addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f)); uint16_t data = m_video_ram[addr & 0x7fff]; for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; int color = (BIT(data, 15) << 1) | BIT(data, 7); if (column == cursor_x) color = 0x03; - bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); + bitmap.pix(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); data <<= 1; } @@ -89,12 +89,12 @@ MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row ) for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; int color = (BIT(data, 31) << 3) | (BIT(data, 23) << 2) | (BIT(data, 15) << 1) | BIT(data, 7); if (column == cursor_x) color = 0x03; - bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); + bitmap.pix(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black(); data <<= 1; } diff --git a/src/devices/bus/wangpc/mvc.cpp b/src/devices/bus/wangpc/mvc.cpp index 562e277f982..cff515a05c1 100644 --- a/src/devices/bus/wangpc/mvc.cpp +++ b/src/devices/bus/wangpc/mvc.cpp @@ -73,15 +73,15 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) { for (int sx = 0; sx < 50; sx++) { - offs_t addr = (y * 50) + sx; + offs_t const addr = (y * 50) + sx; uint16_t data = m_bitmap_ram[addr]; for (int bit = 0; bit < 16; bit++) { - int x = (sx * 16) + bit; - int color = BIT(data, 15) && de; + int const x = (sx * 16) + bit; + int const color = BIT(data, 15) && de; - bitmap.pix32(vbp + y, hbp + x) = PALETTE_MVC[color]; + bitmap.pix(vbp + y, hbp + x) = PALETTE_MVC[color]; data <<= 1; } @@ -89,8 +89,8 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) for (int column = 0; column < x_count; column++) { - uint16_t code = m_video_ram[((ma + column) & 0x7ff)]; - uint8_t attr = code & 0xff; + uint16_t const code = m_video_ram[((ma + column) & 0x7ff)]; + uint8_t const attr = code & 0xff; uint8_t new_ra = ra + 1; @@ -103,7 +103,7 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) new_ra = ra; } - offs_t addr = ((code >> 8) << 4) | (new_ra & 0x0f); + offs_t const addr = ((code >> 8) << 4) | (new_ra & 0x0f); uint16_t data = m_char_ram[addr & 0xfff]; if ((column == cursor_x) || (!ra && ATTR_OVERSCORE) || ((ra == 9) && ATTR_UNDERSCORE)) @@ -113,11 +113,13 @@ MC6845_UPDATE_ROW( wangpc_mvc_device::crtc_update_row ) for (int bit = 0; bit < 10; bit++) { - int x = (column * 10) + bit; + int const x = (column * 10) + bit; int color = ((BIT(data, 9) & ~ATTR_BLANK) ^ ATTR_REVERSE); - if ((color | bitmap.pix32(vbp + y, hbp + x)) & ATTR_BOLD) color = 2; - if (color) bitmap.pix32(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black(); + if ((color | bitmap.pix(vbp + y, hbp + x)) & ATTR_BOLD) + color = 2; + if (color) + bitmap.pix(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black(); data <<= 1; } diff --git a/src/devices/cpu/e0c6200/e0c6s46.cpp b/src/devices/cpu/e0c6200/e0c6s46.cpp index 9f80774a6e5..5094c36a5f7 100644 --- a/src/devices/cpu/e0c6200/e0c6s46.cpp +++ b/src/devices/cpu/e0c6200/e0c6s46.cpp @@ -589,7 +589,7 @@ u32 e0c6s46_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!m_pixel_update_cb.isnull()) m_pixel_update_cb(bitmap, cliprect, m_lcd_contrast, seg, com, pixel); else if (cliprect.contains(seg, com)) - bitmap.pix16(com, seg) = pixel; + bitmap.pix(com, seg) = pixel; } } } diff --git a/src/devices/cpu/f8/f8dasm.cpp b/src/devices/cpu/f8/f8dasm.cpp index 24ec47b5154..e35a7d42f70 100644 --- a/src/devices/cpu/f8/f8dasm.cpp +++ b/src/devices/cpu/f8/f8dasm.cpp @@ -17,33 +17,22 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ { offs_t base_pc = pc; uint8_t op = opcodes.r8(pc++); + offs_t flags = SUPPORTED; switch( op ) { /* opcode bitmask */ case 0x00: /* 0000 0000 */ - util::stream_format(stream, "LR A,KU"); - break; case 0x01: /* 0000 0001 */ - util::stream_format(stream, "LR A,KL"); - break; case 0x02: /* 0000 0010 */ - util::stream_format(stream, "LR A,QU"); - break; case 0x03: /* 0000 0011 */ - util::stream_format(stream, "LR A,QL"); + util::stream_format(stream, "LR A,%s", rname[op + 12]); break; case 0x04: /* 0000 0100 */ - util::stream_format(stream, "LR KU,A"); - break; case 0x05: /* 0000 0101 */ - util::stream_format(stream, "LR KL,A"); - break; case 0x06: /* 0000 0110 */ - util::stream_format(stream, "LR QU,A"); - break; case 0x07: /* 0000 0111 */ - util::stream_format(stream, "LR QL,A"); + util::stream_format(stream, "LR %s,A", rname[(op - 0x04) + 12]); break; case 0x08: /* 0000 1000 */ @@ -60,7 +49,8 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ break; case 0x0c: /* 0000 1100 */ - util::stream_format(stream, "PK") ; + util::stream_format(stream, "PK"); + flags |= STEP_OUT; break; case 0x0d: /* 0000 1101 */ util::stream_format(stream, "LR P0,Q"); @@ -109,6 +99,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ break; case 0x1c: /* 0001 1100 */ util::stream_format(stream, "POP"); + flags |= STEP_OUT; break; case 0x1d: /* 0001 1101 */ util::stream_format(stream, "LR W,J"); @@ -120,39 +111,40 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "INC"); break; case 0x20: /* 0010 0000 */ - util::stream_format(stream, "LI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "LI H'%02X'", opcodes.r8(pc++)); break; case 0x21: /* 0010 0001 */ - util::stream_format(stream, "NI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "NI H'%02X'", opcodes.r8(pc++)); break; case 0x22: /* 0010 0010 */ - util::stream_format(stream, "OI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "OI H'%02X'", opcodes.r8(pc++)); break; case 0x23: /* 0010 0011 */ - util::stream_format(stream, "XI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "XI H'%02X'", opcodes.r8(pc++)); break; case 0x24: /* 0010 0100 */ - util::stream_format(stream, "AI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "AI H'%02X'", opcodes.r8(pc++)); break; case 0x25: /* 0010 0101 */ - util::stream_format(stream, "CI $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "CI H'%02X'", opcodes.r8(pc++)); break; case 0x26: /* 0010 0110 */ - util::stream_format(stream, "IN $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "IN H'%02X'", opcodes.r8(pc++)); break; case 0x27: /* 0010 0111 */ - util::stream_format(stream, "OUT $%02X", opcodes.r8(pc++)); + util::stream_format(stream, "OUT H'%02X'", opcodes.r8(pc++)); break; case 0x28: /* 0010 1000 */ - util::stream_format(stream, "PI $%04X", opcodes.r16(pc)); + util::stream_format(stream, "PI H'%04X'", opcodes.r16(pc)); pc += 2; + flags |= STEP_OVER; break; case 0x29: /* 0010 1001 */ - util::stream_format(stream, "JMP $%04X", opcodes.r16(pc)); + util::stream_format(stream, "JMP H'%04X'", opcodes.r16(pc)); pc += 2; break; case 0x2a: /* 0010 1010 */ - util::stream_format(stream, "DCI $%04X", opcodes.r16(pc)); + util::stream_format(stream, "DCI H'%04X'", opcodes.r16(pc)); pc += 2; break; case 0x2b: /* 0010 1011 */ @@ -161,11 +153,9 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x2c: /* 0010 1100 */ util::stream_format(stream, "XDC"); break; - case 0x2d: /* 0010 1101 */ - case 0x2e: /* 0010 1110 */ - case 0x2f: /* 0010 1111 */ - util::stream_format(stream, "??? $%02X",op); - break; + /* case 0x2d: 0010 1101 */ + /* case 0x2e: 0010 1110 */ + /* case 0x2f: 0010 1111 */ case 0x30: /* 0011 0000 */ case 0x31: /* 0011 0001 */ @@ -179,20 +169,18 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x39: /* 0011 1001 */ case 0x3a: /* 0011 1010 */ case 0x3b: /* 0011 1011 */ - util::stream_format(stream, "DS %s",rname[op & 15]); + util::stream_format(stream, "DS %s", rname[op & 15]); break; case 0x3c: /* 0011 1100 */ - util::stream_format(stream, "DS (IS)"); + util::stream_format(stream, "DS S"); break; case 0x3d: /* 0011 1101 */ - util::stream_format(stream, "DS (IS++)"); + util::stream_format(stream, "DS I"); break; case 0x3e: /* 0011 1110 */ - util::stream_format(stream, "DS (IS--)"); - break; - case 0x3f: /* 0011 1111 */ - util::stream_format(stream, "??? $%02X",op); + util::stream_format(stream, "DS D"); break; + /* case 0x3f: 0011 1111 */ case 0x40: /* 0100 0000 */ case 0x41: /* 0100 0001 */ @@ -206,20 +194,18 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x49: /* 0100 1001 */ case 0x4a: /* 0100 1010 */ case 0x4b: /* 0100 1011 */ - util::stream_format(stream, "LR A,%s",rname[op & 15]); + util::stream_format(stream, "LR A,%s", rname[op & 15]); break; case 0x4c: /* 0100 1100 */ - util::stream_format(stream, "LR A,(IS)"); + util::stream_format(stream, "LR A,S"); break; case 0x4d: /* 0100 1101 */ - util::stream_format(stream, "LR A,(IS++)"); + util::stream_format(stream, "LR A,I"); break; case 0x4e: /* 0100 1110 */ - util::stream_format(stream, "LR A,(IS--)"); - break; - case 0x4f: /* 0100 1111 */ - util::stream_format(stream, "??? $%02X",op); + util::stream_format(stream, "LR A,D"); break; + /* case 0x4f: 0100 1111 */ case 0x50: /* 0101 0000 */ case 0x51: /* 0101 0001 */ @@ -233,20 +219,18 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x59: /* 0101 1001 */ case 0x5a: /* 0101 1010 */ case 0x5b: /* 0101 1011 */ - util::stream_format(stream, "LR %s,A",rname[op & 15]); + util::stream_format(stream, "LR %s,A", rname[op & 15]); break; case 0x5c: /* 0101 1100 */ - util::stream_format(stream, "LR (IS),A"); + util::stream_format(stream, "LR S,A"); break; case 0x5d: /* 0101 1101 */ - util::stream_format(stream, "LR (IS++),A"); + util::stream_format(stream, "LR I,A"); break; case 0x5e: /* 0101 1110 */ - util::stream_format(stream, "LR (IS--),A"); - break; - case 0x5f: /* 0101 1111 */ - util::stream_format(stream, "??? $%02X",op); + util::stream_format(stream, "LR D,A"); break; + /* case 0x5f: 0101 1111 */ case 0x60: /* 0110 0000 */ case 0x61: /* 0110 0001 */ @@ -256,7 +240,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x65: /* 0110 0101 */ case 0x66: /* 0110 0110 */ case 0x67: /* 0110 0111 */ - util::stream_format(stream, "LISU $%02X", op & 0x07); + util::stream_format(stream, "LISU %d", op & 0x07); break; case 0x68: /* 0110 1000 */ case 0x69: /* 0110 1001 */ @@ -266,7 +250,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x6d: /* 0110 1101 */ case 0x6e: /* 0110 1110 */ case 0x6f: /* 0110 1111 */ - util::stream_format(stream, "LISL $%02X", op & 0x07); + util::stream_format(stream, "LISL %d", op & 0x07); break; case 0x70: /* 0111 0000 */ @@ -285,27 +269,27 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x7d: /* 0111 1101 */ case 0x7e: /* 0111 1110 */ case 0x7f: /* 0111 1111 */ - util::stream_format(stream, "LIS $%02X", op & 0x0f); + util::stream_format(stream, "LIS H'%02X'", op & 0x0f); break; case 0x81: /* 1000 0001 */ case 0x85: /* 1000 0101 */ - util::stream_format(stream, "BP $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BP H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x82: /* 1000 0010 */ - util::stream_format(stream, "BC $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BC H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x84: /* 1000 0100 */ - util::stream_format(stream, "BZ $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BZ H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x80: /* 1000 0000 */ case 0x83: /* 1000 0011 */ case 0x86: /* 1000 0110 */ case 0x87: /* 1000 0111 */ - util::stream_format(stream, "BT $%02X,$%04X", op & 0x07, base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BT H'%02X',H'%04X'", op & 0x07, base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x88: /* 1000 1000 */ @@ -337,28 +321,28 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ break; case 0x8f: /* 1000 1111 */ - util::stream_format(stream, "BR7 $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BR7 H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x90: /* 1001 0000 */ - util::stream_format(stream, "BR $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BR H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x91: /* 1001 0001 */ case 0x95: /* 1001 0101 */ - util::stream_format(stream, "BM $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BM H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x92: /* 1001 0010 */ - util::stream_format(stream, "BNC $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BNC H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x94: /* 1001 0100 */ - util::stream_format(stream, "BNZ $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BNZ H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x98: /* 1001 1000 */ - util::stream_format(stream, "BNO $%04X", base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BNO H'%04X'", base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0x93: /* 1001 0011 */ @@ -371,18 +355,16 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0x9d: /* 1001 1101 */ case 0x9e: /* 1001 1110 */ case 0x9f: /* 1001 1111 */ - util::stream_format(stream, "BF $%02X,$%04X", op & 0x0f, base_pc + (int8_t)opcodes.r8(pc++) + 1); + util::stream_format(stream, "BF H'%02X',H'%04X'", op & 0x0f, base_pc + (int8_t)opcodes.r8(pc++) + 1); break; case 0xa0: /* 1010 0000 */ case 0xa1: /* 1010 0001 */ - util::stream_format(stream, "INS $%02X", (unsigned) (int8_t) (op & 0x0F)); + util::stream_format(stream, "INS %d", op & 0x0f); break; - case 0xa2: /* 1010 0010 */ - case 0xa3: /* 1010 0011 */ - util::stream_format(stream, "??? $%02X", op); - break; + /* case 0xa2: 1010 0010 */ + /* case 0xa3: 1010 0011 */ case 0xa4: /* 1010 0100 */ case 0xa5: /* 1010 0101 */ @@ -396,18 +378,16 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0xad: /* 1010 1101 */ case 0xae: /* 1010 1110 */ case 0xaf: /* 1010 1111 */ - util::stream_format(stream, "INS $%02X", (int8_t) op & 0x0f); + util::stream_format(stream, "INS H'%02X'", op & 0x0f); break; case 0xb0: /* 1011 0000 */ case 0xb1: /* 1011 0001 */ - util::stream_format(stream, "OUTS $%02X", (int8_t) op & 0x0f); + util::stream_format(stream, "OUTS %d", op & 0x0f); break; - case 0xb2: /* 1011 0010 */ - case 0xb3: /* 1011 0011 */ - util::stream_format(stream, "??? $%02X", op); - break; + /* case 0xb2: 1011 0010 */ + /* case 0xb3: 1011 0011 */ case 0xb4: /* 1011 0100 */ case 0xb5: /* 1011 0101 */ @@ -421,7 +401,7 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ case 0xbd: /* 1011 1101 */ case 0xbe: /* 1011 1110 */ case 0xbf: /* 1011 1111 */ - util::stream_format(stream, "OUTS $%02X", (unsigned) (int8_t) op & 0x0f); + util::stream_format(stream, "OUTS H'%02X'", op & 0x0f); break; case 0xc0: /* 1100 0000 */ @@ -439,17 +419,15 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "AS %s", rname[op & 15]); break; case 0xcc: /* 1100 1100 */ - util::stream_format(stream, "AS (IS)"); + util::stream_format(stream, "AS S"); break; case 0xcd: /* 1100 1101 */ - util::stream_format(stream, "AS (IS++)"); + util::stream_format(stream, "AS I"); break; case 0xce: /* 1100 1110 */ - util::stream_format(stream, "AS (IS--)"); - break; - case 0xcf: /* 1100 1111 */ - util::stream_format(stream, "??? $%02X", op); + util::stream_format(stream, "AS D"); break; + /* case 0xcf: 1100 1111 */ case 0xd0: /* 1101 0000 */ case 0xd1: /* 1101 0001 */ @@ -466,17 +444,15 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "ASD %s", rname[op & 15]); break; case 0xdc: /* 1101 1100 */ - util::stream_format(stream, "ASD (IS)"); + util::stream_format(stream, "ASD S"); break; case 0xdd: /* 1101 1101 */ - util::stream_format(stream, "ASD (IS++)"); + util::stream_format(stream, "ASD I"); break; case 0xde: /* 1101 1110 */ - util::stream_format(stream, "ASD (IS--)"); - break; - case 0xdf: /* 1101 1111 */ - util::stream_format(stream, "??? $%02X", op); + util::stream_format(stream, "ASD D"); break; + /* case 0xdf: 1101 1111 */ case 0xe0: /* 1110 0000 */ case 0xe1: /* 1110 0001 */ @@ -493,17 +469,15 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "XS %s", rname[op & 15]); break; case 0xec: /* 1110 1100 */ - util::stream_format(stream, "XS (IS)"); + util::stream_format(stream, "XS S"); break; case 0xed: /* 1110 1101 */ - util::stream_format(stream, "XS (IS++)"); + util::stream_format(stream, "XS I"); break; case 0xee: /* 1110 1110 */ - util::stream_format(stream, "XS (IS--)"); - break; - case 0xef: /* 1110 1111 */ - util::stream_format(stream, "??? $%02X", op); + util::stream_format(stream, "XS D"); break; + /* case 0xef: 1110 1111 */ case 0xf0: /* 1111 0000 */ @@ -521,18 +495,21 @@ offs_t f8_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_ util::stream_format(stream, "NS %s", rname[op & 15]); break; case 0xfc: /* 1111 1100 */ - util::stream_format(stream, "NS (IS)"); + util::stream_format(stream, "NS S"); break; case 0xfd: /* 1111 1101 */ - util::stream_format(stream, "NS (IS++)"); + util::stream_format(stream, "NS I"); break; case 0xfe: /* 1111 1110 */ - util::stream_format(stream, "NS (IS--)"); + util::stream_format(stream, "NS D"); break; - case 0xff: /* 1111 1111 */ - util::stream_format(stream, "??? $%02X", op); + /* case 0xff: 1111 1111 */ + + + default: + util::stream_format(stream, "DC H'%02X' (?)", op); break; } - return pc - base_pc; + return (pc - base_pc) | flags; } diff --git a/src/devices/cpu/lc58/lc58d.cpp b/src/devices/cpu/lc58/lc58d.cpp new file mode 100644 index 00000000000..477ee00ffb0 --- /dev/null +++ b/src/devices/cpu/lc58/lc58d.cpp @@ -0,0 +1,160 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// LC58 generic disassembler + +#include "emu.h" +#include "lc58d.h" + +u32 lc58_disassembler::opcode_alignment() const +{ + return 1; +} + +#define P std::ostream &stream, const lc58_disassembler *d, u16 opcode +const lc58_disassembler::instruction lc58_disassembler::instructions[] { + { 0x5a00, 0xffff, [](P) -> u32 { util::stream_format(stream, "cla"); return 1; } }, + { 0xec01, 0xffff, [](P) -> u32 { util::stream_format(stream, "rcf"); return 1; } }, + { 0xe801, 0xffff, [](P) -> u32 { util::stream_format(stream, "scf"); return 1; } }, + { 0x6000, 0xfc00, [](P) -> u32 { util::stream_format(stream, "mrw wr%x, %02x", (opcode >> 7) & 7, opcode & 0x7f); return 1; } }, + { 0x6400, 0xfc00, [](P) -> u32 { util::stream_format(stream, "mwr %02x, wr%x", opcode & 0x7f, (opcode >> 7) & 7); return 1; } }, + { 0x6800, 0xff80, [](P) -> u32 { util::stream_format(stream, "sr0 %02x", opcode & 0x7f); return 1; } }, + { 0x6900, 0xff80, [](P) -> u32 { util::stream_format(stream, "sr1 %02x", opcode & 0x7f); return 1; } }, + { 0x6a00, 0xff80, [](P) -> u32 { util::stream_format(stream, "sl0 %02x", opcode & 0x7f); return 1; } }, + { 0x6b00, 0xff80, [](P) -> u32 { util::stream_format(stream, "sl1 %02x", opcode & 0x7f); return 1; } }, + { 0x6c00, 0xff80, [](P) -> u32 { util::stream_format(stream, "rar %02x", opcode & 0x7f); return 1; } }, + { 0x6e00, 0xff80, [](P) -> u32 { util::stream_format(stream, "ral %02x", opcode & 0x7f); return 1; } }, + { 0x7400, 0xff80, [](P) -> u32 { util::stream_format(stream, "maf %02x", opcode & 0x7f); return 1; } }, + { 0x0f80, 0xff80, [](P) -> u32 { util::stream_format(stream, "mra %02x", opcode & 0x7f); return 1; } }, + + { 0x4000, 0xff80, [](P) -> u32 { util::stream_format(stream, "adc %02x", opcode & 0x7f); return 1; } }, + { 0x4100, 0xff80, [](P) -> u32 { util::stream_format(stream, "adc* %02x", opcode & 0x7f); return 1; } }, + { 0x4200, 0xff80, [](P) -> u32 { util::stream_format(stream, "sbc %02x", opcode & 0x7f); return 1; } }, + { 0x4300, 0xff80, [](P) -> u32 { util::stream_format(stream, "sbc* %02x", opcode & 0x7f); return 1; } }, + { 0x4400, 0xff80, [](P) -> u32 { util::stream_format(stream, "add %02x", opcode & 0x7f); return 1; } }, + { 0x4500, 0xff80, [](P) -> u32 { util::stream_format(stream, "add* %02x", opcode & 0x7f); return 1; } }, + { 0x4600, 0xff80, [](P) -> u32 { util::stream_format(stream, "sub %02x", opcode & 0x7f); return 1; } }, + { 0x4700, 0xff80, [](P) -> u32 { util::stream_format(stream, "sub* %02x", opcode & 0x7f); return 1; } }, + { 0x4800, 0xff80, [](P) -> u32 { util::stream_format(stream, "adn %02x", opcode & 0x7f); return 1; } }, + { 0x4900, 0xff80, [](P) -> u32 { util::stream_format(stream, "adn* %02x", opcode & 0x7f); return 1; } }, + { 0x4a00, 0xff80, [](P) -> u32 { util::stream_format(stream, "and %02x", opcode & 0x7f); return 1; } }, + { 0x4b00, 0xff80, [](P) -> u32 { util::stream_format(stream, "and* %02x", opcode & 0x7f); return 1; } }, + { 0x4c00, 0xff80, [](P) -> u32 { util::stream_format(stream, "eor %02x", opcode & 0x7f); return 1; } }, + { 0x4d00, 0xff80, [](P) -> u32 { util::stream_format(stream, "eor* %02x", opcode & 0x7f); return 1; } }, + { 0x4e00, 0xff80, [](P) -> u32 { util::stream_format(stream, "or %02x", opcode & 0x7f); return 1; } }, + { 0x4f00, 0xff80, [](P) -> u32 { util::stream_format(stream, "or* %02x", opcode & 0x7f); return 1; } }, + { 0x5000, 0xff00, [](P) -> u32 { util::stream_format(stream, "adci #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5100, 0xff00, [](P) -> u32 { util::stream_format(stream, "adci* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5200, 0xff00, [](P) -> u32 { util::stream_format(stream, "sbci #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5300, 0xff00, [](P) -> u32 { util::stream_format(stream, "sbci* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5400, 0xff00, [](P) -> u32 { util::stream_format(stream, "addi #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5500, 0xff00, [](P) -> u32 { util::stream_format(stream, "addi* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5600, 0xff00, [](P) -> u32 { util::stream_format(stream, "subi #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5700, 0xff00, [](P) -> u32 { util::stream_format(stream, "subi* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5800, 0xff00, [](P) -> u32 { util::stream_format(stream, "adni #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5900, 0xff00, [](P) -> u32 { util::stream_format(stream, "adni* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5a00, 0xff00, [](P) -> u32 { util::stream_format(stream, "andi #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5b00, 0xff00, [](P) -> u32 { util::stream_format(stream, "andi* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5c00, 0xff00, [](P) -> u32 { util::stream_format(stream, "eori #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5d00, 0xff00, [](P) -> u32 { util::stream_format(stream, "eori* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5e00, 0xff00, [](P) -> u32 { util::stream_format(stream, "ori #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + { 0x5f00, 0xff00, [](P) -> u32 { util::stream_format(stream, "ori* #%x, %02x", (opcode >> 4) & 0xf, 0x70 + (opcode & 0xf)); return 1; } }, + + { 0x7700, 0xff80, [](P) -> u32 { util::stream_format(stream, "mdpl %02x", opcode & 0x7f); return 1; } }, + { 0x7680, 0xff80, [](P) -> u32 { util::stream_format(stream, "mdph %02x", opcode & 0x7f); return 1; } }, + { 0x6b80, 0xff80, [](P) -> u32 { util::stream_format(stream, "mrdl %02x", opcode & 0x7f); return 1; } }, + { 0x6980, 0xff80, [](P) -> u32 { util::stream_format(stream, "mrdh %02x", opcode & 0x7f); return 1; } }, + { 0x6a80, 0xff80, [](P) -> u32 { util::stream_format(stream, "mrsp %02x", opcode & 0x7f); return 1; } }, + { 0xe800, 0xfc00, [](P) -> u32 { util::stream_format(stream, "sf1 %03x", opcode & 0x3ff); return 1; } }, + { 0xec00, 0xfc00, [](P) -> u32 { util::stream_format(stream, "rf1 %03x", opcode & 0x3ff); return 1; } }, + { 0xf000, 0xfc00, [](P) -> u32 { util::stream_format(stream, "sf2 %03x", opcode & 0x3ff); return 1; } }, + { 0xf400, 0xfc00, [](P) -> u32 { util::stream_format(stream, "rf2 %03x", opcode & 0x3ff); return 1; } }, + { 0xe880, 0xffff, [](P) -> u32 { util::stream_format(stream, "sdpf"); return 1; } }, + { 0xec80, 0xffff, [](P) -> u32 { util::stream_format(stream, "rdpf"); return 1; } }, + + { 0x7780, 0xff80, [](P) -> u32 { util::stream_format(stream, "sta %02x", opcode & 0x7f); return 1; } }, + { 0x7800, 0xf800, [](P) -> u32 { util::stream_format(stream, "lds %02x, #%x", opcode & 0x7f, (opcode >> 7) & 0xf); return 1; } }, + { 0x6880, 0xff80, [](P) -> u32 { util::stream_format(stream, "lda %02x", opcode & 0x7f); return 1; } }, + + { 0xff00, 0xffff, [](P) -> u32 { util::stream_format(stream, "halt"); return 1; } }, + { 0xe000, 0xffc0, [](P) -> u32 { util::stream_format(stream, "ssw %02x", opcode & 0x3f); return 1; } }, + { 0xfa00, 0xfe00, [](P) -> u32 { util::stream_format(stream, "sie %03x", opcode & 0x1ff); return 1 | STEP_OVER; } }, + { 0xfe00, 0xfff0, [](P) -> u32 { util::stream_format(stream, "sie* %x", opcode & 0xf); return 1 | STEP_OVER; } }, + { 0x7580, 0xff80, [](P) -> u32 { util::stream_format(stream, "msb %02x", opcode & 0x7f); return 1; } }, + { 0x7600, 0xff80, [](P) -> u32 { util::stream_format(stream, "msc %02x", opcode & 0x7f); return 1; } }, + { 0x0000, 0xffff, [](P) -> u32 { util::stream_format(stream, "nop"); return 1; } }, + { 0xf018, 0xffff, [](P) -> u32 { util::stream_format(stream, "lon"); return 1; } }, + { 0xf418, 0xffff, [](P) -> u32 { util::stream_format(stream, "loff"); return 1; } }, + { 0xf004, 0xffff, [](P) -> u32 { util::stream_format(stream, "sbak"); return 1; } }, + { 0xf404, 0xffff, [](P) -> u32 { util::stream_format(stream, "rbak"); return 1; } }, + + { 0x7480, 0xff80, [](P) -> u32 { util::stream_format(stream, "mcd %02x", opcode & 0x7f); return 1; } }, + { 0x7500, 0xff80, [](P) -> u32 { util::stream_format(stream, "mcf %02x", opcode & 0x7f); return 1; } }, + { 0xfc22, 0xffff, [](P) -> u32 { util::stream_format(stream, "ccc"); return 1; } }, + { 0xfc40, 0xffff, [](P) -> u32 { util::stream_format(stream, "rlp"); return 1; } }, + { 0xfc80, 0xffff, [](P) -> u32 { util::stream_format(stream, "csp"); return 1; } }, + { 0xfb00, 0xffff, [](P) -> u32 { util::stream_format(stream, "cst"); return 1; } }, + { 0xe802, 0xffff, [](P) -> u32 { util::stream_format(stream, "scex"); return 1; } }, + { 0xec02, 0xffff, [](P) -> u32 { util::stream_format(stream, "rcex"); return 1; } }, + { 0xf000, 0xfffc, [](P) -> u32 { util::stream_format(stream, "schf %x", opcode & 3); return 1; } }, + { 0xf400, 0xfffc, [](P) -> u32 { util::stream_format(stream, "rchf %x", opcode & 3); return 1; } }, + + { 0x7180, 0xff80, [](P) -> u32 { util::stream_format(stream, "ipp %02x", opcode & 0x7f); return 1; } }, + { 0x7000, 0xff80, [](P) -> u32 { util::stream_format(stream, "ips %02x", opcode & 0x7f); return 1; } }, + { 0x7080, 0xff80, [](P) -> u32 { util::stream_format(stream, "ipm %02x", opcode & 0x7f); return 1; } }, + { 0x7100, 0xff80, [](P) -> u32 { util::stream_format(stream, "ipk %02x", opcode & 0x7f); return 1; } }, + { 0x0080, 0xff80, [](P) -> u32 { util::stream_format(stream, "opp %02x", opcode & 0x7f); return 1; } }, + { 0x0f00, 0xff80, [](P) -> u32 { util::stream_format(stream, "opm %02x", opcode & 0x7f); return 1; } }, + { 0xe804, 0xffff, [](P) -> u32 { util::stream_format(stream, "sct1"); return 1; } }, + { 0xec04, 0xffff, [](P) -> u32 { util::stream_format(stream, "rct1"); return 1; } }, + { 0xf200, 0xffff, [](P) -> u32 { util::stream_format(stream, "sct2"); return 1; } }, + { 0xf600, 0xffff, [](P) -> u32 { util::stream_format(stream, "rct2"); return 1; } }, + { 0xf010, 0xffff, [](P) -> u32 { util::stream_format(stream, "slgt"); return 1; } }, + { 0xf410, 0xffff, [](P) -> u32 { util::stream_format(stream, "rlgt"); return 1; } }, + { 0xf800, 0xffff, [](P) -> u32 { util::stream_format(stream, "ras"); return 1; } }, + { 0xf800, 0xfe00, [](P) -> u32 { util::stream_format(stream, "sas %03x", opcode & 0x1ff); return 1; } }, + { 0xe800, 0xff9f, [](P) -> u32 { util::stream_format(stream, "comd %x", (opcode >> 5) & 3); return 1; } }, + { 0xec00, 0xff9f, [](P) -> u32 { util::stream_format(stream, "cimd %x", (opcode >> 5) & 3); return 1; } }, + { 0xf000, 0xfe1f, [](P) -> u32 { util::stream_format(stream, "spdf %x", (opcode >> 5) & 3); return 1; } }, + { 0xf400, 0xfe1f, [](P) -> u32 { util::stream_format(stream, "rpdf %x", (opcode >> 5) & 3); return 1; } }, + { 0xe808, 0xffff, [](P) -> u32 { util::stream_format(stream, "sfsp"); return 1; } }, + { 0xec08, 0xffff, [](P) -> u32 { util::stream_format(stream, "rfsp"); return 1; } }, + { 0x0000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrt %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + { 0x1000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrb %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + { 0x2000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrc %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + { 0x3000, 0xf000, [](P) -> u32 { util::stream_format(stream, "wrp %02x, %02x", (opcode >> 7) & 0x1f, opcode & 0x7f); return 1; } }, + + { 0xc000, 0xf800, [](P) -> u32 { util::stream_format(stream, "jmp %03x", opcode & 0x7ff); return 1; } }, + { 0x8000, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab0 %03x", opcode & 0x7ff); return 1; } }, + { 0x8800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab1 %03x", opcode & 0x7ff); return 1; } }, + { 0x9000, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab2 %03x", opcode & 0x7ff); return 1; } }, + { 0x9800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bab3 %03x", opcode & 0x7ff); return 1; } }, + { 0xa000, 0xf800, [](P) -> u32 { util::stream_format(stream, "banz %03x", opcode & 0x7ff); return 1; } }, + { 0xb000, 0xf800, [](P) -> u32 { util::stream_format(stream, "baz %03x", opcode & 0x7ff); return 1; } }, + { 0xa800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bcnh %03x", opcode & 0x7ff); return 1; } }, + { 0xb800, 0xf800, [](P) -> u32 { util::stream_format(stream, "bch %03x", opcode & 0x7ff); return 1; } }, + + { 0xc800, 0xf800, [](P) -> u32 { util::stream_format(stream, "call %03x", opcode & 0x7ff); return 1 | STEP_OVER; } }, + { 0xd000, 0xffff, [](P) -> u32 { util::stream_format(stream, "rts"); return 1 | STEP_OUT; } }, + { 0xd800, 0xffff, [](P) -> u32 { util::stream_format(stream, "pop"); return 1; } }, + + { 0xe400, 0xfc00, [](P) -> u32 { util::stream_format(stream, "stm %03x", opcode & 0x7ff); return 1; } }, + { 0xfc04, 0xffff, [](P) -> u32 { util::stream_format(stream, "rtm"); return 1 | STEP_OUT; } }, + { 0xf810, 0xffff, [](P) -> u32 { util::stream_format(stream, "sfpd"); return 1 | STEP_OUT; } }, + { 0xfc10, 0xffff, [](P) -> u32 { util::stream_format(stream, "rfpd"); return 1 | STEP_OUT; } }, + { 0xfc00, 0xfe00, [](P) -> u32 { util::stream_format(stream, "plc %03x", opcode & 0x1ff); return 1 | STEP_OVER; } }, + + { 0x0000, 0x0000, [](P) -> u32 { util::stream_format(stream, "?%04x", opcode); return 1; } }, +}; + +#undef P + +offs_t lc58_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) +{ + u16 opcode = opcodes.r16(pc); + + for(u32 i=0;; i++) + if((opcode & instructions[i].mask) == instructions[i].value) + return instructions[i].cb(stream, this, opcode) | SUPPORTED; + return 0; +} diff --git a/src/devices/cpu/lc58/lc58d.h b/src/devices/cpu/lc58/lc58d.h new file mode 100644 index 00000000000..6a570c10f02 --- /dev/null +++ b/src/devices/cpu/lc58/lc58d.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// Sanyo LC58 generic disassembler + +#ifndef MAME_CPU_LC58_LC58D_H +#define MAME_CPU_LC58_LC58D_H + +#pragma once + +class lc58_disassembler : public util::disasm_interface +{ +public: + lc58_disassembler() = default; + virtual ~lc58_disassembler() = default; + + virtual u32 opcode_alignment() const override; + virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; + +private: + struct instruction { + u16 value; + u16 mask; + u32 (*cb)(std::ostream &, const lc58_disassembler *, u16); + }; + + static const instruction instructions[]; +}; + +#endif // MAME_CPU_LC58_LC58D_H diff --git a/src/devices/cpu/m6502/n2a03.cpp b/src/devices/cpu/m6502/n2a03.cpp index f303f1bf1b6..e1731b62e75 100644 --- a/src/devices/cpu/m6502/n2a03.cpp +++ b/src/devices/cpu/m6502/n2a03.cpp @@ -12,6 +12,7 @@ #include "n2a03.h" #include "n2a03d.h" +DEFINE_DEVICE_TYPE(N2A03_CORE, n2a03_core_device, "n2a03_core", "Ricoh N2A03 core") // needed for some VT systems with XOP instead of standard APU DEFINE_DEVICE_TYPE(N2A03, n2a03_device, "n2a03", "Ricoh N2A03") uint8_t n2a03_device::psg1_4014_r() @@ -51,15 +52,29 @@ void n2a03_device::n2a03_map(address_map &map) +n2a03_core_device::n2a03_core_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : m6502_device(mconfig, type, tag, owner, clock) +{ +} + +n2a03_core_device::n2a03_core_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : n2a03_core_device(mconfig, N2A03_CORE, tag, owner, clock) +{ +} + + + n2a03_device::n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m6502_device(mconfig, N2A03, tag, owner, clock) + : n2a03_core_device(mconfig, N2A03, tag, owner, clock) , device_mixer_interface(mconfig, *this, 1) , m_apu(*this, "nesapu") { program_config.m_internal_map = address_map_constructor(FUNC(n2a03_device::n2a03_map), this); } -std::unique_ptr<util::disasm_interface> n2a03_device::create_disassembler() + + +std::unique_ptr<util::disasm_interface> n2a03_core_device::create_disassembler() { return std::make_unique<n2a03_disassembler>(); } diff --git a/src/devices/cpu/m6502/n2a03.h b/src/devices/cpu/m6502/n2a03.h index 5a57bcbed2b..4232093c7a5 100644 --- a/src/devices/cpu/m6502/n2a03.h +++ b/src/devices/cpu/m6502/n2a03.h @@ -15,22 +15,18 @@ #include "m6502.h" #include "sound/nes_apu.h" -class n2a03_device : public m6502_device, public device_mixer_interface { +class n2a03_core_device : public m6502_device { public: - n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + n2a03_core_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; virtual void do_exec_full() override; virtual void do_exec_partial() override; - uint8_t psg1_4014_r(); - uint8_t psg1_4015_r(); - void psg1_4015_w(uint8_t data); - void psg1_4017_w(uint8_t data); - - void n2a03_map(address_map &map); protected: + n2a03_core_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + #define O(o) void o ## _full(); void o ## _partial() // n2a03 opcodes - same as 6502 with D disabled @@ -42,6 +38,21 @@ protected: #undef O +private: +}; + +class n2a03_device : public n2a03_core_device, public device_mixer_interface { +public: + n2a03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint8_t psg1_4014_r(); + uint8_t psg1_4015_r(); + void psg1_4015_w(uint8_t data); + void psg1_4017_w(uint8_t data); + + void n2a03_map(address_map &map); +protected: + required_device<nesapu_device> m_apu; virtual void device_add_mconfig(machine_config &config) override; @@ -52,6 +63,7 @@ private: }; + /* These are the official XTAL values and clock rates used by Nintendo for manufacturing throughout the production of the 2A03. PALC_APU_CLOCK is the clock rate devised by UMC(?) for PAL Famicom clone hardware. */ @@ -69,6 +81,7 @@ enum { N2A03_SET_OVERFLOW = m6502_device::V_LINE }; +DECLARE_DEVICE_TYPE(N2A03_CORE, n2a03_core_device) DECLARE_DEVICE_TYPE(N2A03, n2a03_device) #endif // MAME_CPU_M6502_N2A03_H diff --git a/src/devices/cpu/ns32000/ns32000.cpp b/src/devices/cpu/ns32000/ns32000.cpp index 4b796f8f345..d4801f3c079 100644 --- a/src/devices/cpu/ns32000/ns32000.cpp +++ b/src/devices/cpu/ns32000/ns32000.cpp @@ -83,7 +83,7 @@ static const u32 size_mask[] = { 0x000000ffU, 0x0000ffffU, 0x00000000U, 0xffffff #define SP ((m_psr & PSR_S) ? m_sp1 : m_sp0) -ns32000_device::ns32000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits) +template <int Width>ns32000_device<Width>::ns32000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits) : cpu_device(mconfig, type, tag, owner, clock) , m_program_config("program", ENDIANNESS_LITTLE, databits, addrbits, 0) , m_interrupt_config("interrupt", ENDIANNESS_LITTLE, databits, addrbits, 0) @@ -106,7 +106,7 @@ ns32032_device::ns32032_device(const machine_config &mconfig, const char *tag, d { } -void ns32000_device::device_start() +template <int Width> void ns32000_device<Width>::device_start() { set_icountptr(m_icount); @@ -152,7 +152,7 @@ void ns32000_device::device_start() // state_add(8 + i, util::string_format("F%d", i).c_str(), m_f[i]); } -void ns32000_device::device_reset() +template <int Width> void ns32000_device<Width>::device_reset() { for (std::pair<int, address_space_config const *> s : memory_space_config()) space(has_configured_map(s.first) ? s.first : 0).cache(m_bus[s.first]); @@ -166,7 +166,7 @@ void ns32000_device::device_reset() m_wait = false; } -void ns32000_device::state_string_export(device_state_entry const &entry, std::string &str) const +template <int Width> void ns32000_device<Width>::state_string_export(device_state_entry const &entry, std::string &str) const { switch (entry.index()) { @@ -186,7 +186,7 @@ void ns32000_device::state_string_export(device_state_entry const &entry, std::s } } -s32 ns32000_device::displacement(unsigned &bytes) +template <int Width> s32 ns32000_device<Width>::displacement(unsigned &bytes) { s32 disp = space(0).read_byte(m_pc + bytes); if (BIT(disp, 7)) @@ -214,7 +214,7 @@ s32 ns32000_device::displacement(unsigned &bytes) return disp; } -void ns32000_device::decode(addr_mode *mode, unsigned imm_size, unsigned &bytes) +template <int Width> void ns32000_device<Width>::decode(addr_mode *mode, unsigned imm_size, unsigned &bytes) { bool scaled[] = { false, false }; @@ -325,7 +325,7 @@ void ns32000_device::decode(addr_mode *mode, unsigned imm_size, unsigned &bytes) } } -u32 ns32000_device::ea(addr_mode const mode) +template <int Width> u32 ns32000_device<Width>::ea(addr_mode const mode) { u32 base; @@ -352,7 +352,7 @@ u32 ns32000_device::ea(addr_mode const mode) return base + mode.disp; } -u64 ns32000_device::gen_read(addr_mode mode, unsigned size) +template <int Width> u64 ns32000_device<Width>::gen_read(addr_mode mode, unsigned size) { u64 data = 0; @@ -396,7 +396,7 @@ u64 ns32000_device::gen_read(addr_mode mode, unsigned size) return data; } -s64 ns32000_device::gen_read_sx(addr_mode mode, unsigned size) +template <int Width> s64 ns32000_device<Width>::gen_read_sx(addr_mode mode, unsigned size) { u64 data = gen_read(mode, size); @@ -411,7 +411,7 @@ s64 ns32000_device::gen_read_sx(addr_mode mode, unsigned size) return data; } -void ns32000_device::gen_write(addr_mode mode, unsigned size, u64 data) +template <int Width> void ns32000_device<Width>::gen_write(addr_mode mode, unsigned size, u64 data) { switch (mode.type) { @@ -450,7 +450,7 @@ void ns32000_device::gen_write(addr_mode mode, unsigned size, u64 data) } } -bool ns32000_device::condition(unsigned const cc) +template <int Width> bool ns32000_device<Width>::condition(unsigned const cc) { switch (cc & 15) { @@ -492,7 +492,7 @@ bool ns32000_device::condition(unsigned const cc) return false; } -void ns32000_device::flags(u32 const src1, u32 const src2, u32 const dest, unsigned const size, bool const subtraction) +template <int Width> void ns32000_device<Width>::flags(u32 const src1, u32 const src2, u32 const dest, unsigned const size, bool const subtraction) { unsigned const sign_bit = (size + 1) * 8 - 1; @@ -508,7 +508,7 @@ void ns32000_device::flags(u32 const src1, u32 const src2, u32 const dest, unsig m_psr |= PSR_F; } -void ns32000_device::interrupt(unsigned const vector, u32 const return_address, bool const trap) +template <int Width> void ns32000_device<Width>::interrupt(unsigned const vector, u32 const return_address, bool const trap) { // clear trace pending flag if (vector == TRC) @@ -543,7 +543,7 @@ void ns32000_device::interrupt(unsigned const vector, u32 const return_address, // TODO: flush queue } -void ns32000_device::execute_run() +template <int Width> void ns32000_device<Width>::execute_run() { while (m_icount > 0) { @@ -866,16 +866,16 @@ void ns32000_device::execute_run() m_psr &= ~(PSR_N | PSR_Z | PSR_L); if ((size == SIZE_D && s32(src1) > s32(src2)) - || ((size == SIZE_W && s16(src1) > s16(src2)) - || ((size == SIZE_B && s8(src1) > s8(src2))))) + || ((size == SIZE_W && s16(src1) > s16(src2)) + || ((size == SIZE_B && s8(src1) > s8(src2))))) m_psr |= PSR_N; if (src1 == src2) m_psr |= PSR_Z; if ((size == SIZE_D && u32(src1) > u32(src2)) - || ((size == SIZE_W && u16(src1) > u16(src2)) - || ((size == SIZE_B && u8(src1) > u8(src2))))) + || ((size == SIZE_W && u16(src1) > u16(src2)) + || ((size == SIZE_B && u8(src1) > u8(src2))))) m_psr |= PSR_L; } m_pc += bytes; @@ -1160,16 +1160,16 @@ void ns32000_device::execute_run() m_psr &= ~(PSR_N | PSR_Z | PSR_L); if ((size == SIZE_D && s32(src1) > s32(src2)) - || ((size == SIZE_W && s16(src1) > s16(src2)) - || ((size == SIZE_B && s8(src1) > s8(src2))))) + || ((size == SIZE_W && s16(src1) > s16(src2)) + || ((size == SIZE_B && s8(src1) > s8(src2))))) m_psr |= PSR_N; if (src1 == src2) m_psr |= PSR_Z; if ((size == SIZE_D && u32(src1) > u32(src2)) - || ((size == SIZE_W && u16(src1) > u16(src2)) - || ((size == SIZE_B && u8(src1) > u8(src2))))) + || ((size == SIZE_W && u16(src1) > u16(src2)) + || ((size == SIZE_B && u8(src1) > u8(src2))))) m_psr |= PSR_L; } m_pc += bytes; @@ -1420,13 +1420,13 @@ void ns32000_device::execute_run() m_psr &= ~PSR_Z; if ((size == SIZE_D && s32(src1) > s32(src2)) - || ((size == SIZE_W && s16(src1) > s16(src2)) - || ((size == SIZE_B && s8(src1) > s8(src2))))) + || ((size == SIZE_W && s16(src1) > s16(src2)) + || ((size == SIZE_B && s8(src1) > s8(src2))))) m_psr |= PSR_N; if ((size == SIZE_D && u32(src1) > u32(src2)) - || ((size == SIZE_W && u16(src1) > u16(src2)) - || ((size == SIZE_B && u8(src1) > u8(src2))))) + || ((size == SIZE_W && u16(src1) > u16(src2)) + || ((size == SIZE_B && u8(src1) > u8(src2))))) m_psr |= PSR_L; break; @@ -2249,6 +2249,18 @@ void ns32000_device::execute_run() break; case 0x1e: // format 14 // TODO: mmu + { + u16 const opword = space(0).read_word_unaligned(m_pc + bytes); + bytes += 2; + + addr_mode mode[] = { addr_mode((opword >> 11) & 31), addr_mode(0x13) }; + + //unsigned const quick = (opword >> 7) & 15; + unsigned const size = opword & 3; + + decode(mode, size, bytes); + } + m_pc += bytes; break; case 0x16: // format 15.0 case 0x36: // format 15.1 @@ -2279,7 +2291,7 @@ void ns32000_device::execute_run() } } -void ns32000_device::execute_set_input(int inputnum, int state) +template <int Width> void ns32000_device<Width>::execute_set_input(int inputnum, int state) { if (state) m_wait = false; @@ -2298,7 +2310,7 @@ void ns32000_device::execute_set_input(int inputnum, int state) } } -device_memory_interface::space_config_vector ns32000_device::memory_space_config() const +template <int Width> device_memory_interface::space_config_vector ns32000_device<Width>::memory_space_config() const { return space_config_vector{ std::make_pair(AS_PROGRAM, &m_program_config), @@ -2312,12 +2324,12 @@ device_memory_interface::space_config_vector ns32000_device::memory_space_config }; } -bool ns32000_device::memory_translate(int spacenum, int intention, offs_t &address) +template <int Width> bool ns32000_device<Width>::memory_translate(int spacenum, int intention, offs_t &address) { return true; } -std::unique_ptr<util::disasm_interface> ns32000_device::create_disassembler() +template <int Width> std::unique_ptr<util::disasm_interface> ns32000_device<Width>::create_disassembler() { return std::make_unique<ns32000_disassembler>(); } diff --git a/src/devices/cpu/ns32000/ns32000.h b/src/devices/cpu/ns32000/ns32000.h index af5977fe52e..800b6982a5d 100644 --- a/src/devices/cpu/ns32000/ns32000.h +++ b/src/devices/cpu/ns32000/ns32000.h @@ -6,6 +6,7 @@ #pragma once +template <int Width> class ns32000_device : public cpu_device { public: @@ -87,7 +88,7 @@ private: // emulation state int m_icount; - memory_access<24, 1, 0, ENDIANNESS_LITTLE>::cache m_bus[16]; + typename memory_access<24, Width, 0, ENDIANNESS_LITTLE>::cache m_bus[16]; u32 m_pc; // program counter u32 m_sb; // static base @@ -107,19 +108,19 @@ private: bool m_wait; }; -class ns32008_device : public ns32000_device +class ns32008_device : public ns32000_device<0> { public: ns32008_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); }; -class ns32016_device : public ns32000_device +class ns32016_device : public ns32000_device<1> { public: ns32016_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); }; -class ns32032_device : public ns32000_device +class ns32032_device : public ns32000_device<2> { public: ns32032_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp index d5fd882a484..ab820fc1599 100644 --- a/src/devices/cpu/tms34010/tms34010.cpp +++ b/src/devices/cpu/tms34010/tms34010.cpp @@ -1178,7 +1178,7 @@ uint32_t tms340x0_device::tms340x0_ind16(screen_device &screen, bitmap_ind16 &bi params.heblnk = params.hsblnk = cliprect.max_x + 1; /* blank out the blank regions */ - uint16_t *dest = &bitmap.pix16(cliprect.min_y); + uint16_t *dest = &bitmap.pix(cliprect.min_y); for (x = cliprect.min_x; x < params.heblnk; x++) dest[x] = blackpen; for (x = params.hsblnk; x <= cliprect.max_x; x++) @@ -1209,7 +1209,7 @@ uint32_t tms340x0_device::tms340x0_rgb32(screen_device &screen, bitmap_rgb32 &bi params.heblnk = params.hsblnk = cliprect.max_x + 1; /* blank out the blank regions */ - uint32_t *dest = &bitmap.pix32(cliprect.min_y); + uint32_t *dest = &bitmap.pix(cliprect.min_y); for (x = cliprect.min_x; x < params.heblnk; x++) dest[x] = blackpen; for (x = params.hsblnk; x <= cliprect.max_x; x++) diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index 981356ebcd2..89fdcc8d817 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -220,6 +220,8 @@ void tms9995_device::device_start() m_source_value = 0; + m_index = 0; + // add the states for the debugger for (int i=0; i < 20; i++) { @@ -242,7 +244,7 @@ void tms9995_device::device_start() save_item(NAME(PC)); save_item(NAME(ST)); // save_item(NAME(PC_debug)); // only for debugger output - save_pointer(NAME(m_onchip_memory),256); + save_item(NAME(m_onchip_memory)); save_item(NAME(m_idle_state)); save_item(NAME(m_nmi_state)); save_item(NAME(m_hold_state)); @@ -285,7 +287,7 @@ void tms9995_device::device_start() save_item(NAME(m_cru_address)); save_item(NAME(m_cru_value)); save_item(NAME(m_cru_first_read)); - save_pointer(NAME(m_flag),16); + save_item(NAME(m_flag)); save_item(NAME(IR)); save_item(NAME(m_pre_IR)); save_item(NAME(m_command)); diff --git a/src/devices/cpu/vt50/vt50.cpp b/src/devices/cpu/vt50/vt50.cpp index 961dca5aa2c..7a964c4be5b 100644 --- a/src/devices/cpu/vt50/vt50.cpp +++ b/src/devices/cpu/vt50/vt50.cpp @@ -284,7 +284,7 @@ void vt5x_cpu_device::draw_char_line() if (xc > screen().visible_area().right() - 8) return; - u32 *pix = &m_bitmap.pix32(m_current_line, xc); + u32 *pix = &m_bitmap.pix(m_current_line, xc); if (m_video_process && m_cursor_ff && m_cursor_active) std::fill_n(pix, 9, rgb_t::white()); else if (!m_video_process || m_cursor_ff) diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp index c6e20ba66dd..38f5fcfb059 100644 --- a/src/devices/imagedev/cassette.cpp +++ b/src/devices/imagedev/cassette.cpp @@ -236,7 +236,7 @@ void cassette_image_device::device_start() m_state = m_default_state; m_value = 0; - stream_alloc_legacy(0, (m_stereo? 2:1), machine().sample_rate()); + stream_alloc(0, m_stereo? 2:1, machine().sample_rate()); } image_init_result cassette_image_device::call_create(int format_type, util::option_resolution *format_options) @@ -404,37 +404,29 @@ std::string cassette_image_device::call_display() // Cassette sound //------------------------------------------------- -void cassette_image_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cassette_image_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left_buffer = outputs[0]; - stream_sample_t *right_buffer = nullptr; - - if (m_stereo) - right_buffer = outputs[1]; - cassette_state state = get_state() & (CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER); if (exists() && (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED))) { cassette_image *cassette = get_image(); double time_index = get_position(); - double duration = ((double) samples) / machine().sample_rate(); + double duration = ((double) outputs[0].samples()) / outputs[0].sample_rate(); - cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT); - if (m_stereo) - cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT); + if (m_samples.size() < outputs[0].samples()) + m_samples.resize(outputs[0].samples()); - for (int i = samples - 1; i >= 0; i--) + for (int ch = 0; ch < outputs.size(); ch++) { - left_buffer[i] = ((int16_t *) left_buffer)[i]; - if (m_stereo) - right_buffer[i] = ((int16_t *) right_buffer)[i]; + cassette_get_samples(cassette, 0, time_index, duration, outputs[0].samples(), 2, &m_samples[0], CASSETTE_WAVEFORM_16BIT); + for (int sampindex = 0; sampindex < outputs[ch].samples(); sampindex++) + outputs[ch].put_int(sampindex, m_samples[sampindex], 32768); } } else { - memset(left_buffer, 0, sizeof(*left_buffer) * samples); - if (m_stereo) - memset(right_buffer, 0, sizeof(*right_buffer) * samples); + for (int ch = 0; ch < outputs.size(); ch++) + outputs[ch].fill(0); } } diff --git a/src/devices/imagedev/cassette.h b/src/devices/imagedev/cassette.h index a661e8312a8..ae3af3c6429 100644 --- a/src/devices/imagedev/cassette.h +++ b/src/devices/imagedev/cassette.h @@ -102,7 +102,7 @@ public: void seek(double time, int origin); // sound stream update overrides - void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; device_sound_interface& set_stereo() { m_stereo = true; return *this; } protected: @@ -133,6 +133,7 @@ private: image_init_result internal_load(bool is_create); bool m_stereo; + std::vector<s16> m_samples; }; // device type definition diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 3dd96644f1a..f39be79c761 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -1248,7 +1248,7 @@ void floppy_sound_device::device_start() // If we don't have all samples, don't allocate a stream or access sample data. if (m_loaded) { - m_sound = stream_alloc_legacy(0, 1, clock()); // per-floppy stream + m_sound = stream_alloc(0, 1, clock()); // per-floppy stream } register_for_save_states(); } @@ -1369,21 +1369,21 @@ void floppy_sound_device::step(int zone) } //------------------------------------------------- -// sound_stream_update_legacy - update the sound stream +// sound_stream_update - update the sound stream //------------------------------------------------- -void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // We are using only one stream, unlike the parent class // Also, there is no need for interpolation, as we only expect // one sample rate of 44100 for all samples int16_t out; - stream_sample_t *samplebuffer = outputs[0]; + auto &samplebuffer = outputs[0]; int idx = 0; int sampleend = 0; - while (samples-- > 0) + for (int sampindex = 0; sampindex < samplebuffer.samples(); sampindex++) { out = 0; @@ -1477,7 +1477,7 @@ void floppy_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } // Write to the stream buffer - *(samplebuffer++) = out; + samplebuffer.put_int(sampindex, out, 32768); } } diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h index d07a12c146c..515cf28f610 100644 --- a/src/devices/imagedev/floppy.h +++ b/src/devices/imagedev/floppy.h @@ -294,7 +294,7 @@ protected: private: // device_sound_interface overrides - void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; sound_stream* m_sound; int m_step_base; diff --git a/src/devices/imagedev/picture.cpp b/src/devices/imagedev/picture.cpp index f80bfb2885e..e50f2c0d4c6 100644 --- a/src/devices/imagedev/picture.cpp +++ b/src/devices/imagedev/picture.cpp @@ -25,8 +25,7 @@ DEFINE_DEVICE_TYPE(IMAGE_PICTURE, picture_image_device, "picture_image", "Still picture_image_device::picture_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, IMAGE_PICTURE, tag, owner, clock), - device_image_interface(mconfig, *this), - m_picture(nullptr) + device_image_interface(mconfig, *this) { } @@ -36,11 +35,6 @@ picture_image_device::picture_image_device(const machine_config &mconfig, const picture_image_device::~picture_image_device() { - if (m_picture) - { - delete m_picture; - m_picture = nullptr; - } } @@ -50,11 +44,9 @@ void picture_image_device::device_start() image_init_result picture_image_device::call_load() { - m_picture = new bitmap_argb32; - if (png_read_bitmap(image_core_file(), *m_picture) != PNGERR_NONE) + if (png_read_bitmap(image_core_file(), m_picture) != PNGERR_NONE) { - delete m_picture; - m_picture = nullptr; + m_picture.reset(); // todo: try JPEG here. return image_init_result::FAIL; @@ -65,9 +57,8 @@ image_init_result picture_image_device::call_load() void picture_image_device::call_unload() { - if (m_picture) + if (m_picture.valid()) { - delete m_picture; - m_picture = nullptr; + m_picture.reset(); } } diff --git a/src/devices/imagedev/picture.h b/src/devices/imagedev/picture.h index f8601345a89..1780a563318 100644 --- a/src/devices/imagedev/picture.h +++ b/src/devices/imagedev/picture.h @@ -41,14 +41,14 @@ public: virtual bool is_reset_on_load() const noexcept override { return false; } virtual const char *file_extensions() const noexcept override { return "png"; } - bitmap_argb32 &get_bitmap() { return *m_picture; } + const bitmap_argb32 &get_bitmap() { return m_picture; } protected: // device-level overrides virtual void device_start() override; private: - bitmap_argb32 *m_picture; + bitmap_argb32 m_picture; }; diff --git a/src/devices/machine/8364_paula.cpp b/src/devices/machine/8364_paula.cpp index 1e10ca55b3e..6869ffb3395 100644 --- a/src/devices/machine/8364_paula.cpp +++ b/src/devices/machine/8364_paula.cpp @@ -58,7 +58,7 @@ void paula_8364_device::device_start() } // create the stream - m_stream = stream_alloc_legacy(0, 4, clock() / CLOCK_DIVIDER); + m_stream = stream_alloc(0, 4, clock() / CLOCK_DIVIDER); } //------------------------------------------------- @@ -159,10 +159,10 @@ void paula_8364_device::dma_reload(audio_channel *chan) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void paula_8364_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int channum, sampoffs = 0; @@ -176,11 +176,11 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_ // clear the sample data to 0 for (channum = 0; channum < 4; channum++) - memset(outputs[channum], 0, sizeof(stream_sample_t) * samples); + outputs[channum].fill(0); return; } - samples *= CLOCK_DIVIDER; + int samples = outputs[0].samples() * CLOCK_DIVIDER; // update the DMA states on each channel and reload if fresh for (channum = 0; channum < 4; channum++) @@ -215,7 +215,7 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_ audio_channel *chan = &m_channel[channum]; int volume = (nextvol == -1) ? chan->vol : nextvol; int period = (nextper == -1) ? chan->per : nextper; - stream_sample_t sample; + s32 sample; int i; // normalize the volume value @@ -247,7 +247,7 @@ void paula_8364_device::sound_stream_update_legacy(sound_stream &stream, stream_ // fill the buffer with the sample for (i = 0; i < ticks; i += CLOCK_DIVIDER) - outputs[channum][(sampoffs + i) / CLOCK_DIVIDER] = sample; + outputs[channum].put_int((sampoffs + i) / CLOCK_DIVIDER, sample, 32768); // account for the ticks; if we hit 0, advance chan->curticks -= ticks; diff --git a/src/devices/machine/8364_paula.h b/src/devices/machine/8364_paula.h index a2ac2feab26..9fa7a6ebf38 100644 --- a/src/devices/machine/8364_paula.h +++ b/src/devices/machine/8364_paula.h @@ -68,7 +68,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum diff --git a/src/devices/machine/acorn_vidc.cpp b/src/devices/machine/acorn_vidc.cpp index 36733555e7d..f0ebf10f612 100644 --- a/src/devices/machine/acorn_vidc.cpp +++ b/src/devices/machine/acorn_vidc.cpp @@ -492,9 +492,9 @@ void acorn_vidc10_device::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (is_cursor == true && dot == 0) continue; dot += pen_base; - bitmap.pix32(dsty, dstx+xi) = this->pen(dot); + bitmap.pix(dsty, dstx+xi) = this->pen(dot); if (m_crtc_interlace) - bitmap.pix32(dsty+1, dstx+xi) = this->pen(dot); + bitmap.pix(dsty+1, dstx+xi) = this->pen(dot); } } } diff --git a/src/devices/machine/am9519.h b/src/devices/machine/am9519.h index 315e0bd890d..ec84cd50e52 100644 --- a/src/devices/machine/am9519.h +++ b/src/devices/machine/am9519.h @@ -32,7 +32,7 @@ class am9519_device : public device_t { public: - am9519_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + am9519_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); auto out_int_callback() { return m_out_int_func.bind(); } diff --git a/src/devices/machine/bq4847.cpp b/src/devices/machine/bq4847.cpp index 09afd9b9424..7dd9031c814 100644 --- a/src/devices/machine/bq4847.cpp +++ b/src/devices/machine/bq4847.cpp @@ -305,6 +305,8 @@ uint8_t bq4847_device::read(offs_t address) set_register(reg_flags, 0xff, false); m_interrupt_cb(intrq_r()); } + else + if (regnum == reg_unused) value = 0; // Reg 15 is locked to 0 in BQ4847 LOGMASKED(LOG_REG, "Reg %d -> %02x\n", regnum, value); diff --git a/src/devices/machine/exorterm.cpp b/src/devices/machine/exorterm.cpp index 0b62597e3f1..9db3f0658e4 100644 --- a/src/devices/machine/exorterm.cpp +++ b/src/devices/machine/exorterm.cpp @@ -348,7 +348,7 @@ u32 exorterm155_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma u16 sy = 0, ma = 0; u8 disable_fac = m_disable_fac->read() == 0; u8 display_fac = m_display_fac->read() == 0; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); m_framecnt++; @@ -356,7 +356,7 @@ u32 exorterm155_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma { for (u8 ra = 0; ra < 12; ra++) { - u32 *p = &bitmap.pix32(sy++); + u32 *p = &bitmap.pix(sy++); // FAC codes are cleared on horizontal sync. u8 underline1 = 0; u8 underline2 = 0; diff --git a/src/devices/machine/ie15.cpp b/src/devices/machine/ie15.cpp index 3cdb35af145..eba7ace6fa7 100644 --- a/src/devices/machine/ie15.cpp +++ b/src/devices/machine/ie15.cpp @@ -637,7 +637,8 @@ void ie15_device::scanline_callback() uint32_t ie15_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { update_leds(); - memcpy(&bitmap.pix32(0), &m_tmpbmp[0], sizeof(uint32_t) * IE15_TOTAL_HORZ * IE15_TOTAL_VERT); + for (int y = 0; y < IE15_TOTAL_VERT; y++) + std::copy_n(&m_tmpbmp[y * IE15_TOTAL_HORZ], IE15_TOTAL_HORZ, &bitmap.pix(y)); return 0; } diff --git a/src/devices/machine/laserdsc.cpp b/src/devices/machine/laserdsc.cpp index ef3df359859..d04d3c1201a 100644 --- a/src/devices/machine/laserdsc.cpp +++ b/src/devices/machine/laserdsc.cpp @@ -308,11 +308,11 @@ void laserdisc_device::device_timer(emu_timer &timer, device_timer_id id, int pa //------------------------------------------------- -// sound_stream_update_legacy - audio streamer for +// sound_stream_update - audio streamer for // laserdiscs //------------------------------------------------- -void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void laserdisc_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // compute AND values based on the squelch int16_t leftand = (m_audiosquelch & 1) ? 0x0000 : 0xffff; @@ -324,12 +324,12 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s samples_avail += m_audiobufsize; // if no attached ld, just clear the buffers - stream_sample_t *dst0 = outputs[0]; - stream_sample_t *dst1 = outputs[1]; - if (samples_avail < samples) + auto &dst0 = outputs[0]; + auto &dst1 = outputs[1]; + if (samples_avail < outputs[0].samples()) { - memset(dst0, 0, samples * sizeof(dst0[0])); - memset(dst1, 0, samples * sizeof(dst1[0])); + dst0.fill(0); + dst1.fill(0); } // otherwise, stream from our buffer @@ -340,10 +340,11 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s int sampout = m_audiobufout; // copy samples, clearing behind us as we go - while (sampout != m_audiobufin && samples-- > 0) + int sampindex; + for (sampindex = 0; sampout != m_audiobufin && sampindex < outputs[0].samples(); sampindex++) { - *dst0++ = buffer0[sampout] & leftand; - *dst1++ = buffer1[sampout] & rightand; + dst0.put_int(sampindex, buffer0[sampout] & leftand, 32768); + dst1.put_int(sampindex, buffer1[sampout] & rightand, 32768); buffer0[sampout] = 0; buffer1[sampout] = 0; sampout++; @@ -353,16 +354,16 @@ void laserdisc_device::sound_stream_update_legacy(sound_stream &stream, stream_s m_audiobufout = sampout; // clear out the rest of the buffer - if (samples > 0) + if (sampindex < outputs[0].samples()) { sampout = (m_audiobufout == 0) ? m_audiobufsize - 1 : m_audiobufout - 1; - stream_sample_t fill0 = buffer0[sampout] & leftand; - stream_sample_t fill1 = buffer1[sampout] & rightand; + s32 fill0 = buffer0[sampout] & leftand; + s32 fill1 = buffer1[sampout] & rightand; - while (samples-- > 0) + for ( ; sampindex < outputs[0].samples(); sampindex++) { - *dst0++ = fill0; - *dst1++ = fill1; + dst0.put_int(sampindex, fill0, 32768); + dst1.put_int(sampindex, fill1, 32768); } } } @@ -712,10 +713,10 @@ void laserdisc_device::init_video() fillbitmap_yuy16(frame.m_bitmap, 40, 109, 240); // make a copy of the bitmap that clips out the VBI and horizontal blanking areas - frame.m_visbitmap.wrap(&frame.m_bitmap.pix16(44, frame.m_bitmap.width() * 8 / 720), - frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, - frame.m_bitmap.height() - 44, - frame.m_bitmap.rowpixels()); + frame.m_visbitmap.wrap(&frame.m_bitmap.pix( + 44, frame.m_bitmap.width() * 8 / 720), + frame.m_bitmap.width() - 2 * frame.m_bitmap.width() * 8 / 720, frame.m_bitmap.height() - 44, + frame.m_bitmap.rowpixels()); frame.m_visbitmap.set_palette(m_videopalette); } @@ -762,7 +763,7 @@ void laserdisc_device::init_audio() m_audio_callback.resolve(); // allocate a stream - m_stream = stream_alloc_legacy(0, 2, 48000); + m_stream = stream_alloc(0, 2, 48000); // allocate audio buffers m_audiomaxsamples = ((uint64_t)m_samplerate * 1000000 + m_fps_times_1million - 1) / m_fps_times_1million; @@ -789,7 +790,7 @@ void laserdisc_device::fillbitmap_yuy16(bitmap_yuy16 &bitmap, uint8_t yval, uint // write 32 bits of color (2 pixels at a time) for (int y = 0; y < bitmap.height(); y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); for (int x = 0; x < bitmap.width() / 2; x++) { *dest++ = color0; @@ -918,7 +919,8 @@ void laserdisc_device::read_track_data() frame->m_lastfield = m_curtrack * 2 + m_fieldnum; // set the video target information - m_avhuff_config.video.wrap(&frame->m_bitmap.pix16(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2); + m_avhuff_video.wrap(&frame->m_bitmap.pix(m_fieldnum), frame->m_bitmap.width(), frame->m_bitmap.height() / 2, frame->m_bitmap.rowpixels() * 2); + m_avhuff_config.video = &m_avhuff_video; // set the audio target information if (m_audiobufin + m_audiomaxsamples <= m_audiobufsize) @@ -995,13 +997,13 @@ void laserdisc_device::process_track_data() // remove the video if we had an error if (m_readresult != CHDERR_NONE) - m_avhuff_config.video.reset(); + m_avhuff_video.reset(); // count the field as read if we are successful - if (m_avhuff_config.video.valid()) + if (m_avhuff_video.valid()) { m_frame[m_videoindex].m_numfields++; - player_overlay(m_avhuff_config.video); + player_overlay(m_avhuff_video); } // pass the audio to the callback diff --git a/src/devices/machine/laserdsc.h b/src/devices/machine/laserdsc.h index 8ca3abad222..14594bcf7cd 100644 --- a/src/devices/machine/laserdsc.h +++ b/src/devices/machine/laserdsc.h @@ -220,7 +220,7 @@ protected: virtual void device_validity_check(validity_checker &valid) const override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // subclass helpers void set_audio_squelch(bool squelchleft, bool squelchright) { m_stream->update(); m_audiosquelch = (squelchleft ? 1 : 0) | (squelchright ? 2 : 0); } @@ -277,28 +277,29 @@ private: std::vector<uint8_t> m_vbidata; // pointer to precomputed VBI data int m_width; // width of video int m_height; // height of video - uint32_t m_fps_times_1million; // frame rate of video + uint32_t m_fps_times_1million; // frame rate of video int m_samplerate; // audio samplerate int m_readresult; // result of the most recent read - uint32_t m_chdtracks; // number of tracks in the CHD - avhuff_decompress_config m_avhuff_config; // decompression configuration + uint32_t m_chdtracks; // number of tracks in the CHD + bitmap_yuy16 m_avhuff_video; // decompresed frame buffer + avhuff_decoder::config m_avhuff_config; // decompression configuration // async operations osd_work_queue * m_work_queue; // work queue - uint32_t m_queued_hunknum; // queued hunk + uint32_t m_queued_hunknum; // queued hunk // core states - uint8_t m_audiosquelch; // audio squelch state: bit 0 = audio 1, bit 1 = audio 2 - uint8_t m_videosquelch; // video squelch state: bit 0 = on/off - uint8_t m_fieldnum; // field number (0 or 1) - int32_t m_curtrack; // current track at this end of this vsync - uint32_t m_maxtrack; // maximum track number + uint8_t m_audiosquelch; // audio squelch state: bit 0 = audio 1, bit 1 = audio 2 + uint8_t m_videosquelch; // video squelch state: bit 0 = on/off + uint8_t m_fieldnum; // field number (0 or 1) + int32_t m_curtrack; // current track at this end of this vsync + uint32_t m_maxtrack; // maximum track number attoseconds_t m_attospertrack; // attoseconds per track, or 0 if not moving attotime m_sliderupdate; // time of last slider update // video data frame_data m_frame[3]; // circular list of frames - uint8_t m_videoindex; // index of the current video buffer + uint8_t m_videoindex; // index of the current video buffer bitmap_yuy16 m_emptyframe; // blank frame // audio data diff --git a/src/devices/machine/ldpr8210.cpp b/src/devices/machine/ldpr8210.cpp index fc94159ff6a..64392ed0c90 100644 --- a/src/devices/machine/ldpr8210.cpp +++ b/src/devices/machine/ldpr8210.cpp @@ -784,12 +784,12 @@ void pioneer_pr8210_device::overlay_draw_group(bitmap_yuy16 &bitmap, const uint8 void pioneer_pr8210_device::overlay_erase(bitmap_yuy16 &bitmap, float xstart, float xend) { - uint32_t xmin = (uint32_t)(xstart * 256.0f * float(bitmap.width())); - uint32_t xmax = (uint32_t)(xend * 256.0f * float(bitmap.width())); + uint32_t xmin = uint32_t(xstart * 256.0f * float(bitmap.width())); + uint32_t xmax = uint32_t(xend * 256.0f * float(bitmap.width())); for (uint32_t y = OVERLAY_Y; y < (OVERLAY_Y + (OVERLAY_Y_PIXELS + 2) * OVERLAY_PIXEL_HEIGHT); y++) { - uint16_t *dest = &bitmap.pix16(y, xmin >> 8); + uint16_t *dest = &bitmap.pix(y, xmin >> 8); uint16_t ymax = *dest >> 8; uint16_t ymin = ymax * 3 / 8; uint16_t yres = ymin + ((ymax - ymin) * (xmin & 0xff)) / 256; @@ -819,8 +819,8 @@ void pioneer_pr8210_device::overlay_erase(bitmap_yuy16 &bitmap, float xstart, fl void pioneer_pr8210_device::overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, float xstart) { - uint32_t xminbase = (uint32_t)(xstart * 256.0f * float(bitmap.width())); - uint32_t xsize = (uint32_t)(OVERLAY_PIXEL_WIDTH * 256.0f * float(bitmap.width())); + uint32_t xminbase = uint32_t(xstart * 256.0f * float(bitmap.width())); + uint32_t xsize = uint32_t(OVERLAY_PIXEL_WIDTH * 256.0f * float(bitmap.width())); // iterate over pixels const uint8_t *chdataptr = &text_bitmap[ch & 0x3f][0]; @@ -835,7 +835,7 @@ void pioneer_pr8210_device::overlay_draw_char(bitmap_yuy16 &bitmap, uint8_t ch, uint32_t xmax = xmin + xsize; for (uint32_t yy = 0; yy < OVERLAY_PIXEL_HEIGHT; yy++) { - uint16_t *dest = &bitmap.pix16(OVERLAY_Y + (y + 1) * OVERLAY_PIXEL_HEIGHT + yy, xmin >> 8); + uint16_t *dest = &bitmap.pix(OVERLAY_Y + (y + 1) * OVERLAY_PIXEL_HEIGHT + yy, xmin >> 8); uint16_t ymax = 0xff; uint16_t ymin = *dest >> 8; uint16_t yres = ymin + ((ymax - ymin) * (~xmin & 0xff)) / 256; diff --git a/src/devices/machine/m3002.cpp b/src/devices/machine/m3002.cpp index 8bb9edda2b9..fd93666a55f 100644 --- a/src/devices/machine/m3002.cpp +++ b/src/devices/machine/m3002.cpp @@ -351,13 +351,13 @@ void m3002_device::irq_update() { LOG("IRQ occurred\n"); m_irq_active = true; - m_irq_callback(ASSERT_LINE); + m_irq_callback(0); } else if (m_irq_active && (m_ram[0xf] & 0x0c) == 0) { LOG("IRQ cleared\n"); m_irq_active = false; - m_irq_callback(CLEAR_LINE); + m_irq_callback(1); } } diff --git a/src/devices/machine/m3002.h b/src/devices/machine/m3002.h index d39f904fe60..ef13c360e47 100644 --- a/src/devices/machine/m3002.h +++ b/src/devices/machine/m3002.h @@ -37,6 +37,8 @@ public: // device type constructor m3002_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + auto irq_out() { return m_irq_callback.bind(); } + // 4-bit read/write handlers u8 read(); void write(u8 data); diff --git a/src/devices/machine/mc68328.cpp b/src/devices/machine/mc68328.cpp index 3df500d2f0c..e3690287710 100644 --- a/src/devices/machine/mc68328.cpp +++ b/src/devices/machine/mc68328.cpp @@ -3044,20 +3044,17 @@ uint16_t mc68328_device::internal_read(offs_t offset, uint16_t mem_mask) uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { uint32_t vram_addr = m_regs.lssa & 0x00fffffe; - uint16_t word; - uint16_t *line; - int y, x, b; if (m_regs.lckcon & LCKCON_LCDC_EN) { - for (y = 0; y < 160; y++) + for (int y = 0; y < 160; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 160; x += 16, vram_addr += 2) + for (int x = 0; x < 160; x += 16, vram_addr += 2) { - word = space(AS_PROGRAM).read_word(vram_addr); - for (b = 0; b < 16; b++) + uint16_t const word = space(AS_PROGRAM).read_word(vram_addr); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -3066,11 +3063,11 @@ uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitm } else { - for (y = 0; y < 160; y++) + for (int y = 0; y < 160; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 160; x++) + for (int x = 0; x < 160; x++) { line[x] = 0; } diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index 988c21c33e1..a13349e318f 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -987,7 +987,6 @@ std::unique_ptr<netlist::netlist_state_t> netlist_mame_device::base_validity_che auto lnetlist = std::make_unique<netlist::netlist_state_t>("netlist", plib::plog_delegate(&validity_logger::log, &logger)); // enable validation mode - lnetlist->set_extended_validation(true); lnetlist->set_static_solver_lib(std::make_unique<plib::dynlib_static>(nullptr)); diff --git a/src/devices/machine/pxa255.cpp b/src/devices/machine/pxa255.cpp index 07e7d997b8c..6bd82ec987c 100644 --- a/src/devices/machine/pxa255.cpp +++ b/src/devices/machine/pxa255.cpp @@ -1583,7 +1583,7 @@ uint32_t pxa255_periphs_device::screen_update(screen_device &screen, bitmap_rgb3 { for (int y = 0; y <= (m_lcd_regs.lccr2 & PXA255_LCCR2_LPP); y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); for (int x = 0; x <= (m_lcd_regs.lccr1 & PXA255_LCCR1_PPL); x++) { *dst++ = m_lcd_palette[m_lcd_framebuffer[y * ((m_lcd_regs.lccr1 & PXA255_LCCR1_PPL) + 1) + x]]; diff --git a/src/devices/machine/s2636.cpp b/src/devices/machine/s2636.cpp index bdf95dc69d0..8ad26690bcf 100644 --- a/src/devices/machine/s2636.cpp +++ b/src/devices/machine/s2636.cpp @@ -203,7 +203,7 @@ void s2636_device::device_start() save_item(NAME(m_intreq)); save_item(NAME(m_intack)); - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); save_item(NAME(m_sample_cnt)); save_item(NAME(m_sound_lvl)); @@ -247,7 +247,7 @@ void s2636_device::render_next_line() // pre-clear the line for convenience rectangle const &vis_area = screen().visible_area(); - uint16_t *const row = &m_bitmap.pix16(m_screen_line); + uint16_t *const row = &m_bitmap.pix(m_screen_line); m_bitmap.plot_box(0, m_screen_line, m_bitmap.width(), 1, 0); if ((vis_area.min_y > m_screen_line) || (vis_area.max_y < m_screen_line)) @@ -447,13 +447,14 @@ void s2636_device::write_intack(int state) //------------------------------------------------- -// sound_stream_update_legacy - generate audio output +// sound_stream_update - generate audio output //------------------------------------------------- -void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) + +void s2636_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - while (samples--) + auto &buffer = outputs[0]; + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { if (!m_sample_cnt) { @@ -469,7 +470,7 @@ void s2636_device::sound_stream_update_legacy(sound_stream &stream, stream_sampl } } - *buffer++ = m_sound_lvl ? 0x7fff : 0x0000; + buffer.put(sampindex, m_sound_lvl ? 1.0 : 0.0); m_sample_cnt--; } } diff --git a/src/devices/machine/s2636.h b/src/devices/machine/s2636.h index b5e41b83499..8803c629015 100644 --- a/src/devices/machine/s2636.h +++ b/src/devices/machine/s2636.h @@ -58,7 +58,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx index dcff99a7b70..8fae9ee616e 100644 --- a/src/devices/machine/s3c24xx.hxx +++ b/src/devices/machine/s3c24xx.hxx @@ -434,7 +434,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tpal() uint32_t color = s3c24xx_get_color_tpal(); for (int y = m_lcd.vpos_min; y <= m_lcd.vpos_max; y++) { - uint32_t *scanline = &bitmap.pix32(y, m_lcd.hpos_min); + uint32_t *scanline = &bitmap.pix(y, m_lcd.hpos_min); for (int x = m_lcd.hpos_min; x <= m_lcd.hpos_max; x++) { *scanline++ = color; @@ -445,7 +445,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tpal() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -467,7 +467,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -476,7 +476,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_01() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -490,7 +490,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -499,7 +499,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_02() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -513,7 +513,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -522,7 +522,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_04() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -536,7 +536,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -545,7 +545,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_08() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 16; i++) { *scanline++ = s3c24xx_get_color_stn_12(s3c24xx_lcd_dma_read_bits(12)); @@ -555,7 +555,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -563,7 +563,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_p() void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -577,7 +577,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -586,7 +586,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_stn_12_u() // not tested void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -600,7 +600,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -609,7 +609,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_01() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -623,7 +623,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -632,7 +632,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_02() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -646,7 +646,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -655,7 +655,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_04() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -669,7 +669,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -678,7 +678,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_08() void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_16() { bitmap_rgb32 &bitmap = *m_lcd.bitmap[0]; - uint32_t *scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + uint32_t *scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); for (int i = 0; i < 4; i++) { uint32_t data = s3c24xx_lcd_dma_read(); @@ -692,7 +692,7 @@ void S3C24_CLASS_NAME::s3c24xx_lcd_render_tft_16() m_lcd.vpos++; if (m_lcd.vpos > m_lcd.vpos_max) m_lcd.vpos = m_lcd.vpos_min; m_lcd.hpos = m_lcd.hpos_min; - scanline = &bitmap.pix32(m_lcd.vpos, m_lcd.hpos); + scanline = &bitmap.pix(m_lcd.vpos, m_lcd.hpos); } } } @@ -751,9 +751,9 @@ void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bit { for (int y = 0; y < bitmap_dst.height(); y++) { - uint32_t *line0 = &bitmap_src_1.pix32(y); - uint32_t *line1 = &bitmap_src_2.pix32(y); - uint32_t *line2 = &bitmap_dst.pix32(y); + uint32_t const *const line0 = &bitmap_src_1.pix(y); + uint32_t const *const line1 = &bitmap_src_2.pix(y); + uint32_t *const line2 = &bitmap_dst.pix(y); for (int x = 0; x < bitmap_dst.width(); x++) { uint32_t color0 = line0[x]; @@ -764,9 +764,9 @@ void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bit uint16_t r1 = (color1 >> 16) & 0x000000ff; uint16_t g1 = (color1 >> 8) & 0x000000ff; uint16_t b1 = (color1 >> 0) & 0x000000ff; - uint8_t r = (uint8_t)((r0 + r1) >> 1); - uint8_t g = (uint8_t)((g0 + g1) >> 1); - uint8_t b = (uint8_t)((b0 + b1) >> 1); + uint8_t r = uint8_t((r0 + r1) >> 1); + uint8_t g = uint8_t((g0 + g1) >> 1); + uint8_t b = uint8_t((b0 + b1) >> 1); line2[x] = (r << 16) | (g << 8) | b; } } diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp index 6672127e20f..bf3a1ed811c 100644 --- a/src/devices/machine/s3c44b0.cpp +++ b/src/devices/machine/s3c44b0.cpp @@ -17,6 +17,8 @@ #include "coreutil.h" +#include <algorithm> + #define S3C44B0_INTCON (0x00 / 4) // Interrupt Control #define S3C44B0_INTPND (0x04 / 4) // Interrupt Request Status @@ -696,8 +698,8 @@ uint32_t s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitma { for (int y = 0; y < screen.height(); y++) { - uint32_t *scanline = &bitmap.pix32(y); - uint8_t *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1); + uint32_t *scanline = &bitmap.pix(y); + uint8_t const *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1); for (int x = 0; x < screen.width(); x++) { *scanline++ = rgb_t(vram[0], vram[1], vram[2]); @@ -710,8 +712,7 @@ uint32_t s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitma { for (int y = 0; y < screen.height(); y++) { - uint32_t *scanline = &bitmap.pix32(y); - memset(scanline, 0, screen.width() * 4); + std::fill_n(&bitmap.pix(y), screen.width(), 0); } } return 0; diff --git a/src/devices/machine/spg110_video.cpp b/src/devices/machine/spg110_video.cpp index a76fef3bb60..daf7fa5e158 100644 --- a/src/devices/machine/spg110_video.cpp +++ b/src/devices/machine/spg110_video.cpp @@ -4,6 +4,9 @@ #include "emu.h" #include "spg110_video.h" +#include <algorithm> + + DEFINE_DEVICE_TYPE(SPG110_VIDEO, spg110_video_device, "spg110_video", "SPG110 System-on-a-Chip (Video)") spg110_video_device::spg110_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : @@ -649,9 +652,9 @@ uint32_t spg110_video_device::screen_update(screen_device &screen, bitmap_rgb32 for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); - uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y]; - memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1)); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); + const uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y]; + std::copy_n(src, cliprect.width(), dest); } return 0; diff --git a/src/devices/machine/spg290_ppu.cpp b/src/devices/machine/spg290_ppu.cpp index 8f47d61bf18..19ff7ccb1d2 100644 --- a/src/devices/machine/spg290_ppu.cpp +++ b/src/devices/machine/spg290_ppu.cpp @@ -354,9 +354,9 @@ inline void spg290_ppu_device::argb1555(bitmap_rgb32 &bitmap, const rectangle &c { rgb_t color = rgb_t(pal5bit(argb >> 10), pal5bit(argb >> 5), pal5bit(argb >> 0)); if (blend) - color = blend_colors(bitmap.pix32(posy, posx), color, blend); + color = blend_colors(bitmap.pix(posy, posx), color, blend); - bitmap.pix32(posy, posx) = color; + bitmap.pix(posy, posx) = color; } } @@ -366,9 +366,9 @@ inline void spg290_ppu_device::rgb565(bitmap_rgb32 &bitmap, const rectangle &cli { rgb_t color = rgb_t(pal5bit(rgb >> 11), pal6bit(rgb >> 5), pal5bit(rgb >> 0)); if (blend) - color = blend_colors(bitmap.pix32(posy, posx), color, blend); + color = blend_colors(bitmap.pix(posy, posx), color, blend); - bitmap.pix32(posy, posx) = color; + bitmap.pix(posy, posx) = color; } } diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp index 07d01e88be5..2441ebf17ce 100644 --- a/src/devices/machine/spg2xx_audio.cpp +++ b/src/devices/machine/spg2xx_audio.cpp @@ -76,7 +76,7 @@ void spg2xx_audio_device::device_start() m_audio_beat = timer_alloc(TIMER_BEAT); m_audio_beat->adjust(attotime::never); - m_stream = stream_alloc_legacy(0, 2, 281250/4); + m_stream = stream_alloc(0, 2, 281250/4); m_channel_debug = -1; @@ -887,12 +887,12 @@ void spg2xx_audio_device::audio_w(offs_t offset, uint16_t data) } } -void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void spg2xx_audio_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *out_l = outputs[0]; - stream_sample_t *out_r = outputs[1]; + auto &out_l = outputs[0]; + auto &out_r = outputs[1]; - for (int i = 0; i < samples; i++) + for (int i = 0; i < out_l.samples(); i++) { int32_t left_total = 0; int32_t right_total = 0; @@ -992,8 +992,8 @@ void spg2xx_audio_device::sound_stream_update_legacy(sound_stream &stream, strea int32_t left_final = (int16_t)((left_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7); int32_t right_final = (int16_t)((right_total * (int16_t)m_audio_ctrl_regs[AUDIO_MAIN_VOLUME]) >> 7); - *out_l++ = (int16_t)left_final; - *out_r++ = (int16_t)right_final; + out_l.put_int(i, int16_t(left_final), 32768); + out_r.put_int(i, int16_t(right_final), 32768); } } diff --git a/src/devices/machine/spg2xx_audio.h b/src/devices/machine/spg2xx_audio.h index 59d7635198d..588d49e7895 100644 --- a/src/devices/machine/spg2xx_audio.h +++ b/src/devices/machine/spg2xx_audio.h @@ -33,7 +33,7 @@ public: protected: // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void audio_beat_tick(); void audio_rampdown_tick(const uint32_t channel); diff --git a/src/devices/machine/spg_renderer.cpp b/src/devices/machine/spg_renderer.cpp index 0b6efe58c3f..78bc26438ae 100644 --- a/src/devices/machine/spg_renderer.cpp +++ b/src/devices/machine/spg_renderer.cpp @@ -831,7 +831,7 @@ void spg_renderer_device::update_palette_lookup() void spg_renderer_device::apply_saturation_and_fade(bitmap_rgb32& bitmap, const rectangle& cliprect, int scanline) { - uint32_t* src = &bitmap.pix32(scanline, cliprect.min_x); + uint32_t* src = &bitmap.pix(scanline, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/devices/machine/swtpc8212.cpp b/src/devices/machine/swtpc8212.cpp index 68af9d42e07..fffd6eefe7f 100644 --- a/src/devices/machine/swtpc8212.cpp +++ b/src/devices/machine/swtpc8212.cpp @@ -319,7 +319,7 @@ MC6845_UPDATE_ROW(swtpc8212_device::update_row) else font_color = rgb_t(0x00, 0xd0, 0x00); } - bitmap.pix32(y, x++) = font_color; + bitmap.pix(y, x++) = font_color; data <<= 1; } diff --git a/src/devices/machine/tc009xlvc.cpp b/src/devices/machine/tc009xlvc.cpp index e6fcb74a181..b2d302d3922 100644 --- a/src/devices/machine/tc009xlvc.cpp +++ b/src/devices/machine/tc009xlvc.cpp @@ -347,7 +347,7 @@ u32 tc0090lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { const int res_x = (global_flip()) ? 320 - x : x; - bitmap.pix16(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); + bitmap.pix(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); } } } @@ -398,7 +398,7 @@ u32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { const int res_x = (global_flip()) ? 320 - x : x; - bitmap.pix16(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); + bitmap.pix(y, x) = palette().pen(m_bitmap_ram[count + (res_x & 0x1ff)]); } } } diff --git a/src/devices/machine/terminal.cpp b/src/devices/machine/terminal.cpp index fd07c5bff35..ccb101d8036 100644 --- a/src/devices/machine/terminal.cpp +++ b/src/devices/machine/terminal.cpp @@ -276,7 +276,7 @@ uint32_t generic_terminal_device::update(screen_device &device, bitmap_rgb32 &bi { for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); for (uint16_t x = ma; x < ma + m_width; x++) { diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp index e0fab62505b..91d0fdc46b9 100644 --- a/src/devices/sound/astrocde.cpp +++ b/src/devices/sound/astrocde.cpp @@ -146,7 +146,7 @@ void astrocade_io_device::sound_stream_update(sound_stream &stream, std::vector< constexpr stream_buffer::sample_t sample_scale = 1.0f / 60.0f; for (int sampindex = 0; sampindex < dest.samples(); sampindex += samples_this_time) { - stream_sample_t cursample = 0; + s32 cursample = 0; /* compute the number of cycles until the next master oscillator reset */ /* or until the next noise boundary */ diff --git a/src/devices/sound/cdp1864.cpp b/src/devices/sound/cdp1864.cpp index e8168004811..f4a46748593 100644 --- a/src/devices/sound/cdp1864.cpp +++ b/src/devices/sound/cdp1864.cpp @@ -375,7 +375,7 @@ void cdp1864_device::dma_w(uint8_t data) color = (gdata << 2) | (bdata << 1) | rdata; } - m_bitmap.pix32(y, sx + x) = m_palette[color]; + m_bitmap.pix(y, sx + x) = m_palette[color]; data <<= 1; } diff --git a/src/devices/sound/cdp1869.cpp b/src/devices/sound/cdp1869.cpp index 98580d7ae54..9e28aa4c048 100644 --- a/src/devices/sound/cdp1869.cpp +++ b/src/devices/sound/cdp1869.cpp @@ -574,29 +574,28 @@ void cdp1869_device::sound_stream_update(sound_stream &stream, std::vector<read_ void cdp1869_device::draw_line(bitmap_rgb32 &bitmap, const rectangle &rect, int x, int y, uint8_t data, int color) { - int i; - pen_t fg = m_palette->pen(color); + pen_t const fg = m_palette->pen(color); data <<= 2; - for (i = 0; i < CH_WIDTH; i++) + for (int i = 0; i < CH_WIDTH; i++) { if (data & 0x80) { - bitmap.pix32(y, x) = fg; + bitmap.pix(y, x) = fg; if (!m_fresvert) { - bitmap.pix32(y + 1, x) = fg; + bitmap.pix(y + 1, x) = fg; } if (!m_freshorz) { - bitmap.pix32(y, x + 1) = fg; + bitmap.pix(y, x + 1) = fg; if (!m_fresvert) { - bitmap.pix32(y + 1, x + 1) = fg; + bitmap.pix(y + 1, x + 1) = fg; } } } diff --git a/src/devices/sound/dac76.cpp b/src/devices/sound/dac76.cpp index bbeb5728577..1c73d7b02c1 100644 --- a/src/devices/sound/dac76.cpp +++ b/src/devices/sound/dac76.cpp @@ -79,7 +79,7 @@ void dac76_device::sound_stream_update(sound_stream &stream, std::vector<read_st { // get current output level int step_size = (2 << m_chord); - stream_sample_t vout = m_level[m_chord] + m_step * step_size; + s32 vout = m_level[m_chord] + m_step * step_size; // apply sign bit vout *= (m_sb ? +1 : -1); diff --git a/src/devices/sound/discrete.cpp b/src/devices/sound/discrete.cpp index 1d5647e45cd..7cec35b77fe 100644 --- a/src/devices/sound/discrete.cpp +++ b/src/devices/sound/discrete.cpp @@ -1026,7 +1026,7 @@ void discrete_sound_device::device_reset() // discrete_device_process - process a number of // samples. // -// input / output buffers are stream_sample_t +// input / output buffers are s32 // to not to have to convert the buffers. // a "discrete cpu" device will pass nullptr here //------------------------------------------------- diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h index 2d301f5c05e..2fd316aad8e 100644 --- a/src/devices/sound/es5503.h +++ b/src/devices/sound/es5503.h @@ -36,7 +36,6 @@ protected: virtual void device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) override; // device_sound_interface overrides - //virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_rom_interface overrides diff --git a/src/devices/sound/fm.h b/src/devices/sound/fm.h index 32f768a824b..45381d7dda9 100644 --- a/src/devices/sound/fm.h +++ b/src/devices/sound/fm.h @@ -50,7 +50,7 @@ template <typename X> constexpr TIME_TYPE MULTIPLY_TIME_BY_INT(TIME_TYPE const & #endif -typedef stream_sample_t FMSAMPLE; +typedef s32 FMSAMPLE; /* #if (FM_SAMPLE_BITS==16) typedef int16_t FMSAMPLE; diff --git a/src/devices/sound/fmopl.h b/src/devices/sound/fmopl.h index b70c46f93e3..bb484b0e41b 100644 --- a/src/devices/sound/fmopl.h +++ b/src/devices/sound/fmopl.h @@ -16,7 +16,7 @@ /* select output bits size of output : 8 or 16 */ #define OPL_SAMPLE_BITS 16 -typedef stream_sample_t OPLSAMPLE; +typedef s32 OPLSAMPLE; /* #if (OPL_SAMPLE_BITS==16) typedef int16_t OPLSAMPLE; diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp index 80e4aa9cd09..868bcb70bc4 100644 --- a/src/devices/sound/ics2115.cpp +++ b/src/devices/sound/ics2115.cpp @@ -443,7 +443,7 @@ void ics2115_device::sound_stream_update(sound_stream &stream, std::vector<read_ /* #ifdef ICS2115_DEBUG u32 curaddr = ((voice.osc.saddr << 20) & 0xffffff) | (voice.osc.acc >> 12); - stream_sample_t sample = get_sample(voice); + s32 sample = get_sample(voice); logerror("[%06x=%04x]", curaddr, (s16)sample); #endif */ diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 0032d834df6..7337b0c8b91 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -311,7 +311,7 @@ void k053260_device::sound_stream_update(sound_stream &stream, std::vector<read_ { for ( int j = 0; j < outputs[0].samples(); j++ ) { - stream_sample_t buffer[2] = {0, 0}; + s32 buffer[2] = {0, 0}; for (auto & voice : m_voice) { @@ -435,7 +435,7 @@ void k053260_device::KDSC_Voice::key_off() m_playing = false; } -void k053260_device::KDSC_Voice::play(stream_sample_t *outputs) +void k053260_device::KDSC_Voice::play(s32 *outputs) { m_counter += CLOCKS_PER_SAMPLE; diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h index a50b8b9196e..ad14244ceb9 100644 --- a/src/devices/sound/k053260.h +++ b/src/devices/sound/k053260.h @@ -79,7 +79,7 @@ private: inline void update_pan_volume(); inline void key_on(); inline void key_off(); - inline void play(stream_sample_t *outputs); + inline void play(s32 *outputs); inline bool playing() { return m_playing; } inline u8 read_rom(bool side_effects); diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp index e551df0a93d..fadef01dd20 100644 --- a/src/devices/sound/mos6560.cpp +++ b/src/devices/sound/mos6560.cpp @@ -173,20 +173,18 @@ inline uint8_t mos6560_device::read_colorram(offs_t offset) void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color ) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); - - m_bitmap.pix32(y + yoff, xoff + 0) = PALETTE_MOS[color[code >> 7]]; - m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 2) = PALETTE_MOS[color[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 4) = PALETTE_MOS[color[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 6) = PALETTE_MOS[color[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 1]]; + int code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); + + m_bitmap.pix(y + yoff, xoff + 0) = PALETTE_MOS[color[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, xoff + 1) = PALETTE_MOS[color[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, xoff + 2) = PALETTE_MOS[color[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, xoff + 3) = PALETTE_MOS[color[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, xoff + 4) = PALETTE_MOS[color[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, xoff + 5) = PALETTE_MOS[color[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, xoff + 6) = PALETTE_MOS[color[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, xoff + 7) = PALETTE_MOS[color[BIT(code, 0)]]; } } @@ -197,20 +195,18 @@ void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color ) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); - - m_bitmap.pix32(y + yoff, xoff + 0) = - m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[code >> 6]]; - m_bitmap.pix32(y + yoff, xoff + 2) = - m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, xoff + 4) = - m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, xoff + 6) = - m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 3]]; + int code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); + + m_bitmap.pix(y + yoff, xoff + 0) = m_bitmap.pix(y + yoff, xoff + 1) = + PALETTE_MOS[color[code >> 6]]; + m_bitmap.pix(y + yoff, xoff + 2) = m_bitmap.pix(y + yoff, xoff + 3) = + PALETTE_MOS[color[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, xoff + 4) = m_bitmap.pix(y + yoff, xoff + 5) = + PALETTE_MOS[color[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, xoff + 6) = m_bitmap.pix(y + yoff, xoff + 7) = + PALETTE_MOS[color[code & 3]]; } } @@ -221,9 +217,7 @@ void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yof void mos6560_device::drawlines( int first, int last ) { - int line, vline; - int offs, yoff, xoff, ybegin, yend, i, j; - int attr, ch; + int line; m_lastline = last; if (first >= last) @@ -231,12 +225,13 @@ void mos6560_device::drawlines( int first, int last ) for (line = first; (line < m_ypos) && (line < last); line++) { - for (j = 0; j < m_total_xsize; j++) - m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor]; + for (int j = 0; j < m_total_xsize; j++) + m_bitmap.pix(line, j) = PALETTE_MOS[m_framecolor]; } - for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) + for (int vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) { + int offs, yoff, xoff, ybegin, yend; if (m_matrix8x16) { offs = (vline >> 4) * m_chars_x; @@ -254,16 +249,16 @@ void mos6560_device::drawlines( int first, int last ) if (m_xpos > 0) { - for (i = ybegin; i <= yend; i++) - for (j = 0; j < m_xpos; j++) - m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor]; + for (int i = ybegin; i <= yend; i++) + for (int j = 0; j < m_xpos; j++) + m_bitmap.pix(yoff + i, j) = PALETTE_MOS[m_framecolor]; } for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++) { - ch = read_videoram((m_videoaddr + offs) & 0x3fff); + int ch = read_videoram((m_videoaddr + offs) & 0x3fff); - attr = (read_colorram((m_videoaddr + offs) & 0x3fff)) & 0xf; + int attr = (read_colorram((m_videoaddr + offs) & 0x3fff)) & 0xf; if (m_variant == TYPE_ATTACK_UFO) { @@ -301,9 +296,9 @@ void mos6560_device::drawlines( int first, int last ) if (xoff < m_total_xsize) { - for (i = ybegin; i <= yend; i++) - for (j = xoff; j < m_total_xsize; j++) - m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor]; + for (int i = ybegin; i <= yend; i++) + for (int j = xoff; j < m_total_xsize; j++) + m_bitmap.pix(yoff + i, j) = PALETTE_MOS[m_framecolor]; } if (m_matrix8x16) @@ -319,8 +314,8 @@ void mos6560_device::drawlines( int first, int last ) } for (; line < last; line++) - for (j = 0; j < m_total_xsize; j++) - m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor]; + for (int j = 0; j < m_total_xsize; j++) + m_bitmap.pix(line, j) = PALETTE_MOS[m_framecolor]; } diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp index 993cade8ec2..aa9604b3a78 100644 --- a/src/devices/sound/mos7360.cpp +++ b/src/devices/sound/mos7360.cpp @@ -513,106 +513,93 @@ void mos7360_device::sound_stream_update(sound_stream &stream, std::vector<read_ void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int xoff, uint16_t *color) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { + int code; if (INROM) code = read_rom(m_chargenaddr + ch * 8 + y); else code = read_ram(m_chargenaddr + ch * 8 + y); - m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[color[code >> 7]]; - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[color[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[color[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[color[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[color[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[color[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[color[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[color[code & 1]]; + m_bitmap.pix(y + yoff, 0 + xoff) = PALETTE_MOS[color[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, 1 + xoff) = PALETTE_MOS[color[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, 2 + xoff) = PALETTE_MOS[color[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, 3 + xoff) = PALETTE_MOS[color[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, 4 + xoff) = PALETTE_MOS[color[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, 5 + xoff) = PALETTE_MOS[color[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, 6 + xoff) = PALETTE_MOS[color[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, 7 + xoff) = PALETTE_MOS[color[BIT(code, 0)]]; } } void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { + int code; if (INROM) code = read_rom(m_chargenaddr + ch * 8 + y); else code = read_ram(m_chargenaddr + ch * 8 + y); - m_bitmap.pix32(y + yoff, 0 + xoff) = - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_multi[code >> 6]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_multi[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_multi[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_multi[code & 3]]; + m_bitmap.pix(y + yoff, 0 + xoff) = m_bitmap.pix(y + yoff, 1 + xoff) = + PALETTE_MOS[m_multi[code >> 6]]; + m_bitmap.pix(y + yoff, 2 + xoff) = m_bitmap.pix(y + yoff, 3 + xoff) = + PALETTE_MOS[m_multi[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, 4 + xoff) = m_bitmap.pix(y + yoff, 5 + xoff) = + PALETTE_MOS[m_multi[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, 6 + xoff) = m_bitmap.pix(y + yoff, 7 + xoff) = + PALETTE_MOS[m_multi[code & 3]]; } } void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_ram(m_bitmapaddr + ch * 8 + y); - - m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[code >> 7]]; - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 6) & 1]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 5) & 1]]; - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 4) & 1]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 3) & 1]]; - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 2) & 1]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 1) & 1]]; - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[code & 1]]; + int code = read_ram(m_bitmapaddr + ch * 8 + y); + + m_bitmap.pix(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 7)]]; + m_bitmap.pix(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 6)]]; + m_bitmap.pix(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 5)]]; + m_bitmap.pix(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 4)]]; + m_bitmap.pix(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 3)]]; + m_bitmap.pix(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 2)]]; + m_bitmap.pix(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 1)]]; + m_bitmap.pix(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[BIT(code, 0)]]; } } void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, int xoff) { - int y, code; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { - code = read_ram(m_bitmapaddr + ch * 8 + y); - - m_bitmap.pix32(y + yoff, 0 + xoff) = - m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_bitmapmulti[code >> 6]]; - m_bitmap.pix32(y + yoff, 2 + xoff) = - m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]]; - m_bitmap.pix32(y + yoff, 4 + xoff) = - m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]]; - m_bitmap.pix32(y + yoff, 6 + xoff) = - m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_bitmapmulti[code & 3]]; + int code = read_ram(m_bitmapaddr + ch * 8 + y); + + m_bitmap.pix(y + yoff, 0 + xoff) = m_bitmap.pix(y + yoff, 1 + xoff) = + PALETTE_MOS[m_bitmapmulti[code >> 6]]; + m_bitmap.pix(y + yoff, 2 + xoff) = m_bitmap.pix(y + yoff, 3 + xoff) = + PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]]; + m_bitmap.pix(y + yoff, 4 + xoff) = m_bitmap.pix(y + yoff, 5 + xoff) = + PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]]; + m_bitmap.pix(y + yoff, 6 + xoff) = m_bitmap.pix(y + yoff, 7 + xoff) = + PALETTE_MOS[m_bitmapmulti[code & 3]]; } } void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int color) { - int y; - - for (y = ybegin; y <= yend; y++) + for (int y = ybegin; y <= yend; y++) { for (int x = 0; x < 8; x++) { - m_bitmap.pix32(y + yoff, x + xoff) = PALETTE_MOS[color]; + m_bitmap.pix(y + yoff, x + xoff) = PALETTE_MOS[color]; } } } void mos7360_device::drawlines(int first, int last) { - int line, vline, end; - int attr, ch, c1, c2, ecm; - int offs, yoff, xoff, ybegin, yend, xbegin, xend; - int i; - m_lastline = last; /* top part of display not rastered */ @@ -625,34 +612,44 @@ void mos7360_device::drawlines(int first, int last) if (!SCREENON) { - for (line = first; (line < last) && (line < m_bitmap.height()); line++) + for (int line = first; (line < last) && (line < m_bitmap.height()); line++) { for (int x = 0; x < m_bitmap.width(); x++) { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } return; } + int xbegin, xend; if (COLUMNS40) - xbegin = XPOS, xend = xbegin + 320; + { + xbegin = XPOS; + xend = xbegin + 320; + } else - xbegin = XPOS + 7, xend = xbegin + 304; + { + xbegin = XPOS + 7; + xend = xbegin + 304; + } + int end; if (last < m_y_begin) end = last; else end = m_y_begin + YPOS; + + int line; + for (line = first; line < end; line++) { - for (line = first; line < end; line++) + for (int x = 0; x < m_bitmap.width(); x++) { - for (int x = 0; x < m_bitmap.width(); x++) - { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; - } + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } + + int vline; if (LINES25) vline = line - m_y_begin - YPOS; else @@ -663,23 +660,23 @@ void mos7360_device::drawlines(int first, int last) else end = m_y_end + YPOS; - for (; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) + for (int ybegin, yend; line < end; vline = (vline + 8) & ~7, line = line + 1 + yend - ybegin) { - offs = (vline >> 3) * 40; + int offs = (vline >> 3) * 40; ybegin = vline & 7; - yoff = line - ybegin; + int yoff = line - ybegin; yend = (yoff + 7 < end) ? 7 : (end - yoff - 1); /* rendering 39 characters */ /* left and right borders are overwritten later */ - for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) + for (int xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++) { if (HIRESON) { - ch = read_ram((m_videoaddr | 0x400) + offs); - attr = read_ram(m_videoaddr + offs); - c1 = ((ch >> 4) & 0xf) | (attr << 4); - c2 = (ch & 0xf) | (attr & 0x70); + int ch = read_ram((m_videoaddr | 0x400) + offs); + int attr = read_ram(m_videoaddr + offs); + int c1 = ((ch >> 4) & 0xf) | (attr << 4); + int c2 = (ch & 0xf) | (attr & 0x70); m_bitmapmulti[1] = m_c16_bitmap[1] = c1 & 0x7f; m_bitmapmulti[2] = m_c16_bitmap[0] = c2 & 0x7f; if (MULTICOLORON) @@ -693,13 +690,13 @@ void mos7360_device::drawlines(int first, int last) } else { - ch = read_ram((m_videoaddr | 0x400) + offs); - attr = read_ram(m_videoaddr + offs); + int ch = read_ram((m_videoaddr | 0x400) + offs); + int attr = read_ram(m_videoaddr + offs); // levente harsfalvi's docu says cursor off in ecm and multicolor if (ECMON) { // hardware reverse off - ecm = ch >> 6; + int ecm = ch >> 6; m_ecmcolor[0] = m_colors[ecm]; m_ecmcolor[1] = attr & 0x7f; draw_character(ybegin, yend, ch & ~0xc0, yoff, xoff, m_ecmcolor); @@ -741,16 +738,16 @@ void mos7360_device::drawlines(int first, int last) } } - for (i = ybegin; i <= yend; i++) + for (int i = ybegin; i <= yend; i++) { for (int x = 0; x < xbegin; x++) { - m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; } for (int x = xend; x < m_bitmap.width(); x++) { - m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(yoff + i, x) = PALETTE_MOS[FRAMECOLOR]; } } } @@ -764,7 +761,7 @@ void mos7360_device::drawlines(int first, int last) { for (int x = 0; x < m_bitmap.width(); x++) { - m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR]; + m_bitmap.pix(line, x) = PALETTE_MOS[FRAMECOLOR]; } } } diff --git a/src/devices/sound/nes_apu.cpp b/src/devices/sound/nes_apu.cpp index f7b4772ddb7..483b337475f 100644 --- a/src/devices/sound/nes_apu.cpp +++ b/src/devices/sound/nes_apu.cpp @@ -83,8 +83,8 @@ void nesapu_device::create_syncs(unsigned long sps) DEFINE_DEVICE_TYPE(NES_APU, nesapu_device, "nesapu", "N2A03 APU") -nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, NES_APU, tag, owner, clock) +nesapu_device::nesapu_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) , m_samps_per_sync(0) , m_buffer_size(0) @@ -108,6 +108,11 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev } } +nesapu_device::nesapu_device(const machine_config& mconfig, const char* tag, device_t* owner, u32 clock) + : nesapu_device(mconfig, NES_APU, tag, owner, clock) +{ +} + void nesapu_device::device_reset() { write(0x15, 0x00); diff --git a/src/devices/sound/nes_apu.h b/src/devices/sound/nes_apu.h index 1539f44beab..673c967fec7 100644 --- a/src/devices/sound/nes_apu.h +++ b/src/devices/sound/nes_apu.h @@ -56,6 +56,8 @@ public: void write(offs_t offset, u8 data); protected: + nesapu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + // device-level overrides virtual void device_start() override; diff --git a/src/devices/sound/nes_apu_vt.cpp b/src/devices/sound/nes_apu_vt.cpp new file mode 100644 index 00000000000..f93c3203bac --- /dev/null +++ b/src/devices/sound/nes_apu_vt.cpp @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +// The XOP is the NES APU type found in VT platforms, it roughly doubles the functionality of the APU +// but in ways that means simply installing 2 APU devices isn't entirely correct (registers on one +// APU module having an effect on the other) + +// TODO: everything + +#include "emu.h" +#include "sound/nes_apu_vt.h" + +DEFINE_DEVICE_TYPE(NES_APU_VT, nes_apu_vt_device, "nes_apu_vt", "XOP APU") + +nes_apu_vt_device::nes_apu_vt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : nesapu_device(mconfig, NES_APU_VT, tag, owner, clock) +{ +} + +void nes_apu_vt_device::device_start() +{ + nesapu_device::device_start(); +} + +void nes_apu_vt_device::device_reset() +{ + nesapu_device::device_reset(); +} diff --git a/src/devices/sound/nes_apu_vt.h b/src/devices/sound/nes_apu_vt.h new file mode 100644 index 00000000000..f93616673fa --- /dev/null +++ b/src/devices/sound/nes_apu_vt.h @@ -0,0 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +#ifndef MAME_AUDIO_NES_VT_APU_H +#define MAME_AUDIO_NES_VT_APU_H + +#pragma once + +#include "sound/nes_apu.h" + +DECLARE_DEVICE_TYPE(NES_APU_VT, nes_apu_vt_device) + +class nes_apu_vt_device : public nesapu_device +{ +public: + // construction/destruction + nes_apu_vt_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: +}; + +#endif // MAME_AUDIO_NES_VT_APU_H diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp index 52d255dbfc6..98cd204b503 100644 --- a/src/devices/sound/s_dsp.cpp +++ b/src/devices/sound/s_dsp.cpp @@ -1074,7 +1074,7 @@ void s_dsp_device::sound_stream_update(sound_stream &stream, std::vector<read_st dsp_update(mix); /* Update the buffers */ - outputs[0].put_int(i, (stream_sample_t)mix[0], 32768); - outputs[1].put_int(i, (stream_sample_t)mix[1], 32768); + outputs[0].put_int(i, (s32)mix[0], 32768); + outputs[1].put_int(i, (s32)mix[1], 32768); } } diff --git a/src/devices/sound/vgm_visualizer.cpp b/src/devices/sound/vgm_visualizer.cpp index c1f438f2b2c..bab3c909ddf 100644 --- a/src/devices/sound/vgm_visualizer.cpp +++ b/src/devices/sound/vgm_visualizer.cpp @@ -158,7 +158,7 @@ void vgmviz_device::apply_fft() void vgmviz_device::apply_waterfall() { - int total_bars = FFT_LENGTH / 2; + const int total_bars = FFT_LENGTH / 2; WDL_FFT_COMPLEX* bins[2] = { (WDL_FFT_COMPLEX*)m_fft_buf[0], (WDL_FFT_COMPLEX*)m_fft_buf[1] }; for (int bar = 0; bar < std::min<int>(total_bars, SCREEN_HEIGHT); bar++) { @@ -555,7 +555,7 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap m_clear_pending = false; } - const pen_t *pal = m_palette->pens(); + pen_t const *const pal = m_palette->pens(); int width = SCREEN_WIDTH; switch (SpecMode) @@ -563,31 +563,26 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap case SPEC_VIZ_PILLAR: for (int y = 2; y < SCREEN_HEIGHT; y++) { - uint32_t *src = &m_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y - 2); + uint32_t const *const src = &m_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y - 2); for (int x = SCREEN_WIDTH - 1; x >= 1; x--) { dst[x] = src[x - 1]; } } - width = (int)(SCREEN_WIDTH * 0.75f); + width = int(SCREEN_WIDTH * 0.75f); break; case SPEC_VIZ_TOP: for (int y = 1; y < SCREEN_HEIGHT; y++) { - uint32_t *src = &m_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y - 1); - for (int x = 0; x < SCREEN_WIDTH; x++) - { - dst[x] = src[x]; - } + std::copy_n(&m_bitmap.pix(y), SCREEN_WIDTH, &bitmap.pix(y - 1)); } break; default: break; } - int total_bars = FFT_LENGTH / 2; + const int total_bars = FFT_LENGTH / 2; WDL_FFT_COMPLEX *bins[2] = { (WDL_FFT_COMPLEX *)m_fft_buf[0], (WDL_FFT_COMPLEX *)m_fft_buf[1] }; for (int bar = 2; bar < total_bars && bar < width; bar += BarSize) @@ -614,8 +609,8 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap } for (int y = 0; y < SCREEN_HEIGHT; y++) { - int bar_y = SCREEN_HEIGHT - y; - uint32_t *line = &bitmap.pix32(y); + const int bar_y = SCREEN_HEIGHT - y; + uint32_t *const line = &bitmap.pix(y); for (int x = 0; x < BarSize; x++) { line[(bar - 2) + x] = bar_y <= level ? pal[256 + pal_index] : pal[black_index]; @@ -631,8 +626,8 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap for (int y = 0; y < SCREEN_HEIGHT; y++) { - int bar_y = SCREEN_HEIGHT - y; - uint32_t *line = &bitmap.pix32(y); + const int bar_y = SCREEN_HEIGHT - y; + uint32_t *const line = &bitmap.pix(y); line[0] = 0; if (bar_y > level) { @@ -643,9 +638,9 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap { if (bar_y < (level - 1)) { - const uint8_t r = (uint8_t)(((entry >> 16) & 0xff) * 0.75f); - const uint8_t g = (uint8_t)(((entry >> 8) & 0xff) * 0.75f); - const uint8_t b = (uint8_t)(((entry >> 0) & 0xff) * 0.75f); + const uint8_t r = uint8_t(((entry >> 16) & 0xff) * 0.75f); + const uint8_t g = uint8_t(((entry >> 8) & 0xff) * 0.75f); + const uint8_t b = uint8_t(((entry >> 0) & 0xff) * 0.75f); line[(bar - 2) + x] = 0xff000000 | (r << 16) | (g << 8) | b; } else @@ -653,9 +648,9 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap line[(bar - 2) + x] = pal[256 + pal_index]; } } - const uint8_t r = (uint8_t)(((entry >> 16) & 0xff) * 0.5f); - const uint8_t g = (uint8_t)(((entry >> 8) & 0xff) * 0.5f); - const uint8_t b = (uint8_t)(((entry >> 0) & 0xff) * 0.5f); + const uint8_t r = uint8_t(((entry >> 16) & 0xff) * 0.5f); + const uint8_t g = uint8_t(((entry >> 8) & 0xff) * 0.5f); + const uint8_t b = uint8_t(((entry >> 0) & 0xff) * 0.5f); line[(bar - 2) + (BarSize - 1)] = 0xff000000 | (r << 16) | (g << 8) | b; if (bar_y < level) { @@ -664,10 +659,11 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap } for (int x = 0; x < SCREEN_WIDTH; x++) { - bitmap.pix32(SCREEN_HEIGHT - 1, x) = 0; - bitmap.pix32(SCREEN_HEIGHT - 2, x) = 0; + bitmap.pix(SCREEN_HEIGHT - 1, x) = 0; + bitmap.pix(SCREEN_HEIGHT - 2, x) = 0; } - memcpy(&m_bitmap.pix32(0), &bitmap.pix32(0), sizeof(uint32_t) * SCREEN_WIDTH * SCREEN_HEIGHT); + for (int y = 0; y < SCREEN_HEIGHT; y++) + std::copy_n(&bitmap.pix(y), SCREEN_WIDTH, &m_bitmap.pix(y)); break; case SPEC_VIZ_TOP: level = int(raw_level * 63.0f); @@ -678,10 +674,11 @@ template <int BarSize, int SpecMode> void vgmviz_device::draw_spectrogram(bitmap for (int x = 0; x < BarSize; x++) { - bitmap.pix32(SCREEN_HEIGHT - 1, (bar - 2) + x) = level > 0 ? pal[256 + pal_index] : pal[black_index]; + bitmap.pix(SCREEN_HEIGHT - 1, (bar - 2) + x) = level > 0 ? pal[256 + pal_index] : pal[black_index]; } - memcpy(&m_bitmap.pix32(0), &bitmap.pix32(0), sizeof(uint32_t) * SCREEN_WIDTH * SCREEN_HEIGHT); + for (int y = 0; y < SCREEN_HEIGHT; y++) + std::copy_n(&bitmap.pix(y), SCREEN_WIDTH, &m_bitmap.pix(y)); break; } } @@ -700,7 +697,7 @@ void vgmviz_device::draw_waterfall(bitmap_rgb32 &bitmap) const int v0_index = (int)v0h; const int v1_index = (int)v1h; const float interp = v0h - (float)v0_index; - uint32_t* line = &bitmap.pix32(y); + uint32_t* line = &bitmap.pix(y); for (int x = 0; x < SCREEN_WIDTH; x++) { if (m_waterfall_length < SCREEN_WIDTH) @@ -736,8 +733,8 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) for (int x = 0; x < SCREEN_WIDTH; x++) { - bitmap.pix32(CHANNEL_CENTER, x) = MED_GRAY; - bitmap.pix32(CHANNEL_HEIGHT + 1 + CHANNEL_CENTER, x) = MED_GRAY; + bitmap.pix(CHANNEL_CENTER, x) = MED_GRAY; + bitmap.pix(CHANNEL_HEIGHT + 1 + CHANNEL_CENTER, x) = MED_GRAY; const float raw_l = m_audio_buf[1 - m_audio_fill_index][0][((int)m_history_length + 1 + x) % FFT_LENGTH]; const int sample_l = (int)((raw_l - 0.5f) * (CHANNEL_HEIGHT - 1)); @@ -746,7 +743,7 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) int y = endy_l - sample_l; do { - bitmap.pix32(y, x) = LEFT_COLOR; + bitmap.pix(y, x) = LEFT_COLOR; y += dy_l; } while(y != endy_l); @@ -757,11 +754,11 @@ void vgmviz_device::draw_waveform(bitmap_rgb32 &bitmap) y = endy_r - sample_r; do { - bitmap.pix32(y, x) = RIGHT_COLOR; + bitmap.pix(y, x) = RIGHT_COLOR; y += dy_r; } while(y != endy_r); - bitmap.pix32(CHANNEL_HEIGHT, x) = WHITE; - bitmap.pix32(CHANNEL_HEIGHT + 1, x) = WHITE; + bitmap.pix(CHANNEL_HEIGHT, x) = WHITE; + bitmap.pix(CHANNEL_HEIGHT + 1, x) = WHITE; } } diff --git a/src/devices/sound/ymf262.h b/src/devices/sound/ymf262.h index 3c02e0da16c..fe131169fcf 100644 --- a/src/devices/sound/ymf262.h +++ b/src/devices/sound/ymf262.h @@ -8,7 +8,7 @@ /* select number of output bits: 8 or 16 */ #define OPL3_SAMPLE_BITS 16 -typedef stream_sample_t OPL3SAMPLE; +typedef s32 OPL3SAMPLE; /* #if (OPL3_SAMPLE_BITS==16) typedef int16_t OPL3SAMPLE; 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) { diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp index 6145e668a23..eb8bd09d440 100644 --- a/src/emu/crsshair.cpp +++ b/src/emu/crsshair.cpp @@ -168,7 +168,6 @@ void render_crosshair::set_default_bitmap() void render_crosshair::create_bitmap() { - int x, y; rgb_t color = m_player < ARRAY_LENGTH(crosshair_colors) ? crosshair_colors[m_player] : rgb_t::white(); // if we have a bitmap and texture for this player, kill it @@ -204,14 +203,14 @@ void render_crosshair::create_bitmap() m_bitmap->fill(rgb_t(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ - for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) + for (int y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ - u32 *dest0 = &m_bitmap->pix32(y); - u32 *dest1 = &m_bitmap->pix32(CROSSHAIR_RAW_SIZE - 1 - y); + u32 *const dest0 = &m_bitmap->pix(y); + u32 *const dest1 = &m_bitmap->pix(CROSSHAIR_RAW_SIZE - 1 - y); /* extract to two rows simultaneously */ - for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) + for (int x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = rgb_t(0xff,0x00,0x00,0x00) | color; } diff --git a/src/emu/device.h b/src/emu/device.h index 55c3641f678..53534fe60d5 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -205,7 +205,7 @@ private: template <typename DeviceClass> static std::unique_ptr<device_t> create_device(device_type_impl_base const &type, machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) { - return make_unique_clear<DeviceClass>(mconfig, tag, owner, clock); + return std::make_unique<DeviceClass>(mconfig, tag, owner, clock); } template <typename DriverClass> @@ -298,7 +298,7 @@ public: template <typename... Params> std::unique_ptr<DeviceClass> create(machine_config &mconfig, char const *tag, device_t *owner, Params &&... args) const { - return make_unique_clear<DeviceClass>(mconfig, tag, owner, std::forward<Params>(args)...); + return std::make_unique<DeviceClass>(mconfig, tag, owner, std::forward<Params>(args)...); } template <typename... Params> DeviceClass &operator()(machine_config &mconfig, char const *tag, Params &&... args) const; diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index d2c063ff205..10d16150b76 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -66,15 +66,10 @@ device_sound_interface &device_sound_interface::add_route(u32 output, device_t & //------------------------------------------------- -// stream_alloc_legacy - allocate a stream implicitly +// stream_alloc - allocate a stream implicitly // associated with this device //------------------------------------------------- -sound_stream *device_sound_interface::stream_alloc_legacy(int inputs, int outputs, int sample_rate) -{ - return device().machine().sound().stream_alloc_legacy(*this, inputs, outputs, sample_rate, stream_update_legacy_delegate(&device_sound_interface::sound_stream_update_legacy, this)); -} - sound_stream *device_sound_interface::stream_alloc(int inputs, int outputs, int sample_rate) { return device().machine().sound().stream_alloc(*this, inputs, outputs, sample_rate, stream_update_delegate(&device_sound_interface::sound_stream_update, this), STREAM_DEFAULT_FLAGS); @@ -382,17 +377,6 @@ void device_sound_interface::interface_pre_reset() //------------------------------------------------- -// sound_stream_update_legacy - implementation -// that should be overridden by legacy devices -//------------------------------------------------- - -void device_sound_interface::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - throw emu_fatalerror("sound_stream_update_legacy called but not overridden by owning class"); -} - - -//------------------------------------------------- // sound_stream_update - default implementation // that should be overridden //------------------------------------------------- diff --git a/src/emu/disound.h b/src/emu/disound.h index db6456dfc9a..2e4546da52c 100644 --- a/src/emu/disound.h +++ b/src/emu/disound.h @@ -77,11 +77,9 @@ public: device_sound_interface &reset_routes() { m_route_list.clear(); return *this; } // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); // stream creation - sound_stream *stream_alloc_legacy(int inputs, int outputs, int sample_rate); sound_stream *stream_alloc(int inputs, int outputs, int sample_rate); sound_stream *stream_alloc(int inputs, int outputs, int sample_rate, sound_stream_flags flags); diff --git a/src/emu/emucore.h b/src/emu/emucore.h index b03612512cd..5a2446637c8 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -85,9 +85,6 @@ typedef void genf(void); // pen_t is used to represent pixel values in bitmaps typedef u32 pen_t; -// stream_sample_t is used to represent a single sample in a sound stream -typedef s32 stream_sample_t; - //************************************************************************** diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 46123a02b3f..817ae6e14cc 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -483,7 +483,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo // finally fill out the new info primlist.add_reference(scaled->bitmap); - texinfo.base = &scaled->bitmap->pix32(0); + texinfo.base = &scaled->bitmap->pix(0); texinfo.rowpixels = scaled->bitmap->rowpixels(); texinfo.width = dwidth; texinfo.height = dheight; @@ -718,8 +718,8 @@ void render_container::overlay_scale(bitmap_argb32 &dest, bitmap_argb32 &source, // simply replicate the source bitmap over the target for (int y = 0; y < dest.height(); y++) { - u32 *src = &source.pix32(y % source.height()); - u32 *dst = &dest.pix32(y); + u32 const *const src = &source.pix(y % source.height()); + u32 *dst = &dest.pix(y); int sx = 0; // loop over columns diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index 7b69a6e97e5..13249a083fc 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -664,7 +664,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight; - u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; + u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix(desty, 0) : nullptr; { for (int x = 0; x < gl.bmwidth; x++) { @@ -723,7 +723,7 @@ void render_font::char_expand(char32_t chnum, glyph &gl) for (int y = 0; y < gl.bmheight; ++y) { int const desty(y + m_height + m_yoffs - gl.yoffs - gl.bmheight); - u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix32(desty) : nullptr); + u32 *dest(((0 <= desty) && (m_height > desty)) ? &gl.bitmap.pix(desty) : nullptr); if (m_format == format::TEXT) { @@ -1531,7 +1531,7 @@ bool render_font::save_cached(const char *filename, u64 length, u32 hash) for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight; - const u32 *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; + u32 const *const src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix(desty) : nullptr; for (int x = 0; x < gl.bmwidth; x++) { if (src != nullptr && rgb_t(src[x]).a() != 0) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 46502185e29..de64a98bf30 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -1432,7 +1432,7 @@ private: m_bitmap.fill(0); for (int step = 0; step < 100; step += 25) for (int line = 0; line < 100; line++) - m_bitmap.pix32((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); + m_bitmap.pix((step + line) % 100, line % 100) = rgb_t(0xff,0xff,0xff,0xff); // log an error if (m_alphafile.empty()) @@ -2437,8 +2437,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < dest.width(); x++) { int effx = x; @@ -2484,8 +2484,8 @@ protected: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -2597,8 +2597,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap2.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap2.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < ourwidth/num_shown; x++) { int effx = basex + x; @@ -2645,8 +2645,8 @@ private: if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = basex + curx + x; @@ -3109,8 +3109,8 @@ void layout_element::component::draw_text( int effy = bounds.top() + y; if (effy >= bounds.top() && effy <= bounds.bottom()) { - u32 *src = &tempbitmap.pix32(y); - u32 *d = &dest.pix32(effy); + u32 const *const src = &tempbitmap.pix(y); + u32 *const d = &dest.pix(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.left(); @@ -3149,8 +3149,8 @@ void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest // loop over the width of the segment for (int y = 0; y < width / 2; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); int ty = (y < width / 8) ? width / 8 : y; // loop over the length of the segment @@ -3182,8 +3182,8 @@ void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, // loop over the width of the segment for (int x = 0; x < width / 2; x++) { - u32 *d0 = &dest.pix32(0, midx - x); - u32 *d1 = &dest.pix32(0, midx + x); + u32 *const d0 = &dest.pix(0, midx - x); + u32 *const d1 = &dest.pix(0, midx + x); int tx = (x < width / 8) ? width / 8 : x; // loop over the length of the segment @@ -3219,7 +3219,7 @@ void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy - width - step; y < maxy - step; y++) @@ -3244,7 +3244,7 @@ void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = miny + step; y < miny + step + width; y++) @@ -3267,8 +3267,8 @@ void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int mi // iterate over y for (u32 y = 0; y <= width; y++) { - u32 *d0 = &dest.pix32(midy - y); - u32 *d1 = &dest.pix32(midy + y); + u32 *const d0 = &dest.pix(midy - y); + u32 *const d1 = &dest.pix(midy + y); float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); s32 left, right; @@ -3296,7 +3296,7 @@ void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx // draw line for (int x = minx; x < maxx; x++) { - u32 *d = &dest.pix32(0, x); + u32 *const d = &dest.pix(0, x); int step = (x - minx) * ratio; for (int y = maxy; y < maxy - width - step; y--) @@ -3313,7 +3313,7 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) { for (int y = 0; y < dest.height(); y++) { - u32 *destrow = &dest.pix32(y); + u32 *const destrow = &dest.pix(y); int offs = skewwidth * (dest.height() - y) / dest.height(); for (int x = dest.width() - skewwidth - 1; x >= 0; x--) destrow[x + offs] = destrow[x]; diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index f3e4950f598..18755ffb340 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -42,7 +42,7 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, return; /* adjust the source base */ - const u32 *sbase = &source.pix32(0); + const u32 *sbase = &source.pix(0); /* determine the steppings */ u32 swidth = source.width(); @@ -599,11 +599,11 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname if (s == 1) for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i], buffer[0][i], buffer[0][i]); else if (s == 3) for (int i = 0; i < w; ++i) - bitmap.pix32(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); + bitmap.pix(j, i) = rgb_t(0xFF, buffer[0][i * s], buffer[0][i * s + 1], buffer[0][i * s + 2]); else { osd_printf_error("Cannot read JPEG data from %s file.\n", fname); @@ -726,7 +726,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(png.palette[*src * 3], png.palette[*src * 3 + 1], png.palette[*src * 3 + 2]).brightness()); accumalpha &= alpha; @@ -741,7 +741,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, ++src) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -755,7 +755,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 2) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); accumalpha &= *src; dest = rgb_t(*src, pixel.r(), pixel.g(), pixel.b()); @@ -769,7 +769,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 3) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; @@ -784,7 +784,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info &png) { for (u32 x = 0; width > x; ++x, src += 4) { - bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix32(y_trans(y), x_trans(x)) : bitmap.pix32(y, x)); + bitmap_argb32::pixel_t &dest(png.interlace_method ? bitmap.pix(y_trans(y), x_trans(x)) : bitmap.pix(y, x)); rgb_t const pixel(dest); u8 const alpha(rgb_t(src[0], src[1], src[2]).brightness()); accumalpha &= alpha; diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 8c6e69c0059..cacd16d5982 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -1730,9 +1730,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; - u16 *dst = &curbitmap.as_ind16().pix16(y); - const u16 *src = &srcbitmap.pix16(0); + const bitmap_ind16 &srcbitmap = *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y]; + u16 *dst = &curbitmap.as_ind16().pix(y); + const u16 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < m_scan_widths[y]; x += dx) { @@ -1746,9 +1746,9 @@ void screen_device::create_composited_bitmap() { for (int y = 0; y < dstheight; y++) { - bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; - u32 *dst = &curbitmap.as_rgb32().pix32(y); - const u32 *src = &srcbitmap.pix32(0); + const bitmap_rgb32 &srcbitmap = *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y]; + u32 *dst = &curbitmap.as_rgb32().pix(y); + const u32 *src = &srcbitmap.pix(0); const int dx = (m_scan_widths[y] << 15) / dstwidth; for (int x = 0; x < dstwidth << 15; x += dx) { @@ -1837,10 +1837,10 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); - u64 *dst = &m_burnin.pix64(y); - const u16 *src = &srcbitmap.pix16(per_scanline ? 0 : (srcy >> 16)); - const rgb_t *palette = m_palette->palette()->entry_list_adjusted(); + const bitmap_ind16 &srcbitmap = per_scanline ? *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_ind16(); + u64 *const dst = &m_burnin.pix(y); + u16 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); + rgb_t const *const palette = m_palette->palette()->entry_list_adjusted(); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = palette[src[srcx >> 16]]; @@ -1855,9 +1855,9 @@ void screen_device::update_burnin() // iterate over rows in the destination for (int y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); - u64 *dst = &m_burnin.pix64(y); - const u32 *src = &srcbitmap.pix32(per_scanline ? 0 : (srcy >> 16)); + const bitmap_rgb32 &srcbitmap = per_scanline ? *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][y] : curbitmap.as_rgb32(); + u64 *const dst = &m_burnin.pix(y); + u32 const *const src = &srcbitmap.pix(per_scanline ? 0 : (srcy >> 16)); for (int x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -1900,7 +1900,7 @@ void screen_device::finalize_burnin() u64 maxval = 0; for (int y = 0; y < srcheight; y++) { - u64 *src = &m_burnin.pix64(y); + u64 const *const src = &m_burnin.pix(y); for (int x = 0; x < srcwidth; x++) { minval = std::min(minval, src[x]); @@ -1914,8 +1914,8 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - u64 *src = &m_burnin.pix64(srcy >> 16); - u32 *dst = &finalmap.pix32(y); + u64 const *const src = &m_burnin.pix(srcy >> 16); + u32 *const dst = &finalmap.pix(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { int brightness = u64(maxval - src[srcx >> 16]) * 255 / (maxval - minval); diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 1c33166524f..8063db03959 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -578,12 +578,10 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output m_resampling_disabled((flags & STREAM_DISABLE_INPUT_RESAMPLING) != 0), m_sync_timer(nullptr), m_input(inputs), - m_input_array(inputs), m_input_view(inputs), m_empty_buffer(100), m_output_base(output_base), m_output(outputs), - m_output_array(outputs), m_output_view(outputs) { sound_assert(outputs > 0); @@ -628,21 +626,7 @@ sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output //------------------------------------------------- -// sound_stream - constructor with old-style -// callback -//------------------------------------------------- - -sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags) : - sound_stream(device, inputs, outputs, output_base, sample_rate, flags) -{ - m_callback = std::move(callback); - m_callback_ex = stream_update_delegate(&sound_stream::stream_update_legacy, this); -} - - -//------------------------------------------------- -// sound_stream - constructor with new-style -// callback +// sound_stream - constructor //------------------------------------------------- sound_stream::sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags) : @@ -847,7 +831,7 @@ void sound_stream::apply_sample_rate_changes(u32 updatenum, u32 downstream_rate) #if (SOUND_DEBUG) void sound_stream::print_graph_recursive(int indent, int index) { - osd_printf_info("%c %*s%s Ch.%d @ %d\n", m_callback.isnull() ? ' ' : '!', indent, "", name().c_str(), index + m_output_base, sample_rate()); + osd_printf_info("%*s%s Ch.%d @ %d\n", indent, "", name().c_str(), index + m_output_base, sample_rate()); for (int index = 0; index < m_input.size(); index++) if (m_input[index].valid()) { @@ -924,57 +908,6 @@ void sound_stream::sync_update(void *, s32) //------------------------------------------------- -// stream_update_legacy - new-style callback which -// forwards on to the old-style traditional -// callback, converting to/from floats -//------------------------------------------------- - -void sound_stream::stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) -{ - // temporary buffer to hold stream_sample_t inputs and outputs - stream_sample_t temp_buffer[1024]; - int chunksize = ARRAY_LENGTH(temp_buffer) / (inputs.size() + outputs.size()); - int chunknum = 0; - - // create the arrays to pass to the callback - stream_sample_t **inputptr = m_input.empty() ? nullptr : &m_input_array[0]; - stream_sample_t **outputptr = &m_output_array[0]; - for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++) - inputptr[inputnum] = &temp_buffer[chunksize * chunknum++]; - for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) - outputptr[outputnum] = &temp_buffer[chunksize * chunknum++]; - - // loop until all chunks done - for (int baseindex = 0; baseindex < outputs[0].samples(); baseindex += chunksize) - { - // determine the number of samples to process this time - int cursamples = outputs[0].samples() - baseindex; - if (cursamples > chunksize) - cursamples = chunksize; - - // copy in the input data - for (unsigned int inputnum = 0; inputnum < inputs.size(); inputnum++) - { - stream_sample_t *dest = inputptr[inputnum]; - for (int index = 0; index < cursamples; index++) - dest[index] = stream_sample_t(inputs[inputnum].get(baseindex + index) * stream_buffer::sample_t(32768.0)); - } - - // run the callback - m_callback(*this, inputptr, outputptr, cursamples); - - // copy out the output data - for (unsigned int outputnum = 0; outputnum < m_output.size(); outputnum++) - { - stream_sample_t *src = outputptr[outputnum]; - for (int index = 0; index < cursamples; index++) - outputs[outputnum].put(baseindex + index, stream_buffer::sample_t(src[index]) * stream_buffer::sample_t(1.0 / 32768.0)); - } - } -} - - -//------------------------------------------------- // empty_view - return an empty view covering the // given time period as a substitute for invalid // inputs @@ -1200,23 +1133,6 @@ sound_manager::~sound_manager() //------------------------------------------------- -// stream_alloc_legacy - allocate a new stream -//------------------------------------------------- - -sound_stream *sound_manager::stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback) -{ - // determine output base - u32 output_base = 0; - for (auto &stream : m_stream_list) - if (&stream->device() == &device) - output_base += stream->output_count(); - - m_stream_list.push_back(std::make_unique<sound_stream>(device, inputs, outputs, output_base, sample_rate, callback)); - return m_stream_list.back().get(); -} - - -//------------------------------------------------- // stream_alloc - allocate a new stream with the // new-style callback and flags //------------------------------------------------- diff --git a/src/emu/sound.h b/src/emu/sound.h index f592c0f9f3c..25944847565 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -576,10 +576,7 @@ private: }; -// ======================> stream_update_legacy_delegate/stream_update_delegate - -// old-style callback; eventually should be deprecated -using stream_update_legacy_delegate = delegate<void (sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples)>; +// ======================> stream_update_delegate // new-style callback using stream_update_delegate = delegate<void (sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)>; @@ -614,7 +611,6 @@ class sound_stream public: // construction/destruction - sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_legacy_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS); sound_stream(device_t &device, u32 inputs, u32 outputs, u32 output_base, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags = STREAM_DEFAULT_FLAGS); virtual ~sound_stream(); @@ -680,9 +676,6 @@ private: // timer callback for synchronous streams void sync_update(void *, s32); - // new callback which wrapps calls through to the old-style callbacks - void stream_update_legacy(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs); - // return a view of 0 data covering the given time period read_stream_view empty_view(attotime start, attotime end); @@ -702,7 +695,6 @@ private: // input information std::vector<sound_stream_input> m_input; // list of streams we directly depend upon - std::vector<stream_sample_t *> m_input_array; // array of inputs for passing to the callback std::vector<read_stream_view> m_input_view; // array of output views for passing to the callback std::vector<std::unique_ptr<sound_stream>> m_resampler_list; // internal list of resamplers stream_buffer m_empty_buffer; // empty buffer for invalid inputs @@ -710,12 +702,10 @@ private: // output information u32 m_output_base; // base index of our outputs, relative to our device std::vector<sound_stream_output> m_output; // list of streams which directly depend upon us - std::vector<stream_sample_t *> m_output_array; // array of outputs for passing to the callback std::vector<write_stream_view> m_output_view; // array of output views for passing to the callback // callback information - stream_update_legacy_delegate m_callback; // callback function - stream_update_delegate m_callback_ex; // extended callback function + stream_update_delegate m_callback_ex; // extended callback function }; @@ -774,9 +764,6 @@ public: int sample_count() const { return m_samples_this_update; } int unique_id() { return m_unique_id++; } - // allocate a new stream with the old-style callback - sound_stream *stream_alloc_legacy(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_legacy_delegate callback); - // allocate a new stream with a new-style callback sound_stream *stream_alloc(device_t &device, u32 inputs, u32 outputs, u32 sample_rate, stream_update_delegate callback, sound_stream_flags flags); diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index fab04e8f162..4252b9259a2 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -860,8 +860,8 @@ u8 tilemap_t::tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 u8 andmask = ~0, ormask = 0; for (u16 ty = 0; ty < m_tileheight; ty++) { - u16 *pixptr = &m_pixmap.pix16(y0, x0); - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u16 *pixptr = &m_pixmap.pix(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); // pre-advance to the next row y0 += dy0; @@ -913,7 +913,7 @@ u8 tilemap_t::tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category for (u16 ty = 0; ty < m_tileheight; ty++) { // pre-advance to the next row - u8 *flagsptr = &m_flagsmap.pix8(y0, x0); + u8 *flagsptr = &m_flagsmap.pix(y0, x0); y0 += dy0; // anywhere the bitmask is 0 should be transparent @@ -1182,7 +1182,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // look up priority and destination base addresses for y1 bitmap_ind8 &priority_bitmap = *blit.priority; - u8 *priority_baseaddr = &priority_bitmap.pix8(y1, xpos); + u8 *priority_baseaddr = &priority_bitmap.pix(y1, xpos); typename _BitmapClass::pixel_t *dest_baseaddr = nullptr; int dest_rowpixels = 0; if (dest.valid()) @@ -1198,8 +1198,8 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b y2 -= ypos; // get tilemap pixels - const u16 *source_baseaddr = &m_pixmap.pix16(y1); - const u8 *mask_baseaddr = &m_flagsmap.pix8(y1); + const u16 *source_baseaddr = &m_pixmap.pix(y1); + const u8 *mask_baseaddr = &m_flagsmap.pix(y1); // get start/stop columns, rounding outward int mincol = x1 / m_tilewidth; @@ -1396,9 +1396,9 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c u32 cy = starty >> 16; // get source and priority pointers - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; - const u16 *src = &m_pixmap.pix16(cy); - const u8 *maskptr = &m_flagsmap.pix8(cy); + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; + const u16 *src = &m_pixmap.pix(cy); + const u8 *maskptr = &m_flagsmap.pix(cy); typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); // loop over columns @@ -1440,15 +1440,15 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we match the mask - if ((m_flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((m_flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + ROZ_PLOT_PIXEL(m_pixmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } @@ -1482,16 +1482,16 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix8(sy, sx) : nullptr; + u8 *pri = (priority != 0xff00) ? &priority_bitmap.pix(sy, sx) : nullptr; // loop over columns while (x <= ex) { // plot if we're within the bitmap and we match the mask if (cx < widthshifted && cy < heightshifted) - if ((m_flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((m_flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - ROZ_PLOT_PIXEL(m_pixmap.pix16(cy >> 16, cx >> 16)); + ROZ_PLOT_PIXEL(m_pixmap.pix(cy >> 16, cx >> 16)); if (priority != 0xff00) *pri = (*pri & (priority >> 8)) | priority; } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index e28e6aa1bae..6f88d9ae03d 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -1075,9 +1075,9 @@ void video_manager::create_snapshot_bitmap(screen_device *screen) render_primitive_list &primlist = m_snap_target->get_primitives(); primlist.acquire_lock(); if (machine().options().snap_bilinear()) - snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer_bilinear::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); else - snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix32(0), width, height, m_snap_bitmap.rowpixels()); + snap_renderer::draw_primitives(primlist, &m_snap_bitmap.pix(0), width, height, m_snap_bitmap.rowpixels()); primlist.release_lock(); } diff --git a/src/frontend/mame/ui/selmenu.cpp b/src/frontend/mame/ui/selmenu.cpp index 92bdd3ada64..cfcb6175dc5 100644 --- a/src/frontend/mame/ui/selmenu.cpp +++ b/src/frontend/mame/ui/selmenu.cpp @@ -392,9 +392,9 @@ menu_select_launch::cache::cache(running_machine &machine) // create a texture for snapshot m_snapx_texture.reset(render.texture_alloc(render_texture::hq_scale)); - std::memcpy(&m_no_avail_bitmap.pix32(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t)); + std::memcpy(&m_no_avail_bitmap.pix(0), no_avail_bmp, 256 * 256 * sizeof(uint32_t)); - std::memcpy(&m_star_bitmap.pix32(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_star_bitmap.pix(0), favorite_star_bmp, 32 * 32 * sizeof(uint32_t)); m_star_texture.reset(render.texture_alloc()); m_star_texture->set_bitmap(m_star_bitmap, m_star_bitmap.cliprect(), TEXFORMAT_ARGB32); @@ -410,7 +410,7 @@ menu_select_launch::cache::cache(running_machine &machine) m_toolbar_texture.emplace_back(render.texture_alloc(), render); m_sw_toolbar_texture.emplace_back(render.texture_alloc(), render); - std::memcpy(&m_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_toolbar_bitmap.back().pix(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); if (m_toolbar_bitmap.back().valid()) m_toolbar_texture.back()->set_bitmap(m_toolbar_bitmap.back(), m_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32); else @@ -418,7 +418,7 @@ menu_select_launch::cache::cache(running_machine &machine) if ((i == 0U) || (i == 2U)) { - std::memcpy(&m_sw_toolbar_bitmap.back().pix32(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); + std::memcpy(&m_sw_toolbar_bitmap.back().pix(0), toolbar_bitmap_bmp[i], 32 * 32 * sizeof(uint32_t)); if (m_sw_toolbar_bitmap.back().valid()) m_sw_toolbar_texture.back()->set_bitmap(m_sw_toolbar_bitmap.back(), m_sw_toolbar_bitmap.back().cliprect(), TEXFORMAT_ARGB32); else @@ -1147,7 +1147,7 @@ bool menu_select_launch::scale_icon(bitmap_argb32 &&src, texture_and_bitmap &dst dst.bitmap.allocate(max_width, max_height); for (int y = 0; tmp.height() > y; ++y) for (int x = 0; tmp.width() > x; ++x) - dst.bitmap.pix32(y, x) = tmp.pix32(y, x); + dst.bitmap.pix(y, x) = tmp.pix(y, x); dst.texture->set_bitmap(dst.bitmap, dst.bitmap.cliprect(), TEXFORMAT_ARGB32); return true; } @@ -2412,7 +2412,7 @@ void menu_select_launch::arts_render_images(bitmap_argb32 &&tmp_bitmap, float or for (int x = 0; x < 256; x++) { for (int y = 0; y < 256; y++) - tmp_bitmap.pix32(y, x) = src.pix32(y, x); + tmp_bitmap.pix(y, x) = src.pix(y, x); } no_available = true; } @@ -2475,7 +2475,7 @@ void menu_select_launch::arts_render_images(bitmap_argb32 &&tmp_bitmap, float or for (int x = 0; x < dest_xPixel; x++) for (int y = 0; y < dest_yPixel; y++) - snapx_bitmap.pix32(y + y1, x + x1) = dest_bitmap.pix32(y, x); + snapx_bitmap.pix(y + y1, x + x1) = dest_bitmap.pix(y, x); // apply bitmap m_cache->snapx_texture()->set_bitmap(snapx_bitmap, snapx_bitmap.cliprect(), TEXFORMAT_ARGB32); diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index ff16d117117..c229110caac 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -216,7 +216,7 @@ void mame_ui_manager::init() config_save_delegate(&mame_ui_manager::config_save, this)); // create mouse bitmap - uint32_t *dst = &m_mouse_bitmap.pix32(0); + uint32_t *dst = &m_mouse_bitmap.pix(0); memcpy(dst,mouse_bitmap,32*32*sizeof(uint32_t)); m_mouse_arrow_texture = machine().render().texture_alloc(); m_mouse_arrow_texture->set_bitmap(m_mouse_bitmap, m_mouse_bitmap.cliprect(), TEXFORMAT_ARGB32); diff --git a/src/frontend/mame/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp index 5b4d187bc95..bc6dee9cd47 100644 --- a/src/frontend/mame/ui/viewgfx.cpp +++ b/src/frontend/mame/ui/viewgfx.cpp @@ -994,18 +994,16 @@ static void gfxset_draw_item(running_machine &machine, gfx_element &gfx, int ind { int width = (rotate & ORIENTATION_SWAP_XY) ? gfx.height() : gfx.width(); int height = (rotate & ORIENTATION_SWAP_XY) ? gfx.width() : gfx.height(); - const rgb_t *palette = dpalette->palette()->entry_list_raw() + gfx.colorbase() + color * gfx.granularity(); - - int x, y; + rgb_t const *const palette = dpalette->palette()->entry_list_raw() + gfx.colorbase() + color * gfx.granularity(); // loop over rows in the cell - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { - uint32_t *dest = &bitmap.pix32(dsty + y, dstx); + uint32_t *dest = &bitmap.pix(dsty + y, dstx); const uint8_t *src = gfx.get_data(index); // loop over columns in the cell - for (x = 0; x < width; x++) + for (int x = 0; x < width; x++) { int effx = x, effy = y; const uint8_t *s; diff --git a/src/frontend/mame/ui/widgets.cpp b/src/frontend/mame/ui/widgets.cpp index d8907303b36..59fda0f203c 100644 --- a/src/frontend/mame/ui/widgets.cpp +++ b/src/frontend/mame/ui/widgets.cpp @@ -36,7 +36,7 @@ widgets_manager::widgets_manager(running_machine &machine) for (unsigned x = 0; x < 256; ++x) { unsigned const alpha((x < 25) ? (0xff * x / 25) : (x >(256 - 25)) ? (0xff * (255 - x) / 25) : 0xff); - m_hilight_bitmap->pix32(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); + m_hilight_bitmap->pix(0, x) = rgb_t(alpha, 0xff, 0xff, 0xff); } m_hilight_texture.reset(render.texture_alloc()); m_hilight_texture->set_bitmap(*m_hilight_bitmap, m_hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -49,7 +49,7 @@ widgets_manager::widgets_manager(running_machine &machine) unsigned const r = r1 + (y * (r2 - r1) / 128); unsigned const g = g1 + (y * (g2 - g1) / 128); unsigned const b = b1 + (y * (b2 - b1) / 128); - m_hilight_main_bitmap->pix32(y, 0) = rgb_t(r, g, b); + m_hilight_main_bitmap->pix(y, 0) = rgb_t(r, g, b); } m_hilight_main_texture.reset(render.texture_alloc()); m_hilight_main_texture->set_bitmap(*m_hilight_main_bitmap, m_hilight_main_bitmap->cliprect(), TEXFORMAT_ARGB32); @@ -67,18 +67,17 @@ widgets_manager::widgets_manager(running_machine &machine) void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) { - int halfwidth = dest.width() / 2; - int height = dest.height(); - int x, y; + int const halfwidth = dest.width() / 2; + int const height = dest.height(); // start with all-transparent dest.fill(rgb_t(0x00, 0x00, 0x00, 0x00)); // render from the tip to the bottom - for (y = 0; y < height; y++) + for (int y = 0; y < height; y++) { int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height; - uint32_t *target = &dest.pix32(y, halfwidth); + uint32_t *const target = &dest.pix(y, halfwidth); // don't antialias if height < 12 if (dest.height() < 12) @@ -89,25 +88,23 @@ void widgets_manager::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source } // loop while we still have data to generate - for (x = 0; linewidth > 0; x++) + for (int x = 0; linewidth > 0; x++) { int dalpha; - - // first column we only consume one pixel if (x == 0) { + // first column we only consume one pixel dalpha = std::min(0xff, linewidth); target[x] = rgb_t(dalpha, 0xff, 0xff, 0xff); } - - // remaining columns consume two pixels, one on each side else { + // remaining columns consume two pixels, one on each side dalpha = std::min(0x1fe, linewidth); target[x] = target[-x] = rgb_t(dalpha / 2, 0xff, 0xff, 0xff); } - // account for the weight we consumed */ + // account for the weight we consumed linewidth -= dalpha; } } diff --git a/src/lib/netlist/core/netlist_state.h b/src/lib/netlist/core/netlist_state.h index 8f24fb09d94..dc9888579f5 100644 --- a/src/lib/netlist/core/netlist_state.h +++ b/src/lib/netlist/core/netlist_state.h @@ -217,24 +217,6 @@ namespace netlist device_arena &pool() noexcept { return m_pool; } const device_arena &pool() const noexcept { return m_pool; } - /// \brief set extended validation mode. - /// - /// The extended validation mode is not intended for running. - /// The intention is to identify power pins which are not properly - /// connected. The downside is that this mode creates a netlist which - /// is different (and not able to run). - /// - /// Extended validation is supported by nltool validate option. - /// - /// \param val Boolean value enabling/disabling extended validation mode - void set_extended_validation(bool val) { m_extended_validation = val; } - - /// \brief State of extended validation mode. - /// - /// \returns boolean value indicating if extended validation mode is - /// turned on. - bool is_extended_validation() const { return m_extended_validation; } - struct stats_info { const detail::queue_t &m_queue;// performance @@ -263,7 +245,7 @@ namespace netlist plib::state_manager_t m_state; log_type m_log; - // FIXME: should only be available during device construcion + // FIXME: should only be available during device construction host_arena::unique_ptr<setup_t> m_setup; nets_collection_type m_nets; @@ -271,8 +253,6 @@ namespace netlist devices_collection_type m_devices; // sole use is to manage lifetime of family objects family_collection_type m_family_cache; - bool m_extended_validation; - // dummy version int m_dummy_version; }; diff --git a/src/lib/netlist/devices/nlid_proxy.cpp b/src/lib/netlist/devices/nlid_proxy.cpp index fb93d642a79..e8cc27fc987 100644 --- a/src/lib/netlist/devices/nlid_proxy.cpp +++ b/src/lib/netlist/devices/nlid_proxy.cpp @@ -124,19 +124,9 @@ namespace netlist { register_subalias("Q", "RN.1"); - log().verbose("D/A Proxy: Found power terminals on device {1}", out_proxied->device().name()); - if (anetlist.is_extended_validation()) - { - // During validation, don't connect to terminals found - // This will cause terminals not connected to a rail net to - // fail connection stage. - connect(m_RN.N(), m_RP.P()); - } - else - { - connect(m_RN.N(), *m_tn); - connect(m_RP.P(), *m_tp); - } + connect(m_RN.N(), *m_tn); + connect(m_RP.P(), *m_tp); + connect(m_RN.P(), m_RP.N()); } diff --git a/src/lib/netlist/generated/static_solvers.cpp b/src/lib/netlist/generated/static_solvers.cpp index f945088b84c..3dfe1def465 100644 --- a/src/lib/netlist/generated/static_solvers.cpp +++ b/src/lib/netlist/generated/static_solvers.cpp @@ -393,6 +393,1021 @@ static void nl_gcr_1250f340dea396ae_22_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } +// astrob +static void nl_gcr_13833bf8c127deaa_154_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + double m_A27(0.0); + double m_A28(0.0); + double m_A29(0.0); + double m_A30(0.0); + double m_A31(0.0); + double m_A32(0.0); + double m_A33(0.0); + double m_A34(0.0); + double m_A35(0.0); + double m_A36(0.0); + double m_A37(0.0); + double m_A38(0.0); + double m_A39(0.0); + double m_A40(0.0); + double m_A41(0.0); + double m_A42(0.0); + double m_A43(0.0); + double m_A44(0.0); + double m_A45(0.0); + double m_A46(0.0); + double m_A47(0.0); + double m_A48(0.0); + double m_A49(0.0); + double m_A50(0.0); + double m_A51(0.0); + double m_A52(0.0); + double m_A53(0.0); + double m_A54(0.0); + double m_A55(0.0); + double m_A56(0.0); + double m_A57(0.0); + double m_A58(0.0); + double m_A59(0.0); + double m_A60(0.0); + double m_A61(0.0); + double m_A62(0.0); + double m_A63(0.0); + double m_A64(0.0); + double m_A65(0.0); + double m_A66(0.0); + double m_A67(0.0); + double m_A68(0.0); + double m_A69(0.0); + double m_A70(0.0); + double m_A71(0.0); + double m_A72(0.0); + double m_A73(0.0); + double m_A74(0.0); + double m_A75(0.0); + double m_A76(0.0); + double m_A77(0.0); + double m_A78(0.0); + double m_A79(0.0); + double m_A80(0.0); + double m_A81(0.0); + double m_A82(0.0); + double m_A83(0.0); + double m_A84(0.0); + double m_A85(0.0); + double m_A86(0.0); + double m_A87(0.0); + double m_A88(0.0); + double m_A89(0.0); + double m_A90(0.0); + double m_A91(0.0); + double m_A92(0.0); + double m_A93(0.0); + double m_A94(0.0); + double m_A95(0.0); + double m_A96(0.0); + double m_A97(0.0); + double m_A98(0.0); + double m_A99(0.0); + double m_A100(0.0); + double m_A101(0.0); + double m_A102(0.0); + double m_A103(0.0); + double m_A104(0.0); + double m_A105(0.0); + double m_A106(0.0); + double m_A107(0.0); + double m_A108(0.0); + double m_A109(0.0); + double m_A110(0.0); + double m_A111(0.0); + double m_A112(0.0); + double m_A113(0.0); + double m_A114(0.0); + double m_A115(0.0); + double m_A116(0.0); + double m_A117(0.0); + double m_A118(0.0); + double m_A119(0.0); + double m_A120(0.0); + double m_A121(0.0); + double m_A122(0.0); + double m_A123(0.0); + double m_A124(0.0); + double m_A125(0.0); + double m_A126(0.0); + double m_A127(0.0); + double m_A128(0.0); + double m_A129(0.0); + double m_A130(0.0); + double m_A131(0.0); + double m_A132(0.0); + double m_A133(0.0); + double m_A134(0.0); + double m_A135(0.0); + double m_A136(0.0); + double m_A137(0.0); + double m_A138(0.0); + double m_A139(0.0); + double m_A140(0.0); + double m_A141(0.0); + double m_A142(0.0); + double m_A143(0.0); + double m_A144(0.0); + double m_A145(0.0); + double m_A146(0.0); + double m_A147(0.0); + double m_A148(0.0); + double m_A149(0.0); + double m_A150(0.0); + double m_A151(0.0); + double m_A152(0.0); + double m_A153(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 -= go[1] * *cnV[1]; + m_A2 += gt[2]; + m_A2 += gt[3]; + m_A3 += go[2]; + double RHS1 = Idr[2]; + RHS1 += Idr[3]; + RHS1 -= go[3] * *cnV[3]; + m_A4 += gt[4]; + m_A4 += gt[5]; + m_A5 += go[4]; + double RHS2 = Idr[4]; + RHS2 += Idr[5]; + RHS2 -= go[5] * *cnV[5]; + m_A6 += gt[6]; + m_A6 += gt[7]; + m_A7 += go[6]; + double RHS3 = Idr[6]; + RHS3 += Idr[7]; + RHS3 -= go[7] * *cnV[7]; + m_A8 += gt[8]; + m_A8 += gt[9]; + m_A9 += go[8]; + m_A10 += go[9]; + double RHS4 = Idr[8]; + RHS4 += Idr[9]; + m_A11 += gt[10]; + m_A11 += gt[11]; + m_A11 += gt[12]; + m_A12 += go[10]; + double RHS5 = Idr[10]; + RHS5 += Idr[11]; + RHS5 += Idr[12]; + RHS5 -= go[11] * *cnV[11]; + RHS5 -= go[12] * *cnV[12]; + m_A13 += gt[13]; + m_A13 += gt[14]; + m_A13 += gt[15]; + m_A13 += gt[16]; + m_A14 += go[13]; + m_A14 += go[14]; + m_A15 += go[15]; + double RHS6 = Idr[13]; + RHS6 += Idr[14]; + RHS6 += Idr[15]; + RHS6 += Idr[16]; + RHS6 -= go[16] * *cnV[16]; + m_A16 += gt[17]; + m_A16 += gt[18]; + m_A16 += gt[19]; + m_A16 += gt[20]; + m_A16 += gt[21]; + m_A16 += gt[22]; + m_A18 += go[17]; + m_A17 += go[18]; + double RHS7 = Idr[17]; + RHS7 += Idr[18]; + RHS7 += Idr[19]; + RHS7 += Idr[20]; + RHS7 += Idr[21]; + RHS7 += Idr[22]; + RHS7 -= go[19] * *cnV[19]; + RHS7 -= go[20] * *cnV[20]; + RHS7 -= go[21] * *cnV[21]; + RHS7 -= go[22] * *cnV[22]; + m_A19 += gt[23]; + m_A19 += gt[24]; + m_A19 += gt[25]; + m_A20 += go[23]; + double RHS8 = Idr[23]; + RHS8 += Idr[24]; + RHS8 += Idr[25]; + RHS8 -= go[24] * *cnV[24]; + RHS8 -= go[25] * *cnV[25]; + m_A21 += gt[26]; + m_A21 += gt[27]; + m_A21 += gt[28]; + m_A22 += go[26]; + double RHS9 = Idr[26]; + RHS9 += Idr[27]; + RHS9 += Idr[28]; + RHS9 -= go[27] * *cnV[27]; + RHS9 -= go[28] * *cnV[28]; + m_A23 += gt[29]; + m_A23 += gt[30]; + m_A23 += gt[31]; + m_A24 += go[29]; + double RHS10 = Idr[29]; + RHS10 += Idr[30]; + RHS10 += Idr[31]; + RHS10 -= go[30] * *cnV[30]; + RHS10 -= go[31] * *cnV[31]; + m_A25 += gt[32]; + m_A25 += gt[33]; + m_A25 += gt[34]; + m_A26 += go[32]; + double RHS11 = Idr[32]; + RHS11 += Idr[33]; + RHS11 += Idr[34]; + RHS11 -= go[33] * *cnV[33]; + RHS11 -= go[34] * *cnV[34]; + m_A27 += gt[35]; + m_A27 += gt[36]; + m_A27 += gt[37]; + m_A28 += go[35]; + double RHS12 = Idr[35]; + RHS12 += Idr[36]; + RHS12 += Idr[37]; + RHS12 -= go[36] * *cnV[36]; + RHS12 -= go[37] * *cnV[37]; + m_A29 += gt[38]; + m_A29 += gt[39]; + m_A30 += go[38]; + double RHS13 = Idr[38]; + RHS13 += Idr[39]; + RHS13 -= go[39] * *cnV[39]; + m_A31 += gt[40]; + m_A31 += gt[41]; + m_A31 += gt[42]; + m_A32 += go[40]; + double RHS14 = Idr[40]; + RHS14 += Idr[41]; + RHS14 += Idr[42]; + RHS14 -= go[41] * *cnV[41]; + RHS14 -= go[42] * *cnV[42]; + m_A33 += gt[43]; + m_A33 += gt[44]; + m_A34 += go[43]; + double RHS15 = Idr[43]; + RHS15 += Idr[44]; + RHS15 -= go[44] * *cnV[44]; + m_A35 += gt[45]; + m_A35 += gt[46]; + m_A36 += go[45]; + double RHS16 = Idr[45]; + RHS16 += Idr[46]; + RHS16 -= go[46] * *cnV[46]; + m_A37 += gt[47]; + m_A37 += gt[48]; + m_A38 += go[47]; + double RHS17 = Idr[47]; + RHS17 += Idr[48]; + RHS17 -= go[48] * *cnV[48]; + m_A39 += gt[49]; + m_A39 += gt[50]; + m_A40 += go[49]; + double RHS18 = Idr[49]; + RHS18 += Idr[50]; + RHS18 -= go[50] * *cnV[50]; + m_A41 += gt[51]; + m_A41 += gt[52]; + m_A42 += go[51]; + double RHS19 = Idr[51]; + RHS19 += Idr[52]; + RHS19 -= go[52] * *cnV[52]; + m_A43 += gt[53]; + m_A43 += gt[54]; + m_A44 += go[53]; + double RHS20 = Idr[53]; + RHS20 += Idr[54]; + RHS20 -= go[54] * *cnV[54]; + m_A45 += gt[55]; + m_A45 += gt[56]; + m_A45 += gt[57]; + m_A45 += gt[58]; + m_A45 += gt[59]; + m_A46 += go[55]; + m_A48 += go[56]; + m_A47 += go[57]; + double RHS21 = Idr[55]; + RHS21 += Idr[56]; + RHS21 += Idr[57]; + RHS21 += Idr[58]; + RHS21 += Idr[59]; + RHS21 -= go[58] * *cnV[58]; + RHS21 -= go[59] * *cnV[59]; + m_A49 += gt[60]; + m_A49 += gt[61]; + m_A49 += gt[62]; + m_A50 += go[60]; + double RHS22 = Idr[60]; + RHS22 += Idr[61]; + RHS22 += Idr[62]; + RHS22 -= go[61] * *cnV[61]; + RHS22 -= go[62] * *cnV[62]; + m_A51 += gt[63]; + m_A51 += gt[64]; + m_A52 += go[63]; + double RHS23 = Idr[63]; + RHS23 += Idr[64]; + RHS23 -= go[64] * *cnV[64]; + m_A55 += gt[65]; + m_A55 += gt[66]; + m_A55 += gt[67]; + m_A55 += gt[68]; + m_A54 += go[65]; + m_A53 += go[66]; + double RHS24 = Idr[65]; + RHS24 += Idr[66]; + RHS24 += Idr[67]; + RHS24 += Idr[68]; + RHS24 -= go[67] * *cnV[67]; + RHS24 -= go[68] * *cnV[68]; + m_A57 += gt[69]; + m_A57 += gt[70]; + m_A58 += go[69]; + double RHS25 = Idr[69]; + RHS25 += Idr[70]; + RHS25 -= go[70] * *cnV[70]; + m_A59 += gt[71]; + m_A59 += gt[72]; + m_A59 += gt[73]; + m_A60 += go[71]; + double RHS26 = Idr[71]; + RHS26 += Idr[72]; + RHS26 += Idr[73]; + RHS26 -= go[72] * *cnV[72]; + RHS26 -= go[73] * *cnV[73]; + m_A61 += gt[74]; + m_A61 += gt[75]; + m_A61 += gt[76]; + m_A62 += go[74]; + double RHS27 = Idr[74]; + RHS27 += Idr[75]; + RHS27 += Idr[76]; + RHS27 -= go[75] * *cnV[75]; + RHS27 -= go[76] * *cnV[76]; + m_A63 += gt[77]; + m_A63 += gt[78]; + m_A63 += gt[79]; + m_A64 += go[77]; + double RHS28 = Idr[77]; + RHS28 += Idr[78]; + RHS28 += Idr[79]; + RHS28 -= go[78] * *cnV[78]; + RHS28 -= go[79] * *cnV[79]; + m_A65 += gt[80]; + m_A65 += gt[81]; + m_A67 += go[80]; + m_A66 += go[81]; + double RHS29 = Idr[80]; + RHS29 += Idr[81]; + m_A68 += gt[82]; + m_A68 += gt[83]; + m_A70 += go[82]; + m_A69 += go[83]; + double RHS30 = Idr[82]; + RHS30 += Idr[83]; + m_A71 += gt[84]; + m_A71 += gt[85]; + m_A73 += go[84]; + m_A72 += go[85]; + double RHS31 = Idr[84]; + RHS31 += Idr[85]; + m_A77 += gt[86]; + m_A77 += gt[87]; + m_A77 += gt[88]; + m_A77 += gt[89]; + m_A77 += gt[90]; + m_A77 += gt[91]; + m_A77 += gt[92]; + m_A74 += go[86]; + m_A75 += go[87]; + m_A75 += go[88]; + m_A78 += go[89]; + m_A78 += go[90]; + double RHS32 = Idr[86]; + RHS32 += Idr[87]; + RHS32 += Idr[88]; + RHS32 += Idr[89]; + RHS32 += Idr[90]; + RHS32 += Idr[91]; + RHS32 += Idr[92]; + RHS32 -= go[91] * *cnV[91]; + RHS32 -= go[92] * *cnV[92]; + m_A83 += gt[93]; + m_A83 += gt[94]; + m_A83 += gt[95]; + m_A83 += gt[96]; + m_A83 += gt[97]; + m_A83 += gt[98]; + m_A83 += gt[99]; + m_A83 += gt[100]; + m_A83 += gt[101]; + m_A85 += go[93]; + m_A85 += go[94]; + m_A84 += go[95]; + m_A84 += go[96]; + m_A82 += go[97]; + m_A81 += go[98]; + m_A80 += go[99]; + m_A79 += go[100]; + double RHS33 = Idr[93]; + RHS33 += Idr[94]; + RHS33 += Idr[95]; + RHS33 += Idr[96]; + RHS33 += Idr[97]; + RHS33 += Idr[98]; + RHS33 += Idr[99]; + RHS33 += Idr[100]; + RHS33 += Idr[101]; + RHS33 -= go[101] * *cnV[101]; + m_A92 += gt[102]; + m_A92 += gt[103]; + m_A92 += gt[104]; + m_A92 += gt[105]; + m_A92 += gt[106]; + m_A92 += gt[107]; + m_A91 += go[102]; + m_A90 += go[103]; + m_A89 += go[104]; + m_A88 += go[105]; + m_A87 += go[106]; + m_A86 += go[107]; + double RHS34 = Idr[102]; + RHS34 += Idr[103]; + RHS34 += Idr[104]; + RHS34 += Idr[105]; + RHS34 += Idr[106]; + RHS34 += Idr[107]; + m_A95 += gt[108]; + m_A95 += gt[109]; + m_A95 += gt[110]; + m_A95 += gt[111]; + m_A95 += gt[112]; + m_A95 += gt[113]; + m_A95 += gt[114]; + m_A97 += go[108]; + m_A94 += go[109]; + double RHS35 = Idr[108]; + RHS35 += Idr[109]; + RHS35 += Idr[110]; + RHS35 += Idr[111]; + RHS35 += Idr[112]; + RHS35 += Idr[113]; + RHS35 += Idr[114]; + RHS35 -= go[110] * *cnV[110]; + RHS35 -= go[111] * *cnV[111]; + RHS35 -= go[112] * *cnV[112]; + RHS35 -= go[113] * *cnV[113]; + RHS35 -= go[114] * *cnV[114]; + m_A99 += gt[115]; + m_A99 += gt[116]; + m_A98 += go[115]; + m_A100 += go[116]; + double RHS36 = Idr[115]; + RHS36 += Idr[116]; + m_A107 += gt[117]; + m_A107 += gt[118]; + m_A107 += gt[119]; + m_A107 += gt[120]; + m_A107 += gt[121]; + m_A107 += gt[122]; + m_A106 += go[117]; + m_A105 += go[118]; + m_A104 += go[119]; + m_A103 += go[120]; + m_A102 += go[121]; + m_A101 += go[122]; + double RHS37 = Idr[117]; + RHS37 += Idr[118]; + RHS37 += Idr[119]; + RHS37 += Idr[120]; + RHS37 += Idr[121]; + RHS37 += Idr[122]; + m_A112 += gt[123]; + m_A112 += gt[124]; + m_A112 += gt[125]; + m_A112 += gt[126]; + m_A112 += gt[127]; + m_A111 += go[123]; + m_A110 += go[124]; + m_A109 += go[125]; + double RHS38 = Idr[123]; + RHS38 += Idr[124]; + RHS38 += Idr[125]; + RHS38 += Idr[126]; + RHS38 += Idr[127]; + RHS38 -= go[126] * *cnV[126]; + RHS38 -= go[127] * *cnV[127]; + m_A118 += gt[128]; + m_A118 += gt[129]; + m_A118 += gt[130]; + m_A118 += gt[131]; + m_A118 += gt[132]; + m_A118 += gt[133]; + m_A118 += gt[134]; + m_A118 += gt[135]; + m_A118 += gt[136]; + m_A119 += go[128]; + m_A115 += go[129]; + m_A114 += go[130]; + m_A116 += go[131]; + m_A116 += go[132]; + m_A117 += go[133]; + m_A117 += go[134]; + double RHS39 = Idr[128]; + RHS39 += Idr[129]; + RHS39 += Idr[130]; + RHS39 += Idr[131]; + RHS39 += Idr[132]; + RHS39 += Idr[133]; + RHS39 += Idr[134]; + RHS39 += Idr[135]; + RHS39 += Idr[136]; + RHS39 -= go[135] * *cnV[135]; + RHS39 -= go[136] * *cnV[136]; + m_A121 += gt[137]; + m_A121 += gt[138]; + m_A120 += go[137]; + m_A122 += go[138]; + double RHS40 = Idr[137]; + RHS40 += Idr[138]; + m_A127 += gt[139]; + m_A127 += gt[140]; + m_A127 += gt[141]; + m_A127 += gt[142]; + m_A127 += gt[143]; + m_A126 += go[139]; + m_A125 += go[140]; + m_A124 += go[141]; + m_A123 += go[142]; + m_A128 += go[143]; + double RHS41 = Idr[139]; + RHS41 += Idr[140]; + RHS41 += Idr[141]; + RHS41 += Idr[142]; + RHS41 += Idr[143]; + m_A134 += gt[144]; + m_A134 += gt[145]; + m_A134 += gt[146]; + m_A134 += gt[147]; + m_A134 += gt[148]; + m_A134 += gt[149]; + m_A130 += go[144]; + m_A129 += go[145]; + m_A133 += go[146]; + m_A131 += go[147]; + m_A131 += go[148]; + double RHS42 = Idr[144]; + RHS42 += Idr[145]; + RHS42 += Idr[146]; + RHS42 += Idr[147]; + RHS42 += Idr[148]; + RHS42 += Idr[149]; + RHS42 -= go[149] * *cnV[149]; + m_A137 += gt[150]; + m_A137 += gt[151]; + m_A136 += go[150]; + m_A138 += go[151]; + double RHS43 = Idr[150]; + RHS43 += Idr[151]; + m_A153 += gt[152]; + m_A153 += gt[153]; + m_A153 += gt[154]; + m_A153 += gt[155]; + m_A153 += gt[156]; + m_A153 += gt[157]; + m_A153 += gt[158]; + m_A153 += gt[159]; + m_A152 += go[152]; + m_A140 += go[153]; + m_A141 += go[154]; + m_A142 += go[155]; + m_A149 += go[156]; + m_A145 += go[157]; + m_A150 += go[158]; + m_A139 += go[159]; + double RHS44 = Idr[152]; + RHS44 += Idr[153]; + RHS44 += Idr[154]; + RHS44 += Idr[155]; + RHS44 += Idr[156]; + RHS44 += Idr[157]; + RHS44 += Idr[158]; + RHS44 += Idr[159]; + const double f0 = 1.0 / m_A0; + const double f0_33 = -f0 * m_A79; + m_A83 += m_A1 * f0_33; + RHS33 += f0_33 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_33 = -f1 * m_A80; + m_A83 += m_A3 * f1_33; + RHS33 += f1_33 * RHS1; + const double f2 = 1.0 / m_A4; + const double f2_33 = -f2 * m_A81; + m_A83 += m_A5 * f2_33; + RHS33 += f2_33 * RHS2; + const double f3 = 1.0 / m_A6; + const double f3_33 = -f3 * m_A82; + m_A83 += m_A7 * f3_33; + RHS33 += f3_33 * RHS3; + const double f4 = 1.0 / m_A8; + const double f4_24 = -f4 * m_A53; + m_A55 += m_A9 * f4_24; + m_A56 += m_A10 * f4_24; + RHS24 += f4_24 * RHS4; + const double f4_32 = -f4 * m_A74; + m_A76 += m_A9 * f4_32; + m_A77 += m_A10 * f4_32; + RHS32 += f4_32 * RHS4; + const double f5 = 1.0 / m_A11; + const double f5_24 = -f5 * m_A54; + m_A55 += m_A12 * f5_24; + RHS24 += f5_24 * RHS5; + const double f6 = 1.0 / m_A13; + const double f6_32 = -f6 * m_A75; + m_A77 += m_A14 * f6_32; + m_A78 += m_A15 * f6_32; + RHS32 += f6_32 * RHS6; + const double f6_39 = -f6 * m_A114; + m_A116 += m_A14 * f6_39; + m_A118 += m_A15 * f6_39; + RHS39 += f6_39 * RHS6; + const double f7 = 1.0 / m_A16; + const double f7_35 = -f7 * m_A94; + m_A96 += m_A17 * f7_35; + m_A97 += m_A18 * f7_35; + RHS35 += f7_35 * RHS7; + const double f7_39 = -f7 * m_A115; + m_A118 += m_A17 * f7_39; + m_A119 += m_A18 * f7_39; + RHS39 += f7_39 * RHS7; + const double f7_42 = -f7 * m_A129; + m_A133 += m_A17 * f7_42; + m_A134 += m_A18 * f7_42; + RHS42 += f7_42 * RHS7; + const double f8 = 1.0 / m_A19; + const double f8_37 = -f8 * m_A101; + m_A107 += m_A20 * f8_37; + RHS37 += f8_37 * RHS8; + const double f9 = 1.0 / m_A21; + const double f9_37 = -f9 * m_A102; + m_A107 += m_A22 * f9_37; + RHS37 += f9_37 * RHS9; + const double f10 = 1.0 / m_A23; + const double f10_37 = -f10 * m_A103; + m_A107 += m_A24 * f10_37; + RHS37 += f10_37 * RHS10; + const double f11 = 1.0 / m_A25; + const double f11_37 = -f11 * m_A104; + m_A107 += m_A26 * f11_37; + RHS37 += f11_37 * RHS11; + const double f12 = 1.0 / m_A27; + const double f12_37 = -f12 * m_A105; + m_A107 += m_A28 * f12_37; + RHS37 += f12_37 * RHS12; + const double f13 = 1.0 / m_A29; + const double f13_38 = -f13 * m_A109; + m_A112 += m_A30 * f13_38; + RHS38 += f13_38 * RHS13; + const double f14 = 1.0 / m_A31; + const double f14_34 = -f14 * m_A86; + m_A92 += m_A32 * f14_34; + RHS34 += f14_34 * RHS14; + const double f15 = 1.0 / m_A33; + const double f15_41 = -f15 * m_A123; + m_A127 += m_A34 * f15_41; + RHS41 += f15_41 * RHS15; + const double f16 = 1.0 / m_A35; + const double f16_36 = -f16 * m_A98; + m_A99 += m_A36 * f16_36; + RHS36 += f16_36 * RHS16; + const double f17 = 1.0 / m_A37; + const double f17_40 = -f17 * m_A120; + m_A121 += m_A38 * f17_40; + RHS40 += f17_40 * RHS17; + const double f18 = 1.0 / m_A39; + const double f18_41 = -f18 * m_A124; + m_A127 += m_A40 * f18_41; + RHS41 += f18_41 * RHS18; + const double f19 = 1.0 / m_A41; + const double f19_41 = -f19 * m_A125; + m_A127 += m_A42 * f19_41; + RHS41 += f19_41 * RHS19; + const double f20 = 1.0 / m_A43; + const double f20_41 = -f20 * m_A126; + m_A127 += m_A44 * f20_41; + RHS41 += f20_41 * RHS20; + const double f21 = 1.0 / m_A45; + const double f21_42 = -f21 * m_A130; + m_A132 += m_A46 * f21_42; + m_A134 += m_A47 * f21_42; + m_A135 += m_A48 * f21_42; + RHS42 += f21_42 * RHS21; + const double f21_44 = -f21 * m_A139; + m_A144 += m_A46 * f21_44; + m_A151 += m_A47 * f21_44; + m_A153 += m_A48 * f21_44; + RHS44 += f21_44 * RHS21; + const double f22 = 1.0 / m_A49; + const double f22_34 = -f22 * m_A87; + m_A92 += m_A50 * f22_34; + RHS34 += f22_34 * RHS22; + const double f23 = 1.0 / m_A51; + const double f23_43 = -f23 * m_A136; + m_A137 += m_A52 * f23_43; + RHS43 += f23_43 * RHS23; + const double f24 = 1.0 / m_A55; + const double f24_32 = -f24 * m_A76; + m_A77 += m_A56 * f24_32; + RHS32 += f24_32 * RHS24; + const double f25 = 1.0 / m_A57; + const double f25_38 = -f25 * m_A110; + m_A112 += m_A58 * f25_38; + RHS38 += f25_38 * RHS25; + const double f26 = 1.0 / m_A59; + const double f26_34 = -f26 * m_A88; + m_A92 += m_A60 * f26_34; + RHS34 += f26_34 * RHS26; + const double f27 = 1.0 / m_A61; + const double f27_34 = -f27 * m_A89; + m_A92 += m_A62 * f27_34; + RHS34 += f27_34 * RHS27; + const double f28 = 1.0 / m_A63; + const double f28_34 = -f28 * m_A90; + m_A92 += m_A64 * f28_34; + RHS34 += f28_34 * RHS28; + const double f29 = 1.0 / m_A65; + const double f29_34 = -f29 * m_A91; + m_A92 += m_A66 * f29_34; + m_A93 += m_A67 * f29_34; + RHS34 += f29_34 * RHS29; + const double f29_44 = -f29 * m_A140; + m_A143 += m_A66 * f29_44; + m_A153 += m_A67 * f29_44; + RHS44 += f29_44 * RHS29; + const double f30 = 1.0 / m_A68; + const double f30_37 = -f30 * m_A106; + m_A107 += m_A69 * f30_37; + m_A108 += m_A70 * f30_37; + RHS37 += f30_37 * RHS30; + const double f30_44 = -f30 * m_A141; + m_A146 += m_A69 * f30_44; + m_A153 += m_A70 * f30_44; + RHS44 += f30_44 * RHS30; + const double f31 = 1.0 / m_A71; + const double f31_38 = -f31 * m_A111; + m_A112 += m_A72 * f31_38; + m_A113 += m_A73 * f31_38; + RHS38 += f31_38 * RHS31; + const double f31_44 = -f31 * m_A142; + m_A147 += m_A72 * f31_44; + m_A153 += m_A73 * f31_44; + RHS44 += f31_44 * RHS31; + const double f32 = 1.0 / m_A77; + const double f32_39 = -f32 * m_A116; + m_A118 += m_A78 * f32_39; + RHS39 += f32_39 * RHS32; + const double f33 = 1.0 / m_A83; + const double f33_39 = -f33 * m_A117; + m_A118 += m_A84 * f33_39; + m_A119 += m_A85 * f33_39; + RHS39 += f33_39 * RHS33; + const double f33_42 = -f33 * m_A131; + m_A133 += m_A84 * f33_42; + m_A134 += m_A85 * f33_42; + RHS42 += f33_42 * RHS33; + const double f34 = 1.0 / m_A92; + const double f34_44 = -f34 * m_A143; + m_A153 += m_A93 * f34_44; + RHS44 += f34_44 * RHS34; + const double f35 = 1.0 / m_A95; + const double f35_42 = -f35 * m_A132; + m_A133 += m_A96 * f35_42; + m_A134 += m_A97 * f35_42; + RHS42 += f35_42 * RHS35; + const double f35_44 = -f35 * m_A144; + m_A148 += m_A96 * f35_44; + m_A151 += m_A97 * f35_44; + RHS44 += f35_44 * RHS35; + const double f36 = 1.0 / m_A99; + const double f36_44 = -f36 * m_A145; + m_A153 += m_A100 * f36_44; + RHS44 += f36_44 * RHS36; + const double f37 = 1.0 / m_A107; + const double f37_44 = -f37 * m_A146; + m_A153 += m_A108 * f37_44; + RHS44 += f37_44 * RHS37; + const double f38 = 1.0 / m_A112; + const double f38_44 = -f38 * m_A147; + m_A153 += m_A113 * f38_44; + RHS44 += f38_44 * RHS38; + const double f39 = 1.0 / m_A118; + const double f39_42 = -f39 * m_A133; + m_A134 += m_A119 * f39_42; + RHS42 += f39_42 * RHS39; + const double f39_44 = -f39 * m_A148; + m_A151 += m_A119 * f39_44; + RHS44 += f39_44 * RHS39; + const double f40 = 1.0 / m_A121; + const double f40_44 = -f40 * m_A149; + m_A153 += m_A122 * f40_44; + RHS44 += f40_44 * RHS40; + const double f41 = 1.0 / m_A127; + const double f41_44 = -f41 * m_A150; + m_A153 += m_A128 * f41_44; + RHS44 += f41_44 * RHS41; + const double f42 = 1.0 / m_A134; + const double f42_44 = -f42 * m_A151; + m_A153 += m_A135 * f42_44; + RHS44 += f42_44 * RHS42; + const double f43 = 1.0 / m_A137; + const double f43_44 = -f43 * m_A152; + m_A153 += m_A138 * f43_44; + RHS44 += f43_44 * RHS43; + V[44] = RHS44 / m_A153; + double tmp43 = 0.0; + tmp43 += m_A138 * V[44]; + V[43] = (RHS43 - tmp43) / m_A137; + double tmp42 = 0.0; + tmp42 += m_A135 * V[44]; + V[42] = (RHS42 - tmp42) / m_A134; + double tmp41 = 0.0; + tmp41 += m_A128 * V[44]; + V[41] = (RHS41 - tmp41) / m_A127; + double tmp40 = 0.0; + tmp40 += m_A122 * V[44]; + V[40] = (RHS40 - tmp40) / m_A121; + double tmp39 = 0.0; + tmp39 += m_A119 * V[42]; + V[39] = (RHS39 - tmp39) / m_A118; + double tmp38 = 0.0; + tmp38 += m_A113 * V[44]; + V[38] = (RHS38 - tmp38) / m_A112; + double tmp37 = 0.0; + tmp37 += m_A108 * V[44]; + V[37] = (RHS37 - tmp37) / m_A107; + double tmp36 = 0.0; + tmp36 += m_A100 * V[44]; + V[36] = (RHS36 - tmp36) / m_A99; + double tmp35 = 0.0; + tmp35 += m_A96 * V[39]; + tmp35 += m_A97 * V[42]; + V[35] = (RHS35 - tmp35) / m_A95; + double tmp34 = 0.0; + tmp34 += m_A93 * V[44]; + V[34] = (RHS34 - tmp34) / m_A92; + double tmp33 = 0.0; + tmp33 += m_A84 * V[39]; + tmp33 += m_A85 * V[42]; + V[33] = (RHS33 - tmp33) / m_A83; + double tmp32 = 0.0; + tmp32 += m_A78 * V[39]; + V[32] = (RHS32 - tmp32) / m_A77; + double tmp31 = 0.0; + tmp31 += m_A72 * V[38]; + tmp31 += m_A73 * V[44]; + V[31] = (RHS31 - tmp31) / m_A71; + double tmp30 = 0.0; + tmp30 += m_A69 * V[37]; + tmp30 += m_A70 * V[44]; + V[30] = (RHS30 - tmp30) / m_A68; + double tmp29 = 0.0; + tmp29 += m_A66 * V[34]; + tmp29 += m_A67 * V[44]; + V[29] = (RHS29 - tmp29) / m_A65; + double tmp28 = 0.0; + tmp28 += m_A64 * V[34]; + V[28] = (RHS28 - tmp28) / m_A63; + double tmp27 = 0.0; + tmp27 += m_A62 * V[34]; + V[27] = (RHS27 - tmp27) / m_A61; + double tmp26 = 0.0; + tmp26 += m_A60 * V[34]; + V[26] = (RHS26 - tmp26) / m_A59; + double tmp25 = 0.0; + tmp25 += m_A58 * V[38]; + V[25] = (RHS25 - tmp25) / m_A57; + double tmp24 = 0.0; + tmp24 += m_A56 * V[32]; + V[24] = (RHS24 - tmp24) / m_A55; + double tmp23 = 0.0; + tmp23 += m_A52 * V[43]; + V[23] = (RHS23 - tmp23) / m_A51; + double tmp22 = 0.0; + tmp22 += m_A50 * V[34]; + V[22] = (RHS22 - tmp22) / m_A49; + double tmp21 = 0.0; + tmp21 += m_A46 * V[35]; + tmp21 += m_A47 * V[42]; + tmp21 += m_A48 * V[44]; + V[21] = (RHS21 - tmp21) / m_A45; + double tmp20 = 0.0; + tmp20 += m_A44 * V[41]; + V[20] = (RHS20 - tmp20) / m_A43; + double tmp19 = 0.0; + tmp19 += m_A42 * V[41]; + V[19] = (RHS19 - tmp19) / m_A41; + double tmp18 = 0.0; + tmp18 += m_A40 * V[41]; + V[18] = (RHS18 - tmp18) / m_A39; + double tmp17 = 0.0; + tmp17 += m_A38 * V[40]; + V[17] = (RHS17 - tmp17) / m_A37; + double tmp16 = 0.0; + tmp16 += m_A36 * V[36]; + V[16] = (RHS16 - tmp16) / m_A35; + double tmp15 = 0.0; + tmp15 += m_A34 * V[41]; + V[15] = (RHS15 - tmp15) / m_A33; + double tmp14 = 0.0; + tmp14 += m_A32 * V[34]; + V[14] = (RHS14 - tmp14) / m_A31; + double tmp13 = 0.0; + tmp13 += m_A30 * V[38]; + V[13] = (RHS13 - tmp13) / m_A29; + double tmp12 = 0.0; + tmp12 += m_A28 * V[37]; + V[12] = (RHS12 - tmp12) / m_A27; + double tmp11 = 0.0; + tmp11 += m_A26 * V[37]; + V[11] = (RHS11 - tmp11) / m_A25; + double tmp10 = 0.0; + tmp10 += m_A24 * V[37]; + V[10] = (RHS10 - tmp10) / m_A23; + double tmp9 = 0.0; + tmp9 += m_A22 * V[37]; + V[9] = (RHS9 - tmp9) / m_A21; + double tmp8 = 0.0; + tmp8 += m_A20 * V[37]; + V[8] = (RHS8 - tmp8) / m_A19; + double tmp7 = 0.0; + tmp7 += m_A17 * V[39]; + tmp7 += m_A18 * V[42]; + V[7] = (RHS7 - tmp7) / m_A16; + double tmp6 = 0.0; + tmp6 += m_A14 * V[32]; + tmp6 += m_A15 * V[39]; + V[6] = (RHS6 - tmp6) / m_A13; + double tmp5 = 0.0; + tmp5 += m_A12 * V[24]; + V[5] = (RHS5 - tmp5) / m_A11; + double tmp4 = 0.0; + tmp4 += m_A9 * V[24]; + tmp4 += m_A10 * V[32]; + V[4] = (RHS4 - tmp4) / m_A8; + double tmp3 = 0.0; + tmp3 += m_A7 * V[33]; + V[3] = (RHS3 - tmp3) / m_A6; + double tmp2 = 0.0; + tmp2 += m_A5 * V[33]; + V[2] = (RHS2 - tmp2) / m_A4; + double tmp1 = 0.0; + tmp1 += m_A3 * V[33]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[33]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // pongf static void nl_gcr_13e7b5ac1a260dbf_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -1176,218 +2191,6 @@ static void nl_gcr_144ed14e6bafdb_119_double_double(double * __restrict V, const V[0] = (RHS0 - tmp0) / m_A0; } -// astrob -static void nl_gcr_15b7648945a58fb_27_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - plib::unused_var(cnV); - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - double m_A9(0.0); - double m_A10(0.0); - double m_A11(0.0); - double m_A12(0.0); - double m_A13(0.0); - double m_A14(0.0); - double m_A15(0.0); - double m_A16(0.0); - double m_A17(0.0); - double m_A18(0.0); - double m_A19(0.0); - double m_A20(0.0); - double m_A21(0.0); - double m_A22(0.0); - double m_A23(0.0); - double m_A24(0.0); - double m_A25(0.0); - double m_A26(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A0 += gt[2]; - m_A0 += gt[3]; - m_A0 += gt[4]; - m_A0 += gt[5]; - m_A0 += gt[6]; - m_A1 += go[0]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 += Idr[2]; - RHS0 += Idr[3]; - RHS0 += Idr[4]; - RHS0 += Idr[5]; - RHS0 += Idr[6]; - RHS0 -= go[1] * *cnV[1]; - RHS0 -= go[2] * *cnV[2]; - RHS0 -= go[3] * *cnV[3]; - RHS0 -= go[4] * *cnV[4]; - RHS0 -= go[5] * *cnV[5]; - RHS0 -= go[6] * *cnV[6]; - m_A2 += gt[7]; - m_A2 += gt[8]; - m_A2 += gt[9]; - m_A4 += go[7]; - m_A3 += go[8]; - double RHS1 = Idr[7]; - RHS1 += Idr[8]; - RHS1 += Idr[9]; - RHS1 -= go[9] * *cnV[9]; - m_A5 += gt[10]; - m_A5 += gt[11]; - m_A5 += gt[12]; - m_A5 += gt[13]; - m_A5 += gt[14]; - m_A5 += gt[15]; - m_A5 += gt[16]; - m_A6 += go[10]; - double RHS2 = Idr[10]; - RHS2 += Idr[11]; - RHS2 += Idr[12]; - RHS2 += Idr[13]; - RHS2 += Idr[14]; - RHS2 += Idr[15]; - RHS2 += Idr[16]; - RHS2 -= go[11] * *cnV[11]; - RHS2 -= go[12] * *cnV[12]; - RHS2 -= go[13] * *cnV[13]; - RHS2 -= go[14] * *cnV[14]; - RHS2 -= go[15] * *cnV[15]; - RHS2 -= go[16] * *cnV[16]; - m_A7 += gt[17]; - m_A7 += gt[18]; - m_A7 += gt[19]; - m_A7 += gt[20]; - m_A9 += go[17]; - m_A10 += go[18]; - m_A8 += go[19]; - double RHS3 = Idr[17]; - RHS3 += Idr[18]; - RHS3 += Idr[19]; - RHS3 += Idr[20]; - RHS3 -= go[20] * *cnV[20]; - m_A14 += gt[21]; - m_A14 += gt[22]; - m_A14 += gt[23]; - m_A14 += gt[24]; - m_A14 += gt[25]; - m_A11 += go[21]; - m_A13 += go[22]; - m_A12 += go[23]; - double RHS4 = Idr[21]; - RHS4 += Idr[22]; - RHS4 += Idr[23]; - RHS4 += Idr[24]; - RHS4 += Idr[25]; - RHS4 -= go[24] * *cnV[24]; - RHS4 -= go[25] * *cnV[25]; - m_A19 += gt[26]; - m_A19 += gt[27]; - m_A19 += gt[28]; - m_A20 += go[26]; - m_A17 += go[27]; - double RHS5 = Idr[26]; - RHS5 += Idr[27]; - RHS5 += Idr[28]; - RHS5 -= go[28] * *cnV[28]; - m_A26 += gt[29]; - m_A26 += gt[30]; - m_A26 += gt[31]; - m_A26 += gt[32]; - m_A26 += gt[33]; - m_A26 += gt[34]; - m_A26 += gt[35]; - m_A22 += go[29]; - m_A25 += go[30]; - m_A23 += go[31]; - m_A21 += go[32]; - double RHS6 = Idr[29]; - RHS6 += Idr[30]; - RHS6 += Idr[31]; - RHS6 += Idr[32]; - RHS6 += Idr[33]; - RHS6 += Idr[34]; - RHS6 += Idr[35]; - RHS6 -= go[33] * *cnV[33]; - RHS6 -= go[34] * *cnV[34]; - RHS6 -= go[35] * *cnV[35]; - const double f0 = 1.0 / m_A0; - const double f0_4 = -f0 * m_A11; - m_A12 += m_A1 * f0_4; - RHS4 += f0_4 * RHS0; - const double f1 = 1.0 / m_A2; - const double f1_4 = -f1 * m_A12; - m_A14 += m_A3 * f1_4; - m_A16 += m_A4 * f1_4; - RHS4 += f1_4 * RHS1; - const double f1_6 = -f1 * m_A21; - m_A24 += m_A3 * f1_6; - m_A26 += m_A4 * f1_6; - RHS6 += f1_6 * RHS1; - const double f2 = 1.0 / m_A5; - const double f2_6 = -f2 * m_A22; - m_A25 += m_A6 * f2_6; - RHS6 += f2_6 * RHS2; - const double f3 = 1.0 / m_A7; - const double f3_4 = -f3 * m_A13; - m_A14 += m_A8 * f3_4; - m_A15 += m_A9 * f3_4; - m_A16 += m_A10 * f3_4; - RHS4 += f3_4 * RHS3; - const double f3_5 = -f3 * m_A17; - m_A18 += m_A8 * f3_5; - m_A19 += m_A9 * f3_5; - m_A20 += m_A10 * f3_5; - RHS5 += f3_5 * RHS3; - const double f3_6 = -f3 * m_A23; - m_A24 += m_A8 * f3_6; - m_A25 += m_A9 * f3_6; - m_A26 += m_A10 * f3_6; - RHS6 += f3_6 * RHS3; - const double f4 = 1.0 / m_A14; - const double f4_5 = -f4 * m_A18; - m_A19 += m_A15 * f4_5; - m_A20 += m_A16 * f4_5; - RHS5 += f4_5 * RHS4; - const double f4_6 = -f4 * m_A24; - m_A25 += m_A15 * f4_6; - m_A26 += m_A16 * f4_6; - RHS6 += f4_6 * RHS4; - const double f5 = 1.0 / m_A19; - const double f5_6 = -f5 * m_A25; - m_A26 += m_A20 * f5_6; - RHS6 += f5_6 * RHS5; - V[6] = RHS6 / m_A26; - double tmp5 = 0.0; - tmp5 += m_A20 * V[6]; - V[5] = (RHS5 - tmp5) / m_A19; - double tmp4 = 0.0; - tmp4 += m_A15 * V[5]; - tmp4 += m_A16 * V[6]; - V[4] = (RHS4 - tmp4) / m_A14; - double tmp3 = 0.0; - tmp3 += m_A8 * V[4]; - tmp3 += m_A9 * V[5]; - tmp3 += m_A10 * V[6]; - V[3] = (RHS3 - tmp3) / m_A7; - double tmp2 = 0.0; - tmp2 += m_A6 * V[5]; - V[2] = (RHS2 - tmp2) / m_A5; - double tmp1 = 0.0; - tmp1 += m_A3 * V[4]; - tmp1 += m_A4 * V[6]; - V[1] = (RHS1 - tmp1) / m_A2; - double tmp0 = 0.0; - tmp0 += m_A1 * V[1]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // spacewar static void nl_gcr_15e8f6fb021de0f9_28_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -1581,74 +2384,6 @@ static void nl_gcr_15e8f6fb021de0f9_28_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// armora -static void nl_gcr_1692de755a535408_9_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - plib::unused_var(cnV); - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A0 += gt[2]; - m_A2 += go[0]; - m_A1 += go[1]; - m_A1 += go[2]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 += Idr[2]; - m_A4 += gt[3]; - m_A4 += gt[4]; - m_A4 += gt[5]; - m_A4 += gt[6]; - m_A5 += go[3]; - m_A5 += go[4]; - m_A3 += go[5]; - m_A3 += go[6]; - double RHS1 = Idr[3]; - RHS1 += Idr[4]; - RHS1 += Idr[5]; - RHS1 += Idr[6]; - m_A8 += gt[7]; - m_A8 += gt[8]; - m_A8 += gt[9]; - m_A7 += go[7]; - m_A7 += go[8]; - m_A6 += go[9]; - double RHS2 = Idr[7]; - RHS2 += Idr[8]; - RHS2 += Idr[9]; - const double f0 = 1.0 / m_A0; - const double f0_1 = -f0 * m_A3; - m_A4 += m_A1 * f0_1; - m_A5 += m_A2 * f0_1; - RHS1 += f0_1 * RHS0; - const double f0_2 = -f0 * m_A6; - m_A7 += m_A1 * f0_2; - m_A8 += m_A2 * f0_2; - RHS2 += f0_2 * RHS0; - const double f1 = 1.0 / m_A4; - const double f1_2 = -f1 * m_A7; - m_A8 += m_A5 * f1_2; - RHS2 += f1_2 * RHS1; - V[2] = RHS2 / m_A8; - double tmp1 = 0.0; - tmp1 += m_A5 * V[2]; - V[1] = (RHS1 - tmp1) / m_A4; - double tmp0 = 0.0; - tmp0 += m_A1 * V[1]; - tmp0 += m_A2 * V[2]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // dpatrol static void nl_gcr_18f4d9160b51d613_20_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -8321,1021 +9056,6 @@ static void nl_gcr_34e910fc1896999f_76_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// astrob -static void nl_gcr_37b9bb3472eec580_154_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - plib::unused_var(cnV); - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - double m_A9(0.0); - double m_A10(0.0); - double m_A11(0.0); - double m_A12(0.0); - double m_A13(0.0); - double m_A14(0.0); - double m_A15(0.0); - double m_A16(0.0); - double m_A17(0.0); - double m_A18(0.0); - double m_A19(0.0); - double m_A20(0.0); - double m_A21(0.0); - double m_A22(0.0); - double m_A23(0.0); - double m_A24(0.0); - double m_A25(0.0); - double m_A26(0.0); - double m_A27(0.0); - double m_A28(0.0); - double m_A29(0.0); - double m_A30(0.0); - double m_A31(0.0); - double m_A32(0.0); - double m_A33(0.0); - double m_A34(0.0); - double m_A35(0.0); - double m_A36(0.0); - double m_A37(0.0); - double m_A38(0.0); - double m_A39(0.0); - double m_A40(0.0); - double m_A41(0.0); - double m_A42(0.0); - double m_A43(0.0); - double m_A44(0.0); - double m_A45(0.0); - double m_A46(0.0); - double m_A47(0.0); - double m_A48(0.0); - double m_A49(0.0); - double m_A50(0.0); - double m_A51(0.0); - double m_A52(0.0); - double m_A53(0.0); - double m_A54(0.0); - double m_A55(0.0); - double m_A56(0.0); - double m_A57(0.0); - double m_A58(0.0); - double m_A59(0.0); - double m_A60(0.0); - double m_A61(0.0); - double m_A62(0.0); - double m_A63(0.0); - double m_A64(0.0); - double m_A65(0.0); - double m_A66(0.0); - double m_A67(0.0); - double m_A68(0.0); - double m_A69(0.0); - double m_A70(0.0); - double m_A71(0.0); - double m_A72(0.0); - double m_A73(0.0); - double m_A74(0.0); - double m_A75(0.0); - double m_A76(0.0); - double m_A77(0.0); - double m_A78(0.0); - double m_A79(0.0); - double m_A80(0.0); - double m_A81(0.0); - double m_A82(0.0); - double m_A83(0.0); - double m_A84(0.0); - double m_A85(0.0); - double m_A86(0.0); - double m_A87(0.0); - double m_A88(0.0); - double m_A89(0.0); - double m_A90(0.0); - double m_A91(0.0); - double m_A92(0.0); - double m_A93(0.0); - double m_A94(0.0); - double m_A95(0.0); - double m_A96(0.0); - double m_A97(0.0); - double m_A98(0.0); - double m_A99(0.0); - double m_A100(0.0); - double m_A101(0.0); - double m_A102(0.0); - double m_A103(0.0); - double m_A104(0.0); - double m_A105(0.0); - double m_A106(0.0); - double m_A107(0.0); - double m_A108(0.0); - double m_A109(0.0); - double m_A110(0.0); - double m_A111(0.0); - double m_A112(0.0); - double m_A113(0.0); - double m_A114(0.0); - double m_A115(0.0); - double m_A116(0.0); - double m_A117(0.0); - double m_A118(0.0); - double m_A119(0.0); - double m_A120(0.0); - double m_A121(0.0); - double m_A122(0.0); - double m_A123(0.0); - double m_A124(0.0); - double m_A125(0.0); - double m_A126(0.0); - double m_A127(0.0); - double m_A128(0.0); - double m_A129(0.0); - double m_A130(0.0); - double m_A131(0.0); - double m_A132(0.0); - double m_A133(0.0); - double m_A134(0.0); - double m_A135(0.0); - double m_A136(0.0); - double m_A137(0.0); - double m_A138(0.0); - double m_A139(0.0); - double m_A140(0.0); - double m_A141(0.0); - double m_A142(0.0); - double m_A143(0.0); - double m_A144(0.0); - double m_A145(0.0); - double m_A146(0.0); - double m_A147(0.0); - double m_A148(0.0); - double m_A149(0.0); - double m_A150(0.0); - double m_A151(0.0); - double m_A152(0.0); - double m_A153(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A1 += go[0]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 -= go[1] * *cnV[1]; - m_A2 += gt[2]; - m_A2 += gt[3]; - m_A3 += go[2]; - double RHS1 = Idr[2]; - RHS1 += Idr[3]; - RHS1 -= go[3] * *cnV[3]; - m_A4 += gt[4]; - m_A4 += gt[5]; - m_A5 += go[4]; - double RHS2 = Idr[4]; - RHS2 += Idr[5]; - RHS2 -= go[5] * *cnV[5]; - m_A6 += gt[6]; - m_A6 += gt[7]; - m_A7 += go[6]; - m_A8 += go[7]; - double RHS3 = Idr[6]; - RHS3 += Idr[7]; - m_A9 += gt[8]; - m_A9 += gt[9]; - m_A9 += gt[10]; - m_A10 += go[8]; - double RHS4 = Idr[8]; - RHS4 += Idr[9]; - RHS4 += Idr[10]; - RHS4 -= go[9] * *cnV[9]; - RHS4 -= go[10] * *cnV[10]; - m_A11 += gt[11]; - m_A11 += gt[12]; - m_A11 += gt[13]; - m_A11 += gt[14]; - m_A12 += go[11]; - m_A12 += go[12]; - m_A13 += go[13]; - double RHS5 = Idr[11]; - RHS5 += Idr[12]; - RHS5 += Idr[13]; - RHS5 += Idr[14]; - RHS5 -= go[14] * *cnV[14]; - m_A14 += gt[15]; - m_A14 += gt[16]; - m_A15 += go[15]; - double RHS6 = Idr[15]; - RHS6 += Idr[16]; - RHS6 -= go[16] * *cnV[16]; - m_A16 += gt[17]; - m_A16 += gt[18]; - m_A16 += gt[19]; - m_A16 += gt[20]; - m_A16 += gt[21]; - m_A16 += gt[22]; - m_A18 += go[17]; - m_A17 += go[18]; - double RHS7 = Idr[17]; - RHS7 += Idr[18]; - RHS7 += Idr[19]; - RHS7 += Idr[20]; - RHS7 += Idr[21]; - RHS7 += Idr[22]; - RHS7 -= go[19] * *cnV[19]; - RHS7 -= go[20] * *cnV[20]; - RHS7 -= go[21] * *cnV[21]; - RHS7 -= go[22] * *cnV[22]; - m_A19 += gt[23]; - m_A19 += gt[24]; - m_A19 += gt[25]; - m_A20 += go[23]; - double RHS8 = Idr[23]; - RHS8 += Idr[24]; - RHS8 += Idr[25]; - RHS8 -= go[24] * *cnV[24]; - RHS8 -= go[25] * *cnV[25]; - m_A21 += gt[26]; - m_A21 += gt[27]; - m_A21 += gt[28]; - m_A22 += go[26]; - double RHS9 = Idr[26]; - RHS9 += Idr[27]; - RHS9 += Idr[28]; - RHS9 -= go[27] * *cnV[27]; - RHS9 -= go[28] * *cnV[28]; - m_A23 += gt[29]; - m_A23 += gt[30]; - m_A23 += gt[31]; - m_A24 += go[29]; - double RHS10 = Idr[29]; - RHS10 += Idr[30]; - RHS10 += Idr[31]; - RHS10 -= go[30] * *cnV[30]; - RHS10 -= go[31] * *cnV[31]; - m_A25 += gt[32]; - m_A25 += gt[33]; - m_A25 += gt[34]; - m_A26 += go[32]; - double RHS11 = Idr[32]; - RHS11 += Idr[33]; - RHS11 += Idr[34]; - RHS11 -= go[33] * *cnV[33]; - RHS11 -= go[34] * *cnV[34]; - m_A27 += gt[35]; - m_A27 += gt[36]; - m_A27 += gt[37]; - m_A28 += go[35]; - double RHS12 = Idr[35]; - RHS12 += Idr[36]; - RHS12 += Idr[37]; - RHS12 -= go[36] * *cnV[36]; - RHS12 -= go[37] * *cnV[37]; - m_A29 += gt[38]; - m_A29 += gt[39]; - m_A30 += go[38]; - double RHS13 = Idr[38]; - RHS13 += Idr[39]; - RHS13 -= go[39] * *cnV[39]; - m_A31 += gt[40]; - m_A31 += gt[41]; - m_A31 += gt[42]; - m_A32 += go[40]; - double RHS14 = Idr[40]; - RHS14 += Idr[41]; - RHS14 += Idr[42]; - RHS14 -= go[41] * *cnV[41]; - RHS14 -= go[42] * *cnV[42]; - m_A33 += gt[43]; - m_A33 += gt[44]; - m_A34 += go[43]; - double RHS15 = Idr[43]; - RHS15 += Idr[44]; - RHS15 -= go[44] * *cnV[44]; - m_A35 += gt[45]; - m_A35 += gt[46]; - m_A36 += go[45]; - double RHS16 = Idr[45]; - RHS16 += Idr[46]; - RHS16 -= go[46] * *cnV[46]; - m_A37 += gt[47]; - m_A37 += gt[48]; - m_A38 += go[47]; - double RHS17 = Idr[47]; - RHS17 += Idr[48]; - RHS17 -= go[48] * *cnV[48]; - m_A39 += gt[49]; - m_A39 += gt[50]; - m_A40 += go[49]; - double RHS18 = Idr[49]; - RHS18 += Idr[50]; - RHS18 -= go[50] * *cnV[50]; - m_A41 += gt[51]; - m_A41 += gt[52]; - m_A42 += go[51]; - double RHS19 = Idr[51]; - RHS19 += Idr[52]; - RHS19 -= go[52] * *cnV[52]; - m_A43 += gt[53]; - m_A43 += gt[54]; - m_A44 += go[53]; - double RHS20 = Idr[53]; - RHS20 += Idr[54]; - RHS20 -= go[54] * *cnV[54]; - m_A45 += gt[55]; - m_A45 += gt[56]; - m_A45 += gt[57]; - m_A45 += gt[58]; - m_A45 += gt[59]; - m_A46 += go[55]; - m_A48 += go[56]; - m_A47 += go[57]; - double RHS21 = Idr[55]; - RHS21 += Idr[56]; - RHS21 += Idr[57]; - RHS21 += Idr[58]; - RHS21 += Idr[59]; - RHS21 -= go[58] * *cnV[58]; - RHS21 -= go[59] * *cnV[59]; - m_A49 += gt[60]; - m_A49 += gt[61]; - m_A49 += gt[62]; - m_A50 += go[60]; - double RHS22 = Idr[60]; - RHS22 += Idr[61]; - RHS22 += Idr[62]; - RHS22 -= go[61] * *cnV[61]; - RHS22 -= go[62] * *cnV[62]; - m_A51 += gt[63]; - m_A51 += gt[64]; - m_A52 += go[63]; - double RHS23 = Idr[63]; - RHS23 += Idr[64]; - RHS23 -= go[64] * *cnV[64]; - m_A55 += gt[65]; - m_A55 += gt[66]; - m_A55 += gt[67]; - m_A55 += gt[68]; - m_A54 += go[65]; - m_A53 += go[66]; - double RHS24 = Idr[65]; - RHS24 += Idr[66]; - RHS24 += Idr[67]; - RHS24 += Idr[68]; - RHS24 -= go[67] * *cnV[67]; - RHS24 -= go[68] * *cnV[68]; - m_A57 += gt[69]; - m_A57 += gt[70]; - m_A58 += go[69]; - double RHS25 = Idr[69]; - RHS25 += Idr[70]; - RHS25 -= go[70] * *cnV[70]; - m_A59 += gt[71]; - m_A59 += gt[72]; - m_A59 += gt[73]; - m_A60 += go[71]; - double RHS26 = Idr[71]; - RHS26 += Idr[72]; - RHS26 += Idr[73]; - RHS26 -= go[72] * *cnV[72]; - RHS26 -= go[73] * *cnV[73]; - m_A61 += gt[74]; - m_A61 += gt[75]; - m_A61 += gt[76]; - m_A62 += go[74]; - double RHS27 = Idr[74]; - RHS27 += Idr[75]; - RHS27 += Idr[76]; - RHS27 -= go[75] * *cnV[75]; - RHS27 -= go[76] * *cnV[76]; - m_A63 += gt[77]; - m_A63 += gt[78]; - m_A63 += gt[79]; - m_A64 += go[77]; - double RHS28 = Idr[77]; - RHS28 += Idr[78]; - RHS28 += Idr[79]; - RHS28 -= go[78] * *cnV[78]; - RHS28 -= go[79] * *cnV[79]; - m_A65 += gt[80]; - m_A65 += gt[81]; - m_A67 += go[80]; - m_A66 += go[81]; - double RHS29 = Idr[80]; - RHS29 += Idr[81]; - m_A68 += gt[82]; - m_A68 += gt[83]; - m_A70 += go[82]; - m_A69 += go[83]; - double RHS30 = Idr[82]; - RHS30 += Idr[83]; - m_A71 += gt[84]; - m_A71 += gt[85]; - m_A73 += go[84]; - m_A72 += go[85]; - double RHS31 = Idr[84]; - RHS31 += Idr[85]; - m_A77 += gt[86]; - m_A77 += gt[87]; - m_A77 += gt[88]; - m_A77 += gt[89]; - m_A77 += gt[90]; - m_A77 += gt[91]; - m_A77 += gt[92]; - m_A74 += go[86]; - m_A75 += go[87]; - m_A75 += go[88]; - m_A78 += go[89]; - m_A78 += go[90]; - double RHS32 = Idr[86]; - RHS32 += Idr[87]; - RHS32 += Idr[88]; - RHS32 += Idr[89]; - RHS32 += Idr[90]; - RHS32 += Idr[91]; - RHS32 += Idr[92]; - RHS32 -= go[91] * *cnV[91]; - RHS32 -= go[92] * *cnV[92]; - m_A83 += gt[93]; - m_A83 += gt[94]; - m_A83 += gt[95]; - m_A83 += gt[96]; - m_A83 += gt[97]; - m_A83 += gt[98]; - m_A83 += gt[99]; - m_A83 += gt[100]; - m_A83 += gt[101]; - m_A85 += go[93]; - m_A85 += go[94]; - m_A84 += go[95]; - m_A84 += go[96]; - m_A82 += go[97]; - m_A81 += go[98]; - m_A80 += go[99]; - m_A79 += go[100]; - double RHS33 = Idr[93]; - RHS33 += Idr[94]; - RHS33 += Idr[95]; - RHS33 += Idr[96]; - RHS33 += Idr[97]; - RHS33 += Idr[98]; - RHS33 += Idr[99]; - RHS33 += Idr[100]; - RHS33 += Idr[101]; - RHS33 -= go[101] * *cnV[101]; - m_A92 += gt[102]; - m_A92 += gt[103]; - m_A92 += gt[104]; - m_A92 += gt[105]; - m_A92 += gt[106]; - m_A92 += gt[107]; - m_A91 += go[102]; - m_A90 += go[103]; - m_A89 += go[104]; - m_A88 += go[105]; - m_A87 += go[106]; - m_A86 += go[107]; - double RHS34 = Idr[102]; - RHS34 += Idr[103]; - RHS34 += Idr[104]; - RHS34 += Idr[105]; - RHS34 += Idr[106]; - RHS34 += Idr[107]; - m_A95 += gt[108]; - m_A95 += gt[109]; - m_A95 += gt[110]; - m_A95 += gt[111]; - m_A95 += gt[112]; - m_A95 += gt[113]; - m_A95 += gt[114]; - m_A97 += go[108]; - m_A94 += go[109]; - double RHS35 = Idr[108]; - RHS35 += Idr[109]; - RHS35 += Idr[110]; - RHS35 += Idr[111]; - RHS35 += Idr[112]; - RHS35 += Idr[113]; - RHS35 += Idr[114]; - RHS35 -= go[110] * *cnV[110]; - RHS35 -= go[111] * *cnV[111]; - RHS35 -= go[112] * *cnV[112]; - RHS35 -= go[113] * *cnV[113]; - RHS35 -= go[114] * *cnV[114]; - m_A99 += gt[115]; - m_A99 += gt[116]; - m_A98 += go[115]; - m_A100 += go[116]; - double RHS36 = Idr[115]; - RHS36 += Idr[116]; - m_A107 += gt[117]; - m_A107 += gt[118]; - m_A107 += gt[119]; - m_A107 += gt[120]; - m_A107 += gt[121]; - m_A107 += gt[122]; - m_A106 += go[117]; - m_A105 += go[118]; - m_A104 += go[119]; - m_A103 += go[120]; - m_A102 += go[121]; - m_A101 += go[122]; - double RHS37 = Idr[117]; - RHS37 += Idr[118]; - RHS37 += Idr[119]; - RHS37 += Idr[120]; - RHS37 += Idr[121]; - RHS37 += Idr[122]; - m_A112 += gt[123]; - m_A112 += gt[124]; - m_A112 += gt[125]; - m_A112 += gt[126]; - m_A112 += gt[127]; - m_A111 += go[123]; - m_A110 += go[124]; - m_A109 += go[125]; - double RHS38 = Idr[123]; - RHS38 += Idr[124]; - RHS38 += Idr[125]; - RHS38 += Idr[126]; - RHS38 += Idr[127]; - RHS38 -= go[126] * *cnV[126]; - RHS38 -= go[127] * *cnV[127]; - m_A118 += gt[128]; - m_A118 += gt[129]; - m_A118 += gt[130]; - m_A118 += gt[131]; - m_A118 += gt[132]; - m_A118 += gt[133]; - m_A118 += gt[134]; - m_A118 += gt[135]; - m_A118 += gt[136]; - m_A119 += go[128]; - m_A115 += go[129]; - m_A114 += go[130]; - m_A116 += go[131]; - m_A116 += go[132]; - m_A117 += go[133]; - m_A117 += go[134]; - double RHS39 = Idr[128]; - RHS39 += Idr[129]; - RHS39 += Idr[130]; - RHS39 += Idr[131]; - RHS39 += Idr[132]; - RHS39 += Idr[133]; - RHS39 += Idr[134]; - RHS39 += Idr[135]; - RHS39 += Idr[136]; - RHS39 -= go[135] * *cnV[135]; - RHS39 -= go[136] * *cnV[136]; - m_A121 += gt[137]; - m_A121 += gt[138]; - m_A120 += go[137]; - m_A122 += go[138]; - double RHS40 = Idr[137]; - RHS40 += Idr[138]; - m_A127 += gt[139]; - m_A127 += gt[140]; - m_A127 += gt[141]; - m_A127 += gt[142]; - m_A127 += gt[143]; - m_A126 += go[139]; - m_A125 += go[140]; - m_A124 += go[141]; - m_A123 += go[142]; - m_A128 += go[143]; - double RHS41 = Idr[139]; - RHS41 += Idr[140]; - RHS41 += Idr[141]; - RHS41 += Idr[142]; - RHS41 += Idr[143]; - m_A134 += gt[144]; - m_A134 += gt[145]; - m_A134 += gt[146]; - m_A134 += gt[147]; - m_A134 += gt[148]; - m_A134 += gt[149]; - m_A130 += go[144]; - m_A129 += go[145]; - m_A133 += go[146]; - m_A131 += go[147]; - m_A131 += go[148]; - double RHS42 = Idr[144]; - RHS42 += Idr[145]; - RHS42 += Idr[146]; - RHS42 += Idr[147]; - RHS42 += Idr[148]; - RHS42 += Idr[149]; - RHS42 -= go[149] * *cnV[149]; - m_A137 += gt[150]; - m_A137 += gt[151]; - m_A136 += go[150]; - m_A138 += go[151]; - double RHS43 = Idr[150]; - RHS43 += Idr[151]; - m_A153 += gt[152]; - m_A153 += gt[153]; - m_A153 += gt[154]; - m_A153 += gt[155]; - m_A153 += gt[156]; - m_A153 += gt[157]; - m_A153 += gt[158]; - m_A153 += gt[159]; - m_A152 += go[152]; - m_A140 += go[153]; - m_A141 += go[154]; - m_A142 += go[155]; - m_A149 += go[156]; - m_A145 += go[157]; - m_A150 += go[158]; - m_A139 += go[159]; - double RHS44 = Idr[152]; - RHS44 += Idr[153]; - RHS44 += Idr[154]; - RHS44 += Idr[155]; - RHS44 += Idr[156]; - RHS44 += Idr[157]; - RHS44 += Idr[158]; - RHS44 += Idr[159]; - const double f0 = 1.0 / m_A0; - const double f0_33 = -f0 * m_A79; - m_A83 += m_A1 * f0_33; - RHS33 += f0_33 * RHS0; - const double f1 = 1.0 / m_A2; - const double f1_33 = -f1 * m_A80; - m_A83 += m_A3 * f1_33; - RHS33 += f1_33 * RHS1; - const double f2 = 1.0 / m_A4; - const double f2_33 = -f2 * m_A81; - m_A83 += m_A5 * f2_33; - RHS33 += f2_33 * RHS2; - const double f3 = 1.0 / m_A6; - const double f3_24 = -f3 * m_A53; - m_A55 += m_A7 * f3_24; - m_A56 += m_A8 * f3_24; - RHS24 += f3_24 * RHS3; - const double f3_32 = -f3 * m_A74; - m_A76 += m_A7 * f3_32; - m_A77 += m_A8 * f3_32; - RHS32 += f3_32 * RHS3; - const double f4 = 1.0 / m_A9; - const double f4_24 = -f4 * m_A54; - m_A55 += m_A10 * f4_24; - RHS24 += f4_24 * RHS4; - const double f5 = 1.0 / m_A11; - const double f5_32 = -f5 * m_A75; - m_A77 += m_A12 * f5_32; - m_A78 += m_A13 * f5_32; - RHS32 += f5_32 * RHS5; - const double f5_39 = -f5 * m_A114; - m_A116 += m_A12 * f5_39; - m_A118 += m_A13 * f5_39; - RHS39 += f5_39 * RHS5; - const double f6 = 1.0 / m_A14; - const double f6_33 = -f6 * m_A82; - m_A83 += m_A15 * f6_33; - RHS33 += f6_33 * RHS6; - const double f7 = 1.0 / m_A16; - const double f7_35 = -f7 * m_A94; - m_A96 += m_A17 * f7_35; - m_A97 += m_A18 * f7_35; - RHS35 += f7_35 * RHS7; - const double f7_39 = -f7 * m_A115; - m_A118 += m_A17 * f7_39; - m_A119 += m_A18 * f7_39; - RHS39 += f7_39 * RHS7; - const double f7_42 = -f7 * m_A129; - m_A133 += m_A17 * f7_42; - m_A134 += m_A18 * f7_42; - RHS42 += f7_42 * RHS7; - const double f8 = 1.0 / m_A19; - const double f8_37 = -f8 * m_A101; - m_A107 += m_A20 * f8_37; - RHS37 += f8_37 * RHS8; - const double f9 = 1.0 / m_A21; - const double f9_37 = -f9 * m_A102; - m_A107 += m_A22 * f9_37; - RHS37 += f9_37 * RHS9; - const double f10 = 1.0 / m_A23; - const double f10_37 = -f10 * m_A103; - m_A107 += m_A24 * f10_37; - RHS37 += f10_37 * RHS10; - const double f11 = 1.0 / m_A25; - const double f11_37 = -f11 * m_A104; - m_A107 += m_A26 * f11_37; - RHS37 += f11_37 * RHS11; - const double f12 = 1.0 / m_A27; - const double f12_37 = -f12 * m_A105; - m_A107 += m_A28 * f12_37; - RHS37 += f12_37 * RHS12; - const double f13 = 1.0 / m_A29; - const double f13_38 = -f13 * m_A109; - m_A112 += m_A30 * f13_38; - RHS38 += f13_38 * RHS13; - const double f14 = 1.0 / m_A31; - const double f14_34 = -f14 * m_A86; - m_A92 += m_A32 * f14_34; - RHS34 += f14_34 * RHS14; - const double f15 = 1.0 / m_A33; - const double f15_41 = -f15 * m_A123; - m_A127 += m_A34 * f15_41; - RHS41 += f15_41 * RHS15; - const double f16 = 1.0 / m_A35; - const double f16_36 = -f16 * m_A98; - m_A99 += m_A36 * f16_36; - RHS36 += f16_36 * RHS16; - const double f17 = 1.0 / m_A37; - const double f17_40 = -f17 * m_A120; - m_A121 += m_A38 * f17_40; - RHS40 += f17_40 * RHS17; - const double f18 = 1.0 / m_A39; - const double f18_41 = -f18 * m_A124; - m_A127 += m_A40 * f18_41; - RHS41 += f18_41 * RHS18; - const double f19 = 1.0 / m_A41; - const double f19_41 = -f19 * m_A125; - m_A127 += m_A42 * f19_41; - RHS41 += f19_41 * RHS19; - const double f20 = 1.0 / m_A43; - const double f20_41 = -f20 * m_A126; - m_A127 += m_A44 * f20_41; - RHS41 += f20_41 * RHS20; - const double f21 = 1.0 / m_A45; - const double f21_42 = -f21 * m_A130; - m_A132 += m_A46 * f21_42; - m_A134 += m_A47 * f21_42; - m_A135 += m_A48 * f21_42; - RHS42 += f21_42 * RHS21; - const double f21_44 = -f21 * m_A139; - m_A144 += m_A46 * f21_44; - m_A151 += m_A47 * f21_44; - m_A153 += m_A48 * f21_44; - RHS44 += f21_44 * RHS21; - const double f22 = 1.0 / m_A49; - const double f22_34 = -f22 * m_A87; - m_A92 += m_A50 * f22_34; - RHS34 += f22_34 * RHS22; - const double f23 = 1.0 / m_A51; - const double f23_43 = -f23 * m_A136; - m_A137 += m_A52 * f23_43; - RHS43 += f23_43 * RHS23; - const double f24 = 1.0 / m_A55; - const double f24_32 = -f24 * m_A76; - m_A77 += m_A56 * f24_32; - RHS32 += f24_32 * RHS24; - const double f25 = 1.0 / m_A57; - const double f25_38 = -f25 * m_A110; - m_A112 += m_A58 * f25_38; - RHS38 += f25_38 * RHS25; - const double f26 = 1.0 / m_A59; - const double f26_34 = -f26 * m_A88; - m_A92 += m_A60 * f26_34; - RHS34 += f26_34 * RHS26; - const double f27 = 1.0 / m_A61; - const double f27_34 = -f27 * m_A89; - m_A92 += m_A62 * f27_34; - RHS34 += f27_34 * RHS27; - const double f28 = 1.0 / m_A63; - const double f28_34 = -f28 * m_A90; - m_A92 += m_A64 * f28_34; - RHS34 += f28_34 * RHS28; - const double f29 = 1.0 / m_A65; - const double f29_34 = -f29 * m_A91; - m_A92 += m_A66 * f29_34; - m_A93 += m_A67 * f29_34; - RHS34 += f29_34 * RHS29; - const double f29_44 = -f29 * m_A140; - m_A143 += m_A66 * f29_44; - m_A153 += m_A67 * f29_44; - RHS44 += f29_44 * RHS29; - const double f30 = 1.0 / m_A68; - const double f30_37 = -f30 * m_A106; - m_A107 += m_A69 * f30_37; - m_A108 += m_A70 * f30_37; - RHS37 += f30_37 * RHS30; - const double f30_44 = -f30 * m_A141; - m_A146 += m_A69 * f30_44; - m_A153 += m_A70 * f30_44; - RHS44 += f30_44 * RHS30; - const double f31 = 1.0 / m_A71; - const double f31_38 = -f31 * m_A111; - m_A112 += m_A72 * f31_38; - m_A113 += m_A73 * f31_38; - RHS38 += f31_38 * RHS31; - const double f31_44 = -f31 * m_A142; - m_A147 += m_A72 * f31_44; - m_A153 += m_A73 * f31_44; - RHS44 += f31_44 * RHS31; - const double f32 = 1.0 / m_A77; - const double f32_39 = -f32 * m_A116; - m_A118 += m_A78 * f32_39; - RHS39 += f32_39 * RHS32; - const double f33 = 1.0 / m_A83; - const double f33_39 = -f33 * m_A117; - m_A118 += m_A84 * f33_39; - m_A119 += m_A85 * f33_39; - RHS39 += f33_39 * RHS33; - const double f33_42 = -f33 * m_A131; - m_A133 += m_A84 * f33_42; - m_A134 += m_A85 * f33_42; - RHS42 += f33_42 * RHS33; - const double f34 = 1.0 / m_A92; - const double f34_44 = -f34 * m_A143; - m_A153 += m_A93 * f34_44; - RHS44 += f34_44 * RHS34; - const double f35 = 1.0 / m_A95; - const double f35_42 = -f35 * m_A132; - m_A133 += m_A96 * f35_42; - m_A134 += m_A97 * f35_42; - RHS42 += f35_42 * RHS35; - const double f35_44 = -f35 * m_A144; - m_A148 += m_A96 * f35_44; - m_A151 += m_A97 * f35_44; - RHS44 += f35_44 * RHS35; - const double f36 = 1.0 / m_A99; - const double f36_44 = -f36 * m_A145; - m_A153 += m_A100 * f36_44; - RHS44 += f36_44 * RHS36; - const double f37 = 1.0 / m_A107; - const double f37_44 = -f37 * m_A146; - m_A153 += m_A108 * f37_44; - RHS44 += f37_44 * RHS37; - const double f38 = 1.0 / m_A112; - const double f38_44 = -f38 * m_A147; - m_A153 += m_A113 * f38_44; - RHS44 += f38_44 * RHS38; - const double f39 = 1.0 / m_A118; - const double f39_42 = -f39 * m_A133; - m_A134 += m_A119 * f39_42; - RHS42 += f39_42 * RHS39; - const double f39_44 = -f39 * m_A148; - m_A151 += m_A119 * f39_44; - RHS44 += f39_44 * RHS39; - const double f40 = 1.0 / m_A121; - const double f40_44 = -f40 * m_A149; - m_A153 += m_A122 * f40_44; - RHS44 += f40_44 * RHS40; - const double f41 = 1.0 / m_A127; - const double f41_44 = -f41 * m_A150; - m_A153 += m_A128 * f41_44; - RHS44 += f41_44 * RHS41; - const double f42 = 1.0 / m_A134; - const double f42_44 = -f42 * m_A151; - m_A153 += m_A135 * f42_44; - RHS44 += f42_44 * RHS42; - const double f43 = 1.0 / m_A137; - const double f43_44 = -f43 * m_A152; - m_A153 += m_A138 * f43_44; - RHS44 += f43_44 * RHS43; - V[44] = RHS44 / m_A153; - double tmp43 = 0.0; - tmp43 += m_A138 * V[44]; - V[43] = (RHS43 - tmp43) / m_A137; - double tmp42 = 0.0; - tmp42 += m_A135 * V[44]; - V[42] = (RHS42 - tmp42) / m_A134; - double tmp41 = 0.0; - tmp41 += m_A128 * V[44]; - V[41] = (RHS41 - tmp41) / m_A127; - double tmp40 = 0.0; - tmp40 += m_A122 * V[44]; - V[40] = (RHS40 - tmp40) / m_A121; - double tmp39 = 0.0; - tmp39 += m_A119 * V[42]; - V[39] = (RHS39 - tmp39) / m_A118; - double tmp38 = 0.0; - tmp38 += m_A113 * V[44]; - V[38] = (RHS38 - tmp38) / m_A112; - double tmp37 = 0.0; - tmp37 += m_A108 * V[44]; - V[37] = (RHS37 - tmp37) / m_A107; - double tmp36 = 0.0; - tmp36 += m_A100 * V[44]; - V[36] = (RHS36 - tmp36) / m_A99; - double tmp35 = 0.0; - tmp35 += m_A96 * V[39]; - tmp35 += m_A97 * V[42]; - V[35] = (RHS35 - tmp35) / m_A95; - double tmp34 = 0.0; - tmp34 += m_A93 * V[44]; - V[34] = (RHS34 - tmp34) / m_A92; - double tmp33 = 0.0; - tmp33 += m_A84 * V[39]; - tmp33 += m_A85 * V[42]; - V[33] = (RHS33 - tmp33) / m_A83; - double tmp32 = 0.0; - tmp32 += m_A78 * V[39]; - V[32] = (RHS32 - tmp32) / m_A77; - double tmp31 = 0.0; - tmp31 += m_A72 * V[38]; - tmp31 += m_A73 * V[44]; - V[31] = (RHS31 - tmp31) / m_A71; - double tmp30 = 0.0; - tmp30 += m_A69 * V[37]; - tmp30 += m_A70 * V[44]; - V[30] = (RHS30 - tmp30) / m_A68; - double tmp29 = 0.0; - tmp29 += m_A66 * V[34]; - tmp29 += m_A67 * V[44]; - V[29] = (RHS29 - tmp29) / m_A65; - double tmp28 = 0.0; - tmp28 += m_A64 * V[34]; - V[28] = (RHS28 - tmp28) / m_A63; - double tmp27 = 0.0; - tmp27 += m_A62 * V[34]; - V[27] = (RHS27 - tmp27) / m_A61; - double tmp26 = 0.0; - tmp26 += m_A60 * V[34]; - V[26] = (RHS26 - tmp26) / m_A59; - double tmp25 = 0.0; - tmp25 += m_A58 * V[38]; - V[25] = (RHS25 - tmp25) / m_A57; - double tmp24 = 0.0; - tmp24 += m_A56 * V[32]; - V[24] = (RHS24 - tmp24) / m_A55; - double tmp23 = 0.0; - tmp23 += m_A52 * V[43]; - V[23] = (RHS23 - tmp23) / m_A51; - double tmp22 = 0.0; - tmp22 += m_A50 * V[34]; - V[22] = (RHS22 - tmp22) / m_A49; - double tmp21 = 0.0; - tmp21 += m_A46 * V[35]; - tmp21 += m_A47 * V[42]; - tmp21 += m_A48 * V[44]; - V[21] = (RHS21 - tmp21) / m_A45; - double tmp20 = 0.0; - tmp20 += m_A44 * V[41]; - V[20] = (RHS20 - tmp20) / m_A43; - double tmp19 = 0.0; - tmp19 += m_A42 * V[41]; - V[19] = (RHS19 - tmp19) / m_A41; - double tmp18 = 0.0; - tmp18 += m_A40 * V[41]; - V[18] = (RHS18 - tmp18) / m_A39; - double tmp17 = 0.0; - tmp17 += m_A38 * V[40]; - V[17] = (RHS17 - tmp17) / m_A37; - double tmp16 = 0.0; - tmp16 += m_A36 * V[36]; - V[16] = (RHS16 - tmp16) / m_A35; - double tmp15 = 0.0; - tmp15 += m_A34 * V[41]; - V[15] = (RHS15 - tmp15) / m_A33; - double tmp14 = 0.0; - tmp14 += m_A32 * V[34]; - V[14] = (RHS14 - tmp14) / m_A31; - double tmp13 = 0.0; - tmp13 += m_A30 * V[38]; - V[13] = (RHS13 - tmp13) / m_A29; - double tmp12 = 0.0; - tmp12 += m_A28 * V[37]; - V[12] = (RHS12 - tmp12) / m_A27; - double tmp11 = 0.0; - tmp11 += m_A26 * V[37]; - V[11] = (RHS11 - tmp11) / m_A25; - double tmp10 = 0.0; - tmp10 += m_A24 * V[37]; - V[10] = (RHS10 - tmp10) / m_A23; - double tmp9 = 0.0; - tmp9 += m_A22 * V[37]; - V[9] = (RHS9 - tmp9) / m_A21; - double tmp8 = 0.0; - tmp8 += m_A20 * V[37]; - V[8] = (RHS8 - tmp8) / m_A19; - double tmp7 = 0.0; - tmp7 += m_A17 * V[39]; - tmp7 += m_A18 * V[42]; - V[7] = (RHS7 - tmp7) / m_A16; - double tmp6 = 0.0; - tmp6 += m_A15 * V[33]; - V[6] = (RHS6 - tmp6) / m_A14; - double tmp5 = 0.0; - tmp5 += m_A12 * V[32]; - tmp5 += m_A13 * V[39]; - V[5] = (RHS5 - tmp5) / m_A11; - double tmp4 = 0.0; - tmp4 += m_A10 * V[24]; - V[4] = (RHS4 - tmp4) / m_A9; - double tmp3 = 0.0; - tmp3 += m_A7 * V[24]; - tmp3 += m_A8 * V[32]; - V[3] = (RHS3 - tmp3) / m_A6; - double tmp2 = 0.0; - tmp2 += m_A5 * V[33]; - V[2] = (RHS2 - tmp2) / m_A4; - double tmp1 = 0.0; - tmp1 += m_A3 * V[33]; - V[1] = (RHS1 - tmp1) / m_A2; - double tmp0 = 0.0; - tmp0 += m_A1 * V[33]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // sspeedr static void nl_gcr_3e833834e5ce5aee_13_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -20697,6 +20417,221 @@ static void nl_gcr_6041272373b8603c_178_double_double(double * __restrict V, con V[0] = (RHS0 - tmp0) / m_A0; } +// astrob +static void nl_gcr_62464664b1c5aa1e_27_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) + +{ + + plib::unused_var(cnV); + double m_A0(0.0); + double m_A1(0.0); + double m_A2(0.0); + double m_A3(0.0); + double m_A4(0.0); + double m_A5(0.0); + double m_A6(0.0); + double m_A7(0.0); + double m_A8(0.0); + double m_A9(0.0); + double m_A10(0.0); + double m_A11(0.0); + double m_A12(0.0); + double m_A13(0.0); + double m_A14(0.0); + double m_A15(0.0); + double m_A16(0.0); + double m_A17(0.0); + double m_A18(0.0); + double m_A19(0.0); + double m_A20(0.0); + double m_A21(0.0); + double m_A22(0.0); + double m_A23(0.0); + double m_A24(0.0); + double m_A25(0.0); + double m_A26(0.0); + m_A0 += gt[0]; + m_A0 += gt[1]; + m_A0 += gt[2]; + m_A0 += gt[3]; + m_A0 += gt[4]; + m_A0 += gt[5]; + m_A0 += gt[6]; + m_A1 += go[0]; + double RHS0 = Idr[0]; + RHS0 += Idr[1]; + RHS0 += Idr[2]; + RHS0 += Idr[3]; + RHS0 += Idr[4]; + RHS0 += Idr[5]; + RHS0 += Idr[6]; + RHS0 -= go[1] * *cnV[1]; + RHS0 -= go[2] * *cnV[2]; + RHS0 -= go[3] * *cnV[3]; + RHS0 -= go[4] * *cnV[4]; + RHS0 -= go[5] * *cnV[5]; + RHS0 -= go[6] * *cnV[6]; + m_A2 += gt[7]; + m_A2 += gt[8]; + m_A2 += gt[9]; + m_A4 += go[7]; + m_A3 += go[8]; + double RHS1 = Idr[7]; + RHS1 += Idr[8]; + RHS1 += Idr[9]; + RHS1 -= go[9] * *cnV[9]; + m_A5 += gt[10]; + m_A5 += gt[11]; + m_A5 += gt[12]; + m_A5 += gt[13]; + m_A5 += gt[14]; + m_A5 += gt[15]; + m_A5 += gt[16]; + m_A6 += go[10]; + double RHS2 = Idr[10]; + RHS2 += Idr[11]; + RHS2 += Idr[12]; + RHS2 += Idr[13]; + RHS2 += Idr[14]; + RHS2 += Idr[15]; + RHS2 += Idr[16]; + RHS2 -= go[11] * *cnV[11]; + RHS2 -= go[12] * *cnV[12]; + RHS2 -= go[13] * *cnV[13]; + RHS2 -= go[14] * *cnV[14]; + RHS2 -= go[15] * *cnV[15]; + RHS2 -= go[16] * *cnV[16]; + m_A7 += gt[17]; + m_A7 += gt[18]; + m_A7 += gt[19]; + m_A7 += gt[20]; + m_A9 += go[17]; + m_A10 += go[18]; + m_A8 += go[19]; + double RHS3 = Idr[17]; + RHS3 += Idr[18]; + RHS3 += Idr[19]; + RHS3 += Idr[20]; + RHS3 -= go[20] * *cnV[20]; + m_A14 += gt[21]; + m_A14 += gt[22]; + m_A14 += gt[23]; + m_A14 += gt[24]; + m_A14 += gt[25]; + m_A11 += go[21]; + m_A13 += go[22]; + m_A12 += go[23]; + double RHS4 = Idr[21]; + RHS4 += Idr[22]; + RHS4 += Idr[23]; + RHS4 += Idr[24]; + RHS4 += Idr[25]; + RHS4 -= go[24] * *cnV[24]; + RHS4 -= go[25] * *cnV[25]; + m_A19 += gt[26]; + m_A19 += gt[27]; + m_A19 += gt[28]; + m_A20 += go[26]; + m_A17 += go[27]; + double RHS5 = Idr[26]; + RHS5 += Idr[27]; + RHS5 += Idr[28]; + RHS5 -= go[28] * *cnV[28]; + m_A26 += gt[29]; + m_A26 += gt[30]; + m_A26 += gt[31]; + m_A26 += gt[32]; + m_A26 += gt[33]; + m_A26 += gt[34]; + m_A26 += gt[35]; + m_A26 += gt[36]; + m_A22 += go[29]; + m_A25 += go[30]; + m_A23 += go[31]; + m_A21 += go[32]; + double RHS6 = Idr[29]; + RHS6 += Idr[30]; + RHS6 += Idr[31]; + RHS6 += Idr[32]; + RHS6 += Idr[33]; + RHS6 += Idr[34]; + RHS6 += Idr[35]; + RHS6 += Idr[36]; + RHS6 -= go[33] * *cnV[33]; + RHS6 -= go[34] * *cnV[34]; + RHS6 -= go[35] * *cnV[35]; + RHS6 -= go[36] * *cnV[36]; + const double f0 = 1.0 / m_A0; + const double f0_4 = -f0 * m_A11; + m_A12 += m_A1 * f0_4; + RHS4 += f0_4 * RHS0; + const double f1 = 1.0 / m_A2; + const double f1_4 = -f1 * m_A12; + m_A14 += m_A3 * f1_4; + m_A16 += m_A4 * f1_4; + RHS4 += f1_4 * RHS1; + const double f1_6 = -f1 * m_A21; + m_A24 += m_A3 * f1_6; + m_A26 += m_A4 * f1_6; + RHS6 += f1_6 * RHS1; + const double f2 = 1.0 / m_A5; + const double f2_6 = -f2 * m_A22; + m_A25 += m_A6 * f2_6; + RHS6 += f2_6 * RHS2; + const double f3 = 1.0 / m_A7; + const double f3_4 = -f3 * m_A13; + m_A14 += m_A8 * f3_4; + m_A15 += m_A9 * f3_4; + m_A16 += m_A10 * f3_4; + RHS4 += f3_4 * RHS3; + const double f3_5 = -f3 * m_A17; + m_A18 += m_A8 * f3_5; + m_A19 += m_A9 * f3_5; + m_A20 += m_A10 * f3_5; + RHS5 += f3_5 * RHS3; + const double f3_6 = -f3 * m_A23; + m_A24 += m_A8 * f3_6; + m_A25 += m_A9 * f3_6; + m_A26 += m_A10 * f3_6; + RHS6 += f3_6 * RHS3; + const double f4 = 1.0 / m_A14; + const double f4_5 = -f4 * m_A18; + m_A19 += m_A15 * f4_5; + m_A20 += m_A16 * f4_5; + RHS5 += f4_5 * RHS4; + const double f4_6 = -f4 * m_A24; + m_A25 += m_A15 * f4_6; + m_A26 += m_A16 * f4_6; + RHS6 += f4_6 * RHS4; + const double f5 = 1.0 / m_A19; + const double f5_6 = -f5 * m_A25; + m_A26 += m_A20 * f5_6; + RHS6 += f5_6 * RHS5; + V[6] = RHS6 / m_A26; + double tmp5 = 0.0; + tmp5 += m_A20 * V[6]; + V[5] = (RHS5 - tmp5) / m_A19; + double tmp4 = 0.0; + tmp4 += m_A15 * V[5]; + tmp4 += m_A16 * V[6]; + V[4] = (RHS4 - tmp4) / m_A14; + double tmp3 = 0.0; + tmp3 += m_A8 * V[4]; + tmp3 += m_A9 * V[5]; + tmp3 += m_A10 * V[6]; + V[3] = (RHS3 - tmp3) / m_A7; + double tmp2 = 0.0; + tmp2 += m_A6 * V[5]; + V[2] = (RHS2 - tmp2) / m_A5; + double tmp1 = 0.0; + tmp1 += m_A3 * V[4]; + tmp1 += m_A4 * V[6]; + V[1] = (RHS1 - tmp1) / m_A2; + double tmp0 = 0.0; + tmp0 += m_A1 * V[1]; + V[0] = (RHS0 - tmp0) / m_A0; +} + // solarq static void nl_gcr_62612f71055b8fd4_303_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -41167,450 +41102,6 @@ static void nl_gcr_a6f74be7f61e6db2_29_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// astrob -static void nl_gcr_a7f11a2ba7b1e0de_61_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - plib::unused_var(cnV); - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - double m_A9(0.0); - double m_A10(0.0); - double m_A11(0.0); - double m_A12(0.0); - double m_A13(0.0); - double m_A14(0.0); - double m_A15(0.0); - double m_A16(0.0); - double m_A17(0.0); - double m_A18(0.0); - double m_A19(0.0); - double m_A20(0.0); - double m_A21(0.0); - double m_A22(0.0); - double m_A23(0.0); - double m_A24(0.0); - double m_A25(0.0); - double m_A26(0.0); - double m_A27(0.0); - double m_A28(0.0); - double m_A29(0.0); - double m_A30(0.0); - double m_A31(0.0); - double m_A32(0.0); - double m_A33(0.0); - double m_A34(0.0); - double m_A35(0.0); - double m_A36(0.0); - double m_A37(0.0); - double m_A38(0.0); - double m_A39(0.0); - double m_A40(0.0); - double m_A41(0.0); - double m_A42(0.0); - double m_A43(0.0); - double m_A44(0.0); - double m_A45(0.0); - double m_A46(0.0); - double m_A47(0.0); - double m_A48(0.0); - double m_A49(0.0); - double m_A50(0.0); - double m_A51(0.0); - double m_A52(0.0); - double m_A53(0.0); - double m_A54(0.0); - double m_A55(0.0); - double m_A56(0.0); - double m_A57(0.0); - double m_A58(0.0); - double m_A59(0.0); - double m_A60(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A0 += gt[2]; - m_A0 += gt[3]; - m_A0 += gt[4]; - m_A0 += gt[5]; - m_A0 += gt[6]; - m_A1 += go[0]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - RHS0 += Idr[2]; - RHS0 += Idr[3]; - RHS0 += Idr[4]; - RHS0 += Idr[5]; - RHS0 += Idr[6]; - RHS0 -= go[1] * *cnV[1]; - RHS0 -= go[2] * *cnV[2]; - RHS0 -= go[3] * *cnV[3]; - RHS0 -= go[4] * *cnV[4]; - RHS0 -= go[5] * *cnV[5]; - RHS0 -= go[6] * *cnV[6]; - m_A2 += gt[7]; - m_A2 += gt[8]; - m_A2 += gt[9]; - m_A4 += go[7]; - m_A3 += go[8]; - double RHS1 = Idr[7]; - RHS1 += Idr[8]; - RHS1 += Idr[9]; - RHS1 -= go[9] * *cnV[9]; - m_A5 += gt[10]; - m_A5 += gt[11]; - m_A5 += gt[12]; - m_A5 += gt[13]; - m_A5 += gt[14]; - m_A5 += gt[15]; - m_A5 += gt[16]; - m_A6 += go[10]; - double RHS2 = Idr[10]; - RHS2 += Idr[11]; - RHS2 += Idr[12]; - RHS2 += Idr[13]; - RHS2 += Idr[14]; - RHS2 += Idr[15]; - RHS2 += Idr[16]; - RHS2 -= go[11] * *cnV[11]; - RHS2 -= go[12] * *cnV[12]; - RHS2 -= go[13] * *cnV[13]; - RHS2 -= go[14] * *cnV[14]; - RHS2 -= go[15] * *cnV[15]; - RHS2 -= go[16] * *cnV[16]; - m_A7 += gt[17]; - m_A7 += gt[18]; - m_A7 += gt[19]; - m_A7 += gt[20]; - m_A8 += go[17]; - m_A10 += go[18]; - m_A9 += go[19]; - double RHS3 = Idr[17]; - RHS3 += Idr[18]; - RHS3 += Idr[19]; - RHS3 += Idr[20]; - RHS3 -= go[20] * *cnV[20]; - m_A13 += gt[21]; - m_A13 += gt[22]; - m_A13 += gt[23]; - m_A11 += go[21]; - double RHS4 = Idr[21]; - RHS4 += Idr[22]; - RHS4 += Idr[23]; - RHS4 -= go[22] * *cnV[22]; - RHS4 -= go[23] * *cnV[23]; - m_A16 += gt[24]; - m_A16 += gt[25]; - m_A16 += gt[26]; - m_A16 += gt[27]; - m_A16 += gt[28]; - m_A16 += gt[29]; - m_A16 += gt[30]; - m_A17 += go[24]; - double RHS5 = Idr[24]; - RHS5 += Idr[25]; - RHS5 += Idr[26]; - RHS5 += Idr[27]; - RHS5 += Idr[28]; - RHS5 += Idr[29]; - RHS5 += Idr[30]; - RHS5 -= go[25] * *cnV[25]; - RHS5 -= go[26] * *cnV[26]; - RHS5 -= go[27] * *cnV[27]; - RHS5 -= go[28] * *cnV[28]; - RHS5 -= go[29] * *cnV[29]; - RHS5 -= go[30] * *cnV[30]; - m_A18 += gt[31]; - m_A18 += gt[32]; - m_A18 += gt[33]; - m_A18 += gt[34]; - m_A18 += gt[35]; - m_A18 += gt[36]; - m_A18 += gt[37]; - m_A19 += go[31]; - double RHS6 = Idr[31]; - RHS6 += Idr[32]; - RHS6 += Idr[33]; - RHS6 += Idr[34]; - RHS6 += Idr[35]; - RHS6 += Idr[36]; - RHS6 += Idr[37]; - RHS6 -= go[32] * *cnV[32]; - RHS6 -= go[33] * *cnV[33]; - RHS6 -= go[34] * *cnV[34]; - RHS6 -= go[35] * *cnV[35]; - RHS6 -= go[36] * *cnV[36]; - RHS6 -= go[37] * *cnV[37]; - m_A20 += gt[38]; - m_A20 += gt[39]; - m_A20 += gt[40]; - m_A22 += go[38]; - m_A21 += go[39]; - double RHS7 = Idr[38]; - RHS7 += Idr[39]; - RHS7 += Idr[40]; - RHS7 -= go[40] * *cnV[40]; - m_A23 += gt[41]; - m_A23 += gt[42]; - m_A23 += gt[43]; - m_A23 += gt[44]; - m_A25 += go[41]; - m_A26 += go[42]; - m_A24 += go[43]; - double RHS8 = Idr[41]; - RHS8 += Idr[42]; - RHS8 += Idr[43]; - RHS8 += Idr[44]; - RHS8 -= go[44] * *cnV[44]; - m_A28 += gt[45]; - m_A28 += gt[46]; - m_A28 += gt[47]; - m_A30 += go[45]; - m_A27 += go[46]; - double RHS9 = Idr[45]; - RHS9 += Idr[46]; - RHS9 += Idr[47]; - RHS9 -= go[47] * *cnV[47]; - m_A37 += gt[48]; - m_A37 += gt[49]; - m_A37 += gt[50]; - m_A37 += gt[51]; - m_A37 += gt[52]; - m_A37 += gt[53]; - m_A37 += gt[54]; - m_A33 += go[48]; - m_A35 += go[49]; - m_A34 += go[50]; - m_A32 += go[51]; - m_A31 += go[52]; - double RHS10 = Idr[48]; - RHS10 += Idr[49]; - RHS10 += Idr[50]; - RHS10 += Idr[51]; - RHS10 += Idr[52]; - RHS10 += Idr[53]; - RHS10 += Idr[54]; - RHS10 -= go[53] * *cnV[53]; - RHS10 -= go[54] * *cnV[54]; - m_A43 += gt[55]; - m_A43 += gt[56]; - m_A43 += gt[57]; - m_A45 += go[55]; - m_A41 += go[56]; - double RHS11 = Idr[55]; - RHS11 += Idr[56]; - RHS11 += Idr[57]; - RHS11 -= go[57] * *cnV[57]; - m_A52 += gt[58]; - m_A52 += gt[59]; - m_A52 += gt[60]; - m_A52 += gt[61]; - m_A52 += gt[62]; - m_A52 += gt[63]; - m_A52 += gt[64]; - m_A47 += go[58]; - m_A49 += go[59]; - m_A48 += go[60]; - m_A46 += go[61]; - double RHS12 = Idr[58]; - RHS12 += Idr[59]; - RHS12 += Idr[60]; - RHS12 += Idr[61]; - RHS12 += Idr[62]; - RHS12 += Idr[63]; - RHS12 += Idr[64]; - RHS12 -= go[62] * *cnV[62]; - RHS12 -= go[63] * *cnV[63]; - RHS12 -= go[64] * *cnV[64]; - m_A60 += gt[65]; - m_A60 += gt[66]; - m_A60 += gt[67]; - m_A60 += gt[68]; - m_A60 += gt[69]; - m_A60 += gt[70]; - m_A60 += gt[71]; - m_A54 += go[65]; - m_A58 += go[66]; - m_A56 += go[67]; - m_A55 += go[68]; - double RHS13 = Idr[65]; - RHS13 += Idr[66]; - RHS13 += Idr[67]; - RHS13 += Idr[68]; - RHS13 += Idr[69]; - RHS13 += Idr[70]; - RHS13 += Idr[71]; - RHS13 -= go[69] * *cnV[69]; - RHS13 -= go[70] * *cnV[70]; - RHS13 -= go[71] * *cnV[71]; - const double f0 = 1.0 / m_A0; - const double f0_4 = -f0 * m_A11; - m_A12 += m_A1 * f0_4; - RHS4 += f0_4 * RHS0; - const double f1 = 1.0 / m_A2; - const double f1_4 = -f1 * m_A12; - m_A14 += m_A3 * f1_4; - m_A15 += m_A4 * f1_4; - RHS4 += f1_4 * RHS1; - const double f1_10 = -f1 * m_A31; - m_A37 += m_A3 * f1_10; - m_A39 += m_A4 * f1_10; - RHS10 += f1_10 * RHS1; - const double f1_12 = -f1 * m_A46; - m_A50 += m_A3 * f1_12; - m_A52 += m_A4 * f1_12; - RHS12 += f1_12 * RHS1; - const double f2 = 1.0 / m_A5; - const double f2_12 = -f2 * m_A47; - m_A49 += m_A6 * f2_12; - RHS12 += f2_12 * RHS2; - const double f3 = 1.0 / m_A7; - const double f3_9 = -f3 * m_A27; - m_A28 += m_A8 * f3_9; - m_A29 += m_A9 * f3_9; - m_A30 += m_A10 * f3_9; - RHS9 += f3_9 * RHS3; - const double f3_10 = -f3 * m_A32; - m_A36 += m_A8 * f3_10; - m_A37 += m_A9 * f3_10; - m_A39 += m_A10 * f3_10; - RHS10 += f3_10 * RHS3; - const double f3_12 = -f3 * m_A48; - m_A49 += m_A8 * f3_12; - m_A50 += m_A9 * f3_12; - m_A52 += m_A10 * f3_12; - RHS12 += f3_12 * RHS3; - const double f5 = 1.0 / m_A16; - const double f5_10 = -f5 * m_A33; - m_A34 += m_A17 * f5_10; - RHS10 += f5_10 * RHS5; - const double f6 = 1.0 / m_A18; - const double f6_13 = -f6 * m_A54; - m_A58 += m_A19 * f6_13; - RHS13 += f6_13 * RHS6; - const double f7 = 1.0 / m_A20; - const double f7_10 = -f7 * m_A34; - m_A37 += m_A21 * f7_10; - m_A40 += m_A22 * f7_10; - RHS10 += f7_10 * RHS7; - const double f7_13 = -f7 * m_A55; - m_A57 += m_A21 * f7_13; - m_A60 += m_A22 * f7_13; - RHS13 += f7_13 * RHS7; - const double f8 = 1.0 / m_A23; - const double f8_10 = -f8 * m_A35; - m_A37 += m_A24 * f8_10; - m_A38 += m_A25 * f8_10; - m_A40 += m_A26 * f8_10; - RHS10 += f8_10 * RHS8; - const double f8_11 = -f8 * m_A41; - m_A42 += m_A24 * f8_11; - m_A43 += m_A25 * f8_11; - m_A45 += m_A26 * f8_11; - RHS11 += f8_11 * RHS8; - const double f8_13 = -f8 * m_A56; - m_A57 += m_A24 * f8_13; - m_A58 += m_A25 * f8_13; - m_A60 += m_A26 * f8_13; - RHS13 += f8_13 * RHS8; - const double f9 = 1.0 / m_A28; - const double f9_10 = -f9 * m_A36; - m_A37 += m_A29 * f9_10; - m_A39 += m_A30 * f9_10; - RHS10 += f9_10 * RHS9; - const double f9_12 = -f9 * m_A49; - m_A50 += m_A29 * f9_12; - m_A52 += m_A30 * f9_12; - RHS12 += f9_12 * RHS9; - const double f10 = 1.0 / m_A37; - const double f10_11 = -f10 * m_A42; - m_A43 += m_A38 * f10_11; - m_A44 += m_A39 * f10_11; - m_A45 += m_A40 * f10_11; - RHS11 += f10_11 * RHS10; - const double f10_12 = -f10 * m_A50; - m_A51 += m_A38 * f10_12; - m_A52 += m_A39 * f10_12; - m_A53 += m_A40 * f10_12; - RHS12 += f10_12 * RHS10; - const double f10_13 = -f10 * m_A57; - m_A58 += m_A38 * f10_13; - m_A59 += m_A39 * f10_13; - m_A60 += m_A40 * f10_13; - RHS13 += f10_13 * RHS10; - const double f11 = 1.0 / m_A43; - const double f11_12 = -f11 * m_A51; - m_A52 += m_A44 * f11_12; - m_A53 += m_A45 * f11_12; - RHS12 += f11_12 * RHS11; - const double f11_13 = -f11 * m_A58; - m_A59 += m_A44 * f11_13; - m_A60 += m_A45 * f11_13; - RHS13 += f11_13 * RHS11; - const double f12 = 1.0 / m_A52; - const double f12_13 = -f12 * m_A59; - m_A60 += m_A53 * f12_13; - RHS13 += f12_13 * RHS12; - V[13] = RHS13 / m_A60; - double tmp12 = 0.0; - tmp12 += m_A53 * V[13]; - V[12] = (RHS12 - tmp12) / m_A52; - double tmp11 = 0.0; - tmp11 += m_A44 * V[12]; - tmp11 += m_A45 * V[13]; - V[11] = (RHS11 - tmp11) / m_A43; - double tmp10 = 0.0; - tmp10 += m_A38 * V[11]; - tmp10 += m_A39 * V[12]; - tmp10 += m_A40 * V[13]; - V[10] = (RHS10 - tmp10) / m_A37; - double tmp9 = 0.0; - tmp9 += m_A29 * V[10]; - tmp9 += m_A30 * V[12]; - V[9] = (RHS9 - tmp9) / m_A28; - double tmp8 = 0.0; - tmp8 += m_A24 * V[10]; - tmp8 += m_A25 * V[11]; - tmp8 += m_A26 * V[13]; - V[8] = (RHS8 - tmp8) / m_A23; - double tmp7 = 0.0; - tmp7 += m_A21 * V[10]; - tmp7 += m_A22 * V[13]; - V[7] = (RHS7 - tmp7) / m_A20; - double tmp6 = 0.0; - tmp6 += m_A19 * V[11]; - V[6] = (RHS6 - tmp6) / m_A18; - double tmp5 = 0.0; - tmp5 += m_A17 * V[7]; - V[5] = (RHS5 - tmp5) / m_A16; - double tmp4 = 0.0; - tmp4 += m_A14 * V[10]; - tmp4 += m_A15 * V[12]; - V[4] = (RHS4 - tmp4) / m_A13; - double tmp3 = 0.0; - tmp3 += m_A8 * V[9]; - tmp3 += m_A9 * V[10]; - tmp3 += m_A10 * V[12]; - V[3] = (RHS3 - tmp3) / m_A7; - double tmp2 = 0.0; - tmp2 += m_A6 * V[9]; - V[2] = (RHS2 - tmp2) / m_A5; - double tmp1 = 0.0; - tmp1 += m_A3 * V[10]; - tmp1 += m_A4 * V[12]; - V[1] = (RHS1 - tmp1) / m_A2; - double tmp0 = 0.0; - tmp0 += m_A1 * V[1]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // carpolo static void nl_gcr_a8f1d076330f06b7_34_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -66683,62 +66174,6 @@ static void nl_gcr_ef2f49641f433a74_94_double_double(double * __restrict V, cons V[0] = (RHS0 - tmp0) / m_A0; } -// astrob -static void nl_gcr_efd052e6829c33e_9_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) - -{ - - plib::unused_var(cnV); - double m_A0(0.0); - double m_A1(0.0); - double m_A2(0.0); - double m_A3(0.0); - double m_A4(0.0); - double m_A5(0.0); - double m_A6(0.0); - double m_A7(0.0); - double m_A8(0.0); - m_A0 += gt[0]; - m_A0 += gt[1]; - m_A2 += go[0]; - m_A1 += go[1]; - double RHS0 = Idr[0]; - RHS0 += Idr[1]; - m_A4 += gt[2]; - m_A4 += gt[3]; - m_A5 += go[2]; - m_A3 += go[3]; - double RHS1 = Idr[2]; - RHS1 += Idr[3]; - m_A8 += gt[4]; - m_A8 += gt[5]; - m_A7 += go[4]; - m_A6 += go[5]; - double RHS2 = Idr[4]; - RHS2 += Idr[5]; - const double f0 = 1.0 / m_A0; - const double f0_1 = -f0 * m_A3; - m_A4 += m_A1 * f0_1; - m_A5 += m_A2 * f0_1; - RHS1 += f0_1 * RHS0; - const double f0_2 = -f0 * m_A6; - m_A7 += m_A1 * f0_2; - m_A8 += m_A2 * f0_2; - RHS2 += f0_2 * RHS0; - const double f1 = 1.0 / m_A4; - const double f1_2 = -f1 * m_A7; - m_A8 += m_A5 * f1_2; - RHS2 += f1_2 * RHS1; - V[2] = RHS2 / m_A8; - double tmp1 = 0.0; - tmp1 += m_A5 * V[2]; - V[1] = (RHS1 - tmp1) / m_A4; - double tmp0 = 0.0; - tmp0 += m_A1 * V[1]; - tmp0 += m_A2 * V[2]; - V[0] = (RHS0 - tmp0) / m_A0; -} - // spacfury static void nl_gcr_f365c3863b050e35_45_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) @@ -72910,16 +72345,14 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_124f7aa10f044582_16_double_double", reinterpret_cast<void *>(&nl_gcr_124f7aa10f044582_16_double_double)}, // armora {"nl_gcr_1250f340dea396ae_22_double_double", reinterpret_cast<void *>(&nl_gcr_1250f340dea396ae_22_double_double)}, +// astrob + {"nl_gcr_13833bf8c127deaa_154_double_double", reinterpret_cast<void *>(&nl_gcr_13833bf8c127deaa_154_double_double)}, // pongf {"nl_gcr_13e7b5ac1a260dbf_10_double_double", reinterpret_cast<void *>(&nl_gcr_13e7b5ac1a260dbf_10_double_double)}, // tailg {"nl_gcr_144ed14e6bafdb_119_double_double", reinterpret_cast<void *>(&nl_gcr_144ed14e6bafdb_119_double_double)}, -// astrob - {"nl_gcr_15b7648945a58fb_27_double_double", reinterpret_cast<void *>(&nl_gcr_15b7648945a58fb_27_double_double)}, // spacewar {"nl_gcr_15e8f6fb021de0f9_28_double_double", reinterpret_cast<void *>(&nl_gcr_15e8f6fb021de0f9_28_double_double)}, -// armora - {"nl_gcr_1692de755a535408_9_double_double", reinterpret_cast<void *>(&nl_gcr_1692de755a535408_9_double_double)}, // dpatrol {"nl_gcr_18f4d9160b51d613_20_double_double", reinterpret_cast<void *>(&nl_gcr_18f4d9160b51d613_20_double_double)}, // starhawk @@ -72948,8 +72381,6 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_339c6b457f339538_159_double_double", reinterpret_cast<void *>(&nl_gcr_339c6b457f339538_159_double_double)}, // solarq {"nl_gcr_34e910fc1896999f_76_double_double", reinterpret_cast<void *>(&nl_gcr_34e910fc1896999f_76_double_double)}, -// astrob - {"nl_gcr_37b9bb3472eec580_154_double_double", reinterpret_cast<void *>(&nl_gcr_37b9bb3472eec580_154_double_double)}, // sspeedr {"nl_gcr_3e833834e5ce5aee_13_double_double", reinterpret_cast<void *>(&nl_gcr_3e833834e5ce5aee_13_double_double)}, // astrob @@ -73002,6 +72433,8 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_5d550fc7441617a2_109_double_double", reinterpret_cast<void *>(&nl_gcr_5d550fc7441617a2_109_double_double)}, // zac1b11142 {"nl_gcr_6041272373b8603c_178_double_double", reinterpret_cast<void *>(&nl_gcr_6041272373b8603c_178_double_double)}, +// astrob + {"nl_gcr_62464664b1c5aa1e_27_double_double", reinterpret_cast<void *>(&nl_gcr_62464664b1c5aa1e_27_double_double)}, // solarq {"nl_gcr_62612f71055b8fd4_303_double_double", reinterpret_cast<void *>(&nl_gcr_62612f71055b8fd4_303_double_double)}, // konami1x @@ -73126,8 +72559,6 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_a6cfda6668b153c2_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6cfda6668b153c2_22_double_double)}, // boxingb {"nl_gcr_a6f74be7f61e6db2_29_double_double", reinterpret_cast<void *>(&nl_gcr_a6f74be7f61e6db2_29_double_double)}, -// astrob - {"nl_gcr_a7f11a2ba7b1e0de_61_double_double", reinterpret_cast<void *>(&nl_gcr_a7f11a2ba7b1e0de_61_double_double)}, // carpolo {"nl_gcr_a8f1d076330f06b7_34_double_double", reinterpret_cast<void *>(&nl_gcr_a8f1d076330f06b7_34_double_double)}, // breakout @@ -73272,8 +72703,6 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { {"nl_gcr_ee61dcaa355fc625_285_double_double", reinterpret_cast<void *>(&nl_gcr_ee61dcaa355fc625_285_double_double)}, // starcrus {"nl_gcr_ef2f49641f433a74_94_double_double", reinterpret_cast<void *>(&nl_gcr_ef2f49641f433a74_94_double_double)}, -// astrob - {"nl_gcr_efd052e6829c33e_9_double_double", reinterpret_cast<void *>(&nl_gcr_efd052e6829c33e_9_double_double)}, // spacfury {"nl_gcr_f365c3863b050e35_45_double_double", reinterpret_cast<void *>(&nl_gcr_f365c3863b050e35_45_double_double)}, // spacfury diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 10dc7cf635c..7e0e5f0425f 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -106,7 +106,6 @@ namespace netlist netlist_state_t::netlist_state_t(const pstring &name, plib::plog_delegate logger) : m_log(logger) - , m_extended_validation(false) , m_dummy_version(1) { m_setup = plib::make_unique<setup_t, host_arena>(*this); diff --git a/src/lib/netlist/nl_errstr.h b/src/lib/netlist/nl_errstr.h index 4b44fb7b963..f60287e7a2d 100644 --- a/src/lib/netlist/nl_errstr.h +++ b/src/lib/netlist/nl_errstr.h @@ -150,6 +150,17 @@ namespace netlist PERRMSGV(MI_NO_SPECIFIC_SOLVER, 1, "No specific solver found for netlist of size {1}") PERRMSGV(MW_SOLVER_METHOD_NOT_SUPPORTED, 2, "Solver method {1} not supported. Falling back to {2}") + PERRMSGV(ME_SOLVER_CONSISTENCY_NOT_ANALOG_NET, 1, "Solver consistency: {1} is not an analog net") + PERRMSGV(ME_SOLVER_CONSISTENCY_RAIL_NET, 1, "Solver consistency: {1} is a rail net") + PERRMSGV(ME_SOLVER_TERMINAL_NO_NET, 1, "Solver consistency: Terminal {1} has no net") + PERRMSGV(ME_SOLVER_NO_RAIL_TERMINAL, 1, "Solver consistency: No rail terminals in group with nets: {1}\n" + "At least one rail terminal (like ANALOG_INPUT) needs to be part of a group of nets\n" + "solved by a solver. Without a singular matrix would be created\n" + "which has the potential to cause a crash now or in the future.\n" + "A common cause of this error are BJT or FET devices which\n" + "are defined but not used in the netlist.") + PERRMSGV(MF_SOLVER_CONSISTENCY_ERRORS, 1, "Found {1} errors during solver consistency test") + // nld_mm5837.cpp PERRMSGV(MW_FREQUENCY_OUTSIDE_OF_SPECS_1, 1, "MM5837: Frequency outside of specs: {1}") diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 11584bceb48..d28ba51e476 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -9,6 +9,7 @@ #include "nl_factory.h" #include "nl_parser.h" #include "nl_setup.h" +#include "nl_errstr.h" #include "plib/penum.h" #include "plib/pstonum.h" #include "plib/pstrutil.h" @@ -1192,6 +1193,7 @@ void setup_t::resolve_inputs() log().warning(MW_TERMINAL_1_WITHOUT_CONNECTIONS(name_da)); } } + log().verbose("checking tristate consistency ..."); for (auto & i : m_terminals) { diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 44b96bf0d6d..313ec4e8b2e 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -82,7 +82,6 @@ public: opt_type(*this, "y", "type", 0, std::vector<pstring>({"spice","eagle","rinf"}), "type of file to be converted: spice,eagle,rinf"), opt_grp6(*this, "Options for validate command", "These options are only used by the validate command."), - opt_extended_validation(*this, "", "extended", "Identify issues with power terminals."), opt_grp7(*this, "Options for header command", "These options are only used by the header command."), opt_tabwidth(*this, "", "tab-width", 4, "Tab width for output."), @@ -153,7 +152,6 @@ private: plib::option_str_limit<unsigned> opt_type; plib::option_group opt_grp6; - plib::option_bool opt_extended_validation; plib::option_group opt_grp7; plib::option_num<unsigned> opt_tabwidth; plib::option_num<unsigned> opt_linewidth; @@ -548,8 +546,6 @@ void tool_app_t::validate() m_errors = 0; m_warnings = 0; - nt.set_extended_validation(opt_extended_validation()); - try { nt.read_netlist(opt_files()[0], opt_name(), diff --git a/src/lib/netlist/solver/nld_ms_gcr.h b/src/lib/netlist/solver/nld_ms_gcr.h index 5d8440e5d1d..71388dc867e 100644 --- a/src/lib/netlist/solver/nld_ms_gcr.h +++ b/src/lib/netlist/solver/nld_ms_gcr.h @@ -93,10 +93,7 @@ namespace solver // FIXME: Move me // - // During extended validation there is no reason to check for - // differences in the generated code since during - // extended validation this will be different (and non-functional) - if (!this->state().is_extended_validation() && this->state().static_solver_lib().isLoaded()) + if (this->state().static_solver_lib().isLoaded()) { pstring symname = static_compile_name(); m_proc.load(this->state().static_solver_lib(), symname); diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index a9ff476728d..cd669256608 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -3,6 +3,7 @@ #include "nl_factory.h" +#include "nl_errstr.h" #include "core/setup.h" #include "nl_setup.h" // FIXME: only needed for splitter code #include "nld_matrix_solver.h" @@ -380,9 +381,55 @@ namespace devices net_splitter splitter; splitter.run(state()); + log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), state().nets().size()); + + int num_errors = 0; + + log().verbose("checking net consistency ..."); + for (const auto &grp : splitter.groups) + { + int railterms = 0; + pstring nets_in_grp; + for (const auto &n : grp) + { + nets_in_grp += (n->name() + " "); + if (!n->is_analog()) + { + state().log().error(ME_SOLVER_CONSISTENCY_NOT_ANALOG_NET(n->name())); + num_errors++; + } + if (n->is_rail_net()) + { + state().log().error(ME_SOLVER_CONSISTENCY_RAIL_NET(n->name())); + num_errors++; + } + for (const auto &t : n->core_terms()) + { + if (!t->has_net()) + { + state().log().error(ME_SOLVER_TERMINAL_NO_NET(t->name())); + num_errors++; + } + else + { + auto *otherterm = dynamic_cast<terminal_t *>(t); + if (otherterm != nullptr) + if (state().setup().get_connected_terminal(*otherterm)->net().is_rail_net()) + railterms++; + } + } + } + if (railterms == 0) + { + state().log().error(ME_SOLVER_NO_RAIL_TERMINAL(nets_in_grp)); + num_errors++; + } + } + if (num_errors > 0) + throw nl_exception(MF_SOLVER_CONSISTENCY_ERRORS(num_errors)); + // setup the solvers - log().verbose("Found {1} net groups in {2} nets\n", splitter.groups.size(), state().nets().size()); for (auto & grp : splitter.groups) { solver_ptr ms; diff --git a/src/lib/util/avhuff.cpp b/src/lib/util/avhuff.cpp index 50eea9f24dc..ac5cea71526 100644 --- a/src/lib/util/avhuff.cpp +++ b/src/lib/util/avhuff.cpp @@ -691,24 +691,19 @@ avhuff_decoder::avhuff_decoder() } /** - * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) + * @fn void avhuff_decoder::configure(const config &cfg) * * @brief ------------------------------------------------- * configure - configure decompression parameters * -------------------------------------------------. * - * @param config The configuration. + * @param cfg The configuration. */ -void avhuff_decoder::configure(const avhuff_decompress_config &config) +void avhuff_decoder::configure(const config &cfg) { - m_config.video.wrap(config.video, config.video.cliprect()); - m_config.maxsamples = config.maxsamples; - m_config.actsamples = config.actsamples; - memcpy(m_config.audio, config.audio, sizeof(m_config.audio)); - m_config.maxmetalength = config.maxmetalength; - m_config.actmetalength = config.actmetalength; - m_config.metadata = config.metadata; + m_video.wrap(*cfg.video, cfg.video->cliprect()); + m_config = cfg; } /** @@ -792,9 +787,9 @@ avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complen // determine the start of each piece of data metastart = m_config.metadata; for (int chnum = 0; chnum < channels; chnum++) - audiostart[chnum] = (uint8_t *)m_config.audio[chnum]; - videostart = (m_config.video.valid()) ? reinterpret_cast<uint8_t *>(&m_config.video.pix(0)) : nullptr; - videostride = (m_config.video.valid()) ? m_config.video.rowpixels() * 2 : 0; + audiostart[chnum] = reinterpret_cast<uint8_t *>(m_config.audio[chnum]); + videostart = m_video.valid() ? reinterpret_cast<uint8_t *>(&m_video.pix(0)) : nullptr; + videostride = m_video.valid() ? m_video.rowpixels() * 2 : 0; // data is assumed to be native-endian uint16_t betest = 0; @@ -802,7 +797,7 @@ avhuff_error avhuff_decoder::decode_data(const uint8_t *source, uint32_t complen audioxor = videoxor = (betest == 1) ? 1 : 0; // verify against sizes - if (m_config.video.valid() && (m_config.video.width() < width || m_config.video.height() < height)) + if (m_video.valid() && (m_video.width() < width || m_video.height() < height)) return AVHERR_VIDEO_TOO_LARGE; for (int chnum = 0; chnum < channels; chnum++) if (m_config.audio[chnum] != nullptr && m_config.maxsamples < samples) diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h index 90ef43e977f..83b46195d6b 100644 --- a/src/lib/util/avhuff.h +++ b/src/lib/util/avhuff.h @@ -19,6 +19,8 @@ #include "huffman.h" #include "flac.h" +#include <algorithm> + //************************************************************************** // CONSTANTS @@ -49,32 +51,6 @@ enum avhuff_error // TYPE DEFINITIONS //************************************************************************** -// ======================> av_codec_decompress_config - -// decompression configuration -class avhuff_decompress_config -{ -public: - avhuff_decompress_config() - : maxsamples(0), - actsamples(nullptr), - maxmetalength(0), - actmetalength(nullptr), - metadata(nullptr) - { - memset(audio, 0, sizeof(audio)); - } - - bitmap_yuy16 video; // pointer to video bitmap - uint32_t maxsamples; // maximum number of samples per channel - uint32_t * actsamples; // actual number of samples per channel - int16_t * audio[16]; // pointer to individual audio channels - uint32_t maxmetalength; // maximum length of metadata - uint32_t * actmetalength; // actual length of metadata - uint8_t * metadata; // pointer to metadata buffer -}; - - // ======================> avhuff_encoder // core state for the codec @@ -98,8 +74,7 @@ private: { public: // construction/destruction - deltarle_encoder() - : m_rlecount(0) { } + deltarle_encoder() { } // histogramming uint16_t *rle_and_histo_bitmap(const uint8_t *source, uint32_t items_per_row, uint32_t item_advance, uint32_t row_count); @@ -111,7 +86,7 @@ private: private: // internal state - int m_rlecount; + int m_rlecount = 0; huffman_encoder<256 + 16> m_encoder; std::vector<uint16_t> m_rlebuffer; }; @@ -143,11 +118,30 @@ private: class avhuff_decoder { public: + // decompression configuration + class config + { + public: + config() + { + std::fill(std::begin(audio), std::end(audio), nullptr); + } + + bitmap_yuy16 * video = nullptr; // pointer to video bitmap + uint32_t maxsamples = 0; // maximum number of samples per channel + uint32_t * actsamples = nullptr; // actual number of samples per channel + int16_t * audio[16]; // pointer to individual audio channels + uint32_t maxmetalength = 0; // maximum length of metadata + uint32_t * actmetalength = nullptr; // actual length of metadata + uint8_t * metadata = nullptr; // pointer to metadata buffer + }; + + // construction/destruction avhuff_decoder(); // configuration - void configure(const avhuff_decompress_config &config); + void configure(const config &cfg); // encode/decode avhuff_error decode_data(const uint8_t *source, uint32_t complength, uint8_t *dest); @@ -158,8 +152,7 @@ private: { public: // construction/destruction - deltarle_decoder() - : m_rlecount(0), m_prevdata(0) { } + deltarle_decoder() { } // general void reset() { m_rlecount = m_prevdata = 0; } @@ -171,8 +164,8 @@ private: private: // internal state - int m_rlecount; - uint8_t m_prevdata; + int m_rlecount = 0; + uint8_t m_prevdata = 0; huffman_decoder<256 + 16> m_decoder; }; @@ -183,7 +176,8 @@ private: avhuff_error decode_video_lossless(int width, int height, const uint8_t *source, uint32_t complength, uint8_t *dest, uint32_t dstride, uint32_t dxor); // internal state - avhuff_decompress_config m_config; + bitmap_yuy16 m_video; + config m_config; // video decoding contexts deltarle_decoder m_ycontext; diff --git a/src/lib/util/aviio.cpp b/src/lib/util/aviio.cpp index 8722017d3e8..7f74920f06b 100644 --- a/src/lib/util/aviio.cpp +++ b/src/lib/util/aviio.cpp @@ -999,7 +999,7 @@ avi_file::error avi_stream::rgb32_compress_to_rgb(const bitmap_rgb32 &bitmap, st /* compressed video */ for (y = 0; y < height; y++) { - const std::uint32_t *source = &bitmap.pix32(y); + const std::uint32_t *source = &bitmap.pix(y); std::uint8_t *dest = data + (m_height - 1 - y) * m_width * 3; for (x = 0; x < width && dest < dataend; x++) @@ -1062,7 +1062,7 @@ avi_file::error avi_stream::yuv_decompress_to_yuy16(const std::uint8_t *data, st for (y = 0; y < m_height; y++) { const std::uint16_t *source = reinterpret_cast<const std::uint16_t *>(data) + y * m_width; - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *dest = &bitmap.pix(y); /* switch off the compression */ switch (m_format) @@ -1113,7 +1113,7 @@ avi_file::error avi_stream::yuy16_compress_to_yuy(const bitmap_yuy16 &bitmap, st /* compressed video */ for (y = 0; y < m_height; y++) { - const std::uint16_t *source = &bitmap.pix16(y); + const std::uint16_t *source = &bitmap.pix(y); std::uint16_t *dest = reinterpret_cast<std::uint16_t *>(data) + y * m_width; /* switch off the compression */ @@ -1298,7 +1298,7 @@ avi_file::error avi_stream::huffyuv_decompress_to_yuy16(const std::uint8_t *data /* compressed video */ for (y = 0; y < m_height; y++) { - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *dest = &bitmap.pix(y); /* handle the first four bytes independently */ x = 0; @@ -1386,8 +1386,8 @@ avi_file::error avi_stream::huffyuv_decompress_to_yuy16(const std::uint8_t *data lastprevy = lastprevcb = lastprevcr = 0; for (y = 0; y < m_height; y++) { - std::uint16_t *prevrow = &bitmap.pix16(y - prevlines); - std::uint16_t *dest = &bitmap.pix16(y); + std::uint16_t *prevrow = &bitmap.pix(y - prevlines); + std::uint16_t *dest = &bitmap.pix(y); /* handle the first four bytes independently */ x = 0; @@ -1500,7 +1500,7 @@ avi_file::error avi_stream::uncompressed_rgb24_to_argb32(const std::uint8_t *dat /* uncompressed video */ for (int y = 0; y < m_height; y++) { - std::uint32_t *dest = &bitmap.pix32(y); + std::uint32_t *dest = &bitmap.pix(y); /* loop over pixels */ for (int x = 0; x < m_width; x++) @@ -1530,7 +1530,7 @@ avi_file::error avi_stream::uncompressed_yuv420p_to_argb32(const std::uint8_t *d /* uncompressed video */ for (int y = 0; y < m_height; y++) { - std::uint32_t *dest = &bitmap.pix32(y); + std::uint32_t *dest = &bitmap.pix(y); /* loop over pixels */ for (int x = 0; x < m_width; x++) diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp index 2b7cd74b5a1..fc05b89f1b6 100644 --- a/src/lib/util/bitmap.cpp +++ b/src/lib/util/bitmap.cpp @@ -10,7 +10,6 @@ #include "bitmap.h" -#include <algorithm> #include <cassert> #include <new> @@ -360,7 +359,7 @@ void bitmap_t::wrap(void *base, int width, int height, int rowpixels) * @param subrect The subrect. */ -void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) +void bitmap_t::wrap(bitmap_t &source, const rectangle &subrect) { assert(m_format == source.m_format); assert(m_bpp == source.m_bpp); @@ -406,7 +405,7 @@ void bitmap_t::set_palette(palette_t *palette) } /** - * @fn void bitmap_t::fill(uint32_t color, const rectangle &cliprect) + * @fn void bitmap_t::fill(uint64_t color, const rectangle &bounds) * * @brief ------------------------------------------------- * fill -- fill a bitmap with a solid color @@ -416,10 +415,10 @@ void bitmap_t::set_palette(palette_t *palette) * @param cliprect The cliprect. */ -void bitmap_t::fill(uint32_t color, const rectangle &cliprect) +void bitmap_t::fill(uint64_t color, const rectangle &bounds) { // if we have a cliprect, intersect with that - rectangle fill(cliprect); + rectangle fill(bounds); fill &= m_cliprect; if (!fill.empty()) { @@ -448,3 +447,13 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect) } } } + + +//************************************************************************** +// EXPLICIT TEMPLATE INSTANTIATIONS +//************************************************************************** + +template class bitmap_specific<uint8_t>; +template class bitmap_specific<uint16_t>; +template class bitmap_specific<uint32_t>; +template class bitmap_specific<uint64_t>; diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h index ed6a5382a61..57ed0bc1775 100644 --- a/src/lib/util/bitmap.h +++ b/src/lib/util/bitmap.h @@ -16,6 +16,9 @@ #include "osdcore.h" #include "palette.h" +#include <algorithm> +#include <memory> + //************************************************************************** // TYPE DEFINITIONS @@ -151,23 +154,23 @@ public: // operations void set_palette(palette_t *palette); - void fill(uint32_t color) { fill(color, m_cliprect); } - void fill(uint32_t color, const rectangle &cliprect); - void plot_box(int x, int y, int width, int height, uint32_t color) + void fill(uint64_t color) { fill(color, m_cliprect); } + void fill(uint64_t color, const rectangle &bounds); + void plot_box(int32_t x, int32_t y, int32_t width, int32_t height, uint64_t color) { - rectangle clip(x, x + width - 1, y, y + height - 1); - fill(color, clip); + fill(color, rectangle(x, x + width - 1, y, y + height - 1)); } // pixel access - template<typename PixelType> - PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } - void *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } + void *raw_pixptr(int32_t y, int32_t x = 0) { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } + void const *raw_pixptr(int32_t y, int32_t x = 0) const { return reinterpret_cast<uint8_t *>(m_base) + (y * m_rowpixels + x) * m_bpp / 8; } protected: // for use by subclasses only to ensure type correctness + template <typename PixelType> PixelType &pixt(int32_t y, int32_t x = 0) { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } + template <typename PixelType> PixelType const &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<PixelType *>(m_base) + y * m_rowpixels + x); } void wrap(void *base, int width, int height, int rowpixels); - void wrap(const bitmap_t &source, const rectangle &subrect); + void wrap(bitmap_t &source, const rectangle &subrect); private: // internal helpers @@ -191,17 +194,17 @@ private: // ======================> bitmap_specific, bitmap8_t, bitmap16_t, bitmap32_t, bitmap64_t -template<typename PixelType> +template <typename PixelType> class bitmap_specific : public bitmap_t { - static constexpr int PixelBits = 8 * sizeof(PixelType); + static constexpr int PIXEL_BITS = 8 * sizeof(PixelType); protected: // construction/destruction -- subclasses only bitmap_specific(bitmap_specific<PixelType> &&) = default; - bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PixelBits, width, height, xslop, yslop) { } - bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PixelBits, base, width, height, rowpixels) { } - bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PixelBits, source, subrect) { } + bitmap_specific(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, PIXEL_BITS, width, height, xslop, yslop) { } + bitmap_specific(bitmap_format format, PixelType *base, int width, int height, int rowpixels) : bitmap_t(format, PIXEL_BITS, base, width, height, rowpixels) { } + bitmap_specific(bitmap_format format, bitmap_specific<PixelType> &source, const rectangle &subrect) : bitmap_t(format, PIXEL_BITS, source, subrect) { } bitmap_specific<PixelType> &operator=(bitmap_specific<PixelType> &&) = default; @@ -209,27 +212,46 @@ public: using pixel_t = PixelType; // getters - uint8_t bpp() const { return PixelBits; } + uint8_t bpp() const { return PIXEL_BITS; } // pixel accessors - PixelType &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } - PixelType &pix8(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 8, "must be 8bpp"); return pixt<PixelType>(y, x); } - PixelType &pix16(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 16, "must be 16bpp"); return pixt<PixelType>(y, x); } - PixelType &pix32(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 32, "must be 32bpp"); return pixt<PixelType>(y, x); } - PixelType &pix64(int32_t y, int32_t x = 0) const { static_assert(PixelBits == 64, "must be 64bpp"); return pixt<PixelType>(y, x); } + PixelType &pix(int32_t y, int32_t x = 0) { return pixt<PixelType>(y, x); } + PixelType const &pix(int32_t y, int32_t x = 0) const { return pixt<PixelType>(y, x); } + + // operations + void fill(PixelType color) { fill(color, cliprect()); } + void fill(PixelType color, const rectangle &bounds) + { + // if we have a cliprect, intersect with that + rectangle fill(bounds); + fill &= cliprect(); + if (!fill.empty()) + { + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + std::fill_n(&pix(y, fill.left()), fill.width(), color); + } + } + void plot_box(int32_t x, int32_t y, int32_t width, int32_t height, PixelType color) + { + fill(color, rectangle(x, x + width - 1, y, y + height - 1)); + } }; // 8bpp bitmaps using bitmap8_t = bitmap_specific<uint8_t>; +extern template class bitmap_specific<uint8_t>; // 16bpp bitmaps using bitmap16_t = bitmap_specific<uint16_t>; +extern template class bitmap_specific<uint16_t>; // 32bpp bitmaps using bitmap32_t = bitmap_specific<uint32_t>; +extern template class bitmap_specific<uint32_t>; // 64bpp bitmaps using bitmap64_t = bitmap_specific<uint64_t>; +extern template class bitmap_specific<uint64_t>; // ======================> bitmap_ind8, bitmap_ind16, bitmap_ind32, bitmap_ind64 @@ -246,7 +268,7 @@ public: bitmap_ind8(uint8_t *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind8(bitmap_ind8 &source, const rectangle &subrect) : bitmap8_t(k_bitmap_format, source, subrect) { } void wrap(uint8_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -266,7 +288,7 @@ public: bitmap_ind16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind16(bitmap_ind16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { } void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -286,7 +308,7 @@ public: bitmap_ind32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind32(bitmap_ind32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -306,7 +328,7 @@ public: bitmap_ind64(uint64_t *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_ind64(bitmap_ind64 &source, const rectangle &subrect) : bitmap64_t(k_bitmap_format, source, subrect) { } void wrap(uint64_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -329,7 +351,7 @@ public: bitmap_yuy16(uint16_t *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_yuy16(bitmap_yuy16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { } void wrap(uint16_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -349,7 +371,7 @@ public: bitmap_rgb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_rgb32(bitmap_rgb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -369,7 +391,7 @@ public: bitmap_argb32(uint32_t *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { } bitmap_argb32(bitmap_argb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { } void wrap(uint32_t *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); } - void wrap(const bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<const bitmap_t &>(source), subrect); } + void wrap(bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); } // getters bitmap_format format() const { return k_bitmap_format; } @@ -377,5 +399,4 @@ public: bitmap_argb32 &operator=(bitmap_argb32 &&) = default; }; - -#endif // MAME_UTIL_BITMAP_H +#endif // MAME_UTIL_BITMAP_H diff --git a/src/lib/util/chdcodec.cpp b/src/lib/util/chdcodec.cpp index 58f7b4291db..7f6e0f018cd 100644 --- a/src/lib/util/chdcodec.cpp +++ b/src/lib/util/chdcodec.cpp @@ -1786,7 +1786,7 @@ void chd_avhuff_decompressor::configure(int param, void *config) { // if we're getting the decompression configuration, apply it now if (param == AVHUFF_CODEC_DECOMPRESS_CONFIG) - m_decoder.configure(*reinterpret_cast<avhuff_decompress_config *>(config)); + m_decoder.configure(*reinterpret_cast<avhuff_decoder::config const *>(config)); // anything else is invalid else diff --git a/src/lib/util/png.cpp b/src/lib/util/png.cpp index 6b59436750c..69835e54051 100644 --- a/src/lib/util/png.cpp +++ b/src/lib/util/png.cpp @@ -519,7 +519,7 @@ public: accumalpha &= alpha; std::uint16_t const paloffs(std::uint16_t(*src) * 3); rgb_t const pix(alpha, pnginfo.palette[paloffs], pnginfo.palette[paloffs + 1], pnginfo.palette[paloffs + 2]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -537,7 +537,7 @@ public: std::uint8_t const a_val((pnginfo.trans && (transpen == i_val)) ? 0x00 : 0xff); i_val >>= samp_shift; accumalpha &= a_val; - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, i_val, i_val, i_val); + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, i_val, i_val, i_val); } } } @@ -552,7 +552,7 @@ public: { accumalpha &= src[a]; rgb_t const pix(src[a], src[i], src[i], src[i]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -578,7 +578,7 @@ public: g_val >>= samp_shift; b_val >>= samp_shift; accumalpha &= a_val; - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, r_val, g_val, b_val); + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = rgb_t(a_val, r_val, g_val, b_val); } } } @@ -595,7 +595,7 @@ public: { accumalpha &= src[a]; rgb_t const pix(src[a], src[r], src[g], src[b]); - bitmap.pix32((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; + bitmap.pix((y << y_shift) + y_offs, (x << x_shift) + x_offs) = pix; } } } @@ -1042,7 +1042,7 @@ static png_error convert_bitmap_to_image_palette(png_info &pnginfo, const bitmap /* copy in the pixels, specifying a nullptr filter */ for (y = 0; y < pnginfo.height; y++) { - auto *src = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + uint16_t const *src = reinterpret_cast<uint16_t const *>(bitmap.raw_pixptr(y)); uint8_t *dst = &pnginfo.image[y * (rowbytes + 1)]; /* store the filter byte, then copy the data */ @@ -1088,7 +1088,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 16bpp palettized format */ if (bitmap.format() == BITMAP_FORMAT_IND16) { - auto *src16 = reinterpret_cast<uint16_t *>(bitmap.raw_pixptr(y)); + uint16_t const *src16 = reinterpret_cast<uint16_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t color = palette[*src16++]; @@ -1101,7 +1101,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit RGB direct */ else if (bitmap.format() == BITMAP_FORMAT_RGB32) { - auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + uint32_t const *src32 = reinterpret_cast<uint32_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; @@ -1114,7 +1114,7 @@ static png_error convert_bitmap_to_image_rgb(png_info &pnginfo, const bitmap_t & /* 32-bit ARGB direct */ else if (bitmap.format() == BITMAP_FORMAT_ARGB32) { - auto *src32 = reinterpret_cast<uint32_t *>(bitmap.raw_pixptr(y)); + uint32_t const *src32 = reinterpret_cast<uint32_t const *>(bitmap.raw_pixptr(y)); for (x = 0; x < pnginfo.width; x++) { rgb_t raw = *src32++; diff --git a/src/mame/audio/arcadia.cpp b/src/mame/audio/arcadia.cpp index 19adb9fac4e..46c7c9ee64f 100644 --- a/src/mame/audio/arcadia.cpp +++ b/src/mame/audio/arcadia.cpp @@ -59,7 +59,7 @@ arcadia_sound_device::arcadia_sound_device(const machine_config &mconfig, const //------------------------------------------------- void arcadia_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, UVI_PAL*OSAMP); + m_channel = stream_alloc(0, 1, UVI_PAL*OSAMP); m_lfsr = LFSR_INIT; m_tval = 1; logerror("arcadia_sound start\n"); @@ -76,18 +76,18 @@ void arcadia_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void arcadia_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (i = 0; i < samples; i++, buffer++) + for (i = 0; i < buffer.samples(); i++) { - *buffer = 0; + s32 result = 0; //if minimal pitch ? if (m_reg[1]){ @@ -97,17 +97,17 @@ void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stre //tone only case 1: - *buffer = m_volume * m_tval; + result = m_volume * m_tval; break; //noise only case 2: - *buffer = m_volume * m_nval; + result = m_volume * m_nval; break; //tone AND noise (bitwise and) case 3: - *buffer = m_volume * (m_tval & m_nval); + result = m_volume * (m_tval & m_nval); break; } @@ -132,6 +132,7 @@ void arcadia_sound_device::sound_stream_update_legacy(sound_stream &stream, stre m_pos = 0; } } + buffer.put_int(i, result, 32768); } } diff --git a/src/mame/audio/arcadia.h b/src/mame/audio/arcadia.h index de67b71705d..6eb25f9e970 100644 --- a/src/mame/audio/arcadia.h +++ b/src/mame/audio/arcadia.h @@ -21,7 +21,7 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; sound_stream *m_channel; uint8_t m_reg[3]; diff --git a/src/mame/audio/channelf.cpp b/src/mame/audio/channelf.cpp index 5003f28ae3a..ec4971d35df 100644 --- a/src/mame/audio/channelf.cpp +++ b/src/mame/audio/channelf.cpp @@ -30,7 +30,7 @@ void channelf_sound_device::device_start() { int rate; - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); rate = machine().sample_rate(); /* @@ -67,19 +67,18 @@ void channelf_sound_device::device_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void channelf_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint32_t mask = 0, target = 0; - stream_sample_t *buffer = outputs[0]; - stream_sample_t *sample = buffer; + auto &buffer = outputs[0]; switch( m_sound_mode ) { case 0: /* sound off */ - memset(buffer,0,sizeof(*buffer)*samples); + buffer.fill(0); return; case 1: /* high tone (2V) - 1000Hz */ @@ -96,12 +95,12 @@ void channelf_sound_device::sound_stream_update_legacy(sound_stream &stream, str break; } - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { if ((m_forced_ontime > 0) || ((m_sample_counter & mask) == target)) // change made for improved sound - *sample++ = m_envelope; + buffer.put_int(sampindex, m_envelope, 32768); else - *sample++ = 0; + buffer.put(sampindex, 0); m_sample_counter += m_incr; m_envelope *= m_decay_mult; if (m_forced_ontime > 0) // added for improved sound diff --git a/src/mame/audio/channelf.h b/src/mame/audio/channelf.h index 36c98aa47ed..ce1231c3951 100644 --- a/src/mame/audio/channelf.h +++ b/src/mame/audio/channelf.h @@ -20,7 +20,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state sound_stream *m_channel; diff --git a/src/mame/audio/cmi01a.cpp b/src/mame/audio/cmi01a.cpp index dbb180c2247..f99eccb71c9 100644 --- a/src/mame/audio/cmi01a.cpp +++ b/src/mame/audio/cmi01a.cpp @@ -132,7 +132,7 @@ void cmi01a_device::device_add_mconfig(machine_config &config) } -void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cmi01a_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { if (m_run) { @@ -140,23 +140,21 @@ void cmi01a_device::sound_stream_update_legacy(sound_stream &stream, stream_samp int addr = m_segment_cnt; uint8_t *wave_ptr = &m_wave_ram[m_segment_cnt & 0x3fff]; - stream_sample_t *buf = outputs[0]; + auto &buf = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < buf.samples(); sampindex++) { const uint8_t sample8 = wave_ptr[addr++ & 0x3fff]; - int32_t sample = (int32_t)(int8_t)(sample8 ^ 0x80) * m_env * m_vol_latch; + s32 sample = (int32_t)(int8_t)(sample8 ^ 0x80) * m_env * m_vol_latch; if (m_channel == 5) printf("%08x:%02x:%02x:%02x", (uint32_t)sample, sample8, m_env, m_vol_latch); - *buf++ = (int16_t)(sample >> 8); + buf.put_int(sampindex, (int16_t)(sample >> 8), 32768); } if (m_channel == 5) printf("\n"); m_segment_cnt = (m_segment_cnt & ~mask) | addr; } else - { - memset(outputs[0], 0, samples * sizeof(stream_sample_t)); - } + outputs[0].fill(0); } void cmi01a_device::device_resolve_objects() @@ -175,7 +173,7 @@ void cmi01a_device::device_start() m_zx_timer->adjust(attotime::never); m_eosi_timer->adjust(attotime::never); - m_stream = stream_alloc_legacy(0, 1, 44100); + m_stream = stream_alloc(0, 1, 44100); m_ptm->set_external_clocks(clock() / 8, clock() / 4, clock() / 4); diff --git a/src/mame/audio/cmi01a.h b/src/mame/audio/cmi01a.h index 7e5da0b56a8..743c50e5829 100644 --- a/src/mame/audio/cmi01a.h +++ b/src/mame/audio/cmi01a.h @@ -34,7 +34,7 @@ public: void write(offs_t offset, uint8_t data); uint8_t read(offs_t offset); - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; protected: virtual void device_resolve_objects() override; diff --git a/src/mame/audio/cps3.cpp b/src/mame/audio/cps3.cpp index aa7eb8340f0..bbefabf4d50 100644 --- a/src/mame/audio/cps3.cpp +++ b/src/mame/audio/cps3.cpp @@ -39,7 +39,7 @@ cps3_sound_device::cps3_sound_device(const machine_config &mconfig, const char * void cps3_sound_device::device_start() { /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, clock() / 384); + m_stream = stream_alloc(0, 2, clock() / 384); save_item(NAME(m_key)); for (int i = 0; i < 16; i++) @@ -52,14 +52,14 @@ void cps3_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void cps3_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* Clear the buffers */ - memset(outputs[0], 0, samples*sizeof(*outputs[0])); - memset(outputs[1], 0, samples*sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); for (int i = 0; i < 16; i ++) { @@ -103,7 +103,7 @@ void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_ loop -= 0x400000; /* Go through the buffer and add voice contributions */ - for (int j = 0; j < samples; j++) + for (int j = 0; j < outputs[0].samples(); j++) { int32_t sample; @@ -127,8 +127,8 @@ void cps3_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_ sample = m_base[BYTE4_XOR_LE(start + pos)]; frac += step; - outputs[0][j] += ((sample * vol_l) >> 8); - outputs[1][j] += ((sample * vol_r) >> 8); + outputs[0].add_int(j, sample * vol_l, 32768 << 8); + outputs[1].add_int(j, sample * vol_r, 32768 << 8); } vptr->pos = pos; diff --git a/src/mame/audio/cps3.h b/src/mame/audio/cps3.h index 4e3fe471c8d..101fa8903ce 100644 --- a/src/mame/audio/cps3.h +++ b/src/mame/audio/cps3.h @@ -46,7 +46,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/mame/audio/dai_snd.cpp b/src/mame/audio/dai_snd.cpp index 37004da5644..52334c699f8 100644 --- a/src/mame/audio/dai_snd.cpp +++ b/src/mame/audio/dai_snd.cpp @@ -33,7 +33,7 @@ dai_sound_device::dai_sound_device(const machine_config &mconfig, const char *ta void dai_sound_device::device_start() { - m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); } //------------------------------------------------- @@ -115,27 +115,27 @@ WRITE_LINE_MEMBER(dai_sound_device::set_input_ch2) } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void dai_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void dai_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *sample_left = outputs[0]; - stream_sample_t *sample_right = outputs[1]; + auto &sample_left = outputs[0]; + auto &sample_right = outputs[1]; int16_t channel_0_signal = m_dai_input[0] ? s_osc_volume_table[m_osc_volume[0]] : -s_osc_volume_table[m_osc_volume[0]]; int16_t channel_1_signal = m_dai_input[1] ? s_osc_volume_table[m_osc_volume[1]] : -s_osc_volume_table[m_osc_volume[1]]; int16_t channel_2_signal = m_dai_input[2] ? s_osc_volume_table[m_osc_volume[2]] : -s_osc_volume_table[m_osc_volume[2]]; - while (samples--) + for (int sampindex = 0; sampindex < sample_left.samples(); sampindex++) { int16_t noise = machine().rand()&0x01 ? s_noise_volume_table[m_noise_volume] : -s_noise_volume_table[m_noise_volume]; /* channel 0 + channel 1 + noise */ - *sample_left++ = channel_0_signal + channel_1_signal + noise; + sample_left.put_int(sampindex, channel_0_signal + channel_1_signal + noise, 32768); /* channel 1 + channel 2 + noise */ - *sample_right++ = channel_1_signal + channel_2_signal + noise; + sample_right.put_int(sampindex, channel_1_signal + channel_2_signal + noise, 32768); } } diff --git a/src/mame/audio/dai_snd.h b/src/mame/audio/dai_snd.h index cea0e1c6c71..f34bed0199d 100644 --- a/src/mame/audio/dai_snd.h +++ b/src/mame/audio/dai_snd.h @@ -27,7 +27,7 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream * m_mixer_channel; diff --git a/src/mame/audio/dsbz80.cpp b/src/mame/audio/dsbz80.cpp index 7643face54b..ad7f25bbfcd 100644 --- a/src/mame/audio/dsbz80.cpp +++ b/src/mame/audio/dsbz80.cpp @@ -85,7 +85,7 @@ void dsbz80_device::device_start() m_rxd_handler.resolve_safe(); uint8_t *rom_base = machine().root_device().memregion("mpeg")->base(); decoder = new mpeg_audio(rom_base, mpeg_audio::L2, false, 0); - stream_alloc_legacy(0, 2, 32000); + stream_alloc(0, 2, 32000); } //------------------------------------------------- @@ -232,11 +232,13 @@ void dsbz80_device::mpeg_stereo_w(uint8_t data) mp_pan = data & 3; // 0 = stereo, 1 = left on both channels, 2 = right on both channels } -void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void dsbz80_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *out_l = outputs[0]; - stream_sample_t *out_r = outputs[1]; + auto &out_l = outputs[0]; + auto &out_r = outputs[1]; + int samples = out_l.samples(); + int sampindex = 0; for(;;) { while(samples && audio_pos < audio_avail) @@ -244,18 +246,21 @@ void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_samp switch (mp_pan) { case 0: // stereo - *out_l++ = audio_buf[audio_pos*2]; - *out_r++ = audio_buf[audio_pos*2+1]; + out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); + out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); + sampindex++; break; case 1: // left only - *out_l++ = audio_buf[audio_pos*2]; - *out_r++ = audio_buf[audio_pos*2]; + out_l.put_int(sampindex, audio_buf[audio_pos*2], 32768); + out_r.put_int(sampindex, audio_buf[audio_pos*2], 32768); + sampindex++; break; case 2: // right only - *out_l++ = audio_buf[audio_pos*2+1]; - *out_r++ = audio_buf[audio_pos*2+1]; + out_l.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); + out_r.put_int(sampindex, audio_buf[audio_pos*2+1], 32768); + sampindex++; break; } audio_pos++; @@ -269,11 +274,8 @@ void dsbz80_device::sound_stream_update_legacy(sound_stream &stream, stream_samp if(mp_state == 0) { - for(int i=0; i != samples; i++) - { - *out_l++ = 0; - *out_r++ = 0; - } + out_l.fill(0, sampindex); + out_r.fill(0, sampindex); break; } diff --git a/src/mame/audio/dsbz80.h b/src/mame/audio/dsbz80.h index 92e0c4f3f2f..6f135454524 100644 --- a/src/mame/audio/dsbz80.h +++ b/src/mame/audio/dsbz80.h @@ -37,7 +37,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: mpeg_audio *decoder; diff --git a/src/mame/audio/elan_eu3a05.cpp b/src/mame/audio/elan_eu3a05.cpp index 39ab90a08fb..1922ee3b1da 100644 --- a/src/mame/audio/elan_eu3a05.cpp +++ b/src/mame/audio/elan_eu3a05.cpp @@ -54,7 +54,7 @@ void elan_eu3a05_sound_device::map(address_map &map) void elan_eu3a05_sound_device::device_start() { m_space_read_cb.resolve_safe(0); - m_stream = stream_alloc_legacy(0, 1, 8000); + m_stream = stream_alloc(0, 1, 8000); m_sound_end_cb.resolve_all_safe(); @@ -92,18 +92,19 @@ void elan_eu3a05_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void elan_eu3a05_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // reset the output stream - memset(outputs[0], 0, samples * sizeof(*outputs[0])); + outputs[0].fill(0); int volume = m_volumes[0] | (m_volumes[1] << 8); int outpos = 0; // loop while we still have samples to generate + int samples = outputs[0].samples(); while (samples-- != 0) { int total = 0; @@ -142,7 +143,7 @@ void elan_eu3a05_sound_device::sound_stream_update_legacy(sound_stream &stream, //LOGMASKED( LOG_AUDIO, "m_isstopped %02x channel %d is NOT active %08x %06x\n", m_isstopped, channel, m_sound_byte_address[channel], m_sound_current_nib_pos[channel]); } } - outputs[0][outpos] = total / 6; + outputs[0].put_int(outpos, total, 32768 * 6); outpos++; } } diff --git a/src/mame/audio/elan_eu3a05.h b/src/mame/audio/elan_eu3a05.h index c9ef2e83ab3..692d685cf64 100644 --- a/src/mame/audio/elan_eu3a05.h +++ b/src/mame/audio/elan_eu3a05.h @@ -30,7 +30,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual space_config_vector memory_space_config() const override; const address_space_config m_space_config; diff --git a/src/mame/audio/exidy.cpp b/src/mame/audio/exidy.cpp index 8220c3e1af7..3f5b6559f2e 100644 --- a/src/mame/audio/exidy.cpp +++ b/src/mame/audio/exidy.cpp @@ -180,7 +180,7 @@ void exidy_sound_device::common_sh_start() m_sh6840_clocks_per_sample = (int)(SH6840_CLOCK.dvalue() / (double)sample_rate * (double)(1 << 24)); /* allocate the stream */ - m_stream = stream_alloc_legacy(0, 1, sample_rate); + m_stream = stream_alloc(0, 1, sample_rate); sh6840_register_state_globals(); } @@ -239,23 +239,23 @@ void exidy_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void exidy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { sh6840_timer_channel *sh6840_timer = m_sh6840_timer; /* hack to skip the expensive lfsr noise generation unless at least one of the 3 channels actually depends on it being generated */ int noisy = ((sh6840_timer[0].cr & sh6840_timer[1].cr & sh6840_timer[2].cr & 0x02) == 0); - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* loop over samples */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { sh6840_timer_channel *t; int clocks; - stream_sample_t sample = 0; + s32 sample = 0; /* determine how many 6840 clocks this sample */ m_sh6840_clock_count += m_sh6840_clocks_per_sample; @@ -310,19 +310,19 @@ void exidy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream sample += generate_music_sample(); /* stash */ - *buffer++ = sample; + buffer.put_int(sampindex, sample, 32768); } } -stream_sample_t exidy_sound_device::generate_music_sample() +s32 exidy_sound_device::generate_music_sample() { return 0; } -stream_sample_t exidy_sh8253_sound_device::generate_music_sample() +s32 exidy_sh8253_sound_device::generate_music_sample() { sh8253_timer_channel *c; - stream_sample_t sample = 0; + s32 sample = 0; /* music channel 0 */ c = &m_sh8253_timer[0]; diff --git a/src/mame/audio/exidy.h b/src/mame/audio/exidy.h index 86ed7b145cd..c619cd1975d 100644 --- a/src/mame/audio/exidy.h +++ b/src/mame/audio/exidy.h @@ -54,8 +54,8 @@ protected: void sh6840_register_state_globals(); // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - virtual stream_sample_t generate_music_sample(); + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + virtual s32 generate_music_sample(); static inline void sh6840_apply_clock(sh6840_timer_channel *t, int clocks); @@ -102,7 +102,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; - virtual stream_sample_t generate_music_sample() override; + virtual s32 generate_music_sample() override; void r6532_porta_w(uint8_t data); uint8_t r6532_porta_r(); diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp index a4ca2d10339..a5a40cae628 100644 --- a/src/mame/audio/exidy440.cpp +++ b/src/mame/audio/exidy440.cpp @@ -74,8 +74,6 @@ exidy440_sound_device::exidy440_sound_device(const machine_config &mconfig, cons m_samples(*this, "samples"), m_sound_command(0), m_sound_command_ack(0), - m_mixer_buffer_left(nullptr), - m_mixer_buffer_right(nullptr), m_sound_cache(nullptr), m_sound_cache_end(nullptr), m_sound_cache_max(nullptr), @@ -146,7 +144,7 @@ void exidy440_sound_device::device_start() m_channel_frequency[3] = clock()/2; /* get stream channels */ - m_stream = stream_alloc_legacy(0, 2, clock()); + m_stream = stream_alloc(0, 2, clock()); /* allocate the sample cache */ length = m_samples.bytes() * 16 + MAX_CACHE_ENTRIES * sizeof(sound_cache_entry); @@ -157,8 +155,8 @@ void exidy440_sound_device::device_start() reset_sound_cache(); /* allocate the mixer buffer */ - m_mixer_buffer_left = make_unique_clear<int32_t[]>(clock()); - m_mixer_buffer_right = make_unique_clear<int32_t[]>(clock()); + m_mixer_buffer_left.resize(clock()/50); + m_mixer_buffer_right.resize(clock()/50); if (SOUND_LOG) m_debuglog = fopen("sound.log", "w"); @@ -224,24 +222,15 @@ void exidy440_sound_device::add_and_scale_samples(int ch, int32_t *dest, int sam * *************************************/ -void exidy440_sound_device::mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right) +void exidy440_sound_device::mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right) { - int32_t *mixer_left = m_mixer_buffer_left.get(); - int32_t *mixer_right = m_mixer_buffer_right.get(); - int i, clippers = 0; + int32_t *mixer_left = &m_mixer_buffer_left[0]; + int32_t *mixer_right = &m_mixer_buffer_right[0]; - for (i = 0; i < length; i++) + for (int i = 0; i < dest_left.samples(); i++) { - int32_t sample_left = *mixer_left++; - int32_t sample_right = *mixer_right++; - - if (sample_left < -32768) { sample_left = -32768; clippers++; } - else if (sample_left > 32767) { sample_left = 32767; clippers++; } - if (sample_right < -32768) { sample_right = -32768; clippers++; } - else if (sample_right > 32767) { sample_right = 32767; clippers++; } - - *dest_left++ = sample_left; - *dest_right++ = sample_right; + dest_left.put_int_clamp(i, *mixer_left++, 32768); + dest_right.put_int_clamp(i, *mixer_right++, 32768); } } @@ -836,22 +825,22 @@ void exidy440_sound_device::sound_banks_w(offs_t offset, uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void exidy440_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int ch; /* reset the mixer buffers */ - memset(m_mixer_buffer_left.get(), 0, samples * sizeof(int32_t)); - memset(m_mixer_buffer_right.get(), 0, samples * sizeof(int32_t)); + std::fill_n(&m_mixer_buffer_left[0], outputs[0].samples(), 0); + std::fill_n(&m_mixer_buffer_right[0], outputs[0].samples(), 0); /* loop over channels */ for (ch = 0; ch < 4; ch++) { sound_channel_data *channel = &m_sound_channel[ch]; - int length, volume, left = samples; + int length, volume, left = outputs[0].samples(); int effective_offset; /* if we're not active, bail */ @@ -864,12 +853,12 @@ void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, str /* get a pointer to the sample data and copy to the left */ volume = m_sound_volume[2 * ch + 0]; if (volume) - add_and_scale_samples(ch, m_mixer_buffer_left.get(), length, volume); + add_and_scale_samples(ch, &m_mixer_buffer_left[0], length, volume); /* get a pointer to the sample data and copy to the left */ volume = m_sound_volume[2 * ch + 1]; if (volume) - add_and_scale_samples(ch, m_mixer_buffer_right.get(), length, volume); + add_and_scale_samples(ch, &m_mixer_buffer_right[0], length, volume); /* update our counters */ channel->offset += length; @@ -889,5 +878,5 @@ void exidy440_sound_device::sound_stream_update_legacy(sound_stream &stream, str } /* all done, time to mix it */ - mix_to_16(samples, outputs[0], outputs[1]); + mix_to_16(outputs[0], outputs[1]); } diff --git a/src/mame/audio/exidy440.h b/src/mame/audio/exidy440.h index 9f8861bdfe3..e3920be90a2 100644 --- a/src/mame/audio/exidy440.h +++ b/src/mame/audio/exidy440.h @@ -29,7 +29,7 @@ protected: virtual void device_stop() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void exidy440_audio_map(address_map &map); @@ -76,8 +76,8 @@ private: uint8_t m_sound_banks[4]; //uint8_t m_m6844_data[0x20]; uint8_t m_sound_volume[0x10]; - std::unique_ptr<int32_t[]> m_mixer_buffer_left; - std::unique_ptr<int32_t[]> m_mixer_buffer_right; + std::vector<int32_t> m_mixer_buffer_left; + std::vector<int32_t> m_mixer_buffer_right; sound_cache_entry *m_sound_cache; sound_cache_entry *m_sound_cache_end; sound_cache_entry *m_sound_cache_max; @@ -111,7 +111,7 @@ private: void fir_filter(int32_t *input, int16_t *output, int count); void add_and_scale_samples(int ch, int32_t *dest, int samples, int volume); - void mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right); + void mix_to_16(write_stream_view &dest_left, write_stream_view &dest_right); uint8_t sound_command_r(); uint8_t sound_volume_r(offs_t offset); diff --git a/src/mame/audio/flower.cpp b/src/mame/audio/flower.cpp index 4ade0d864a9..99806a0c6b6 100644 --- a/src/mame/audio/flower.cpp +++ b/src/mame/audio/flower.cpp @@ -48,9 +48,7 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch device_memory_interface(mconfig, *this), m_io_space_config("io", ENDIANNESS_LITTLE, 8, 7, 0, address_map_constructor(FUNC(flower_sound_device::regs_map), this)), m_stream(nullptr), - m_mixer_table(nullptr), m_mixer_lookup(nullptr), - m_mixer_buffer(nullptr), m_last_channel(nullptr) { } @@ -63,9 +61,9 @@ flower_sound_device::flower_sound_device(const machine_config &mconfig, const ch void flower_sound_device::device_start() { m_iospace = &space(AS_IO); - m_stream = stream_alloc_legacy(0, 1, clock()/2); + m_stream = stream_alloc(0, 1, clock()/2); - m_mixer_buffer = make_unique_clear<short[]>(clock()/2); + m_mixer_buffer.resize(clock()/50); make_mixer_table(MAX_VOICES, defgain); m_last_channel = m_channel_list + MAX_VOICES; @@ -94,10 +92,10 @@ void flower_sound_device::device_start() void flower_sound_device::make_mixer_table(int voices, int gain) { /* allocate memory */ - m_mixer_table = make_unique_clear<int16_t[]>(256 * voices); + m_mixer_table.resize(256 * voices); /* find the middle of the table */ - m_mixer_lookup = m_mixer_table.get() + (128 * voices); + m_mixer_lookup = &m_mixer_table[128 * voices]; /* fill in the table - 16 bit case */ for (int i = 0; i < voices * 128; i++) @@ -127,13 +125,13 @@ void flower_sound_device::device_reset() } } -void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void flower_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; short *mix; uint8_t raw_sample; - memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); for (fl_sound_channel *voice = m_channel_list; voice < m_last_channel; voice++) { @@ -143,9 +141,9 @@ void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, strea if (voice->enable == false) continue; - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; - for (int i = 0; i < samples; i++) + for (int i = 0; i < buffer.samples(); i++) { if (voice->repeat == true) { @@ -174,9 +172,9 @@ void flower_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } /* mix it down */ - mix = m_mixer_buffer.get(); - for (int i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; + mix = &m_mixer_buffer[0]; + for (int i = 0; i < buffer.samples(); i++) + buffer.put_int(i, m_mixer_lookup[*mix++], 32768); } //------------------------------------------------- diff --git a/src/mame/audio/flower.h b/src/mame/audio/flower.h index 8fad33679c6..44787c6f30d 100644 --- a/src/mame/audio/flower.h +++ b/src/mame/audio/flower.h @@ -39,7 +39,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual space_config_vector memory_space_config() const override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; address_space *m_iospace; private: @@ -50,9 +50,9 @@ private: static constexpr unsigned MAX_VOICES = 8; static constexpr int defgain = 48; - std::unique_ptr<int16_t[]> m_mixer_table; + std::vector<int16_t> m_mixer_table; int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; + std::vector<short> m_mixer_buffer; struct fl_sound_channel { diff --git a/src/mame/audio/geebee.cpp b/src/mame/audio/geebee.cpp index 63859916d7c..01858b5ecad 100644 --- a/src/mame/audio/geebee.cpp +++ b/src/mame/audio/geebee.cpp @@ -42,7 +42,7 @@ void geebee_sound_device::device_start() m_decay[0x7fff - i] = (int16_t) (0x7fff/exp(1.0*i/4096)); /* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */ - m_channel = stream_alloc_legacy(0, 1, clock() / 3 / 2 / 384); + m_channel = stream_alloc(0, 1, clock() / 3 / 2 / 384); m_vcount = 0; m_volume_timer = timer_alloc(TIMER_VOLUME_DECAY); @@ -103,16 +103,16 @@ void geebee_sound_device::sound_w(u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void geebee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) - { - stream_sample_t *buffer = outputs[0]; +void geebee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + auto &buffer = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer++ = m_sound_signal; + buffer.put_int(sampindex, m_sound_signal, 32768); /* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */ { m_vcount++; diff --git a/src/mame/audio/geebee.h b/src/mame/audio/geebee.h index 1cca0fc6dd0..1bbddf36bba 100644 --- a/src/mame/audio/geebee.h +++ b/src/mame/audio/geebee.h @@ -22,7 +22,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/audio/gomoku.cpp b/src/mame/audio/gomoku.cpp index 6aeb288f6db..632b016441e 100644 --- a/src/mame/audio/gomoku.cpp +++ b/src/mame/audio/gomoku.cpp @@ -11,8 +11,6 @@ #include "emu.h" #include "audio/gomoku.h" -constexpr int DEFGAIN = 48; - // device type definition DEFINE_DEVICE_TYPE(GOMOKU_SOUND, gomoku_sound_device, "gomoku_sound", "Gomoku Narabe Renju Custom Sound") @@ -32,10 +30,6 @@ gomoku_sound_device::gomoku_sound_device(const machine_config &mconfig, const ch , m_sound_rom(*this, DEVICE_SELF) , m_sound_enable(0) , m_stream(nullptr) - , m_mixer_table(nullptr) - , m_mixer_lookup(nullptr) - , m_mixer_buffer(nullptr) - , m_mixer_buffer_2(nullptr) { std::fill(std::begin(m_soundregs1), std::end(m_soundregs1), 0); std::fill(std::begin(m_soundregs2), std::end(m_soundregs2), 0); @@ -52,14 +46,10 @@ void gomoku_sound_device::device_start() int ch; // get stream channels - m_stream = stream_alloc_legacy(0, 1, clock()); - - // allocate a pair of buffers to mix into - 1 second's worth should be more than enough - m_mixer_buffer = std::make_unique<short[]>(2 * clock()); - m_mixer_buffer_2 = m_mixer_buffer.get() + clock(); // this is never used? + m_stream = stream_alloc(0, 1, clock()); - // build the mixer table - make_mixer_table(8, DEFGAIN); + // allocate a buffer to mix into - 1 second's worth should be more than enough + m_mixer_buffer.resize(clock()/50); // start with sound enabled, many games don't have a sound enable register m_sound_enable = 1; @@ -76,7 +66,6 @@ void gomoku_sound_device::device_start() save_item(NAME(m_soundregs1)); save_item(NAME(m_soundregs2)); - save_pointer(NAME(m_mixer_buffer), 2 * clock()); // save_item(NAME(m_sound_enable)); // set to 1 at device start and never updated? save_item(STRUCT_MEMBER(m_channel_list, channel)); save_item(STRUCT_MEMBER(m_channel_list, frequency)); @@ -87,12 +76,12 @@ void gomoku_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update in mono +// sound_stream_update - handle a stream update in mono //------------------------------------------------- -void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gomoku_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; sound_channel *voice; short *mix; int ch; @@ -100,12 +89,12 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea // if no sound, we're done if (m_sound_enable == 0) { - memset(buffer, 0, samples * sizeof(*buffer)); + buffer.fill(0); return; } // zap the contents of the mixer buffer - memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); // loop over each voice and add its contribution for (ch = 0, voice = std::begin(m_channel_list); voice < std::end(m_channel_list); ch++, voice++) @@ -124,10 +113,10 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea else w_base = 0x100 * (m_soundregs2[0x1d] & 0x0f); - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; // add our contribution - for (int i = 0; i < samples; i++) + for (int i = 0; i < buffer.samples(); i++) { c += f; @@ -167,31 +156,9 @@ void gomoku_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } // mix it down - mix = m_mixer_buffer.get(); - for (int i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; -} - - -// build a table to divide by the number of voices; gain is specified as gain*16 -void gomoku_sound_device::make_mixer_table(int voices, int gain) -{ - int count = voices * 128; - - // allocate memory - m_mixer_table = std::make_unique<int16_t[]>(256 * voices); - - // find the middle of the table - m_mixer_lookup = m_mixer_table.get() + (128 * voices); - - // fill in the table - 16 bit case - for (int i = 0; i < count; i++) - { - int val = i * gain * 16 / voices; - if (val > 32767) val = 32767; - m_mixer_lookup[ i] = val; - m_mixer_lookup[-i] = -val; - } + mix = &m_mixer_buffer[0]; + for (int i = 0; i < buffer.samples(); i++) + buffer.put_int(i, *mix++, 128 * MAX_VOICES); } diff --git a/src/mame/audio/gomoku.h b/src/mame/audio/gomoku.h index 75de8a2c09c..0c077de96bd 100644 --- a/src/mame/audio/gomoku.h +++ b/src/mame/audio/gomoku.h @@ -23,7 +23,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void make_mixer_table(int voices, int gain); @@ -52,10 +52,7 @@ private: sound_stream *m_stream; // mixer tables and internal buffers - std::unique_ptr<int16_t[]> m_mixer_table; - int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; - short *m_mixer_buffer_2; + std::vector<short> m_mixer_buffer; uint8_t m_soundregs1[0x20]; uint8_t m_soundregs2[0x20]; diff --git a/src/mame/audio/gridlee.cpp b/src/mame/audio/gridlee.cpp index 429518b39d0..2f6904c4efc 100644 --- a/src/mame/audio/gridlee.cpp +++ b/src/mame/audio/gridlee.cpp @@ -43,26 +43,26 @@ gridlee_sound_device::gridlee_sound_device(const machine_config &mconfig, const void gridlee_sound_device::device_start() { /* allocate the stream */ - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate(); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void gridlee_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gridlee_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; /* loop over samples */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { /* tone channel */ m_tone_fraction += m_tone_step; - *buffer++ = (m_tone_fraction & 0x0800000) ? (m_tone_volume << 6) : 0; + buffer.put_int(sampindex, (m_tone_fraction & 0x0800000) ? m_tone_volume : 0, 32768 >> 6); } } diff --git a/src/mame/audio/hyprolyb.cpp b/src/mame/audio/hyprolyb.cpp index 77ff8034ae5..c97d5612d03 100644 --- a/src/mame/audio/hyprolyb.cpp +++ b/src/mame/audio/hyprolyb.cpp @@ -8,7 +8,6 @@ DEFINE_DEVICE_TYPE(HYPROLYB_ADPCM, hyprolyb_adpcm_device, "hyprolyb_adpcm", "Hyp hyprolyb_adpcm_device::hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HYPROLYB_ADPCM, tag, owner, clock) - , device_sound_interface(mconfig, *this) , m_audiocpu(*this, ":audiocpu") , m_soundlatch2(*this, ":soundlatch2") , m_msm(*this, ":msm") @@ -80,13 +79,3 @@ void hyprolyb_adpcm_device::vck_callback( int st ) { m_vck_ready = 0x80; } - -//------------------------------------------------- -// sound_stream_update_legacy - handle a stream update -//------------------------------------------------- - -void hyprolyb_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - // should never get here - fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n"); -} diff --git a/src/mame/audio/hyprolyb.h b/src/mame/audio/hyprolyb.h index ac2687b40e4..5d9ce541551 100644 --- a/src/mame/audio/hyprolyb.h +++ b/src/mame/audio/hyprolyb.h @@ -8,7 +8,7 @@ #include "machine/gen_latch.h" #include "sound/msm5205.h" -class hyprolyb_adpcm_device : public device_t, public device_sound_interface +class hyprolyb_adpcm_device : public device_t { public: hyprolyb_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -27,9 +27,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - private: // internal state required_device<cpu_device> m_audiocpu; diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp index 40369d86d1d..d839a4c1704 100644 --- a/src/mame/audio/lynx.cpp +++ b/src/mame/audio/lynx.cpp @@ -172,7 +172,7 @@ void lynx_sound_device::init() void lynx_sound_device::device_start() { - m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 1, machine().sample_rate()); m_usec_per_sample = 1000000 / machine().sample_rate(); m_timer_delegate.resolve(); init(); @@ -182,7 +182,7 @@ void lynx_sound_device::device_start() void lynx2_sound_device::device_start() { - m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); m_usec_per_sample = 1000000 / machine().sample_rate(); m_timer_delegate.resolve(); init(); @@ -467,39 +467,41 @@ void lynx_sound_device::write(offs_t offset, uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void lynx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void lynx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int v; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (int i = 0; i < samples; i++, buffer++) + for (int i = 0; i < buffer.samples(); i++) { - *buffer = 0; + s32 result = 0; for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) { execute(channel); v = m_audio[channel].reg.output; - *buffer += v * 15; // where does the *15 come from? + result += v * 15; // where does the *15 come from? } + buffer.put_int(i, result, 32768); } } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void lynx2_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left=outputs[0], *right=outputs[1]; + auto &left=outputs[0]; + auto &right=outputs[1]; int v; - for (int i = 0; i < samples; i++, left++, right++) + for (int i = 0; i < left.samples(); i++) { - *left = 0; - *right= 0; + s32 lsum = 0; + s32 rsum = 0; for (int channel = 0; channel < LYNX_AUDIO_CHANNELS; channel++) { execute(channel); @@ -507,17 +509,19 @@ void lynx2_sound_device::sound_stream_update_legacy(sound_stream &stream, stream if (!(m_master_enable & (0x10 << channel))) { if (m_attenuation_enable & (0x10 << channel)) - *left += v * (m_audio[channel].attenuation >> 4); + lsum += v * (m_audio[channel].attenuation >> 4); else - *left += v * 15; + lsum += v * 15; } if (!(m_master_enable & (1 << channel))) { if (m_attenuation_enable & (1 << channel)) - *right += v * (m_audio[channel].attenuation & 0xf); + rsum += v * (m_audio[channel].attenuation & 0xf); else - *right += v * 15; + rsum += v * 15; } } + left.put_int(i, lsum, 32768); + right.put_int(i, rsum, 32768); } } diff --git a/src/mame/audio/lynx.h b/src/mame/audio/lynx.h index 11b983089a7..07bfef1a98b 100644 --- a/src/mame/audio/lynx.h +++ b/src/mame/audio/lynx.h @@ -45,7 +45,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void reset_channel(LYNX_AUDIO *channel); void shift(int chan_nr); @@ -75,7 +75,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; diff --git a/src/mame/audio/micro3d.cpp b/src/mame/audio/micro3d.cpp index 52f723ef55f..5f38bdad788 100644 --- a/src/mame/audio/micro3d.cpp +++ b/src/mame/audio/micro3d.cpp @@ -68,9 +68,9 @@ void micro3d_sound_device::lp_filter::init(double fsval) proto_coef[1].b1 = 1.847759; proto_coef[1].b2 = 1.0; - coef = make_unique_clear<float[]>(4 * 2 + 1); + std::fill(std::begin(coef), std::end(coef), 0); fs = fsval; - history = make_unique_clear<float[]>(2 * 2); + std::fill(std::begin(history), std::end(history), 0); } static void prewarp(double *a0, double *a1, double *a2,double fc, double fs) @@ -104,7 +104,7 @@ static void bilinear(double a0, double a1, double a2, void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc) { - float *c = coef.get() + 1; + float *c = &coef[1]; for (int nInd = 0; nInd < 2; nInd++) { @@ -182,7 +182,7 @@ micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const void micro3d_sound_device::device_start() { /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_stream = stream_alloc(0, 2, machine().sample_rate()); m_filter.init(machine().sample_rate()); m_noise_filters[0].configure(2.7e3 + 2.7e3, 1.0e-6); @@ -206,20 +206,20 @@ void micro3d_sound_device::device_reset() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { lp_filter *iir = &m_filter; float pan_l, pan_r; - stream_sample_t *fl = &outputs[0][0]; - stream_sample_t *fr = &outputs[1][0]; + auto &fl = outputs[0]; + auto &fr = outputs[1]; /* Clear the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + fl.fill(0); + fr.fill(0); if (m_gain == 0) return; @@ -227,7 +227,7 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre pan_l = (float)(255 - m_dac[PAN]) / 255.0f; pan_r = (float)(m_dac[PAN]) / 255.0f; - while (samples--) + for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { unsigned int i; float *hist1_ptr,*hist2_ptr,*coef_ptr; @@ -255,9 +255,9 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre input += white; input *= 200.0f; - coef_ptr = iir->coef.get(); + coef_ptr = &iir->coef[0]; - hist1_ptr = iir->history.get(); + hist1_ptr = &iir->history[0]; hist2_ptr = hist1_ptr + 1; /* 1st number of coefficients array is overall input scale factor, * or filter gain */ @@ -279,15 +279,9 @@ void micro3d_sound_device::sound_stream_update_legacy(sound_stream &stream, stre hist1_ptr++; hist2_ptr++; } - output *= 3.5f; + output *= 3.5f / 32768.f; - /* Clip */ - if (output > 32767) - output = 32767; - else if (output < -32768) - output = -32768; - - *fl++ = output * pan_l; - *fr++ = output * pan_r; + fl.put_clamp(sampindex, output * pan_l, 1.0); + fr.put_clamp(sampindex, output * pan_r, 1.0); } } diff --git a/src/mame/audio/micro3d.h b/src/mame/audio/micro3d.h index 937d1fbed74..04b2b284deb 100644 --- a/src/mame/audio/micro3d.h +++ b/src/mame/audio/micro3d.h @@ -24,7 +24,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: enum dac_registers { @@ -45,8 +45,8 @@ private: void init(double fs); void recompute(double k, double q, double fc); - std::unique_ptr<float[]> history; - std::unique_ptr<float[]> coef; + float history[2 * 2]; + float coef[4 * 2 + 1]; double fs; biquad proto_coef[2]; }; diff --git a/src/mame/audio/nl_armora.cpp b/src/mame/audio/nl_armora.cpp index 53b102be96b..05775622295 100644 --- a/src/mame/audio/nl_armora.cpp +++ b/src/mame/audio/nl_armora.cpp @@ -224,7 +224,7 @@ NETLIST_START(armora) D_1N914(D8) - Q_2N3904(Q1) // NPN +// Q_2N3904(Q1) // NPN -- not used Q_2N3906(Q2) // PNP Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP diff --git a/src/mame/audio/nl_astrob.cpp b/src/mame/audio/nl_astrob.cpp index 8ff80c77c2f..e4718888a4b 100644 --- a/src/mame/audio/nl_astrob.cpp +++ b/src/mame/audio/nl_astrob.cpp @@ -96,7 +96,7 @@ NETLIST_START(astrob) PARAM(Solver.Solver_54.DYNAMIC_MIN_TIMESTEP, 4e-6) // gets rid of NR loops failure #else #if !(ENABLE_SONAR_ALT) - PARAM(Solver.Solver_42.DYNAMIC_MIN_TIMESTEP, 6e-6) // gets rid of NR loops failure + PARAM(Solver.Solver_41.DYNAMIC_MIN_TIMESTEP, 6e-6) // gets rid of NR loops failure #endif #endif #else @@ -479,7 +479,7 @@ NETLIST_START(astrob) Q_2N4403(Q1) Q_2N4403(Q2) Q_2N4403(Q3) - Q_2N4093(Q4) + //Q_2N4093(Q4) // avoid singular matrix being created Q_2N4093(Q5) Q_2N4093(Q6) Q_2N4403(Q7) @@ -488,6 +488,13 @@ NETLIST_START(astrob) Q_2N4403(Q10) TL084_DIP(U1) // Op. Amp. + NET_C(U1.4, I_V12) + NET_C(U1.11, I_VM12) + + TL084_DIP(U2) // Op. Amp. + NET_C(U2.4, I_V12) + NET_C(U2.11, I_VM12) + #if (ENABLE_SONAR_ALT) // Oscillators are of order 1kHz. No need to to have UGF in MHz range PARAM(U1.A.MODEL, "TL084(TYPE=3 UGF=10k)") @@ -499,12 +506,6 @@ NETLIST_START(astrob) PARAM(U2.C.MODEL, "TL084(TYPE=3 UGF=10k)") PARAM(U2.D.MODEL, "TL084(TYPE=3 UGF=10k)") #endif - NET_C(U1.4, I_V12) - NET_C(U1.11, I_VM12) - - TL084_DIP(U2) // Op. Amp. - NET_C(U2.4, I_V12) - NET_C(U2.11, I_VM12) CD4017_DIP(U3) // Decade Counter/Divider NET_C(U3.8, GND) @@ -675,7 +676,7 @@ NETLIST_START(astrob) NET_C(U2.3, GND) NET_C(U2.2, D6.A, R65.1) - NET_C(U2.14, D6.K, R62.1) + NET_C(U2.1, D6.K, R62.1) NET_C(R62.2, R63.2, C24.1, C25.1) NET_C(R63.1, GND) NET_C(R65.2, R64.2, U2.7, C25.2, R66.2) @@ -691,13 +692,30 @@ NETLIST_START(astrob) NET_C(C40.2, R93.1, U2.9) NET_C(U2.10, GND) + NET_C(R5.1, R40.1, R114.1, Q3.B, R95.1, R66.1) + #if (ENABLE_SONAR_ALT) + // The oscillators need a small offset voltage to start oscillating. + // Without frontiers I assume the offset voltage is created due to the + // slight differences in resistor values in the four (now connected) + // oscillators. + + ANALOG_INPUT(I_VOFF, 0.1) + RES(RDUM1, RES_M(1)) + RES(RDUM2, RES_M(1)) + RES(RDUM3, RES_M(1)) + RES(RDUM4, RES_M(1)) + NET_C(R5.2, RDUM1.1) + NET_C(R40.2, RDUM2.1) + NET_C(R95.2, RDUM3.1) + NET_C(R66.2, RDUM4.1) + NET_C(I_VOFF, RDUM1.2, RDUM2.2, RDUM3.2, RDUM4.2) + OPTIMIZE_FRONTIER(R5.2, RES_K(68), 192) OPTIMIZE_FRONTIER(R40.2, RES_K(68), 192) OPTIMIZE_FRONTIER(R95.2, RES_K(68), 192) OPTIMIZE_FRONTIER(R66.2, RES_K(68), 192) #endif - NET_C(R5.1, R40.1, R114.1, Q3.B, R95.1, R66.1) #endif NET_C(R114.2, GND) @@ -1183,6 +1201,7 @@ NETLIST_START(astrob) // // Unconnected outputs // + NET_C(GND, U7.7, U7.14) // avoid singular matrices #if (ENABLE_FRONTIERS) #define RXX 192 diff --git a/src/mame/audio/nl_barrier.cpp b/src/mame/audio/nl_barrier.cpp index edd7c3d71a3..929e666eb08 100644 --- a/src/mame/audio/nl_barrier.cpp +++ b/src/mame/audio/nl_barrier.cpp @@ -123,11 +123,13 @@ NETLIST_START(barrier) D_1N914(CR5) D_1N914(CR6) +#if !(HLE_NOISE_GEN) Q_2N3906(Q1) // PNP Q_2N3904(Q2) // NPN +#endif Q_2N6426(Q3) // NPN Darlington - Q_2N6292(Q4) // NPN - Q_2N6107(Q5) // PNP +// Q_2N6292(Q4) // NPN -- not used +// Q_2N6107(Q5) // PNP -- not used Q_2N6426(Q6) // NPN Darlington Q_2N3904(Q7) // NPN diff --git a/src/mame/audio/nl_boxingb.cpp b/src/mame/audio/nl_boxingb.cpp index 39be6050b19..78f7bbac761 100644 --- a/src/mame/audio/nl_boxingb.cpp +++ b/src/mame/audio/nl_boxingb.cpp @@ -362,31 +362,41 @@ NETLIST_START(boxingb) Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP Q_2N3904(Q5) // NPN +#if !(HLE_CHIRPING_VCO) Q_2N3904(Q6) // NPN +#endif Q_2N3906(Q7) // PNP Q_2N3904(Q8) // NPN +#if !(HLE_DYING_BUG_VCO) Q_2N3904(Q9) // NPN +#endif Q_2N3906(Q10) // PNP Q_2N3904(Q11) // NPN +#if !(HLE_CRACKING_VCO) Q_2N3904(Q12) // NPN +#endif Q_2N3906(Q13) // PNP Q_2N3904(Q14) // NPN +#if !(HLE_BEETLE_VCO) Q_2N3904(Q15) // NPN +#endif Q_2N3906(Q16) // PNP Q_2N3904(Q17) // NPN Q_2N3906(Q18) // PNP Q_2N3906(Q19) // PNP Q_2N3906(Q20) // PNP Q_2N3904(Q21) // NPN +#if !(HLE_CANNON_VCO) Q_2N3904(Q22) // NPN +#endif Q_2N3906(Q23) // PNP Q_2N3906(Q24) // PNP Q_2N3906(Q25) // PNP Q_2N3906(Q26) // PNP // Q_2N6292(Q27) // PNP -- part of final amp (not emulated) // Q_2N6107(Q28) // NPN -- part of final amp (not emulated) - Q_2N5210(Q29) // NPN - Q_2N5210(Q30) // NPN +// Q_2N5210(Q29) // NPN -- not used +// Q_2N5210(Q30) // NPN -- not used Q_2N3906(Q31) // PNP Q_2N3906(Q32) // PNP Q_2N3906(Q33) // PNP diff --git a/src/mame/audio/nl_ripoff.cpp b/src/mame/audio/nl_ripoff.cpp index 84ccfea212a..60e525cb615 100644 --- a/src/mame/audio/nl_ripoff.cpp +++ b/src/mame/audio/nl_ripoff.cpp @@ -239,9 +239,15 @@ NETLIST_START(ripoff) Q_2N3906(Q5) // PNP // Q_2N6292(Q6) // PNP -- part of final amp (not emulated) // Q_2N6107(Q7) // PNP -- part of final amp (not emulated) +#if !(HLE_LASER_VCO) Q_2N3904(Q8) // NPN +#endif +#if !(HLE_TORPEDO_VCO) Q_2N3904(Q9) // NPN +#endif +#if !(HLE_BACKGROUND_VCOS) Q_2N3904(Q10) // NPN +#endif AMI_S2688(IC1) // Noise generator diff --git a/src/mame/audio/nl_solarq.cpp b/src/mame/audio/nl_solarq.cpp index be6ef4bca6f..ec7795e1cfa 100644 --- a/src/mame/audio/nl_solarq.cpp +++ b/src/mame/audio/nl_solarq.cpp @@ -298,7 +298,9 @@ NETLIST_START(solarq) Q_2N3906(Q10) // PNP Q_2N3906(Q11) // PNP Q_2N3904(Q12) // NPN +#if !(HLE_CAPTURE_VCO) Q_2N3904(Q13) // NPN +#endif Q_2N3906(Q14) // PNP Q_2N3906(Q15) // PNP Q_2N3906(Q16) // PNP diff --git a/src/mame/audio/nl_spacewar.cpp b/src/mame/audio/nl_spacewar.cpp index 778906b31ad..1d1d9e7df40 100644 --- a/src/mame/audio/nl_spacewar.cpp +++ b/src/mame/audio/nl_spacewar.cpp @@ -128,11 +128,13 @@ NETLIST_START(spacewar) D_1N914(CR5) D_1N914(CR6) +#if !(HLE_NOISE_GEN) Q_2N3906(Q1) // PNP Q_2N3904(Q2) // NPN +#endif Q_2N6426(Q3) // NPN Darlington - Q_2N6292(Q4) // NPN - Q_2N6107(Q5) // PNP +// Q_2N6292(Q4) // NPN -- not used +// Q_2N6107(Q5) // PNP -- not used Q_2N6426(Q6) // NPN Darlington Q_2N3904(Q7) // NPN diff --git a/src/mame/audio/nl_starcas.cpp b/src/mame/audio/nl_starcas.cpp index fd6dee8d968..1792217fd01 100644 --- a/src/mame/audio/nl_starcas.cpp +++ b/src/mame/audio/nl_starcas.cpp @@ -281,11 +281,15 @@ NETLIST_START(wotw) D_1N914B(D9) D_1N914B(D10) +#if !(HLE_BACKGROUND_VCO) Q_2N3904(Q1) // NPN +#endif Q_2N3904(Q2) // NPN Q_2N3906(Q3) // PNP Q_2N3904(Q4) // NPN +#if !(HLE_LASER_VCO) Q_2N3904(Q5) // NPN +#endif Q_2N3906(Q6) // PNP Q_2N3906(Q7) // PNP Q_2N3906(Q8) // PNP diff --git a/src/mame/audio/nl_tailg.cpp b/src/mame/audio/nl_tailg.cpp index fab4b88bf9c..63c01ae4cf7 100644 --- a/src/mame/audio/nl_tailg.cpp +++ b/src/mame/audio/nl_tailg.cpp @@ -204,8 +204,8 @@ NETLIST_START(tailg) D_1N914(D8) D_1N914(D9) - Q_2N3904(Q1) // NPN - Q_2N3904(Q2) // NPN +// Q_2N3904(Q1) // NPN -- not used +// Q_2N3904(Q2) // NPN -- not used Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP Q_2N3906(Q5) // PNP diff --git a/src/mame/audio/nl_warrior.cpp b/src/mame/audio/nl_warrior.cpp index d5403559420..cd439d0fff4 100644 --- a/src/mame/audio/nl_warrior.cpp +++ b/src/mame/audio/nl_warrior.cpp @@ -168,7 +168,9 @@ NETLIST_START(warrior) Q_2N3906(Q2) // PNP Q_2N3906(Q3) // PNP Q_2N3906(Q4) // PNP +#if !(HLE_PITFALL_VCO) Q_2N3904(Q5) // NPN +#endif // Q_2N5878(Q6) // NPN -- part of final amp (not emulated) // Q_2N5876(Q7) // PNP -- part of final amp (not emulated) diff --git a/src/mame/audio/phoenix.cpp b/src/mame/audio/phoenix.cpp index 7c43519c186..772f4bb889a 100644 --- a/src/mame/audio/phoenix.cpp +++ b/src/mame/audio/phoenix.cpp @@ -89,7 +89,7 @@ void phoenix_sound_device::device_start() m_poly18[i] = bits; } - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); save_item(NAME(m_sound_latch_a)); save_item(NAME(m_c24_state.counter)); @@ -101,7 +101,6 @@ void phoenix_sound_device::device_start() save_item(NAME(m_noise_state.polyoffs)); save_item(NAME(m_noise_state.lowpass_counter)); save_item(NAME(m_noise_state.lowpass_polybit)); - save_pointer(NAME(m_poly18), (1ul << (18-5))); } int phoenix_sound_device::update_c24(int samplerate) @@ -520,18 +519,18 @@ void phoenix_sound_device::control_b_w(uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void phoenix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void phoenix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int samplerate = machine().sample_rate(); - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; + int samplerate = buffer.sample_rate(); - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = 0; sum = noise(samplerate) / 2; - *buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767; + buffer.put_int_clamp(sampindex, sum, 32768); } } diff --git a/src/mame/audio/phoenix.h b/src/mame/audio/phoenix.h index 6a02220c30e..30e6edfef10 100644 --- a/src/mame/audio/phoenix.h +++ b/src/mame/audio/phoenix.h @@ -22,7 +22,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct c_state @@ -46,7 +46,7 @@ private: struct n_state m_noise_state; uint8_t m_sound_latch_a; sound_stream * m_channel; - std::unique_ptr<uint32_t[]> m_poly18; + std::unique_ptr<uint32_t[]> m_poly18; required_device<discrete_device> m_discrete; required_device<tms36xx_device> m_tms; diff --git a/src/mame/audio/pleiads.cpp b/src/mame/audio/pleiads.cpp index ee69320e7d6..965b445f67a 100644 --- a/src/mame/audio/pleiads.cpp +++ b/src/mame/audio/pleiads.cpp @@ -642,7 +642,7 @@ void pleiads_sound_device::common_start() m_poly18[i] = bits; } - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); save_item(NAME(m_sound_latch_a)); save_item(NAME(m_sound_latch_b)); @@ -691,27 +691,27 @@ void pleiads_sound_device::common_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void pleiads_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void pleiads_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int rate = machine().sample_rate(); - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; + int rate = buffer.sample_rate(); - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate); - *buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767; + buffer.put_int_clamp(sampindex, sum, 32768); } } -void naughtyb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void naughtyb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples); + pleiads_sound_device::sound_stream_update(stream, inputs, outputs); } -void popflame_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void popflame_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - pleiads_sound_device::sound_stream_update_legacy(stream, inputs, outputs, samples); + pleiads_sound_device::sound_stream_update(stream, inputs, outputs); } diff --git a/src/mame/audio/pleiads.h b/src/mame/audio/pleiads.h index 0c4ef99b4a9..9dd77f6e857 100644 --- a/src/mame/audio/pleiads.h +++ b/src/mame/audio/pleiads.h @@ -51,7 +51,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void common_start(); inline int tone1(int samplerate); @@ -105,7 +105,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; @@ -119,7 +119,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; diff --git a/src/mame/audio/polepos.cpp b/src/mame/audio/polepos.cpp index 48865d300e0..a1dd8bc24dc 100644 --- a/src/mame/audio/polepos.cpp +++ b/src/mame/audio/polepos.cpp @@ -225,7 +225,7 @@ polepos_sound_device::polepos_sound_device(const machine_config &mconfig, const void polepos_sound_device::device_start() { - m_stream = stream_alloc_legacy(0, 1, OUTPUT_RATE); + m_stream = stream_alloc(0, 1, OUTPUT_RATE); m_sample_msb = m_sample_lsb = 0; m_sample_enable = 0; @@ -251,21 +251,21 @@ void polepos_sound_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void polepos_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint32_t step, clock, slot; uint8_t *base; double volume, i_total; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; int loop; /* if we're not enabled, just fill with 0 */ if (!m_sample_enable) { - memset(buffer, 0, samples * sizeof(*buffer)); + buffer.fill(0); return; } @@ -279,7 +279,7 @@ void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stre base = &machine().root_device().memregion("engine")->base()[slot * 0x800]; /* fill in the sample */ - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { m_filter_engine[0].x0 = (3.4 / 255 * base[(m_current_position >> 12) & 0x7ff] - 2) * volume; m_filter_engine[1].x0 = m_filter_engine[0].x0; @@ -296,9 +296,9 @@ void polepos_sound_device::sound_stream_update_legacy(sound_stream &stream, stre i_total += m_filter_engine[loop].y0 / r_filt_out[loop]; } - i_total *= r_filt_total * 32000/2; /* now contains voltage adjusted by final gain */ + i_total *= r_filt_total/2; /* now contains voltage adjusted by final gain */ - *buffer++ = (int)i_total; + buffer.put(sampindex, i_total); m_current_position += step; } } diff --git a/src/mame/audio/polepos.h b/src/mame/audio/polepos.h index 430078088b2..b8611218284 100644 --- a/src/mame/audio/polepos.h +++ b/src/mame/audio/polepos.h @@ -19,7 +19,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: DECLARE_WRITE_LINE_MEMBER(clson_w); diff --git a/src/mame/audio/redbaron.cpp b/src/mame/audio/redbaron.cpp index c08036c7d3b..51586a809fd 100644 --- a/src/mame/audio/redbaron.cpp +++ b/src/mame/audio/redbaron.cpp @@ -102,19 +102,19 @@ void redbaron_sound_device::device_start() m_vol_crash[i] = 32767 * r0 / (r0 + r1); } - m_channel = stream_alloc_legacy(0, 1, OUTPUT_RATE); + m_channel = stream_alloc(0, 1, OUTPUT_RATE); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void redbaron_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; - while( samples-- ) + auto &buffer = outputs[0]; + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int sum = 0; @@ -214,7 +214,7 @@ void redbaron_sound_device::sound_stream_update_legacy(sound_stream &stream, str if( m_squeal_out ) sum += 32767 * 40 / 100; - *buffer++ = sum; + buffer.put_int(sampindex, sum, 32768); } } diff --git a/src/mame/audio/redbaron.h b/src/mame/audio/redbaron.h index a66b74dff21..71f072ff44f 100644 --- a/src/mame/audio/redbaron.h +++ b/src/mame/audio/redbaron.h @@ -21,7 +21,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: std::unique_ptr<int16_t[]> m_vol_lookup; diff --git a/src/mame/audio/segag80r.cpp b/src/mame/audio/segag80r.cpp index 90a8463cbad..4acd7c2104a 100644 --- a/src/mame/audio/segag80r.cpp +++ b/src/mame/audio/segag80r.cpp @@ -46,7 +46,7 @@ void sega005_sound_device::device_start() segag80r_state *state = machine().driver_data<segag80r_state>(); /* create the stream */ - m_sega005_stream = stream_alloc_legacy(0, 1, SEGA005_COUNTER_FREQ); + m_sega005_stream = stream_alloc(0, 1, SEGA005_COUNTER_FREQ); /* create a timer for the 555 */ m_sega005_sound_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega005_sound_device::sega005_auto_timer), this)); @@ -57,17 +57,17 @@ void sega005_sound_device::device_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void sega005_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { segag80r_state *state = machine().driver_data<segag80r_state>(); const uint8_t *sound_prom = state->memregion("proms")->base(); int i; /* no implementation yet */ - for (i = 0; i < samples; i++) + for (i = 0; i < outputs[0].samples(); i++) { if (!(state->m_sound_state[1] & 0x10) && (++state->m_square_count & 0xff) == 0) { @@ -78,7 +78,7 @@ void sega005_sound_device::sound_stream_update_legacy(sound_stream &stream, stre state->m_square_state += 2; } - outputs[0][i] = (state->m_square_state & 2) ? 0x7fff : 0x0000; + outputs[0].put(i, (state->m_square_state & 2) ? 1.0 : 0.0); } } diff --git a/src/mame/audio/segausb.cpp b/src/mame/audio/segausb.cpp index ef6343e945d..dc87b73ae8c 100644 --- a/src/mame/audio/segausb.cpp +++ b/src/mame/audio/segausb.cpp @@ -100,7 +100,7 @@ void usb_sound_device::device_start() #else - m_stream = stream_alloc_legacy(0, 1, USB_2MHZ_CLOCK); + m_stream = stream_alloc(0, 1, USB_2MHZ_CLOCK); m_noise_shift = 0x15555; @@ -451,15 +451,15 @@ void usb_sound_device::env_w(int which, u8 offset, u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void usb_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *dest = outputs[0]; + auto &dest = outputs[0]; // iterate over samples - while (samples--) + for (int sampindex = 0; sampindex < dest.samples(); sampindex++) { /*---------------- Noise Source @@ -590,7 +590,7 @@ void usb_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s WEIGHT */ - *dest++ = 3000 * m_final_filter.step_cr(sample); + dest.put(sampindex, 0.1 * m_final_filter.step_cr(sample)); } } diff --git a/src/mame/audio/segausb.h b/src/mame/audio/segausb.h index e34d892142d..e1e4a581782 100644 --- a/src/mame/audio/segausb.h +++ b/src/mame/audio/segausb.h @@ -62,7 +62,7 @@ protected: #if (!ENABLE_SEGAUSB_NETLIST) // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; #endif private: diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp index 17075367960..57c6253fe9b 100644 --- a/src/mame/audio/seibu.cpp +++ b/src/mame/audio/seibu.cpp @@ -385,7 +385,7 @@ seibu_adpcm_device::seibu_adpcm_device(const machine_config &mconfig, const char void seibu_adpcm_device::device_start() { m_playing = 0; - m_stream = stream_alloc_legacy(0, 1, clock()); + m_stream = stream_alloc(0, 1, clock()); m_adpcm.reset(); save_item(NAME(m_current)); @@ -443,14 +443,15 @@ void seibu_adpcm_device::ctl_w(u8 data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void seibu_adpcm_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *dest = outputs[0]; + auto &dest = outputs[0]; - while (m_playing && samples > 0) + int sampindex; + for (sampindex = 0; m_playing && sampindex < dest.samples(); sampindex++) { int val = (m_base[m_current] >> m_nibble) & 15; @@ -462,12 +463,7 @@ void seibu_adpcm_device::sound_stream_update_legacy(sound_stream &stream, stream m_playing = 0; } - *dest++ = m_adpcm.clock(val) << 4; - samples--; - } - while (samples > 0) - { - *dest++ = 0; - samples--; + dest.put_int(sampindex, m_adpcm.clock(val), 32768 >> 4); } + dest.fill(0, sampindex); } diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 9954b462205..1c53beb7746 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -145,7 +145,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state diff --git a/src/mame/audio/snk6502.cpp b/src/mame/audio/snk6502.cpp index 4d5550e08c3..0dc3b1868a5 100644 --- a/src/mame/audio/snk6502.cpp +++ b/src/mame/audio/snk6502.cpp @@ -165,7 +165,7 @@ void snk6502_sound_device::device_start() // 38.99 Hz update (according to schematic) set_music_clock(M_LN2 * (RES_K(18) * 2 + RES_K(1)) * CAP_U(1)); - m_tone_stream = stream_alloc_legacy(0, 1, SAMPLE_RATE); + m_tone_stream = stream_alloc(0, 1, SAMPLE_RATE); for (int i = 0; i < NUM_CHANNELS; i++) { @@ -509,17 +509,17 @@ void snk6502_sound_device::speech_w(uint8_t data, const uint16_t *table, int sta */ //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void snk6502_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; for (int i = 0; i < NUM_CHANNELS; i++) validate_tone_channel(i); - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int32_t data = 0; @@ -541,7 +541,7 @@ void snk6502_sound_device::sound_stream_update_legacy(sound_stream &stream, stre } } - *buffer++ = data; + buffer.put_int(sampindex, data, 3768); m_tone_clock += FRAC_ONE; if (m_tone_clock >= m_tone_clock_expire) diff --git a/src/mame/audio/snk6502.h b/src/mame/audio/snk6502.h index 99c0178120c..54474aa8207 100644 --- a/src/mame/audio/snk6502.h +++ b/src/mame/audio/snk6502.h @@ -40,7 +40,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: static constexpr unsigned NUM_CHANNELS = 3; diff --git a/src/mame/audio/socrates.cpp b/src/mame/audio/socrates.cpp index 4b49ec0b5bd..4f9731494eb 100644 --- a/src/mame/audio/socrates.cpp +++ b/src/mame/audio/socrates.cpp @@ -43,20 +43,20 @@ void socrates_snd_device::device_start() m_DAC_output = 0x00; /* output */ m_state[0] = m_state[1] = m_state[2] = 0; m_accum[0] = m_accum[1] = m_accum[2] = 0xFF; - m_stream = stream_alloc_legacy(0, 1, clock() ? clock() : machine().sample_rate()); + m_stream = stream_alloc(0, 1, clock() ? clock() : machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void socrates_snd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void socrates_snd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int i = 0; i < samples; i++) + for (int i = 0; i < outputs[0].samples(); i++) { snd_clock(); - outputs[0][i] = ((int)m_DAC_output<<4); + outputs[0].put_int(i, (int)m_DAC_output, 32768 >> 4); } } diff --git a/src/mame/audio/socrates.h b/src/mame/audio/socrates.h index cd2d240079c..a75e5c1ca6f 100644 --- a/src/mame/audio/socrates.h +++ b/src/mame/audio/socrates.h @@ -22,7 +22,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void snd_clock(); static const uint8_t s_volumeLUT[]; diff --git a/src/mame/audio/special.cpp b/src/mame/audio/special.cpp index 9a1383bfec0..40442b2cfb2 100644 --- a/src/mame/audio/special.cpp +++ b/src/mame/audio/special.cpp @@ -41,41 +41,24 @@ specimx_sound_device::specimx_sound_device(const machine_config &mconfig, const void specimx_sound_device::device_start() { m_specimx_input[0] = m_specimx_input[1] = m_specimx_input[2] = 0; - m_mixer_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void specimx_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void specimx_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int16_t channel_0_signal; - int16_t channel_1_signal; - int16_t channel_2_signal; + auto &sample_left = outputs[0]; - stream_sample_t *sample_left = outputs[0]; + stream_buffer::sample_t channel_0_signal = m_specimx_input[0] ? 0.1 : -0.1; + stream_buffer::sample_t channel_1_signal = m_specimx_input[1] ? 0.1 : -0.1; + stream_buffer::sample_t channel_2_signal = m_specimx_input[2] ? 0.1 : -0.1; + stream_buffer::sample_t sum = channel_0_signal + channel_1_signal + channel_2_signal; - channel_0_signal = m_specimx_input[0] ? 3000 : -3000; - channel_1_signal = m_specimx_input[1] ? 3000 : -3000; - channel_2_signal = m_specimx_input[2] ? 3000 : -3000; - - while (samples--) - { - *sample_left = 0; - - /* music channel 0 */ - *sample_left += channel_0_signal; - - /* music channel 1 */ - *sample_left += channel_1_signal; - - /* music channel 2 */ - *sample_left += channel_2_signal; - - sample_left++; - } + sample_left.fill(sum); } diff --git a/src/mame/audio/special.h b/src/mame/audio/special.h index daaa983a2d7..51dca82f12f 100644 --- a/src/mame/audio/special.h +++ b/src/mame/audio/special.h @@ -26,7 +26,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_mixer_channel; diff --git a/src/mame/audio/svis_snd.cpp b/src/mame/audio/svis_snd.cpp index 91fdd2dcce1..ed80d459821 100644 --- a/src/mame/audio/svis_snd.cpp +++ b/src/mame/audio/svis_snd.cpp @@ -45,22 +45,23 @@ void svision_sound_device::device_start() memset(&m_noise, 0, sizeof(m_noise)); memset(m_channel, 0, sizeof(m_channel)); - m_mixer_channel = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void svision_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *left=outputs[0], *right=outputs[1]; + auto &left=outputs[0]; + auto &right=outputs[1]; - for (int i = 0; i < samples; i++, left++, right++) + for (int i = 0; i < left.samples(); i++) { - *left = 0; - *right = 0; + s32 lsum = 0; + s32 rsum = 0; for (int j = 0; j < ARRAY_LENGTH(m_channel); j++) { CHANNEL &channel(m_channel[j]); @@ -88,9 +89,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre { int16_t s = on ? channel.volume << 8 : 0; if (j == 0) - *right += s; + rsum += s; else - *left += s; + lsum += s; } } channel.pos++; @@ -103,9 +104,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre int16_t s = (m_noise.value ? 1 << 8: 0) * m_noise.volume; int b1, b2; if (m_noise.left) - *left += s; + lsum += s; if (m_noise.right) - *right += s; + rsum += s; m_noise.pos += m_noise.step; if (m_noise.pos >= 1.0) { @@ -146,9 +147,9 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre s = (sample & 0xf0) >> 4; s <<= 8; if (m_dma.left) - *left += s; + lsum += s; if (m_dma.right) - *right += s; + rsum += s; m_dma.pos += m_dma.step; if (m_dma.pos >= m_dma.size) { @@ -157,6 +158,8 @@ void svision_sound_device::sound_stream_update_legacy(sound_stream &stream, stre m_irq_cb(1); } } + left.put_int(i, lsum, 32768); + right.put_int(i, rsum, 32768); } } diff --git a/src/mame/audio/svis_snd.h b/src/mame/audio/svis_snd.h index 9b7efad6353..d080976261b 100644 --- a/src/mame/audio/svis_snd.h +++ b/src/mame/audio/svis_snd.h @@ -41,7 +41,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct NOISE diff --git a/src/mame/audio/tiamc1.cpp b/src/mame/audio/tiamc1.cpp index d99de897c22..67049496ceb 100644 --- a/src/mame/audio/tiamc1.cpp +++ b/src/mame/audio/tiamc1.cpp @@ -77,7 +77,7 @@ void tiamc1_sound_device::device_start() timer8253_reset(&m_timer0); timer8253_reset(&m_timer1); - m_channel = stream_alloc_legacy(0, 1, clock() / CLOCK_DIVIDER); + m_channel = stream_alloc(0, 1, clock() / CLOCK_DIVIDER); m_timer1_divider = 0; @@ -104,14 +104,14 @@ void tiamc1_sound_device::device_start() //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tiamc1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int count, o0, o1, o2, len, orval = 0; - len = samples * CLOCK_DIVIDER; + len = outputs[0].samples() * CLOCK_DIVIDER; for (count = 0; count < len; count++) { @@ -140,7 +140,7 @@ void tiamc1_sound_device::sound_stream_update_legacy(sound_stream &stream, strea if ((count + 1) % CLOCK_DIVIDER == 0) { - outputs[0][count / CLOCK_DIVIDER] = orval ? 0x2828 : 0; + outputs[0].put(count / CLOCK_DIVIDER, orval ? 0.3 : 0.0); orval = 0; } } diff --git a/src/mame/audio/tiamc1.h b/src/mame/audio/tiamc1.h index d8834816899..f469e8a40e0 100644 --- a/src/mame/audio/tiamc1.h +++ b/src/mame/audio/tiamc1.h @@ -25,7 +25,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct timer8253chan diff --git a/src/mame/audio/timeplt.cpp b/src/mame/audio/timeplt.cpp index 7fe94dd46c7..f626a8f98f9 100644 --- a/src/mame/audio/timeplt.cpp +++ b/src/mame/audio/timeplt.cpp @@ -34,7 +34,6 @@ locomotn_audio_device::locomotn_audio_device(const machine_config &mconfig, cons timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) - , device_sound_interface(mconfig, *this) , m_soundcpu(*this, "tpsound") , m_soundlatch(*this, "soundlatch") , m_filter_0(*this, "filter.0.%u", 0) @@ -226,13 +225,3 @@ void locomotn_audio_device::device_add_mconfig(machine_config &config) /* basic machine hardware */ m_soundcpu->set_addrmap(AS_PROGRAM, &locomotn_audio_device::locomotn_sound_map); } - -//------------------------------------------------- -// sound_stream_update_legacy - handle a stream update -//------------------------------------------------- - -void timeplt_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - // should never get here - fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n"); -} diff --git a/src/mame/audio/timeplt.h b/src/mame/audio/timeplt.h index 8e69d20caa1..b4e5b7c0677 100644 --- a/src/mame/audio/timeplt.h +++ b/src/mame/audio/timeplt.h @@ -10,7 +10,7 @@ #include "sound/ay8910.h" #include "sound/flt_rc.h" -class timeplt_audio_device : public device_t, public device_sound_interface +class timeplt_audio_device : public device_t { public: timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 14'318'181); @@ -26,9 +26,6 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; - // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - void filter_w(offs_t offset, uint8_t data); uint8_t portB_r(); diff --git a/src/mame/audio/trackfld.cpp b/src/mame/audio/trackfld.cpp index bf139f858e9..9a8a863d551 100644 --- a/src/mame/audio/trackfld.cpp +++ b/src/mame/audio/trackfld.cpp @@ -15,7 +15,6 @@ DEFINE_DEVICE_TYPE(TRACKFLD_AUDIO, trackfld_audio_device, "trackfld_audio", "Tra trackfld_audio_device::trackfld_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TRACKFLD_AUDIO, tag, owner, clock) - , device_sound_interface(mconfig, *this) , m_audiocpu(*this, finder_base::DUMMY_TAG) , m_vlm(*this, finder_base::DUMMY_TAG) , m_last_addr(0) @@ -130,13 +129,3 @@ WRITE_LINE_MEMBER(trackfld_audio_device::sh_irqtrigger_w) m_last_irq = state; } - -//------------------------------------------------- -// sound_stream_update_legacy - handle a stream update -//------------------------------------------------- - -void trackfld_audio_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) -{ - // should never get here - fatalerror("sound_stream_update_legacy called; not applicable to legacy sound devices\n"); -} diff --git a/src/mame/audio/trackfld.h b/src/mame/audio/trackfld.h index f1502443562..141916cec65 100644 --- a/src/mame/audio/trackfld.h +++ b/src/mame/audio/trackfld.h @@ -8,7 +8,7 @@ #include "sound/vlm5030.h" #include "cpu/m6800/m6800.h" -class trackfld_audio_device : public device_t, public device_sound_interface +class trackfld_audio_device : public device_t { public: template <typename T, typename U> @@ -33,9 +33,6 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; - private: optional_device<cpu_device> m_audiocpu; optional_device<vlm5030_device> m_vlm; diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp index 4d8414b0118..a2f9ecdb5af 100644 --- a/src/mame/audio/turrett.cpp +++ b/src/mame/audio/turrett.cpp @@ -47,7 +47,7 @@ void turrett_device::device_start() space().cache(m_cache); // Create the sound stream - m_stream = stream_alloc_legacy(0, 2, 44100); + m_stream = stream_alloc(0, 2, 44100); // Create the volume table for (int i = 0; i < 0x4f; ++i) @@ -78,20 +78,17 @@ void turrett_device::device_reset() //------------------------------------------------- -// sound_stream_update_legacy - update sound stream +// sound_stream_update - update sound stream //------------------------------------------------- -void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void turrett_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // Silence the buffers - memset(outputs[0], 0x00, sizeof(stream_sample_t) * samples); - memset(outputs[1], 0x00, sizeof(stream_sample_t) * samples); + outputs[0].fill(0); + outputs[1].fill(0); for (int ch = 0; ch < SOUND_CHANNELS; ++ch) { - stream_sample_t *l = outputs[0]; - stream_sample_t *r = outputs[1]; - if (m_channels[ch].m_playing) { uint32_t &addr = m_channels[ch].m_address; @@ -104,7 +101,7 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam // Channels 30 and 31 expect interleaved stereo samples uint32_t incr = (ch >= 30) ? 2 : 1; - for (int s = 0; s < samples; ++s) + for (int s = 0; s < outputs[0].samples(); ++s) { int16_t sample = m_cache.read_word(addr << 1); @@ -116,8 +113,8 @@ void turrett_device::sound_stream_update_legacy(sound_stream &stream, stream_sam addr += incr; - *l++ += (sample * lvol) >> 17; - *r++ += (sample * rvol) >> 17; + outputs[0].add_int(s, (sample * lvol) >> 17, 32768); + outputs[1].add_int(s, (sample * rvol) >> 17, 32768); } } } diff --git a/src/mame/audio/tvc.cpp b/src/mame/audio/tvc.cpp index e30c79ef959..84495e0838b 100644 --- a/src/mame/audio/tvc.cpp +++ b/src/mame/audio/tvc.cpp @@ -31,7 +31,7 @@ void tvc_sound_device::device_start() // resolve callbacks m_write_sndint.resolve_safe(); - m_stream = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_stream = stream_alloc(0, 1, machine().sample_rate()); m_sndint_timer = timer_alloc(TIMER_SNDINT); } @@ -58,19 +58,19 @@ void tvc_sound_device::device_timer(emu_timer &timer, device_timer_id id, int pa } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tvc_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int rate = machine().sample_rate() / 2; - stream_sample_t *output = outputs[0]; + auto &output = outputs[0]; + int rate = output.sample_rate() / 2; if (m_enabled && m_freq) { - while( samples-- > 0 ) + for (int sampindex = 0; sampindex < output.samples(); sampindex++) { - *output++ = m_signal * (m_volume * 0x0800); + output.put_int(sampindex, m_signal * m_volume, 32768 / 0x0800); m_incr -= m_freq; while(m_incr < 0) { @@ -82,7 +82,7 @@ void tvc_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s else { // fill output with 0 if the sound is disabled - memset(output, 0, samples * sizeof(stream_sample_t)); + output.fill(0); } } diff --git a/src/mame/audio/tvc.h b/src/mame/audio/tvc.h index 669184a0a2b..004ed6975bf 100644 --- a/src/mame/audio/tvc.h +++ b/src/mame/audio/tvc.h @@ -34,7 +34,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: static const device_timer_id TIMER_SNDINT = 0; diff --git a/src/mame/audio/tx1.cpp b/src/mame/audio/tx1.cpp index a6dd9d2aeb6..22f3e23ec5b 100644 --- a/src/mame/audio/tx1.cpp +++ b/src/mame/audio/tx1.cpp @@ -111,7 +111,7 @@ void tx1_sound_device::device_start() /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_stream = stream_alloc(0, 2, machine().sample_rate()); m_freq_to_step = (double)(1 << TX1_FRAC) / (double)machine().sample_rate(); /* Compute the engine resistor weights */ @@ -356,20 +356,16 @@ static inline void update_engine(int eng[4]) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void tx1_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { uint32_t step_0, step_1, step_2; double /*gain_0, gain_1,*/ gain_2, gain_3; - stream_sample_t *fl = &outputs[0][0]; - stream_sample_t *fr = &outputs[1][0]; - - /* Clear the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + auto &fl = outputs[0]; + auto &fr = outputs[1]; /* 8253 outputs for the player/opponent engine sounds. */ step_0 = m_pit8253.counts[0].val ? (TX1_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0; @@ -381,7 +377,7 @@ void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s gain_2 = tx1_engine_gains[m_ay_outputb & 0xf]; gain_3 = BIT(m_ay_outputb, 5) ? 1.0f : 1.5f; - while (samples--) + for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { if (m_step0 & ((1 << TX1_FRAC))) { @@ -404,8 +400,8 @@ void tx1_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_s m_step2 &= ((1 << TX1_FRAC) - 1); } - *fl++ = (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2; - *fr++ = (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2; + fl.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768); + fr.put_int(sampindex, (m_pit0 + m_pit1)*gain_3 + 2*m_pit2*gain_2, 32768); m_step0 += step_0; m_step1 += step_1; @@ -662,7 +658,7 @@ void buggyboy_sound_device::device_start() m_eng_voltages[i] = combine_weights(aweights, BIT(tmp[i], 0), BIT(tmp[i], 1), BIT(tmp[i], 2), BIT(tmp[i], 3)); /* Allocate the stream */ - m_stream = stream_alloc_legacy(0, 2, machine().sample_rate()); + m_stream = stream_alloc(0, 2, machine().sample_rate()); m_freq_to_step = (double)(1 << 24) / (double)machine().sample_rate(); } @@ -763,10 +759,10 @@ void buggyboy_sound_device::ym2_b_w(uint8_t data) //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void buggyboy_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* This is admittedly a bit of a hack job... */ @@ -774,12 +770,8 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str int n1_en, n2_en; double gain0, gain1_l, gain1_r; - stream_sample_t *fl = &outputs[0][0]; - stream_sample_t *fr = &outputs[1][0]; - - /* Clear the buffers */ - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + auto &fl = outputs[0]; + auto &fr = outputs[1]; /* 8253 outputs for the player/opponent buggy engine sounds. */ step_0 = m_pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / m_pit8253.counts[0].val * m_freq_to_step) : 0; @@ -796,10 +788,10 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str gain1_l = bb_engine_gains[m_ym2_outputa >> 4] * 5; gain1_r = bb_engine_gains[m_ym2_outputa & 0xf] * 5; - while (samples--) + for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { int i; - stream_sample_t pit0, pit1, n1, n2; + s32 pit0, pit1, n1, n2; pit0 = m_eng_voltages[(m_step0 >> 24) & 0xf]; pit1 = m_eng_voltages[(m_step1 >> 24) & 0xf]; @@ -839,8 +831,8 @@ void buggyboy_sound_device::sound_stream_update_legacy(sound_stream &stream, str else n2 = 8192; - *fl++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l); - *fr++ = n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r); + fl.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_l), 32768); + fr.put_int(sampindex, n1 + n2 + (pit0 * gain0) + (pit1 * gain1_r), 32768); m_step0 += step_0; m_step1 += step_1; diff --git a/src/mame/audio/tx1.h b/src/mame/audio/tx1.h index 71e228e324c..8d8e4d49739 100644 --- a/src/mame/audio/tx1.h +++ b/src/mame/audio/tx1.h @@ -73,7 +73,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void tx1_sound_io(address_map &map); void tx1_sound_prg(address_map &map); @@ -104,9 +104,9 @@ protected: uint8_t m_ppi_latch_b = 0; uint32_t m_ts = 0; - stream_sample_t m_pit0 = 0; - stream_sample_t m_pit1 = 0; - stream_sample_t m_pit2 = 0; + s32 m_pit0 = 0; + s32 m_pit1 = 0; + s32 m_pit2 = 0; double m_weights0[4] = { 0, 0, 0, 0 }; double m_weights1[3] = { 0, 0, 0 }; @@ -155,7 +155,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void ym1_a_w(uint8_t data); diff --git a/src/mame/audio/vboy.cpp b/src/mame/audio/vboy.cpp index 37eec2ee80b..56aa88e9054 100644 --- a/src/mame/audio/vboy.cpp +++ b/src/mame/audio/vboy.cpp @@ -209,7 +209,7 @@ void vboysnd_device::device_start() { uint32_t rate = clock() / 120; // create the stream - m_stream = stream_alloc_legacy(0, 2, rate); + m_stream = stream_alloc(0, 2, rate); m_timer = timer_alloc(0, nullptr); m_timer->adjust(attotime::zero, 0, rate ? attotime::from_hz(rate / 4) : attotime::never); @@ -265,19 +265,18 @@ void vboysnd_device::device_timer(emu_timer &timer, device_timer_id tid, int par } //------------------------------------------------- -// sound_stream_update_legacy - handle update requests for +// sound_stream_update - handle update requests for // our sound stream //------------------------------------------------- -void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vboysnd_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *outL, *outR; int len, i, j, channel; - outL = outputs[0]; - outR = outputs[1]; + auto &outL = outputs[0]; + auto &outR = outputs[1]; - len = samples; + len = outL.samples(); // if (mgetb(m_aram+SST0P) & 0x1) // Sound Stop Reg // goto end; @@ -384,13 +383,9 @@ void vboysnd_device::sound_stream_update_legacy(sound_stream &stream, stream_sam // scale to 16 bits note_left = (note_left << 5) | ((note_left >> 6) & 0x1f); note_right = (note_right << 5) | ((note_right >> 6) & 0x1f); - if (note_left < -32767) note_left = -32767; - if (note_left > 32767) note_left = 32767; - if (note_right < -32767) note_right = -32767; - if (note_right > 32767) note_right = 32767; - *(outL++) = ((int16_t)note_left); - *(outR++) = ((int16_t)note_right); + outL.put_int_clamp(j, (int16_t)note_left, 32768); + outR.put_int_clamp(j, (int16_t)note_right, 32768); } } diff --git a/src/mame/audio/vboy.h b/src/mame/audio/vboy.h index f8d3a050272..ca4de746db3 100644 --- a/src/mame/audio/vboy.h +++ b/src/mame/audio/vboy.h @@ -72,7 +72,7 @@ protected: virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; s_snd_channel snd_channel[5]; diff --git a/src/mame/audio/vc4000.cpp b/src/mame/audio/vc4000.cpp index 84c19a2d942..0454af936a5 100644 --- a/src/mame/audio/vc4000.cpp +++ b/src/mame/audio/vc4000.cpp @@ -31,26 +31,22 @@ vc4000_sound_device::vc4000_sound_device(const machine_config &mconfig, const ch void vc4000_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, machine().sample_rate()); + m_channel = stream_alloc(0, 1, machine().sample_rate()); } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void vc4000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void vc4000_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { int i; - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - for (i = 0; i < samples; i++, buffer++) + for (i = 0; i < buffer.samples(); i++) { - *buffer = 0; - if (m_reg[0] && m_pos <= m_size / 2) - { - *buffer = 0x7fff; - } + buffer.put(i, (m_reg[0] && m_pos <= m_size / 2) ? 1.0 : 0.0); if (m_pos <= m_size) m_pos++; if (m_pos > m_size) diff --git a/src/mame/audio/vc4000.h b/src/mame/audio/vc4000.h index 3917ffa2776..2dad7a87d27 100644 --- a/src/mame/audio/vc4000.h +++ b/src/mame/audio/vc4000.h @@ -28,7 +28,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: void soundport_w(int mode, int data); diff --git a/src/mame/audio/warpwarp.cpp b/src/mame/audio/warpwarp.cpp index 9e00ff069fd..5ef7e52659c 100644 --- a/src/mame/audio/warpwarp.cpp +++ b/src/mame/audio/warpwarp.cpp @@ -52,7 +52,7 @@ void warpwarp_sound_device::device_start() m_clock_16h = clock() / 3 / 2 / 16; m_clock_1v = clock() / 3 / 2 / 384; - m_channel = stream_alloc_legacy(0, 1, m_clock_16h); + m_channel = stream_alloc(0, 1, m_clock_16h); m_sound_volume_timer = timer_alloc(TIMER_SOUND_VOLUME_DECAY); m_music_volume_timer = timer_alloc(TIMER_MUSIC_VOLUME_DECAY); @@ -169,16 +169,16 @@ void warpwarp_sound_device::music2_w(u8 data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void warpwarp_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) - { - stream_sample_t *buffer = outputs[0]; +void warpwarp_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) +{ + auto &buffer = outputs[0]; - while (samples--) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer++ = (m_sound_signal + m_music_signal) / 2; + buffer.put_int(sampindex, m_sound_signal + m_music_signal, 32768 * 2); /* * The music signal is selected at a rate of 2H (1.536MHz) from the diff --git a/src/mame/audio/warpwarp.h b/src/mame/audio/warpwarp.h index 7bf06a4dc25..d4bcdc15d23 100644 --- a/src/mame/audio/warpwarp.h +++ b/src/mame/audio/warpwarp.h @@ -27,7 +27,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/audio/wiping.cpp b/src/mame/audio/wiping.cpp index 0b83b88f8ac..3ce7f02e096 100644 --- a/src/mame/audio/wiping.cpp +++ b/src/mame/audio/wiping.cpp @@ -11,8 +11,6 @@ #include "emu.h" #include "audio/wiping.h" -static constexpr int defgain = 48; - DEFINE_DEVICE_TYPE(WIPING_CUSTOM, wiping_sound_device, "wiping_sound", "Wiping Custom Sound") wiping_sound_device::wiping_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) @@ -23,10 +21,7 @@ wiping_sound_device::wiping_sound_device(const machine_config &mconfig, const ch m_sound_rom(nullptr), m_num_voices(0), m_sound_enable(0), - m_stream(nullptr), - m_mixer_table(nullptr), - m_mixer_lookup(nullptr), - m_mixer_buffer(nullptr) + m_stream(nullptr) { memset(m_channel_list, 0, sizeof(wp_sound_channel)*MAX_VOICES); memset(m_soundregs, 0, sizeof(uint8_t)*0x4000); @@ -42,13 +37,10 @@ void wiping_sound_device::device_start() wp_sound_channel *voice; /* get stream channels */ - m_stream = stream_alloc_legacy(0, 1, clock()/2); + m_stream = stream_alloc(0, 1, clock()/2); /* allocate a buffer to mix into - 1 second's worth should be more than enough */ - m_mixer_buffer = make_unique_clear<short[]>(clock()/2); - - /* build the mixer table */ - make_mixer_table(8, defgain); + m_mixer_buffer.resize(clock()/2); /* extract globals from the interface */ m_num_voices = 8; @@ -81,26 +73,6 @@ void wiping_sound_device::device_start() } } -/* build a table to divide by the number of voices; gain is specified as gain*16 */ -void wiping_sound_device::make_mixer_table(int voices, int gain) -{ - /* allocate memory */ - m_mixer_table = make_unique_clear<int16_t[]>(256 * voices); - - /* find the middle of the table */ - m_mixer_lookup = m_mixer_table.get() + (128 * voices); - - /* fill in the table - 16 bit case */ - for (int i = 0; i < voices * 128; i++) - { - int val = i * gain * 16 / voices; - if (val > 32767) val = 32767; - m_mixer_lookup[ i] = val; - m_mixer_lookup[-i] = -val; - } -} - - /********************************************************************************/ void wiping_sound_device::sound_w(offs_t offset, uint8_t data) @@ -150,12 +122,12 @@ void wiping_sound_device::sound_w(offs_t offset, uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void wiping_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; wp_sound_channel *voice; short *mix; int i; @@ -163,12 +135,12 @@ void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, strea /* if no sound, we're done */ if (m_sound_enable == 0) { - memset(buffer, 0, samples * sizeof(*buffer)); + buffer.fill(0); return; } /* zap the contents of the mixer buffer */ - memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); + std::fill_n(&m_mixer_buffer[0], buffer.samples(), 0); /* loop over each voice and add its contribution */ for (voice = m_channel_list; voice < m_last_channel; voice++) @@ -182,10 +154,10 @@ void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, strea const uint8_t *w = voice->wave; int c = voice->counter; - mix = m_mixer_buffer.get(); + mix = &m_mixer_buffer[0]; /* add our contribution */ - for (i = 0; i < samples; i++) + for (i = 0; i < buffer.samples(); i++) { int offs; @@ -229,7 +201,7 @@ void wiping_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } /* mix it down */ - mix = m_mixer_buffer.get(); - for (i = 0; i < samples; i++) - *buffer++ = m_mixer_lookup[*mix++]; + mix = &m_mixer_buffer[0]; + for (i = 0; i < buffer.samples(); i++) + buffer.put_int(i, *mix++, 128 * MAX_VOICES); } diff --git a/src/mame/audio/wiping.h b/src/mame/audio/wiping.h index d10a26d2848..1f50683387e 100644 --- a/src/mame/audio/wiping.h +++ b/src/mame/audio/wiping.h @@ -17,7 +17,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: /* 8 voices max */ @@ -48,10 +48,7 @@ private: sound_stream *m_stream; /* mixer tables and internal buffers */ - std::unique_ptr<int16_t[]> m_mixer_table; - int16_t *m_mixer_lookup; - std::unique_ptr<short[]> m_mixer_buffer; - std::unique_ptr<short[]> m_mixer_buffer_2; + std::vector<short> m_mixer_buffer; uint8_t m_soundregs[0x4000]; diff --git a/src/mame/audio/wswan.cpp b/src/mame/audio/wswan.cpp index 0e6442cea6d..6f956ffb57c 100644 --- a/src/mame/audio/wswan.cpp +++ b/src/mame/audio/wswan.cpp @@ -62,7 +62,7 @@ constexpr int clk_div = 64; void wswan_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 2, clock() / clk_div); + m_channel = stream_alloc(0, 2, clock() / clk_div); save_item(NAME(m_sweep_step)); save_item(NAME(m_sweep_time)); @@ -164,16 +164,16 @@ int wswan_sound_device::fetch_sample(int channel, int offset) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void wswan_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void wswan_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t sample, left, right; + s32 sample, left, right; - stream_sample_t *outputl = outputs[0]; - stream_sample_t *outputr = outputs[1]; - while( samples-- > 0 ) + auto &outputl = outputs[0]; + auto &outputr = outputs[1]; + for (int sampindex = 0; sampindex < outputl.samples(); sampindex++) { left = right = 0; @@ -268,11 +268,8 @@ void wswan_sound_device::sound_stream_update_legacy(sound_stream &stream, stream right += m_audio4.vol_right * sample; } - left <<= 5; - right <<= 5; - - *outputl++ = left; - *outputr++ = right; + outputl.put_int(sampindex, left, 32768 >> 5); + outputr.put_int(sampindex, right, 32768 >> 5); } } diff --git a/src/mame/audio/wswan.h b/src/mame/audio/wswan.h index e3c4974bf54..f21ad6adbc5 100644 --- a/src/mame/audio/wswan.h +++ b/src/mame/audio/wswan.h @@ -59,7 +59,7 @@ protected: virtual void rom_bank_updated() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: void wswan_ch_set_freq( CHAN *ch, uint16_t freq ); diff --git a/src/mame/audio/xavix.cpp b/src/mame/audio/xavix.cpp index a4b2d12dccb..ab5b2387a86 100644 --- a/src/mame/audio/xavix.cpp +++ b/src/mame/audio/xavix.cpp @@ -27,7 +27,7 @@ void xavix_sound_device::device_start() m_readregs_cb.resolve_safe(0xff); m_readsamples_cb.resolve_safe(0x80); - m_stream = stream_alloc_legacy(0, 2, 163840); + m_stream = stream_alloc(0, 2, 163840); } void xavix_sound_device::device_reset() @@ -43,14 +43,15 @@ void xavix_sound_device::device_reset() } -void xavix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void xavix_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { // reset the output stream - memset(outputs[0], 0, samples * sizeof(*outputs[0])); - memset(outputs[1], 0, samples * sizeof(*outputs[1])); + outputs[0].fill(0); + outputs[1].fill(0); int outpos = 0; // loop while we still have samples to generate + int samples = outputs[0].samples(); while (samples-- != 0) { for (int channel = 0; channel < 2; channel++) @@ -83,7 +84,7 @@ void xavix_sound_device::sound_stream_update_legacy(sound_stream &stream, stream */ } - outputs[channel][outpos] += sample * (m_voice[v].vol + 1); + outputs[channel].add_int(outpos, sample * (m_voice[v].vol + 1), 32768); m_voice[v].position[channel] += m_voice[v].rate; } else diff --git a/src/mame/drivers/1945kiii.cpp b/src/mame/drivers/1945kiii.cpp index db424a83f54..1f78b084df1 100644 --- a/src/mame/drivers/1945kiii.cpp +++ b/src/mame/drivers/1945kiii.cpp @@ -234,8 +234,8 @@ void k3_state::k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_eleme { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp index 1d8ca3d4af0..387a2362366 100644 --- a/src/mame/drivers/5clown.cpp +++ b/src/mame/drivers/5clown.cpp @@ -553,7 +553,7 @@ MC6845_UPDATE_ROW(_5clown_state::update_row) x--- ---- Extra color for 7's. */ - uint32_t *pix = &bitmap.pix32(y); + uint32_t *pix = &bitmap.pix(y); ra &= 0x07; for (int x = 0; x < x_count; x++) diff --git a/src/mame/drivers/a5105.cpp b/src/mame/drivers/a5105.cpp index d8ffbbcc55c..3525ce5b51d 100644 --- a/src/mame/drivers/a5105.cpp +++ b/src/mame/drivers/a5105.cpp @@ -120,7 +120,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels ) { int const pen = ((gfx >> xi) & 1) ? 7 : 0; - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } @@ -151,7 +151,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text ) pen = 0; if (m_screen->visible_area().contains(res_x+0, res_y)) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/a7150.cpp b/src/mame/drivers/a7150.cpp index 66250419e21..92a3327b452 100644 --- a/src/mame/drivers/a7150.cpp +++ b/src/mame/drivers/a7150.cpp @@ -122,18 +122,17 @@ private: uint32_t a7150_state::screen_update_k7072(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b; int addr = 0; - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { int horpos = 0; - for (x = 0; x < 80; x++) + for (int x = 0; x < 80; x++) { uint8_t code = m_video_ram[addr++]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? 1 : 0; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? 1 : 0; } } } diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp index f93a40832ae..6a1c050195e 100644 --- a/src/mame/drivers/accomm.cpp +++ b/src/mame/drivers/accomm.cpp @@ -234,7 +234,7 @@ inline uint8_t accomm_state::read_vram(uint16_t addr) inline void accomm_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t accomm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/acefruit.cpp b/src/mame/drivers/acefruit.cpp index c41d958d314..f8fc8e8b065 100644 --- a/src/mame/drivers/acefruit.cpp +++ b/src/mame/drivers/acefruit.cpp @@ -149,16 +149,14 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in { int startrow = cliprect.min_y / 8; int endrow = cliprect.max_y / 8; - int row; - int col; - for( row = startrow; row <= endrow; row++ ) + for( int row = startrow; row <= endrow; row++ ) { int spriterow = 0; int spriteindex = 0; int spriteparameter = 0; - for( col = 0; col < 32; col++ ) + for( int col = 0; col < 32; col++ ) { int tile_index = ( col * 32 ) + row; int code = m_videoram[ tile_index ]; @@ -170,20 +168,18 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in } else if( color >= 0x5 && color <= 0x7 ) { - int y; - int x; static const int spriteskip[] = { 1, 2, 4 }; int spritesize = spriteskip[ color - 5 ]; gfx_element *gfx = m_gfxdecode->gfx(0); - for( x = 0; x < 16; x++ ) + for( int x = 0; x < 16; x++ ) { int sprite = ( m_spriteram[ ( spriteindex / 64 ) % 6 ] & 0xf ) ^ 0xf; const uint8_t *gfxdata = gfx->get_data(sprite); - for( y = 0; y < 8; y++ ) + for( int y = 0; y < 8; y++ ) { - uint16_t *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) ); + uint16_t *dst = &bitmap.pix(y + ( row * 8 ), x + ( col * 16 ) ); *( dst ) = *( gfxdata + ( ( spriterow + y ) * gfx->rowbytes() ) + ( ( spriteindex % 64 ) >> 1 ) ); } @@ -192,14 +188,11 @@ uint32_t acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_in } else { - int y; - int x; - - for( x = 0; x < 16; x++ ) + for( int x = 0; x < 16; x++ ) { - for( y = 0; y < 8; y++ ) + for( int y = 0; y < 8; y++ ) { - uint16_t *dst = &bitmap.pix16(y + ( row * 8 ), x + ( col * 16 ) ); + uint16_t *dst = &bitmap.pix(y + ( row * 8 ), x + ( col * 16 ) ); *( dst ) = 0; } } diff --git a/src/mame/drivers/adacp150.cpp b/src/mame/drivers/adacp150.cpp index 3c20a6a82e7..1243bf7a279 100644 --- a/src/mame/drivers/adacp150.cpp +++ b/src/mame/drivers/adacp150.cpp @@ -74,7 +74,7 @@ void adacp150_state::machine_start() HD44780_PIXEL_UPDATE(adacp150_state::pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/adm11.cpp b/src/mame/drivers/adm11.cpp index f976f7da444..e21e34ee018 100644 --- a/src/mame/drivers/adm11.cpp +++ b/src/mame/drivers/adm11.cpp @@ -93,7 +93,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(adm11_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/aleck64.cpp b/src/mame/drivers/aleck64.cpp index 48eb265d078..b0d380bffe0 100644 --- a/src/mame/drivers/aleck64.cpp +++ b/src/mame/drivers/aleck64.cpp @@ -1085,10 +1085,6 @@ uint32_t aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &b for(int offs=0;offs<0x1000/4;offs+=2) { - int xi,yi; - int r,g,b; - int pal_offs; - int pal_shift; // 0x400 is another enable? end code if off? //uint16_t tile = m_e90_vram[offs] >> 16; @@ -1113,28 +1109,26 @@ uint32_t aleck64_state::screen_update_e90(screen_device &screen, bitmap_rgb32 &b // some pieces needs this color adjustment (see T piece / 5 block version of I piece) pal |= (attr & 0xc0) >> 4; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - uint16_t raw_rgb; - res_x = x+xi + 4; - res_y = (y & 0xff)+yi + 7; + int res_x = x+xi + 4; + int res_y = (y & 0xff)+yi + 7; - pal_offs = (pal*0x10); + int pal_offs = (pal*0x10); pal_offs+= pal_table[xi+yi*8]; - pal_shift = pal_offs & 1 ? 0 : 16; - raw_rgb = m_e90_pal[pal_offs>>1] >> pal_shift; - r = (raw_rgb & 0x001f) >> 0; - g = (raw_rgb & 0x03e0) >> 5; - b = (raw_rgb & 0x7c00) >> 10; + int pal_shift = pal_offs & 1 ? 0 : 16; + uint16_t raw_rgb = m_e90_pal[pal_offs>>1] >> pal_shift; + int r = (raw_rgb & 0x001f) >> 0; + int g = (raw_rgb & 0x03e0) >> 5; + int b = (raw_rgb & 0x7c00) >> 10; r = pal5bit(r); g = pal5bit(g); b = pal5bit(b); if(cliprect.contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = r << 16 | g << 8 | b; + bitmap.pix(res_y, res_x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp index 36759cd6af8..1b02744e3bb 100644 --- a/src/mame/drivers/alesis.cpp +++ b/src/mame/drivers/alesis.cpp @@ -411,7 +411,7 @@ HD44780_PIXEL_UPDATE(alesis_state::sr16_pixel_update) if (line == 1 && pos >= 6 && pos < 8) // last 2 characters of the second line are used to control the LCD symbols update_lcd_symbols(bitmap, pos, y, x, state); else if (pos < 8) - bitmap.pix16(line*9 + y, pos*6 + x) = state; + bitmap.pix(line*9 + y, pos*6 + x) = state; } void alesis_state::hr16(machine_config &config) diff --git a/src/mame/drivers/alfaskop41xx.cpp b/src/mame/drivers/alfaskop41xx.cpp index 30bb0733266..103f9897616 100644 --- a/src/mame/drivers/alfaskop41xx.cpp +++ b/src/mame/drivers/alfaskop41xx.cpp @@ -285,14 +285,14 @@ template <unsigned N> void alfaskop4110_state::irq_w(int state) /* Simplified chargen, no attributes or special formats/features yet */ MC6845_UPDATE_ROW( alfaskop4110_state::crtc_update_row ) { - offs_t base = ma + 0x4000; - u32 *px = &bitmap.pix32(y); + offs_t const base = ma + 0x4000; + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { u8 chr = m_vram[(base + i) & 0x07ff] & 0x7f; - rgb_t bg = rgb_t::white(); - rgb_t fg = rgb_t::black(); + rgb_t const bg = rgb_t::white(); + rgb_t const fg = rgb_t::black(); u8 dots = m_chargen[chr * 16 + ra]; diff --git a/src/mame/drivers/alinvade.cpp b/src/mame/drivers/alinvade.cpp index ce86f28db3a..a13baceb064 100644 --- a/src/mame/drivers/alinvade.cpp +++ b/src/mame/drivers/alinvade.cpp @@ -177,23 +177,19 @@ void alinvade_state::machine_reset() uint32_t alinvade_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = (offs << 3)&0x7f; int y = (offs >> 4)&0x7f; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/alphajuno.cpp b/src/mame/drivers/alphajuno.cpp index 95800a634b9..13f09295084 100644 --- a/src/mame/drivers/alphajuno.cpp +++ b/src/mame/drivers/alphajuno.cpp @@ -58,7 +58,7 @@ void alphajuno_state::machine_reset() HD44780_PIXEL_UPDATE(alphajuno_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp index 08a9c361569..68a3936f12c 100644 --- a/src/mame/drivers/alphatpx.cpp +++ b/src/mame/drivers/alphatpx.cpp @@ -903,31 +903,31 @@ static const gfx_layout extcharlayout = u32 alphatp_12_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); - int start = m_crtc->upscroll_offset(); + pen_t const *const pen = m_palette->pens(); + int const start = m_crtc->upscroll_offset(); rectangle cursor; m_crtc->cursor_bounds(cursor); for (int y = 0; y < 24; y++) { - int vramy = (start + y) % 24; + int const vramy = (start + y) % 24; for (int x = 0; x < 80; x++) { u8 code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line // draw 12 lines of the character - bool cursoren = cursor.contains(x * 8, y * 12); + bool const cursoren = cursor.contains(x * 8, y * 12); for (int line = 0; line < 12; line++) { u8 data = m_gfx[((code & 0x7f) * 16) + line]; if (cursoren) data ^= 0xff; - bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; } } } @@ -945,23 +945,23 @@ GFXDECODE_END u32 alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); - int start = m_crtc->upscroll_offset(); + pen_t const *const pen = m_palette->pens(); + int const start = m_crtc->upscroll_offset(); rectangle cursor; m_crtc->cursor_bounds(cursor); - bool scrext = m_scncfg->read() ? true : false; + bool const scrext = m_scncfg->read() ? true : false; for (int y = 0; y < 24; y++) { - int vramy = (start + y) % 24; + int const vramy = (start + y) % 24; for (int x = 0; x < 80; x++) { u8 code = m_vram[(vramy * 128) + x]; // helwie44 must be 128d is 080h physical display-ram step line // draw 12 lines of the character - bool cursoren = cursor.contains(x * 8, y * 12); + bool const cursoren = cursor.contains(x * 8, y * 12); for (int line = 0; line < 12; line++) { u8 data = 0; - if(scrext) + if (scrext) { offs_t offset = (((vramy * 12) + line) * 80) + x; if(offset < (371 * 80)) @@ -974,14 +974,14 @@ u32 alphatp_34_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, if (cursoren) data ^= 0xff; } - bitmap.pix32(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; - bitmap.pix32(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 0) = pen[BIT(data, 0) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 1) = pen[BIT(data, 1) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 2) = pen[BIT(data, 2) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 3) = pen[BIT(data, 3) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 4) = pen[BIT(data, 4) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 5) = pen[BIT(data, 5) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 6) = pen[BIT(data, 6) ^ BIT(code, 7)]; + bitmap.pix(y * 12 + line, x * 8 + 7) = pen[BIT(data, 7) ^ BIT(code, 7)]; } } } diff --git a/src/mame/drivers/alphatro.cpp b/src/mame/drivers/alphatro.cpp index 0070adcf3d6..912dc35452f 100644 --- a/src/mame/drivers/alphatro.cpp +++ b/src/mame/drivers/alphatro.cpp @@ -340,22 +340,19 @@ void alphatro_state::portf0_w(uint8_t data) MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); bool palette = BIT(m_config->read(), 5); if (y==0) m_flashcnt++; - bool inv; - u8 chr,gfx,attr,bg,fg; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x); - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; - attr = m_p_videoram[mem | 0x800]; - bg = (palette) ? 8 : attr & 7; // amber or RGB - fg = (palette) ? 0 : (attr & 0x38) >> 3; + bool inv = (x == cursor_x); + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_p_videoram[mem]; + u8 attr = m_p_videoram[mem | 0x800]; + u8 bg = (palette) ? 8 : attr & 7; // amber or RGB + u8 fg = (palette) ? 0 : (attr & 0x38) >> 3; if (BIT(attr, 7)) // reverse video { @@ -369,7 +366,7 @@ MC6845_UPDATE_ROW( alphatro_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; + u8 gfx = m_p_chargen[(chr<<4) | ra]; if (inv) { diff --git a/src/mame/drivers/amust.cpp b/src/mame/drivers/amust.cpp index 1c7d01dd4d8..7441b4a3033 100644 --- a/src/mame/drivers/amust.cpp +++ b/src/mame/drivers/amust.cpp @@ -384,16 +384,15 @@ GFXDECODE_END MC6845_UPDATE_ROW( amust_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,inv; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; + u8 inv = (x == cursor_x) ? 0xff : 0; + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra] ^ inv; else diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp index 9c010c25bbb..cf3686b1730 100644 --- a/src/mame/drivers/apc.cpp +++ b/src/mame/drivers/apc.cpp @@ -207,51 +207,38 @@ UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi,yi_trans; - int x; - uint8_t char_size; -// uint8_t interlace_on; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // if(m_video_ff[DISPLAY_REG] == 0) //screen is off // return; -// interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ - char_size = 19; +// uint8_t interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */ + uint8_t char_size = 19; - for(x=0;x<pitch;x++) + for(int x=0;x<pitch;x++) { - uint8_t tile_data; - uint8_t u_line, o_line, v_line, reverse, blink; - uint8_t color; - uint8_t tile,attr,pen; - uint32_t tile_addr; - uint8_t tile_sel; - -// tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); - tile_addr = addr+(x*(1)); - - tile = (m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] >> 8) & 0x00ff; - tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; - attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); - - u_line = attr & 0x01; - o_line = attr & 0x02; - v_line = attr & 0x04; - blink = attr & 0x08; - reverse = attr & 0x10; +// uint32_t tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); + uint32_t tile_addr = addr+(x*(1)); + + uint8_t tile = (m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] >> 8) & 0x00ff; + uint8_t tile_sel = m_video_ram_1[((tile_addr*2) & 0x1fff) >> 1] & 0x00ff; + uint8_t attr = (m_video_ram_1[((tile_addr*2 & 0x1fff) | 0x2000) >> 1] & 0x00ff); + + uint8_t u_line = attr & 0x01; + uint8_t o_line = attr & 0x02; + uint8_t v_line = attr & 0x04; + uint8_t blink = attr & 0x08; + uint8_t reverse = attr & 0x10; // secret= (attr & 1) ^ 1; - color = (attr & 0xe0) >> 5; + uint8_t color = (attr & 0xe0) >> 5; - for(yi=0;yi<lr;yi++) + for(int yi=0;yi<lr;yi++) { - yi_trans = (yi==0)?lr-1:yi-1; - for(xi=0;xi<8;xi++) + int yi_trans = (yi==0)?lr-1:yi-1; + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - - res_x = (x*8+xi); - res_y = y+yi; + int res_x = (x*8+xi); + int res_y = y+yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; @@ -272,6 +259,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) Data bus: 76543210 = pixels, in left->01234567->right order */ + uint8_t tile_data; if(tile_sel == 0x89)// Aux character RAM select TODO: correct triggering? { if(yi & 0x10) @@ -291,13 +279,14 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text ) if(cursor_on && cursor_addr == tile_addr && m_screen->frame_number() & 0x10) tile_data^=0xff; + uint8_t pen; if(yi >= char_size) pen = 0; else pen = (tile_data >> (xi) & 1) ? color : 0; if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/apogee.cpp b/src/mame/drivers/apogee.cpp index f91f058ee6c..6284114c8e6 100644 --- a/src/mame/drivers/apogee.cpp +++ b/src/mame/drivers/apogee.cpp @@ -216,7 +216,7 @@ I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels) pixels ^= 0xff; for(int i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index 5cf5e9c3e95..cdc46753200 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -324,24 +324,21 @@ void apple1_state::poll_keyboard() void apple1_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; int fg = 1, bg = 0; - int charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); + int const charcode = (code & 0x1f) | (((code ^ 0x40) & 0x40) >> 1); /* look up the character data */ - chardata = &textgfx_data[(charcode * 8)]; + uint8_t const *const chardata = &textgfx_data[(charcode * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } diff --git a/src/mame/drivers/applix.cpp b/src/mame/drivers/applix.cpp index eef5c0382bc..14c28072e3a 100644 --- a/src/mame/drivers/applix.cpp +++ b/src/mame/drivers/applix.cpp @@ -818,7 +818,7 @@ MC6845_UPDATE_ROW( applix_state::crtc_update_row ) // The 6845 cursor signal is not used at all. rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u32 const vidbase = (m_video_latch & 15) << 14 | (ra & 7) << 12; - u32 *p = &bitmap.pix32(y + vbp, hbp); + u32 *p = &bitmap.pix(y + vbp, hbp); for (u16 x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp index d782dd9111d..60a80be6f72 100644 --- a/src/mame/drivers/apricot.cpp +++ b/src/mame/drivers/apricot.cpp @@ -298,14 +298,14 @@ MC6845_UPDATE_ROW( apricot_state::crtc_update_row ) { int color = fill ? 1 : BIT(data, x); color ^= BIT(code, 15); // reverse? - bitmap.pix32(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; + bitmap.pix(y, x + i*10) = pen[color ? 1 + BIT(code, 14) : 0]; } } else { // draw 16 pixels of the cell for (int x = 0; x <= 16; x++) - bitmap.pix32(y, x + i*16) = pen[BIT(data, x)]; + bitmap.pix(y, x + i*16) = pen[BIT(data, x)]; } } } diff --git a/src/mame/drivers/apricotf.cpp b/src/mame/drivers/apricotf.cpp index d7ee2f5d1d1..f3d59584e27 100644 --- a/src/mame/drivers/apricotf.cpp +++ b/src/mame/drivers/apricotf.cpp @@ -149,7 +149,7 @@ u32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const r { int color = (BIT(data, 15) << 1) | BIT(data, 7); - bitmap.pix16(y, (sx * 8) + x) = color; + bitmap.pix(y, (sx * 8) + x) = color; data <<= 1; } @@ -160,8 +160,8 @@ u32 f1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const r { int color = (BIT(data, 15) << 3) | (BIT(data, 14) << 2) | (BIT(data, 7) << 1) | BIT(data, 6); - bitmap.pix16(y, (sx * 8) + (x * 2)) = color; - bitmap.pix16(y, (sx * 8) + (x * 2) + 1) = color; + bitmap.pix(y, (sx * 8) + (x * 2)) = color; + bitmap.pix(y, (sx * 8) + (x * 2) + 1) = color; data <<= 2; } diff --git a/src/mame/drivers/apricotp.cpp b/src/mame/drivers/apricotp.cpp index a2d356486da..8e6b94d197d 100644 --- a/src/mame/drivers/apricotp.cpp +++ b/src/mame/drivers/apricotp.cpp @@ -190,7 +190,7 @@ uint32_t fp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co { int color = BIT(data, 15); - bitmap.pix16(y, (sx * 16) + x) = color; + bitmap.pix(y, (sx * 16) + x) = color; data <<= 1; } diff --git a/src/mame/drivers/argo.cpp b/src/mame/drivers/argo.cpp index 090172d407f..9a85211d859 100644 --- a/src/mame/drivers/argo.cpp +++ b/src/mame/drivers/argo.cpp @@ -267,7 +267,7 @@ I8275_DRAW_CHARACTER_MEMBER(argo_state::display_pixels) gfx ^= 0xff; for(u8 i=0;i<7;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 6-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 6-i) ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t argo_pens[3] = diff --git a/src/mame/drivers/aristmk6.cpp b/src/mame/drivers/aristmk6.cpp index 3e90126427d..b0e332129fe 100644 --- a/src/mame/drivers/aristmk6.cpp +++ b/src/mame/drivers/aristmk6.cpp @@ -173,7 +173,7 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r | g<<8 | b<<16; + bitmap.pix(y, x) = r | g<<8 | b<<16; count+=2; } @@ -184,7 +184,7 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg color = blit_ram[count]; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } @@ -205,12 +205,12 @@ uint32_t aristmk6_state::screen_update_aristmk6(screen_device &screen, bitmap_rg pix1 = pix & 0xffffffff; col = 0; if (pix1) col = 1; - bitmap.pix32(y, x*2) = m_palette->pen(col); + bitmap.pix(y, x*2) = m_palette->pen(col); pix1 = pix >> 32; col = 0; if (pix1) col = 1; - bitmap.pix32(y, x*2+1) = m_palette->pen(col); + bitmap.pix(y, x*2+1) = m_palette->pen(col); count++; diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp index 0a23d19cbf5..86d1dc1502f 100644 --- a/src/mame/drivers/astinvad.cpp +++ b/src/mame/drivers/astinvad.cpp @@ -168,14 +168,14 @@ void astinvad_state::plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint { uint8_t flip_xor = m_screen_flip & 7; - bitmap.pix32(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix32(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); + bitmap.pix(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); } diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp index 3bd3ee55911..700eca70dd3 100644 --- a/src/mame/drivers/astrof.cpp +++ b/src/mame/drivers/astrof.cpp @@ -356,14 +356,9 @@ void astrof_state::tomahawk_video_control_2_w(uint8_t data) void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &cliprect, pen_t *pens, int num_pens ) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - uint8_t data; - int i; - - uint8_t color = m_colorram[offs >> 1]; + uint8_t const color = m_colorram[offs >> 1]; pen_t back_pen = pens[(color & (num_pens-1)) | 0x00]; pen_t fore_pen = pens[(color & (num_pens-1)) | 0x01]; @@ -377,22 +372,23 @@ void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &c if ((y <= cliprect.top()) || (y >= cliprect.bottom())) continue; + uint8_t data; if (m_screen_off) data = 0; else data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen = (data & 0x01) ? fore_pen : back_pen; + pen_t const pen = (data & 0x01) ? fore_pen : back_pen; if (m_flipscreen) - bitmap.pix32(y, 255 - x) = pen; + bitmap.pix(y, 255 - x) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data >> 1; + x++; + data >>= 1; } } } diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp index 8da5a02d553..1dfd60758f8 100644 --- a/src/mame/drivers/atarisy4.cpp +++ b/src/mame/drivers/atarisy4.cpp @@ -231,7 +231,6 @@ void atarisy4_state::video_reset() uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; uint32_t offset = 0; if (m_gpu.bcrw & 0x80) @@ -245,15 +244,14 @@ uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rg //uint32_t offset = m_gpu.dpr << 5; - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { - uint16_t *src = &m_screen_ram[(offset + (4096 * y)) / 2]; - uint32_t *dest = &bitmap.pix32(y, cliprect.left()); - int x; + uint16_t const *src = &m_screen_ram[(offset + (4096 * y)) / 2]; + uint32_t *dest = &bitmap.pix(y, cliprect.left()); - for (x = cliprect.left(); x < cliprect.right(); x += 2) + for (int x = cliprect.left(); x < cliprect.right(); x += 2) { - uint16_t data = *src++; + uint16_t const data = *src++; *dest++ = m_palette->pen(data & 0xff); *dest++ = m_palette->pen(data >> 8); diff --git a/src/mame/drivers/atronic.cpp b/src/mame/drivers/atronic.cpp index 5d73e60b702..19fe4c15a7e 100644 --- a/src/mame/drivers/atronic.cpp +++ b/src/mame/drivers/atronic.cpp @@ -423,8 +423,8 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(atronic_state::from_shiftreg) TMS340X0_SCANLINE_RGB32_CB_MEMBER(atronic_state::scanline_update) { uint32_t fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 5; - uint32_t* bg0_base = &m_vidram[(fulladdr & 0x7fe00)]; // this probably isn't screen ram, but some temp gfx are copied on startup - uint32_t* dst = &bitmap.pix32(scanline); + uint32_t const *const bg0_base = &m_vidram[(fulladdr & 0x7fe00)]; // this probably isn't screen ram, but some temp gfx are copied on startup + uint32_t *const dst = &bitmap.pix(scanline); int coladdr = fulladdr & 0x1ff; const pen_t *pens = m_palette->pens(); diff --git a/src/mame/drivers/att4425.cpp b/src/mame/drivers/att4425.cpp index e574f006e55..b2033aa5f05 100644 --- a/src/mame/drivers/att4425.cpp +++ b/src/mame/drivers/att4425.cpp @@ -131,26 +131,26 @@ void att4425_state::video_start() uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx, fg, bg, chr, attr; - uint16_t sy = 0, ma, x, ca; + uint16_t sy = 0; - fg = 2; - bg = 0; + uint8_t fg = 2; + uint8_t bg = 0; - for (y = 0; y < 27; y++) + for (uint8_t y = 0; y < 27; y++) { - ma = 0x7e9c + 4 * (81 - 27 + y); + uint16_t ma = 0x7e9c + 4 * (81 - 27 + y); ma = (m_p_videoram[ma] << 8) + m_p_videoram[ma + 1] - 0x8000; - for (ra = 0; ra < 13; ra++) + for (uint8_t ra = 0; ra < 13; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 160; x += 2) + for (uint16_t x = ma; x < ma + 160; x += 2) { - chr = m_p_videoram[x + 1]; - attr = m_p_videoram[x]; - ca = (chr << 4) & 0x7f0; + uint8_t const chr = m_p_videoram[x + 1]; + uint8_t const attr = m_p_videoram[x]; + uint16_t ca = (chr << 4) & 0x7f0; + uint8_t gfx; // font 2 if (attr & 0x01) @@ -178,9 +178,8 @@ uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* Display a scanline of a character */ for (int i = 7; i >= 0; i--) - { *p++ = BIT(gfx, i) ? fg : bg; - } + *p++ = bg; } } diff --git a/src/mame/drivers/att630.cpp b/src/mame/drivers/att630.cpp index 96e0626ea4a..bcedcd25c15 100644 --- a/src/mame/drivers/att630.cpp +++ b/src/mame/drivers/att630.cpp @@ -54,7 +54,7 @@ u32 att630_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con { for (int y = 0; y < 1024; y++) for (int x = 0; x < 1024; x++) - bitmap.pix32(y, x) = BIT(m_vram[y * (1024 / 16) + x / 16], 15 - (x % 16)) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = BIT(m_vram[y * (1024 / 16) + x / 16], 15 - (x % 16)) ? rgb_t::white() : rgb_t::black(); return 0; } diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp index 7f42d3e551a..17f434fce48 100644 --- a/src/mame/drivers/attache.cpp +++ b/src/mame/drivers/attache.cpp @@ -299,39 +299,35 @@ private: // bit 7 = subscript (superscript and subscript combined produces strikethrough) uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y,vy,start,bit,scan,data; - uint8_t dbl_mode = 0; // detemines which half of character to display when using double size attribute, - // as it can start on either odd or even character cells. - // Graphics output (if enabled) if(m_gfx_enabled) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); - for(y=0;y<(bitmap.height()-1)/10;y++) + for(uint8_t y=0;y<(bitmap.height()-1)/10;y++) { - for(x=0;x<(bitmap.width()-1)/8;x++) + for(uint8_t x=0;x<(bitmap.width()-1)/8;x++) { // graphics pixels use half the clock of text, so 4 graphics pixels per character - for(scan=0;scan<10;scan+=2) + for(uint8_t scan=0;scan<10;scan+=2) { - data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; - bitmap.pix32(y*10+scan,x*8) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+1) = pen[BIT(data,7)]; - bitmap.pix32(y*10+scan,x*8+2) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+3) = pen[BIT(data,6)]; - bitmap.pix32(y*10+scan,x*8+4) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+5) = pen[BIT(data,5)]; - bitmap.pix32(y*10+scan,x*8+6) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan,x*8+7) = pen[BIT(data,4)]; - bitmap.pix32(y*10+scan+1,x*8) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; - bitmap.pix32(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; - bitmap.pix32(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; - bitmap.pix32(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; - bitmap.pix32(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; + uint8_t const data = m_gfx_ram[(128*32*(scan/2))+(y*128+x)]; + bitmap.pix(y*10+scan,x*8) = pen[BIT(data,7)]; + bitmap.pix(y*10+scan,x*8+1) = pen[BIT(data,7)]; + bitmap.pix(y*10+scan,x*8+2) = pen[BIT(data,6)]; + bitmap.pix(y*10+scan,x*8+3) = pen[BIT(data,6)]; + bitmap.pix(y*10+scan,x*8+4) = pen[BIT(data,5)]; + bitmap.pix(y*10+scan,x*8+5) = pen[BIT(data,5)]; + bitmap.pix(y*10+scan,x*8+6) = pen[BIT(data,4)]; + bitmap.pix(y*10+scan,x*8+7) = pen[BIT(data,4)]; + bitmap.pix(y*10+scan+1,x*8) = pen[BIT(data,3)]; + bitmap.pix(y*10+scan+1,x*8+1) = pen[BIT(data,3)]; + bitmap.pix(y*10+scan+1,x*8+2) = pen[BIT(data,2)]; + bitmap.pix(y*10+scan+1,x*8+3) = pen[BIT(data,2)]; + bitmap.pix(y*10+scan+1,x*8+4) = pen[BIT(data,1)]; + bitmap.pix(y*10+scan+1,x*8+5) = pen[BIT(data,1)]; + bitmap.pix(y*10+scan+1,x*8+6) = pen[BIT(data,0)]; + bitmap.pix(y*10+scan+1,x*8+7) = pen[BIT(data,0)]; } } } @@ -340,12 +336,14 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma bitmap.fill(0); // Text output - for(y=0;y<(bitmap.height()-1)/10;y++) // lines + uint8_t dbl_mode = 0; // detemines which half of character to display when using double size attribute, + // as it can start on either odd or even character cells. + for(uint8_t y=0;y<(bitmap.height()-1)/10;y++) // lines { - start = m_crtc->upscroll_offset(); - vy = (start + y) % 24; + uint8_t const start = m_crtc->upscroll_offset(); + uint8_t const vy = (start + y) % 24; - for(x=0;x<(bitmap.width()-1)/8;x++) // columns + for(uint8_t x=0;x<(bitmap.width()-1)/8;x++) // columns { assert(((y*128)+x) >= 0 && ((y*128)+x) < ARRAY_LENGTH(m_char_ram)); assert(((vy*128)+x) >= 0 && ((vy*128)+x) < ARRAY_LENGTH(m_char_ram)); @@ -356,9 +354,9 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma else dbl_mode = 0; - for(scan=0;scan<10;scan++) // 10 scanlines per line + for(uint8_t scan=0;scan<10;scan++) // 10 scanlines per line { - data = m_char_rom->base()[(ch*16+scan)]; + uint8_t data = m_char_rom->base()[(ch*16+scan)]; if((m_attr_ram[(vy*128)+x] & 0xc0) != 0xc0) // if not strikethrough { if(m_attr_ram[(vy*128)+x] & 0x40) // superscript @@ -402,13 +400,13 @@ uint32_t attache_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma data = newdata; } - for(bit=0;bit<8;bit++) // 8 pixels per character + for(uint8_t bit=0;bit<8;bit++) // 8 pixels per character { - uint16_t xpos = x*8+bit; - uint16_t ypos = y*10+scan; + uint16_t const xpos = x*8+bit; + uint16_t const ypos = y*10+scan; if(BIT(data,7-bit)) - bitmap.pix32(ypos,xpos) = fg; + bitmap.pix(ypos,xpos) = fg; } } } diff --git a/src/mame/drivers/avalnche.cpp b/src/mame/drivers/avalnche.cpp index 5b3f930a43e..7c8896238b9 100644 --- a/src/mame/drivers/avalnche.cpp +++ b/src/mame/drivers/avalnche.cpp @@ -48,17 +48,13 @@ uint32_t avalnche_state::screen_update_avalnche(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - int y = offs >> 5; + int const y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen; @@ -67,10 +63,10 @@ uint32_t avalnche_state::screen_update_avalnche(screen_device &screen, bitmap_rg else pen = (data & 0x80) ? rgb_t::black() : rgb_t::white(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data << 1; - x = x + 1; + data <<= 1; + x++; } } diff --git a/src/mame/drivers/b16.cpp b/src/mame/drivers/b16.cpp index a156c83826d..d4a864b0a77 100644 --- a/src/mame/drivers/b16.cpp +++ b/src/mame/drivers/b16.cpp @@ -97,18 +97,17 @@ uint32_t b16_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for(int x=0;x<mc6845_h_display;x++) { - int tile = m_vram[x+y*mc6845_h_display] & 0xff; - int color = (m_vram[x+y*mc6845_h_display] & 0x700) >> 8; - int pen; + int const tile = m_vram[x+y*mc6845_h_display] & 0xff; + int const color = (m_vram[x+y*mc6845_h_display] & 0x700) >> 8; for(int yi=0;yi<mc6845_tile_height;yi++) { for(int xi=0;xi<8;xi++) { - pen = (m_char_rom[tile*16+yi] >> (7-xi) & 1) ? color : 0; + int const pen = (m_char_rom[tile*16+yi] >> (7-xi) & 1) ? color : 0; if(y*mc6845_tile_height < 400 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/banctec.cpp b/src/mame/drivers/banctec.cpp index 8d5857a7a1f..220ad278819 100644 --- a/src/mame/drivers/banctec.cpp +++ b/src/mame/drivers/banctec.cpp @@ -87,16 +87,14 @@ void banctec_state::videoram_w(u8 data) MC6845_UPDATE_ROW( banctec_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0xff; - chr = m_videoram[mem]; - gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0); + u16 const mem = (ma + x) & 0xff; + u8 const chr = m_videoram[mem]; + u8 const gfx = m_p_chargen[chr | (ra << 8)] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/bcs3.cpp b/src/mame/drivers/bcs3.cpp index 8660ded8640..1bb81ef9fc7 100644 --- a/src/mame/drivers/bcs3.cpp +++ b/src/mame/drivers/bcs3.cpp @@ -265,24 +265,24 @@ INPUT_PORTS_END // Official version u32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,rat; - u16 sy=0,ma=0x50,x; + u16 sy=0,ma=0x50; - for (y = 0; y < 12; y++) + for (u8 y = 0; y < 12; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; + uint16_t *p = &bitmap.pix(sy++); + u8 const rat = (ra + 1) & 7; - for (x = ma; x < ma + 28; x++) + for (u16 x = ma; x < ma + 28; x++) { + u8 gfx; if (ra < 8) { - chr = m_p_videoram[x] & 0x7f; + u8 const chr = m_p_videoram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | rat ] ^ 0xff; + gfx = m_p_chargen[(chr<<3) | rat] ^ 0xff; } else gfx = 0xff; @@ -307,27 +307,27 @@ u32 bcs3_state::screen_update_bcs3(screen_device &screen, bitmap_ind16 &bitmap, I'm assuming that it only shows a portion of this, with the cursor always in sight. */ u32 bcs3_state::screen_update_bcs3a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,rat; - u16 sy = 0, ma = s_init, x; - u16 cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position - rat = cursor / (s_cols+1); - if (rat > (s_rows-1)) ma += (rat-(s_rows-1)) * (s_cols+1); + u16 sy = 0, ma = s_init; + u16 const cursor = (m_p_videoram[s_curs] | (m_p_videoram[s_curs+1] << 8)) - 0x3c00 - ma; // get cursor relative position + u8 const cw = cursor / (s_cols+1); + if (cw > (s_rows-1)) ma += (cw-(s_rows-1)) * (s_cols+1); - for (y = 0; y < s_rows; y++) + for (u8 y = 0; y < s_rows; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - rat = (ra + 1) & 7; + uint16_t *p = &bitmap.pix(sy++); + u8 const rat = (ra + 1) & 7; - for (x = ma; x < ma + s_cols; x++) + for (u16 x = ma; x < ma + s_cols; x++) { + u8 gfx; if (ra < 8) { - chr = m_p_videoram[x] & 0x7f; + u8 const chr = m_p_videoram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | rat ] ^ 0xff; + gfx = m_p_chargen[(chr<<3) | rat] ^ 0xff; } else gfx = 0xff; diff --git a/src/mame/drivers/beaminv.cpp b/src/mame/drivers/beaminv.cpp index e323210244f..91b9e7b664d 100644 --- a/src/mame/drivers/beaminv.cpp +++ b/src/mame/drivers/beaminv.cpp @@ -186,23 +186,19 @@ void beaminv_state::machine_reset() uint32_t beaminv_state::screen_update_beaminv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t y = offs; uint8_t x = offs >> 8 << 3; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/beezer.cpp b/src/mame/drivers/beezer.cpp index beaee78687e..4d6a88944ce 100644 --- a/src/mame/drivers/beezer.cpp +++ b/src/mame/drivers/beezer.cpp @@ -257,8 +257,8 @@ uint32_t beezer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - bitmap.pix16(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; - bitmap.pix16(y, x + 0) = m_videoram[0x80 * x + y] >> 4; + bitmap.pix(y, x + 1) = m_videoram[0x80 * x + y] & 0x0f; + bitmap.pix(y, x + 0) = m_videoram[0x80 * x + y] >> 4; } } diff --git a/src/mame/drivers/berzerk.cpp b/src/mame/drivers/berzerk.cpp index 778046da173..6d45d41f3aa 100644 --- a/src/mame/drivers/berzerk.cpp +++ b/src/mame/drivers/berzerk.cpp @@ -492,30 +492,30 @@ uint32_t berzerk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t data = m_videoram[offs]; uint8_t color = m_colorram[((offs >> 2) & 0x07e0) | (offs & 0x001f)]; uint8_t y = offs >> 5; uint8_t x = offs << 3; + int i; + for (i = 0; i < 4; i++) { rgb_t pen = (data & 0x80) ? pens[color >> 4] : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } for (; i < 8; i++) { rgb_t pen = (data & 0x80) ? pens[color & 0x0f] : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } } diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp index ccbefc4235f..c960664c5f8 100644 --- a/src/mame/drivers/bfcobra.cpp +++ b/src/mame/drivers/bfcobra.cpp @@ -415,20 +415,16 @@ void bfcobra_state::video_start() uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint8_t *src; - uint32_t *dest; - uint32_t offset; - uint8_t *hirescol; - uint8_t *lorescol; - /* Select screen has to be programmed into two registers */ /* No idea what happens if the registers are different */ + uint32_t offset; if (m_flip_8 & 0x40 && m_flip_22 & 0x40) offset = 0x10000; else offset = 0; + uint8_t const *hirescol; + uint8_t const *lorescol; if(m_videomode & 0x20) { hirescol = m_col3bit; @@ -445,16 +441,16 @@ uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb3 lorescol = m_col8bit; } - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { uint16_t y_offset = (y + m_v_scroll) * 256; - src = &m_video_ram[offset + y_offset]; - dest = &bitmap.pix32(y); + uint8_t const *const src = &m_video_ram[offset + y_offset]; + uint32_t *dest = &bitmap.pix(y); - for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) + for (int x = cliprect.left(); x <= cliprect.right() / 2; ++x) { - uint8_t x_offset = x + m_h_scroll; - uint8_t pen = *(src + x_offset); + uint8_t const x_offset = x + m_h_scroll; + uint8_t const pen = *(src + x_offset); if ( ( m_videomode & 0x81 ) == 1 || (m_videomode & 0x80 && pen & 0x80) ) { @@ -2323,21 +2319,16 @@ void bfcobjam_state::chipset_w(offs_t offset, uint8_t data) uint32_t bfcobjam_state::screen_update_bfcobjam(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint8_t *src; - uint32_t *dest; - uint32_t offset; - uint8_t *hirescol; - uint8_t *lorescol; - - /* Select screen has to be programmed into two registers */ /* No idea what happens if the registers are different */ + uint32_t offset; if (m_flip_8 & 0x40 && m_flip_22 & 0x40) offset = 0x10000; else offset = 0; + uint8_t const *hirescol; + uint8_t const *lorescol; if(m_videomode & 0x20) { hirescol = m_col3bit; @@ -2354,16 +2345,16 @@ uint32_t bfcobjam_state::screen_update_bfcobjam(screen_device &screen, bitmap_rg lorescol = m_col8bit; } - for (y = cliprect.top(); y <= cliprect.bottom(); ++y) + for (int y = cliprect.top(); y <= cliprect.bottom(); ++y) { - uint16_t y_offset = (y + m_v_scroll) * 256; - src = &m_video_ram[offset + y_offset]; - dest = &bitmap.pix32(y); + uint16_t const y_offset = (y + m_v_scroll) * 256; + uint8_t const *const src = &m_video_ram[offset + y_offset]; + uint32_t *dest = &bitmap.pix(y); - for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) + for (int x = cliprect.left(); x <= cliprect.right() / 2; ++x) { - uint8_t x_offset = x + m_h_scroll; - uint8_t pen = *(src + x_offset); + uint8_t const x_offset = x + m_h_scroll; + uint8_t const pen = *(src + x_offset); if ( ( m_videomode & 0x81 ) == 1 || (m_videomode & 0x80 && pen & 0x80) ) { diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp index dc597cba79d..a80176597bc 100644 --- a/src/mame/drivers/bigbord2.cpp +++ b/src/mame/drivers/bigbord2.cpp @@ -554,21 +554,19 @@ u8 bigbord2_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, uint16_t ac_cnt, boo MC6845_UPDATE_ROW( bigbord2_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,attr; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); ra &= 15; m_cnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - attr = m_aram[mem]; - chr = m_vram[mem]; + u16 mem = (ma + x) & 0x7ff; + u8 attr = m_aram[mem]; + u8 chr = m_vram[mem]; /* process attributes */ - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + u8 gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character */ *p++ = palette[BIT( gfx, 7 )]; diff --git a/src/mame/drivers/bingor.cpp b/src/mame/drivers/bingor.cpp index 63a39cc8c05..1d20658a6e3 100644 --- a/src/mame/drivers/bingor.cpp +++ b/src/mame/drivers/bingor.cpp @@ -564,37 +564,32 @@ void bingor_state::video_start() uint32_t bingor_state::screen_update_bingor(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - bitmap.fill(m_palette->black_pen(), cliprect); - count = (0x2000 / 2); - - for(y = 0; y < 256; y++) + int count = (0x2000 / 2); + for(int y = 0; y < 256; y++) { - for(x = 0; x < 286; x += 4) + for(int x = 0; x < 286; x += 4) { - uint32_t color; - - color = (m_blit_ram[count] & 0xf000) >> 12; + uint32_t color = (m_blit_ram[count] & 0xf000) >> 12; if(cliprect.contains(x + 3, y)) - bitmap.pix32(y, x + 3) = m_palette->pen(color); + bitmap.pix(y, x + 3) = m_palette->pen(color); color = (m_blit_ram[count] & 0x0f00) >> 8; if(cliprect.contains(x + 2, y)) - bitmap.pix32(y, x + 2) = m_palette->pen(color); + bitmap.pix(y, x + 2) = m_palette->pen(color); color = (m_blit_ram[count] & 0x00f0) >> 4; if(cliprect.contains(x + 1, y)) - bitmap.pix32(y, x + 1) = m_palette->pen(color); + bitmap.pix(y, x + 1) = m_palette->pen(color); color = (m_blit_ram[count] & 0x000f) >> 0; if(cliprect.contains(x + 0, y)) - bitmap.pix32(y, x + 0) = m_palette->pen(color); + bitmap.pix(y, x + 0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/bitgraph.cpp b/src/mame/drivers/bitgraph.cpp index 89207357183..52279795d3c 100644 --- a/src/mame/drivers/bitgraph.cpp +++ b/src/mame/drivers/bitgraph.cpp @@ -384,16 +384,13 @@ void bitgraph_state::adlc_w(offs_t offset, uint8_t data) uint32_t bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx = 0; - int x, y; - - for (y = 0; y < 768; y++) + for (int y = 0; y < 768; y++) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = 0; x < 1024 / 8; x += 2) + for (int x = 0; x < 1024 / 8; x += 2) { - gfx = m_videoram[(x + 1) | (y << 7)]; + uint8_t gfx = m_videoram[(x + 1) | (y << 7)]; for (int i = 7; i >= 0; i--) { *p++ = BIT(gfx, i); diff --git a/src/mame/drivers/blitz68k.cpp b/src/mame/drivers/blitz68k.cpp index 8b7a6c96874..ba96cc81447 100644 --- a/src/mame/drivers/blitz68k.cpp +++ b/src/mame/drivers/blitz68k.cpp @@ -274,13 +274,13 @@ VIDEO_START_MEMBER(blitz68k_state,blitz68k_addr_factor1) uint32_t blitz68k_state::screen_update_blitz68k(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *src = m_blit_buffer.get(); + const uint8_t *src = m_blit_buffer.get(); for(int y = 0; y < 256; y++) { for(int x = 0; x < 512; x++) { - bitmap.pix32(y, x) = m_palette->pen(*src++); + bitmap.pix(y, x) = m_palette->pen(*src++); } } @@ -292,17 +292,17 @@ uint32_t blitz68k_state::screen_update_blitz68k(screen_device &screen, bitmap_rg uint32_t blitz68k_state::screen_update_blitz68k_noblit(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *src = m_frame_buffer; + const uint16_t *src = m_frame_buffer; for(int y = 0; y < 256; y++) { for(int x = 0; x < 512; ) { - uint16_t pen = *src++; - bitmap.pix32(y, x++) = m_palette->pen((pen >> 8) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 12) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 0) & 0xf); - bitmap.pix32(y, x++) = m_palette->pen((pen >> 4) & 0xf); + const uint16_t pen = *src++; + bitmap.pix(y, x++) = m_palette->pen((pen >> 8) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 12) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 0) & 0xf); + bitmap.pix(y, x++) = m_palette->pen((pen >> 4) & 0xf); } } diff --git a/src/mame/drivers/blw700i.cpp b/src/mame/drivers/blw700i.cpp index c5c8a0fd9b7..3552b957a64 100644 --- a/src/mame/drivers/blw700i.cpp +++ b/src/mame/drivers/blw700i.cpp @@ -122,29 +122,24 @@ void lw700i_state::video_start() uint32_t lw700i_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0xffffff, 0 }; - uint8_t *pVRAM = (uint8_t *)m_mainram.target(); + uint8_t const *const pVRAM = (uint8_t *)m_mainram.target() + 0x3e200; - pVRAM += 0x3e200; - - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 480/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 480/8; x++) { - pixels = pVRAM[(y * (480/8)) + (BYTE_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = pVRAM[(y * (480/8)) + (BYTE_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/bmcbowl.cpp b/src/mame/drivers/bmcbowl.cpp index 847acd2b025..79970bf864b 100644 --- a/src/mame/drivers/bmcbowl.cpp +++ b/src/mame/drivers/bmcbowl.cpp @@ -167,41 +167,42 @@ uint32_t bmcbowl_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma missing scroll and priorities (maybe fixed ones) */ - int x,y,z,pixdat; bitmap.fill(rgb_t::black(), cliprect); - z=0; - for (y=0;y<230;y++) + int z=0; + for (int y=0; y<230; y++) { - for (x=0;x<280;x+=2) + for (int x=0; x<280; x+=2) { + int pixdat; + pixdat = m_vid2[0x8000+z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid2[z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid1[0x8000+z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); pixdat = m_vid1[z]; if(pixdat&0xff) - bitmap.pix32(y, x+1) = m_palette->pen(pixdat&0xff); + bitmap.pix(y, x+1) = m_palette->pen(pixdat&0xff); if(pixdat>>8) - bitmap.pix32(y, x) = m_palette->pen(pixdat>>8); + bitmap.pix(y, x) = m_palette->pen(pixdat>>8); z++; } diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp index 05700c64b71..094dde0f078 100644 --- a/src/mame/drivers/bmcpokr.cpp +++ b/src/mame/drivers/bmcpokr.cpp @@ -147,21 +147,21 @@ void bmcpokr_state::pixram_w(offs_t offset, uint16_t data, uint16_t mem_mask) { COMBINE_DATA(&m_pixram[offset]); - int x = (offset & 0xff) << 2; - int y = (offset >> 8); + int const x = (offset & 0xff) << 2; + int const y = (offset >> 8); - uint16_t pixpal = (m_pixpal & 0xf) << 4; + uint16_t const pixpal = (m_pixpal & 0xf) << 4; uint16_t pen; if (ACCESSING_BITS_8_15) { - pen = (data >> 12) & 0xf; m_pixbitmap->pix16(y, x + 0) = pen ? pixpal + pen : 0; - pen = (data >> 8) & 0xf; m_pixbitmap->pix16(y, x + 1) = pen ? pixpal + pen : 0; + pen = (data >> 12) & 0xf; m_pixbitmap->pix(y, x + 0) = pen ? pixpal + pen : 0; + pen = (data >> 8) & 0xf; m_pixbitmap->pix(y, x + 1) = pen ? pixpal + pen : 0; } if (ACCESSING_BITS_0_7) { - pen = (data >> 4) & 0xf; m_pixbitmap->pix16(y, x + 2) = pen ? pixpal + pen : 0; - pen = (data >> 0) & 0xf; m_pixbitmap->pix16(y, x + 3) = pen ? pixpal + pen : 0; + pen = (data >> 4) & 0xf; m_pixbitmap->pix(y, x + 2) = pen ? pixpal + pen : 0; + pen = (data >> 0) & 0xf; m_pixbitmap->pix(y, x + 3) = pen ? pixpal + pen : 0; } } @@ -173,12 +173,12 @@ void bmcpokr_state::pixbitmap_redraw() { for (int x = 0; x < 1024; x += 4) { - uint16_t data = m_pixram[offset++]; + uint16_t const data = m_pixram[offset++]; uint16_t pen; - pen = (data >> 12) & 0xf; m_pixbitmap->pix16(y, x + 0) = pen ? pixpal + pen : 0; - pen = (data >> 8) & 0xf; m_pixbitmap->pix16(y, x + 1) = pen ? pixpal + pen : 0; - pen = (data >> 4) & 0xf; m_pixbitmap->pix16(y, x + 2) = pen ? pixpal + pen : 0; - pen = (data >> 0) & 0xf; m_pixbitmap->pix16(y, x + 3) = pen ? pixpal + pen : 0; + pen = (data >> 12) & 0xf; m_pixbitmap->pix(y, x + 0) = pen ? pixpal + pen : 0; + pen = (data >> 8) & 0xf; m_pixbitmap->pix(y, x + 1) = pen ? pixpal + pen : 0; + pen = (data >> 4) & 0xf; m_pixbitmap->pix(y, x + 2) = pen ? pixpal + pen : 0; + pen = (data >> 0) & 0xf; m_pixbitmap->pix(y, x + 3) = pen ? pixpal + pen : 0; } } } diff --git a/src/mame/drivers/bmjr.cpp b/src/mame/drivers/bmjr.cpp index 081e5feff2b..93f0fedcf4c 100644 --- a/src/mame/drivers/bmjr.cpp +++ b/src/mame/drivers/bmjr.cpp @@ -71,20 +71,20 @@ private: u32 bmjr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,fg=4; - u16 sy=0,ma=0x100,x; - u8 inv = (m_xor_display) ? 0xff : 0; + u8 fg=4; + u16 sy=0,ma=0x100; + u8 const inv = (m_xor_display) ? 0xff : 0; - for(y = 0; y < 24; y++ ) + for(u8 y = 0; y < 24; y++ ) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 32; x++) + for (u16 x = ma; x < ma + 32; x++) { - chr = m_p_wram[x]; - gfx = m_p_chargen[(chr<<3) | ra] ^ inv; + u8 const chr = m_p_wram[x]; + u8 const gfx = m_p_chargen[(chr<<3) | ra] ^ inv; /* Display a scanline of a character */ *p++ = BIT(gfx, 7) ? fg : 0; diff --git a/src/mame/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp index 3558439a923..5636185c513 100644 --- a/src/mame/drivers/bml3.cpp +++ b/src/mame/drivers/bml3.cpp @@ -575,7 +575,7 @@ INPUT_CHANGED_MEMBER(bml3_state::nmi_button) MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // The MB-6890 has a 5-bit colour RAM region. The meaning of the bits are: // 0: blue // 1: red @@ -583,13 +583,9 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) // 3: reverse/inverse video // 4: graphic (not character) - u8 x=0,hf=0,xi=0,interlace=0,bgcolor=0,rawbits=0,dots[2]={0,0},color=0,pen=0; - bool reverse=0,graphic=0,lowres=0; - u16 mem=0; - - interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; - lowres = BIT(m_hres_reg, 6); - bgcolor = m_hres_reg & 7; + u8 const interlace = (m_crtc_vreg[8] & 3) ? 1 : 0; + bool const lowres = BIT(m_hres_reg, 6); + u8 const bgcolor = m_hres_reg & 7; if (interlace) { @@ -597,19 +593,21 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) if (y > 0x191) return; } - for(x=0; x<x_count; x++) + for(u8 x=0; x<x_count; x++) { + u16 mem; if (lowres) mem = (ma + x - 0x400) & 0x3fff; else mem = (ma + x + ra * x_count/40 * 0x400 -0x400) & 0x3fff; - color = m_aram[mem] & 7; - reverse = BIT(m_aram[mem], 3) ^ (x == cursor_x); - graphic = BIT(m_aram[mem], 4); + u8 const color = m_aram[mem] & 7; + bool const reverse = BIT(m_aram[mem], 3) ^ (x == cursor_x); + bool const graphic = BIT(m_aram[mem], 4); - rawbits = m_vram[mem]; + u8 const rawbits = m_vram[mem]; + u8 dots[2] = { 0, 0 }; if (graphic) { if (lowres) @@ -629,8 +627,8 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) else { // character mode - int tile = rawbits & 0x7f; - int tile_bank = BIT(rawbits, 7); + int const tile = rawbits & 0x7f; + int const tile_bank = BIT(rawbits, 7); if (interlace) { dots[0] = m_p_chargen[(tile_bank<<11)|(tile<<4)|(ra<<1)]; @@ -642,18 +640,19 @@ MC6845_UPDATE_ROW( bml3_state::crtc_update_row ) } } - for(hf=0;hf<=interlace;hf++) + for(u8 hf=0;hf<=interlace;hf++) { - for(xi=0;xi<8;xi++) + for(u8 xi=0;xi<8;xi++) { + u8 pen; if(reverse) pen = (dots[hf] >> (7-xi) & 1) ? bgcolor : color; else pen = (dots[hf] >> (7-xi) & 1) ? color : bgcolor; - bitmap.pix32(y, x*8+xi) = palette[pen]; + bitmap.pix(y, x*8+xi) = palette[pen]; // when the mc6845 device gains full interlace&video support, replace the line above with the line below - // bitmap.pix32(y*(interlace+1)+hf, x*8+xi) = palette[pen]; + // bitmap.pix(y*(interlace+1)+hf, x*8+xi) = palette[pen]; } } } diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp index 93337ce0e5b..d9928ac612c 100644 --- a/src/mame/drivers/bw12.cpp +++ b/src/mame/drivers/bw12.cpp @@ -302,13 +302,12 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); - int column, bit; + pen_t const *const pen = m_palette->pens(); - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { - uint8_t code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; - uint16_t addr = code << 4 | (ra & 0x0f); + uint8_t const code = m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; + uint16_t const addr = code << 4 | (ra & 0x0f); uint8_t data = m_char_rom->base()[addr & BW12_CHARROM_MASK]; if (column == cursor_x) @@ -316,12 +315,12 @@ MC6845_UPDATE_ROW( bw12_state::crtc_update_row ) data = 0xff; } - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; - int color = BIT(data, 7) && de; + int const x = (column * 8) + bit; + int const color = BIT(data, 7) && de; - bitmap.pix32(vbp + y, hbp + x) = pen[color]; + bitmap.pix(vbp + y, hbp + x) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/c10.cpp b/src/mame/drivers/c10.cpp index 628082f4987..fd7e5f5945b 100644 --- a/src/mame/drivers/c10.cpp +++ b/src/mame/drivers/c10.cpp @@ -98,24 +98,23 @@ void c10_state::machine_reset() uint32_t c10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { //static uint8_t framecnt=0; - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x,xx; + uint16_t sy=0,ma=0; //framecnt++; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - xx = ma; - for (x = ma; x < ma + 80; x++) + uint16_t xx = ma; + for (uint16_t x = ma; x < ma + 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_vram[xx++]; + uint8_t chr = m_vram[xx++]; // /* Take care of flashing characters */ // if ((chr < 0x80) && (framecnt & 0x08)) diff --git a/src/mame/drivers/c65.cpp b/src/mame/drivers/c65.cpp index c918bf97d04..b4bd8c4ec75 100644 --- a/src/mame/drivers/c65.cpp +++ b/src/mame/drivers/c65.cpp @@ -178,7 +178,7 @@ uint32_t c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, if (attr & 0x10) enable_dot = 0; //if(cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_palette->pen(highlight_color + ((enable_dot) ? foreground_color : background_color)); + bitmap.pix(y, x) = m_palette->pen(highlight_color + ((enable_dot) ? foreground_color : background_color)); //gfx->opaque(bitmap,cliprect,tile,0,0,0,x*8,y*8); diff --git a/src/mame/drivers/calcune.cpp b/src/mame/drivers/calcune.cpp index 64dc5f6453d..f58fbd9f63e 100644 --- a/src/mame/drivers/calcune.cpp +++ b/src/mame/drivers/calcune.cpp @@ -149,7 +149,7 @@ uint32_t calcune_state::screen_update_calcune(screen_device &screen, bitmap_rgb3 { const unsigned palette_per_scanline = 64 * y; - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int pix; diff --git a/src/mame/drivers/camplynx.cpp b/src/mame/drivers/camplynx.cpp index fe43ec05f5c..81d46cc91ff 100644 --- a/src/mame/drivers/camplynx.cpp +++ b/src/mame/drivers/camplynx.cpp @@ -748,9 +748,8 @@ void camplynx_state::machine_reset() MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) { - u8 r,g,b,x; - uint32_t green_bank, *p = &bitmap.pix32(y); - uint16_t mem = ((ma << 2) + (ra << 5)) & 0x1fff; + uint32_t green_bank, *p = &bitmap.pix(y); + uint16_t const mem = ((ma << 2) + (ra << 5)) & 0x1fff; // determine green bank if (BIT(m_port80, 4)) @@ -758,11 +757,11 @@ MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) else green_bank = 0x3c000 + mem; // normal green - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - r = m_p_ram[0x2c000 + mem + x]; - b = m_p_ram[0x28000 + mem + x]; - g = m_p_ram[green_bank + x]; + u8 const r = m_p_ram[0x2c000 + mem + x]; + u8 const b = m_p_ram[0x28000 + mem + x]; + u8 const g = m_p_ram[green_bank + x]; *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); @@ -777,20 +776,20 @@ MC6845_UPDATE_ROW( camplynx_state::lynx48k_update_row ) MC6845_UPDATE_ROW( camplynx_state::lynx128k_update_row ) { - u8 r,g,b,x; - uint32_t green_bank, *p = &bitmap.pix32(y); - uint16_t mem = ((ma << 2) + (ra << 6)) & 0x3fff; + uint32_t green_bank, *p = &bitmap.pix(y); + uint16_t const mem = ((ma << 2) + (ra << 6)) & 0x3fff; + // determine green bank if (BIT(m_port80, 4)) - green_bank = 0x2c000+mem; // alt green + green_bank = 0x2c000 + mem; // alt green else - green_bank = 0x28000+mem; // normal green + green_bank = 0x28000 + mem; // normal green - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - r = m_p_ram[0x20000+mem+x]; - b = m_p_ram[0x24000+mem+x]; - g = m_p_ram[green_bank+x]; + u8 const r = m_p_ram[0x20000 + mem + x]; + u8 const b = m_p_ram[0x24000 + mem + x]; + u8 const g = m_p_ram[green_bank + x]; *p++ = m_palette->pen_color((BIT(b, 7) << 2) | (BIT(g, 7) << 1) | (BIT(r, 7))); *p++ = m_palette->pen_color((BIT(b, 6) << 2) | (BIT(g, 6) << 1) | (BIT(r, 6))); diff --git a/src/mame/drivers/candela.cpp b/src/mame/drivers/candela.cpp index ca381740f0a..ec9997a80a8 100644 --- a/src/mame/drivers/candela.cpp +++ b/src/mame/drivers/candela.cpp @@ -570,7 +570,7 @@ uint32_t can09_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (x = 0; x < 8; x++) { // if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + y, col + x) = x & 1; //(*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + y, col + x) = x & 1; //(*chardata & (1 << x)) ? 1 : 0; } // chardata++; } diff --git a/src/mame/drivers/canon_s80.cpp b/src/mame/drivers/canon_s80.cpp index 7e2aa68a4dc..7799077fb53 100644 --- a/src/mame/drivers/canon_s80.cpp +++ b/src/mame/drivers/canon_s80.cpp @@ -41,7 +41,7 @@ private: HD44780_PIXEL_UPDATE(canons80_state::pixel_update) { if (pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void canons80_state::canons80_map(address_map &map) diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp index 0db1f9319dd..6dac232e77b 100644 --- a/src/mame/drivers/cardline.cpp +++ b/src/mame/drivers/cardline.cpp @@ -136,9 +136,9 @@ MC6845_UPDATE_ROW( cardline_state::crtc_update_row ) int fg_col = gfx[fg_tile * 64 + ra * 8 + i]; if (fg_col == 1) - bitmap.pix32(y, x) = palette[bg_pal_ofs + bg_col]; + bitmap.pix(y, x) = palette[bg_pal_ofs + bg_col]; else - bitmap.pix32(y, x) = palette[fg_pal_ofs + fg_col]; + bitmap.pix(y, x) = palette[fg_pal_ofs + fg_col]; x++; } diff --git a/src/mame/drivers/casloopy.cpp b/src/mame/drivers/casloopy.cpp index 4ade93aa0eb..7beec8a8564 100644 --- a/src/mame/drivers/casloopy.cpp +++ b/src/mame/drivers/casloopy.cpp @@ -255,7 +255,6 @@ void casloopy_state::video_start() uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *gfx = m_gfxdecode->gfx(m_gfx_index); - int x,y; int count; static int test; @@ -279,9 +278,9 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm #endif count = test; - for (y=0;y<32;y++) + for (int y=0;y<32;y++) { - for (x=0;x<32;x++) + for (int x=0;x<32;x++) { uint16_t tile = (m_vram[count+1])|(m_vram[count]<<8); @@ -295,15 +294,13 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm count = test; - for (y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one? + for (int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one? { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t pix; - - pix = m_bitmap_vram[count]; + uint8_t pix = m_bitmap_vram[count]; if(pix) - bitmap.pix16(y, x) = pix + 0x100; + bitmap.pix(y, x) = pix + 0x100; count++; } diff --git a/src/mame/drivers/cat.cpp b/src/mame/drivers/cat.cpp index 353e2caa6ea..628fa66569f 100644 --- a/src/mame/drivers/cat.cpp +++ b/src/mame/drivers/cat.cpp @@ -960,10 +960,10 @@ uint32_t cat_state::screen_update_cat(screen_device &screen, bitmap_rgb32 &bitma int horpos = 0; for (int x = 0; x < 42; x++) { - uint16_t code = m_p_cat_videoram[addr++]; + const uint16_t code = m_p_cat_videoram[addr++]; for (int b = 15; b >= 0; b--) { - bitmap.pix32(y, horpos++) = BIT(code, b) ? on_color : off_color; + bitmap.pix(y, horpos++) = BIT(code, b) ? on_color : off_color; } } } diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp index 5cec01c471f..ae2bbae0d14 100644 --- a/src/mame/drivers/cbm2.cpp +++ b/src/mame/drivers/cbm2.cpp @@ -11,10 +11,7 @@ */ #include "emu.h" -#include "emupal.h" -#include "screen.h" -#include "softlist.h" -#include "speaker.h" + #include "bus/cbm2/exp.h" #include "bus/cbm2/user.h" #include "bus/ieee488/ieee488.h" @@ -37,6 +34,11 @@ #include "video/mc6845.h" #include "video/mos6566.h" +#include "emupal.h" +#include "screen.h" +#include "softlist.h" +#include "speaker.h" + #define PLA1_TAG "u78" #define PLA2_TAG "u88" #define MOS6567_TAG "u23" @@ -1413,7 +1415,7 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); int x = 0; @@ -1429,7 +1431,7 @@ MC6845_UPDATE_ROW( cbm2_state::crtc_update_row ) if (cursor_x == column) color ^= 1; color &= de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; if (bit < 8 || !m_graphics) data <<= 1; } diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp index 31cb481ddc3..c0f60554e7e 100644 --- a/src/mame/drivers/cc40.cpp +++ b/src/mame/drivers/cc40.cpp @@ -226,7 +226,7 @@ HD44780_PIXEL_UPDATE(cc40_state::cc40_pixel_update) { // internal: 2*16, external: 1*31 if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp index f5469448101..01760a14fbd 100644 --- a/src/mame/drivers/cd2650.cpp +++ b/src/mame/drivers/cd2650.cpp @@ -189,26 +189,25 @@ u32 cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con Further, the letters have bit 6 set low, thus the range is 01 to 1A. When the bottom of the screen is reached, it does not scroll, it just wraps around. */ - u8 y,ra,chr,gfx; - u16 offset=0,sy=0,x,mem; + u16 offset=0,sy=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < CHARACTER_LINES; ra++) + for (u8 ra = 0; ra < CHARACTER_LINES; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (u16 x = 0; x < 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < CHARACTER_HEIGHT) { - mem = offset + y + (x<<4); + u16 mem = offset + y + (x<<4); if (mem > 0x4ff) mem -= 0x500; - chr = m_p_videoram[mem] & 0x3f; + u8 chr = m_p_videoram[mem] & 0x3f; gfx = m_p_chargen[(bitswap<8>(chr,7,6,2,1,0,3,4,5)<<3) | ra]; } diff --git a/src/mame/drivers/cdc721.cpp b/src/mame/drivers/cdc721.cpp index 028d9cae951..1643cf91350 100644 --- a/src/mame/drivers/cdc721.cpp +++ b/src/mame/drivers/cdc721.cpp @@ -259,24 +259,23 @@ void cdc721_state::cdc721_palette(palette_device &palette) const uint32_t cdc721_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,attr,pen; - uint16_t sy=0,x; + uint16_t sy=0; m_flashcnt++; - for (y = 0; y < 30; y++) + for (uint8_t y = 0; y < 30; y++) { uint16_t ma = m_videoram[y * 2] | m_videoram[y * 2 + 1] << 8; - for (ra = 0; ra < 15; ra++) + for (uint8_t ra = 0; ra < 15; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 160; x+=2) + for (uint16_t x = 0; x < 160; x+=2) { - pen = 1; - chr = m_videoram[(x + ma) & 0x1fff]; - attr = m_videoram[(x + ma + 1) & 0x1fff]; - gfx = m_rom_chargen[chr | (ra << 8) ]; + uint8_t pen = 1; + uint8_t chr = m_videoram[(x + ma) & 0x1fff]; + uint8_t attr = m_videoram[(x + ma + 1) & 0x1fff]; + uint8_t gfx = m_rom_chargen[chr | (ra << 8) ]; if (BIT(attr, 0)) // blank pen = 0; if (BIT(attr, 1) && (ra == 14)) // underline diff --git a/src/mame/drivers/cdi.cpp b/src/mame/drivers/cdi.cpp index 94e939df12b..f5579cf659a 100644 --- a/src/mame/drivers/cdi.cpp +++ b/src/mame/drivers/cdi.cpp @@ -402,7 +402,7 @@ void cdi_state::draw_lcd(int y) if (y >= 22 || !m_slave_hle.found()) return; - uint32_t *scanline = &m_lcdbitmap.pix32(y); + uint32_t *scanline = &m_lcdbitmap.pix(y); for (int lcd = 0; lcd < 8; lcd++) { diff --git a/src/mame/drivers/ceres.cpp b/src/mame/drivers/ceres.cpp new file mode 100644 index 00000000000..ace6ea7b186 --- /dev/null +++ b/src/mame/drivers/ceres.cpp @@ -0,0 +1,283 @@ +// license:BSD-3-Clause +// copyright-holders:Patrick Mackinlay + +/* + * Eidgenössische Technische Hochschule (ETH) Zürich Ceres-1 + * + * Sources: + * - http://bitsavers.org/pdf/eth/ceres/Eberle_Hardware_Description_of_the_Workstation_Ceres_198701.pdf + * + * TODO: + * - startup/reset memory map + * - i/o device mapping + * - interrupt acknowledge + * - WD1002-05 Winchester/Floppy Disk Controller (WFC) + * - keyboard + * - mouse + */ + +#include "emu.h" + +// cpus and memory +#include "cpu/ns32000/ns32000.h" +#include "machine/ram.h" + +// various hardware +//#include "machine/ns32081.h" +//#include "machine/ns32082.h" +#include "machine/mc68681.h" +#include "machine/z80scc.h" +#include "machine/m3002.h" +#include "machine/am9519.h" +#include "machine/wd_fdc.h" + +// busses and connectors +#include "bus/rs232/rs232.h" +#include "imagedev/floppy.h" + +// video +#include "screen.h" + +#define VERBOSE 0 +#include "logmacro.h" + +class ceres1_state : public driver_device +{ +public: + ceres1_state(machine_config const &mconfig, device_type type, char const *tag) + : driver_device(mconfig, type, tag) + , m_cpu(*this, "cpu") + , m_ram(*this, "ram") + , m_uart(*this, "uart") + , m_serial(*this, "v24") + , m_scc(*this, "scc") + , m_rtc(*this, "rtc") + , m_icu(*this, "icu") + , m_fdc(*this, "fdc") + , m_fdd(*this, "fdc:0:35dd") + , m_screen(*this, "screen") + , m_vram(*this, "vram") + { + } + +protected: + // driver_device overrides + virtual void machine_start() override; + virtual void machine_reset() override; + + // address maps + template <unsigned ST> void cpu_map(address_map &map); + +public: + // machine config + void ceres1(machine_config &config); + + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rectangle const &cliprect); + + void wfc_w(offs_t offset, u8 data); + u8 wfc_r(offs_t offset); + +protected: + DECLARE_FLOPPY_FORMATS(floppy_formats); + + required_device<ns32032_device> m_cpu; + required_device<ram_device> m_ram; + + required_device<scn2681_device> m_uart; + required_device<rs232_port_device> m_serial; + required_device<z80scc_device> m_scc; + required_device<m3002_device> m_rtc; + required_device<am9519_device> m_icu; + + required_device<wd2797_device> m_fdc; + required_device<floppy_image_device> m_fdd; + + required_device<screen_device> m_screen; + required_shared_ptr<u32> m_vram; + + u8 m_dcr; +}; + +void ceres1_state::machine_start() +{ + save_item(NAME(m_dcr)); +} + +void ceres1_state::machine_reset() +{ + m_dcr = 0; +} + +void ceres1_state::wfc_w(offs_t offset, u8 data) +{ + switch (offset) + { + case 0: LOG("wfc_w data 0x%02x\n", offset, data); break; + case 1: LOG("wfc_w write precomp 0x%02x\n", offset, data); break; + case 2: LOG("wfc_w sector count 0x%02x\n", offset, data); break; + case 3: LOG("wfc_w sector number 0x%02x\n", offset, data); break; + case 4: LOG("wfc_w cylinder low 0x%02x\n", offset, data); break; + case 5: LOG("wfc_w cylinder high 0x%02x\n", offset, data); break; + case 6: LOG("wfc_w size/drive/head 0x%02x\n", offset, data); break; + case 7: LOG("wfc_w command 0x%02x\n", offset, data); break; + } +} + +u8 ceres1_state::wfc_r(offs_t offset) +{ + u8 data = 0; + + switch (offset) + { + case 0: // data + case 1: // error + case 2: // sector count + case 3: // sector number + case 4: // cylinder low + case 5: // cylinder high + case 6: // size/drive/head + break; + + case 7: // status + //data = 0x40; // drive ready + break; + } + + LOG("wfc_r reg %d data 0x%02x\n", offset, data); + + return data; +} + +template <unsigned ST> void ceres1_state::cpu_map(address_map &map) +{ + // FIXME: address lines 19-23 driven high until boot flipflop reset + map(0x000000, 0x007fff).rom().region("eprom", 0); + + map(0xe00000, 0xe3ffff).ram().share("vram"); + map(0xf80000, 0xf87fff).rom().region("eprom", 0); + map(0xfffa00, 0xfffa00).lw8( + [this](u8 data) + { + m_dcr = data & 7; + }, "dcr_w"); + map(0xfffdc0, 0xfffdc3).portr("SW1"); + map(0xfffdc0, 0xfffdc0).lw8( + [this](u8 data) + { + m_cpu->space(0).install_ram(0, m_ram->mask(), m_ram->pointer()); + }, "bt_ff_w"); + + map(0xfffc00, 0xfffc1f).rw(FUNC(ceres1_state::wfc_r), FUNC(ceres1_state::wfc_w)).umask32(0xff); +} + +static INPUT_PORTS_START(ceres1) + PORT_START("SW1") + PORT_DIPNAME(0x80, 0x00, "Diagnostic") PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING(0x00, DEF_STR(On)) + PORT_DIPSETTING(0x80, DEF_STR(Off)) + + PORT_DIPNAME(0x40, 0x40, "FPU") PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING(0x00, DEF_STR(On)) + PORT_DIPSETTING(0x40, DEF_STR(Off)) + + PORT_DIPNAME(0x20, 0x00, "MMU") PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING(0x00, DEF_STR(On)) + PORT_DIPSETTING(0x20, DEF_STR(Off)) + + PORT_DIPUNUSED_DIPLOC(0x10, 0x00, "SW1:4") + + // TODO: configuration is guesswork + PORT_DIPNAME(0x0f, 0x08, "Memory Size") PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING(0x01, "2M") + PORT_DIPSETTING(0x03, "4M") + PORT_DIPSETTING(0x07, "6M") + PORT_DIPSETTING(0x0f, "8M") +INPUT_PORTS_END + +void ceres1_state::ceres1(machine_config &config) +{ + NS32032(config, m_cpu, 10_MHz_XTAL); + m_cpu->set_addrmap(0, &ceres1_state::cpu_map<0>); + m_cpu->set_addrmap(6, &ceres1_state::cpu_map<6>); + + RAM(config, m_ram); + m_ram->set_default_size("2MiB"); + m_ram->set_default_value(0); + m_ram->set_extra_options("4MiB,6MiB,8MiB"); + + // TODO: port A txd/rxd connect to keyboard + SCN2681(config, m_uart, 3.6864_MHz_XTAL); + m_uart->irq_cb().set(m_icu, FUNC(am9519_device::ireq2_w)); + m_uart->outport_cb().set( + [this](u8 data) + { + m_serial->write_dtr(BIT(data, 0)); + m_serial->write_rts(BIT(data, 1)); + m_icu->ireq0_w(BIT(data, 3)); + m_icu->ireq4_w(BIT(data, 4)); + }); + m_uart->b_tx_cb().set(m_serial, FUNC(rs232_port_device::write_txd)); + + RS232_PORT(config, m_serial, default_rs232_devices, nullptr); + m_serial->rxd_handler().set(m_uart, FUNC(scn2681_device::rx_b_w)); + m_serial->cts_handler().set(m_uart, FUNC(scn2681_device::ip1_w)); + m_serial->dcd_handler().set(m_uart, FUNC(scn2681_device::ip0_w)); + m_serial->dsr_handler().set(m_uart, FUNC(scn2681_device::ip2_w)); + + // TODO: RS-485 ports "na" and "nb" + SCC8530N(config, m_scc, 6_MHz_XTAL); + m_scc->configure_channels(m_uart->clock(), 0, m_uart->clock(), 0); + m_scc->out_int_callback().set(m_icu, FUNC(am9519_device::ireq1_w)); + + M3002(config, m_rtc, 32.768_kHz_XTAL); + m_rtc->irq_out().set(m_icu, FUNC(am9519_device::ireq5_w)); + + AM9519(config, m_icu); + m_icu->out_int_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + + // TODO: WD1002-05 Winchester/Floppy Disk Controller (WFC) + WD2797(config, m_fdc, 0); + FLOPPY_CONNECTOR(config, "fdc:0", "35dd", FLOPPY_35_DD, true, floppy_formats).enable_sound(false); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(70'000'000, 1344, 0, 1024, 838, 0, 800); + m_screen->set_screen_update(FUNC(ceres1_state::screen_update)); +} + +u32 ceres1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rectangle const &cliprect) +{ + if (!BIT(m_dcr, 0)) + { + offs_t offset = BIT(m_dcr, 1) ? 0x20000 : 0; + u32 const invert = BIT(m_dcr, 2) ? 0xffffffffU : 0; + + for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++) + { + for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 32) + { + u32 const data = m_vram[offset++] ^ invert; + + for (unsigned i = 0; i < 32; i++) + bitmap.pix(y, x + i) = BIT(data, 31 - i) ? rgb_t::white() : rgb_t::black(); + } + } + } + + return 0; +} + +FLOPPY_FORMATS_MEMBER(ceres1_state::floppy_formats) + {} +FLOPPY_FORMATS_END + +ROM_START(ceres1) + ROM_REGION32_LE(0x8000, "eprom", 0) + ROM_SYSTEM_BIOS(0, "ceres1", "30.6.89") + ROMX_LOAD("by0_u44__30_6_89.u44", 0x0000, 0x2000, CRC(8e1559fe) SHA1(2e11c144fd698b9576816f5cfb003c46ab9ce43b), ROM_BIOS(0) | ROM_SKIP(3)) + ROMX_LOAD("by1_u43__30_6_89.u43", 0x0001, 0x2000, CRC(18625b0c) SHA1(3319043507b7eeb488ecd839708032f968e6e53e), ROM_BIOS(0) | ROM_SKIP(3)) + ROMX_LOAD("by2_u42__30_6_89.u42", 0x0002, 0x2000, CRC(a56497c5) SHA1(85858bea9fd27031ee0191b1d508c7469a384f10), ROM_BIOS(0) | ROM_SKIP(3)) + ROMX_LOAD("by3_u41__30_6_89.u41", 0x0003, 0x2000, CRC(6b628912) SHA1(f76ea089e8bf82f572f27def344b5174e577ebbb), ROM_BIOS(0) | ROM_SKIP(3)) +ROM_END + +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP(1986, ceres1, 0, 0, ceres1, ceres1, ceres1_state, empty_init, "Eidgenössische Technische Hochschule Zürich", "Ceres-1", MACHINE_NOT_WORKING) diff --git a/src/mame/drivers/cesclass.cpp b/src/mame/drivers/cesclass.cpp index 73d88eaeccd..1ebb1c639f9 100644 --- a/src/mame/drivers/cesclass.cpp +++ b/src/mame/drivers/cesclass.cpp @@ -71,25 +71,21 @@ void cesclassic_state::video_start() uint32_t cesclassic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,xi; - bitmap.fill(m_palette->black_pen(), cliprect); + for(int y=0;y<64;y++) { - for(y=0;y<64;y++) + for(int x=0;x<16;x++) { - for(x=0;x<16;x++) + for(int xi=0;xi<16;xi++) { - for(xi=0;xi<16;xi++) - { - uint8_t color; + uint8_t color; - color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1); - color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1; + color = (((m_vram[x+y*16+0x400])>>(15-xi)) & 1); + color |= (((m_vram[x+y*16])>>(15-xi)) & 1)<<1; - if((x*16+xi)<256 && ((y)+0)<256) - bitmap.pix32(y, x*16+xi) = m_palette->pen(color); - } + if((x*16+xi)<256 && ((y)+0)<256) + bitmap.pix(y, x*16+xi) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/cfx9850.cpp b/src/mame/drivers/cfx9850.cpp index ffed4490e53..cfd718e9aa1 100644 --- a/src/mame/drivers/cfx9850.cpp +++ b/src/mame/drivers/cfx9850.cpp @@ -270,7 +270,7 @@ u32 cfx9850_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co for (int b = 0; b < 8; b++) { - bitmap.pix16(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); + bitmap.pix(63-j, x+b) = ( data1 & 0x80 ) ? ( data2 & 0x80 ? 3 : 2 ) : ( data2 & 0x80 ? 1 : 0 ); data1 <<= 1; data2 <<= 1; } diff --git a/src/mame/drivers/cgenie.cpp b/src/mame/drivers/cgenie.cpp index ca1fe971ec6..b9c8edae374 100644 --- a/src/mame/drivers/cgenie.cpp +++ b/src/mame/drivers/cgenie.cpp @@ -344,10 +344,10 @@ MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) { const rgb_t map[] = { m_background_color, m_palette[8], m_palette[6], m_palette[5] }; - bitmap.pix32(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; - bitmap.pix32(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 0) = map[code >> 6 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 1) = map[code >> 4 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 2) = map[code >> 2 & 0x03]; + bitmap.pix(y + vbp, column * 4 + hbp + 3) = map[code >> 0 & 0x03]; } else { @@ -367,7 +367,7 @@ MC6845_UPDATE_ROW( cgenie_state::crtc_update_row ) // 8 pixel chars for (int p = 0; p < 8; p++) - bitmap.pix32(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; + bitmap.pix(y + vbp, column * 8 + hbp + p) = BIT(gfx, 7 - p) ? m_palette[color] : m_background_color; } } } diff --git a/src/mame/drivers/chihiro.cpp b/src/mame/drivers/chihiro.cpp index 764e59c8606..678403f7abc 100644 --- a/src/mame/drivers/chihiro.cpp +++ b/src/mame/drivers/chihiro.cpp @@ -1953,8 +1953,10 @@ void chihiro_state::chihirogd(machine_config &config) ROM_SYSTEM_BIOS( 0, "bios0", "Chihiro Bios" ) \ ROM_LOAD_BIOS( 0, "chihiro_xbox_bios.bin", 0x000000, 0x80000, CRC(66232714) SHA1(b700b0041af8f84835e45d1d1250247bf7077188) ) \ ROM_REGION( 0x200000, "mediaboard", 0) \ + ROM_LOAD16_WORD_SWAP_BIOS( 0, "fpr-23887_29lv160te.ic4", 0x000000, 0x200000, CRC(13034372) SHA1(77197fba2781ed1d81402c48bd743adb26d3161a) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "fpr21042_m29w160et.bin", 0x000000, 0x200000, CRC(a4fcab0b) SHA1(a13cf9c5cdfe8605d82150b7573652f419b30197) ) \ ROM_REGION( 0x204080, "others", 0) \ + ROM_LOAD16_WORD_SWAP_BIOS( 0, "315-6351a_epc1pc8.ic2", 0x0000, 0x1ff01, CRC(488624ea) SHA1(1a607337a186415ae90b48934ce2aae81639d4de) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "ic10_g24lc64.bin", 0x0000, 0x2000, CRC(cfc5e06f) SHA1(3ababd4334d8d57abb22dd98bd2d347df39648d9) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "ic11_24lc024.bin", 0x2000, 0x80, CRC(8dc8374e) SHA1(cc03a0650bfac4bf6cb66e414bbef121cba53efe) ) \ ROM_LOAD16_WORD_SWAP_BIOS( 0, "pc20_g24lc64.bin", 0x2080, 0x2000, CRC(7742ab62) SHA1(82dad6e2a75bab4a4840dc6939462f1fb9b95101) ) diff --git a/src/mame/drivers/cit101.cpp b/src/mame/drivers/cit101.cpp index a34c5d077ef..97ec2c97ffa 100644 --- a/src/mame/drivers/cit101.cpp +++ b/src/mame/drivers/cit101.cpp @@ -232,7 +232,7 @@ u32 cit101_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con { const int line = ((z / (BIT(rowattr, 8) ? 2 : 1)) + (rowattr & 0x00f)) & 15; const bool last_line = z++ == rowlines - 1; - draw_line(&bitmap.pix32(y++), cliprect.left(), cliprect.right(), line, last_line, rowaddr, rowattr, scrattr); + draw_line(&bitmap.pix(y++), cliprect.left(), cliprect.right(), line, last_line, rowaddr, rowattr, scrattr); if (last_line) break; } diff --git a/src/mame/drivers/cit220.cpp b/src/mame/drivers/cit220.cpp index 18651203502..bbde707b26c 100644 --- a/src/mame/drivers/cit220.cpp +++ b/src/mame/drivers/cit220.cpp @@ -135,7 +135,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(cit220_state::draw_character) for (int i = 0; i < width; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/clayshoo.cpp b/src/mame/drivers/clayshoo.cpp index 87b59a9ad6f..3af7ad14ed8 100644 --- a/src/mame/drivers/clayshoo.cpp +++ b/src/mame/drivers/clayshoo.cpp @@ -196,7 +196,7 @@ uint32_t clayshoo_state::screen_update_clayshoo(screen_device &screen, bitmap_rg for (i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; data = data << 1; x = x + 1; diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index 326802a7bc6..aae6accb85e 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -105,43 +105,43 @@ public: for (int x = 0; x < 60; x++) { - uint8_t bit = m_ram->pointer()[offset++]; - - bitmap.pix16(y, (x * 8) + 0) = (bit >> 7) & 1; - bitmap.pix16(y, (x * 8) + 1) = (bit >> 6) & 1; - bitmap.pix16(y, (x * 8) + 2) = (bit >> 5) & 1; - bitmap.pix16(y, (x * 8) + 3) = (bit >> 4) & 1; - bitmap.pix16(y, (x * 8) + 4) = (bit >> 3) & 1; - bitmap.pix16(y, (x * 8) + 5) = (bit >> 2) & 1; - bitmap.pix16(y, (x * 8) + 6) = (bit >> 1) & 1; - bitmap.pix16(y, (x * 8) + 7) = (bit >> 0) & 1; + uint8_t const bit = m_ram->pointer()[offset++]; + + bitmap.pix(y, (x * 8) + 0) = BIT(bit, 7); + bitmap.pix(y, (x * 8) + 1) = BIT(bit, 6); + bitmap.pix(y, (x * 8) + 2) = BIT(bit, 5); + bitmap.pix(y, (x * 8) + 3) = BIT(bit, 4); + bitmap.pix(y, (x * 8) + 4) = BIT(bit, 3); + bitmap.pix(y, (x * 8) + 5) = BIT(bit, 2); + bitmap.pix(y, (x * 8) + 6) = BIT(bit, 1); + bitmap.pix(y, (x * 8) + 7) = BIT(bit, 0); } } } else { - uint8_t *font = m_lcd_char_rom->base(); + uint8_t const *font = m_lcd_char_rom->base(); if (m_lcd_mode & LCD_MODE_ALT) { font += 1024; } - int chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; + int const chrw = (m_lcd_size & LCD_SIZE_CHRW) ? 8 : 6; for (int y = 0; y < 128; y++) { - int offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); + int const offset = (m_lcd_scrolly * 128) + (m_lcd_scrollx & 0x7f) + ((y / 8) * 128); for (int x = 0; x < 480; x++) { - uint8_t ch = m_ram->pointer()[offset + (x / chrw)]; + uint8_t const ch = m_ram->pointer()[offset + (x / chrw)]; uint8_t bit = font[((ch & 0x7f) * 8) + (y % 8)]; if (ch & 0x80) { bit = ~bit; } - bitmap.pix16(y, x) = (bit >> (7 - (x % chrw))) & 1; + bitmap.pix(y, x) = (bit >> (7 - (x % chrw))) & 1; } } } diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp index 333d352af29..dc0d8a940a4 100644 --- a/src/mame/drivers/cmi.cpp +++ b/src/mame/drivers/cmi.cpp @@ -490,7 +490,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint8_t *src = &m_video_ram[(512/8) * ((y + y_scroll) & 0xff)]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 8) { @@ -507,7 +507,7 @@ uint32_t cmi_state::screen_update_cmi2x(screen_device &screen, bitmap_rgb32 &bit if (m_lp_touch_port->read() && BIT(m_q219_pia->b_output(), 1)) { /* Invert target pixel */ - bitmap.pix32(m_lp_y_port->read(), m_lp_x_port->read()) ^= 0x00ffffff; + bitmap.pix(m_lp_y_port->read(), m_lp_x_port->read()) ^= 0x00ffffff; } diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp index 162bf98d927..9fcd2d39ca6 100644 --- a/src/mame/drivers/cobra.cpp +++ b/src/mame/drivers/cobra.cpp @@ -860,8 +860,8 @@ public: void cobra_renderer::render_color_scan(int32_t scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid) { - uint32_t *fb = &m_backbuffer->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_backbuffer->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); float z = extent.param[POLY_Z].start; float dz = extent.param[POLY_Z].dpdx; @@ -961,8 +961,8 @@ void cobra_renderer::render_texture_scan(int32_t scanline, const extent_t &exten float ga = extent.param[POLY_A].start; float dga = extent.param[POLY_A].dpdx; - uint32_t *fb = &m_backbuffer->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_backbuffer->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); uint32_t texture_width = 1 << ((extradata.tex_format >> 28) & 0xf); uint32_t texture_height = 1 << ((extradata.tex_format >> 24) & 0xf); @@ -1066,7 +1066,7 @@ void cobra_renderer::draw_point(const rectangle &visarea, vertex_t &v, uint32_t if (x >= visarea.min_x && x <= visarea.max_x && y >= visarea.min_y && y <= visarea.max_y) { - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; } } @@ -1094,7 +1094,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t { int y = y1 + (dy * (float)(x - x1) / (float)(dx)); - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; x++; @@ -1107,7 +1107,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t { int x = x1 + (dx * (float)(y - y1) / (float)(dy)); - uint32_t *fb = &m_backbuffer->pix32(y); + uint32_t *const fb = &m_backbuffer->pix(y); fb[x] = color; y++; @@ -2610,11 +2610,11 @@ void cobra_renderer::gfx_fifo_exec() uint32_t *buffer; switch (m_gfx_gram[0x80104/4]) { - case 0x800000: buffer = &m_framebuffer->pix32(y); break; - case 0x200000: buffer = &m_backbuffer->pix32(y); break; - case 0x0e0000: buffer = &m_overlay->pix32(y); break; - case 0x000800: buffer = &m_zbuffer->pix32(y); break; - case 0x000200: buffer = &m_stencil->pix32(y); break; + case 0x800000: buffer = &m_framebuffer->pix(y); break; + case 0x200000: buffer = &m_backbuffer->pix(y); break; + case 0x0e0000: buffer = &m_overlay->pix(y); break; + case 0x000800: buffer = &m_zbuffer->pix(y); break; + case 0x000200: buffer = &m_stencil->pix(y); break; default: { @@ -2666,11 +2666,11 @@ void cobra_renderer::gfx_fifo_exec() uint32_t *buffer; switch (m_gfx_gram[0x80104/4]) { - case 0x800000: buffer = &m_framebuffer->pix32(y+i); break; - case 0x200000: buffer = &m_backbuffer->pix32(y+i); break; - case 0x0e0000: buffer = &m_overlay->pix32(y+i); break; - case 0x000800: buffer = &m_zbuffer->pix32(y+i); break; - case 0x000200: buffer = &m_stencil->pix32(y+i); break; + case 0x800000: buffer = &m_framebuffer->pix(y+i); break; + case 0x200000: buffer = &m_backbuffer->pix(y+i); break; + case 0x0e0000: buffer = &m_overlay->pix(y+i); break; + case 0x000800: buffer = &m_zbuffer->pix(y+i); break; + case 0x000200: buffer = &m_stencil->pix(y+i); break; default: { diff --git a/src/mame/drivers/cocoloco.cpp b/src/mame/drivers/cocoloco.cpp index 37e9ac204ba..18e6e0060d4 100644 --- a/src/mame/drivers/cocoloco.cpp +++ b/src/mame/drivers/cocoloco.cpp @@ -288,7 +288,7 @@ uint32_t cocoloco_state::screen_update(screen_device &screen, bitmap_ind16 &bitm color |= ((m_videoram[count|0x6000] >> (xi)) & 1) << 3; if (cliprect.contains(x + xi, 256 - y)) - bitmap.pix16(256 - y, x + xi) = m_palette->pen(color & 0x0f); + bitmap.pix(256 - y, x + xi) = m_palette->pen(color & 0x0f); } count++; diff --git a/src/mame/drivers/compucolor.cpp b/src/mame/drivers/compucolor.cpp index f5dc5662f4b..ca1b9824215 100644 --- a/src/mame/drivers/compucolor.cpp +++ b/src/mame/drivers/compucolor.cpp @@ -284,12 +284,12 @@ uint32_t compucolor2_state::screen_update(screen_device &screen, bitmap_rgb32 &b uint8_t data = m_char_rom->base()[char_offs]; - rgb_t fg = m_palette->pen_color(attr & 0x07); - rgb_t bg = m_palette->pen_color((attr >> 3) & 0x07); + rgb_t const fg = m_palette->pen_color(attr & 0x07); + rgb_t const bg = m_palette->pen_color((attr >> 3) & 0x07); for (int x = 0; x < 6; x++) { - bitmap.pix32(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; + bitmap.pix(y, (sx * 6) + x) = BIT(data, 7) ? fg : bg; data <<= 1; } diff --git a/src/mame/drivers/consola_emt.cpp b/src/mame/drivers/consola_emt.cpp index 8e5abca8046..74bff79497f 100644 --- a/src/mame/drivers/consola_emt.cpp +++ b/src/mame/drivers/consola_emt.cpp @@ -233,7 +233,7 @@ HD44780_PIXEL_UPDATE( consoemt_state::lcd_pixel_update ) return; if (line < 2 && pos < 20) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/drivers/coolpool.cpp b/src/mame/drivers/coolpool.cpp index 8028dcc7a7e..f5fad8a2a87 100644 --- a/src/mame/drivers/coolpool.cpp +++ b/src/mame/drivers/coolpool.cpp @@ -63,21 +63,20 @@ static const uint16_t nvram_unlock_seq[] = TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::amerdart_scanline) { - uint16_t *vram = &m_vram_base[(params->rowaddr << 8) & 0xff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram_base[(params->rowaddr << 8) & 0xff00]; + uint32_t *const dest = &bitmap.pix(scanline); rgb_t pens[16]; int coladdr = params->coladdr; - int x; /* update the palette */ if (scanline < 256) - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { uint16_t pal = m_vram_base[x]; pens[x] = rgb_t(pal4bit(pal >> 4), pal4bit(pal >> 8), pal4bit(pal >> 12)); } - for (x = params->heblnk; x < params->hsblnk; x += 4) + for (int x = params->heblnk; x < params->hsblnk; x += 4) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[(pixels >> 0) & 15]; @@ -90,13 +89,12 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::amerdart_scanline) TMS340X0_SCANLINE_RGB32_CB_MEMBER(coolpool_state::coolpool_scanline) { - uint16_t *vram = &m_vram_base[(params->rowaddr << 8) & 0x1ff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const vram = &m_vram_base[(params->rowaddr << 8) & 0x1ff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/coolridr.cpp b/src/mame/drivers/coolridr.cpp index 8b454e86424..cbb54e200b3 100644 --- a/src/mame/drivers/coolridr.cpp +++ b/src/mame/drivers/coolridr.cpp @@ -663,17 +663,17 @@ do { /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + PIXEL_TYPE *destptr = &dest.pix(cury, destx); \ + const uint8_t *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ for (curx = 0; curx < numblocks; curx++) \ { \ - COOL_PIXEL_OP(destptr[0], srcptr[0]); \ - COOL_PIXEL_OP(destptr[1], srcptr[1]); \ - COOL_PIXEL_OP(destptr[2], srcptr[2]); \ - COOL_PIXEL_OP(destptr[3], srcptr[3]); \ + COOL_PIXEL_OP(destptr[0], srcptr[0]); \ + COOL_PIXEL_OP(destptr[1], srcptr[1]); \ + COOL_PIXEL_OP(destptr[2], srcptr[2]); \ + COOL_PIXEL_OP(destptr[3], srcptr[3]); \ \ srcptr += 4; \ destptr += 4; \ @@ -682,7 +682,7 @@ do { /* iterate over leftover pixels */ \ for (curx = 0; curx < leftovers; curx++) \ { \ - COOL_PIXEL_OP(destptr[0], srcptr[0]); \ + COOL_PIXEL_OP(destptr[0], srcptr[0]); \ srcptr++; \ destptr++; \ } \ @@ -695,8 +695,8 @@ do { /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + PIXEL_TYPE *destptr = &dest.pix(cury, destx); \ + const uint8_t *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -910,8 +910,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t* linesrc = &m_screen_bitmap[Screen].pix16(y); - uint16_t* linedest = &bitmap.pix16(y); + uint16_t const *const linesrc = &m_screen_bitmap[Screen].pix(y); + uint16_t *const linedest = &bitmap.pix(y); for (int x = cliprect.left(); x<= cliprect.right(); x++) { @@ -1129,8 +1129,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm const int pixelOffsetnextX = ((hPositionTable) + ((h+1)* 16 * hZoomHere)) / 0x40; \ if (drawy>clipmaxY) { break; }; \ if (drawy<clipminY) { drawy++; continue; }; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int blockwide = pixelOffsetnextX-pixelOffsetX; \ if (pixelOffsetX+blockwide <clipminX) { drawy++; continue; } \ if (pixelOffsetX>clipmaxX) { drawy++; continue; } \ @@ -1167,8 +1167,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int realy = ((y*incy)>>21); \ const int drawy = pixelOffsetY+y; \ if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int drawx = pixelOffsetX; \ for (int x = 0; x < blockwide; x++) \ { \ @@ -1185,8 +1185,8 @@ uint32_t coolridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { \ const int drawy = pixelOffsetY+realy; \ if ((drawy>clipmaxY) || (drawy<clipminY)) continue; \ - line = &drawbitmap->pix16(drawy); \ - /* zline = &object->zbitmap->pix16(drawy); */ \ + uint16_t *const line = &drawbitmap->pix(drawy); \ + /* uint16_t *const zline = &object->zbitmap->pix(drawy); */ \ int drawx = pixelOffsetX; \ for (int realx = 0; realx < 16; realx++) \ { \ @@ -1937,9 +1937,6 @@ void *coolridr_state::draw_object_threaded(void *param, int threadid) uint32_t incy = 0x8000000 / vZoom; // DEBUG: Draw 16x16 block - uint16_t* line; - //uint16_t* zline; - if (indirect_zoom_enable) { diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp index d8bd5d0ae54..90c58278ed9 100644 --- a/src/mame/drivers/corona.cpp +++ b/src/mame/drivers/corona.cpp @@ -499,22 +499,18 @@ void corona_state::video_start() uint32_t corona_state::screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) - bitmap.pix16(y, x) = m_videobuf[y * 512 + x]; + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(y, x) = m_videobuf[y * 512 + x]; return 0; } uint32_t corona_state::screen_update_luckyrlt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = 0; y < 256; y++) - for (x = 0; x < 256; x++) - bitmap.pix16(255 - y, x) = m_videobuf[y * 512 + x]; + for (int y = 0; y < 256; y++) + for (int x = 0; x < 256; x++) + bitmap.pix(255 - y, x) = m_videobuf[y * 512 + x]; return 0; } diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp index ce0a55bc62c..ab0408d1a1c 100644 --- a/src/mame/drivers/cps3.cpp +++ b/src/mame/drivers/cps3.cpp @@ -707,8 +707,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -723,8 +723,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -740,8 +740,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -757,8 +757,8 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -1288,8 +1288,8 @@ u32 cps3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const /* copy render bitmap without zoom */ for (u32 rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++) { - u32* dstbitmap = &bitmap.pix32(rendery); - u32* srcbitmap = &m_renderbuffer_bitmap.pix32(rendery); + u32 *const dstbitmap = &bitmap.pix(rendery); + u32 const *const srcbitmap = &m_renderbuffer_bitmap.pix(rendery); for (u32 renderx = cliprect.left(); renderx <= cliprect.right(); renderx++) { @@ -1303,8 +1303,8 @@ u32 cps3_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const u32 srcy = cliprect.top() * fszy; for (u32 rendery = cliprect.top(); rendery <= cliprect.bottom(); rendery++) { - u32* dstbitmap = &bitmap.pix32(rendery); - u32* srcbitmap = &m_renderbuffer_bitmap.pix32(srcy >> 16); + u32 *const dstbitmap = &bitmap.pix(rendery); + u32 const *const srcbitmap = &m_renderbuffer_bitmap.pix(srcy >> 16); u32 srcx = cliprect.left() * fszx; for (u32 renderx = cliprect.left(); renderx <= cliprect.right(); renderx++) diff --git a/src/mame/drivers/cubeqst.cpp b/src/mame/drivers/cubeqst.cpp index 6df6c4eec61..96a799ac89b 100644 --- a/src/mame/drivers/cubeqst.cpp +++ b/src/mame/drivers/cubeqst.cpp @@ -130,8 +130,6 @@ void cubeqst_state::palette_w(offs_t offset, uint16_t data, uint16_t mem_mask) /* TODO: This is a simplified version of what actually happens */ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; - /* * Clear the display with palette RAM entry 0xff * This will be either transparent or an actual colour @@ -141,13 +139,11 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 bitmap.fill(m_colormap[255], cliprect); /* TODO: Add 1 for linebuffering? */ - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - int i; int num_entries = m_linecpu->cubeqcpu_get_ptr_ram_val(y); - uint32_t *stk_ram = m_linecpu->cubeqcpu_get_stack_ram(); - uint32_t *dest = &bitmap.pix32(y); - uint32_t pen; + uint32_t const *const stk_ram = m_linecpu->cubeqcpu_get_stack_ram(); + uint32_t *const dest = &bitmap.pix(y); /* Zap the depth buffer */ memset(m_depth_buffer.get(), 0xff, 512); @@ -155,11 +151,10 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 /* Process all the spans on this scanline */ if (y < 256) { - for (i = 0; i < num_entries; i += 2) + for (int i = 0; i < num_entries; i += 2) { int color = 0, depth = 0; int h1 = 0, h2 = 0; - int x; int entry1 = stk_ram[(y << 7) | ((i + 0) & 0x7f)]; int entry2 = stk_ram[(y << 7) | ((i + 1) & 0x7f)]; @@ -187,8 +182,8 @@ uint32_t cubeqst_state::screen_update_cubeqst(screen_device &screen, bitmap_rgb3 } /* Draw the span, testing for depth */ - pen = m_colormap[m_generic_paletteram_16[color]]; - for (x = h1; x <= h2; ++x) + uint32_t pen = m_colormap[m_generic_paletteram_16[color]]; + for (int x = h1; x <= h2; ++x) { if (!(m_depth_buffer[x] < depth)) { diff --git a/src/mame/drivers/cupidon.cpp b/src/mame/drivers/cupidon.cpp index a4681e71eaf..4f0066ebf99 100644 --- a/src/mame/drivers/cupidon.cpp +++ b/src/mame/drivers/cupidon.cpp @@ -29,25 +29,23 @@ public: m_gfxram(*this, "gfxram") { } + void init_cupidon(); + void init_funnyfm(); + + void cupidon(machine_config &config); + void cupidon_map(address_map &map); + +protected: // devices required_device<m68340_cpu_device> m_maincpu; required_shared_ptr<uint32_t> m_gfxram; uint32_t screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void init_cupidon(); - void init_funnyfm(); - uint32_t cupidon_return_ffffffff() { return -1; // or it hits an illegal opcode (sleep on the 68340?) - }; - - void cupidon(machine_config &config); - void cupidon_map(address_map &map); -protected: - - + } }; uint32_t cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -60,7 +58,7 @@ uint32_t cupidon_state::screen_update_cupidon(screen_device &screen, bitmap_ind1 { for (int y=0;y<16;y++) { - uint16_t* destline = &bitmap.pix16(ytile*16 + y); + uint16_t *const destline = &bitmap.pix(ytile*16 + y); for (int x=0;x<8;x++) { diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp index 612e69281e3..a477f9626df 100644 --- a/src/mame/drivers/cxhumax.cpp +++ b/src/mame/drivers/cxhumax.cpp @@ -897,17 +897,14 @@ static inline uint32_t ycc_to_rgb(uint32_t ycc) uint32_t cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - uint32_t osd_pointer = m_drm1_regs[DRM_OSD_PTR_REG]; if(osd_pointer) { - uint32_t *ram = m_ram; - uint32_t *osd_header = &ram[osd_pointer/4]; - uint8_t *vbuf = (uint8_t*)(&ram[osd_header[3]/4]); - uint32_t *palette = &ram[osd_header[7]/4]; + uint32_t const *ram = m_ram; + uint32_t const *osd_header = &ram[osd_pointer/4]; + uint8_t const *vbuf = (uint8_t*)(&ram[osd_header[3]/4]); + uint32_t const *palette = &ram[osd_header[7]/4]; uint32_t x_disp_start_and_width = osd_header[1]; uint32_t xdisp_width = (x_disp_start_and_width >> 16) & 0x1fff; @@ -927,14 +924,14 @@ uint32_t cxhumax_state::screen_update_cxhumax(screen_device &screen, bitmap_rgb3 uint32_t first_y = m_drm0_regs[DRM_ACTIVE_Y_REG] & 0xfff; uint32_t last_y = (m_drm0_regs[DRM_ACTIVE_Y_REG] >> 16) & 0xfff;*/ - for (j=ydisp_start; j <= ydisp_last; j++) + for (int j=ydisp_start; j <= ydisp_last; j++) { - uint32_t *bmp = &bitmap.pix32(j); + uint32_t *const bmp = &bitmap.pix(j); - for (i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) + for (int i=xdisp_start; i <= (xdisp_start + xdisp_width); i++) { if ((i <= (xdisp_start + ximg_width)) && (j <= (ydisp_start + yimg_height))) { - bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; + bmp[i] = palette[vbuf[i+((j-ydisp_start)*ximg_width)]]; // FIXME: need BYTE4_XOR_?E for endianness } else { bmp[i] = ycc_to_rgb(m_drm1_regs[DRM_BCKGND_REG]); } diff --git a/src/mame/drivers/cybertnk.cpp b/src/mame/drivers/cybertnk.cpp index 306769ebbb5..bc713eedbe1 100644 --- a/src/mame/drivers/cybertnk.cpp +++ b/src/mame/drivers/cybertnk.cpp @@ -379,7 +379,7 @@ void cybertnk_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c if ((yy>=miny) && (yy<=maxy)) { - dest = &bitmap.pix16(yy, 0); + dest = &bitmap.pix(yy, 0); int start,end,inc; diff --git a/src/mame/drivers/cz101.cpp b/src/mame/drivers/cz101.cpp index b41b08c17b0..1e475f33125 100644 --- a/src/mame/drivers/cz101.cpp +++ b/src/mame/drivers/cz101.cpp @@ -259,7 +259,7 @@ HD44780_PIXEL_UPDATE( cz101_state::lcd_pixel_update ) return; if (line < 2 && pos < 16) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } void cz101_state::led_4_w(uint8_t data) diff --git a/src/mame/drivers/d6800.cpp b/src/mame/drivers/d6800.cpp index 49bc8d9ead2..010f6274193 100644 --- a/src/mame/drivers/d6800.cpp +++ b/src/mame/drivers/d6800.cpp @@ -171,16 +171,16 @@ INPUT_CHANGED_MEMBER(d6800_state::reset_button) /* Video */ uint32_t d6800_state::screen_update_d6800(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t x,y,gfx=0; + uint8_t gfx=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = 0; x < 8; x++) + for (uint8_t x = 0; x < 8; x++) { if (m_cb2) - gfx = m_videoram[ x | (y<<3)]; + gfx = m_videoram[x | (y<<3)]; *p++ = BIT(gfx, 7); *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/dai3wksi.cpp b/src/mame/drivers/dai3wksi.cpp index 91293f00cee..64a54bdad0e 100644 --- a/src/mame/drivers/dai3wksi.cpp +++ b/src/mame/drivers/dai3wksi.cpp @@ -179,9 +179,9 @@ uint32_t dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rg rgb_t pen = (data & (1 << i)) ? m_palette->pen_color(color) : rgb_t::black(); if (m_dai3wksi_flipscreen) - bitmap.pix32(255-y, 255-x) = pen; + bitmap.pix(255-y, 255-x) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; x++; } diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index 85e8f828216..8e59a701fa2 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -1703,7 +1703,6 @@ uint8_t ddenlovr_state::ddenlovr_gfxrom_r() void ddenlovr_state::copylayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer) { - int x,y; int scrollx = m_ddenlovr_scroll[layer / 4 * 8 + (layer % 4) + 0]; int scrolly = m_ddenlovr_scroll[layer / 4 * 8 + (layer % 4) + 4]; @@ -1720,15 +1719,15 @@ void ddenlovr_state::copylayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (((m_ddenlovr_layer_enable2 << 4) | m_ddenlovr_layer_enable) & (1 << layer)) { - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { int pen = m_ddenlovr_pixmap[layer][512 * ((y + scrolly) & 0x1ff) + ((x + scrollx) & 0x1ff)]; if ((pen & transmask) != transpen) { pen &= penmask; - bitmap.pix32(y, x) = pens[pen]; + bitmap.pix(y, x) = pens[pen]; } } } @@ -4283,18 +4282,16 @@ VIDEO_START_MEMBER(htengoku_state,htengoku) uint32_t htengoku_state::screen_update_htengoku(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int layer, x, y; - // render the layers, one by one, "dynax.c" style. Then convert the pixmaps to "ddenlovr.c" // format and let screen_update_ddenlovr() do the final compositing (priorities + palettes) - for (layer = 0; layer < 4; layer++) + for (int layer = 0; layer < 4; layer++) { m_htengoku_layer.fill(0, cliprect); hanamai_copylayer(m_htengoku_layer, cliprect, layer); - for (y = 0; y < 256; y++) - for (x = 0; x < 512; x++) - m_ddenlovr_pixmap[3 - layer][y * 512 + x] = (uint8_t)(m_htengoku_layer.pix16(y, x)); + for (int y = 0; y < 256; y++) + for (int x = 0; x < 512; x++) + m_ddenlovr_pixmap[3 - layer][y * 512 + x] = uint8_t(m_htengoku_layer.pix(y, x)); } return screen_update_ddenlovr(screen, bitmap, cliprect); diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp index 0fdd7a79c5e..e443f17e22a 100644 --- a/src/mame/drivers/dec8.cpp +++ b/src/mame/drivers/dec8.cpp @@ -2602,17 +2602,17 @@ ROM_START( gondo ) ROM_REGION( 0x40000, "maincpu", 0 ) ROM_LOAD( "dt00-e.f3", 0x08000, 0x08000, CRC(912a7eee) SHA1(15af89babf166dadaa77640e1973d7ebb4c078db) ) // Verified only DT00-E & DT03-E have the "-E" extention ROM_LOAD( "dt01.f5", 0x10000, 0x10000, CRC(c39bb877) SHA1(9beb59ba19f38417c5d4d36e8f3c41f2b017d2d6) ) - ROM_LOAD( "dt02.f6", 0x20000, 0x10000, CRC(bb5e674b) SHA1(8057dc7464a8b6987536f248d607957923b223cf) ) + ROM_LOAD( "dt02.f6", 0x20000, 0x10000, CRC(925307a4) SHA1(1e8b8eb21df1a11b14c981b343b34c6cc3676517) ) // same label as the US version, but content identical to Japanese version ROM_LOAD( "dt03-e.f7", 0x30000, 0x10000, CRC(ee7475eb) SHA1(8c68198ea1c3e89c9c2c4ba0e5d3f47afb8eecd4) ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "dt05-e.h5", 0x8000, 0x8000, CRC(ec08aa29) SHA1(ce83974ae095d9518d1ebf9f7e712f0cbc2c1b42) ) ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "dt-e.b1", 0x0000, 0x1000, NO_DUMP ) // No decapped dump or hand crafted code for this set + ROM_LOAD( "dt-e.b1", 0x0000, 0x1000, BAD_DUMP CRC(0d0532ec) SHA1(30894f69ff24c1be4b684e07729bbb3e0f353086) ) // hand-crafted from the US version ROM_REGION( 0x08000, "gfx1", 0 ) /* characters */ - ROM_LOAD( "dt14.b18", 0x00000, 0x08000, CRC(4bef16e1) SHA1(b8157a7a1b8f36cea1fd353267a4e03d920cb4aa) ) + ROM_LOAD( "dt14-e.b18", 0x00000, 0x08000, CRC(00cbe9c8) SHA1(de7b640de8fd54ee79194945c96d5768d09f483b) ) // identical to Japanese version ROM_REGION( 0x80000, "gfx2", 0 ) /* sprites */ ROM_LOAD( "dt19.f13", 0x00000, 0x10000, CRC(da2abe4b) SHA1(d53e4769671f3fd437edcff7e7ea05156bbcb45d) ) // All sprite data matches the Japanese set @@ -3729,7 +3729,7 @@ GAME( 1986, lastmisnu5, lastmisn, lastmisn, lastmisn, dec8_state, init_dec8, GAME( 1986, lastmisnj, lastmisn, lastmisn, lastmisnj, dec8_state, init_dec8, ROT270, "Data East Corporation", "Last Mission (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, shackled, 0, shackled, shackled, dec8_state, init_dec8, ROT0, "Data East USA", "Shackled (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, breywood, shackled, shackled, breywood, dec8_state, init_dec8, ROT0, "Data East Corporation", "Breywood (Japan revision 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1987, gondo, 0, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East Corporation", "Gondomania (World)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // i8751 protection MCU not dumped +GAME( 1987, gondo, 0, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East Corporation", "Gondomania (World)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, gondou, gondo, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East USA", "Gondomania (US)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, makyosen, gondo, gondo, gondo, dec8_state, init_dec8, ROT270, "Data East Corporation", "Makyou Senshi (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1987, garyoret, 0, garyoret, garyoret, dec8_state, init_dec8, ROT0, "Data East Corporation", "Garyo Retsuden (Japan)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/decstation.cpp b/src/mame/drivers/decstation.cpp index 36125d8c584..aa0ecc18f17 100644 --- a/src/mame/drivers/decstation.cpp +++ b/src/mame/drivers/decstation.cpp @@ -171,17 +171,14 @@ void decstation_state::video_start() uint32_t decstation_state::kn01_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - uint8_t *vram = (uint8_t *)m_kn01vram.target(); + uint8_t const *const vram = (uint8_t *)m_kn01vram.target(); - for (y = 0; y < 864; y++) + for (int y = 0; y < 864; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1024; x++) { - pixels = vram[(y * 1024) + x]; + uint8_t const pixels = vram[(y * 1024) + x]; *scanline++ = m_palette[pixels]; } } diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp index 8d328ae2003..fd863440050 100644 --- a/src/mame/drivers/destroyr.cpp +++ b/src/mame/drivers/destroyr.cpp @@ -174,7 +174,7 @@ uint32_t destroyr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int i = 0; i < 256; i++) { if (i & 4) - bitmap.pix16(m_cursor ^ 0xff, i) = 7; + bitmap.pix(m_cursor ^ 0xff, i) = 7; } return 0; } diff --git a/src/mame/drivers/dgpix.cpp b/src/mame/drivers/dgpix.cpp index 29484abd2d0..e06bdcb99b2 100644 --- a/src/mame/drivers/dgpix.cpp +++ b/src/mame/drivers/dgpix.cpp @@ -419,8 +419,8 @@ u32 dgpix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { int x = cliprect.left(); - u16 *src = &m_vram[(m_vbuffer ? 0 : 0x20000) | (y << 9) | x]; - u16 *dest = &bitmap.pix16(y, x); + u16 const *src = &m_vram[(m_vbuffer ? 0 : 0x20000) | (y << 9) | x]; + u16 *dest = &bitmap.pix(y, x); for (; x <= cliprect.right(); x++) { diff --git a/src/mame/drivers/dim68k.cpp b/src/mame/drivers/dim68k.cpp index ebb3ce6763d..b2937aaef95 100644 --- a/src/mame/drivers/dim68k.cpp +++ b/src/mame/drivers/dim68k.cpp @@ -234,20 +234,20 @@ void dim68k_state::machine_reset() // Text-only; graphics isn't emulated yet. Need to find out if hardware cursor is used. MC6845_UPDATE_ROW( dim68k_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,x,xx,inv; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint16_t chr16=0x2020; // set to spaces if screen is off - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); u8 screen_on = ~m_video_control & 4; u8 dot8 = ~m_video_control & 40; // need to divide everything in half to cater for 16-bit reads x_count /= 2; ma /= 2; - xx = 0; + u8 xx = 0; - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { + u8 inv, chr, gfx; if (screen_on) chr16 = m_ram[ma+x]; // reads 2 characters diff --git a/src/mame/drivers/dkmb.cpp b/src/mame/drivers/dkmb.cpp index 5a83f16b125..715c0c03bbb 100644 --- a/src/mame/drivers/dkmb.cpp +++ b/src/mame/drivers/dkmb.cpp @@ -67,11 +67,11 @@ uint32_t dkmb_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, int count = 0; for (int y = 0; y < 256; y++) { - uint32_t* dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = 0; x < 1024 / 2; x++) { - uint64_t val = m_framebuffer[count]; + uint64_t const val = m_framebuffer[count]; dst[(x * 2) + 0] = (val >> 32) & 0x00ffffff; dst[(x * 2) + 1] = (val >> 0) & 0x00ffffff; diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index ced56a6fb8c..ba0a6881739 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -315,17 +315,17 @@ UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) for(int xi=0; xi<16; xi++) { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; + int r = BIT(red, xi) ? 255 : 0; + int g = BIT(green, xi) ? 255 : 0; + int b = BIT(blue, xi) ? 255 : 0; if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + bitmap.pix(y, x + xi) = rgb_t(r, g, b); } } else { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // 32KB videoram uint16_t gfx = m_video_ram[(address & 0xffff) >> 1]; @@ -333,7 +333,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels ) for(int xi=0;xi<16;xi++) { if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = ((gfx >> xi) & 1) ? palette[2] : palette[0]; + bitmap.pix(y, x + xi) = ((gfx >> xi) & 1) ? palette[2] : palette[0]; } } } @@ -367,18 +367,17 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) for( int xi = 0; xi < 8; xi++) { - int res_x,res_y; int pen = (tile_data >> xi) & 1 ? 1 : 0; - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(!m_screen->visible_area().contains(res_x, res_y)) continue; if(yi >= 16) { pen = 0; } - bitmap.pix32(res_y, res_x) = pen ? fg : bg; + bitmap.pix(res_y, res_x) = pen ? fg : bg; } } } diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp index c1498e8e5ce..c8fc3ac0278 100644 --- a/src/mame/drivers/dooyong.cpp +++ b/src/mame/drivers/dooyong.cpp @@ -770,9 +770,9 @@ u32 popbingo_state::screen_update_popbingo(screen_device &screen, bitmap_ind16 & for (int y = cliprect.top(); cliprect.bottom() >= y; y++) { - const u16 *const bg_src(&m_bg_bitmap[0].pix16(y, 0)); - const u16 *const bg2_src(&m_bg_bitmap[1].pix16(y, 0)); - u16 *const dst(&bitmap.pix16(y, 0)); + const u16 *const bg_src(&m_bg_bitmap[0].pix(y, 0)); + const u16 *const bg2_src(&m_bg_bitmap[1].pix(y, 0)); + u16 *const dst(&bitmap.pix(y, 0)); for (int x = cliprect.left(); cliprect.right() >= x; x++) dst[x] = 0x100U | (bg_src[x] << 4) | bg2_src[x]; } diff --git a/src/mame/drivers/dorachan.cpp b/src/mame/drivers/dorachan.cpp index fc0e8a74f96..54820630f8c 100644 --- a/src/mame/drivers/dorachan.cpp +++ b/src/mame/drivers/dorachan.cpp @@ -74,8 +74,6 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg { for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - uint8_t fore_color; - uint8_t x = offs >> 8 << 3; uint8_t y = offs & 0xff; @@ -84,6 +82,7 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg uint8_t data = m_videoram[offs]; + uint8_t fore_color; if (m_flip_screen) fore_color = (m_colors[color_address] >> 3) & 0x07; else @@ -92,7 +91,7 @@ uint32_t dorachan_state::screen_update_dorachan(screen_device &screen, bitmap_rg for (int i = 0; i < 8; i++) { uint8_t color = BIT(data, i) ? fore_color : 0; - bitmap.pix32(y, x++) = m_palette->pen_color(color); + bitmap.pix(y, x++) = m_palette->pen_color(color); } } diff --git a/src/mame/drivers/dotrikun.cpp b/src/mame/drivers/dotrikun.cpp index 9fb00be2adf..3f56aeafaa1 100644 --- a/src/mame/drivers/dotrikun.cpp +++ b/src/mame/drivers/dotrikun.cpp @@ -130,7 +130,7 @@ uint32_t dotrikun_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if ((x & 7) == 0) m_vram_latch = m_vram[x >> 3 | y >> 1 << 4]; - bitmap.pix16(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3; + bitmap.pix(y, x) = (m_vram_latch >> (~x & 7) & 1) ? m_color & 7 : m_color >> 3; } } diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index 3f6608f311a..87b278a2638 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -1068,8 +1068,8 @@ void dpb7000_state::device_timer(emu_timer &timer, device_timer_id id, int param MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row) { - const pen_t *pen = m_palette->pens(); - const uint8_t *char_rom = m_vdu_char_rom->base(); + const pen_t *const pen = m_palette->pens(); + const uint8_t *const char_rom = m_vdu_char_rom->base(); for (int column = 0; column < x_count; column++) { @@ -1087,7 +1087,7 @@ MC6845_UPDATE_ROW(dpb7000_state::crtc_update_row) int x = (column * 8) + bit; int color = BIT(data, 7) && de; - bitmap.pix32(y, x) = pen[color]; + bitmap.pix(y, x) = pen[color]; data <<= 1; } @@ -2396,9 +2396,9 @@ uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 { for (int py = 0; py < 768; py++) { - uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; - uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; - uint32_t *dst = &bitmap.pix32(py); + const uint8_t *src_lum = &m_framestore_lum[StoreNum][py * 800]; + const uint8_t *src_chr = &m_framestore_chr[StoreNum][py * 800]; + uint32_t *dst = &bitmap.pix(py); for (int px = 0; px < 800; px++) { const uint32_t u = *src_chr++ << 16; @@ -2412,9 +2412,9 @@ uint32_t dpb7000_state::store_screen_update(screen_device &screen, bitmap_rgb32 { for (int py = 512; py < 768; py++) { - uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; - uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; - uint32_t *dst = &bitmap.pix32(py); + const uint8_t *src_lum = &m_brushstore_lum[(py - 512) * 256]; + const uint8_t *src_chr = &m_brushstore_chr[(py - 512) * 256]; + uint32_t *dst = &bitmap.pix(py); for (int px = 0; px < 256; px += 2) { const uint32_t u = *src_chr++ << 16; diff --git a/src/mame/drivers/duet16.cpp b/src/mame/drivers/duet16.cpp index e2c0f49c303..54d3e4b246e 100644 --- a/src/mame/drivers/duet16.cpp +++ b/src/mame/drivers/duet16.cpp @@ -194,7 +194,7 @@ MC6845_UPDATE_ROW(duet16_state::crtc_update_row) { if(!de) return; - u8 *gvram = (u8 *)&m_gvram[0]; + u8 const *const gvram = (u8 *)&m_gvram[0]; for(int i = 0; i < x_count; i++) { u16 coffset = (ma + i) & 0x07ff; @@ -235,7 +235,7 @@ MC6845_UPDATE_ROW(duet16_state::crtc_update_row) color = m_pal->pen_color((BIT(g2, 7 - xi) << 2) | (BIT(g1, 7 - xi) << 1) | BIT(g0, 7 - xi)); else color = 0; - bitmap.pix32(y, (i * 8) + xi) = color; + bitmap.pix(y, (i * 8) + xi) = color; } } } diff --git a/src/mame/drivers/dvk_kcgd.cpp b/src/mame/drivers/dvk_kcgd.cpp index 664a1d83db0..0844a6781e4 100644 --- a/src/mame/drivers/dvk_kcgd.cpp +++ b/src/mame/drivers/dvk_kcgd.cpp @@ -307,19 +307,19 @@ void kcgd_state::draw_scanline(uint16_t *p, uint16_t offset) TIMER_DEVICE_CALLBACK_MEMBER(kcgd_state::scanline_callback) { - uint16_t y = m_screen->vpos(), offset; + uint16_t y = m_screen->vpos(); if (y < KCGD_VERT_START) return; y -= KCGD_VERT_START; if (y >= KCGD_DISP_VERT) return; - offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); + uint16_t const offset = BIT(m_video.status, KCGD_STATUS_PAGE) ? (KCGD_PAGE_1 >> 1) : (KCGD_PAGE_0 >> 1); DBG_LOG(2,"scanline_cb", ("frame %d y %.3d page %d offset %04X *offset %04X\n", m_screen->frame_number(), BIT(m_video.status, KCGD_STATUS_PAGE), y, offset + y, m_videoram[offset + y])); - draw_scanline(&m_tmpbmp.pix16(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); + draw_scanline(&m_tmpbmp.pix(y), m_videoram[offset + (KCGD_DISP_VERT-1) - y]); } uint32_t kcgd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp index 37dc73a84e8..4a6bc1afa65 100644 --- a/src/mame/drivers/dvk_ksm.cpp +++ b/src/mame/drivers/dvk_ksm.cpp @@ -365,7 +365,6 @@ uint32_t ksm_state::draw_scanline(uint16_t *p, uint16_t offset, uint8_t scanline TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) { uint16_t y = m_screen->vpos(); - uint16_t offset; LOGDBG("scanline_cb addr %02x frame %d x %.4d y %.3d row %.2d\n", m_video.line, (int)m_screen->frame_number(), m_screen->hpos(), y, y%11); @@ -374,6 +373,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) y -= KSM_VERT_START; if (y >= KSM_DISP_VERT) return; + uint16_t offset; if (y < KSM_STATUSLINE_TOTAL) { offset = KSM_STATUSLINE_VRAM - 0xC000; @@ -383,7 +383,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(ksm_state::scanline_callback) offset = 0x2000 + 0x30 + (((m_video.line + y / 11 - 1) % 48) << 7); } - draw_scanline(&m_tmpbmp.pix16(y), offset, y % 11); + draw_scanline(&m_tmpbmp.pix(y), offset, y % 11); } uint32_t ksm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dwarfd.cpp b/src/mame/drivers/dwarfd.cpp index 246e31d1bb1..4e040d7581b 100644 --- a/src/mame/drivers/dwarfd.cpp +++ b/src/mame/drivers/dwarfd.cpp @@ -619,10 +619,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::pesp_display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } @@ -642,10 +642,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } @@ -665,10 +665,10 @@ I8275_DRAW_CHARACTER_MEMBER(dwarfd_state::qc_display_pixels) { uint8_t pixel = (pixels >> (i * 2)) & 0xf; uint8_t value = (pixel >> 1) | (rvv << 4) | (vsp << 3); - bitmap.pix32(y, x + i) = palette[value]; - bitmap.pix32(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; + bitmap.pix(y, x + i) = palette[value]; + bitmap.pix(y, x + i + 1) = palette[(pixel & 1) ? 0 : value]; if(m_back_color) - bitmap.pix32(y, x + i - 1) = palette[value]; + bitmap.pix(y, x + i - 1) = palette[value]; m_back_color = pixel & 1; } } diff --git a/src/mame/drivers/e100.cpp b/src/mame/drivers/e100.cpp index 6afd7a2ec69..2ac709df04e 100644 --- a/src/mame/drivers/e100.cpp +++ b/src/mame/drivers/e100.cpp @@ -235,7 +235,7 @@ uint32_t e100_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (x = 0; x < 8; x++) { if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + y, col + x) = (*chardata & (1 << x)) ? 1 : 0; } chardata++; } diff --git a/src/mame/drivers/ec65.cpp b/src/mame/drivers/ec65.cpp index c18395857b2..4ce325e34b5 100644 --- a/src/mame/drivers/ec65.cpp +++ b/src/mame/drivers/ec65.cpp @@ -164,19 +164,17 @@ void ec65_state::machine_reset() MC6845_UPDATE_ROW( ec65_common::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,inv; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; + u8 const inv = (x == cursor_x) ? 0xff : 0; + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; + u8 const gfx = m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/embargo.cpp b/src/mame/drivers/embargo.cpp index 9c528330d11..44d903197b8 100644 --- a/src/mame/drivers/embargo.cpp +++ b/src/mame/drivers/embargo.cpp @@ -52,23 +52,19 @@ private: uint32_t embargo_state::screen_update_embargo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - uint8_t y = offs >> 5; + uint8_t const y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data >> 1; - x = x + 1; + data >>= 1; + x++; } } diff --git a/src/mame/drivers/emu68k.cpp b/src/mame/drivers/emu68k.cpp index 2d2dba851cb..f4deb4ebf30 100644 --- a/src/mame/drivers/emu68k.cpp +++ b/src/mame/drivers/emu68k.cpp @@ -54,7 +54,7 @@ void emu68k_state::machine_start() HD44780_PIXEL_UPDATE(emu68k_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/enigma2.cpp b/src/mame/drivers/enigma2.cpp index 7d9b2211cd0..6537fa57d92 100644 --- a/src/mame/drivers/enigma2.cpp +++ b/src/mame/drivers/enigma2.cpp @@ -282,7 +282,7 @@ uint32_t enigma2_state::screen_update_enigma2(screen_device &screen, bitmap_rgb3 /* stars only appear at certain positions */ color = ((x & y & 0x0f) == 0x0f) ? star_color : 0; - bitmap.pix32(bitmap_y, x) = m_palette->pen_color(color); + bitmap.pix(bitmap_y, x) = m_palette->pen_color(color); /* next pixel */ x = x + 1; @@ -344,7 +344,7 @@ uint32_t enigma2_state::screen_update_enigma2a(screen_device &screen, bitmap_rgb } pen = bit ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(bitmap_y, x) = pen; + bitmap.pix(bitmap_y, x) = pen; /* next pixel */ x = x + 1; diff --git a/src/mame/drivers/eolith16.cpp b/src/mame/drivers/eolith16.cpp index de0de146aaa..d3ad8c11532 100644 --- a/src/mame/drivers/eolith16.cpp +++ b/src/mame/drivers/eolith16.cpp @@ -129,7 +129,7 @@ uint32_t eolith16_state::screen_update_eolith16(screen_device &screen, bitmap_in { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[(y * 320) + x] & 0xff; + bitmap.pix(y, x) = m_vram[(y * 320) + x] & 0xff; } } return 0; diff --git a/src/mame/drivers/epic14e.cpp b/src/mame/drivers/epic14e.cpp index a32884f75ee..65647de0e8b 100644 --- a/src/mame/drivers/epic14e.cpp +++ b/src/mame/drivers/epic14e.cpp @@ -61,7 +61,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(epic14e_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index 98eeea10226..f47cbf90200 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -118,7 +118,7 @@ uint32_t esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitma for(int yi=0;yi<8;yi++) for(int xi=0;xi<8;xi++) - bitmap.pix32(yi+chary*8, xi+charx*8) = m_palette->pen(palIndex * 8 + pal_bank * 0x100); + bitmap.pix(yi+chary*8, xi+charx*8) = m_palette->pen(palIndex * 8 + pal_bank * 0x100); continue; } diff --git a/src/mame/drivers/esprit.cpp b/src/mame/drivers/esprit.cpp index 610c0fca646..6969eabe52e 100644 --- a/src/mame/drivers/esprit.cpp +++ b/src/mame/drivers/esprit.cpp @@ -82,8 +82,8 @@ INPUT_PORTS_END MC6845_UPDATE_ROW(esprit_state::crtc_update_row) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/esq1.cpp b/src/mame/drivers/esq1.cpp index b0a9e97a293..c7f4869c33d 100644 --- a/src/mame/drivers/esq1.cpp +++ b/src/mame/drivers/esq1.cpp @@ -210,7 +210,7 @@ protected: virtual void device_start() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: struct filter { @@ -334,13 +334,13 @@ void esq1_filters::recalc_filter(filter &f) void esq1_filters::device_start() { - stream = stream_alloc_legacy(8, 2, 44100); + stream = stream_alloc(8, 2, 44100); memset(filters, 0, sizeof(filters)); for(auto & elem : filters) recalc_filter(elem); } -void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void esq1_filters::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { /* if(0) { for(int i=0; i<8; i++) @@ -352,11 +352,11 @@ void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sampl fprintf(stderr, "\n"); }*/ - for(int i=0; i<samples; i++) { + for(int i=0; i<outputs[0].samples(); i++) { double l=0, r=0; for(int j=0; j<8; j++) { filter &f = filters[j]; - double x = inputs[j][i]; + double x = inputs[j].get(i); double y = (x*f.a[0] + f.x[0]*f.a[1] + f.x[1]*f.a[2] + f.x[2]*f.a[3] + f.x[3]*f.a[4] - f.y[0]*f.b[1] - f.y[1]*f.b[2] - f.y[2]*f.b[3] - f.y[3]*f.b[4]) / f.b[0]; @@ -378,8 +378,8 @@ void esq1_filters::sound_stream_update_legacy(sound_stream &stream, stream_sampl // r *= 6553; l *= 2; r *= 2; - outputs[0][i] = l < -32768 ? -32768 : l > 32767 ? 32767 : int(l); - outputs[1][i] = r < -32768 ? -32768 : r > 32767 ? 32767 : int(r); + outputs[0].put_clamp(i, l, 1.0); + outputs[1].put_clamp(i, r, 1.0); } } diff --git a/src/mame/drivers/eurit.cpp b/src/mame/drivers/eurit.cpp index 24b9ad57b44..1bb12cfc320 100644 --- a/src/mame/drivers/eurit.cpp +++ b/src/mame/drivers/eurit.cpp @@ -53,7 +53,7 @@ void eurit_state::machine_start() HD44780_PIXEL_UPDATE(eurit_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp index 719bb57852c..a62c695a9e5 100644 --- a/src/mame/drivers/eurocom2.cpp +++ b/src/mame/drivers/eurocom2.cpp @@ -302,19 +302,16 @@ uint8_t waveterm_state::waveterm_adc() uint32_t eurocom2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, offset, page; - uint16_t gfx, *p; + int const page = (m_vico[0] & 3) << 14; - page = (m_vico[0] & 3) << 14; - - for (y = 0; y < VC_DISP_VERT; y++) + for (int y = 0; y < VC_DISP_VERT; y++) { - offset = (VC_DISP_HORZ / 8) * ((m_vico[1] + y) % VC_DISP_VERT); - p = &m_tmpbmp.pix16(y); + int const offset = (VC_DISP_HORZ / 8) * ((m_vico[1] + y) % VC_DISP_VERT); + uint16_t *p = &m_tmpbmp.pix(y); - for (x = offset; x < offset + VC_DISP_HORZ / 8; x++) + for (int x = offset; x < offset + VC_DISP_HORZ / 8; x++) { - gfx = m_p_videoram[page + x]; + uint16_t const gfx = m_p_videoram[page + x]; for (int i = 7; i >= 0; i--) { diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp index bf1368c495d..56d2afc5406 100644 --- a/src/mame/drivers/excali64.cpp +++ b/src/mame/drivers/excali64.cpp @@ -530,20 +530,19 @@ void excali64_state::excali64_palette(palette_device &palette) MC6845_UPDATE_ROW( excali64_state::update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,col,bg,fg; - u16 mem,x; - u8 col_base = BIT(m_sys_status, 3) ? 16 : 0; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u8 const col_base = BIT(m_sys_status, 3) ? 16 : 0; + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - col = m_vram[mem+0x800]; - fg = col_base + (col >> 4); - bg = 32 + ((col >> 1) & 7); + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; + u8 const col = m_vram[mem+0x800]; + u8 const fg = col_base + (col >> 4); + u8 const bg = 32 + ((col >> 1) & 7); + u8 gfx; if (BIT(col, 0)) { u8 h = m_vram[mem+0x1000] - 4; diff --git a/src/mame/drivers/expro02.cpp b/src/mame/drivers/expro02.cpp index 6767f6454c7..5a2bc1ed6eb 100644 --- a/src/mame/drivers/expro02.cpp +++ b/src/mame/drivers/expro02.cpp @@ -338,7 +338,7 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1; @@ -363,7 +363,7 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff; diff --git a/src/mame/drivers/f-32.cpp b/src/mame/drivers/f-32.cpp index 7e58b37a5cc..0f07d04cd4a 100644 --- a/src/mame/drivers/f-32.cpp +++ b/src/mame/drivers/f-32.cpp @@ -67,17 +67,15 @@ private: uint32_t mosaicf2_state::screen_update_mosaicf2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x10000; offs++) + for (offs_t offs = 0; offs < 0x10000; offs++) { int y = offs >> 8; int x = offs & 0xff; if ((x < 0xa0) && (y < 0xe0)) { - bitmap.pix16(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff; - bitmap.pix16(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff; + bitmap.pix(y, (x * 2) + 0) = (m_videoram[offs] >> 16) & 0x7fff; + bitmap.pix(y, (x * 2) + 1) = (m_videoram[offs] >> 0) & 0x7fff; } } diff --git a/src/mame/drivers/facit4440.cpp b/src/mame/drivers/facit4440.cpp index 2c066aa243c..84c6d8cc8db 100644 --- a/src/mame/drivers/facit4440.cpp +++ b/src/mame/drivers/facit4440.cpp @@ -148,7 +148,7 @@ WRITE_LINE_MEMBER(facit4440_state::vsync_w) MC6845_UPDATE_ROW(facit4440_state::update_row) { offs_t base = ma / 5 * 6; - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { diff --git a/src/mame/drivers/falco5220.cpp b/src/mame/drivers/falco5220.cpp index b7950bde463..a4a2660e4db 100644 --- a/src/mame/drivers/falco5220.cpp +++ b/src/mame/drivers/falco5220.cpp @@ -96,7 +96,7 @@ u32 falco5220_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, gfx = 0xff; for (int x = 0; x < 8; x++) - bitmap.pix32(col*16 + y, row*8 + x) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(col*16 + y, row*8 + x) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/fanucspmg.cpp b/src/mame/drivers/fanucspmg.cpp index 4d8a2f70aca..c5608e0eb92 100644 --- a/src/mame/drivers/fanucspmg.cpp +++ b/src/mame/drivers/fanucspmg.cpp @@ -846,11 +846,10 @@ void fanucspmg_state::memory_write_byte(offs_t offset, uint8_t data) MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); - int i; - uint8_t *chargen = m_chargen->base(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const chargen = m_chargen->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); @@ -868,14 +867,14 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) if (attr & 0x40) fg |= 0x00ff00; if (attr & 0x80) fg |= 0x0000ff; - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; + *p++ = BIT(data, 0) ? fg : bg; + *p++ = BIT(data, 1) ? fg : bg; + *p++ = BIT(data, 2) ? fg : bg; + *p++ = BIT(data, 3) ? fg : bg; + *p++ = BIT(data, 4) ? fg : bg; + *p++ = BIT(data, 5) ? fg : bg; + *p++ = BIT(data, 6) ? fg : bg; + *p++ = BIT(data, 7) ? fg : bg; } } else @@ -894,11 +893,10 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row ) MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) { - uint32_t *p = &bitmap.pix32(y); - int i; - uint8_t *chargen = m_chargen->base(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const chargen = m_chargen->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ); @@ -912,14 +910,14 @@ MC6845_UPDATE_ROW( fanucspmg_state::crtc_update_row_mono ) uint32_t fg = 0xff00; uint32_t bg = 0; - *p++ = ( data & 0x01 ) ? fg : bg; - *p++ = ( data & 0x02 ) ? fg : bg; - *p++ = ( data & 0x04 ) ? fg : bg; - *p++ = ( data & 0x08 ) ? fg : bg; - *p++ = ( data & 0x10 ) ? fg : bg; - *p++ = ( data & 0x20 ) ? fg : bg; - *p++ = ( data & 0x40 ) ? fg : bg; - *p++ = ( data & 0x80 ) ? fg : bg; + *p++ = BIT(data, 0) ? fg : bg; + *p++ = BIT(data, 1) ? fg : bg; + *p++ = BIT(data, 2) ? fg : bg; + *p++ = BIT(data, 3) ? fg : bg; + *p++ = BIT(data, 4) ? fg : bg; + *p++ = BIT(data, 5) ? fg : bg; + *p++ = BIT(data, 6) ? fg : bg; + *p++ = BIT(data, 7) ? fg : bg; } } else diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp index 35cf5c36c46..e05ba8a9255 100644 --- a/src/mame/drivers/fb01.cpp +++ b/src/mame/drivers/fb01.cpp @@ -148,7 +148,7 @@ HD44780_PIXEL_UPDATE(fb01_state::fb01_pixel_update) { if ( pos < 8 && line < 2 ) { - bitmap.pix16(y, line*6*8 + pos*6 + x) = state; + bitmap.pix(y, line*6*8 + pos*6 + x) = state; } } diff --git a/src/mame/drivers/fk1.cpp b/src/mame/drivers/fk1.cpp index 3e8f728ce02..e0d11652fee 100644 --- a/src/mame/drivers/fk1.cpp +++ b/src/mame/drivers/fk1.cpp @@ -404,17 +404,15 @@ void fk1_state::machine_reset() uint32_t fk1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code; - int y, x, b; - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); - for (x = 0; x < 64; x++) + for (int x = 0; x < 64; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x8000]; - for (b = 0; b < 8; b++) - bitmap.pix16(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; + uint8_t code = ram[x * 0x100 + ((y + m_video_rol) & 0xff) + 0x8000]; + for (int b = 0; b < 8; b++) + bitmap.pix(y, x*8+b) = ((code << b) & 0x80) ? 1 : 0; } } return 0; diff --git a/src/mame/drivers/flipjack.cpp b/src/mame/drivers/flipjack.cpp index 9f84bca2350..e0eb29c1691 100644 --- a/src/mame/drivers/flipjack.cpp +++ b/src/mame/drivers/flipjack.cpp @@ -173,8 +173,8 @@ MC6845_UPDATE_ROW(flipjack_state::update_row) { const bool flip = !BIT(m_layer, 0); const uint16_t row_base = ((ma & 0x03e0) << 3 | (ra & 7) << 5) ^ (flip ? 0x1fff : 0); - uint32_t *const pbegin = &bitmap.pix32(y); - uint32_t *const pend = &bitmap.pix32(y, x_count * 8); + uint32_t *const pbegin = &bitmap.pix(y); + uint32_t *const pend = &bitmap.pix(y, x_count * 8); std::fill(pbegin, pend, rgb_t::black()); diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp index a45064ae13f..ee657e4a41e 100644 --- a/src/mame/drivers/flyball.cpp +++ b/src/mame/drivers/flyball.cpp @@ -175,7 +175,7 @@ uint32_t flyball_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = bally; y < bally + 2; y++) for (int x = ballx; x < ballx + 2; x++) if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; return 0; } diff --git a/src/mame/drivers/fp1100.cpp b/src/mame/drivers/fp1100.cpp index dab8f080191..0c3208d75b1 100644 --- a/src/mame/drivers/fp1100.cpp +++ b/src/mame/drivers/fp1100.cpp @@ -137,7 +137,7 @@ private: MC6845_UPDATE_ROW( fp1100_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); if (BIT(m_upd7801.porta, 4)) { // green screen diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp index bb8d027dc55..6794d2c5122 100644 --- a/src/mame/drivers/fp200.cpp +++ b/src/mame/drivers/fp200.cpp @@ -135,20 +135,16 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix(y,x) = pix; } /* else if(m_lcd.attr[x/8+yoffs*20] == 0x40) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix(y,x) = pix; }*/ } } @@ -166,19 +162,15 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap if(m_lcd.attr[x/8+yoffs*20] == 0x60 || m_lcd.attr[x/8+yoffs*20] == 0x50) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = ((m_chargen[vram*8+(x & 7)]) >> (7-(yoffs & 7))) & 1; + bitmap.pix(y,x) = pix; } /*else if(m_lcd.attr[x/8+yoffs*20] == 0x40) { - uint8_t vram,pix; - - vram = m_lcd.vram[x/8+yoffs*20]; - pix = (vram) >> (7-(yoffs & 7)) & 1; - bitmap.pix16(y,x) = pix; + uint8_t const vram = m_lcd.vram[x/8+yoffs*20]; + uint8_t const pix = (vram) >> (7-(yoffs & 7)) & 1; + bitmap.pix(y,x) = pix; }*/ } } diff --git a/src/mame/drivers/fp6000.cpp b/src/mame/drivers/fp6000.cpp index b4f5ecff25a..51bec4e9682 100644 --- a/src/mame/drivers/fp6000.cpp +++ b/src/mame/drivers/fp6000.cpp @@ -243,15 +243,15 @@ uint16_t fp6000_state::unk_r() MC6845_UPDATE_ROW( fp6000_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); - uint8_t *pcg = reinterpret_cast<uint8_t *>(m_pcg.target()); - uint32_t *vram = reinterpret_cast<uint32_t *>(m_gvram.target()); + pen_t const *const pen = m_palette->pens(); + uint8_t const *const pcg = reinterpret_cast<uint8_t *>(m_pcg.target()); + uint32_t const *const vram = reinterpret_cast<uint32_t *>(m_gvram.target()); for (int x = 0; x < x_count; x++) { // text mode - uint8_t code = (m_vram[ma + x] >> 0) & 0xff; - uint8_t color = (m_vram[ma + x] >> 8) & 0x0f; + uint8_t const code = (m_vram[ma + x] >> 0) & 0xff; + uint8_t const color = (m_vram[ma + x] >> 8) & 0x0f; uint8_t gfx = pcg[(code << 4) | ra]; // cursor? @@ -260,20 +260,20 @@ MC6845_UPDATE_ROW( fp6000_state::crtc_update_row ) // draw 8 pixels of the character for (int i = 0; i < 8; i++) - bitmap.pix32(y, x * 8 + i) = BIT(gfx, 7 - i) ? pen[color] : 0; + bitmap.pix(y, x * 8 + i) = BIT(gfx, 7 - i) ? pen[color] : 0; // graphics - uint32_t data = vram[(ma << 3) + (ra * x_count) + x]; + uint32_t const data = vram[(ma << 3) + (ra * x_count) + x]; // draw 8 gfx pixels - if ((data >> 12) & 0x0f) bitmap.pix32(y, x * 8 + 0) = pen[(data >> 12) & 0x0f]; - if ((data >> 8) & 0x0f) bitmap.pix32(y, x * 8 + 1) = pen[(data >> 8) & 0x0f]; - if ((data >> 4) & 0x0f) bitmap.pix32(y, x * 8 + 2) = pen[(data >> 4) & 0x0f]; - if ((data >> 0) & 0x0f) bitmap.pix32(y, x * 8 + 3) = pen[(data >> 0) & 0x0f]; - if ((data >> 28) & 0x0f) bitmap.pix32(y, x * 8 + 4) = pen[(data >> 28) & 0x0f]; - if ((data >> 24) & 0x0f) bitmap.pix32(y, x * 8 + 5) = pen[(data >> 24) & 0x0f]; - if ((data >> 20) & 0x0f) bitmap.pix32(y, x * 8 + 6) = pen[(data >> 20) & 0x0f]; - if ((data >> 16) & 0x0f) bitmap.pix32(y, x * 8 + 7) = pen[(data >> 16) & 0x0f]; + if ((data >> 12) & 0x0f) bitmap.pix(y, x * 8 + 0) = pen[(data >> 12) & 0x0f]; + if ((data >> 8) & 0x0f) bitmap.pix(y, x * 8 + 1) = pen[(data >> 8) & 0x0f]; + if ((data >> 4) & 0x0f) bitmap.pix(y, x * 8 + 2) = pen[(data >> 4) & 0x0f]; + if ((data >> 0) & 0x0f) bitmap.pix(y, x * 8 + 3) = pen[(data >> 0) & 0x0f]; + if ((data >> 28) & 0x0f) bitmap.pix(y, x * 8 + 4) = pen[(data >> 28) & 0x0f]; + if ((data >> 24) & 0x0f) bitmap.pix(y, x * 8 + 5) = pen[(data >> 24) & 0x0f]; + if ((data >> 20) & 0x0f) bitmap.pix(y, x * 8 + 6) = pen[(data >> 20) & 0x0f]; + if ((data >> 16) & 0x0f) bitmap.pix(y, x * 8 + 7) = pen[(data >> 16) & 0x0f]; } } diff --git a/src/mame/drivers/fs3216.cpp b/src/mame/drivers/fs3216.cpp index 5491a7a518b..ba4522b4601 100644 --- a/src/mame/drivers/fs3216.cpp +++ b/src/mame/drivers/fs3216.cpp @@ -141,7 +141,7 @@ void fs3216_state::machine_reset() MC6845_UPDATE_ROW(fs3216_state::crt_update_row) { - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { diff --git a/src/mame/drivers/galgame.cpp b/src/mame/drivers/galgame.cpp index cbfb4a7c6be..53fa633f66b 100644 --- a/src/mame/drivers/galgame.cpp +++ b/src/mame/drivers/galgame.cpp @@ -187,7 +187,7 @@ uint32_t galaxygame_state::screen_update_galaxygame(screen_device &screen, bitma bitmap.fill(m_palette->black_pen(), cliprect); for (int i = 0; i < m_point_display_list_index; i++ ) { - bitmap.pix16(m_point_display_list[i].x >> 7, m_point_display_list[i].y >> 7) = 1; + bitmap.pix(m_point_display_list[i].x >> 7, m_point_display_list[i].y >> 7) = 1; } return 0; } diff --git a/src/mame/drivers/galpani3.cpp b/src/mame/drivers/galpani3.cpp index 0ffb68cd319..6e56e73c5db 100644 --- a/src/mame/drivers/galpani3.cpp +++ b/src/mame/drivers/galpani3.cpp @@ -190,7 +190,7 @@ void galpani3_state::video_start() uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); bitmap.fill(0, cliprect); @@ -198,137 +198,134 @@ uint32_t galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rg // popmessage("%02x %02x", m_grap2[0]->m_framebuffer_bright2, m_grap2[1]->m_framebuffer_bright2); + for (int drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++) { - int drawy, drawx; - for (drawy=cliprect.min_y;drawy<=cliprect.max_y;drawy++) - { - uint16_t* sprline = &m_sprite_bitmap.pix16(drawy); - uint16_t* srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const sprline = &m_sprite_bitmap.pix(drawy); + uint16_t const *const srcline1 = m_grap2[0]->m_framebuffer.get() + ((drawy+m_grap2[0]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const srcline2 = m_grap2[1]->m_framebuffer.get() + ((drawy+m_grap2[1]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const srcline3 = m_grap2[2]->m_framebuffer.get() + ((drawy+m_grap2[2]->m_framebuffer_scrolly+11)&0x1ff) * 0x200; - uint16_t* priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200; + uint16_t const *const priline = m_priority_buffer + ((drawy+m_priority_buffer_scrolly+11)&0x1ff) * 0x200; - uint32_t* dst = &bitmap.pix32(drawy & 0x3ff); + uint32_t *const dst = &bitmap.pix(drawy & 0x3ff); - for (drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++) - { - int sproffs = drawx & 0x3ff; - int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff; - int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff; - int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff; + for (int drawx=cliprect.min_x;drawx<=cliprect.max_x;drawx++) + { + int sproffs = drawx & 0x3ff; + int srcoffs1 = (drawx+m_grap2[0]->m_framebuffer_scrollx+67)&0x1ff; + int srcoffs2 = (drawx+m_grap2[1]->m_framebuffer_scrollx+67)&0x1ff; + int srcoffs3 = (drawx+m_grap2[2]->m_framebuffer_scrollx+67)&0x1ff; - int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff; + int prioffs = (drawx+m_priority_buffer_scrollx+66)&0x1ff; - uint16_t sprdat = sprline[sproffs]; - uint8_t dat1 = srcline1[srcoffs1]; - uint8_t dat2 = srcline2[srcoffs2]; - uint8_t dat3 = srcline3[srcoffs3]; + uint16_t sprdat = sprline[sproffs]; + uint8_t dat1 = srcline1[srcoffs1]; + uint8_t dat2 = srcline2[srcoffs2]; + uint8_t dat3 = srcline3[srcoffs3]; - uint8_t pridat = priline[prioffs]; + uint8_t pridat = priline[prioffs]; - // TODO : Verify priorities, blendings from real PCB. - if (pridat==0x0f) // relates to the area you've drawn over + // TODO : Verify priorities, blendings from real PCB. + if (pridat==0x0f) // relates to the area you've drawn over + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[2]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat1 && m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat2 && m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(2, dat3); } - else if (pridat==0xcf) // the girl + SPRITE_DRAW_PIXEL(0x4000); + if (dat1 && m_grap2[0]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, 0x100); - } - SPRITE_DRAW_PIXEL(0x4000); - if (m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, 0x100); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(0, dat1); } - else if (pridat==0x30) // during the 'gals boxes' on the intro + SPRITE_DRAW_PIXEL(0x8000); + if (dat2 && m_grap2[1]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[1]->m_framebuffer_enable) // TODO : Opaqued and Swapped order? - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat1 && m_grap2[0]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(1, dat2); } - else + SPRITE_DRAW_PIXEL(0xc000); + } + else if (pridat==0xcf) // the girl + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[0]->m_framebuffer_enable) { - SPRITE_DRAW_PIXEL(0x0000); - if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB? - { - FB_DRAW_PIXEL(0, dat1); - } - SPRITE_DRAW_PIXEL(0x4000); - if (dat2 && m_grap2[1]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(1, dat2); - } - SPRITE_DRAW_PIXEL(0x8000); - if (dat3 && m_grap2[2]->m_framebuffer_enable) - { - FB_DRAW_PIXEL(2, dat3); - } - SPRITE_DRAW_PIXEL(0xc000); + FB_DRAW_PIXEL(0, 0x100); } - - /* - else if (pridat==0x2f) // area outside of the girl + SPRITE_DRAW_PIXEL(0x4000); + if (m_grap2[1]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(1, 0x100); } - - else if (pridat==0x00) // the initial line / box that gets drawn + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) + { + FB_DRAW_PIXEL(2, dat3); + } + SPRITE_DRAW_PIXEL(0xc000); + } + else if (pridat==0x30) // during the 'gals boxes' on the intro + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[1]->m_framebuffer_enable) // TODO : Opaqued and Swapped order? + { + FB_DRAW_PIXEL(1, dat2); + } + SPRITE_DRAW_PIXEL(0x4000); + if (dat1 && m_grap2[0]->m_framebuffer_enable) + { + FB_DRAW_PIXEL(0, dat1); + } + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(2, dat3); } - else if (pridat==0x30) // during the 'gals boxes' on the intro + SPRITE_DRAW_PIXEL(0xc000); + } + else + { + SPRITE_DRAW_PIXEL(0x0000); + if (m_grap2[0]->m_framebuffer_enable) // TODO : Opaque drawing 1st framebuffer in real PCB? { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(0, dat1); } - else if (pridat==0x0c) // 'nice' at end of level + SPRITE_DRAW_PIXEL(0x4000); + if (dat2 && m_grap2[1]->m_framebuffer_enable) { - //dst[drawx] = machine().rand()&0x3fff; + FB_DRAW_PIXEL(1, dat2); } - else + SPRITE_DRAW_PIXEL(0x8000); + if (dat3 && m_grap2[2]->m_framebuffer_enable) { - //printf("%02x, ",pridat); + FB_DRAW_PIXEL(2, dat3); } - */ + SPRITE_DRAW_PIXEL(0xc000); + } + + /* + else if (pridat==0x2f) // area outside of the girl + { + //dst[drawx] = machine().rand()&0x3fff; + } + + else if (pridat==0x00) // the initial line / box that gets drawn + { + //dst[drawx] = machine().rand()&0x3fff; + } + else if (pridat==0x30) // during the 'gals boxes' on the intro + { + //dst[drawx] = machine().rand()&0x3fff; + } + else if (pridat==0x0c) // 'nice' at end of level + { + //dst[drawx] = machine().rand()&0x3fff; + } + else + { + //printf("%02x, ",pridat); } + */ } } return 0; diff --git a/src/mame/drivers/galpanic_ms.cpp b/src/mame/drivers/galpanic_ms.cpp index f94e85e1de7..7401d06caf5 100644 --- a/src/mame/drivers/galpanic_ms.cpp +++ b/src/mame/drivers/galpanic_ms.cpp @@ -272,7 +272,7 @@ uint32_t galspanic_ms_state::screen_update_backgrounds(screen_device &screen, bi count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1; @@ -285,7 +285,7 @@ uint32_t galspanic_ms_state::screen_update_backgrounds(screen_device &screen, bi count = 0; for (int y = 0; y < 256; y++) { - uint16_t *const dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = 0; x < 256; x++) { uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff; diff --git a/src/mame/drivers/gamecstl.cpp b/src/mame/drivers/gamecstl.cpp index 0207bd9dd2b..699c0b9ed55 100644 --- a/src/mame/drivers/gamecstl.cpp +++ b/src/mame/drivers/gamecstl.cpp @@ -137,16 +137,14 @@ void gamecstl_state::video_start() void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint16_t *p = &bitmap.pix16(j); + uint16_t *const p = &bitmap.pix(j); - for (i=x; i < x+8; i++) + for (int i=x; i < x+8; i++) { uint8_t pen = dp[index++]; if (pen) @@ -159,16 +157,15 @@ void gamecstl_state::draw_char(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t gamecstl_state::screen_update_gamecstl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, j; gfx_element *gfx = m_gfxdecode->gfx(0); - uint32_t *cga = m_cga_ram; + uint32_t const *const cga = m_cga_ram; int index = 0; bitmap.fill(0, cliprect); - for (j=0; j < 25; j++) + for (int j=0; j < 25; j++) { - for (i=0; i < 80; i+=2) + for (int i=0; i < 80; i+=2) { int att0 = (cga[index] >> 8) & 0xff; int ch0 = (cga[index] >> 0) & 0xff; diff --git a/src/mame/drivers/gameking.cpp b/src/mame/drivers/gameking.cpp index b381b324244..0e02f8f42a5 100644 --- a/src/mame/drivers/gameking.cpp +++ b/src/mame/drivers/gameking.cpp @@ -153,10 +153,10 @@ uint32_t gameking_state::screen_update_gameking(screen_device &screen, bitmap_in for (int x=0, j=0;j<48/4;x+=4, j++) { uint8_t data=maincpu_ram->read_byte(lssa+j+i*12); - bitmap.pix16(y, x+3)=data&3; - bitmap.pix16(y, x+2)=(data>>2)&3; - bitmap.pix16(y, x+1)=(data>>4)&3; - bitmap.pix16(y, x)=(data>>6)&3; + bitmap.pix(y, x+3)=data&3; + bitmap.pix(y, x+2)=(data>>2)&3; + bitmap.pix(y, x+1)=(data>>4)&3; + bitmap.pix(y, x)=(data>>6)&3; } } return 0; @@ -188,24 +188,24 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r switch (i % 3) { case 0: - bitmap.pix32(y, x + 3) = rgb_t(0, gameking3_intensities[data&3], 0); - bitmap.pix32(y + 1, x + 2) = rgb_t(gameking3_intensities[(data>>2)&3], 0, 0); - bitmap.pix32(y, x + 1) = rgb_t(0, gameking3_intensities[(data>>4)&3], 0); - bitmap.pix32(y + 1, x) = rgb_t(gameking3_intensities[(data>>6)&3], 0, 0); + bitmap.pix(y, x + 3) = rgb_t(0, gameking3_intensities[data&3], 0); + bitmap.pix(y + 1, x + 2) = rgb_t(gameking3_intensities[(data>>2)&3], 0, 0); + bitmap.pix(y, x + 1) = rgb_t(0, gameking3_intensities[(data>>4)&3], 0); + bitmap.pix(y + 1, x) = rgb_t(gameking3_intensities[(data>>6)&3], 0, 0); break; case 1: - bitmap.pix32(y, x + 3) = rgb_t(0, 0, gameking3_intensities[data&3]); - bitmap.pix32(y + 1, x+2) = rgb_t(0, gameking3_intensities[(data>>2)&3], 0); - bitmap.pix32(y, x + 1) = rgb_t(0, 0, gameking3_intensities[(data>>4)&3]); - bitmap.pix32(y + 1, x) = rgb_t(0, gameking3_intensities[(data>>6)&3], 0); + bitmap.pix(y, x + 3) = rgb_t(0, 0, gameking3_intensities[data&3]); + bitmap.pix(y + 1, x+2) = rgb_t(0, gameking3_intensities[(data>>2)&3], 0); + bitmap.pix(y, x + 1) = rgb_t(0, 0, gameking3_intensities[(data>>4)&3]); + bitmap.pix(y + 1, x) = rgb_t(0, gameking3_intensities[(data>>6)&3], 0); break; case 2: - bitmap.pix32(y, x + 3) = rgb_t(gameking3_intensities[data&3], 0, 0); - bitmap.pix32(y + 1, x+2) = rgb_t(0, 0, gameking3_intensities[(data>>2)&3]); - bitmap.pix32(y, x + 1) = rgb_t(gameking3_intensities[(data>>4)&3], 0, 0); - bitmap.pix32(y + 1, x) = rgb_t(0, 0, gameking3_intensities[(data>>6)&3]); + bitmap.pix(y, x + 3) = rgb_t(gameking3_intensities[data&3], 0, 0); + bitmap.pix(y + 1, x+2) = rgb_t(0, 0, gameking3_intensities[(data>>2)&3]); + bitmap.pix(y, x + 1) = rgb_t(gameking3_intensities[(data>>4)&3], 0, 0); + bitmap.pix(y + 1, x) = rgb_t(0, 0, gameking3_intensities[(data>>6)&3]); break; } } @@ -216,12 +216,12 @@ uint32_t gameking_state::screen_update_gameking3(screen_device& screen, bitmap_r { for (int x = y & 1; x < 160; x += 2) { - rgb_t l = rgb_t(x == 0 ? 0 : bitmap.pix32(y, x - 1)); - rgb_t r = rgb_t(x == 159 ? 0 : bitmap.pix32(y, x + 1)); - rgb_t u = rgb_t(y == 0 ? 0 : bitmap.pix32(y - 1, x)); - rgb_t d = rgb_t(y == 159 ? 0 : bitmap.pix32(y + 1, x)); + rgb_t l = rgb_t(x == 0 ? 0 : bitmap.pix(y, x - 1)); + rgb_t r = rgb_t(x == 159 ? 0 : bitmap.pix(y, x + 1)); + rgb_t u = rgb_t(y == 0 ? 0 : bitmap.pix(y - 1, x)); + rgb_t d = rgb_t(y == 159 ? 0 : bitmap.pix(y + 1, x)); - bitmap.pix32(y, x) = rgb_t( + bitmap.pix(y, x) = rgb_t( ((u.r() + d.r()) * 2 + l.r() + r.r()) / 3, ((u.g() + d.g()) * 2 + l.g() + r.g()) / 3, ((u.b() + d.b()) * 2 + l.b() + r.b()) / 3 diff --git a/src/mame/drivers/gei.cpp b/src/mame/drivers/gei.cpp index d7d3dadd732..fa12d4e20cf 100644 --- a/src/mame/drivers/gei.cpp +++ b/src/mame/drivers/gei.cpp @@ -235,7 +235,7 @@ void gei_state::gei_bitmap_w(offs_t offset, uint8_t data) sy = (sy + m_yadd) & 0xff; for (int i = 0; i < 8; i++) - m_bitmap.pix16(sy, sx + i) = m_color[8 - i - 1]; + m_bitmap.pix(sy, sx + i) = m_color[8 - i - 1]; } void gei_state::video_start() diff --git a/src/mame/drivers/generalplus_gpl_unknown.cpp b/src/mame/drivers/generalplus_gpl_unknown.cpp index fffce35facb..405158d73b5 100644 --- a/src/mame/drivers/generalplus_gpl_unknown.cpp +++ b/src/mame/drivers/generalplus_gpl_unknown.cpp @@ -178,7 +178,7 @@ uint32_t gpl162xx_lcdtype_state::screen_update(screen_device &screen, bitmap_rgb int count = 0; for (int y = 0; y < 256; y++) { - uint32_t* dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = 0; x < 320; x++) { diff --git a/src/mame/drivers/geniusiq.cpp b/src/mame/drivers/geniusiq.cpp index 9350d3c4989..b46c3df2457 100644 --- a/src/mame/drivers/geniusiq.cpp +++ b/src/mame/drivers/geniusiq.cpp @@ -275,7 +275,7 @@ uint32_t geniusiq_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for(int b=0; b<4; b++) { - bitmap.pix16(y, x*2 + b) = (data>>12) & 0x0f; + bitmap.pix(y, x*2 + b) = (data>>12) & 0x0f; data <<= 4; } } @@ -292,7 +292,7 @@ uint32_t geniusiq_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // I assume color 0 is transparent if(pen != 0 && screen.visible_area().contains(m_mouse_gfx_posx + x*4 + b, m_mouse_gfx_posy + y)) - bitmap.pix16(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; + bitmap.pix(m_mouse_gfx_posy + y, m_mouse_gfx_posx + x*4 + b) = pen; data <<= 2; } } diff --git a/src/mame/drivers/gigatron.cpp b/src/mame/drivers/gigatron.cpp index 3261208786b..5397a95288a 100644 --- a/src/mame/drivers/gigatron.cpp +++ b/src/mame/drivers/gigatron.cpp @@ -103,7 +103,7 @@ void gigatron_state::video_start() void gigatron_state::video_reset() { - uint32_t *dest = &m_bitmap_render->pix32(0, 0); + uint32_t *dest = &m_bitmap_render->pix(0, 0); for(uint32_t i = 0; i < 640*480; i++) *dest++ = 0; } @@ -138,7 +138,7 @@ void gigatron_state::port_out(uint8_t data) uint8_t r = (out << 6) & 0xC0; uint8_t g = (out << 4) & 0xC0; uint8_t b = (out << 2) & 0xC0; - uint32_t *dest = &m_bitmap_render->pix32(m_row, m_col); + uint32_t *dest = &m_bitmap_render->pix(m_row, m_col); for(uint8_t i = 0; i < 4; i++) *dest++ = b|(g<<8)|(r<<16); } diff --git a/src/mame/drivers/gkigt.cpp b/src/mame/drivers/gkigt.cpp index 4dfd39519ce..4b670245d25 100644 --- a/src/mame/drivers/gkigt.cpp +++ b/src/mame/drivers/gkigt.cpp @@ -162,22 +162,18 @@ void igt_gameking_state::video_start() uint32_t igt_gameking_state::screen_update_igt_gameking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - bitmap.fill(m_palette->black_pen(), cliprect); - for(y = 0; y < 480; y++) + for(int y = 0; y < 480; y++) { - for(x = 0; x < 640; x+=4) + for(int x = 0; x < 640; x+=4) { for(int xi=0;xi<4;xi++) { - uint32_t color; - - color = (m_vram[(x+y*1024)/4] >> (xi*8)) & 0xff; + uint32_t const color = (m_vram[(x+y*1024)/4] >> (xi*8)) & 0xff; if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(color); + bitmap.pix(y, x+xi) = m_palette->pen(color); } } diff --git a/src/mame/drivers/gmaster.cpp b/src/mame/drivers/gmaster.cpp index 76e5f116817..cd798155887 100644 --- a/src/mame/drivers/gmaster.cpp +++ b/src/mame/drivers/gmaster.cpp @@ -280,30 +280,20 @@ void gmaster_state::gmaster_palette(palette_device &palette) const uint32_t gmaster_state::screen_update_gmaster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - for (y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) + for (int y = 0; y < ARRAY_LENGTH(m_video.pixels); y++) { - for (x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) + for (int x = 0; x < ARRAY_LENGTH(m_video.pixels[0]); x++) { - uint8_t d = m_video.pixels[y][x]; - uint16_t *line; - - line = &bitmap.pix16((y * 8), x); - line[0] = BIT(d, 0); - line = &bitmap.pix16((y * 8 + 1), x); - line[0] = BIT(d, 1); - line = &bitmap.pix16((y * 8 + 2), x); - line[0] = BIT(d, 2); - line = &bitmap.pix16((y * 8 + 3), x); - line[0] = BIT(d, 3); - line = &bitmap.pix16((y * 8 + 4), x); - line[0] = BIT(d, 4); - line = &bitmap.pix16((y * 8 + 5), x); - line[0] = BIT(d, 5); - line = &bitmap.pix16((y * 8 + 6), x); - line[0] = BIT(d, 6); - line = &bitmap.pix16((y * 8 + 7), x); - line[0] = BIT(d, 7); + uint8_t const d = m_video.pixels[y][x]; + + bitmap.pix((y * 8 + 0), x) = BIT(d, 0); + bitmap.pix((y * 8 + 1), x) = BIT(d, 1); + bitmap.pix((y * 8 + 2), x) = BIT(d, 2); + bitmap.pix((y * 8 + 3), x) = BIT(d, 3); + bitmap.pix((y * 8 + 4), x) = BIT(d, 4); + bitmap.pix((y * 8 + 5), x) = BIT(d, 5); + bitmap.pix((y * 8 + 6), x) = BIT(d, 6); + bitmap.pix((y * 8 + 7), x) = BIT(d, 7); } } return 0; diff --git a/src/mame/drivers/goldart.cpp b/src/mame/drivers/goldart.cpp index 975211b4e8c..d2b95d88a63 100644 --- a/src/mame/drivers/goldart.cpp +++ b/src/mame/drivers/goldart.cpp @@ -111,9 +111,9 @@ uint32_t goldart_state::screen_update_goldart(screen_device& screen, bitmap_ind1 { for (int x = 0; x < 192; x++) { - uint16_t* dstptr_bitmap = &bitmap.pix16(y); - uint8_t data = m_ram[count]; - uint8_t data2 = m_ram2[count]; + uint16_t *const dstptr_bitmap = &bitmap.pix(y); + uint8_t const data = m_ram[count]; + uint8_t const data2 = m_ram2[count]; count++; diff --git a/src/mame/drivers/goldngam.cpp b/src/mame/drivers/goldngam.cpp index c701d74f91e..27c0b483c20 100644 --- a/src/mame/drivers/goldngam.cpp +++ b/src/mame/drivers/goldngam.cpp @@ -300,8 +300,8 @@ uint32_t goldngam_state::screen_update_goldngam(screen_device &screen, bitmap_in for(int x = 0; x < 384; x += 2) { uint16_t word = m_videoram[index]; - bitmap.pix16(y, x) = word >> 8; - bitmap.pix16(y, x+1) = word & 0xff; + bitmap.pix(y, x) = word >> 8; + bitmap.pix(y, x+1) = word & 0xff; ++index; } } diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp index 38fc94e5cb2..b4bcae82f41 100644 --- a/src/mame/drivers/goupil.cpp +++ b/src/mame/drivers/goupil.cpp @@ -489,7 +489,7 @@ WRITE_LINE_MEMBER( goupil_g1_state::via_video_ca2_w ) MC6845_UPDATE_ROW(goupil_g2_state::crtc_update_row) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (uint8_t x = 0; x < x_count; ++x) { uint16_t const offset = ( 0x400 + ( ma + x ) ) & 0x7FF; diff --git a/src/mame/drivers/gp2x.cpp b/src/mame/drivers/gp2x.cpp index 2ff5addc312..7c2af984b7c 100644 --- a/src/mame/drivers/gp2x.cpp +++ b/src/mame/drivers/gp2x.cpp @@ -159,8 +159,7 @@ uint32_t gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bit // only support RGB still image layer for now if (m_vidregs[0x80/2] & 4) { - int x, y; - uint16_t *vram = (uint16_t *)&m_ram[0x2100000/4]; + uint16_t const *const vram = (uint16_t *)&m_ram[0x2100000/4]; /* printf("RGB still image 1 enabled, bpp %d, size is %d %d %d %d\n", (m_vidregs[(0xda/2)]>>9)&3, @@ -170,13 +169,13 @@ uint32_t gp2x_state::screen_update_gp2x(screen_device &screen, bitmap_rgb32 &bit m_vidregs[(0xe8/2)]);*/ - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < 320; x++) + for (int x = 0; x < 320; x++) { - uint16_t pixel = vram[(320*y)+x]; + uint16_t const pixel = vram[(320*y)+x]; *scanline++ = rgb_t(0xff, (pixel>>11)<<3, ((pixel>>5)&0x3f)<<2, (pixel&0x1f)<<3); } diff --git a/src/mame/drivers/gp32.cpp b/src/mame/drivers/gp32.cpp index 34a80fedcda..189babc7069 100644 --- a/src/mame/drivers/gp32.cpp +++ b/src/mame/drivers/gp32.cpp @@ -143,21 +143,20 @@ uint32_t gp32_state::s3c240x_lcd_dma_read( ) void gp32_state::s3c240x_lcd_render_01( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 32; j++) + for (int j = 0; j < 32; j++) { *scanline++ = m_palette->pen_color((data >> 31) & 0x01); - data = data << 1; + data <<= 1; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 4)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -166,21 +165,20 @@ void gp32_state::s3c240x_lcd_render_01( ) void gp32_state::s3c240x_lcd_render_02( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 16; j++) + for (int j = 0; j < 16; j++) { *scanline++ = m_palette->pen_color((data >> 30) & 0x03); - data = data << 2; + data <<= 2; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 3)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -189,21 +187,20 @@ void gp32_state::s3c240x_lcd_render_02( ) void gp32_state::s3c240x_lcd_render_04( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read( ); - for (j = 0; j < 8; j++) + for (int j = 0; j < 8; j++) { *scanline++ = m_palette->pen_color((data >> 28) & 0x0F); - data = data << 4; + data <<= 4; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 2)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -212,21 +209,20 @@ void gp32_state::s3c240x_lcd_render_04( ) void gp32_state::s3c240x_lcd_render_08( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) { *scanline++ = m_palette->pen_color((data >> 24) & 0xFF); - data = data << 8; + data <<= 8; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 1)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -235,21 +231,20 @@ void gp32_state::s3c240x_lcd_render_08( ) void gp32_state::s3c240x_lcd_render_16( ) { bitmap_rgb32 &bitmap = m_bitmap; - uint32_t *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); - int i, j; - for (i = 0; i < 4; i++) + uint32_t *scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + for (int i = 0; i < 4; i++) { uint32_t data = s3c240x_lcd_dma_read(); - for (j = 0; j < 2; j++) + for (int j = 0; j < 2; j++) { *scanline++ = s3c240x_get_color_5551( (data >> 16) & 0xFFFF); - data = data << 16; + data <<= 16; m_s3c240x_lcd.hpos++; if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 0)) { m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); + scanline = &bitmap.pix(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } diff --git a/src/mame/drivers/gpworld.cpp b/src/mame/drivers/gpworld.cpp index 0e717fe6fea..d9d008b31b7 100644 --- a/src/mame/drivers/gpworld.cpp +++ b/src/mame/drivers/gpworld.cpp @@ -138,7 +138,7 @@ void gpworld_state::draw_pixel(bitmap_rgb32 &bitmap,const rectangle &cliprect,in } if (cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); } void gpworld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/grfd2301.cpp b/src/mame/drivers/grfd2301.cpp index 6767c3d543d..a17b1616455 100644 --- a/src/mame/drivers/grfd2301.cpp +++ b/src/mame/drivers/grfd2301.cpp @@ -82,21 +82,20 @@ void grfd2301_state::machine_reset() uint32_t grfd2301_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_p_videoram[x+ma]; + uint8_t chr = m_p_videoram[x+ma]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp index 63d41b12390..1deb3174053 100644 --- a/src/mame/drivers/gridcomp.cpp +++ b/src/mame/drivers/gridcomp.cpp @@ -246,18 +246,15 @@ uint8_t gridcomp_state::grid_dma_r(offs_t offset) uint32_t gridcomp_state::screen_update_generic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int px) { - int x, y, offset; - uint16_t gfx, *p; - - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - offset = y * (px / 16); + int const offset = y * (px / 16); - for (x = offset; x < offset + px / 16; x++) + for (int x = offset; x < offset + px / 16; x++) { - gfx = m_videoram[x]; + uint16_t const gfx = m_videoram[x]; for (int i = 15; i >= 0; i--) { diff --git a/src/mame/drivers/gstream.cpp b/src/mame/drivers/gstream.cpp index c5d88370663..95f27a7c4d4 100644 --- a/src/mame/drivers/gstream.cpp +++ b/src/mame/drivers/gstream.cpp @@ -587,10 +587,8 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & do { g_profiler.start(PROFILER_DRAWGFX); do { - const uint8_t *srcdata, *srcdata2; int32_t destendx, destendy; int32_t srcx, srcy; - int32_t curx, cury; int32_t dy; assert(dest.valid()); @@ -649,8 +647,8 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & } /* fetch the source data */ - srcdata = gfx->get_data(code); - srcdata2 = gfx2->get_data(code); + const uint8_t *srcdata = gfx->get_data(code); + const uint8_t *srcdata2 = gfx2->get_data(code); /* compute how many blocks of 4 pixels we have */ uint32_t leftovers = (destendx + 1 - destx); @@ -663,16 +661,16 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & if (!flipx) { /* iterate over pixels in Y */ - for (cury = desty; cury <= destendy; cury++) + for (int32_t cury = desty; cury <= destendy; cury++) { - uint32_t *destptr = &dest.pix32(cury, destx); + uint32_t *destptr = &dest.pix(cury, destx); const uint8_t *srcptr = srcdata; const uint8_t *srcptr2 = srcdata2; srcdata += dy; srcdata2 += dy; /* iterate over leftover pixels */ - for (curx = 0; curx < leftovers; curx++) + for (int32_t curx = 0; curx < leftovers; curx++) { uint32_t srcdata = (srcptr[0]); uint32_t srcdata2 = (srcptr2[0]); @@ -692,9 +690,9 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & else { /* iterate over pixels in Y */ - for (cury = desty; cury <= destendy; cury++) + for (int32_t cury = desty; cury <= destendy; cury++) { - uint32_t *destptr = &dest.pix32(cury, destx); + uint32_t *destptr = &dest.pix(cury, destx); const uint8_t *srcptr = srcdata; const uint8_t *srcptr2 = srcdata2; @@ -702,7 +700,7 @@ void gstream_state::drawgfx_transpen_x2222(bitmap_rgb32 &dest, const rectangle & srcdata2 += dy; /* iterate over leftover pixels */ - for (curx = 0; curx < leftovers; curx++) + for (int32_t curx = 0; curx < leftovers; curx++) { uint32_t srcdata = (srcptr[0]); uint32_t srcdata2 = (srcptr2[0]); diff --git a/src/mame/drivers/gsword.cpp b/src/mame/drivers/gsword.cpp index 47398823e39..472c6a80550 100644 --- a/src/mame/drivers/gsword.cpp +++ b/src/mame/drivers/gsword.cpp @@ -153,14 +153,14 @@ So far, the AA-016 and AA-017 MCUs have been dumped successfully. At least two Great Swordsman boards have been seen with a UVEPROM-based D8741A-8 MCU for AA-013 at 9.5A. This suggests the developers made some -last-minute change to the code that only the main CPU. +last-minute change to the code that only affects the main CPU. It appears that during development, the developers worked with three copies of what became the AA-016 MCU. Protection code was added to the I/O MCU program, and this became AA-017. At this point they intended to use two copies of AA-016 for communications, and one AA-017 for I/O. It -turned out that some last-minute change was required for the master CPU, -but it was too late to order new mask ROM MUCs. This resulted in the +turned out that some last-minute change was required for the main CPU, +but it was too late to order new mask ROM MCUs. This resulted in the use of UVEPROM parts for AA-013. There are problems with sound. Many effects aren't playing or are cut @@ -255,9 +255,9 @@ contained within a single page. The initialisation/self test and mode selection, the subroutine for receiving configuration, and an unused subroutine for sending a negated program byte to the host are in page 0. The subroutines that implement coin handling are in page 1. There are -three input handling and protection programs of increasing of increasing -complexity in page 2 and page 3. The host selects the input handling -program to use with the high nybble of the first command. +three input handling and protection programs of increasing complexity in +page 2 and page 3. The host selects the input handling program to use +with the high nybble of the first command. The subroutine for receiving configuration from the host is identical to the one in the AA-016 MCU besides being shifted to a different address. @@ -310,11 +310,11 @@ command: The MCU keeps an internal credit counter ($2D). Each time the MCU receives a polling command, if the credit counter is non-zero it will be decremented and bit 7 of the response will be set; if the credit counter -is zero, but 7 of the response will be clear. +is zero, bit 7 of the response will be clear. After terminating the setup phase, any byte written to the data port will cause the MCU to check the coin inputs, update the credit counter -if necessary, and return the desired data. A byte written to the +if necessary, and return the requested data. A byte written to the control port after the setup phase terminates causes the MCU to read a byte of program memory from page 2 using the received byte as the offset, twos-complement it, return it, and then immediately re-execute diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp index 49bf5252eec..74d251c5d58 100644 --- a/src/mame/drivers/gticlub.cpp +++ b/src/mame/drivers/gticlub.cpp @@ -909,7 +909,7 @@ uint32_t gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb3 for (x=0; x < 512; x++) { uint8_t pixel = rom[index + (y*512) + x]; - bitmap.pix32(y, x) = K001006_palette[tp][(pal * 256) + pixel]; + bitmap.pix(y, x) = K001006_palette[tp][(pal * 256) + pixel]; } } diff --git a/src/mame/drivers/gts3a.cpp b/src/mame/drivers/gts3a.cpp index 2e2aeb056bd..86a613df8b3 100644 --- a/src/mame/drivers/gts3a.cpp +++ b/src/mame/drivers/gts3a.cpp @@ -321,14 +321,13 @@ void gts3a_state::palette_init(palette_device &palette) MC6845_UPDATE_ROW( gts3a_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t gfx=0; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0xfff;mem++; + uint16_t mem = (ma + x) & 0xfff;mem++; gfx = 4;//m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character */ diff --git a/src/mame/drivers/gts80a.cpp b/src/mame/drivers/gts80a.cpp index 6ed611719ac..84aa0c5ca58 100644 --- a/src/mame/drivers/gts80a.cpp +++ b/src/mame/drivers/gts80a.cpp @@ -430,10 +430,10 @@ uint32_t caveman_state::screen_update_caveman(screen_device &screen, bitmap_ind1 { uint8_t pix = m_vram[count]; - bitmap.pix16(y, x+0) = (pix >> 6)&0x3; - bitmap.pix16(y, x+1) = (pix >> 4)&0x3; - bitmap.pix16(y, x+2) = (pix >> 2)&0x3; - bitmap.pix16(y, x+3) = (pix >> 0)&0x3; + bitmap.pix(y, x+0) = (pix >> 6)&0x3; + bitmap.pix(y, x+1) = (pix >> 4)&0x3; + bitmap.pix(y, x+2) = (pix >> 2)&0x3; + bitmap.pix(y, x+3) = (pix >> 0)&0x3; count++; } diff --git a/src/mame/drivers/guab.cpp b/src/mame/drivers/guab.cpp index 193675652cc..d308bfb5e02 100644 --- a/src/mame/drivers/guab.cpp +++ b/src/mame/drivers/guab.cpp @@ -275,12 +275,12 @@ uint32_t guab_state::screen_update_guab(screen_device &screen, bitmap_ind16 &bit for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint8_t *src = &m_tms34061->m_display.vram[256 * y]; - uint16_t *dest = &bitmap.pix16(y); + uint8_t const *const src = &m_tms34061->m_display.vram[256 * y]; + uint16_t *dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - uint8_t pen = src[x >> 1]; + uint8_t const pen = src[x >> 1]; /* Draw two 4-bit pixels */ *dest++ = m_palette->pen(pen >> 4); diff --git a/src/mame/drivers/gunpey.cpp b/src/mame/drivers/gunpey.cpp index 9b79660e2aa..db35f1242dc 100644 --- a/src/mame/drivers/gunpey.cpp +++ b/src/mame/drivers/gunpey.cpp @@ -295,9 +295,6 @@ void gunpey_state::video_start() uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count,uint8_t scene_gradient) { - int x,y; - int bpp_sel; - int color; const int ZOOM_SHIFT = 15; // there doesn't seem to be a specific bit to mark compressed sprites (we currently have a hack to look at the first byte of the data) // do they get decompressed at blit time instead? of are there other registers we need to look at @@ -326,12 +323,12 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in if(!(m_wram[count+0] & 1)) { - x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); - y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); + int x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); + int y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); uint32_t zoomheight = (m_wram[count+5] >> 8); uint32_t zoomwidth = (m_wram[count+5] & 0xff); - bpp_sel = (m_wram[count+0] & 0x18); - color = (m_wram[count+0] >> 8); + int bpp_sel = (m_wram[count+0] & 0x18); + int color = (m_wram[count+0] >> 8); x-=0x160; y-=0x188; @@ -379,8 +376,6 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in int xi2 = xsourceoff>>ZOOM_SHIFT; uint8_t data = m_vram[((((ysource + yi2) & 0x7ff) * 0x800) + ((xsource + (xi2/2)) & 0x7ff))]; uint8_t pix; - uint32_t col_offs; - uint16_t color_data; if (xi2 & 1) { @@ -391,19 +386,17 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in pix = (data & 0x0f); } - col_offs = ((pix + color*0x10) & 0xff) << 1; + uint32_t col_offs = ((pix + color*0x10) & 0xff) << 1; col_offs+= ((pix + color*0x10) >> 8)*0x800; - color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); + uint16_t color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); if(!(color_data & 0x8000)) { if(scene_gradient & 0x40) { - int r,g,b; - - r = (color_data & 0x7c00) >> 10; - g = (color_data & 0x03e0) >> 5; - b = (color_data & 0x001f) >> 0; + int r = (color_data & 0x7c00) >> 10; + int g = (color_data & 0x03e0) >> 5; + int b = (color_data & 0x001f) >> 0; r-= (scene_gradient & 0x1f); g-= (scene_gradient & 0x1f); b-= (scene_gradient & 0x1f); @@ -418,11 +411,11 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in { if (alpha==0x00) // a value of 0x00 is solid { - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } else { - uint16_t basecolor = bitmap.pix16(y+yi, x+xi); + uint16_t basecolor = bitmap.pix(y+yi, x+xi); int base_r = ((basecolor >> 10)&0x1f)*alpha; int base_g = ((basecolor >> 5)&0x1f)*alpha; int base_b = ((basecolor >> 0)&0x1f)*alpha; @@ -433,7 +426,7 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in g = (base_g+g)/0x1f; b = (base_b+b)/0x1f; color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } } } @@ -460,24 +453,19 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in int xi2 = xsourceoff>>ZOOM_SHIFT; uint8_t data = m_vram[((((ysource+yi2)&0x7ff)*0x800) + ((xsource+xi2)&0x7ff))]; - uint8_t pix; - uint32_t col_offs; - uint16_t color_data; - pix = (data & 0xff); - col_offs = ((pix + color*0x100) & 0xff) << 1; + uint8_t pix = (data & 0xff); + uint32_t col_offs = ((pix + color*0x100) & 0xff) << 1; col_offs+= ((pix + color*0x100) >> 8)*0x800; - color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); + uint16_t color_data = (m_vram[col_offs])|(m_vram[col_offs+1]<<8); if(!(color_data & 0x8000)) { if(scene_gradient & 0x40) { - int r,g,b; - - r = (color_data & 0x7c00) >> 10; - g = (color_data & 0x03e0) >> 5; - b = (color_data & 0x001f) >> 0; + int r = (color_data & 0x7c00) >> 10; + int g = (color_data & 0x03e0) >> 5; + int b = (color_data & 0x001f) >> 0; r-= (scene_gradient & 0x1f); g-= (scene_gradient & 0x1f); b-= (scene_gradient & 0x1f); @@ -492,11 +480,11 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in { if (alpha==0x00) // a value of 0x00 is solid { - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } else { - uint16_t basecolor = bitmap.pix16(y+yi, x+xi); + uint16_t basecolor = bitmap.pix(y+yi, x+xi); int base_r = ((basecolor >> 10)&0x1f)*alpha; int base_g = ((basecolor >> 5)&0x1f)*alpha; int base_b = ((basecolor >> 0)&0x1f)*alpha; @@ -507,7 +495,7 @@ uint8_t gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,in g = (base_g+g)/0x1f; b = (base_b+b)/0x1f; color_data = (color_data & 0x8000) | (r << 10) | (g << 5) | (b << 0); - bitmap.pix16(y+yi, x+xi) = color_data & 0x7fff; + bitmap.pix(y+yi, x+xi) = color_data & 0x7fff; } } } diff --git a/src/mame/drivers/h19.cpp b/src/mame/drivers/h19.cpp index 0feafc33d63..fc296c17392 100644 --- a/src/mame/drivers/h19.cpp +++ b/src/mame/drivers/h19.cpp @@ -475,8 +475,9 @@ MC6845_UPDATE_ROW( h19_state::crtc_update_row ) { if (!de) return; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) { @@ -491,7 +492,7 @@ MC6845_UPDATE_ROW( h19_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t const gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp index a4423bd304c..18b653d6908 100644 --- a/src/mame/drivers/halleys.cpp +++ b/src/mame/drivers/halleys.cpp @@ -1310,7 +1310,7 @@ void halleys_state::copy_scroll_op(bitmap_ind16 &bitmap, uint16_t *source, int s // draw top split for (int y=0; y != bch; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); memcpy(dest, src+sx, 2*rcw); memcpy(dest + rcw, src, 2*(CLIP_W - rcw)); src += SCREEN_WIDTH; @@ -1320,7 +1320,7 @@ void halleys_state::copy_scroll_op(bitmap_ind16 &bitmap, uint16_t *source, int s // draw bottom split for (int y = bch; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); memcpy(dest, src+sx, 2*rcw); memcpy(dest + rcw, src, 2*(CLIP_W - rcw)); src += SCREEN_WIDTH; @@ -1345,7 +1345,7 @@ void halleys_state::copy_scroll_xp(bitmap_ind16 &bitmap, uint16_t *source, int s // draw top split for (int y=0; y != bch; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); const uint16_t *src = src_base + sx; for(int x=0; x != rcw; x++) { uint16_t pixel = *src++; @@ -1370,7 +1370,7 @@ void halleys_state::copy_scroll_xp(bitmap_ind16 &bitmap, uint16_t *source, int s // draw bottom split for (int y = bch; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); const uint16_t *src = src_base + sx; for(int x=0; x != rcw; x++) { uint16_t pixel = *src++; @@ -1398,7 +1398,7 @@ void halleys_state::copy_fixed_xp(bitmap_ind16 &bitmap, uint16_t *source) { uint16_t *src = source + CLIP_SKIP; for(int y=0; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); for(int x=0; x != CLIP_W; x++) { uint16_t pixel = src[x]; @@ -1414,7 +1414,7 @@ void halleys_state::copy_fixed_2b(bitmap_ind16 &bitmap, uint16_t *source) { uint16_t *src = source + CLIP_SKIP; for(int y=0; y != CLIP_H; y++) { - uint16_t *dest = &bitmap.pix16(VIS_MINY + y, VIS_MINX); + uint16_t *dest = &bitmap.pix(VIS_MINY + y, VIS_MINX); for(int x=0; x != CLIP_W; x++) { uint16_t pixel = src[x]; @@ -1436,7 +1436,7 @@ void halleys_state::filter_bitmap(bitmap_ind16 &bitmap, int mask) pal_ptr = m_internal_palette.get(); esi = mask | 0xffffff00; - edi = (uint32_t*)&bitmap.pix16(VIS_MINY, VIS_MINX + CLIP_W); + edi = (uint32_t*)&bitmap.pix(VIS_MINY, VIS_MINX + CLIP_W); dst_pitch = bitmap.rowpixels() >> 1; ecx = -(CLIP_W>>1); edx = CLIP_H; diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index 1055ae69d69..ba0ea2f53c3 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -269,11 +269,10 @@ uint32_t hazl1500_state::screen_update_hazl1500(screen_device &screen, bitmap_rg m_last_hpos = 0; m_last_vpos = 0; - uint32_t pixindex = 0; for (int y = 0; y < SCREEN_VTOTAL; y++) { - uint32_t *scanline = &bitmap.pix32(y); - pixindex = y * SCREEN_HTOTAL; + uint32_t *scanline = &bitmap.pix(y); + uint32_t pixindex = y * SCREEN_HTOTAL; for (int x = 0; x < SCREEN_HTOTAL; x++) //*scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 0.5) * 0x010101); *scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 63.0) * 0x010101); diff --git a/src/mame/drivers/hektor.cpp b/src/mame/drivers/hektor.cpp index 939896fcc0e..0342dc91160 100644 --- a/src/mame/drivers/hektor.cpp +++ b/src/mame/drivers/hektor.cpp @@ -215,14 +215,14 @@ MC6845_UPDATE_ROW(hektor3_state::crtc_update_row) uint8_t data = m_ram->pointer()[~offset & 0xffff]; if (x == cursor_x) data ^= 0xff; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; } } diff --git a/src/mame/drivers/hhtiger.cpp b/src/mame/drivers/hhtiger.cpp index e0d486317c3..24256624a91 100644 --- a/src/mame/drivers/hhtiger.cpp +++ b/src/mame/drivers/hhtiger.cpp @@ -184,18 +184,18 @@ GFXDECODE_END UPD7220_DISPLAY_PIXELS_MEMBER(hhtiger_state::display_pixels) { /* 96KB video RAM (32KB green + 32KB red + 32KB blue) */ - uint16_t green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; - uint16_t red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; - uint16_t blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; + uint16_t const green = m_video_ram[(0x00000 + (address & 0x7fff)) >> 1]; + uint16_t const red = m_video_ram[(0x08000 + (address & 0x7fff)) >> 1]; + uint16_t const blue = m_video_ram[(0x10000 + (address & 0x7fff)) >> 1]; for (int xi = 0; xi<16; xi++) { - int r = ((red >> xi) & 1) ? 255 : 0; - int g = ((green >> xi) & 1) ? 255 : 0; - int b = ((blue >> xi) & 1) ? 255 : 0; + int const r = BIT(red, xi) ? 255 : 0; + int const g = BIT(green, xi) ? 255 : 0; + int const b = BIT(blue, xi) ? 255 : 0; if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = rgb_t(r, g, b); + bitmap.pix(y, x + xi) = rgb_t(r, g, b); } } @@ -226,7 +226,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER(hhtiger_state::draw_text) pen = 0; if (!m_screen->visible_area().contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/highvdeo.cpp b/src/mame/drivers/highvdeo.cpp index 6fb110ad7d4..16c02ff3922 100644 --- a/src/mame/drivers/highvdeo.cpp +++ b/src/mame/drivers/highvdeo.cpp @@ -216,24 +216,22 @@ void highvdeo_state::machine_start() uint32_t highvdeo_state::screen_update_tourvisn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.min_y;y<=cliprect.max_y;y++) { - count = ((y * (screen.visible_area().max_x+1)) + cliprect.min_x) >> 1; - for(x=(cliprect.min_x>>1);x<=(cliprect.max_x>>1);x++) + int count = ((y * (screen.visible_area().max_x+1)) + cliprect.min_x) >> 1; + for(int x=(cliprect.min_x>>1);x<=(cliprect.max_x>>1);x++) { uint32_t color; color = ((m_blit_ram[count]) & 0x00ff)>>0; if(cliprect.contains((x*2)+0, y)) - bitmap.pix32(y, (x*2)+0) = m_palette->pen(color); + bitmap.pix(y, (x*2)+0) = m_palette->pen(color); color = ((m_blit_ram[count]) & 0xff00)>>8; if(cliprect.contains((x*2)+1, y)) - bitmap.pix32(y, (x*2)+1) = m_palette->pen(color); + bitmap.pix(y, (x*2)+1) = m_palette->pen(color); count++; } @@ -245,16 +243,14 @@ uint32_t highvdeo_state::screen_update_tourvisn(screen_device &screen, bitmap_rg /*Later HW, RGB565 instead of RAM-based pens (+ ramdac).*/ uint32_t highvdeo_state::screen_update_brasil(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - - const pen_t *rgb = m_palette->pens(); // 16 bit RGB + pen_t const *const rgb = m_palette->pens(); // 16 bit RGB - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.min_y;y<=cliprect.max_y;y++) { - count = (y * 400) + cliprect.min_x; - for(x=cliprect.min_x;x<=cliprect.max_x;x++) + int count = (y * 400) + cliprect.min_x; + for(int x=cliprect.min_x;x<=cliprect.max_x;x++) { - bitmap.pix32(y, x) = rgb[m_blit_ram[count++]]; + bitmap.pix(y, x) = rgb[m_blit_ram[count++]]; } } diff --git a/src/mame/drivers/hitme.cpp b/src/mame/drivers/hitme.cpp index 1c6e59f3742..33b65f0c945 100644 --- a/src/mame/drivers/hitme.cpp +++ b/src/mame/drivers/hitme.cpp @@ -80,26 +80,26 @@ uint32_t hitme_state::screen_update_hitme(screen_device &screen, bitmap_ind16 &b double dot_freq = 15750 * 336; /* the number of pixels is the duration times the frequency */ int width_pixels = width_duration * dot_freq; - int x, y, xx, inv; offs_t offs = 0; /* start by drawing the tilemap */ m_tilemap->draw(screen, bitmap, cliprect, 0, 0); /* now loop over and invert anything */ - for (y = 0; y < 19; y++) + for (int y = 0; y < 19; y++) { int dy = bitmap.rowpixels(); - for (inv = x = 0; x < 40; x++, offs++) + int inv = 0; + for (int x = 0; x < 40; x++, offs++) { /* if the high bit is set, reset the oneshot */ if (m_videoram[y * 40 + x] & 0x80) inv = width_pixels; /* invert pixels until we run out */ - for (xx = 0; xx < 8 && inv; xx++, inv--) + for (int xx = 0; xx < 8 && inv; xx++, inv--) { - uint16_t *dest = &bitmap.pix16(y * 10, x * 8 + xx); + uint16_t *const dest = &bitmap.pix(y * 10, x * 8 + xx); dest[0 * dy] ^= 1; dest[1 * dy] ^= 1; dest[2 * dy] ^= 1; diff --git a/src/mame/drivers/homelab.cpp b/src/mame/drivers/homelab.cpp index d19379c2e8d..4861ab08b83 100644 --- a/src/mame/drivers/homelab.cpp +++ b/src/mame/drivers/homelab.cpp @@ -622,19 +622,18 @@ u32 homelab_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co if (!m_cols) return 1; - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for(y = 0; y < m_rows; y++ ) + for (u8 y = 0; y < m_rows; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + m_cols; x++) + for (u16 x = ma; x < ma + m_cols; x++) { - chr = m_vram[x]; // get char in videoram - gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen + u8 const chr = m_vram[x]; // get char in videoram + u8 const gfx = m_p_chargen[chr | (ra<<8)]; // get dot pattern in chargen /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/homez80.cpp b/src/mame/drivers/homez80.cpp index e84d42b71d6..c6e339af789 100644 --- a/src/mame/drivers/homez80.cpp +++ b/src/mame/drivers/homez80.cpp @@ -233,21 +233,20 @@ void homez80_state::machine_start() u32 homez80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++, 44); + uint16_t *p = &bitmap.pix(sy++, 44); - for (x = ma; x < ma+32; x++) + for (u16 x = ma; x < ma+32; x++) { - chr = m_vram[x]; + u8 const chr = m_vram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr<<3) | ra]; + u8 const gfx = m_p_chargen[ (chr<<3) | ra]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/hotblock.cpp b/src/mame/drivers/hotblock.cpp index 40f73692962..9aa225c38ca 100644 --- a/src/mame/drivers/hotblock.cpp +++ b/src/mame/drivers/hotblock.cpp @@ -159,7 +159,7 @@ uint32_t hotblock_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int count = (y * 320) + cliprect.left(); for(int x = cliprect.left(); x <= cliprect.right(); x++) { - bitmap.pix16(y, x) = m_vram[count++]; + bitmap.pix(y, x) = m_vram[count++]; } } diff --git a/src/mame/drivers/hotstuff.cpp b/src/mame/drivers/hotstuff.cpp index 446c4edbaab..05c1b1ffb77 100644 --- a/src/mame/drivers/hotstuff.cpp +++ b/src/mame/drivers/hotstuff.cpp @@ -40,11 +40,10 @@ void hotstuff_state::video_start() uint32_t hotstuff_state::screen_update_hotstuff(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int yyy,xxx; uint16_t row_palette_data[0x10]; rgb_t row_palette_data_as_rgb32_pen_data[0x10]; - yyy=512;xxx=512*2; + int yyy=512, xxx=512*2; int count = 0; for (int y = 0; y < yyy; y++) @@ -61,13 +60,13 @@ uint32_t hotstuff_state::screen_update_hotstuff(screen_device &screen, bitmap_rg for (int x = 0; x < xxx; ) { - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0xf000)>>12]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0xf000)>>12]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x0f00)>>8]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x0f00)>>8]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x00f0)>>4]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x00f0)>>4]; x++; - bitmap.pix32(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x000f)>>0]; + bitmap.pix(y, x) = row_palette_data_as_rgb32_pen_data[(m_bitmapram[count] &0x000f)>>0]; x++; count++; diff --git a/src/mame/drivers/hp16500.cpp b/src/mame/drivers/hp16500.cpp index f26bfda1e2d..654228a96db 100644 --- a/src/mame/drivers/hp16500.cpp +++ b/src/mame/drivers/hp16500.cpp @@ -143,12 +143,11 @@ WRITE_LINE_MEMBER( hp16500_state::vsync_changed ) MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); - int i, pos; + uint32_t *p = &bitmap.pix(y); - pos = y * 144; + int pos = y * 144; - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { *p++ = m_palette[m_vram[pos+0x00000]]; *p++ = m_palette[m_vram[pos+0x10000]]; @@ -165,12 +164,11 @@ MC6845_UPDATE_ROW( hp16500_state::crtc_update_row ) MC6845_UPDATE_ROW( hp16500_state::crtc_update_row_1650 ) { - uint32_t *p = &bitmap.pix32(y); - int i, pos; + uint32_t *p = &bitmap.pix(y); - pos = y * 148; + int pos = y * 148; - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { *p++ = m_palette[m_vram[pos+0x00000]]; *p++ = m_palette[m_vram[pos+0x10000]]; @@ -400,7 +398,7 @@ uint32_t hp16500_state::screen_update_hp16500(screen_device &screen, bitmap_rgb3 int pos = 0; for (int y = 0; y < 384; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); for (int x = 0; x < 576; x+=4) { diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp index 618377674aa..55c26b3edd3 100644 --- a/src/mame/drivers/hp2640.cpp +++ b/src/mame/drivers/hp2640.cpp @@ -667,8 +667,8 @@ void hp2645_state::video_render_buffer(unsigned video_scanline , unsigned line_i } unsigned on_pen = BIT(attrs , 3) ? 1 : 2; for (unsigned x = 0; x < VIDEO_CHAR_WIDTH * 2; x += 2) { - m_bitmap.pix32(video_scanline , x_left + x) = m_palette->pen(BIT(pixels_e , 0) ? on_pen : 0); - m_bitmap.pix32(video_scanline , x_left + x + 1) = m_palette->pen(BIT(pixels_o , 0) ? on_pen : 0); + m_bitmap.pix(video_scanline , x_left + x) = m_palette->pen(BIT(pixels_e , 0) ? on_pen : 0); + m_bitmap.pix(video_scanline , x_left + x + 1) = m_palette->pen(BIT(pixels_o , 0) ? on_pen : 0); pixels_e >>= 1; pixels_o >>= 1; } diff --git a/src/mame/drivers/hp64k.cpp b/src/mame/drivers/hp64k.cpp index ba1e068e2a0..3d2e2ca4298 100644 --- a/src/mame/drivers/hp64k.cpp +++ b/src/mame/drivers/hp64k.cpp @@ -481,11 +481,9 @@ WRITE_LINE_MEMBER(hp64k_state::hp64k_crtc_vrtc_w) I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t chargen_byte = m_chargen[ linecount | ((unsigned)charcode << 4) ]; - bool lvid , livid; uint16_t pixels_lvid , pixels_livid; - unsigned i; if (vsp) { pixels_lvid = pixels_livid = ~0; @@ -504,19 +502,19 @@ I8275_DRAW_CHARACTER_MEMBER(hp64k_state::crtc_display_pixels) pixels_livid = ~0; } - for (i = 0; i < 9; i++) { - lvid = (pixels_lvid & (1U << (8 - i))) != 0; - livid = (pixels_livid & (1U << (8 - i))) != 0; + for (unsigned i = 0; i < 9; i++) { + bool const lvid = (pixels_lvid & (1U << (8 - i))) != 0; + bool const livid = (pixels_livid & (1U << (8 - i))) != 0; if (!lvid) { // Normal brightness - bitmap.pix32(y , x + i) = palette[ 2 ]; + bitmap.pix(y , x + i) = palette[ 2 ]; } else if (livid) { // Black - bitmap.pix32(y , x + i) = palette[ 0 ]; + bitmap.pix(y , x + i) = palette[ 0 ]; } else { // Half brightness - bitmap.pix32(y , x + i) = palette[ 1 ]; + bitmap.pix(y , x + i) = palette[ 1 ]; } } diff --git a/src/mame/drivers/hp80.cpp b/src/mame/drivers/hp80.cpp index 6fa046d2822..7daea00a448 100644 --- a/src/mame/drivers/hp80.cpp +++ b/src/mame/drivers/hp80.cpp @@ -1107,7 +1107,7 @@ WRITE_LINE_MEMBER(hp85_state::vblank_w) uint8_t pixels = video_mem_r(video_start , GRAPH_MEM_SIZE / 2 - 1); video_start += 2; for (unsigned sub_x = 0; sub_x < 8; sub_x++) { - m_bitmap.pix32(y , x + sub_x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , x + sub_x) = m_palette->pen(BIT(pixels , 7)); pixels <<= 1; } } @@ -1130,7 +1130,7 @@ WRITE_LINE_MEMBER(hp85_state::vblank_w) pixels = 0; } for (unsigned sub_x = 0; sub_x < 8; sub_x++) { - m_bitmap.pix32(row + sub_row , col + sub_x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(row + sub_row , col + sub_x) = m_palette->pen(BIT(pixels , 7)); pixels <<= 1; } } @@ -1840,14 +1840,14 @@ WRITE_LINE_MEMBER(hp86_state::vblank_w) if (++video_ptr >= limit) { video_ptr = 0; } - m_bitmap.pix32(y , x) = m_palette->pen(BIT(pixels , 7)); - m_bitmap.pix32(y , x + 1) = m_palette->pen(BIT(pixels , 6)); - m_bitmap.pix32(y , x + 2) = m_palette->pen(BIT(pixels , 5)); - m_bitmap.pix32(y , x + 3) = m_palette->pen(BIT(pixels , 4)); - m_bitmap.pix32(y , x + 4) = m_palette->pen(BIT(pixels , 3)); - m_bitmap.pix32(y , x + 5) = m_palette->pen(BIT(pixels , 2)); - m_bitmap.pix32(y , x + 6) = m_palette->pen(BIT(pixels , 1)); - m_bitmap.pix32(y , x + 7) = m_palette->pen(BIT(pixels , 0)); + m_bitmap.pix(y , x) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , x + 1) = m_palette->pen(BIT(pixels , 6)); + m_bitmap.pix(y , x + 2) = m_palette->pen(BIT(pixels , 5)); + m_bitmap.pix(y , x + 3) = m_palette->pen(BIT(pixels , 4)); + m_bitmap.pix(y , x + 4) = m_palette->pen(BIT(pixels , 3)); + m_bitmap.pix(y , x + 5) = m_palette->pen(BIT(pixels , 2)); + m_bitmap.pix(y , x + 6) = m_palette->pen(BIT(pixels , 1)); + m_bitmap.pix(y , x + 7) = m_palette->pen(BIT(pixels , 0)); } } } else { @@ -1880,14 +1880,14 @@ WRITE_LINE_MEMBER(hp86_state::vblank_w) pixels = ~pixels; } unsigned y = row * lines_per_row + sub_row; - m_bitmap.pix32(y , col) = m_palette->pen(BIT(pixels , 7)); - m_bitmap.pix32(y , col + 1) = m_palette->pen(BIT(pixels , 6)); - m_bitmap.pix32(y , col + 2) = m_palette->pen(BIT(pixels , 5)); - m_bitmap.pix32(y , col + 3) = m_palette->pen(BIT(pixels , 4)); - m_bitmap.pix32(y , col + 4) = m_palette->pen(BIT(pixels , 3)); - m_bitmap.pix32(y , col + 5) = m_palette->pen(BIT(pixels , 2)); - m_bitmap.pix32(y , col + 6) = m_palette->pen(BIT(pixels , 1)); - m_bitmap.pix32(y , col + 7) = m_palette->pen(BIT(pixels , 0)); + m_bitmap.pix(y , col) = m_palette->pen(BIT(pixels , 7)); + m_bitmap.pix(y , col + 1) = m_palette->pen(BIT(pixels , 6)); + m_bitmap.pix(y , col + 2) = m_palette->pen(BIT(pixels , 5)); + m_bitmap.pix(y , col + 3) = m_palette->pen(BIT(pixels , 4)); + m_bitmap.pix(y , col + 4) = m_palette->pen(BIT(pixels , 3)); + m_bitmap.pix(y , col + 5) = m_palette->pen(BIT(pixels , 2)); + m_bitmap.pix(y , col + 6) = m_palette->pen(BIT(pixels , 1)); + m_bitmap.pix(y , col + 7) = m_palette->pen(BIT(pixels , 0)); } } } diff --git a/src/mame/drivers/hp95lx.cpp b/src/mame/drivers/hp95lx.cpp index dc8b0ec5998..2c8df7ad204 100644 --- a/src/mame/drivers/hp95lx.cpp +++ b/src/mame/drivers/hp95lx.cpp @@ -188,20 +188,16 @@ void hp95lx_state::hp95lx_palette(palette_device &palette) const uint32_t hp95lx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, offset; - uint16_t gfx, *p; - uint8_t chr, attr; - if (m_graphics_mode) { - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - p = &bitmap.pix16(y); - offset = y * (240 / 8); + uint16_t *p = &bitmap.pix(y); + int const offset = y * (240 / 8); - for (x = offset; x < offset + (240 / 8); x++) + for (int x = offset; x < offset + (240 / 8); x++) { - gfx = m_p_videoram[x]; + uint16_t const gfx = m_p_videoram[x]; for (int i = 7; i >= 0; i--) { @@ -215,17 +211,17 @@ uint32_t hp95lx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap bool blink((m_screen->frame_number() % 10) > 4); // screen memory is normal MDA 80x25, but only a scrollable 40x16 window is displayed - for (y = 0; y < 128; y++) + for (int y = 0; y < 128; y++) { - p = &bitmap.pix16(y); - offset = (y / 8) * 160 + m_window_start_addr; + uint16_t *p = &bitmap.pix(y); + int const offset = (y / 8) * 160 + m_window_start_addr; - for (x = offset; x < offset + 80; x += 2) + for (int x = offset; x < offset + 80; x += 2) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x + 1]; + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x + 1]; - gfx = m_p_chargen[(chr)*8 + (y % 8)]; + uint16_t gfx = m_p_chargen[(chr)*8 + (y % 8)]; if ((x >> 1) == m_cursor_addr && blink && (y % 8) >= m_cursor_start_ras) { diff --git a/src/mame/drivers/hp9845.cpp b/src/mame/drivers/hp9845.cpp index 1543d81dfe1..400aeb02133 100644 --- a/src/mame/drivers/hp9845.cpp +++ b/src/mame/drivers/hp9845.cpp @@ -1032,7 +1032,7 @@ void hp9845b_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked) { // Blank scanline for (unsigned i = 0; i < VIDEO_HBSTART; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } else { bool cursor_line = line_in_row == 12; @@ -1065,7 +1065,7 @@ void hp9845b_state::video_render_buff(unsigned video_scanline , unsigned line_in for (unsigned j = 0; j < 9; j++) { bool pixel = (pixels & (1U << j)) != 0; - m_bitmap.pix32(video_scanline , i * 9 + j) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; + m_bitmap.pix(video_scanline , i * 9 + j) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; } } } @@ -1105,7 +1105,7 @@ void hp9845b_state::graphic_video_render(unsigned video_scanline) // Normal pixel pixel = (word & mask) != 0 ? PEN_GRAPHIC : PEN_BLACK; } - m_bitmap.pix32(video_scanline - GVIDEO_VBEND , x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline - GVIDEO_VBEND , x++) = pen[ pixel ]; } } } @@ -1693,15 +1693,15 @@ void hp9845ct_base_state::render_lp_cursor(unsigned video_scanline , unsigned pe const pen_t &pen = m_palette->pen(pen_idx); if (!yc) { if (m_gv_lp_cursor_x < VIDEO_TOT_HPIXELS) { - m_bitmap.pix32(video_scanline , m_gv_lp_cursor_x) = pen; + m_bitmap.pix(video_scanline , m_gv_lp_cursor_x) = pen; } } else if (m_gv_lp_cursor_fs) { for (unsigned x = 0; x < VIDEO_TOT_HPIXELS; x++) { - m_bitmap.pix32(video_scanline , x) = pen; + m_bitmap.pix(video_scanline , x) = pen; } } else { for (unsigned x = std::max(0 , (int)m_gv_lp_cursor_x - 24); x <= (m_gv_lp_cursor_x + 25) && x < VIDEO_TOT_HPIXELS; x++) { - m_bitmap.pix32(video_scanline , x) = pen; + m_bitmap.pix(video_scanline , x) = pen; } } } @@ -2216,15 +2216,15 @@ void hp9845c_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked || !m_alpha_sel) { // Blank scanline for (unsigned i = 0; i < VIDEO_770_ALPHA_L_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } if (!m_graphic_sel) { for (unsigned i = VIDEO_770_ALPHA_L_LIM; i < VIDEO_770_ALPHA_R_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } } for (unsigned i = VIDEO_770_ALPHA_R_LIM; i < VIDEO_TOT_HPIXELS; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ pen_alpha(0) ]; + m_bitmap.pix(video_scanline , i) = pen[ pen_alpha(0) ]; } } else { bool cursor_line = line_in_row == 12; @@ -2272,11 +2272,11 @@ void hp9845c_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_graphic_sel && x >= VIDEO_770_ALPHA_L_LIM && x < VIDEO_770_ALPHA_R_LIM) { // alpha overlays graphics (non-dominating) if (pixel) { - m_bitmap.pix32(video_scanline , x) = pen[ pen_alpha(color) ]; + m_bitmap.pix(video_scanline , x) = pen[ pen_alpha(color) ]; } } else { // Graphics disabled or alpha-only zone - m_bitmap.pix32(video_scanline , x) = pen[ pixel ? pen_alpha(color) : pen_alpha(0) ]; + m_bitmap.pix(video_scanline , x) = pen[ pixel ? pen_alpha(color) : pen_alpha(0) ]; } } } @@ -2347,7 +2347,7 @@ void hp9845c_state::graphic_video_render(unsigned video_scanline) // Normal pixel pixel = pen_graphic(((word0 & mask) ? pen0 : 0) | ((word1 & mask) ? pen1 : 0) | ((word2 & mask) ? pen2 : 0)); } - m_bitmap.pix32(video_scanline , VIDEO_770_ALPHA_L_LIM + x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline , VIDEO_770_ALPHA_L_LIM + x++) = pen[ pixel ]; } } } @@ -2914,15 +2914,15 @@ void hp9845t_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_video_blanked || !m_alpha_sel) { // Blank scanline for (unsigned i = 0; i < VIDEO_780_ALPHA_L_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } if (!m_graphic_sel) { for (unsigned i = VIDEO_780_ALPHA_L_LIM; i < VIDEO_780_ALPHA_R_LIM; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } for (unsigned i = VIDEO_780_ALPHA_R_LIM; i < VIDEO_TOT_HPIXELS; i++) { - m_bitmap.pix32(video_scanline , i) = pen[ PEN_BLACK ]; + m_bitmap.pix(video_scanline , i) = pen[ PEN_BLACK ]; } } else { bool cursor_line = line_in_row == 12; @@ -2974,11 +2974,11 @@ void hp9845t_state::video_render_buff(unsigned video_scanline , unsigned line_in if (m_graphic_sel && x >= VIDEO_780_ALPHA_L_LIM && x < VIDEO_780_ALPHA_R_LIM) { // alpha overlays graphics (non-dominating) if (pixel) { - m_bitmap.pix32(video_scanline , x) = pen[ PEN_ALPHA ]; + m_bitmap.pix(video_scanline , x) = pen[ PEN_ALPHA ]; } } else { // Graphics disabled or alpha-only zone - m_bitmap.pix32(video_scanline , x) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; + m_bitmap.pix(video_scanline , x) = pen[ pixel ? PEN_ALPHA : PEN_BLACK ]; } } } @@ -3042,7 +3042,7 @@ void hp9845t_state::graphic_video_render(unsigned video_scanline) else pixel = word & mask ? PEN_GRAPHIC : PEN_BLACK; } - m_bitmap.pix32(video_scanline , VIDEO_780_ALPHA_L_LIM + x++) = pen[ pixel ]; + m_bitmap.pix(video_scanline , VIDEO_780_ALPHA_L_LIM + x++) = pen[ pixel ]; } } } diff --git a/src/mame/drivers/hp9k.cpp b/src/mame/drivers/hp9k.cpp index 1895babc4d1..ca89fd2a7bd 100644 --- a/src/mame/drivers/hp9k.cpp +++ b/src/mame/drivers/hp9k.cpp @@ -353,14 +353,13 @@ GFXDECODE_END void hp9k_state::putChar(uint8_t thec,int x,int y,bitmap_ind16 &bitmap) { - const uint8_t* pchar=m_gfxdecode->gfx(0)->get_data(thec); + uint8_t const *const pchar=m_gfxdecode->gfx(0)->get_data(thec); for (int py=0;py<HP9816_CHDIMY;py++) { for (int px=0;px<HP9816_CHDIMX;px++) { - uint16_t *dest=&bitmap.pix16((y*(HP9816_CHDIMY))+py,(x*(HP9816_CHDIMX))+px); - *dest=pchar[px+(py*8)]; + bitmap.pix((y*(HP9816_CHDIMY))+py,(x*(HP9816_CHDIMX))+px) = pchar[px+(py*8)]; } } } diff --git a/src/mame/drivers/hprot1.cpp b/src/mame/drivers/hprot1.cpp index 685bf8bc84f..feaff0856f5 100644 --- a/src/mame/drivers/hprot1.cpp +++ b/src/mame/drivers/hprot1.cpp @@ -236,12 +236,12 @@ HD44780_PIXEL_UPDATE(hprot1_state::hprot1_pixel_update) { if ( pos < 16 && line==0 ) { - bitmap.pix16(y, pos*6 + x) = state; + bitmap.pix(y, pos*6 + x) = state; } if ( pos >= 64 && pos < 80 && line==0 ) { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; + bitmap.pix(y+9,(pos-64)*6 + x) = state; } } diff --git a/src/mame/drivers/huebler.cpp b/src/mame/drivers/huebler.cpp index 8b3a6974097..56b5748d3d3 100644 --- a/src/mame/drivers/huebler.cpp +++ b/src/mame/drivers/huebler.cpp @@ -231,26 +231,25 @@ INPUT_PORTS_END uint32_t amu880_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y, sx, x, line; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); - for (y = 0; y < 240; y++) + for (int y = 0; y < 240; y++) { - line = y % 10; + int const line = y % 10; - for (sx = 0; sx < 64; sx++) + for (int sx = 0; sx < 64; sx++) { - uint16_t videoram_addr = ((y / 10) * 64) + sx; - uint8_t videoram_data = m_video_ram[videoram_addr & 0x7ff]; + uint16_t const videoram_addr = ((y / 10) * 64) + sx; + uint8_t const videoram_data = m_video_ram[videoram_addr & 0x7ff]; - uint16_t charrom_addr = ((videoram_data & 0x7f) << 3) | line; + uint16_t const charrom_addr = ((videoram_data & 0x7f) << 3) | line; uint8_t data = m_char_rom->base()[charrom_addr & 0x3ff]; - for (x = 0; x < 6; x++) + for (int x = 0; x < 6; x++) { - int color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); + int const color = ((line > 7) ? 0 : BIT(data, 7)) ^ BIT(videoram_data, 7); - bitmap.pix32(y, (sx * 6) + x) = pen[color]; + bitmap.pix(y, (sx * 6) + x) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/hunter16.cpp b/src/mame/drivers/hunter16.cpp index aadb3dcea92..1824bbc508c 100644 --- a/src/mame/drivers/hunter16.cpp +++ b/src/mame/drivers/hunter16.cpp @@ -169,12 +169,12 @@ void hunter16_state::palette_init_hunter16(palette_device &palette) MC6845_UPDATE_ROW(hunter16_state::crtc_update_row) { - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (int i = 0; i < x_count; i++) { - uint16_t offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); + uint16_t const offset = (((ma + i) << 1) & 0x1fff) | ((ra & 1) << 13); uint8_t data = m_videoram[offset]; for (int bit = 7; bit >= 0; bit--) diff --git a/src/mame/drivers/husky.cpp b/src/mame/drivers/husky.cpp index ba63742e0a2..84084b366cb 100644 --- a/src/mame/drivers/husky.cpp +++ b/src/mame/drivers/husky.cpp @@ -384,13 +384,13 @@ uint32_t husky_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, I'm drawing each character as 6x12 to form an overall screen of 192x48. */ - uint8_t data; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int y = 0; y < 48; y++) { for (int x = 0; x < 32; x++) { + uint8_t data; switch (y % 12) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: @@ -399,24 +399,24 @@ uint32_t husky_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int b = 0; b < 5; b++) { - bitmap.pix32(y, (x * 6) + b) = BIT(data, 0) ? pen[1] : pen[2]; + bitmap.pix(y, (x * 6) + b) = BIT(data, 0) ? pen[1] : pen[2]; data >>= 1; } - bitmap.pix32(y, (x * 6) + 5) = pen[0]; + bitmap.pix(y, (x * 6) + 5) = pen[0]; break; case 8: /* cursor */ for (int b = 0; b < 5; b++) { - bitmap.pix32(y, (x * 6) + b) = (!m_curinh && m_cursor == (y / 12) * 32 + x) ? pen[1] : pen[2]; + bitmap.pix(y, (x * 6) + b) = (!m_curinh && m_cursor == (y / 12) * 32 + x) ? pen[1] : pen[2]; } - bitmap.pix32(y, (x * 6) + 5) = pen[0]; + bitmap.pix(y, (x * 6) + 5) = pen[0]; break; default: /* blank */ for (int b = 0; b < 6; b++) { - bitmap.pix32(y, (x * 6) + b) = pen[0]; + bitmap.pix(y, (x * 6) + b) = pen[0]; } break; } diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp index 0f2ec3a18d1..26ae14be877 100644 --- a/src/mame/drivers/ibm6580.cpp +++ b/src/mame/drivers/ibm6580.cpp @@ -717,23 +717,24 @@ INPUT_PORTS_END uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx,fg,bg,chr,attr; - uint16_t sy=0,ma=25,x,ca; + uint16_t sy=0,ma=25; - fg = 1; bg = 0; + uint8_t fg = 1, bg = 0; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - // graphics mode - if (m_p_videoram[ma] & 0x100) { - for (x = ma; x < ma + 80; x++) + if (m_p_videoram[ma] & 0x100) + { + // graphics mode + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x] >> 8; + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x] >> 8; + uint8_t gfx; switch (ra >> 1) { @@ -764,13 +765,16 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma *p++ = BIT(gfx, i) ? fg : bg; } } - } else { - // text mode - for (x = ma; x < ma + 80; x++) + } + else + { + // text mode + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - attr = m_p_videoram[x] >> 8; - ca = (chr<<4); + uint8_t const chr = m_p_videoram[x]; + uint8_t const attr = m_p_videoram[x] >> 8; + uint16_t ca = (chr<<4); + uint8_t gfx; // font 2 if (attr & 0x02) diff --git a/src/mame/drivers/icatel.cpp b/src/mame/drivers/icatel.cpp index e20cde566cb..151fd97ed80 100644 --- a/src/mame/drivers/icatel.cpp +++ b/src/mame/drivers/icatel.cpp @@ -228,12 +228,12 @@ HD44780_PIXEL_UPDATE(icatel_state::icatel_pixel_update) { if ( pos < 16 && line==0 ) { - bitmap.pix16(y, pos*6 + x) = state; + bitmap.pix(y, pos*6 + x) = state; } if ( pos >= 64 && pos < 80 && line==0 ) { - bitmap.pix16(y+9,(pos-64)*6 + x) = state; + bitmap.pix(y+9,(pos-64)*6 + x) = state; } } diff --git a/src/mame/drivers/if800.cpp b/src/mame/drivers/if800.cpp index 0719bb7f354..26128d2aa91 100644 --- a/src/mame/drivers/if800.cpp +++ b/src/mame/drivers/if800.cpp @@ -43,18 +43,15 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - int xi,gfx; - uint8_t pen; + int gfx = m_video_ram[address >> 1]; - gfx = m_video_ram[address >> 1]; - - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - pen = ((gfx >> xi) & 1) ? 1 : 0; + uint8_t pen = BIT(gfx, xi); - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp index 284abb450fd..f6268c6800e 100644 --- a/src/mame/drivers/igs011.cpp +++ b/src/mame/drivers/igs011.cpp @@ -394,10 +394,10 @@ u32 igs011_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con #ifdef MAME_DEBUG if ((layer_enable != -1) && (pri_addr == 0xff)) - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x) = m_palette->black_pen(); else #endif - bitmap.pix16(y, x) = m_layer[l][scr_addr] | (l << 8); + bitmap.pix(y, x) = m_layer[l][scr_addr] | (l << 8); } } return 0; diff --git a/src/mame/drivers/imolagp.cpp b/src/mame/drivers/imolagp.cpp index 67503390b3b..05b87fba010 100644 --- a/src/mame/drivers/imolagp.cpp +++ b/src/mame/drivers/imolagp.cpp @@ -182,7 +182,7 @@ uint32_t imolagp_state::screen_update_imolagp(screen_device &screen, bitmap_ind1 for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { uint8_t const *const source = &m_videoram[layer][(y & 0xff) * 0x40]; - uint16_t *const dest = &bitmap.pix16(y & 0xff); + uint16_t *const dest = &bitmap.pix(y & 0xff); for (int i = 0; i < 0x40; i++) { uint8_t const data = source[i]; diff --git a/src/mame/drivers/informer_207_100.cpp b/src/mame/drivers/informer_207_100.cpp index eb7e9ab238e..37814336add 100644 --- a/src/mame/drivers/informer_207_100.cpp +++ b/src/mame/drivers/informer_207_100.cpp @@ -108,7 +108,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED( informer_207_100_state::crtc_addr ) MC6845_UPDATE_ROW( informer_207_100_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int x = 0; x < x_count; x++) { @@ -120,14 +120,14 @@ MC6845_UPDATE_ROW( informer_207_100_state::crtc_update_row ) data = 0xff; // draw 8 pixels of the character - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; } } diff --git a/src/mame/drivers/informer_207_376.cpp b/src/mame/drivers/informer_207_376.cpp index 4d084317302..a10483728d3 100644 --- a/src/mame/drivers/informer_207_376.cpp +++ b/src/mame/drivers/informer_207_376.cpp @@ -139,11 +139,11 @@ void informer_207_376_state::crt_brightness_w(uint8_t data) MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int x = 0; x < x_count; x++) { - uint8_t code = m_ram[ma + x]; + uint8_t const code = m_ram[ma + x]; uint8_t data = m_chargen[(code << 4) + ra]; if (x == cursor_x) @@ -154,14 +154,14 @@ MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row ) data = 0xff; // draw 8 pixels of the character - bitmap.pix32(y, x * 8 + 7) = pen[BIT(data, 0)]; - bitmap.pix32(y, x * 8 + 6) = pen[BIT(data, 1)]; - bitmap.pix32(y, x * 8 + 5) = pen[BIT(data, 2)]; - bitmap.pix32(y, x * 8 + 4) = pen[BIT(data, 3)]; - bitmap.pix32(y, x * 8 + 3) = pen[BIT(data, 4)]; - bitmap.pix32(y, x * 8 + 2) = pen[BIT(data, 5)]; - bitmap.pix32(y, x * 8 + 1) = pen[BIT(data, 6)]; - bitmap.pix32(y, x * 8 + 0) = pen[BIT(data, 7)]; + bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)]; + bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)]; + bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)]; + bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)]; + bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)]; + bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)]; + bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)]; + bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)]; } } diff --git a/src/mame/drivers/informer_213.cpp b/src/mame/drivers/informer_213.cpp index f2167563fbe..c031b214484 100644 --- a/src/mame/drivers/informer_213.cpp +++ b/src/mame/drivers/informer_213.cpp @@ -196,12 +196,12 @@ uint32_t informer_213_state::screen_update(screen_device &screen, bitmap_rgb32 & data = 0xff; // 6 pixels of the character - bitmap.pix32(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 2) = BIT(data, 5) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 3) = BIT(data, 4) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 4) = BIT(data, 3) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y * 9 + i, x * 6 + 5) = BIT(data, 2) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 0) = BIT(data, 7) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 1) = BIT(data, 6) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 2) = BIT(data, 5) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 3) = BIT(data, 4) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 4) = BIT(data, 3) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 9 + i, x * 6 + 5) = BIT(data, 2) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/invqix.cpp b/src/mame/drivers/invqix.cpp index d25b321c04c..6a51d9e74c6 100644 --- a/src/mame/drivers/invqix.cpp +++ b/src/mame/drivers/invqix.cpp @@ -174,8 +174,6 @@ void invqix_state::video_start() uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - // this means freeze or blank or something if (m_vctl == 0x100) { @@ -184,45 +182,39 @@ uint32_t invqix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap if (m_vctl == 0x0000) { - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t r,g,b; - int pen_data; - - pen_data = (m_vram[(x+y*256)]); - b = (pen_data & 0x001f); - g = (pen_data & 0x03e0) >> 5; - r = (pen_data & 0x7c00) >> 10; + int pen_data = (m_vram[(x+y*256)]); + uint8_t b = (pen_data & 0x001f); + uint8_t g = (pen_data & 0x03e0) >> 5; + uint8_t r = (pen_data & 0x7c00) >> 10; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } else if (m_vctl == 0x0001) // flip { - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<256;x++) + for(int x=0;x<256;x++) { - uint8_t r,g,b; - int pen_data; - - pen_data = (m_vram[(256-x)+((256-y)*256)]); - b = (pen_data & 0x001f); - g = (pen_data & 0x03e0) >> 5; - r = (pen_data & 0x7c00) >> 10; + int pen_data = (m_vram[(256-x)+((256-y)*256)]); + uint8_t b = (pen_data & 0x001f); + uint8_t g = (pen_data & 0x03e0) >> 5; + uint8_t r = (pen_data & 0x7c00) >> 10; r = (r << 3) | (r & 0x7); g = (g << 3) | (g & 0x7); b = (b << 3) | (b & 0x7); if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/drivers/ipds.cpp b/src/mame/drivers/ipds.cpp index 1e25739e3f9..cd6379ed07e 100644 --- a/src/mame/drivers/ipds.cpp +++ b/src/mame/drivers/ipds.cpp @@ -92,8 +92,7 @@ void ipds_state::machine_reset() I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t *charmap = memregion("chargen")->base(); uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; @@ -106,8 +105,8 @@ I8275_DRAW_CHARACTER_MEMBER( ipds_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + for(int i=0;i<6;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp index e986c5562c2..0a51a6b624e 100644 --- a/src/mame/drivers/irisha.cpp +++ b/src/mame/drivers/irisha.cpp @@ -207,17 +207,15 @@ INPUT_PORTS_END uint32_t irisha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx; - uint16_t y,ma=0,x; - uint16_t *p; + uint16_t ma=0; - for (y = 0; y < 200; y++) + for (uint16_t y = 0; y < 200; y++) { - p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); - for (x = ma; x < ma+40; x++) + for (uint16_t x = ma; x < ma+40; x++) { - gfx = m_p_videoram[x]; + uint8_t const gfx = m_p_videoram[x]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/istrebiteli.cpp b/src/mame/drivers/istrebiteli.cpp index a1ba11ca972..065c5329159 100644 --- a/src/mame/drivers/istrebiteli.cpp +++ b/src/mame/drivers/istrebiteli.cpp @@ -45,7 +45,7 @@ protected: virtual void device_start() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state @@ -81,15 +81,15 @@ istrebiteli_sound_device::istrebiteli_sound_device(const machine_config &mconfig void istrebiteli_sound_device::device_start() { - m_channel = stream_alloc_legacy(0, 1, clock() / 2); + m_channel = stream_alloc(0, 1, clock() / 2); m_rom = machine().root_device().memregion("soundrom")->base(); } -void istrebiteli_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void istrebiteli_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *sample = outputs[0]; + auto &buffer = outputs[0]; - while (samples-- > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { int smpl = 0; if (m_rom_out_en) @@ -100,7 +100,7 @@ void istrebiteli_sound_device::sound_stream_update_legacy(sound_stream &stream, smpl &= machine().rand() & 1; smpl *= (m_prev_data & 0x80) ? 1000 : 4000; // b7 volume ? - *sample++ = smpl; + buffer.put_int(sampindex, smpl, 32768); m_rom_cnt = (m_rom_cnt + m_rom_incr) & 0x1ff; } } diff --git a/src/mame/drivers/itgambl2.cpp b/src/mame/drivers/itgambl2.cpp index 61b39d63c18..26d1107f089 100644 --- a/src/mame/drivers/itgambl2.cpp +++ b/src/mame/drivers/itgambl2.cpp @@ -145,7 +145,7 @@ uint32_t itgambl2_state::screen_update_itgambl2(screen_device &screen, bitmap_rg uint32_t const color = (blit_ram[count] & 0xff) >> 0; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/itgambl3.cpp b/src/mame/drivers/itgambl3.cpp index 894145657f8..ea119054d62 100644 --- a/src/mame/drivers/itgambl3.cpp +++ b/src/mame/drivers/itgambl3.cpp @@ -92,8 +92,7 @@ void itgambl3_state::video_start() /* (dirty) debug code for looking 8bpps blitter-based gfxs */ uint32_t itgambl3_state::screen_update_itgambl3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - const uint8_t *blit_ram = memregion("gfx1")->base(); + uint8_t const *const blit_ram = memregion("gfx1")->base(); if(machine().input().code_pressed(KEYCODE_Z)) m_test_x++; @@ -123,18 +122,16 @@ uint32_t itgambl3_state::screen_update_itgambl3(screen_device &screen, bitmap_rg bitmap.fill(m_palette->black_pen(), cliprect); - count = (m_start_offs); + int count = m_start_offs; - for(y=0;y<m_test_y;y++) + for(int y=0;y<m_test_y;y++) { - for(x=0;x<m_test_x;x++) + for(int x=0;x<m_test_x;x++) { - uint32_t color; - - color = (blit_ram[count] & 0xff)>>0; + uint32_t color = (blit_ram[count] & 0xff)>>0; if(cliprect.contains(x, y)) - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/itt1700.cpp b/src/mame/drivers/itt1700.cpp index ec993830f2d..f9d9cb41f04 100644 --- a/src/mame/drivers/itt1700.cpp +++ b/src/mame/drivers/itt1700.cpp @@ -51,7 +51,7 @@ private: MC6845_UPDATE_ROW(itt1700_state::update_row) { - u32 *px = &bitmap.pix32(y); + u32 *px = &bitmap.pix(y); u16 page = 0x800; for (int i = 0; i < x_count; i++) diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index 789343aa3dc..7888971b5a2 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -193,7 +193,7 @@ uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); - uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); + uint16_t *dst = &m_tmp_bitmap->pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/drivers/jantotsu.cpp b/src/mame/drivers/jantotsu.cpp index 200b8339b36..41912c6a542 100644 --- a/src/mame/drivers/jantotsu.cpp +++ b/src/mame/drivers/jantotsu.cpp @@ -166,28 +166,23 @@ void jantotsu_state::video_start() uint32_t jantotsu_state::screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y, i; - int count = 0; - uint8_t pen_i; - if(!m_display_on) return 0; - for (y = 0; y < 256; y++) + int count = 0; + for (int y = 0; y < 256; y++) { - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - uint8_t color; - - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - color = m_col_bank; + uint8_t color = m_col_bank; - for(pen_i = 0;pen_i<4;pen_i++) + for (uint8_t pen_i = 0;pen_i<4;pen_i++) color |= (((m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << pen_i; if (cliprect.contains(x + i, y)) - bitmap.pix32(y, x + i) = m_palette->pen(color); + bitmap.pix(y, x + i) = m_palette->pen(color); } count++; diff --git a/src/mame/drivers/jchan.cpp b/src/mame/drivers/jchan.cpp index 37a642da4cc..412ef71848c 100644 --- a/src/mame/drivers/jchan.cpp +++ b/src/mame/drivers/jchan.cpp @@ -323,10 +323,10 @@ u32 jchan_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons // TODO : verify sprite-tile priorities from real hardware, Check what 15 bit of palette actually working for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16* src1 = &m_sprite_bitmap[0]->pix16(y); - const u16* src2 = &m_sprite_bitmap[1]->pix16(y); - u8 *tilepri = &tile_primap->pix8(y); - u16* dst = &bitmap.pix16(y); + u16 const *const src1 = &m_sprite_bitmap[0]->pix(y); + u16 const *const src2 = &m_sprite_bitmap[1]->pix(y); + u8 *const tilepri = &tile_primap->pix(y); + u16 *const dst = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/jollyjgr.cpp b/src/mame/drivers/jollyjgr.cpp index 4c2bfccea69..d413146df0f 100644 --- a/src/mame/drivers/jollyjgr.cpp +++ b/src/mame/drivers/jollyjgr.cpp @@ -514,13 +514,13 @@ void jollyjgr_state::draw_bitmap(bitmap_rgb32 &bitmap) if (color) { if (m_flip_x && m_flip_y) - bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color); + bitmap.pix(y, x * 8 + i) = m_bm_palette->pen_color(color); else if (m_flip_x && !m_flip_y) - bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); + bitmap.pix(255 - y, x * 8 + i) = m_bm_palette->pen_color(color); else if (!m_flip_x && m_flip_y) - bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); + bitmap.pix(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); else - bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); + bitmap.pix(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color); } } @@ -602,7 +602,7 @@ uint32_t jollyjgr_state::screen_update_fspider(screen_device &screen, bitmap_rgb if (sy>=cliprect.min_y && sy<=cliprect.max_y) for (int x=sx-4;x<sx;x++) if (x>=cliprect.min_x && x<=cliprect.max_x) - bitmap.pix32(sy, x) = m_bm_palette->pen_color(bc); + bitmap.pix(sy, x) = m_bm_palette->pen_color(bc); } return 0; diff --git a/src/mame/drivers/jongkyo.cpp b/src/mame/drivers/jongkyo.cpp index 1193f11fa83..98f8ed1d3b0 100644 --- a/src/mame/drivers/jongkyo.cpp +++ b/src/mame/drivers/jongkyo.cpp @@ -98,18 +98,10 @@ void jongkyo_state::video_start() uint32_t jongkyo_state::screen_update_jongkyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - - for (y = 0; y < 256; ++y) + for (int y = 0; y < 256; ++y) { - int x; - - for (x = 0; x < 256; x += 4) + for (int x = 0; x < 256; x += 4) { - int b; - int res_x,res_y; - uint8_t data1; - uint8_t data2; uint8_t data3; // data3 = m_videoram2[x/4 + y*64]; // wrong @@ -120,15 +112,14 @@ uint32_t jongkyo_state::screen_update_jongkyo(screen_device &screen, bitmap_ind1 // data3 = 0x00; // we're missing 2 bits.. there must be another piece of video ram somewhere or we can't use all the colours (6bpp).. banked somehow? + uint8_t data1 = m_videoram[0x4000 + x / 4 + y * 64]; + uint8_t data2 = m_videoram[x / 4 + y * 64]; - data1 = m_videoram[0x4000 + x / 4 + y * 64]; - data2 = m_videoram[x / 4 + y * 64]; - - for (b = 0; b < 4; ++b) + for (int b = 0; b < 4; ++b) { - res_x = m_flip_screen ? 255 - (x + b) : (x + b); - res_y = m_flip_screen ? 255 - y : y; - bitmap.pix16(res_y, res_x) = ((data2 & 0x01)) + ((data2 & 0x10) >> 3) + + int const res_x = m_flip_screen ? 255 - (x + b) : (x + b); + int const res_y = m_flip_screen ? 255 - y : y; + bitmap.pix(res_y, res_x) = ((data2 & 0x01)) + ((data2 & 0x10) >> 3) + ((data1 & 0x01) << 2) + ((data1 & 0x10) >> 1) + ((data3 & 0x01) << 4) + ((data3 & 0x10) << 1); data1 >>= 1; diff --git a/src/mame/drivers/jonos.cpp b/src/mame/drivers/jonos.cpp index 2009928dd76..ea499a758d3 100644 --- a/src/mame/drivers/jonos.cpp +++ b/src/mame/drivers/jonos.cpp @@ -124,23 +124,23 @@ void jonos_state::machine_reset() uint32_t jonos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_framecnt++; - u8 y,ra,chr,gfx,inv; - u16 sy=0,x; + u16 sy=0; u16 ma = (m_p_videoram[0x7da] + (m_p_videoram[0x7db] << 8)) & 0x7ff; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); u16 cpos = y << 8; - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - chr = m_p_videoram[x]; - inv = (BIT(chr, 7) ^ ((cpos == m_curs_pos) && BIT(m_framecnt, 5))) ? 0xff : 0; + u8 chr = m_p_videoram[x]; + u8 inv = (BIT(chr, 7) ^ ((cpos == m_curs_pos) && BIT(m_framecnt, 5))) ? 0xff : 0; chr &= 0x7f; + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra ] ^ inv; else diff --git a/src/mame/drivers/joystand.cpp b/src/mame/drivers/joystand.cpp index 049ffbf1421..0fa58107e82 100644 --- a/src/mame/drivers/joystand.cpp +++ b/src/mame/drivers/joystand.cpp @@ -253,7 +253,7 @@ void joystand_state::bg2_w(offs_t offset, uint16_t data, uint16_t mem_mask) void joystand_state::bg15_0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { uint16_t val = COMBINE_DATA(&m_bg15_0_ram[offset]); - m_bg15_bitmap[0].pix32(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + m_bg15_bitmap[0].pix(offset >> 9, offset & 0x1ff) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); } // tile-based @@ -268,7 +268,7 @@ void joystand_state::draw_bg15_tile(address_space &space, int x, int y, uint16_t for (int tx = 0; tx < 16; ++tx) { uint16_t val = space.read_word(srcaddr + ty * 16 * 2 + tx * 2); - m_bg15_bitmap[1].pix32(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); + m_bg15_bitmap[1].pix(y + ty , x + tx) = (val & 0x8000) ? BG15_TRANSPARENT : m_bg15_palette->pen_color(val & 0x7fff); } } } diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp index b203c7d6330..a0f4bad7093 100644 --- a/src/mame/drivers/jpmsys5.cpp +++ b/src/mame/drivers/jpmsys5.cpp @@ -153,8 +153,6 @@ void jpmsys5v_state::ramdac_w(offs_t offset, uint16_t data) uint32_t jpmsys5v_state::screen_update_jpmsys5v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - m_tms34061->get_display_state(); if (m_tms34061->m_display.blanked) @@ -163,14 +161,14 @@ uint32_t jpmsys5v_state::screen_update_jpmsys5v(screen_device &screen, bitmap_rg return 0; } - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint8_t *src = &m_tms34061->m_display.vram[(m_tms34061->m_display.dispstart & 0xffff)*2 + 256 * y]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint8_t const *const src = &m_tms34061->m_display.vram[(m_tms34061->m_display.dispstart & 0xffff)*2 + 256 * y]; + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x +=2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x +=2) { - uint8_t pen = src[(x-cliprect.min_x)>>1]; + uint8_t const pen = src[(x-cliprect.min_x)>>1]; /* Draw two 4-bit pixels */ *dest++ = m_palette->pen((pen >> 4) & 0xf); diff --git a/src/mame/drivers/jr100.cpp b/src/mame/drivers/jr100.cpp index b502a72b4d3..748771028d0 100644 --- a/src/mame/drivers/jr100.cpp +++ b/src/mame/drivers/jr100.cpp @@ -216,20 +216,19 @@ void jr100_state::machine_reset() uint32_t jr100_state::screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool attr; - u8 y,ra,gfx,chr; - u16 x,sy=0,ma=0; + u16 sy=0,ma=0; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); - for (x = ma; x < ma + 32; x++) + uint16_t *p = &bitmap.pix(sy++); + for (u16 x = ma; x < ma + 32; x++) { - chr = m_vram[x]; - attr = BIT(chr, 7); + u8 chr = m_vram[x]; + bool const attr = BIT(chr, 7); chr &= 0x7f; + u8 gfx; // ATTR is inverted for normal char or use PCG in case of CMODE1 if (m_use_pcg && attr && (chr < 32)) gfx = m_pcg[(chr<<3) | ra]; diff --git a/src/mame/drivers/jr200.cpp b/src/mame/drivers/jr200.cpp index 80f08a50e21..eabbbd154b4 100644 --- a/src/mame/drivers/jr200.cpp +++ b/src/mame/drivers/jr200.cpp @@ -166,22 +166,21 @@ void jr200_state::video_start() uint32_t jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,xi,yi,pen; - bitmap.fill(m_border_col, cliprect); - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t tile = m_vram[x + y*32]; uint8_t attr = m_cram[x + y*32]; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - uint8_t *gfx_data; + const uint8_t *gfx_data; + int pen; if(attr & 0x80) //bitmap mode { @@ -209,7 +208,7 @@ uint32_t jr200_state::screen_update_jr200(screen_device &screen, bitmap_ind16 &b pen = (gfx_data[(tile*8)+yi]>>(7-xi) & 1) ? (attr & 0x7) : ((attr & 0x38) >> 3); } - bitmap.pix16(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); + bitmap.pix(y*8+yi+16, x*8+xi+16) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/jtc.cpp b/src/mame/drivers/jtc.cpp index ffd343f3f2c..7c425e7eb46 100644 --- a/src/mame/drivers/jtc.cpp +++ b/src/mame/drivers/jtc.cpp @@ -669,16 +669,14 @@ QUICKLOAD_LOAD_MEMBER(jtc_state::quickload_cb) u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 i, y, sx; - - for (y = 0; y < 64; y++) + for (u8 y = 0; y < 64; y++) { - for (sx = 0; sx < 8; sx++) + for (u8 sx = 0; sx < 8; sx++) { - u8 data = m_video_ram[(y * 8) + sx]; + u8 const data = m_video_ram[(y * 8) + sx]; - for (i = 0; i < 8; i++) - bitmap.pix16(y, (sx * 8) + i) = BIT(data, 7-i); + for (u8 i = 0; i < 8; i++) + bitmap.pix(y, (sx * 8) + i) = BIT(data, 7-i); } } @@ -687,16 +685,14 @@ u32 jtc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const u32 jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 i, y, sx; - - for (y = 0; y < 128; y++) + for (u8 y = 0; y < 128; y++) { - for (sx = 0; sx < 16; sx++) + for (u8 sx = 0; sx < 16; sx++) { - u8 data = m_video_ram[(y * 16) + sx]; + u8 const data = m_video_ram[(y * 16) + sx]; - for (i = 0; i < 8; i++) - bitmap.pix16(y, (sx * 8) + i) = BIT(data, 7-i); + for (u8 i = 0; i < 8; i++) + bitmap.pix(y, (sx * 8) + i) = BIT(data, 7-i); } } @@ -742,7 +738,7 @@ u32 jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co u8 const b = ~m_color_ram_b[ma + x]; for (int i = 0; i < 8; i++) - bitmap.pix16(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3); + bitmap.pix(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3); } ma+=40; } diff --git a/src/mame/drivers/juku.cpp b/src/mame/drivers/juku.cpp index 0ab5ca60f12..98ac5951af0 100644 --- a/src/mame/drivers/juku.cpp +++ b/src/mame/drivers/juku.cpp @@ -303,7 +303,7 @@ uint32_t juku_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (int y = 0; y < 240; y++) for (int x = 0; x < 320; x++) - bitmap.pix32(y, x) = BIT(m_ram[0xd800 + (y * (320 / 8) + x / 8)], 7 - (x % 8)) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = BIT(m_ram[0xd800 + (y * (320 / 8) + x / 8)], 7 - (x % 8)) ? rgb_t::white() : rgb_t::black(); return 0; } diff --git a/src/mame/drivers/jupace.cpp b/src/mame/drivers/jupace.cpp index 9c1d55bf969..455eef6f8c2 100644 --- a/src/mame/drivers/jupace.cpp +++ b/src/mame/drivers/jupace.cpp @@ -584,21 +584,19 @@ TIMER_DEVICE_CALLBACK_MEMBER(ace_state::clear_irq) uint32_t ace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=56,ma=0,x; - - for (y = 0; y < 24; y++) + uint16_t sy=56, ma=0; + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++, 40); + uint16_t *p = &bitmap.pix(sy++, 40); - for (x = ma; x < ma+32; x++) + for (uint16_t x = ma; x < ma+32; x++) { - chr = m_video_ram[x]; + uint8_t const chr = m_video_ram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + uint8_t const gfx = m_char_ram[((chr&0x7f)<<3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/jupiter.cpp b/src/mame/drivers/jupiter.cpp index 9c2692e6ebc..79ca7743019 100644 --- a/src/mame/drivers/jupiter.cpp +++ b/src/mame/drivers/jupiter.cpp @@ -202,21 +202,20 @@ void jupiter3_state::kbd_put(u8 data) uint32_t jupiter3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/k8915.cpp b/src/mame/drivers/k8915.cpp index 8e19debc68e..6f8f4bbd7d7 100644 --- a/src/mame/drivers/k8915.cpp +++ b/src/mame/drivers/k8915.cpp @@ -92,24 +92,23 @@ void k8915_state::machine_start() u32 k8915_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; /* Take care of flashing characters */ if ((chr & 0x80) && (m_framecnt & 0x08)) diff --git a/src/mame/drivers/kdt6.cpp b/src/mame/drivers/kdt6.cpp index abd0ff77dfd..5cb6a5b28cb 100644 --- a/src/mame/drivers/kdt6.cpp +++ b/src/mame/drivers/kdt6.cpp @@ -297,7 +297,7 @@ uint32_t kdt6_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -314,7 +314,7 @@ MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) for (int x = 0; x < 8; x++) { int color = BIT(data, 7 - x); - bitmap.pix32(y, x + i*8) = pen[blink ? 0 : (color ^ inverse)]; + bitmap.pix(y, x + i*8) = pen[blink ? 0 : (color ^ inverse)]; } } else @@ -324,7 +324,7 @@ MC6845_UPDATE_ROW( kdt6_state::crtc_update_row ) // draw 8 pixels of the cell for (int x = 0; x < 8; x++) - bitmap.pix32(y, x + i*8) = pen[BIT(data, 7 - x)]; + bitmap.pix(y, x + i*8) = pen[BIT(data, 7 - x)]; } } } diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp index bb9ed493ac3..a27fafc0d88 100644 --- a/src/mame/drivers/kinst.cpp +++ b/src/mame/drivers/kinst.cpp @@ -317,18 +317,18 @@ void kinst_state::machine_reset() uint32_t kinst_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); /* loop over rows and copy to the destination */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *src = &m_video_base[640/4 * y]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t const *src = &m_video_base[640/4 * y]; + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); /* loop over columns */ for (int x = cliprect.min_x; x < cliprect.max_x; x += 2) { - uint32_t data = *src++; + uint32_t const data = *src++; /* store two pixels */ *dest++ = pen[(data >> 0) & 0x7fff]; diff --git a/src/mame/drivers/konamigs.cpp b/src/mame/drivers/konamigs.cpp index 23c307b78ac..a0afaef7075 100644 --- a/src/mame/drivers/konamigs.cpp +++ b/src/mame/drivers/konamigs.cpp @@ -746,7 +746,7 @@ u32 gsan_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const if (!m_bg16bit) col = get_color(col); } - bitmap.pix32(y, x) = pal565(col, 11, 5, 0); + bitmap.pix(y, x) = pal565(col, 11, 5, 0); } } else diff --git a/src/mame/drivers/konamigv.cpp b/src/mame/drivers/konamigv.cpp index 650631c4fd8..36764c0063b 100644 --- a/src/mame/drivers/konamigv.cpp +++ b/src/mame/drivers/konamigv.cpp @@ -391,13 +391,13 @@ void konamigv_state::konamigv(machine_config &config) static INPUT_PORTS_START( konamigv ) PORT_START("P1") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_START1 ) @@ -677,19 +677,42 @@ INPUT_PORTS_END static INPUT_PORTS_START( weddingr ) PORT_INCLUDE( konamigv ) + // Control Type must match selection in service mode (no sense line to detect control panel type) + // Buttons 2 and 3 are shown in service mode, but not used by the game + // Button 1-3 inputs are read in service mode even when 4 Buttons is selected, but they could confuse users + + PORT_START("CFG") + PORT_CONFNAME( 0x01, 0x01, "Control Type" ) + PORT_CONFSETTING( 0x01, "4 Buttons" ) + PORT_CONFSETTING( 0x00, "Joystick and Button" ) + PORT_MODIFY("P1") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("Answer 3/Zoom In") - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("Answer 4/Zoom Out") - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Answer 1/Pan Left") - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Answer 2/Pan Right") - PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 3/Zoom In") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 4/Zoom Out") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 1/Pan Left") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Answer 2/Pan Right") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) PORT_MODIFY("P2") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("Answer 3/Zoom In") - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("Answer 4/Zoom Out") - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("Answer 1/Pan Left") - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("Answer 2/Pan Right") - PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 3/Zoom In") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 4/Zoom Out") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 1/Pan Left") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Answer 2/Pan Right") PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000070, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("CFG", 0x01, EQUALS, 0x01) + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) + PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_CONDITION("CFG", 0x01, EQUALS, 0x00) PORT_MODIFY("P3_P4") PORT_BIT( 0x0000ffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp index ba1be6d096b..862d6693ad3 100644 --- a/src/mame/drivers/konmedal68k.cpp +++ b/src/mame/drivers/konmedal68k.cpp @@ -152,8 +152,8 @@ void konmedal68k_state::fill_backcolor(bitmap_ind16 &bitmap, const rectangle &cl } else { - uint16_t *dst_ptr = &bitmap.pix16(cliprect.min_y); - int dst_pitch = bitmap.rowpixels(); + uint16_t *dst_ptr = &bitmap.pix(cliprect.min_y); + int const dst_pitch = bitmap.rowpixels(); if ((mode & 0x01) == 0) // vertical gradient fill { @@ -173,7 +173,7 @@ void konmedal68k_state::fill_backcolor(bitmap_ind16 &bitmap, const rectangle &cl { pen_idx += cliprect.min_x; dst_ptr += cliprect.min_x; - for(int y = cliprect.min_y; y<= cliprect.max_y; y++) + for (int y = cliprect.min_y; y<= cliprect.max_y; y++) { for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/kontest.cpp b/src/mame/drivers/kontest.cpp index 921ced6509f..c63d32404f4 100644 --- a/src/mame/drivers/kontest.cpp +++ b/src/mame/drivers/kontest.cpp @@ -106,29 +106,20 @@ void kontest_state::video_start() uint32_t kontest_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { - int x,y; - int xi,yi; - uint16_t tile; - uint8_t attr; - - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - for(x=0;x<64;x++) + for(int x=0;x<64;x++) { - tile = m_ram[(x+y*64)|0x800]; - attr = m_ram[(x+((y >> 1)*64))|0x000] & 7; - tile *= 0x10; - tile += 0x1000; + uint16_t const tile = (m_ram[(x+y*64)|0x800] * 0x10) + 0x1000; + uint8_t const attr = m_ram[(x+((y >> 1)*64))|0x000] & 7; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { uint8_t color,pen[2]; - uint8_t x_step; - int res_x,res_y; - x_step = xi >> 2; + uint8_t const x_step = xi >> 2; pen[0] = m_ram[(x_step+yi*2)|(tile)]; pen[0] >>= 3-((xi & 3)); @@ -140,11 +131,11 @@ uint32_t kontest_state::screen_update( screen_device &screen, bitmap_rgb32 &bitm color = pen[0]; color|= pen[1]<<1; - res_x = x*8+xi-256; - res_y = y*8+yi; + int const res_x = x*8+xi-256; + int const res_y = y*8+yi; if (cliprect.contains(res_x, res_y)) - bitmap.pix32(res_y, res_x) = m_palette->pen(color|attr*4); + bitmap.pix(res_y, res_x) = m_palette->pen(color|attr*4); } } } diff --git a/src/mame/drivers/korgds8.cpp b/src/mame/drivers/korgds8.cpp index f6d80b7b8d2..18fedea0b89 100644 --- a/src/mame/drivers/korgds8.cpp +++ b/src/mame/drivers/korgds8.cpp @@ -72,13 +72,13 @@ void korg_ds8_state::machine_start() HD44780_PIXEL_UPDATE(korg_ds8_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 40) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } HD44780_PIXEL_UPDATE(korg_ds8_state::korg707_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } u8 korg_ds8_state::kbd_sw_r() diff --git a/src/mame/drivers/korgdss1.cpp b/src/mame/drivers/korgdss1.cpp index eb6da9b2efe..69b13016ebd 100644 --- a/src/mame/drivers/korgdss1.cpp +++ b/src/mame/drivers/korgdss1.cpp @@ -141,7 +141,7 @@ void korg_dss1_state::machine_reset() HD44780_PIXEL_UPDATE(korg_dss1_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 20) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } diff --git a/src/mame/drivers/korgm1.cpp b/src/mame/drivers/korgm1.cpp index c7fdc20825b..62e8d1dc1c0 100644 --- a/src/mame/drivers/korgm1.cpp +++ b/src/mame/drivers/korgm1.cpp @@ -66,7 +66,7 @@ void korgm1_state::video_start() HD44780_PIXEL_UPDATE(korgm1_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 40) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void korgm1_state::pio_pa_w(u8 data) diff --git a/src/mame/drivers/krokha.cpp b/src/mame/drivers/krokha.cpp index 10140b2755c..399f29c69a3 100644 --- a/src/mame/drivers/krokha.cpp +++ b/src/mame/drivers/krokha.cpp @@ -116,22 +116,19 @@ void krokha_state::machine_reset() uint32_t krokha_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx; - uint16_t chr, ma = 0, x = 0; - - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - ma = 0xe0 + y; - for (ra = 0; ra < 8; ra++) + uint16_t ma = 0xe0 + y; + for (uint8_t ra = 0; ra < 8; ra++) { - for (x = ma; x < ma + 64*32; x += 32) + for (uint16_t x = ma; x < ma + 64*32; x += 32) { - chr = m_p_videoram[x] << 3; - gfx = m_p_chargen[chr | ra]; + uint16_t chr = m_p_videoram[x] << 3; + uint8_t gfx = m_p_chargen[chr | ra]; for (int i = 0; i < 8; i++) { - bitmap.pix16(y * 8 + ra, (x - ma) / 4 + i) = BIT(gfx, 7 - i); + bitmap.pix(y * 8 + ra, (x - ma) / 4 + i) = BIT(gfx, 7 - i); } } } diff --git a/src/mame/drivers/kron.cpp b/src/mame/drivers/kron.cpp index 34f2804fdf7..bb9cd9dc0d3 100644 --- a/src/mame/drivers/kron.cpp +++ b/src/mame/drivers/kron.cpp @@ -224,30 +224,26 @@ INPUT_PORTS_END /* Video TODO: find and understand the char table within main rom */ uint32_t kron180_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int vramad; - uint8_t *chardata; - uint8_t charcode; - LOGSCREEN("%s()\n", FUNCNAME); - vramad = 0; + int vramad = 0; for (int row = 0; row < 25 * 8; row += 8) { + uint8_t charcode; for (int col = 0; col < 80 * 8; col += 8) { /* look up the character data */ charcode = m_vram[vramad]; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %c at X=%d Y=%d: ", charcode, col, row); - chardata = &m_chargen[(charcode * 8) + 8]; + uint8_t const *chardata = &m_chargen[(charcode * 8) + 8]; /* plot the character */ - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { chardata--; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %02x: ", *chardata); - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); - bitmap.pix16(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; + bitmap.pix(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; } } vramad += 2; diff --git a/src/mame/drivers/laser3k.cpp b/src/mame/drivers/laser3k.cpp index 3e514ee9e0f..f17caa47a11 100644 --- a/src/mame/drivers/laser3k.cpp +++ b/src/mame/drivers/laser3k.cpp @@ -496,32 +496,28 @@ uint8_t laser3k_state::io2_r(offs_t offset) void laser3k_state::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen) { - int x, y, i; int fg = m_fg_color; int bg = m_bg_color; - const uint8_t *chardata; - uint16_t color; /* look up the character data */ - chardata = &textgfx_data[(code * 8) % textgfx_datalen]; + uint8_t const *const chardata = &textgfx_data[(code * 8) % textgfx_datalen]; if (m_flash && (code >= 0x40) && (code <= 0x7f)) { /* we're flashing; swap */ - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -578,15 +574,6 @@ void laser3k_state::text_update(screen_device &screen, bitmap_ind16 &bitmap, con void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42] ; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -595,31 +582,32 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x4000 : 0x2000); + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -629,14 +617,6 @@ void laser3k_state::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, cons void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[82]; - uint16_t v; - uint16_t *p; - uint32_t w; - /* sanity checks */ if (beginrow < cliprect.min_y) beginrow = cliprect.min_y; @@ -645,16 +625,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con if (endrow < beginrow) return; - vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t const *const vram = m_ram->pointer() + (m_disp_page ? 0x8000 : 0x4000); + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); if (col < 40) { vram_row[1+(col*2)+0] = vram[offset]; @@ -667,17 +648,17 @@ void laser3k_state::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, con } } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + uint16_t v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; } } diff --git a/src/mame/drivers/laserbas.cpp b/src/mame/drivers/laserbas.cpp index 10a009326dd..8412283fcac 100644 --- a/src/mame/drivers/laserbas.cpp +++ b/src/mame/drivers/laserbas.cpp @@ -150,8 +150,8 @@ MC6845_UPDATE_ROW( laserbas_state::crtc_update_row ) } int pixaddr = y << 8; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *b = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *const b = &bitmap.pix(y); while (x != x_max) { diff --git a/src/mame/drivers/lastfght.cpp b/src/mame/drivers/lastfght.cpp index 81b4a5a40e3..fd7749a3502 100644 --- a/src/mame/drivers/lastfght.cpp +++ b/src/mame/drivers/lastfght.cpp @@ -165,9 +165,7 @@ uint32_t lastfght_state::screen_update(screen_device &screen, bitmap_ind16 &bitm #ifdef MAME_DEBUG #if 1 // gfx roms viewer (toggle with enter, use pgup/down to browse) - int x, y, count = 0; - uint8_t *gfxdata = memregion("gfx1")->base(); - uint8_t data; + uint8_t const *const gfxdata = memregion("gfx1")->base(); if (machine().input().code_pressed_once(KEYCODE_ENTER)) m_view_roms ^= 1; if (m_view_roms) @@ -176,15 +174,15 @@ uint32_t lastfght_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (machine().input().code_pressed_once(KEYCODE_PGUP)) m_base -= 512 * 256; m_base %= memregion("gfx1")->bytes(); - count = m_base; + int count = m_base; bitmap.fill(m_palette->black_pen(), cliprect ); - for (y = 0 ; y < 256; y++) + for (int y = 0 ; y < 256; y++) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { - data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? m_palette->white_pen() : gfxdata[count]; // white grid or data - bitmap.pix16(y, x) = data; + uint8_t data = (((count & 0xf) == 0) && ((count & 0x1e00) == 0)) ? m_palette->white_pen() : gfxdata[count]; // white grid or data + bitmap.pix(y, x) = data; count++; } } @@ -317,7 +315,6 @@ void lastfght_state::blit_w(offs_t offset, uint16_t data, uint16_t mem_mask) { if (ACCESSING_BITS_8_15) { - int x, y, addr; uint8_t *gfxdata = memregion( "gfx1" )->base(); bitmap_ind16 &dest = m_bitmap[m_dest]; @@ -330,18 +327,18 @@ void lastfght_state::blit_w(offs_t offset, uint16_t data, uint16_t mem_mask) data >> 8); #endif - for (y = 0; y <= m_h; y++) + for (int y = 0; y <= m_h; y++) { - for (x = 0; x <= m_w; x++) + for (int x = 0; x <= m_w; x++) { - addr = (((m_sx + m_sx1 + m_dsx * x) >> 6) & 0x1ff) + + int addr = (((m_sx + m_sx1 + m_dsx * x) >> 6) & 0x1ff) + (((m_sy + m_sy1 + m_dsy * y) >> 6) & 0xff) * 0x200 + m_sp * 0x200 * 0x100 + m_sr * 0x200000; data = gfxdata[addr]; if (data && (m_x + x >= 0) && (m_x + x < 512) && (m_y + y >= 0) && (m_y + y < 256)) - dest.pix16(m_y + y, m_x + x) = data; + dest.pix(m_y + y, m_x + x) = data; } } } diff --git a/src/mame/drivers/lbeach.cpp b/src/mame/drivers/lbeach.cpp index a2f77a19d7b..94c44d0f39b 100644 --- a/src/mame/drivers/lbeach.cpp +++ b/src/mame/drivers/lbeach.cpp @@ -189,8 +189,8 @@ u32 lbeach_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con { for (int x = sprite_x; x < (sprite_x + 16) && cliprect.contains(x, y); x++) { - m_collision_bg_car |= (bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1); - m_collision_fg_car |= (fg_bitmap.pix16(y, x) & m_colmap_car.pix16(y, x) & 1); + m_collision_bg_car |= (bitmap.pix(y, x) & m_colmap_car.pix(y, x) & 1); + m_collision_fg_car |= (fg_bitmap.pix(y, x) & m_colmap_car.pix(y, x) & 1); } } diff --git a/src/mame/drivers/lft_craft.cpp b/src/mame/drivers/lft_craft.cpp index 3069c2172f2..6f6ce148570 100644 --- a/src/mame/drivers/lft_craft.cpp +++ b/src/mame/drivers/lft_craft.cpp @@ -174,7 +174,7 @@ uint32_t lft_craft_state::screen_update(screen_device &screen, bitmap_rgb32 &bit const pen_t *pens = m_palette->pens(); for(int y = 0; y < LINES_PER_FRAME; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); uint8_t *src = &m_pixels[y * LINE_CYCLES]; for(int x = 0; x < LINE_CYCLES; x++) { diff --git a/src/mame/drivers/lft_phasor.cpp b/src/mame/drivers/lft_phasor.cpp index 11335ca939b..2f18af496e3 100644 --- a/src/mame/drivers/lft_phasor.cpp +++ b/src/mame/drivers/lft_phasor.cpp @@ -186,7 +186,7 @@ uint32_t lft_phasor_state::screen_update(screen_device &screen, bitmap_rgb32 &bi const pen_t *pens = m_palette->pens(); for(int y = 0; y < 313; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); uint8_t *src = &m_samples[y * 1135]; for(int x = 0; x < 1135; x++) { diff --git a/src/mame/drivers/limenko.cpp b/src/mame/drivers/limenko.cpp index ced23bf5779..1455aaa25f3 100644 --- a/src/mame/drivers/limenko.cpp +++ b/src/mame/drivers/limenko.cpp @@ -375,9 +375,9 @@ void limenko_state::draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &c { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * width; - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &m_sprites_bitmap_pri.pix8(y); + u8 const *const source = source_base + y_index * width; + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &m_sprites_bitmap_pri.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -452,10 +452,10 @@ void limenko_state::copy_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &sprites_bit { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *source = &sprites_bitmap.pix16(y); - u16 *dest = &bitmap.pix16(y); - u8 *dest_pri = &priority_bitmap.pix8(y); - u8 *source_pri = &m_sprites_bitmap_pri.pix8(y); + u16 const *const source = &sprites_bitmap.pix(y); + u16 *const dest = &bitmap.pix(y); + u8 const *const dest_pri = &priority_bitmap.pix(y); + u8 const *const source_pri = &m_sprites_bitmap_pri.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/llc1.cpp b/src/mame/drivers/llc1.cpp index a0117d521d8..29e900f8b1e 100644 --- a/src/mame/drivers/llc1.cpp +++ b/src/mame/drivers/llc1.cpp @@ -237,22 +237,21 @@ void llc1_state::machine_start() u32 llc1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - inv = (m_vram[x] & 0x80) ? 0xff : 0; - chr = m_vram[x] & 0x7f; + u8 const inv = (m_vram[x] & 0x80) ? 0xff : 0; + u8 const chr = m_vram[x] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; + u8 const gfx = m_p_chargen[ chr | (ra << 7) ] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/llc2.cpp b/src/mame/drivers/llc2.cpp index b22de1b0774..cc00f24d67c 100644 --- a/src/mame/drivers/llc2.cpp +++ b/src/mame/drivers/llc2.cpp @@ -166,30 +166,29 @@ void llc2_state::machine_start() u32 llc2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv, inv1=m_rv ? 0xff : 0; - u16 sy=0,ma=0,x; + u8 const inv1 = m_rv ? 0xff : 0; + u16 sy = 0, ma = 0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - inv = 0; - u16 *p = &bitmap.pix16(sy++); + u8 inv = 0; + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - chr = m_vram[x]; + u8 chr = m_vram[x]; if (chr==0x11) // inverse on { inv=0xff; chr=0x0f; // must not show } - else - if (chr==0x10) // inverse off + else if (chr==0x10) // inverse off inv=0; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; + u8 const gfx = m_p_chargen[ (chr << 3) | ra ] ^ inv ^ inv1; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/lola8a.cpp b/src/mame/drivers/lola8a.cpp index f915bed8bfe..3ca470eb116 100644 --- a/src/mame/drivers/lola8a.cpp +++ b/src/mame/drivers/lola8a.cpp @@ -234,16 +234,14 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( lola8a_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 x,gfx; - u16 mem; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); ma &= 0x7ff; - for (x = 0; x < x_count; x++) + for (u8 x = 0; x < x_count; x++) { - mem = (x+ma)*8 + ra; - gfx = m_p_videoram[mem] ^ ((cursor_x == x) ? 0xff : 0); + u16 mem = (x+ma)*8 + ra; + u8 gfx = m_p_videoram[mem] ^ ((cursor_x == x) ? 0xff : 0); *p++ = palette[BIT(gfx, 7) ? 7 : 0]; *p++ = palette[BIT(gfx, 6) ? 7 : 0]; diff --git a/src/mame/drivers/m14.cpp b/src/mame/drivers/m14.cpp index 5a40e118da5..99bedecc74c 100644 --- a/src/mame/drivers/m14.cpp +++ b/src/mame/drivers/m14.cpp @@ -161,33 +161,31 @@ void m14_state::video_start() void m14_state::draw_ball_and_paddle(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int xi,yi; //const rgb_t white_pen = rgb_t::white(); const uint8_t white_pen = 0x1f; const int xoffs = -8; // matches left-right wall bounces const int p_ybase = 184; // matches ball bounce to paddle - int resx,resy; // draw ball - for(xi=0;xi<4;xi++) - for(yi=0;yi<4;yi++) + for(int xi=0;xi<4;xi++) + for(int yi=0;yi<4;yi++) { - resx = flip_screen() ? 32*8-(m_ballx+xi+xoffs) : m_ballx+xi+xoffs; - resy = flip_screen() ? 28*8-(m_bally+yi) : m_bally+yi; + const int resx = flip_screen() ? 32*8-(m_ballx+xi+xoffs) : m_ballx+xi+xoffs; + const int resy = flip_screen() ? 28*8-(m_bally+yi) : m_bally+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_palette->pen(white_pen); + bitmap.pix(resy, resx) = m_palette->pen(white_pen); } // draw paddle - for(xi=0;xi<16;xi++) - for(yi=0;yi<4;yi++) + for(int xi=0;xi<16;xi++) + for(int yi=0;yi<4;yi++) { - resx = flip_screen() ? 32*8-(m_paddlex+xi+xoffs) : (m_paddlex+xi+xoffs); - resy = flip_screen() ? 28*8-(p_ybase+yi) : p_ybase+yi; + const int resx = flip_screen() ? 32*8-(m_paddlex+xi+xoffs) : (m_paddlex+xi+xoffs); + const int resy = flip_screen() ? 28*8-(p_ybase+yi) : p_ybase+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_palette->pen(white_pen); + bitmap.pix(resy, resx) = m_palette->pen(white_pen); } diff --git a/src/mame/drivers/m20.cpp b/src/mame/drivers/m20.cpp index 00c61f10ee6..557c4e684a1 100644 --- a/src/mame/drivers/m20.cpp +++ b/src/mame/drivers/m20.cpp @@ -130,16 +130,15 @@ private: MC6845_UPDATE_ROW( m20_state::update_row ) { - uint32_t *p = &bitmap.pix32(y); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; + uint32_t *p = &bitmap.pix(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ((ma | (ra << 1)) << 4) + i; uint16_t data = m_p_videoram[ offset ]; - for ( j = 15; j >= 0; j-- ) + for ( int j = 15; j >= 0; j-- ) { *p = palette[( data & 1 << j ) ? 1 : 0]; p++; diff --git a/src/mame/drivers/m3.cpp b/src/mame/drivers/m3.cpp index e97675a6e50..f40db77c10f 100644 --- a/src/mame/drivers/m3.cpp +++ b/src/mame/drivers/m3.cpp @@ -62,16 +62,14 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( m3_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = (x == cursor_x) ? 0xff : 0; - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + uint8_t inv = (x == cursor_x) ? 0xff : 0; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_p_videoram[mem]; if (BIT(chr, 7)) { inv ^= 0xff; @@ -79,7 +77,7 @@ MC6845_UPDATE_ROW( m3_state::crtc_update_row ) } /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 6)]; diff --git a/src/mame/drivers/m79152pc.cpp b/src/mame/drivers/m79152pc.cpp index cf041466982..2f05839a30c 100644 --- a/src/mame/drivers/m79152pc.cpp +++ b/src/mame/drivers/m79152pc.cpp @@ -185,10 +185,10 @@ TIMER_CALLBACK_MEMBER(m79152pc_state::hsync_off) void m79152pc_state::screen_draw_line(bitmap_ind16 &bitmap, unsigned y) { - u16 ma = u16(m_line_base) << 4; - u8 ra = m_line_count & 0xf; + const u16 ma = u16(m_line_base) << 4; + const u8 ra = m_line_count & 0xf; - u16 *p = &bitmap.pix16(y++); + u16 *p = &bitmap.pix(y++); for (u16 x = ma; x < ma + 80; x++) { diff --git a/src/mame/drivers/m79amb.cpp b/src/mame/drivers/m79amb.cpp index 7baecaf457e..c855502faa1 100644 --- a/src/mame/drivers/m79amb.cpp +++ b/src/mame/drivers/m79amb.cpp @@ -75,20 +75,16 @@ void m79amb_state::ramtek_videoram_w(offs_t offset, uint8_t data) uint32_t m79amb_state::screen_update_ramtek(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t data = m_videoram[offs]; int y = offs >> 5; int x = (offs & 0x1f) << 3; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; x++; data <<= 1; diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp index 9dcd7c3184e..d75819c4107 100644 --- a/src/mame/drivers/mac128.cpp +++ b/src/mame/drivers/mac128.cpp @@ -938,23 +938,17 @@ void mac128_state::mac_driver_init(mac128model_t model) uint32_t mac128_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint32_t const video_base = m_ram_size - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + uint16_t const *video_ram = (const uint16_t *) (m_ram_ptr + video_base); - video_base = m_ram_size - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const uint16_t *) (m_ram_ptr + video_base); - - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + uint16_t const word = *(video_ram++); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } diff --git a/src/mame/drivers/macrossp.cpp b/src/mame/drivers/macrossp.cpp index 1202cbfcb02..cc8733ce38d 100644 --- a/src/mame/drivers/macrossp.cpp +++ b/src/mame/drivers/macrossp.cpp @@ -10,6 +10,7 @@ Driver by David Haywood TODO: - what is the 'BIOS' ROM for? it appears to be data tables and is very different between games but we don't map it anywhere - convert tilemaps to devices? + - quizmoon title gfx/sound in attract mode is incorrect? reference: https://youtu.be/925rRv2JG50 68020 interrupts lev 1 : 0x64 : 0000 084c - unknown.. diff --git a/src/mame/drivers/magicard.cpp b/src/mame/drivers/magicard.cpp index 20a74fe5b1e..eec8a48e058 100644 --- a/src/mame/drivers/magicard.cpp +++ b/src/mame/drivers/magicard.cpp @@ -646,43 +646,40 @@ void magicard_state::video_start() uint32_t magicard_state::screen_update_magicard(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x, y; - uint32_t count; - bitmap.fill(m_palette->black_pen(), cliprect); //TODO if(!(SCC_DE_VREG)) //display enable return 0; - count = ((SCC_VSR_VREG) / 2); + uint32_t count = ((SCC_VSR_VREG) / 2); if(SCC_FG_VREG) //4bpp gfx { - for(y = 0; y < 300; y++) + for(int y = 0; y < 300; y++) { - for(x = 0; x < 84; x++) + for(int x = 0; x < 84; x++) { uint32_t color; color = ((m_magicram[count]) & 0x000f) >> 0; if(cliprect.contains((x * 4) + 3, y)) - bitmap.pix32(y, (x * 4) + 3) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 3) = m_palette->pen(color); color = ((m_magicram[count]) & 0x00f0) >> 4; if(cliprect.contains((x * 4) + 2, y)) - bitmap.pix32(y, (x * 4) + 2) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 2) = m_palette->pen(color); color = ((m_magicram[count]) & 0x0f00) >> 8; if(cliprect.contains((x * 4) + 1, y)) - bitmap.pix32(y, (x * 4) + 1) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 1) = m_palette->pen(color); color = ((m_magicram[count]) & 0xf000) >> 12; if(cliprect.contains((x * 4) + 0, y)) - bitmap.pix32(y, (x * 4) + 0) = m_palette->pen(color); + bitmap.pix(y, (x * 4) + 0) = m_palette->pen(color); count++; } @@ -690,21 +687,21 @@ uint32_t magicard_state::screen_update_magicard(screen_device &screen, bitmap_rg } else //8bpp gfx { - for(y = 0; y < 300; y++) + for(int y = 0; y < 300; y++) { - for(x = 0; x < 168; x++) + for(int x = 0; x < 168; x++) { uint32_t color; color = ((m_magicram[count]) & 0x00ff) >> 0; if(cliprect.contains((x * 2) + 1, y)) - bitmap.pix32(y, (x * 2) + 1) = m_palette->pen(color); + bitmap.pix(y, (x * 2) + 1) = m_palette->pen(color); color = ((m_magicram[count]) & 0xff00) >> 8; if(cliprect.contains((x * 2) + 0, y)) - bitmap.pix32(y, (x * 2) + 0) = m_palette->pen(color); + bitmap.pix(y, (x * 2) + 0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/marinedt.cpp b/src/mame/drivers/marinedt.cpp index 79ed6144257..b0a4bdfdb75 100644 --- a/src/mame/drivers/marinedt.cpp +++ b/src/mame/drivers/marinedt.cpp @@ -205,8 +205,8 @@ void marinedt_state::init_seabitmap() if(blue_pen > 0x5f) blue_pen = 0x5f; - m_seabitmap[0]->pix16(y, x) = blue_pen; - m_seabitmap[1]->pix16(y, x) = blue_pen+0x20; + m_seabitmap[0]->pix(y, x) = blue_pen; + m_seabitmap[1]->pix(y, x) = blue_pen+0x20; } } } @@ -360,11 +360,11 @@ inline uint32_t marinedt_state::obj_to_obj_collision() resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix16(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) continue; // return value is never read most likely - if(m_obj[1].bitmap.pix16(resy,resx) != 0) + if(m_obj[1].bitmap.pix(resy,resx) != 0) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); } } @@ -387,14 +387,14 @@ inline uint32_t marinedt_state::obj_to_layer_collision() resx = m_obj[0].x + x; resy = m_obj[0].y + y; - if((m_obj[0].bitmap.pix16(resy,resx) & 3) == 0) + if((m_obj[0].bitmap.pix(resy,resx) & 3) == 0) continue; if(!m_screen_flip) resy -= 32; // TODO: non screen flip path doesn't work properly - if(m_tilemap->pixmap().pix16(resy,resx) != 0) + if(m_tilemap->pixmap().pix(resy,resx) != 0) { if(m_screen_flip) return ((resy / 8) * 32) | (((resx / 8) - 1) & 0x1f); diff --git a/src/mame/drivers/maygayv1.cpp b/src/mame/drivers/maygayv1.cpp index 4459418d0cc..b0f686a348d 100644 --- a/src/mame/drivers/maygayv1.cpp +++ b/src/mame/drivers/maygayv1.cpp @@ -329,7 +329,6 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in uint16_t *atable = &i82716.dram[VREG(ATBA)]; uint16_t *otable = &i82716.dram[VREG(ODTBA) & 0xfc00]; // both must be bank 0 - int sl, sx; int slmask = 0xffff; // TODO: Save if using scanline callbacks int xbound = (VREG(DWBA) & 0x3f8) | 7; @@ -344,13 +343,12 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in } /* For every scanline... */ - for (sl = cliprect.min_x; sl <= cliprect.max_y; ++sl) + for (int sl = cliprect.min_x; sl <= cliprect.max_y; ++sl) { - int obj; uint16_t aflags = atable[sl]; uint16_t slmask_old = slmask; - uint16_t *bmp_ptr = &bitmap.pix16(sl); + uint16_t *bmp_ptr = &bitmap.pix(sl); slmask = 0xffff ^ (slmask ^ aflags); @@ -359,7 +357,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in memset(i82716.line_buf.get(), 0x22, 512); /* Parse the list of 16 objects */ - for (obj = 0; obj < 16; ++obj) + for (int obj = 0; obj < 16; ++obj) { int offs = obj * 4; @@ -367,7 +365,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in if ( !BIT(slmask, obj) ) { uint32_t objbase, trans, width; - int32_t x, xpos; + int32_t xpos; uint16_t w0, w1, w2; uint16_t *objptr; uint8_t *bmpptr; // ? @@ -419,7 +417,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in bmpptr = (uint8_t*)objptr; // 4bpp - for (x = xpos; x < std::min(xbound, int(xpos + width * 8)); ++x) + for (int x = xpos; x < std::min(xbound, int(xpos + width * 8)); ++x) { if (x >= 0) { @@ -441,7 +439,7 @@ uint32_t maygayv1_state::screen_update_maygayv1(screen_device &screen, bitmap_in } // Write it out - for (sx = cliprect.min_x; sx < cliprect.max_x; sx += 2) + for (int sx = cliprect.min_x; sx < cliprect.max_x; sx += 2) { uint8_t pix = i82716.line_buf[sx / 2]; diff --git a/src/mame/drivers/mbc200.cpp b/src/mame/drivers/mbc200.cpp index 369cb6ee117..64e89698e6b 100644 --- a/src/mame/drivers/mbc200.cpp +++ b/src/mame/drivers/mbc200.cpp @@ -268,15 +268,13 @@ static void mbc200_floppies(device_slot_interface &device) MC6845_UPDATE_ROW( mbc200_state::update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma+x)*4+ra; - gfx = m_vram[mem & 0x7fff]; + u16 mem = (ma+x)*4+ra; + u8 gfx = m_vram[mem & 0x7fff]; *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; diff --git a/src/mame/drivers/mc8020.cpp b/src/mame/drivers/mc8020.cpp index f5fcd33bcee..bcdd4f3c1fc 100644 --- a/src/mame/drivers/mc8020.cpp +++ b/src/mame/drivers/mc8020.cpp @@ -263,20 +263,20 @@ static const uint8_t prom[] = { uint32_t mc8020_state::screen_update_mc8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + u16 sy=0,ma=0; - for(y = 0; y < 8; y++ ) + for (u8 y = 0; y < 8; y++ ) { - for (ra = 0; ra < 16; ra++) + for (u8 ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 32; x++) + for (u16 x = ma; x < ma + 32; x++) { + u8 gfx; if (ra > 3 && ra < 12) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; gfx = prom[(chr<<3) | (ra-4)]; } else diff --git a/src/mame/drivers/mc8030.cpp b/src/mame/drivers/mc8030.cpp index a3b35bd5f2d..e8f0abcdfe1 100644 --- a/src/mame/drivers/mc8030.cpp +++ b/src/mame/drivers/mc8030.cpp @@ -145,27 +145,24 @@ uint8_t mc8030_state::asp_port_b_r() uint32_t mc8030_state::screen_update_mc8030(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t gfx; - uint16_t y=0,ma=0,x; + uint16_t ma=0; - for(y = 0; y < 256; y++ ) + for(uint16_t y = 0; y < 256; y++ ) { - uint16_t *p = &bitmap.pix16(y); + uint16_t *p = &bitmap.pix(y); + for (uint16_t x = ma; x < ma + 64; x++) { - for (x = ma; x < ma + 64; x++) - { - gfx = m_vram[x^0x3fff]; - - /* Display a scanline of a character */ - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); - } + uint8_t const gfx = m_vram[x^0x3fff]; + + /* Display a scanline of a character */ + *p++ = BIT(gfx, 7); + *p++ = BIT(gfx, 6); + *p++ = BIT(gfx, 5); + *p++ = BIT(gfx, 4); + *p++ = BIT(gfx, 3); + *p++ = BIT(gfx, 2); + *p++ = BIT(gfx, 1); + *p++ = BIT(gfx, 0); } ma+=64; } diff --git a/src/mame/drivers/mdt60.cpp b/src/mame/drivers/mdt60.cpp index 63669bbf0f9..45623589d4f 100644 --- a/src/mame/drivers/mdt60.cpp +++ b/src/mame/drivers/mdt60.cpp @@ -108,7 +108,7 @@ TIMER_CALLBACK_MEMBER(mdt60_state::baud_timer) MC6845_UPDATE_ROW(mdt60_state::update_row) { - u32 *pix = &bitmap.pix32(y); + u32 *pix = &bitmap.pix(y); for (unsigned x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/mediagx.cpp b/src/mame/drivers/mediagx.cpp index 353f25ab02d..6e20ffb9e58 100644 --- a/src/mame/drivers/mediagx.cpp +++ b/src/mame/drivers/mediagx.cpp @@ -266,19 +266,17 @@ void mediagx_state::video_start() void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - const pen_t *pens = &m_palette->pen(0); + pen_t const *const pens = &m_palette->pen(0); - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint32_t *p = &bitmap.pix32(j); - for (i=x; i < x+8; i++) + uint32_t *const p = &bitmap.pix(j); + for (int i=x; i < x+8; i++) { - uint8_t pen = dp[index++]; + uint8_t const pen = dp[index++]; if (pen) p[i] = pens[gfx->colorbase() + (att & 0xf)]; else @@ -292,18 +290,16 @@ void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, g void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - int width, height; - int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; + int const line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; - width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1; + int width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1; if (m_disp_ctrl_reg[DC_TIMING_CFG] & 0x8000) // pixel double { width >>= 1; } width += 4; - height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1; + int height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1; if ( (width != m_frame_width || height != m_frame_height) && (width > 1 && height > 1 && width <= 640 && height <= 480) ) @@ -319,19 +315,19 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode { - uint8_t *framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; - uint8_t *pal = m_pal; + uint8_t const *const framebuf = (uint8_t const *)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint8_t const *const pal = m_pal; - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint8_t *si = &framebuf[j * line_delta]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint8_t const *si = &framebuf[j * line_delta]; + for (int i=0; i < m_frame_width; i++) { - int c = *si++; - int r = pal[(c*3)+0] << 2; - int g = pal[(c*3)+1] << 2; - int b = pal[(c*3)+2] << 2; + int const c = *si++; + int const r = pal[(c*3)+0] << 2; + int const g = pal[(c*3)+1] << 2; + int const b = pal[(c*3)+2] << 2; p[i] = r << 16 | g << 8 | b; } @@ -339,21 +335,21 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip } else // 16-bit { - uint16_t *framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint16_t const *const framebuf = (uint16_t const *)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; // RGB 5-6-5 mode if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0) { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { - uint16_t c = *si++; - int r = ((c >> 11) & 0x1f) << 3; - int g = ((c >> 5) & 0x3f) << 2; - int b = (c & 0x1f) << 3; + uint16_t const c = *si++; + int const r = ((c >> 11) & 0x1f) << 3; + int const g = ((c >> 5) & 0x3f) << 2; + int const b = (c & 0x1f) << 3; p[i] = r << 16 | g << 8 | b; } @@ -362,16 +358,16 @@ void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &clip // RGB 5-5-5 mode else { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { - uint16_t c = *si++; - int r = ((c >> 10) & 0x1f) << 3; - int g = ((c >> 5) & 0x1f) << 3; - int b = (c & 0x1f) << 3; + uint16_t const c = *si++; + int const r = ((c >> 10) & 0x1f) << 3; + int const g = ((c >> 5) & 0x1f) << 3; + int const b = (c & 0x1f) << 3; p[i] = r << 16 | g << 8 | b; } diff --git a/src/mame/drivers/megaplay.cpp b/src/mame/drivers/megaplay.cpp index 8b0f4011e38..be3943762bd 100644 --- a/src/mame/drivers/megaplay.cpp +++ b/src/mame/drivers/megaplay.cpp @@ -633,9 +633,9 @@ uint32_t mplay_state::screen_update_megplay(screen_device &screen, bitmap_rgb32 const u32 width = sega315_5124_device::WIDTH - (sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); for (int y = 0; y < 224; y++) { - uint32_t* lineptr = &bitmap.pix32(y); - uint32_t* srcptr = &m_vdp1->get_bitmap().pix32(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); - uint8_t* y1ptr = &m_vdp1->get_y1_bitmap().pix8(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); + uint32_t *const lineptr = &bitmap.pix(y); + uint32_t const *const srcptr = &m_vdp1->get_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); + uint8_t const *const y1ptr = &m_vdp1->get_y1_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH); for (int srcx = 0, xx = 0, dstx = 0; srcx < width; dstx++) { diff --git a/src/mame/drivers/megatech.cpp b/src/mame/drivers/megatech.cpp index d13980ffad6..5b1f42d7a66 100644 --- a/src/mame/drivers/megatech.cpp +++ b/src/mame/drivers/megatech.cpp @@ -627,8 +627,8 @@ uint32_t mtech_state::screen_update_main(screen_device &screen, bitmap_rgb32 &bi // when launching megatech + both sms and megadrive games, the following would be needed... for (int y = 0; y < 224; y++) { - uint32_t* lineptr = &bitmap.pix32(y); - uint32_t* srcptr = &m_vdp->get_bitmap().pix32(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT); + uint32_t* lineptr = &bitmap.pix(y); + uint32_t* srcptr = &m_vdp->get_bitmap().pix(y + sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT); for (int x = 0; x < sega315_5124_device::WIDTH; x++) lineptr[x] = srcptr[x]; diff --git a/src/mame/drivers/meijinsn.cpp b/src/mame/drivers/meijinsn.cpp index 0778c284c18..09fc80ded0a 100644 --- a/src/mame/drivers/meijinsn.cpp +++ b/src/mame/drivers/meijinsn.cpp @@ -324,7 +324,7 @@ uint32_t meijinsn_state::screen_update_meijinsn(screen_device &screen, bitmap_in { color= BIT(data1, x) | (BIT(data1, x + 4) << 1); data = BIT(data2, x) | (BIT(data2, x + 4) << 1); - bitmap.pix16(sy, (sx * 4 + (3 - x))) = color * 4 + data; + bitmap.pix(sy, (sx * 4 + (3 - x))) = color * 4 + data; } } return 0; diff --git a/src/mame/drivers/mekd3.cpp b/src/mame/drivers/mekd3.cpp index aed68ab06ad..29105919019 100644 --- a/src/mame/drivers/mekd3.cpp +++ b/src/mame/drivers/mekd3.cpp @@ -837,31 +837,34 @@ MC6845_UPDATE_ROW(mekd3_state::update_row) uint8_t code = m_video_ram[(ma + column) & 0xfff]; int dcursor = (column == cursor_x); - if (BIT(code, 7)) { - /* Lores 6 pixel character. - ----------- - | D1 | D0 | - | D3 | D2 | - | D5 | D4 | - ----------- - D6 - 1 Grey tone, 0 brightness. - */ - int pixel = ((ra & 0x0c) >> 1) + 1; - int dout = BIT(code, pixel); - int grey = BIT(code, 6); - int color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - pixel--; - dout = BIT(code, pixel); - color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - } else { + if (BIT(code, 7)) + { + /* Lores 6 pixel character. + ----------- + | D1 | D0 | + | D3 | D2 | + | D5 | D4 | + ----------- + D6 - 1 Grey tone, 0 brightness. + */ + int pixel = ((ra & 0x0c) >> 1) + 1; + int dout = BIT(code, pixel); + int grey = BIT(code, 6); + int color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + pixel--; + dout = BIT(code, pixel); + color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + } + else + { offs_t address = ra < 8 ? ((code & 0x7f) << 3) | (ra & 0x07) : 0; uint8_t data = m_p_chargen[address]; @@ -870,7 +873,7 @@ MC6845_UPDATE_ROW(mekd3_state::update_row) int dout = BIT(data, 7); int color = ((dcursor ^ dout) && de) << 1; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/mekd4.cpp b/src/mame/drivers/mekd4.cpp index f03c8e3248f..d8856a11893 100644 --- a/src/mame/drivers/mekd4.cpp +++ b/src/mame/drivers/mekd4.cpp @@ -874,29 +874,29 @@ MC6845_UPDATE_ROW(mekd4_state::update_row) int dcursor = (column == cursor_x); if (BIT(code, 7)) { - /* Lores 6 pixel character. - ----------- - | D1 | D0 | - | D3 | D2 | - | D5 | D4 | - ----------- - D6 - 1 Grey tone, 0 brightness. - */ - int pixel = ((ra & 0x0c) >> 1) + 1; - int dout = BIT(code, pixel); - int grey = BIT(code, 6); - int color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - pixel--; - dout = BIT(code, pixel); - color = ((dcursor ^ dout) && de) << (grey ^ 1); - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; + /* Lores 6 pixel character. + ----------- + | D1 | D0 | + | D3 | D2 | + | D5 | D4 | + ----------- + D6 - 1 Grey tone, 0 brightness. + */ + int pixel = ((ra & 0x0c) >> 1) + 1; + int dout = BIT(code, pixel); + int grey = BIT(code, 6); + int color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + pixel--; + dout = BIT(code, pixel); + color = ((dcursor ^ dout) && de) << (grey ^ 1); + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } else { offs_t address = ra < 8 ? ((code & 0x7f) << 3) | (ra & 0x07) : 0; uint8_t data = m_p_chargen[address]; @@ -906,7 +906,7 @@ MC6845_UPDATE_ROW(mekd4_state::update_row) int dout = BIT(data, 7); int color = ((dcursor ^ dout) && de) << 1; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index f54de1f3f07..ffa8650e791 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -296,28 +296,23 @@ MC6845_BEGIN_UPDATE( merit_state::crtc_begin_update ) MC6845_UPDATE_ROW( merit_state::crtc_update_row ) { - uint8_t *gfx[2]; + uint8_t const *const gfx[2] = { memregion("gfx1")->base(), memregion("gfx2")->base() }; uint16_t x = 0; - int rlen; - gfx[0] = memregion("gfx1")->base(); - gfx[1] = memregion("gfx2")->base(); - rlen = memregion("gfx2")->bytes(); + int const rlen = memregion("gfx2")->bytes(); //ma = ma ^ 0x7ff; for (uint8_t cx = 0; cx < x_count; cx++) { - int i; int attr = m_ram_attr[ma & 0x7ff]; int region = (attr & 0x40) >> 6; int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (m_extra_video_bank_bit)) << 4) | (ra & 0x0f); int colour = (attr & 0x7f) << 3; - uint8_t *data; addr &= (rlen-1); - data = gfx[region]; + uint8_t const *const data = gfx[region]; - for (i = 7; i>=0; i--) + for (int i = 7; i>=0; i--) { int col = colour; @@ -331,7 +326,7 @@ MC6845_UPDATE_ROW( merit_state::crtc_update_row ) col |= 0x03; col = m_ram_palette[col & 0x3ff]; - bitmap.pix32(y, x) = m_pens[col ? col & (NUM_PENS-1) : (m_lscnblk ? 8 : 0)]; + bitmap.pix(y, x) = m_pens[col ? col & (NUM_PENS-1) : (m_lscnblk ? 8 : 0)]; x++; } diff --git a/src/mame/drivers/meritum.cpp b/src/mame/drivers/meritum.cpp index 6be63729eea..c16a2514999 100644 --- a/src/mame/drivers/meritum.cpp +++ b/src/mame/drivers/meritum.cpp @@ -227,12 +227,11 @@ static INPUT_PORTS_START( meritum ) INPUT_PORTS_END u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -/* lores characters are in the character generator. Each character is 6x12 (basic characters are 6x7 excluding descenders/ascenders). */ { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; - u8 cols = m_mode ? 32 : 64; - u8 skip = m_mode ? 2 : 1; + // lores characters are in the character generator. Each character is 6x12 (basic characters are 6x7 excluding descenders/ascenders). + u16 sy=0,ma=0; + const u8 cols = m_mode ? 32 : 64; + const u8 skip = m_mode ? 2 : 1; if (m_mode != m_size_store) { @@ -240,28 +239,28 @@ u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x] & 0xbf; + const u8 chr = m_p_videoram[x] & 0xbf; + u8 gfx; // shift down comma and semicolon // not sure Meritum I got the circuit for this (like TRS80) // but position of ';' suggests most likely yes if ((chr == 0x2c) && (ra >= 2)) gfx = m_p_chargen[0x2be + ra]; - else - if ((chr == 0x3b) && (ra >= 1)) + else if ((chr == 0x3b) && (ra >= 1)) gfx = m_p_chargen[0x3af + ra]; else gfx = m_p_chargen[(chr<<4) | ra]; - /* Display a scanline of a character (6 pixels) */ + // Display a scanline of a character (6 pixels) *p++ = BIT(gfx, 5); *p++ = BIT(gfx, 4); *p++ = BIT(gfx, 3); @@ -277,10 +276,9 @@ u32 meritum_state::screen_update_meritum1(screen_device &screen, bitmap_ind16 &b u32 meritum_state::screen_update_meritum2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; - u8 cols = m_mode ? 32 : 64; - u8 skip = m_mode ? 2 : 1; + u16 sy=0,ma=0; + const u8 cols = m_mode ? 32 : 64; + const u8 skip = m_mode ? 2 : 1; if (m_mode != m_size_store) { @@ -288,20 +286,20 @@ u32 meritum_state::screen_update_meritum2(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (u16 x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + const u8 chr = m_p_videoram[x]; - /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra]; + // get pattern of pixels for that character scanline + const u8 gfx = m_p_chargen[(chr<<4) | ra]; - /* Display a scanline of a character (6 pixels) */ + // Display a scanline of a character (6 pixels) *p++ = BIT(gfx, 5); *p++ = BIT(gfx, 4); *p++ = BIT(gfx, 3); @@ -343,7 +341,7 @@ void meritum_state::port_ff_w(u8 data) d1, d0 Cassette output */ static const double levels[4] = { 0.0, 1.0, -1.0, 0.0 }; - static bool init = 0; + static bool init = 0; // FIXME: static variable, breaks hard reset and multiple runs from system selection menu m_cassette->change_state(BIT(data, 2) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR ); m_cassette->output(levels[data & 3]); diff --git a/src/mame/drivers/mes.cpp b/src/mame/drivers/mes.cpp index 24b69b6866a..de379ba2a96 100644 --- a/src/mame/drivers/mes.cpp +++ b/src/mame/drivers/mes.cpp @@ -99,21 +99,20 @@ void mes_state::machine_reset() Also the screen dimensions are a guess. */ uint32_t mes_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 9) { - chr = m_p_videoram[x]; + u8 chr = m_p_videoram[x]; gfx = m_p_chargen[(chr<<4) | ra ]; } diff --git a/src/mame/drivers/metalmx.cpp b/src/mame/drivers/metalmx.cpp index 4fc9ec4f3a6..e1c5acfb595 100644 --- a/src/mame/drivers/metalmx.cpp +++ b/src/mame/drivers/metalmx.cpp @@ -290,7 +290,7 @@ uint32_t metalmx_state::screen_update_metalmx(screen_device &screen, bitmap_ind1 for (int y = (std::max)(0, cliprect.min_y); y <= (std::min)(383, cliprect.max_y); ++y) { - uint16_t *pix = &bitmap.pix16(y); + uint16_t *pix = &bitmap.pix(y); for (int x = 0; x < 256; x++) { *pix++ = src_base[256 * y + x] & 0xffff; diff --git a/src/mame/drivers/meyc8080.cpp b/src/mame/drivers/meyc8080.cpp index 7b63e7e117f..5ff1731fa36 100644 --- a/src/mame/drivers/meyc8080.cpp +++ b/src/mame/drivers/meyc8080.cpp @@ -113,12 +113,8 @@ private: uint32_t meyc8080_state::screen_update_meyc8080(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram_0.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram_0.bytes(); offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; @@ -132,15 +128,15 @@ uint32_t meyc8080_state::screen_update_meyc8080(screen_device &screen, bitmap_rg uint8_t data_g = (data2 & ~data0) | (data2 & data1) | (~data2 & ~data1 & data0); uint8_t data_b = data0 ^ data1; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x) = rgb_t(pal1bit(data_r >> 7), pal1bit(data_g >> 7), pal1bit(data_b >> 7)); + bitmap.pix(y, x) = rgb_t(pal1bit(data_r >> 7), pal1bit(data_g >> 7), pal1bit(data_b >> 7)); - data_r = data_r << 1; - data_g = data_g << 1; - data_b = data_b << 1; + data_r <<= 1; + data_g <<= 1; + data_b <<= 1; - x = x + 1; + x++; } } diff --git a/src/mame/drivers/meyc8088.cpp b/src/mame/drivers/meyc8088.cpp index 363eaffe16d..653ff3b757b 100644 --- a/src/mame/drivers/meyc8088.cpp +++ b/src/mame/drivers/meyc8088.cpp @@ -163,7 +163,7 @@ uint32_t meyc8088_state::screen_update(screen_device &screen, bitmap_ind16 &bitm v[3] = m_vram[offs|0x4001]; // video4: color prom d3 for (int i = 0; i < 8; i++) - bitmap.pix16(y, x | i) = ((v[0] << i) >> 7 & 1) | ((v[1] << i) >> 6 & 2) | ((v[2] << i) >> 5 & 4) | ((v[3] << i) >> 4 & 8) | v[4]; + bitmap.pix(y, x | i) = ((v[0] << i) >> 7 & 1) | ((v[1] << i) >> 6 & 2) | ((v[2] << i) >> 5 & 4) | ((v[3] << i) >> 4 & 8) | v[4]; } return 0; diff --git a/src/mame/drivers/micral.cpp b/src/mame/drivers/micral.cpp index 12c1c90f2af..692c61480b7 100644 --- a/src/mame/drivers/micral.cpp +++ b/src/mame/drivers/micral.cpp @@ -323,21 +323,20 @@ INPUT_PORTS_END uint32_t micral_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 9) { - chr = m_vram[x+ma]; + uint8_t chr = m_vram[x+ma]; gfx = m_p_chargen[(chr<<4) | ra ]; if (((s_curpos & 0xff)==x) && ((s_curpos >> 8)==y)) gfx ^= 0xff; diff --git a/src/mame/drivers/microb.cpp b/src/mame/drivers/microb.cpp index a7186e48554..4feafb18f93 100644 --- a/src/mame/drivers/microb.cpp +++ b/src/mame/drivers/microb.cpp @@ -285,9 +285,9 @@ I8275_DRAW_CHARACTER_MEMBER(microb_state::draw_character) dots ^= 0xff; // HLGT is active on status line - rgb_t fg = hlgt ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); + rgb_t const fg = hlgt ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); - u32 *pix = &bitmap.pix32(y, x); + u32 *pix = &bitmap.pix(y, x); for (int i = 0; i < 8; i++) { *pix++ = BIT(dots, 7) ? fg : rgb_t::black(); diff --git a/src/mame/drivers/microterm_f8.cpp b/src/mame/drivers/microterm_f8.cpp index 9d476def400..da4d83cd617 100644 --- a/src/mame/drivers/microterm_f8.cpp +++ b/src/mame/drivers/microterm_f8.cpp @@ -162,7 +162,7 @@ u32 microterm_f8_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma bool dot = (!BIT(ch, 8) && allow_underline) || ((BIT(ch, 10) || blink_on) && BIT(chdata, 8 - (x % 9))); if ((BIT(ch, 7) && cursor_on) == BIT(ch, 9)) dot = !dot; - bitmap.pix32(y, x) = dot ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = dot ? rgb_t::white() : rgb_t::black(); } y++; diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index 7957d16279d..324443a5366 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -267,7 +267,7 @@ uint32_t microvision_state::screen_update(screen_device &screen, bitmap_rgb32 &b p = (p > 255) ? 0 : p ^ 255; if (cliprect.contains(x, y)) - bitmap.pix32(y, x) = p << 16 | p << 8 | p; + bitmap.pix(y, x) = p << 16 | p << 8 | p; } } diff --git a/src/mame/drivers/mikro80.cpp b/src/mame/drivers/mikro80.cpp index 5501b6d0536..b49f864e6f6 100644 --- a/src/mame/drivers/mikro80.cpp +++ b/src/mame/drivers/mikro80.cpp @@ -184,7 +184,7 @@ u32 mikro80_state::screen_update_mikro80(screen_device &screen, bitmap_ind16 &bi { for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); for (u16 x = ma; x < ma + 64; x++) { diff --git a/src/mame/drivers/mikrosha.cpp b/src/mame/drivers/mikrosha.cpp index 6660e81c278..8442c3238b3 100644 --- a/src/mame/drivers/mikrosha.cpp +++ b/src/mame/drivers/mikrosha.cpp @@ -190,7 +190,7 @@ I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels) pixels ^= 0xff; for(int i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/milton6805.cpp b/src/mame/drivers/milton6805.cpp index efda2a0886d..1377e8d85a2 100644 --- a/src/mame/drivers/milton6805.cpp +++ b/src/mame/drivers/milton6805.cpp @@ -90,7 +90,7 @@ public: protected: virtual void device_start() override; - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; @@ -108,25 +108,24 @@ milton_filter_device::milton_filter_device(const machine_config &mconfig, const void milton_filter_device::device_start() { - m_stream = stream_alloc_legacy(1, 1, machine().sample_rate()); + m_stream = stream_alloc(1, 1, machine().sample_rate()); m_led_out.resolve(); } -void milton_filter_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void milton_filter_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - int level = 0; + stream_buffer::sample_t level = 0; - for (int i = 0; i < samples; i++) - { - level += abs(inputs[0][i]); - outputs[0][i] = inputs[0][i]; - } + for (int i = 0; i < outputs[0].samples(); i++) + level += fabsf(inputs[0].get(i)); + + outputs[0] = inputs[0]; - if (samples > 0) - level /= samples; + if (outputs[0].samples() > 0) + level /= outputs[0].samples(); // 2 leds connected to the audio circuit - const int threshold = 1500; + const stream_buffer::sample_t threshold = 1500.0 / 32768.0; m_led_out = (level > threshold) ? 1 : 0; } diff --git a/src/mame/drivers/mindset.cpp b/src/mame/drivers/mindset.cpp index 279ad92bbf8..d11e5291420 100644 --- a/src/mame/drivers/mindset.cpp +++ b/src/mame/drivers/mindset.cpp @@ -751,12 +751,12 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co if(ibm_mode) { if(large_pixels) { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; for(int field=0; field<2; field++) { for(u32 yy=0; yy<2; yy++) { const u16 *src = bank + 4096*yy; for(u32 y=yy; y<200; y+=2) { - u32 *dest = &bitmap.pix32(2*y+field+dy, dx); + u32 *dest = &bitmap.pix(2*y+field+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -770,12 +770,12 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co } return 0; } else { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; for(int field=0; field<2; field++) { for(u32 yy=0; yy<2; yy++) { const u16 *src = bank + 4096*yy; for(u32 y=yy; y<200; y+=2) { - u32 *dest = &bitmap.pix32(2*y+field+dy, dx); + u32 *dest = &bitmap.pix(2*y+field+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -795,8 +795,8 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 0: { const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=4) { u16 sv = sw(*src++); for(u32 xx=0; xx<4; xx++) { @@ -811,11 +811,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -832,8 +832,8 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 2: { const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<320; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -853,7 +853,7 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co case 0: { const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<320; x+=4) { u16 sv = sw(*src++); for(u32 xx=0; xx<4; xx++) { @@ -866,10 +866,10 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 1, 4, 5 }; + static int const palind[4] = { 0, 1, 4, 5 }; const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<320; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -887,11 +887,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co if(!interleave) { switch(pixels_per_byte_order) { case 0: { - static int palind[4] = { 0, 4, 8, 12 }; + static int const palind[4] = { 0, 4, 8, 12 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<640; x+=8) { u16 sv = sw(*src++); for(u32 xx=0; xx<8; xx++) { @@ -904,11 +904,11 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co return 0; } case 1: { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; const u16 *src = bank; for(u32 y=0; y<200; y++) { - u32 *dest0 = &bitmap.pix32(2*y+dy, dx); - u32 *dest1 = &bitmap.pix32(2*y+1+dy, dx); + u32 *dest0 = &bitmap.pix(2*y+dy, dx); + u32 *dest1 = &bitmap.pix(2*y+1+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { @@ -922,10 +922,10 @@ u32 mindset_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co } } } else { - static int palind[4] = { 0, 4 }; + static int const palind[2] = { 0, 4 }; const u16 *src = bank; for(u32 y=0; y<400; y++) { - u32 *dest = &bitmap.pix32(y+dy, dx); + u32 *dest = &bitmap.pix(y+dy, dx); for(u32 x=0; x<640; x+=16) { u16 sv = sw(*src++); for(u32 xx=0; xx<16; xx++) { diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp index 28f52c0aed3..9423a10432d 100644 --- a/src/mame/drivers/miniboy7.cpp +++ b/src/mame/drivers/miniboy7.cpp @@ -320,7 +320,7 @@ int miniboy7_state::get_color_offset(uint8_t tile, uint8_t attr, int ra, int px) MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (uint8_t cx = 0; cx < x_count; cx+=1) { @@ -332,9 +332,9 @@ MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row ) uint8_t color_b = m_proms[offset_b] & 0x0f; if (color_a && (m_gpri || !color_b)) // videoram A has priority - bitmap.pix32(y, (cx << 3) + px) = palette[offset_a]; + bitmap.pix(y, (cx << 3) + px) = palette[offset_a]; else if (color_b && (!m_gpri || !color_a)) // videoram B has priority - bitmap.pix32(y, (cx << 3) + px) = palette[offset_b]; + bitmap.pix(y, (cx << 3) + px) = palette[offset_b]; } } } diff --git a/src/mame/drivers/minivadr.cpp b/src/mame/drivers/minivadr.cpp index 0b0b1bd4c88..329d3c5fa15 100644 --- a/src/mame/drivers/minivadr.cpp +++ b/src/mame/drivers/minivadr.cpp @@ -65,23 +65,19 @@ private: uint32_t minivadr_state::screen_update_minivadr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t x = offs << 3; - int y = offs >> 5; + const int y = offs >> 5; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - data = data << 1; - x = x + 1; + data <<= 1; + x++; } } diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp index ca2f756d1c4..b4c1d9c0823 100644 --- a/src/mame/drivers/missile.cpp +++ b/src/mame/drivers/missile.cpp @@ -683,24 +683,21 @@ uint8_t missile_state::read_vram(address_space &space, offs_t address) uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; - int x, y; - // draw the bitmap to the screen, looping over Y - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); - int effy = m_flipscreen ? ((256+24 - y) & 0xff) : y; - uint8_t *src = &videoram[effy * 64]; - uint8_t *src3 = nullptr; + int const effy = m_flipscreen ? ((256+24 - y) & 0xff) : y; + uint8_t const *const src = &m_videoram[effy * 64]; + uint8_t const *src3 = nullptr; // compute the base of the 3rd pixel row if (effy >= 224) - src3 = &videoram[get_bit3_addr(effy << 8)]; + src3 = &m_videoram[get_bit3_addr(effy << 8)]; // loop over X - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pix = src[x / 4] >> (x & 3); pix = ((pix >> 2) & 4) | ((pix << 1) & 2); diff --git a/src/mame/drivers/mjsenpu.cpp b/src/mame/drivers/mjsenpu.cpp index f38ca081012..5d3954855ca 100644 --- a/src/mame/drivers/mjsenpu.cpp +++ b/src/mame/drivers/mjsenpu.cpp @@ -407,32 +407,26 @@ void mjsenpu_state::video_start() uint32_t mjsenpu_state::screen_update_mjsenpu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,count; - int color; + uint32_t const *const vram = (m_control & 0x01) ? m_vram0 : m_vram1; - uint32_t* vram; - - if (m_control & 0x01) vram = m_vram0; - else vram = m_vram1; - - - - count = 0; - for (y=0;y < 256;y++) + int count = 0; + for (int y=0;y < 256;y++) { - for (x=0;x < 512/4;x++) + for (int x=0;x < 512/4;x++) { + int color; + color = vram[count] & 0x000000ff; - bitmap.pix16(y, x*4 + 2) = color; + bitmap.pix(y, x*4 + 2) = color; color = (vram[count] & 0x0000ff00) >> 8; - bitmap.pix16(y, x*4 + 3) = color; + bitmap.pix(y, x*4 + 3) = color; color = (vram[count] & 0x00ff0000) >> 16; - bitmap.pix16(y, x*4 + 0) = color; + bitmap.pix(y, x*4 + 0) = color; color = (vram[count] & 0xff000000) >> 24; - bitmap.pix16(y, x*4 + 1) = color; + bitmap.pix(y, x*4 + 1) = color; count++; } diff --git a/src/mame/drivers/mjsister.cpp b/src/mame/drivers/mjsister.cpp index 79ea31be2ae..94f3f27cf69 100644 --- a/src/mame/drivers/mjsister.cpp +++ b/src/mame/drivers/mjsister.cpp @@ -139,8 +139,8 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row ) // background layer uint8_t data_bg = m_vram[0x400 + ((ma << 3) | (ra << 7) | i)]; - bitmap.pix32(y, x1) = pen[m_colorbank << 5 | ((data_bg & 0x0f) >> 0)]; - bitmap.pix32(y, x2) = pen[m_colorbank << 5 | ((data_bg & 0xf0) >> 4)]; + bitmap.pix(y, x1) = pen[m_colorbank << 5 | ((data_bg & 0x0f) >> 0)]; + bitmap.pix(y, x2) = pen[m_colorbank << 5 | ((data_bg & 0xf0) >> 4)]; // foreground layer uint8_t data_fg = m_vram[0x8000 | (0x400 + ((ma << 3) | (ra << 7) | i))]; @@ -149,8 +149,8 @@ MC6845_UPDATE_ROW( mjsister_state::crtc_update_row ) uint8_t c2 = ((data_fg & 0xf0) >> 4); // 0 is transparent - if (c1) bitmap.pix32(y, x1) = pen[m_colorbank << 5 | 0x10 | c1]; - if (c2) bitmap.pix32(y, x2) = pen[m_colorbank << 5 | 0x10 | c2]; + if (c1) bitmap.pix(y, x1) = pen[m_colorbank << 5 | 0x10 | c1]; + if (c2) bitmap.pix(y, x2) = pen[m_colorbank << 5 | 0x10 | c2]; } } diff --git a/src/mame/drivers/ml20.cpp b/src/mame/drivers/ml20.cpp index 413efc7ca99..d31a697b5a0 100644 --- a/src/mame/drivers/ml20.cpp +++ b/src/mame/drivers/ml20.cpp @@ -170,7 +170,7 @@ HD44780_PIXEL_UPDATE( ml20_state::lcd_pixel_update ) return; if (line < 2 && pos < 16) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } // 7654---- unknown (set to input) diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp index ef3b653a06a..1a7734e07c9 100644 --- a/src/mame/drivers/mlanding.cpp +++ b/src/mame/drivers/mlanding.cpp @@ -243,12 +243,12 @@ void mlanding_state::machine_reset() u32 mlanding_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const pen_t *pens = m_palette->pens(); + pen_t const *const pens = m_palette->pens(); for (u32 y = cliprect.min_y; y <= cliprect.max_y; ++y) { - u16 *src = &m_g_ram[(112 + y) * 512 + cliprect.min_x]; - u16 *dst = &bitmap.pix16(y, cliprect.min_x); + u16 const *src = &m_g_ram[(112 + y) * 512 + cliprect.min_x]; + u16 *dst = &bitmap.pix(y, cliprect.min_x); for (u32 x = cliprect.min_x; x <= cliprect.max_x; ++x) { diff --git a/src/mame/drivers/mmagic.cpp b/src/mame/drivers/mmagic.cpp index cd17c92e098..ac9eb64d633 100644 --- a/src/mame/drivers/mmagic.cpp +++ b/src/mame/drivers/mmagic.cpp @@ -229,15 +229,15 @@ uint32_t mmagic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap { uint8_t gfx = m_tiles[(code << 4) + tx]; - bitmap.pix32(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black() : m_palette->pen_color(color); - - bitmap.pix32(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black() : m_palette->pen_color(color); - bitmap.pix32(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black() : m_palette->pen_color(color); + + bitmap.pix(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black() : m_palette->pen_color(color); + bitmap.pix(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black() : m_palette->pen_color(color); } } } diff --git a/src/mame/drivers/modellot.cpp b/src/mame/drivers/modellot.cpp index 8e8e710fe06..c33d1bc3460 100644 --- a/src/mame/drivers/modellot.cpp +++ b/src/mame/drivers/modellot.cpp @@ -166,25 +166,25 @@ GFXDECODE_END u32 modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (u8 ra = 0; ra < 16; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 64; x++) + for (u16 x = 0; x < 64; x++) { - inv = 0; + u8 inv = 0; - chr = m_p_videoram[x+ma]; + u8 chr = m_p_videoram[x+ma]; if (BIT(chr, 7)) inv = 0xff; chr &= 0x7f; // cursor + u8 gfx; if (ra < 8) gfx = m_p_chargen[(chr<<3) | ra ]; else diff --git a/src/mame/drivers/monty.cpp b/src/mame/drivers/monty.cpp index 835c6119390..b0d096fed3d 100644 --- a/src/mame/drivers/monty.cpp +++ b/src/mame/drivers/monty.cpp @@ -106,7 +106,7 @@ u32 monty_state::screen_update(screen_device& screen, bitmap_rgb32& bitmap, cons // letters with width 5 with space in between them for (int y = 0; y < 32; y++) for (int x = 0; x < 40; x++) - bitmap.pix32(y + 1, x + x/5 + 1) = BIT(m_lcd_data[y], x) ? 0 : 0xffffff; + bitmap.pix(y + 1, x + x/5 + 1) = BIT(m_lcd_data[y], x) ? 0 : 0xffffff; return 0; } diff --git a/src/mame/drivers/monzagp.cpp b/src/mame/drivers/monzagp.cpp index e0af88f679e..5ef342070a1 100644 --- a/src/mame/drivers/monzagp.cpp +++ b/src/mame/drivers/monzagp.cpp @@ -247,9 +247,9 @@ uint32_t monzagp_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } if (cliprect.contains(x * 2, y)) - bitmap.pix16(y, x * 2) = color; + bitmap.pix(y, x * 2) = color; if (cliprect.contains(x * 2 + 1, y)) - bitmap.pix16(y, x * 2 + 1) = color; + bitmap.pix(y, x * 2 + 1) = color; // collisions uint8_t coll_prom_addr = bitswap<8>(tile_idx, 7, 6, 5, 4, 2, 0, 1, 3); diff --git a/src/mame/drivers/mpu4plasma.cpp b/src/mame/drivers/mpu4plasma.cpp index d392a1232f0..5e9e182fb30 100644 --- a/src/mame/drivers/mpu4plasma.cpp +++ b/src/mame/drivers/mpu4plasma.cpp @@ -56,31 +56,23 @@ void mpu4plasma_state::mpu4plasma_map(address_map &map) uint32_t mpu4plasma_state::screen_update_mpu4plasma(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // don't know if this really gets drawn straight from ram.. - int base = 0x1600 / 2; + int const base = 0x1600 / 2; - uint16_t* rambase = m_plasmaram; - uint16_t* dst_bitmap; + uint16_t const *const rambase = m_plasmaram; - int i,y,x,p; - i = 0; + int i = 0; - for (y=0;y<40;y++) + for (int y=0; y<40; y++) { - dst_bitmap = &bitmap.pix16(y); + uint16_t *const dst_bitmap = &bitmap.pix(y); - for (x=0;x<128/16;x++) + for (int x=0; x<128/16; x++) { - uint16_t pix = rambase[base+i]; - - for (p=0;p<16;p++) - { - uint16_t bit = (pix << p)&0x8000; - if (bit) dst_bitmap[x*16 + p] = 1; - else dst_bitmap[x*16 + p] = 0; - } + uint16_t const pix = rambase[base+i]; + for (int p=0; p<16; p++) + dst_bitmap[x*16 + p] = ((pix << p) & 0x8000) ? 1 : 0; i++; - } } diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp index 84cac95b732..cea0f4ea8ad 100644 --- a/src/mame/drivers/mpu4vid.cpp +++ b/src/mame/drivers/mpu4vid.cpp @@ -440,7 +440,7 @@ void mpu4vid_state::mpu4_vram(address_map &map) SCN2674_DRAW_CHARACTER_MEMBER(mpu4vid_state::display_pixels) { - if(!lg) + if (!lg) { uint16_t tile = m_vid_mainram[address & 0x7fff]; const uint8_t *line = m_gfxdecode->gfx(m_gfx_index+0)->get_data(tile & 0xfff); @@ -455,30 +455,29 @@ SCN2674_DRAW_CHARACTER_MEMBER(mpu4vid_state::display_pixels) { // TODO: calculate instead? static const uint8_t lookup[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, - 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, - 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, - 0, 0, 2, 2, 4, 4, 6, 6, 0, 0, 2, 2, 4, 4, 6, 6, - 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, - 0, 1, 0, 1, 0, 1, 0, 1, 8, 9, 8, 9, 8, 9, 8, 9, - 0, 0, 2, 2, 0, 0, 2, 2, 8, 8,10,10, 8, 8,10,10, - 0, 1, 2, 3, 0, 1, 2, 3, 8, 9,10,11, 8, 9,10,11, - 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8,12,12,12,12, - 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9,12,13,12,13, - 0, 0, 2, 2, 4, 4, 6, 6, 8, 8,10,10,12,12,14,14, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 - }; - - bitmap.pix32(y, x + i) = m_palette->pen(lookup[(extra << 4) | (pen & 0xf)]); + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, + 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, + 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, + 0, 1, 0, 1, 4, 5, 4, 5, 0, 1, 0, 1, 4, 5, 4, 5, + 0, 0, 2, 2, 4, 4, 6, 6, 0, 0, 2, 2, 4, 4, 6, 6, + 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, + 0, 1, 0, 1, 0, 1, 0, 1, 8, 9, 8, 9, 8, 9, 8, 9, + 0, 0, 2, 2, 0, 0, 2, 2, 8, 8,10,10, 8, 8,10,10, + 0, 1, 2, 3, 0, 1, 2, 3, 8, 9,10,11, 8, 9,10,11, + 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8,12,12,12,12, + 0, 1, 0, 1, 4, 5, 4, 5, 8, 9, 8, 9,12,13,12,13, + 0, 0, 2, 2, 4, 4, 6, 6, 8, 8,10,10,12,12,14,14, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15 + }; + + bitmap.pix(y, x + i) = m_palette->pen(lookup[(extra << 4) | (pen & 0xf)]); } else { - bitmap.pix32(y, x + i) = m_palette->pen((extra<<4) | (pen & 0xf)); - + bitmap.pix(y, x + i) = m_palette->pen((extra<<4) | (pen & 0xf)); } } } diff --git a/src/mame/drivers/ms0515.cpp b/src/mame/drivers/ms0515.cpp index 33f2e059fb2..5adf16996ad 100644 --- a/src/mame/drivers/ms0515.cpp +++ b/src/mame/drivers/ms0515.cpp @@ -384,34 +384,33 @@ static void ms0515_floppies(device_slot_interface &device) uint32_t ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b; int addr = 0; if (BIT(m_sysregc, 3)) { uint8_t fg = m_sysregc & 7; uint8_t bg = fg ^ 7; - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { uint16_t code = (m_video_ram[addr++] << 8); - code += m_video_ram[addr++]; - for (b = 0; b < 16; b++) + code |= m_video_ram[addr++]; + for (int b = 0; b < 16; b++) { // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (15 - b)) & 0x01) ? bg : fg; + bitmap.pix(y, horpos++) = ((code >> (15 - b)) & 0x01) ? bg : fg; } } } } else { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { uint8_t code = m_video_ram[addr++]; uint8_t attr = m_video_ram[addr++]; @@ -424,11 +423,11 @@ uint32_t ms0515_state::screen_update_ms0515(screen_device &screen, bitmap_ind16 bg = tmp; m_blink = -1; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { // In lower res mode we will just double pixels - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; - bitmap.pix16(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; + bitmap.pix(y, horpos++) = ((code >> (7 - b)) & 0x01) ? fg : bg; } } } diff --git a/src/mame/drivers/ms6102.cpp b/src/mame/drivers/ms6102.cpp index 6c52ac9c06d..5280a203381 100644 --- a/src/mame/drivers/ms6102.cpp +++ b/src/mame/drivers/ms6102.cpp @@ -183,7 +183,7 @@ u8 ms6102_state::memory_read_byte(offs_t offset) I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = (lten) ? 0xff : 0; if (!vsp) gfx = m_p_chargen[linecount | (charcode << 4)]; @@ -192,7 +192,7 @@ I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_pixels) gfx ^= 0xff; for(u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } I8275_DRAW_CHARACTER_MEMBER(ms6102_state::display_attr) // TODO: attributes diff --git a/src/mame/drivers/mstation.cpp b/src/mame/drivers/mstation.cpp index 517300b2ee5..c96c359ca65 100644 --- a/src/mame/drivers/mstation.cpp +++ b/src/mame/drivers/mstation.cpp @@ -155,7 +155,7 @@ uint32_t mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // columns are inverted (right to left) int col = ((x < 20) ? 19 : 59) - x; - bitmap.pix16(y, col*8 + b)= BIT(data, 0); + bitmap.pix(y, col*8 + b)= BIT(data, 0); data >>= 1; } } @@ -164,7 +164,7 @@ uint32_t mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitm //*************************************************************************** // Bankswitch -//***************************************************************************/ +//*************************************************************************** uint8_t mstation_state::bank1_r(offs_t offset) { diff --git a/src/mame/drivers/mtd1256.cpp b/src/mame/drivers/mtd1256.cpp index fdc73e30185..0c05033a071 100644 --- a/src/mame/drivers/mtd1256.cpp +++ b/src/mame/drivers/mtd1256.cpp @@ -63,9 +63,9 @@ HD44780_PIXEL_UPDATE(mtd1256_state::pixel_update) { // Is this the right layout? if (pos < 20) - bitmap.pix16(line * 16 + y, pos * 6 + x) = state; + bitmap.pix(line * 16 + y, pos * 6 + x) = state; else if (pos < 40) - bitmap.pix16(line * 16 + 8 + y, (pos - 20) * 6 + x) = state; + bitmap.pix(line * 16 + 8 + y, (pos - 20) * 6 + x) = state; } diff --git a/src/mame/drivers/multi16.cpp b/src/mame/drivers/multi16.cpp index 818a137d7cf..48ead99c97d 100644 --- a/src/mame/drivers/multi16.cpp +++ b/src/mame/drivers/multi16.cpp @@ -82,7 +82,7 @@ private: MC6845_UPDATE_ROW(multi16_state::crtc_update_row) { - uint8_t *vram = reinterpret_cast<uint8_t *>(m_vram.target()); + uint8_t const *const vram = reinterpret_cast<uint8_t *>(m_vram.target()); for (int i = 0; i < x_count; i++) { @@ -101,7 +101,7 @@ MC6845_UPDATE_ROW(multi16_state::crtc_update_row) color |= BIT(data_g, 7 - x) << 1; color |= BIT(data_b, 7 - x) << 2; - bitmap.pix32(y, x + i * 8) = m_palette->pens()[color]; + bitmap.pix(y, x + i * 8) = m_palette->pens()[color]; } } } diff --git a/src/mame/drivers/multi8.cpp b/src/mame/drivers/multi8.cpp index 05609efb6ec..819ddc3de4f 100644 --- a/src/mame/drivers/multi8.cpp +++ b/src/mame/drivers/multi8.cpp @@ -115,14 +115,13 @@ void multi8_state::video_start() MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t i,chr,gfx=0,color,pen,attr; - uint16_t mem = y*80,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u16 mem = y*80; + u32 *p = &bitmap.pix(y); - for(x = 0; x < x_count; x++) + for(u16 x = 0; x < x_count; x++) { - for(i = 0; i < 8; i++) + for(u8 i = 0; i < 8; i++) { u8 pen_b = BIT(m_p_vram[mem | 0x0000], 7-i); u8 pen_r = BIT(m_p_vram[mem | 0x4000], 7-i); @@ -143,18 +142,18 @@ MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) mem++; } - u8 x_width = BIT(m_display_reg, 6) ? 80 : 40; - u8 x_step = BIT(m_display_reg, 6) ? 1 : 2; + const u8 x_width = BIT(m_display_reg, 6) ? 80 : 40; + const u8 x_step = BIT(m_display_reg, 6) ? 1 : 2; mem = 0xc000 + ma; - p = &bitmap.pix32(y); + p = &bitmap.pix(y); - for(x = 0; x < x_width; x++) + for(u16 x = 0; x < x_width; x++) { - chr = m_p_vram[mem]; - attr = m_p_vram[mem | 0x800]; - color = (BIT(m_display_reg, 7)) ? 7 : (attr & 0x07); + const u8 chr = m_p_vram[mem]; + const u8 attr = m_p_vram[mem | 0x800]; + const u8 color = (BIT(m_display_reg, 7)) ? 7 : (attr & 0x07); - gfx = BIT(attr, 5); + u8 gfx = BIT(attr, 5); if (cursor_x >= 0) gfx ^= (x == (cursor_x / x_step)); @@ -165,9 +164,9 @@ MC6845_UPDATE_ROW( multi8_state::crtc_update_row ) if (ra < 8) gfx ^= m_p_chargen[(chr << 3) | ra]; - for(i = 0; i < 8; i++) + for(u8 i = 0; i < 8; i++) { - pen = BIT(gfx, 7-i) ? color : 0; + u8 pen = BIT(gfx, 7-i) ? color : 0; if (x_step == 1) { diff --git a/src/mame/drivers/mx2178.cpp b/src/mame/drivers/mx2178.cpp index ef2d7160509..36950bf3ee5 100644 --- a/src/mame/drivers/mx2178.cpp +++ b/src/mame/drivers/mx2178.cpp @@ -84,18 +84,16 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( mx2178_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_p_videoram[mem]; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_p_videoram[mem]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7)]; diff --git a/src/mame/drivers/myb3k.cpp b/src/mame/drivers/myb3k.cpp index 720357451c9..ebfe5b95628 100644 --- a/src/mame/drivers/myb3k.cpp +++ b/src/mame/drivers/myb3k.cpp @@ -305,7 +305,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) { for (int pxl = 0; pxl < 8; pxl++) { - bitmap.pix32(y, ( x_pos * 8) + pxl) = rgb_t::black(); + bitmap.pix(y, ( x_pos * 8) + pxl) = rgb_t::black(); } } else @@ -332,7 +332,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) //pind ^= ((cursor_x != -1 && x_pos == cursor_x && ra == 7) ? 7 : 0); /* Create the grey scale */ - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; } } break; @@ -372,7 +372,7 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) pind ^= ((cursor_x != -1 && x_pos == cursor_x && ra == 7) ? 7 : 0); /* Pick up the color */ - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[pind & 0x07]; } } break; @@ -394,11 +394,11 @@ MC6845_UPDATE_ROW( myb3k_state::crtc_update_row ) { if ((pdat & (0x80 >> pxl)) != 0) { - bitmap.pix32(y, ( x_pos * 8) + pxl) = (*m_pal)[0x07]; + bitmap.pix(y, ( x_pos * 8) + pxl) = (*m_pal)[0x07]; } else { - bitmap.pix32(y, ( x_pos * 8) + pxl) = rgb_t::black(); + bitmap.pix(y, ( x_pos * 8) + pxl) = rgb_t::black(); } } } diff --git a/src/mame/drivers/mycom.cpp b/src/mame/drivers/mycom.cpp index cd6f3f66ecb..a7fdd4f6403 100644 --- a/src/mame/drivers/mycom.cpp +++ b/src/mame/drivers/mycom.cpp @@ -148,20 +148,17 @@ private: MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx=0,z; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); if (m_port0a & 0x40) { - for (x = 0; x < x_count; x++) // lores pixels + for (u16 x = 0; x < x_count; x++) // lores pixels { - u8 dbit=1; - if (x == cursor_x) dbit=0; - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - z = ra / 3; + u8 dbit = (x == cursor_x) ? 0 : 1; + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 z = ra / 3; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; @@ -175,16 +172,16 @@ MC6845_UPDATE_ROW( mycom_state::crtc_update_row ) } else { - for (x = 0; x < x_count; x++) // text + for (u16 x = 0; x < x_count; x++) // text { - u8 inv=0; - if (x == cursor_x) inv=0xff; - mem = (ma + x) & 0x7ff; + u8 inv = (x == cursor_x) ? 0xff : 0; + u16 mem = (ma + x) & 0x7ff; + u8 gfx; if (ra > 7) gfx = inv; // some blank spacing lines else { - chr = m_vram[mem]; + u8 chr = m_vram[mem]; gfx = m_p_chargen[(chr<<3) | ra] ^ inv; } diff --git a/src/mame/drivers/mz2000.cpp b/src/mame/drivers/mz2000.cpp index 36331ccade5..f227ea79c00 100644 --- a/src/mame/drivers/mz2000.cpp +++ b/src/mame/drivers/mz2000.cpp @@ -183,8 +183,8 @@ uint32_t mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 pen |= ((gvram[count+0xc000] >> (xi)) & 1) ? 4 : 0; //G pen &= m_gvram_mask; - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen); + bitmap.pix(y*2+0, x+xi) = m_palette->pen(pen); + bitmap.pix(y*2+1, x+xi) = m_palette->pen(pen); } count++; } @@ -224,27 +224,27 @@ uint32_t mz2000_state::screen_update_mz2000(screen_device &screen, bitmap_ind16 { if(m_width80 == 0) { - bitmap.pix16(res_y, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y, res_x*2+1) = m_palette->pen(pen); } else { - bitmap.pix16(res_y, res_x) = m_palette->pen(pen); + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } else { if(m_width80 == 0) { - bitmap.pix16(res_y*2+0, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+0, res_x*2+1) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+0) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x*2+1) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x*2+0) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x*2+1) = m_palette->pen(pen); } else { - bitmap.pix16(res_y*2+0, res_x) = m_palette->pen(pen); - bitmap.pix16(res_y*2+1, res_x) = m_palette->pen(pen); + bitmap.pix(res_y*2+0, res_x) = m_palette->pen(pen); + bitmap.pix(res_y*2+1, res_x) = m_palette->pen(pen); } } } diff --git a/src/mame/drivers/mz2500.cpp b/src/mame/drivers/mz2500.cpp index b5f430f7474..055fc956233 100644 --- a/src/mame/drivers/mz2500.cpp +++ b/src/mame/drivers/mz2500.cpp @@ -72,23 +72,23 @@ void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,uint16_t { if(width && height) { - bitmap.pix16(y*2+0, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+0, x*2+1) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x*2+1) = m_palette->pen(pen); + bitmap.pix(y*2+0, x*2+0) = m_palette->pen(pen); + bitmap.pix(y*2+0, x*2+1) = m_palette->pen(pen); + bitmap.pix(y*2+1, x*2+0) = m_palette->pen(pen); + bitmap.pix(y*2+1, x*2+1) = m_palette->pen(pen); } else if(width) { - bitmap.pix16(y, x*2+0) = m_palette->pen(pen); - bitmap.pix16(y, x*2+1) = m_palette->pen(pen); + bitmap.pix(y, x*2+0) = m_palette->pen(pen); + bitmap.pix(y, x*2+1) = m_palette->pen(pen); } else if(height) { - bitmap.pix16(y*2+0, x) = m_palette->pen(pen); - bitmap.pix16(y*2+1, x) = m_palette->pen(pen); + bitmap.pix(y*2+0, x) = m_palette->pen(pen); + bitmap.pix(y*2+1, x) = m_palette->pen(pen); } else - bitmap.pix16(y, x) = m_palette->pen(pen); + bitmap.pix(y, x) = m_palette->pen(pen); } void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,uint16_t map_addr) diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp index 0b9b537c340..d9689c2afa1 100644 --- a/src/mame/drivers/mz3500.cpp +++ b/src/mame/drivers/mz3500.cpp @@ -167,39 +167,29 @@ UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int x; - int xi,yi; - int tile; - int attr; - uint8_t tile_data; - uint8_t width80; - uint8_t char_size; - uint8_t hires; - uint8_t color_mode; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); // popmessage("%02x",m_crtc[6]); - color_mode = m_crtc[4] & 1; - width80 = (m_crtc[5] & 2) >> 1; - hires = (m_crtc[6] & 1); - char_size = (hires) ? 16 : 8; + uint8_t color_mode = m_crtc[4] & 1; + uint8_t width80 = (m_crtc[5] & 2) >> 1; + uint8_t hires = (m_crtc[6] & 1); + uint8_t char_size = (hires) ? 16 : 8; - for( x = 0; x < pitch; x++ ) + for( int x = 0; x < pitch; x++ ) { - tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); - attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); + int tile = (m_video_ram[(((addr+x)*2) & 0x1fff) >> 1] & 0xff); + int attr = ((m_video_ram[(((addr+x)*2+1) & 0x3ffff) >> 1] >> 8) & 0x0f); //if(hires) // tile <<= 1; - for( yi = 0; yi < lr; yi++) + for( int yi = 0; yi < lr; yi++) { - tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; + uint8_t tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)]; - for( xi = 0; xi < 8; xi++) + for( int xi = 0; xi < 8; xi++) { - int res_x,res_y; int pen; if(yi >= char_size) @@ -227,18 +217,18 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text ) } } - res_x = x * 8 + xi; - res_y = y + yi; + int res_x = x * 8 + xi; + int res_y = y + yi; if(pen != -1) { if(!width80) { - bitmap.pix32(res_y, res_x*2+0) = palette[pen]; - bitmap.pix32(res_y, res_x*2+1) = palette[pen]; + bitmap.pix(res_y, res_x*2+0) = palette[pen]; + bitmap.pix(res_y, res_x*2+1) = palette[pen]; } else - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/mz6500.cpp b/src/mame/drivers/mz6500.cpp index 76ba97cf42a..464cb888dd3 100644 --- a/src/mame/drivers/mz6500.cpp +++ b/src/mame/drivers/mz6500.cpp @@ -50,19 +50,14 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int gfx[3]; - u8 i,pen; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + int const gfx[3] = { m_vram[(address + 0x00000) >> 1], m_vram[(address + 0x10000) >> 1], m_vram[(address + 0x20000) >> 1] }; - gfx[0] = m_vram[(address + 0x00000) >> 1]; - gfx[1] = m_vram[(address + 0x10000) >> 1]; - gfx[2] = m_vram[(address + 0x20000) >> 1]; - - for(i=0; i<16; i++) + for(u8 i=0; i<16; i++) { - pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); + u8 pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); - bitmap.pix32(y, x + i) = palette[pen]; + bitmap.pix(y, x + i) = palette[pen]; } } diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp index a033f08bb83..8551fc700c6 100644 --- a/src/mame/drivers/nakajies.cpp +++ b/src/mame/drivers/nakajies.cpp @@ -685,7 +685,7 @@ uint32_t nakajies_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int px=0; px<8; px++) { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + bitmap.pix(y, (x * 8) + px) = BIT(data, 7); data <<= 1; } } diff --git a/src/mame/drivers/namcos12.cpp b/src/mame/drivers/namcos12.cpp index 8a90913b3d5..29648ffb258 100644 --- a/src/mame/drivers/namcos12.cpp +++ b/src/mame/drivers/namcos12.cpp @@ -870,8 +870,8 @@ Type 2 SYSTEM12 COH716 PCB 8661962301 (8661972301) (manufactured by Namco, probably in 2001, under license from Sony) Component layout is identical to COH-700 PCB with some updated components. Generally - it has 2X the amount of video RAM and 4X the amount of program RAM that the COH-700 PCB has. - KM4132G271Q replaced with OKI 54V25632A 256k x 32-bit x 2 Banks SGRAM (x2, QFP100) + it has 4X the amount of program RAM that the COH-700 PCB has. + KM4132G271Q replaced with OKI 54V25632A 128k x 32-bit x 2 Banks SGRAM (x2, QFP100) KM416V1204 replaced with Samsung Electronics K4E6416120D 4M x16 EDO DRAM (x2, TSOP44) Updated Sony CXD8561CQ GPU (QFP208) Updated Sony CXD8606BQ R3000A-based CPU (QFP208) @@ -1761,11 +1761,11 @@ void namcos12_state::coh700(machine_config &config) /* basic machine hardware */ CXD8661R(config, m_maincpu, XTAL(100'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &namcos12_state::namcos12_map); - m_maincpu->subdevice<ram_device>("ram")->set_default_size("4M"); + m_maincpu->subdevice<ram_device>("ram")->set_default_size("4M"); // 2 KM416V1204s m_maincpu->subdevice<psxdma_device>("dma")->install_read_handler(5, psxdma_device::read_delegate(&namcos12_state::namcos12_rom_read, this)); /* video hardware */ - CXD8654Q(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); + CXD8654Q(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); // 2 KM4132G271Qs SCREEN(config, "screen", SCREEN_TYPE_RASTER).screen_vblank().set(FUNC(namcos12_state::namcos12_sub_irq)); } @@ -1777,11 +1777,11 @@ void namcos12_state::coh716(machine_config &config) /* basic machine hardware */ CXD8606BQ(config, m_maincpu, XTAL(100'000'000)); m_maincpu->set_addrmap(AS_PROGRAM, &namcos12_state::namcos12_map); - m_maincpu->subdevice<ram_device>("ram")->set_default_size("16M"); + m_maincpu->subdevice<ram_device>("ram")->set_default_size("16M"); // 2 K4E6416120Ds m_maincpu->subdevice<psxdma_device>("dma")->install_read_handler(5, psxdma_device::read_delegate(&namcos12_state::namcos12_rom_read, this)); /* video hardware */ - CXD8561CQ(config, "gpu", XTAL(53'693'175), 0x400000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); + CXD8561CQ(config, "gpu", XTAL(53'693'175), 0x200000, subdevice<psxcpu_device>("maincpu")).set_screen("screen"); // 2 54V25632As SCREEN(config, "screen", SCREEN_TYPE_RASTER).screen_vblank().set(FUNC(namcos12_state::namcos12_sub_irq)); } diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index ee8177e023d..359c646a822 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -433,20 +433,19 @@ uint16_t namcos21_state::winrun_gpu_videoram_r(offs_t offset) void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_gpu_videoram.get(); + uint8_t const *const videoram = m_gpu_videoram.get(); //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.top(),cliprect.bottom(),m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]); - int yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; - int xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; - int base = 0x1000+0x100*(m_winrun_color&0xf); - int sx,sy; - for( sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) + int const yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; + int const xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; + int const base = 0x1000+0x100*(m_winrun_color&0xf); + for( int sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) { - const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; - uint16_t *pDest = &bitmap.pix16(sy); - for( sx=cliprect.left(); sx<=cliprect.right(); sx++ ) + uint8_t const *const pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; + uint16_t *const pDest = &bitmap.pix(sy); + for( int sx=cliprect.left(); sx<=cliprect.right(); sx++ ) { - int pen = pSource[(sx+xscroll) & 0x1ff]; + int const pen = pSource[(sx+xscroll) & 0x1ff]; switch( pen ) { case 0xff: diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index ca4b2eda839..12d30f9fe01 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -2060,16 +2060,16 @@ void namcos23_renderer::render_scanline(int32_t scanline, const extent_t& extent float u = extent.param[1].start; float v = extent.param[2].start; float l = extent.param[3].start; - float dw = extent.param[0].dpdx; - float du = extent.param[1].dpdx; - float dv = extent.param[2].dpdx; - float dl = extent.param[3].dpdx; + const float dw = extent.param[0].dpdx; + const float du = extent.param[1].dpdx; + const float dv = extent.param[2].dpdx; + const float dl = extent.param[3].dpdx; - uint32_t *img = &object.bitmap->pix32(scanline, extent.startx); + uint32_t *img = &object.bitmap->pix(scanline, extent.startx); for(int x = extent.startx; x < extent.stopx; x++) { - float z = w ? 1/w : 0; - uint32_t pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z); + const float z = w ? 1/w : 0; + const uint32_t pcol = rd.texture_lookup(*rd.machine, rd.pens, u*z, v*z); float ll = l*z; *img = (light(pcol >> 16, ll) << 16) | (light(pcol >> 8, ll) << 8) | light(pcol, ll); diff --git a/src/mame/drivers/nanos.cpp b/src/mame/drivers/nanos.cpp index 792a3cc7053..1adfc64ad2f 100644 --- a/src/mame/drivers/nanos.cpp +++ b/src/mame/drivers/nanos.cpp @@ -264,8 +264,7 @@ INPUT_PORTS_END uint32_t nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // static uint8_t framecnt=0; - uint8_t gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; // framecnt++; @@ -273,13 +272,14 @@ uint32_t nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { + uint8_t gfx; if (ra < 8) { - uint8_t chr = m_vram[x]; + uint8_t const chr = m_vram[x]; /* get pattern of pixels for that character scanline */ gfx = m_p_chargen[(chr<<3) | ra ]; diff --git a/src/mame/drivers/ncd68k.cpp b/src/mame/drivers/ncd68k.cpp index ecfeca15ddf..566ebcea5d0 100644 --- a/src/mame/drivers/ncd68k.cpp +++ b/src/mame/drivers/ncd68k.cpp @@ -210,7 +210,7 @@ u32 ncd16_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect { for (unsigned y = 0; y < 1024; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1024 / 8; x++) { u8 const pixels = m_vram->read(BYTE_XOR_BE(y * (1024 / 8) + x)); @@ -227,7 +227,7 @@ u32 ncd17c_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rec { for (unsigned y = 0; y < 768; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1024; x++) { u8 const pixels = m_vram->read((y * 1024) + BYTE4_XOR_BE(x)); @@ -242,7 +242,7 @@ u32 ncd19_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect { for (unsigned y = 0; y < 1024; y++) { - u32 *scanline = &bitmap.pix32(y); + u32 *scanline = &bitmap.pix(y); for (unsigned x = 0; x < 1280/8; x++) { u8 const pixels = m_vram->read((y * (2048/8)) + BYTE4_XOR_BE(x)); diff --git a/src/mame/drivers/nes_vt.cpp b/src/mame/drivers/nes_vt.cpp index 130e21cdeae..324ec787eee 100644 --- a/src/mame/drivers/nes_vt.cpp +++ b/src/mame/drivers/nes_vt.cpp @@ -124,6 +124,9 @@ public: void vt_external_space_map_1mbyte(address_map& map); void vt_external_space_map_512kbyte(address_map& map); + void nes_vt_1mb_majkon(machine_config& config); + void vt_external_space_map_1mbyte_majkon(address_map& map); + void init_protpp(); protected: @@ -140,7 +143,7 @@ public: void nes_vt_vh2009(machine_config& config); void nes_vt_vh2009_1mb(machine_config& config); - void nes_vt_vh2009_2mb_alt(machine_config& config); + void nes_vt_vh2009_2mb(machine_config& config); void nes_vt_vh2009_4mb(machine_config& config); void nes_vt_vh2009_8mb(machine_config& config); @@ -368,8 +371,6 @@ public: void nes_vt_vg_8mb(machine_config& config); void nes_vt_vg_16mb(machine_config& config); - - void nes_vt_vg_1mb_majkon(machine_config& config); void nes_vt_fp(machine_config& config); void nes_vt_fp_16mb(machine_config& config); void nes_vt_fp_32mb(machine_config& config); @@ -481,6 +482,12 @@ void nes_vt_swap_op_d5_d6_state::vt_external_space_map_senwld_512kbyte(address_m map(0x0180000, 0x01fffff).r(FUNC(nes_vt_swap_op_d5_d6_state::vt_rom_r)); } +void nes_vt_state::vt_external_space_map_1mbyte_majkon(address_map &map) +{ + map(0x0000000, 0x00fffff).mirror(0x1f00000).r(FUNC(nes_vt_state::vt_rom_r)); + map(0x1400000, 0x1401fff).ram(); // rush'n attack writes to chr space, after setting the program and character outer bank to a mirror, is the correct way to handle it? +} + // bitboy is 2 16Mbyte banks uint8_t nes_vt_cy_state::vt_rom_banked_r(offs_t offset) { @@ -1117,13 +1124,6 @@ void nes_vt_hh_state::nes_vt_vg_16mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_16mbyte); } -void nes_vt_hh_state::nes_vt_vg_1mb_majkon(machine_config &config) -{ - nes_vt_dg(config); - m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_1mbyte); - m_soc->force_raster_timing_hack(); -} - // New mystery handheld architecture, VTxx derived void nes_vt_hh_state::nes_vt_hh(machine_config &config) @@ -1159,6 +1159,16 @@ void nes_vt_hh_state::nes_vt_hh_4mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_hh_state::vt_external_space_map_4mbyte); } + +void nes_vt_state::nes_vt_1mb_majkon(machine_config& config) +{ + NES_VT_SOC(config, m_soc, NTSC_APU_CLOCK); + configure_soc(m_soc); + m_soc->set_addrmap(AS_PROGRAM, &nes_vt_state::vt_external_space_map_1mbyte_majkon); + m_soc->force_raster_timing_hack(); +} + + static INPUT_PORTS_START( nes_vt ) PORT_START("IO0") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("A") @@ -1377,7 +1387,7 @@ void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_1mb(machine_config& config) m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_1mbyte); } -void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_2mb_alt(machine_config& config) +void nes_vt_swap_op_d5_d6_state::nes_vt_vh2009_2mb(machine_config& config) { nes_vt_vh2009(config); m_soc->set_addrmap(AS_PROGRAM, &nes_vt_swap_op_d5_d6_state::vt_external_space_map_2mbyte); @@ -2190,7 +2200,7 @@ CONS( 2005, ablpinb, 0, 0, nes_vt_pal_2mb, ablpinb, nes_vt_ablpinb_state, e CONS( 2004, sporzpp, 0, 0, nes_vt_waixing_alt_4mb_sporzpp, sporzpp, nes_vt_waixing_alt_sporzpp_state, empty_init, "Macro Winners", "Game Sporz Wireless Duet Play Ping-Pong", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // has some longer than expected delays when sounds should play on the Boxing part, but NES hacks are all functional CONS( 2004, sporzbx, 0, 0, nes_vt_waixing_alt_4mb_sporzpp, sporzpp, nes_vt_waixing_alt_sporzpp_state, empty_init, "Macro Winners", "Game Sporz Wireless Boxing", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -// has some longer than expected delays when sounds should play on the Tennis part, but NES hacks are all functional +// has some longer than expected delays when sounds should play on the Tennis part, but NES hacks are all functional, US version is sold in DreamGear branded box. CONS( 2004, sporztn, 0, 0, nes_vt_pal_4mb, sporzpp, nes_vt_wldsoctv_state, empty_init, "Macro Winners (Play Vision license)", "Wireless Tennis (PAL, Play Vision)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // missing PCM audio, but regular APU SFX work CONS( 200?, wldsoctv, 0, 0, nes_vt_pal_4mb, nes_vt, nes_vt_wldsoctv_state, empty_init, "Taikee", "World Soccer TV Game 10-in-1 (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) @@ -2204,7 +2214,7 @@ CONS( 200?, mc_dgear, 0, 0, nes_vt_4mb, nes_vt, nes_vt_state, empty_init, // all games work OK except Frogger which has serious graphical issues CONS( 2006, vgtablet, 0, 0, nes_vt_vg_4mb_rasterhack, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products (licensed by Konami)", "VG Pocket Tablet (VG-4000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // raster timing for Frogger needs a hack // There is a 2004 Majesco Frogger "TV game" that appears to contain the same version of Frogger as above but with no other games, so probably fits here. -CONS( 2004, majkon, 0, 0, nes_vt_vg_1mb_majkon, nes_vt, nes_vt_hh_state, empty_init, "Majesco (licensed from Konami)", "Konami Collector's Series Arcade Advanced", MACHINE_NOT_WORKING ) // raster timing for Frogger needs a hack, Green Beret has other serious issues +CONS( 2004, majkon, 0, 0, nes_vt_1mb_majkon, nes_vt, nes_vt_state, empty_init, "Majesco (licensed from Konami)", "Konami Collector's Series Arcade Advanced", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // raster timing for Frogger needs a hack, Rush'n Attack also has raster timing issues on the status bar split CONS( 200?, majgnc, 0, 0, nes_vt_vg_1mb_majgnc, majgnc, nes_vt_vg_1mb_majgnc_state, empty_init, "Majesco", "Golden Nugget Casino", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) @@ -2226,22 +2236,22 @@ CONS( 200?, timetp36, 0, 0, nes_vt_pal_4mb, timetp36, nes_vt_timetp36_state, CONS( 200?, timetp7, 0, 0, nes_vt_pal_2mb, timetp36, nes_vt_timetp36_state, empty_init, "TimeTop", "Super Game 7-in-1 (TimeTop SuperGame) (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +// Runs fine, non-sport 121 in 1 games perfect, but minor graphical issues in +// sport games, also no sound in menu or sport games due to missing PCM +// emulation +CONS( 200?, dgun2500, 0, 0, nes_vt_dg_baddma_16mb, nes_vt, nes_vt_dg_state, empty_init, "dreamGEAR", "dreamGEAR Wireless Motion Control with 130 games (DGUN-2500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) + // this is VT09 based CONS( 2009, cybar120, 0, 0, nes_vt_vg_16mb, nes_vt, nes_vt_hh_state, empty_init, "Defender", "Defender M2500P 120-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -CONS( 2005, vgpocket, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket (VG-2000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // Butterfly Catch (same game as Insect Chase in polmega) is broken +CONS( 2005, vgpocket, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket (VG-2000)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) CONS( 200?, vgpmini, 0, 0, nes_vt_vg_4mb, nes_vt, nes_vt_hh_state, empty_init, "Performance Designed Products", "VG Pocket Mini (VG-1500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // VG Pocket Max (VG-2500) (blue case, 75 games) // VG Pocket Max (VG-3000) (white case, 75 games) (does the game selection differ, or only the case?) // VG Pocket Caplet is SunPlus hardware instead, see spg2xx_lexibook.cpp -// Runs fine, non-sport 121 in 1 games perfect, but minor graphical issues in -// sport games, also no sound in menu or sport games due to missing PCM -// emulation -CONS( 200?, dgun2500, 0, 0, nes_vt_dg_baddma_16mb, nes_vt, nes_vt_dg_state, empty_init, "dreamGEAR", "dreamGEAR Wireless Motion Control with 130 games (DGUN-2500)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND) - // CPU die is marked 'VH2009' There's also a 62256 RAM chip on the PCB, some scrambled opcodes -CONS( 2004, polmega, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Polaroid", "Megamax GPD001SDG", MACHINE_NOT_WORKING ) // Insect Chase is broken -CONS( 2004, vsmaxx17, 0, 0, nes_vt_vh2009_2mb_alt, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario", "Vs. Maxx 17-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // from a Green unit, '17 Classic & Racing Game' +CONS( 2004, polmega, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Polaroid", "TV MegaMax active power game system 30-in-1 (MegaMax GPD001SDG)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) +CONS( 2004, vsmaxx17, 0, 0, nes_vt_vh2009_2mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "Senario", "Vs. Maxx 17-in-1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // from a Green unit, '17 Classic & Racing Game' CONS( 200?, silv35, 0, 0, nes_vt_vh2009_4mb, nes_vt, nes_vt_swap_op_d5_d6_state, empty_init, "SilverLit", "35 in 1 Super Twins", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) // die is marked as VH2009, as above, but no scrambled opcodes here CONS( 201?, techni4, 0, 0, nes_vt_pal_2mb, nes_vt, nes_vt_state, empty_init, "Technigame", "Technigame Super 4-in-1 Sports (PAL)", MACHINE_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/nexus3d.cpp b/src/mame/drivers/nexus3d.cpp index a0bfc095328..81c218bb886 100644 --- a/src/mame/drivers/nexus3d.cpp +++ b/src/mame/drivers/nexus3d.cpp @@ -97,14 +97,14 @@ void nexus3d_state::video_start() uint32_t nexus3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *fbram = reinterpret_cast<uint16_t *>(m_fbram.target()); - const int width = 640; + uint16_t const *const fbram = reinterpret_cast<uint16_t *>(m_fbram.target()); + int const width = 640; - uint16_t *visible = fbram + (m_screen->frame_number() & 1) * (0x96000/2); + uint16_t const *const visible = fbram + (m_screen->frame_number() & 1) * (0x96000/2); uint32_t const dx = cliprect.left(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) - std::copy_n(&visible[(y * width) + dx], width, &bitmap.pix16(y, dx)); + std::copy_n(&visible[(y * width) + dx], width, &bitmap.pix(y, dx)); return 0; } diff --git a/src/mame/drivers/ngen.cpp b/src/mame/drivers/ngen.cpp index de4ee86a914..e0a18155ead 100644 --- a/src/mame/drivers/ngen.cpp +++ b/src/mame/drivers/ngen.cpp @@ -768,9 +768,9 @@ MC6845_UPDATE_ROW( ngen_state::crtc_update_row ) for(int z=0;z<9;z++) { if(BIT(m_fontram.read16(ch*16+ra),8-z)) - bitmap.pix32(y,x+z) = rgb_t(0,0xff,0); + bitmap.pix(y,x+z) = rgb_t(0,0xff,0); else - bitmap.pix32(y,x+z) = rgb_t(0,0,0); + bitmap.pix(y,x+z) = rgb_t(0,0,0); } } } diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp index 99b2428e3f1..8acac8fd461 100644 --- a/src/mame/drivers/nightgal.cpp +++ b/src/mame/drivers/nightgal.cpp @@ -175,14 +175,12 @@ void nightgal_state::video_start() uint32_t nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x); - uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x); + uint16_t *dst = &m_tmp_bitmap->pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint32_t srcpix = *src++; *dst++ = m_palette->pen((srcpix & 0xf) | m_pal_bank); diff --git a/src/mame/drivers/nightmare.cpp b/src/mame/drivers/nightmare.cpp index 5ea1c4ac209..5dda8921429 100644 --- a/src/mame/drivers/nightmare.cpp +++ b/src/mame/drivers/nightmare.cpp @@ -369,9 +369,9 @@ uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_ // combine two buffers (additive?) for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *const bitmap1 = &m_vdc2->get_bitmap().pix32(y); - uint32_t *const bitmap2 = &m_vdc->get_bitmap().pix32(y); - uint32_t *dst = &bitmap.pix32(y); + uint32_t const *const bitmap1 = &m_vdc2->get_bitmap().pix(y); + uint32_t const *const bitmap2 = &m_vdc->get_bitmap().pix(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -379,9 +379,9 @@ uint32_t nightmare_state::screen_update_nightmare(screen_device &screen, bitmap_ uint32_t p2 = bitmap2[x]; uint32_t result = 0; - for(int shift=0; shift<32;shift+=8) + for (int shift=0; shift<32;shift+=8) { - uint32_t data = ((p2>>shift)&0xff)+((p1>>shift)&0xff); + uint32_t const data = ((p2>>shift)&0xff)+((p1>>shift)&0xff); result|=((data>0xff)?0xff:data)<<shift; } dst[x]=result; diff --git a/src/mame/drivers/ninjaw.cpp b/src/mame/drivers/ninjaw.cpp index 3cff502baf7..1a6c4e58760 100644 --- a/src/mame/drivers/ninjaw.cpp +++ b/src/mame/drivers/ninjaw.cpp @@ -618,7 +618,7 @@ protected: virtual void device_start(); // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples); + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state @@ -654,11 +654,12 @@ void subwoofer_device::device_start() } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- -void subwoofer_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void subwoofer_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { + outputs[0].fill(0); } diff --git a/src/mame/drivers/nmg5.cpp b/src/mame/drivers/nmg5.cpp index a657a5641b8..c887aaa54f1 100644 --- a/src/mame/drivers/nmg5.cpp +++ b/src/mame/drivers/nmg5.cpp @@ -315,7 +315,7 @@ uint8_t nmg5_state::pixmap_r(offs_t offset) int const sy = offset >> 8; int const sx = (offset & 0xff) << 1; - return ((m_pixmap->pix16(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix16(sy & 0xff, sx | 1) & 0xf); + return ((m_pixmap->pix(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix(sy & 0xff, sx | 1) & 0xf); } void nmg5_state::pixmap_w(offs_t offset, uint8_t data) @@ -323,8 +323,8 @@ void nmg5_state::pixmap_w(offs_t offset, uint8_t data) int const sy = offset >> 8; int const sx = (offset & 0xff) << 1; - m_pixmap->pix16(sy & 0xff, sx & ~1) = 0x300 + ((data & 0xf0) >> 4); - m_pixmap->pix16(sy & 0xff, sx | 1) = 0x300 + (data & 0x0f); + m_pixmap->pix(sy & 0xff, sx & ~1) = 0x300 + ((data & 0xf0) >> 4); + m_pixmap->pix(sy & 0xff, sx | 1) = 0x300 + (data & 0x0f); } template<int Layer> diff --git a/src/mame/drivers/nokia_3310.cpp b/src/mame/drivers/nokia_3310.cpp index 352513d8cc2..0007ecba6ed 100644 --- a/src/mame/drivers/nokia_3310.cpp +++ b/src/mame/drivers/nokia_3310.cpp @@ -422,7 +422,7 @@ PCD8544_SCREEN_UPDATE(noki3310_state::pcd8544_screen_update) for (int y = 0; y < 8; y++) { int p = BIT(gfx, y); - bitmap.pix16(r*8 + y, x) = p ^ inv; + bitmap.pix(r*8 + y, x) = p ^ inv; } } } diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index 89b2ed4e811..abf39db27fb 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -282,28 +282,23 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit { // have to figure out what resolution we're drawing to here and draw appropriately to screen // code borrowed/stolen from video/mac.cpp - uint32_t video_base; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = (m_DispAddr << 3)&0x1FFFF; + uint32_t const video_base = (m_DispAddr << 3) & 0x1ffff; #ifdef DEBUG_VIDEO logerror("Video Base = 0x%05x\n", video_base); #endif - const uint16_t *video_ram_field1 = &m_mainram[video_base/2]; - const uint16_t *video_ram_field2 = &m_mainram[(video_base+0x4B00)/2]; + uint16_t const *video_ram_field1 = &m_mainram[video_base / 2]; + uint16_t const *video_ram_field2 = &m_mainram[(video_base + 0x4b00) / 2]; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - if ((y&1)==0) word = *(video_ram_field1++); else word = *(video_ram_field2++); - for (b = 0; b < 16; b++) + uint16_t const word = *((y & 1) ? video_ram_field2 : video_ram_field1)++; + for (int b = 0; b < 16; b++) { - line[x + b] = (word >> (15 - b)) & 0x0001; + line[x + b] = BIT(word, 15 - b); } } } @@ -312,15 +307,15 @@ uint32_t notetaker_state::screen_update(screen_device &screen, bitmap_ind16 &bit void notetaker_state::IPConReg_w(uint16_t data) { - m_BootSeqDone = (data&0x80)?1:0; - m_ProcLock = (data&0x40)?1:0; // bus lock for this processor (hold other processor in wait state) - m_CharCtr = (data&0x20)?1:0; // battery charge control (incorrectly called 'Char counter' in source code) - m_DisableROM = (data&0x10)?1:0; // disable rom at 0000-0fff - m_CorrOn_q = (data&0x08)?1:0; // CorrectionOn (ECC correction enabled); also LedInd5 - m_LedInd6 = (data&0x04)?1:0; - m_LedInd7 = (data&0x02)?1:0; - m_LedInd8 = (data&0x01)?1:0; - popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", (data&0x04)>>2, (data&0x08)>>3, (data&0x02)>>1, (data&0x01)); // cr1 and 2 are in the reverse order as expected, according to the schematic + m_BootSeqDone = BIT(data, 7); + m_ProcLock = BIT(data, 6); // bus lock for this processor (hold other processor in wait state) + m_CharCtr = BIT(data, 5); // battery charge control (incorrectly called 'Char counter' in source code) + m_DisableROM = BIT(data, 4); // disable rom at 0000-0fff + m_CorrOn_q = BIT(data, 3); // CorrectionOn (ECC correction enabled); also LedInd5 + m_LedInd6 = BIT(data, 2); + m_LedInd7 = BIT(data, 1); + m_LedInd8 = BIT(data, 0); + popmessage("LEDS: CR1: %d, CR2: %d, CR3: %d, CR4: %d", BIT(data, 2), BIT(data, 3), BIT(data, 1), BIT(data, 0)); // cr1 and 2 are in the reverse order as expected, according to the schematic } /* handlers for the two system hd6402s (ay-5-1013 equivalent) */ diff --git a/src/mame/drivers/novag_diablo.cpp b/src/mame/drivers/novag_diablo.cpp index 0c464c6ee2f..2f39f863df3 100644 --- a/src/mame/drivers/novag_diablo.cpp +++ b/src/mame/drivers/novag_diablo.cpp @@ -142,7 +142,7 @@ HD44780_PIXEL_UPDATE(diablo_state::lcd_pixel_update) if (line < 2 && pos < 8) { // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/novag_sexpert.cpp b/src/mame/drivers/novag_sexpert.cpp index c4eb02fd318..a983ba9567f 100644 --- a/src/mame/drivers/novag_sexpert.cpp +++ b/src/mame/drivers/novag_sexpert.cpp @@ -217,7 +217,7 @@ HD44780_PIXEL_UPDATE(sexpert_state::lcd_pixel_update) if (line < 2 && pos < 8) { // internal: (8+8)*1, external: 1*16 - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/nyny.cpp b/src/mame/drivers/nyny.cpp index 4f86a5a9cb1..957e26e405b 100644 --- a/src/mame/drivers/nyny.cpp +++ b/src/mame/drivers/nyny.cpp @@ -316,7 +316,7 @@ MC6845_UPDATE_ROW( nyny_state::crtc_update_row ) else color = bit2 ? color2 : 0; - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); x += 1; } @@ -342,7 +342,7 @@ MC6845_END_UPDATE( nyny_state::crtc_end_update ) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* check if the star status */ - if (m_star_enable && (bitmap.pix32(y, x) == m_palette->pen_color(0)) && + if (m_star_enable && (bitmap.pix(y, x) == m_palette->pen_color(0)) && ((m_star_shift_reg & 0x80ff) == 0x00ff) && (((y & 0x01) ^ m_flipscreen) ^ (((x & 0x08) >> 3) ^ m_flipscreen))) { @@ -350,7 +350,7 @@ MC6845_END_UPDATE( nyny_state::crtc_end_update ) ((m_star_shift_reg & 0x0400) >> 9) | /* G */ ((m_star_shift_reg & 0x1000) >> 10); /* B */ - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); } if (delay_counter == 0) diff --git a/src/mame/drivers/octopus.cpp b/src/mame/drivers/octopus.cpp index 05d2d414baf..b33a13202de 100644 --- a/src/mame/drivers/octopus.cpp +++ b/src/mame/drivers/octopus.cpp @@ -863,7 +863,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(octopus_state::display_pixels) data = 0xff; } for (int z=0;z<8;z++) - bitmap.pix32(y,x + z) = BIT(data,z) ? fg : bg; + bitmap.pix(y,x + z) = BIT(data,z) ? fg : bg; } } diff --git a/src/mame/drivers/odyssey.cpp b/src/mame/drivers/odyssey.cpp index 628fe45caa9..312bd67e69c 100644 --- a/src/mame/drivers/odyssey.cpp +++ b/src/mame/drivers/odyssey.cpp @@ -85,7 +85,7 @@ private: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void odyssey_map(address_map &map); }; @@ -93,7 +93,7 @@ void odyssey_state::video_start() { } -uint32_t odyssey_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +u32 odyssey_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; } diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index 6aabae3acc8..da3a27a003b 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -78,8 +78,8 @@ TODO: - 4in1 and musician are not supposed to work on g7400, but work fine on MAME, caused by bus conflict or because they write to P2? - verify odyssey3 cpu/video clocks -- odyssey3 keyboard layout is not the same as g7400, but there is no software - to test the scancodes +- problems with natural keyboard: videopacp has two enter keys, odyssey3 has + alternate inputs for -, =, + - partial screen updates aren't shown when using MAME's debugger, this is caused by a forced full screen update and a reset_partial_updates in emu/video.cpp. For the same reason, collision detection also won't work properly when stepping @@ -142,9 +142,9 @@ protected: required_device<screen_device> m_screen; required_device<o2_cart_slot_device> m_cart; - uint8_t m_ram[0x80]; - uint8_t m_p1 = 0xff; - uint8_t m_p2 = 0xff; + u8 m_ram[0x80]; + u8 m_p1 = 0xff; + u8 m_p2 = 0xff; DECLARE_READ_LINE_MEMBER(t1_read); @@ -156,21 +156,21 @@ protected: required_ioport_array<8> m_keyboard; required_ioport_array<2> m_joysticks; - virtual uint8_t io_read(offs_t offset); - virtual void io_write(offs_t offset, uint8_t data); - uint8_t bus_read(); - void p1_write(uint8_t data); - uint8_t p2_read(); - void p2_write(uint8_t data); + virtual u8 io_read(offs_t offset); + virtual void io_write(offs_t offset, u8 data); + u8 bus_read(); + void p1_write(u8 data); + u8 p2_read(); + void p2_write(u8 data); private: - 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); }; -class videopacp_state : public odyssey2_state +class vpp_state : public odyssey2_state { public: - videopacp_state(const machine_config &mconfig, device_type type, const char *tag) : + vpp_state(const machine_config &mconfig, device_type type, const char *tag) : odyssey2_state(mconfig, type, tag), m_i8243(*this, "i8243"), m_ef934x(*this, "ef934x") @@ -183,26 +183,26 @@ public: protected: virtual void machine_start() override; - virtual uint8_t io_read(offs_t offset) override; - virtual void io_write(offs_t offset, uint8_t data) override; + virtual u8 io_read(offs_t offset) override; + virtual void io_write(offs_t offset, u8 data) override; private: required_device<i8243_device> m_i8243; required_device<ef9340_1_device> m_ef934x; - 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 p2_write(uint8_t data); - uint8_t io_vpp(offs_t offset, uint8_t data); - template<int P> void i8243_port_w(uint8_t data); + void p2_write(u8 data); + u8 io_vpp(offs_t offset, u8 data); + template<int P> void i8243_port_w(u8 data); inline offs_t ef934x_extram_address(offs_t offset); - uint8_t ef934x_extram_r(offs_t offset); - void ef934x_extram_w(offs_t offset, uint8_t data); + u8 ef934x_extram_r(offs_t offset); + void ef934x_extram_w(offs_t offset, u8 data); - uint8_t m_mix_i8244 = 0xff; - uint8_t m_mix_ef934x = 0xff; - uint8_t m_ef934x_extram[0x800]; + u8 m_mix_i8244 = 0xff; + u8 m_mix_ef934x = 0xff; + u8 m_ef934x_extram[0x800]; }; void odyssey2_state::machine_start() @@ -214,7 +214,7 @@ void odyssey2_state::machine_start() save_item(NAME(m_p2)); } -void videopacp_state::machine_start() +void vpp_state::machine_start() { odyssey2_state::machine_start(); memset(m_ef934x_extram, 0, sizeof(m_ef934x_extram)); @@ -259,7 +259,7 @@ void odyssey2_state::odyssey2_palette(palette_device &palette) const } -uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_i8244->screen_update(screen, bitmap, cliprect); @@ -268,12 +268,12 @@ uint32_t odyssey2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // apply external LUM setting for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix16(y, x) |= lum; + bitmap.pix(y, x) |= lum; return 0; } -uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 vpp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { u8 lum = ~m_p1 >> 4 & 0x08; bitmap_ind16 *ef934x_bitmap = m_ef934x->get_bitmap(); @@ -288,8 +288,8 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit for (int x = clip.min_x; x <= clip.max_x; x++) { - uint16_t d = bitmap.pix16(y, x) & 7; - uint16_t e = ef934x_bitmap->pix16(y, x); + u16 d = bitmap.pix(y, x) & 7; + u16 e = ef934x_bitmap->pix(y, x); // i8244 decoder enable is masked with cartridge pin B bool en = (e & 8) || !m_cart->b_read(); @@ -302,12 +302,12 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit if (en && BIT(m_mix_i8244, d)) { // Use i8245 input - bitmap.pix16(y, x) |= lum; + bitmap.pix(y, x) |= lum; } else { // Use EF934x input - bitmap.pix16(y, x) = e | (i2 ? 8 : 0); + bitmap.pix(y, x) = e | (i2 ? 8 : 0); } } } @@ -321,7 +321,7 @@ uint32_t videopacp_state::screen_update(screen_device &screen, bitmap_ind16 &bit I/O ******************************************************************************/ -uint8_t odyssey2_state::io_read(offs_t offset) +u8 odyssey2_state::io_read(offs_t offset) { u8 data = m_cart->io_read(offset); if (!(m_p1 & 0x10) && ~offset & 0x80) @@ -333,7 +333,7 @@ uint8_t odyssey2_state::io_read(offs_t offset) return data; } -void odyssey2_state::io_write(offs_t offset, uint8_t data) +void odyssey2_state::io_write(offs_t offset, u8 data) { if (!(m_p1 & 0x40)) { @@ -349,7 +349,7 @@ void odyssey2_state::io_write(offs_t offset, uint8_t data) // 8048 ports -void odyssey2_state::p1_write(uint8_t data) +void odyssey2_state::p1_write(u8 data) { // LUM changed if ((m_p1 ^ data) & 0x80) @@ -359,7 +359,7 @@ void odyssey2_state::p1_write(uint8_t data) m_cart->write_p1(m_p1 & 0x13); } -uint8_t odyssey2_state::p2_read() +u8 odyssey2_state::p2_read() { u8 data = 0xff; @@ -374,13 +374,13 @@ uint8_t odyssey2_state::p2_read() return data; } -void odyssey2_state::p2_write(uint8_t data) +void odyssey2_state::p2_write(u8 data) { m_p2 = data; m_cart->write_p2(m_p2 & 0x0f); } -uint8_t odyssey2_state::bus_read() +u8 odyssey2_state::bus_read() { u8 data = 0xff; @@ -402,40 +402,40 @@ READ_LINE_MEMBER(odyssey2_state::t1_read) // G7400-specific -uint8_t videopacp_state::io_read(offs_t offset) +u8 vpp_state::io_read(offs_t offset) { u8 data = odyssey2_state::io_read(offset); return io_vpp(offset, data); } -void videopacp_state::io_write(offs_t offset, uint8_t data) +void vpp_state::io_write(offs_t offset, u8 data) { odyssey2_state::io_write(offset, data); io_vpp(offset, data); } -uint8_t videopacp_state::io_vpp(offs_t offset, uint8_t data) +u8 vpp_state::io_vpp(offs_t offset, u8 data) { if (!(m_p1 & 0x20)) { // A2 to R/W pin if (offset & 4) - data &= m_ef934x->ef9341_read( offset & 0x02, offset & 0x01 ); + data &= m_ef934x->ef9341_read(offset & 0x02, offset & 0x01); else - m_ef934x->ef9341_write( offset & 0x02, offset & 0x01, data ); + m_ef934x->ef9341_write(offset & 0x02, offset & 0x01, data); } return data; } -void videopacp_state::p2_write(uint8_t data) +void vpp_state::p2_write(u8 data) { odyssey2_state::p2_write(data); m_i8243->p2_w(m_p2 & 0x0f); } template<int P> -void videopacp_state::i8243_port_w(uint8_t data) +void vpp_state::i8243_port_w(u8 data) { // P4,P5: color mix I8244 side (IC674) // P6,P7: color mix EF9340 side (IC678) @@ -457,7 +457,7 @@ void videopacp_state::i8243_port_w(uint8_t data) // EF9341 extended RAM -offs_t videopacp_state::ef934x_extram_address(offs_t offset) +offs_t vpp_state::ef934x_extram_address(offs_t offset) { u8 latch = (offset >> 12 & 0x80) | (offset >> 4 & 0x7f); u16 address = (latch & 0x1f) | (offset << 9 & 0x200) | (latch << 3 & 0x400); @@ -468,12 +468,12 @@ offs_t videopacp_state::ef934x_extram_address(offs_t offset) return address | (offset << 4 & 0x60) | (latch << 2 & 0x180); } -uint8_t videopacp_state::ef934x_extram_r(offs_t offset) +u8 vpp_state::ef934x_extram_r(offs_t offset) { return m_ef934x_extram[ef934x_extram_address(offset)]; } -void videopacp_state::ef934x_extram_w(offs_t offset, uint8_t data) +void vpp_state::ef934x_extram_w(offs_t offset, u8 data) { m_ef934x_extram[ef934x_extram_address(offset)] = data; } @@ -502,7 +502,7 @@ void odyssey2_state::odyssey2_io(address_map &map) Input Ports ******************************************************************************/ -static INPUT_PORTS_START( odyssey2 ) +static INPUT_PORTS_START( o2 ) PORT_START("KEY.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') @@ -589,8 +589,8 @@ static INPUT_PORTS_START( odyssey2 ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Reset") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, odyssey2_state, reset_button, 0) INPUT_PORTS_END -static INPUT_PORTS_START( g7400 ) - PORT_INCLUDE( odyssey2 ) +static INPUT_PORTS_START( vpp ) + PORT_INCLUDE( o2 ) PORT_MODIFY("KEY.0") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 #") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('#') @@ -648,7 +648,7 @@ static INPUT_PORTS_START( g7400 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter _") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(10) PORT_CHAR('_') PORT_MODIFY("KEY.6") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ret") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ret") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(13) // clash with KEY.5 0x80 PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(": *") PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*') PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("| @") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('|') PORT_CHAR('@') @@ -664,6 +664,42 @@ static INPUT_PORTS_START( g7400 ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) INPUT_PORTS_END +static INPUT_PORTS_START( o3 ) + PORT_INCLUDE( vpp ) + + PORT_MODIFY("KEY.0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 )") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 @") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 ^") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 &") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&') + + PORT_MODIFY("KEY.1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 *") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 (") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + + PORT_MODIFY("KEY.4") + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + + PORT_MODIFY("KEY.5") + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clear") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + + PORT_MODIFY("KEY.6") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("] }") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("; :") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- _") PORT_CODE(KEYCODE_PGDN) // clash with KEY.5 0x01 + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("' \"") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('\"') + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= +") PORT_CODE(KEYCODE_PGUP) // clash with KEY.2 0x01 and KEY.5 0x08 + + PORT_MODIFY("KEY.7") + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_2) +INPUT_PORTS_END + /****************************************************************************** @@ -730,38 +766,38 @@ void odyssey2_state::videopacf(machine_config &config) } -void videopacp_state::g7400(machine_config &config) +void vpp_state::g7400(machine_config &config) { /* basic machine hardware */ I8048(config, m_maincpu, 5.911_MHz_XTAL); - m_maincpu->set_addrmap(AS_PROGRAM, &videopacp_state::odyssey2_mem); - m_maincpu->set_addrmap(AS_IO, &videopacp_state::odyssey2_io); - m_maincpu->p1_out_cb().set(FUNC(videopacp_state::p1_write)); - m_maincpu->p2_in_cb().set(FUNC(videopacp_state::p2_read)); - m_maincpu->p2_out_cb().set(FUNC(videopacp_state::p2_write)); - m_maincpu->bus_in_cb().set(FUNC(videopacp_state::bus_read)); + m_maincpu->set_addrmap(AS_PROGRAM, &vpp_state::odyssey2_mem); + m_maincpu->set_addrmap(AS_IO, &vpp_state::odyssey2_io); + m_maincpu->p1_out_cb().set(FUNC(vpp_state::p1_write)); + m_maincpu->p2_in_cb().set(FUNC(vpp_state::p2_read)); + m_maincpu->p2_out_cb().set(FUNC(vpp_state::p2_write)); + m_maincpu->bus_in_cb().set(FUNC(vpp_state::bus_read)); m_maincpu->t0_in_cb().set("cartslot", FUNC(o2_cart_slot_device::t0_read)); - m_maincpu->t1_in_cb().set(FUNC(videopacp_state::t1_read)); + m_maincpu->t1_in_cb().set(FUNC(vpp_state::t1_read)); m_maincpu->prog_out_cb().set(m_i8243, FUNC(i8243_device::prog_w)); /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_screen_update(FUNC(videopacp_state::screen_update)); + m_screen->set_screen_update(FUNC(vpp_state::screen_update)); m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); m_screen->set_palette("palette"); PALETTE(config, "palette", m_i8244, FUNC(i8244_device::i8244_palette), 16); I8243(config, m_i8243); - m_i8243->p4_out_cb().set(FUNC(videopacp_state::i8243_port_w<0>)); - m_i8243->p5_out_cb().set(FUNC(videopacp_state::i8243_port_w<1>)); - m_i8243->p6_out_cb().set(FUNC(videopacp_state::i8243_port_w<2>)); - m_i8243->p7_out_cb().set(FUNC(videopacp_state::i8243_port_w<3>)); + m_i8243->p4_out_cb().set(FUNC(vpp_state::i8243_port_w<0>)); + m_i8243->p5_out_cb().set(FUNC(vpp_state::i8243_port_w<1>)); + m_i8243->p6_out_cb().set(FUNC(vpp_state::i8243_port_w<2>)); + m_i8243->p7_out_cb().set(FUNC(vpp_state::i8243_port_w<3>)); EF9340_1(config, m_ef934x, (8.867_MHz_XTAL * 2) / 5, "screen"); m_ef934x->set_offsets(15, 5); - m_ef934x->read_exram().set(FUNC(videopacp_state::ef934x_extram_r)); - m_ef934x->write_exram().set(FUNC(videopacp_state::ef934x_extram_w)); + m_ef934x->read_exram().set(FUNC(vpp_state::ef934x_extram_r)); + m_ef934x->write_exram().set(FUNC(vpp_state::ef934x_extram_w)); I8245(config, m_i8244, (8.867_MHz_XTAL * 2) / 5); m_i8244->set_screen("screen"); @@ -776,7 +812,7 @@ void videopacp_state::g7400(machine_config &config) SOFTWARE_LIST(config, "cart_list").set_original("videopac").set_filter("VPP"); } -void videopacp_state::jo7400(machine_config &config) +void vpp_state::jo7400(machine_config &config) { g7400(config); @@ -785,7 +821,7 @@ void videopacp_state::jo7400(machine_config &config) m_ef934x->set_clock(3.5625_MHz_XTAL); } -void videopacp_state::odyssey3(machine_config &config) +void vpp_state::odyssey3(machine_config &config) { g7400(config); @@ -815,33 +851,33 @@ void videopacp_state::odyssey3(machine_config &config) ROM_START (videopac) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) + ROM_LOAD("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) ROM_END ROM_START (odyssey2) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) + ROM_LOAD("o2bios.rom", 0x0000, 0x0400, CRC(8016a315) SHA1(b2e1955d957a475de2411770452eff4ea19f4cee)) ROM_END ROM_START (videopacf) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("c52.rom", 0x0000, 0x0400, CRC(a318e8d6) SHA1(a6120aed50831c9c0d95dbdf707820f601d9452e)) + ROM_LOAD("c52.rom", 0x0000, 0x0400, CRC(a318e8d6) SHA1(a6120aed50831c9c0d95dbdf707820f601d9452e)) ROM_END ROM_START (videopacp) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("g7400.bin", 0x0000, 0x0400, CRC(e20a9f41) SHA1(5130243429b40b01a14e1304d0394b8459a6fbae)) + ROM_LOAD("g7400.bin", 0x0000, 0x0400, CRC(e20a9f41) SHA1(5130243429b40b01a14e1304d0394b8459a6fbae)) ROM_END ROM_START (jopac) ROM_REGION(0x0400,"maincpu",0) - ROM_LOAD ("jopac.bin", 0x0000, 0x0400, CRC(11647ca5) SHA1(54b8d2c1317628de51a85fc1c424423a986775e4)) + ROM_LOAD("jopac.bin", 0x0000, 0x0400, CRC(11647ca5) SHA1(54b8d2c1317628de51a85fc1c424423a986775e4)) ROM_END ROM_START (odyssey3) ROM_REGION(0x0400, "maincpu", 0) - ROM_LOAD ("odyssey3.bin", 0x0000, 0x0400, CRC(e2b23324) SHA1(0a38c5f2cea929d2fe0a23e5e1a60de9155815dc)) + ROM_LOAD("odyssey3.bin", 0x0000, 0x0400, CRC(e2b23324) SHA1(0a38c5f2cea929d2fe0a23e5e1a60de9155815dc)) ROM_END } // anonymous namespace @@ -852,11 +888,11 @@ ROM_END Drivers ******************************************************************************/ -// YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS -COMP( 1978, videopac, 0, 0, videopac, odyssey2, odyssey2_state, empty_init, "Philips", "Videopac G7000 (Europe)", MACHINE_SUPPORTS_SAVE ) -COMP( 1979, videopacf, videopac, 0, videopacf, odyssey2, odyssey2_state, empty_init, "Philips", "Videopac C52 (France)", MACHINE_SUPPORTS_SAVE ) -COMP( 1979, odyssey2, videopac, 0, odyssey2, odyssey2, odyssey2_state, empty_init, "Magnavox", "Odyssey 2 (US)", MACHINE_SUPPORTS_SAVE ) +// YEAR NAME PARENT CMP MACHINE INPUT STATE INIT COMPANY, FULLNAME, FLAGS +COMP( 1978, videopac, 0, 0, videopac, o2, odyssey2_state, empty_init, "Philips", "Videopac G7000 (Europe)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, videopacf, videopac, 0, videopacf, o2, odyssey2_state, empty_init, "Philips", "Videopac C52 (France)", MACHINE_SUPPORTS_SAVE ) +COMP( 1979, odyssey2, videopac, 0, odyssey2, o2, odyssey2_state, empty_init, "Magnavox", "Odyssey 2 (US)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, videopacp, 0, 0, g7400, g7400, videopacp_state, empty_init, "Philips", "Videopac+ G7400 (Europe)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, jopac, videopacp, 0, jo7400, g7400, videopacp_state, empty_init, "Philips (Brandt license)", "Jopac JO7400 (France)", MACHINE_SUPPORTS_SAVE ) -COMP( 1983, odyssey3, videopacp, 0, odyssey3, g7400, videopacp_state, empty_init, "Philips", "Odyssey 3 Command Center (US, prototype)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, videopacp, 0, 0, g7400, vpp, vpp_state, empty_init, "Philips", "Videopac+ G7400 (Europe)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, jopac, videopacp, 0, jo7400, vpp, vpp_state, empty_init, "Philips (Brandt license)", "Jopac JO7400 (France)", MACHINE_SUPPORTS_SAVE ) +COMP( 1983, odyssey3, videopacp, 0, odyssey3, o3, vpp_state, empty_init, "Philips", "Odyssey 3 Command Center (US, prototype)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp index 6ea860f4762..f024415038a 100644 --- a/src/mame/drivers/okean240.cpp +++ b/src/mame/drivers/okean240.cpp @@ -421,17 +421,14 @@ void okean240_state::machine_reset() u32 okean240_state::screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 gfx,ma; // ma must be 8bit - u16 x,y; - - for (y = 0; y < 256; y++) + for (u16 y = 0; y < 256; y++) { - ma = y + m_scroll; - u16 *p = &bitmap.pix16(y); + u8 const ma = y + m_scroll; // ma must be 8-bit + u16 *p = &bitmap.pix(y); - for (x = 0; x < 0x4000; x+=0x200) + for (u16 x = 0; x < 0x4000; x+=0x200) { - gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; + u8 const gfx = m_p_videoram[x|ma] | m_p_videoram[x|ma|0x100]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0); diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp index 82bc5696955..900f1f6960e 100644 --- a/src/mame/drivers/olyboss.cpp +++ b/src/mame/drivers/olyboss.cpp @@ -262,18 +262,15 @@ UPD3301_DRAW_CHARACTER_MEMBER( olyboss_state::olyboss_display_pixels ) data = m_vchrram[(data << 4) | lc]; else data = m_char_rom->base()[(data << 4) | lc]; - int i; //if (lc >= 8) return; if (csr) - { data = 0xff; - } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx * 8) + i) = color?0xffffff:0; + bitmap.pix(y, (sx * 8) + i) = color?0xffffff:0; data <<= 1; } } diff --git a/src/mame/drivers/ondra.cpp b/src/mame/drivers/ondra.cpp index aed29ede721..8b05048eeda 100644 --- a/src/mame/drivers/ondra.cpp +++ b/src/mame/drivers/ondra.cpp @@ -123,25 +123,24 @@ INPUT_CHANGED_MEMBER(ondra_state::nmi_button) u32 ondra_state::screen_update_ondra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 *r = m_ram->pointer(); + u8 const *const r = m_ram->pointer(); u8 code1=0,code2=0; - int y, x, b; int Vaddr = 0x2800; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - for (y = 127; y >=0; y--) + for (int y = 127; y >=0; y--) { if (m_video_enable) { code1 = r[0xd700 + Vaddr + 0x80]; code2 = r[0xd700 + Vaddr + 0x00]; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - bitmap.pix16(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; - bitmap.pix16(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; + bitmap.pix(2*y, x*8+b) = ((code1 << b) & 0x80) ? 1 : 0; + bitmap.pix(2*y+1, x*8+b) = ((code2 << b) & 0x80) ? 1 : 0; } Vaddr++; } diff --git a/src/mame/drivers/orao.cpp b/src/mame/drivers/orao.cpp index d6ec83ef9b3..65cd7f81a71 100644 --- a/src/mame/drivers/orao.cpp +++ b/src/mame/drivers/orao.cpp @@ -266,7 +266,7 @@ u32 orao_state::screen_update_orao(screen_device &screen, bitmap_ind16 &bitmap, u8 code = m_vram[addr++]; for (u8 b = 0; b < 8; b++) { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + bitmap.pix(y, horpos++) = (code >> b) & 0x01; } } } diff --git a/src/mame/drivers/oric.cpp b/src/mame/drivers/oric.cpp index 3fd07906bb4..803a2feb0dd 100644 --- a/src/mame/drivers/oric.cpp +++ b/src/mame/drivers/oric.cpp @@ -235,7 +235,7 @@ uint32_t oric_state::screen_update_oric(screen_device &screen, bitmap_rgb32 &bit uint32_t fgcol = m_palette->pen_color(7); uint32_t bgcol = m_palette->pen_color(0); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for(int x=0; x<40; x++) { // Lookup the byte and, if needed, the pattern data diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 467ab3c0b7d..a1cb78acae9 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -465,7 +465,7 @@ TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) if ( y < 240 ) { uint16_t row_addr = ( y / 10 ) * 128; - uint16_t *p = &m_bitmap.pix16(y); + uint16_t *const p = &m_bitmap.pix(y); uint8_t char_line = y % 10; for ( int x = 0; x < 80; x++ ) diff --git a/src/mame/drivers/othello.cpp b/src/mame/drivers/othello.cpp index b43707ae0c3..051dc56c002 100644 --- a/src/mame/drivers/othello.cpp +++ b/src/mame/drivers/othello.cpp @@ -132,9 +132,9 @@ private: MC6845_UPDATE_ROW( othello_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - const uint8_t *gfx = memregion("gfx")->base(); + uint8_t const *const gfx = memregion("gfx")->base(); for(int cx = 0; cx < x_count; ++cx) { @@ -143,7 +143,7 @@ MC6845_UPDATE_ROW( othello_state::crtc_update_row ) for(int x = 0; x < TILE_WIDTH; ++x) { - bitmap.pix32(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; + bitmap.pix(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; tmp >>= 4; } } diff --git a/src/mame/drivers/panicr.cpp b/src/mame/drivers/panicr.cpp index 564e3803310..d6db1e8f59d 100644 --- a/src/mame/drivers/panicr.cpp +++ b/src/mame/drivers/panicr.cpp @@ -298,12 +298,12 @@ uint32_t panicr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y=0;y<256;y++) { - uint16_t* srcline = &m_temprender->pix16(y); - uint16_t* dstline = &bitmap.pix16(y); + uint16_t const *const srcline = &m_temprender->pix(y); + uint16_t *const dstline = &bitmap.pix(y); for (int x=0;x<256;x++) { - uint16_t dat = srcline[x]; + uint16_t const dat = srcline[x]; dstline[x] = ((dat & 0x00f) | ((dat & 0x1e0)>>0)) + 0x200; @@ -315,12 +315,12 @@ uint32_t panicr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y=0;y<256;y++) { - uint16_t* srcline = &m_temprender->pix16(y); - uint16_t* dstline = &bitmap.pix16(y); + uint16_t const *const srcline = &m_temprender->pix(y); + uint16_t *const dstline = &bitmap.pix(y); for (int x=0;x<256;x++) { - uint16_t dat = srcline[x]; + uint16_t const dat = srcline[x]; if (dat & 0x10) dstline[x] = ((dat & 0x00f) | ((dat & 0x1e0)>>0)) + 0x200; @@ -367,7 +367,7 @@ uint8_t panicr_state::collision_r(offs_t offset) uint8_t ret = 0; - uint16_t* srcline = &m_tempbitmap_1->pix16(actual_line); + uint16_t const *const srcline = &m_tempbitmap_1->pix(actual_line); ret |= (srcline[(actual_column+0)&0xff]&3) << 6; diff --git a/src/mame/drivers/pasha2.cpp b/src/mame/drivers/pasha2.cpp index 397354fb516..74735b174af 100644 --- a/src/mame/drivers/pasha2.cpp +++ b/src/mame/drivers/pasha2.cpp @@ -356,28 +356,25 @@ void pasha2_state::video_start() uint32_t pasha2_state::screen_update_pasha2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, count; - int color; - /* 2 512x256 bitmaps */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - count = cliprect.min_x | (y << 9); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + int count = cliprect.min_x | (y << 9); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - bitmap.pix16(y, x) = m_bitmap0[(m_vbuffer ^ 1)][count++] | 0x100; + bitmap.pix(y, x) = m_bitmap0[(m_vbuffer ^ 1)][count++] | 0x100; } } - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - count = cliprect.min_x | (y << 9); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + int count = cliprect.min_x | (y << 9); + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - color = m_bitmap1[(m_vbuffer ^ 1)][count++]; + int color = m_bitmap1[(m_vbuffer ^ 1)][count++]; if (color != 0) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/drivers/paso1600.cpp b/src/mame/drivers/paso1600.cpp index 1f7b32468d3..0c156fdf7db 100644 --- a/src/mame/drivers/paso1600.cpp +++ b/src/mame/drivers/paso1600.cpp @@ -92,10 +92,7 @@ private: uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int xi,yi; - #if 0 - uint32_t count; +#if 0 static int test_x; if(machine().input().code_pressed(KEYCODE_Z)) @@ -106,49 +103,48 @@ uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_in popmessage("%d",test_x); - count = 0; + uint32_t count = 0; - for(y=0;y<475;y++) + for(int y=0;y<475;y++) { count &= 0xffff; - for(x=0;x<test_x/16;x++) + for(int x=0;x<test_x/16;x++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { int pen = (m_p_gvram[count] >> xi) & 1; if(y < 475 && x*16+xi < 640) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(pen); + bitmap.pix(y, x*16+xi) = m_palette->pen(pen); } count++; } } - #endif +#endif // popmessage("%d %d %d",mc6845_h_display,mc6845_v_display,mc6845_tile_height); - for(y=0;y<mc6845_v_display;y++) + for(int y=0;y<mc6845_v_display;y++) { - for(x=0;x<mc6845_h_display;x++) + for(int x=0;x<mc6845_h_display;x++) { int tile = m_p_vram[x+y*mc6845_h_display] & 0xff; int color = (m_p_vram[x+y*mc6845_h_display] & 0x700) >> 8; - int pen; - for(yi=0;yi<19;yi++) + for(int yi=0;yi<19;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; + int pen = (m_p_chargen[tile*8+(yi >> 1)] >> (7-xi) & 1) ? color : -1; if(yi & 0x10) pen = -1; if(pen != -1) if(y*19 < 475 && x*8+xi < 640) /* TODO: safety check */ - bitmap.pix16(y*19+yi, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y*19+yi, x*8+xi) = m_palette->pen(pen); } } } @@ -156,15 +152,15 @@ uint32_t paso1600_state::screen_update_paso1600(screen_device &screen, bitmap_in /* quick and dirty way to do the cursor */ if(0) - for(yi=0;yi<mc6845_tile_height;yi++) + for(int yi=0;yi<mc6845_tile_height;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { if((mc6845_cursor_y_start & 0x60) != 0x20 && mc6845_h_display) { - x = mc6845_cursor_addr % mc6845_h_display; - y = mc6845_cursor_addr / mc6845_h_display; - bitmap.pix16(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(7); + int x = mc6845_cursor_addr % mc6845_h_display; + int y = mc6845_cursor_addr / mc6845_h_display; + bitmap.pix(y*mc6845_tile_height+yi, x*8+xi) = m_palette->pen(7); } } } diff --git a/src/mame/drivers/pasogo.cpp b/src/mame/drivers/pasogo.cpp index dd08e9c4609..10092897b24 100644 --- a/src/mame/drivers/pasogo.cpp +++ b/src/mame/drivers/pasogo.cpp @@ -503,23 +503,22 @@ INPUT_CHANGED_MEMBER(pasogo_state::contrast) uint32_t pasogo_state::screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *vram = (uint8_t *)m_vram.target(); - int x, y; - for (y=0; y<240; y++) + uint8_t const *const vram = (uint8_t *)m_vram.target(); + for (int y=0; y<240; y++) { - for (x=0; x<(320/8); x++) + for (int x=0; x<(320/8); x++) { - int a = (y & 3) * 0x2000; - uint8_t d1 = vram[a + (y >> 2) * 80 + x]; - uint16_t *line = &bitmap.pix16(y, x << 3); - *line++ = ((d1 >> 7) & 1); - *line++ = ((d1 >> 6) & 1); - *line++ = ((d1 >> 5) & 1); - *line++ = ((d1 >> 4) & 1); - *line++ = ((d1 >> 3) & 1); - *line++ = ((d1 >> 2) & 1); - *line++ = ((d1 >> 1) & 1); - *line++ = ((d1 >> 0) & 1); + int const a = (y & 3) * 0x2000; + uint8_t const d1 = vram[a + (y >> 2) * 80 + x]; + uint16_t *line = &bitmap.pix(y, x << 3); + *line++ = BIT(d1, 7); + *line++ = BIT(d1, 6); + *line++ = BIT(d1, 5); + *line++ = BIT(d1, 4); + *line++ = BIT(d1, 3); + *line++ = BIT(d1, 2); + *line++ = BIT(d1, 1); + *line++ = BIT(d1, 0); } } return 0; diff --git a/src/mame/drivers/pasopia.cpp b/src/mame/drivers/pasopia.cpp index f0715ba3ac5..af79aa49211 100644 --- a/src/mame/drivers/pasopia.cpp +++ b/src/mame/drivers/pasopia.cpp @@ -125,9 +125,9 @@ TIMER_CALLBACK_MEMBER( pasopia_state::pio_timer ) MC6845_UPDATE_ROW( pasopia_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 fg=7,bg=0; // colours need to be determined - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (u16 x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp index 3dd0dabb6b8..b38f32be17b 100644 --- a/src/mame/drivers/pasopia7.cpp +++ b/src/mame/drivers/pasopia7.cpp @@ -191,15 +191,13 @@ void pasopia7_state::draw_cg4_line(bitmap_rgb32 &bitmap,int y,int yi,int width,i { for(int xi=0;xi<8;xi++) { - int pen_b,pen_r,pen_g,color; + int pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; + int pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; + int pen_g = 0;//(m_vram[count+yi+0x8000]>>(7-xi)) & 1; - pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; - pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = 0;//(m_vram[count+yi+0x8000]>>(7-xi)) & 1; + int color = pen_g<<2 | pen_r<<1 | pen_b<<0; - color = pen_g<<2 | pen_r<<1 | pen_b<<0; - - bitmap.pix32(y, x+xi) = m_palette->pen(color); + bitmap.pix(y, x+xi) = m_palette->pen(color); } count+=8; } @@ -217,7 +215,7 @@ void pasopia7_state::draw_tv_line(bitmap_rgb32 &bitmap,int y,int yi,int width,in { int pen = ((m_font_rom[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } // draw cursor @@ -225,7 +223,7 @@ void pasopia7_state::draw_tv_line(bitmap_rgb32 &bitmap,int y,int yi,int width,in { for(int xc=0;xc<8;xc++) { - bitmap.pix32(y, x*8+xc) = m_palette->pen(7); + bitmap.pix(y, x*8+xc) = m_palette->pen(7); } } count+=8; @@ -243,15 +241,13 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { for(int xi=0;xi<8;xi++) { - int pen,pen_b,pen_r,pen_g; - - pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; - pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; - pen_g = (m_vram[count+yi+0x8000]>>(7-xi)) & 1; + int pen_b = (m_vram[count+yi+0x0000]>>(7-xi)) & 1; + int pen_r = (m_vram[count+yi+0x4000]>>(7-xi)) & 1; + int pen_g = (m_vram[count+yi+0x8000]>>(7-xi)) & 1; - pen = pen_g<<2 | pen_r<<1 | pen_b<<0; + int pen = pen_g<<2 | pen_r<<1 | pen_b<<0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } } else @@ -262,7 +258,7 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { int pen = ((m_font_rom[tile*8+yi]>>(7-xi)) & 1) ? color : 0; - bitmap.pix32(y, x*8+xi) = m_palette->pen(pen); + bitmap.pix(y, x*8+xi) = m_palette->pen(pen); } } @@ -271,7 +267,7 @@ void pasopia7_state::draw_mixed_line(bitmap_rgb32 &bitmap,int y,int yi,int width { for(int xc=0;xc<8;xc++) { - bitmap.pix32(y, x*8+xc) = m_palette->pen(7); + bitmap.pix(y, x*8+xc) = m_palette->pen(7); } } diff --git a/src/mame/drivers/pc100.cpp b/src/mame/drivers/pc100.cpp index c371415bc86..8cefae88466 100644 --- a/src/mame/drivers/pc100.cpp +++ b/src/mame/drivers/pc100.cpp @@ -164,40 +164,35 @@ void pc100_state::video_start() uint32_t pc100_state::screen_update_pc100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - int count; - int xi; - int dot; - int pen[4],pen_i; + int count = (m_crtc.vstart + 0x20) * 0x40; - count = ((m_crtc.vstart + 0x20) * 0x40); - - for(y=0;y<512;y++) + for(int y=0;y<512;y++) { count &= 0xffff; - for(x=0;x<1024/16;x++) + for(int x=0;x<1024/16;x++) { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { if(m_crtc.cmd != 0xffff) { - for(pen_i=0;pen_i<4;pen_i++) + int pen[4]; + for(int pen_i=0;pen_i<4;pen_i++) pen[pen_i] = (m_vram[count+pen_i*0x10000] >> xi) & 1; - dot = 0; - for(pen_i=0;pen_i<4;pen_i++) + int dot = 0; + for(int pen_i=0;pen_i<4;pen_i++) dot |= pen[pen_i]<<pen_i; if(y < 512 && x*16+xi < 768) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot); + bitmap.pix(y, x*16+xi) = m_palette->pen(dot); } else { - dot = (m_vram[count] >> xi) & 1; + int dot = (m_vram[count] >> xi) & 1; if(y < 512 && x*16+xi < 768) /* TODO: safety check */ - bitmap.pix16(y, x*16+xi) = m_palette->pen(dot ? 15 : 0); + bitmap.pix(y, x*16+xi) = m_palette->pen(dot ? 15 : 0); } } diff --git a/src/mame/drivers/pc1500.cpp b/src/mame/drivers/pc1500.cpp index af40cda61af..09e63e71504 100644 --- a/src/mame/drivers/pc1500.cpp +++ b/src/mame/drivers/pc1500.cpp @@ -107,9 +107,9 @@ uint32_t pc1500_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int b=0; b<8; b++) { if(b<4) - bitmap.pix16(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); + bitmap.pix(b + 4 * (BIT( a, 0)), (a>>1) + 0x00 + 0x27*p) = BIT(data, b); else - bitmap.pix16(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); + bitmap.pix(b - 4 * (BIT(~a, 0)), (a>>1) + 0x4e + 0x27*p) = BIT(data, b); } } diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp index d79cb645a09..fdf7b603a96 100644 --- a/src/mame/drivers/pc2000.cpp +++ b/src/mame/drivers/pc2000.cpp @@ -277,7 +277,7 @@ int gl3000s_state::sed1520_screen_update(bitmap_ind16 &bitmap, const rectangle & int py = 8 + y*8 + yi; if (cliprect.contains(px, py)) - bitmap.pix16(py, px) = (vram[addr % 0x140] >> yi) & 1; + bitmap.pix(py, px) = (vram[addr % 0x140] >> yi) & 1; } row_pos++; @@ -336,7 +336,7 @@ SED1520_UPDATE_CB(gl3000s_state::screen_update_left) else if (x < 74 && yi < 7) { int cx = x - 59; - bitmap.pix16(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; + bitmap.pix(yi, (y ? 0 : 89) + (16 - (cx + cx / 5))) = state; } } } @@ -413,7 +413,7 @@ HD44780_PIXEL_UPDATE(pc1000_state::pc1000_pixel_update) for (int i=0; i<20; i++) if (pos == layout[i]) { - bitmap.pix16((line * 9) + y, (i * 6) + x) = state; + bitmap.pix((line * 9) + y, (i * 6) + x) = state; break; } } @@ -962,7 +962,7 @@ HD44780_PIXEL_UPDATE(gl4004_state::gl4000_pixel_update) }; uint8_t char_pos = gl4000_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + bitmap.pix((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; } } diff --git a/src/mame/drivers/pc8001.cpp b/src/mame/drivers/pc8001.cpp index c832b088ce1..a7478090cb7 100644 --- a/src/mame/drivers/pc8001.cpp +++ b/src/mame/drivers/pc8001.cpp @@ -373,18 +373,17 @@ static const rgb_t PALETTE_PC8001[] = UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) { uint8_t data = m_char_rom->base()[(cc << 3) | lc]; - int i; if (lc >= 8) return; if (csr) data = 0xff; if (m_width80) { - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx * 8) + i) = PALETTE_PC8001[color ? 7 : 0]; data <<= 1; } @@ -393,12 +392,12 @@ UPD3301_DRAW_CHARACTER_MEMBER( pc8001_state::pc8001_display_pixels ) { if (sx % 2) return; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { int color = BIT(data, 7) ^ rvv; - bitmap.pix32(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; - bitmap.pix32(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx/2 * 16) + (i * 2)) = PALETTE_PC8001[color ? 7 : 0]; + bitmap.pix(y, (sx/2 * 16) + (i * 2) + 1) = PALETTE_PC8001[color ? 7 : 0]; data <<= 1; } diff --git a/src/mame/drivers/pc8801.cpp b/src/mame/drivers/pc8801.cpp index 9bb9f7b3e36..9683fe3b434 100644 --- a/src/mame/drivers/pc8801.cpp +++ b/src/mame/drivers/pc8801.cpp @@ -311,25 +311,18 @@ void pc8801_state::video_start() void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) { - int x,y,xi; - uint32_t count; - uint16_t y_size; - uint16_t y_double; + uint32_t count = 0; - count = 0; + uint16_t y_double = (pc8801_pixel_clock()); + uint16_t y_size = (y_double+1) * 200; - y_double = (pc8801_pixel_clock()); - y_size = (y_double+1) * 200; - - for(y=0;y<y_size;y+=(y_double+1)) + for(int y=0;y<y_size;y+=(y_double+1)) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = 0; + int pen = 0; /* note: layer masking doesn't occur in 3bpp mode, Bug Attack relies on this */ pen |= ((m_gvram[count+0x0000] >> (7-xi)) & 1) << 0; @@ -339,15 +332,15 @@ void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &clipre if(y_double) { if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y+0, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y+0, x+xi) = m_palette->pen(pen & 7); if(cliprect.contains(x+xi, y+1)) - bitmap.pix16(y+1, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y+1, x+xi) = m_palette->pen(pen & 7); } else { if(cliprect.contains(x+xi, y+0)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen & 7); + bitmap.pix(y, x+xi) = m_palette->pen(pen & 7); } } @@ -358,42 +351,35 @@ void pc8801_state::draw_bitmap_3bpp(bitmap_ind16 &bitmap,const rectangle &clipre void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &cliprect) { - int x,y,xi; - uint32_t count; - uint8_t color; - uint8_t is_cursor; - - count = 0; - color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; - is_cursor = 0; + uint32_t count = 0; + uint8_t color = (m_gfx_ctrl & 1) ? 7 & ((m_layer_mask ^ 0xe) >> 1) : 7; + uint8_t is_cursor = 0; - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { if(!(m_gfx_ctrl & 1)) is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); + int pen = ((m_gvram[count+0x0000] >> (7-xi)) & 1); if(is_cursor) pen^=1; if((m_gfx_ctrl & 1)) { if(cliprect.contains(x+xi, y*2+0)) - bitmap.pix16(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y*2+0, x+xi) = m_palette->pen(pen ? color : 0); if(cliprect.contains(x+xi, y*2+1)) - bitmap.pix16(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y*2+1, x+xi) = m_palette->pen(pen ? color : 0); } else { if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? color : 0); + bitmap.pix(y, x+xi) = m_palette->pen(pen ? color : 0); } } @@ -405,23 +391,21 @@ void pc8801_state::draw_bitmap_1bpp(bitmap_ind16 &bitmap,const rectangle &clipre { count = 0; - for(y=200;y<400;y++) + for(int y=200;y<400;y++) { - for(x=0;x<640;x+=8) + for(int x=0;x<640;x+=8) { if(!(m_gfx_ctrl & 1)) is_cursor = calc_cursor_pos(x/8,y/lines_per_char,y & (lines_per_char-1)); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); + int pen = ((m_gvram[count+0x4000] >> (7-xi)) & 1); if(is_cursor) pen^=1; if(cliprect.contains(x+xi, y)) - bitmap.pix16(y, x+xi) = m_palette->pen(pen ? 7 : 0); + bitmap.pix(y, x+xi) = m_palette->pen(pen ? 7 : 0); } count++; @@ -496,84 +480,73 @@ uint8_t pc8801_state::extract_text_attribute(uint32_t address,int x, uint8_t wid void pc8801_state::pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,uint8_t gfx_mode,uint8_t reverse,uint8_t secret,uint8_t blink,uint8_t upper,uint8_t lower,int y_size,int width, uint8_t non_special) { - int xi,yi; uint8_t *vram = m_work_ram.get(); - uint8_t is_cursor; - uint8_t y_height, y_double; - uint8_t y_step; - y_height = lines_per_char; - y_double = (pc8801_pixel_clock()); - y_step = (non_special) ? 80 : 120; // trusted by Elthlead - is_cursor = 0; + uint8_t y_height = lines_per_char; + uint8_t y_double = (pc8801_pixel_clock()); + uint8_t y_step = (non_special) ? 80 : 120; // trusted by Elthlead + uint8_t is_cursor = 0; - for(yi=0;yi<y_height;yi++) + for(int yi=0;yi<y_height;yi++) { if(m_gfx_ctrl & 1) is_cursor = calc_cursor_pos(x,y,yi); - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - int tile; - int color; + int tile = vram[x+(y*y_step)+m_dma_address[2]]; - { - tile = vram[x+(y*y_step)+m_dma_address[2]]; + int res_x = x*8+xi*(width+1); + int res_y = y*y_height+yi; - res_x = x*8+xi*(width+1); - res_y = y*y_height+yi; + if(!m_screen->visible_area().contains(res_x, res_y)) + continue; - if(!m_screen->visible_area().contains(res_x, res_y)) - continue; + int color; + if(gfx_mode) + { + uint8_t mask; - if(gfx_mode) - { - uint8_t mask; + mask = (xi & 4) ? 0x10 : 0x01; + mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); + color = (tile & mask) ? pal : -1; + } + else + { + uint8_t blink_mask = 0; + if(blink && ((m_screen->frame_number() / blink_speed) & 3) == 1) + blink_mask = 1; - mask = (xi & 4) ? 0x10 : 0x01; - mask <<= ((yi & (0x6 << y_double)) >> (1+y_double)); - color = (tile & mask) ? pal : -1; - } + uint8_t char_data; + if(yi >= (1 << (y_double+3)) || secret || blink_mask) + char_data = 0; else - { - uint8_t char_data; - uint8_t blink_mask; - - blink_mask = 0; - if(blink && ((m_screen->frame_number() / blink_speed) & 3) == 1) - blink_mask = 1; - - if(yi >= (1 << (y_double+3)) || secret || blink_mask) - char_data = 0; - else - char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; + char_data = (m_cg_rom[tile*8+(yi >> y_double)] >> (7-xi)) & 1; - if(yi == 0 && upper) - char_data = 1; + if(yi == 0 && upper) + char_data = 1; - if(yi == y_height && lower) - char_data = 1; + if(yi == y_height && lower) + char_data = 1; - if(is_cursor) - char_data^=1; + if(is_cursor) + char_data^=1; - if(reverse) - char_data^=1; + if(reverse) + char_data^=1; - color = char_data ? pal : -1; - } + color = char_data ? pal : -1; + } - if(color != -1) + if(color != -1) + { + bitmap.pix(res_y, res_x) = m_palette->pen(color); + if(width) { - bitmap.pix16(res_y, res_x) = m_palette->pen(color); - if(width) - { - if(!m_screen->visible_area().contains(res_x+1, res_y)) - continue; - - bitmap.pix16(res_y, res_x+1) = m_palette->pen(color); - } + if(!m_screen->visible_area().contains(res_x+1, res_y)) + continue; + + bitmap.pix(res_y, res_x+1) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp index 1f6cc8ea76c..a532443e380 100644 --- a/src/mame/drivers/pc88va.cpp +++ b/src/mame/drivers/pc88va.cpp @@ -39,26 +39,22 @@ void pc88va_state::video_start() void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *tvram = m_tvram; - int offs,i; + uint16_t const *const tvram = m_tvram; - offs = m_tsp.spr_offset; - for(i=0;i<(0x100);i+=(8)) + int offs = m_tsp.spr_offset; + for(int i=0;i<(0x100);i+=(8)) { - int xp,yp,sw,md,xsize,ysize,spda,fg_col,bc; - int x_i,y_i,x_s; int spr_count; - int pen; - - ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; - sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; - yp = (tvram[(offs + i + 0) / 2] & 0x1ff); - xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; - md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; - xp = (tvram[(offs + i + 2) / 2] & 0x3ff); - spda = (tvram[(offs + i + 4) / 2] & 0xffff); - fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; - bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; + + int ysize = (tvram[(offs + i + 0) / 2] & 0xfc00) >> 10; + int sw = (tvram[(offs + i + 0) / 2] & 0x200) >> 9; + int yp = (tvram[(offs + i + 0) / 2] & 0x1ff); + int xsize = (tvram[(offs + i + 2) / 2] & 0xf800) >> 11; + int md = (tvram[(offs + i + 2) / 2] & 0x400) >> 10; + int xp = (tvram[(offs + i + 2) / 2] & 0x3ff); + int spda = (tvram[(offs + i + 4) / 2] & 0xffff); + int fg_col = (tvram[(offs + i + 6) / 2] & 0xf0) >> 4; + int bc = (tvram[(offs + i + 6) / 2] & 0x08) >> 3; if(!sw) continue; @@ -86,18 +82,18 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) spr_count = 0; - for(y_i=0;y_i<ysize;y_i++) + for(int y_i=0;y_i<ysize;y_i++) { - for(x_i=0;x_i<xsize;x_i+=16) + for(int x_i=0;x_i<xsize;x_i+=16) { - for(x_s=0;x_s<16;x_s++) + for(int x_s=0;x_s<16;x_s++) { - pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1; + int pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1; pen = pen & 1 ? fg_col : (bc) ? 8 : -1; if(pen != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + bitmap.pix(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); } spr_count+=2; } @@ -113,16 +109,16 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) spr_count = 0; - for(y_i=0;y_i<ysize;y_i++) + for(int y_i=0;y_i<ysize;y_i++) { - for(x_i=0;x_i<xsize;x_i+=2) + for(int x_i=0;x_i<xsize;x_i+=2) { - for(x_s=0;x_s<2;x_s++) + for(int x_s=0;x_s<2;x_s++) { - pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf; + int pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf; //if(bc != -1) //transparent pen - bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); + bitmap.pix(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen); } spr_count+=2; } @@ -148,41 +144,31 @@ uint32_t pc88va_state::calc_kanji_rom_addr(uint8_t jis1,uint8_t jis2,int x,int y void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *tvram = m_tvram; + uint16_t const *const tvram = m_tvram; // TODO: PCG select won't work with this arrangement - uint8_t *kanji = memregion("kanji")->base(); - int xi,yi; - int x,y; - int res_x,res_y; - uint16_t lr_half_gfx; - uint8_t jis1,jis2; - uint32_t count; - uint32_t tile_num; - uint16_t attr; - uint8_t attr_mode; - uint8_t fg_col,bg_col,secret,reverse; - //uint8_t blink,dwidc,dwid,uline,hline; - uint8_t screen_fg_col,screen_bg_col; - - count = tvram[m_tsp.tvram_vreg_offset/2]; - - attr_mode = tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x1f; + uint8_t const *const kanji = memregion("kanji")->base(); + + uint32_t count = tvram[m_tsp.tvram_vreg_offset/2]; + + uint8_t attr_mode = tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x1f; /* Note: bug in docs has the following two reversed */ - screen_fg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0xf000) >> 12; - screen_bg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x0f00) >> 8; + uint8_t screen_fg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0xf000) >> 12; + uint8_t screen_bg_col = (tvram[(m_tsp.tvram_vreg_offset+0xa) / 2] & 0x0f00) >> 8; - for(y=0;y<13;y++) + for(int y=0;y<13;y++) { - for(x=0;x<80;x++) + for(int x=0;x<80;x++) { - jis1 = (tvram[count] & 0x7f) + 0x20; - jis2 = (tvram[count] & 0x7f00) >> 8; - lr_half_gfx = ((tvram[count] & 0x8000) >> 15); + uint8_t jis1 = (tvram[count] & 0x7f) + 0x20; + uint8_t jis2 = (tvram[count] & 0x7f00) >> 8; + uint16_t lr_half_gfx = ((tvram[count] & 0x8000) >> 15); - tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); + uint32_t tile_num = calc_kanji_rom_addr(jis1,jis2,x,y); - attr = (tvram[count+(m_tsp.attr_offset/2)] & 0x00ff); + uint16_t attr = (tvram[count+(m_tsp.attr_offset/2)] & 0x00ff); + uint8_t fg_col,bg_col,secret,reverse; + //uint8_t blink,dwidc,dwid,uline,hline; fg_col = bg_col = reverse = secret = 0; //blink = dwidc = dwid = uline = hline = 0; switch(attr_mode) @@ -296,19 +282,17 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) return; } - for(yi=0;yi<16;yi++) + for(int yi=0;yi<16;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - res_x = x*8+xi; - res_y = y*16+yi; + int res_x = x*8+xi; + int res_y = y*16+yi; if(!cliprect.contains(res_x, res_y)) continue; - pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; + int pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1; if(reverse) pen = pen & 1 ? bg_col : fg_col; @@ -318,7 +302,7 @@ void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) if(secret) { pen = 0; } //hide text if(pen != -1) //transparent - bitmap.pix32(res_y, res_x) = m_palette->pen(pen); + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } diff --git a/src/mame/drivers/pce220.cpp b/src/mame/drivers/pce220.cpp index e2b08ae5149..fddfa2404ae 100644 --- a/src/mame/drivers/pce220.cpp +++ b/src/mame/drivers/pce220.cpp @@ -161,11 +161,11 @@ uint32_t pce220_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { //first 12 columns int panel1_addr = ((m_lcd_start_line>>3) + y)*0x40 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; + bitmap.pix(y*8 + yi, x*6 + xi) = (m_vram[panel1_addr & 0x1ff] >> yi) & 1; //last 12 columns int panel2_addr = ((m_lcd_start_line>>3) + y + 4)*0x40 + (59-row_pos); - bitmap.pix16(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; + bitmap.pix(y*8 + yi, (x+12)*6 + xi) = (m_vram[panel2_addr & 0x1ff] >> yi) & 1; } row_pos++; @@ -245,7 +245,7 @@ uint32_t pcg850v_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int yi = 0; yi < 8; yi++) { int addr = ((m_lcd_start_line>>3) + y)*0x100 + row_pos; - bitmap.pix16(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; + bitmap.pix(y*8 + yi, x*6 + xi) = ((m_vram[addr & 0x7ff] >> yi) & 1 ) ? color1 : color0; } row_pos++; diff --git a/src/mame/drivers/pcm.cpp b/src/mame/drivers/pcm.cpp index db992da93bf..a68ab28fcba 100644 --- a/src/mame/drivers/pcm.cpp +++ b/src/mame/drivers/pcm.cpp @@ -241,20 +241,19 @@ void pcm_state::machine_reset() u32 pcm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0x400,x; + u16 sy=0,ma=0x400; - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - chr = m_vram[x]; + u8 const chr = m_vram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + u8 const gfx = m_p_chargen[(chr<<3) | ra]; *p++ = BIT(gfx, 7); *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp index 2218591e41b..9bd5cc80969 100644 --- a/src/mame/drivers/pcw.cpp +++ b/src/mame/drivers/pcw.cpp @@ -641,7 +641,7 @@ void pcw_state::pcw_printer_fire_pins(uint16_t pins) { line = x % PCW_PRINTER_HEIGHT; if((pins & 0x01) == 0) - m_prn_output->pix16(line, m_printer_headpos) = (uint16_t)(pins & 0x01); + m_prn_output->pix(line, m_printer_headpos) = (uint16_t)(pins & 0x01); pins >>= 1; } // if(m_printer_headpos < PCW_PRINTER_WIDTH) diff --git a/src/mame/drivers/pcxt.cpp b/src/mame/drivers/pcxt.cpp index c180067a72e..dd25820e008 100644 --- a/src/mame/drivers/pcxt.cpp +++ b/src/mame/drivers/pcxt.cpp @@ -199,32 +199,27 @@ uint8_t isa8_cga_tetriskr_device::bg_bank_r() uint32_t isa8_cga_tetriskr_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y; - int yi; - const uint8_t *bg_rom = memregion("gfx2")->base(); + uint8_t const *const bg_rom = memregion("gfx2")->base(); //popmessage("%04x",m_start_offs); bitmap.fill(rgb_t::black(), cliprect); - for(y=0;y<200/8;y++) + for(int y=0;y<200/8;y++) { - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(x=0;x<320/8;x++) + for(int x=0;x<320/8;x++) { - uint8_t color; - int xi,pen_i; - - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - color = 0; + uint8_t color = 0; /* TODO: first byte seems bogus? */ - for(pen_i = 0;pen_i<4;pen_i++) + for(int pen_i = 0;pen_i<4;pen_i++) color |= ((bg_rom[y*320/8+x+(pen_i*0x20000)+yi*0x400+m_bg_bank*0x2000+1] >> (7-xi)) & 1) << pen_i; if(cliprect.contains(x*8+xi, y*8+yi)) - bitmap.pix32(y*8+yi, x*8+xi) = m_palette->pen(color); + bitmap.pix(y*8+yi, x*8+xi) = m_palette->pen(color); } } } diff --git a/src/mame/drivers/pda600.cpp b/src/mame/drivers/pda600.cpp index 31d0054973a..3435da028de 100644 --- a/src/mame/drivers/pda600.cpp +++ b/src/mame/drivers/pda600.cpp @@ -132,7 +132,7 @@ uint32_t pda600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int px=0; px<8; px++) { - bitmap.pix16(y, (x * 8) + px) = BIT(data, 7); + bitmap.pix(y, (x * 8) + px) = BIT(data, 7); data <<= 1; } } diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp index b687074ea1f..55eae153890 100644 --- a/src/mame/drivers/pegasus.cpp +++ b/src/mame/drivers/pegasus.cpp @@ -314,20 +314,19 @@ static const u8 mcm6571a_shift[] = u32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx,inv; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; bool pcg_mode = BIT(m_control_bits, 1); - for(y = 0; y < 16; y++ ) + for(u8 y = 0; y < 16; y++ ) { - for(ra = 0; ra < 16; ra++ ) + for(u8 ra = 0; ra < 16; ra++ ) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for(x = ma; x < ma + 32; x++ ) + for(u16 x = ma; x < ma + 32; x++ ) { - inv = 0xff; - chr = m_vram[x]; + u8 inv = 0xff; + u8 chr = m_vram[x]; if (BIT(chr, 7)) { @@ -335,12 +334,12 @@ u32 pegasus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co chr &= 0x7f; } + u8 gfx; if (pcg_mode) { gfx = m_pcg[(chr << 4) | ra] ^ inv; } - else - if (mcm6571a_shift[chr]) + else if (mcm6571a_shift[chr]) { if (ra < 3) gfx = inv; diff --git a/src/mame/drivers/peoplepc.cpp b/src/mame/drivers/peoplepc.cpp index 011535db098..9c25f9504e9 100644 --- a/src/mame/drivers/peoplepc.cpp +++ b/src/mame/drivers/peoplepc.cpp @@ -114,17 +114,16 @@ static const gfx_layout peoplepc_charlayout = MC6845_UPDATE_ROW(peoplepc_state::update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int i, j; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); - for(i = 0; i < x_count; i++) + for(int i = 0; i < x_count; i++) { if(BIT(m_p7c, 1)) { uint16_t data = m_gvram[((((ma / 40) * 16) + ra) * 64) + i]; - for(j = 15; j >= 0; j--) - bitmap.pix32(y, (i * 16) + j) = palette[BIT(data, j)]; + for(int j = 15; j >= 0; j--) + bitmap.pix(y, (i * 16) + j) = palette[BIT(data, j)]; } else { @@ -134,8 +133,8 @@ MC6845_UPDATE_ROW(peoplepc_state::update_row) chr ^= 0xff; if(((data & 0x800) && (ra > 14)) || (i == cursor_x)) chr = 0xff; - for(j = 0; j < 8; j++) - bitmap.pix32(y, (i * 8) + j) = palette[BIT(chr, j)]; + for(int j = 0; j < 8; j++) + bitmap.pix(y, (i * 8) + j) = palette[BIT(chr, j)]; } } } diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp index bf020d6c52e..77a2b3bc43e 100644 --- a/src/mame/drivers/pet.cpp +++ b/src/mame/drivers/pet.cpp @@ -1344,24 +1344,24 @@ TIMER_CALLBACK_MEMBER( pet_state::sync_tick ) uint32_t pet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int y = 0; y < 200; y++) { for (int sx = 0; sx < 40; sx++) { - int sy = y / 8; - offs_t video_addr = (sy * 40) + sx; - uint8_t lsd = m_video_ram[video_addr]; + int const sy = y / 8; + offs_t const video_addr = (sy * 40) + sx; + uint8_t const lsd = m_video_ram[video_addr]; - int ra = y & 0x07; - offs_t char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; + int const ra = y & 0x07; + offs_t const char_addr = (m_graphic << 10) | ((lsd & 0x7f) << 3) | ra; uint8_t data = m_char_rom->base()[char_addr]; for (int x = 0; x < 8; x++, data <<= 1) { - int color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; - bitmap.pix32(y, (sx * 8) + x) = pen[color]; + int const color = (BIT(data, 7) ^ BIT(lsd, 7)) && m_blanktv; + bitmap.pix(y, (sx * 8) + x) = pen[color]; } } } @@ -1403,8 +1403,8 @@ MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } // odd character @@ -1416,8 +1416,8 @@ MC6845_UPDATE_ROW( pet80_state::pet80_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } @@ -1449,8 +1449,8 @@ MC6845_UPDATE_ROW( pet_state::pet40_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (!((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) ^ invert) && de; + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } @@ -1485,8 +1485,8 @@ MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } // odd character @@ -1498,8 +1498,8 @@ MC6845_UPDATE_ROW( pet80_state::cbm8296_update_row ) for (int bit = 0; bit < 8; bit++, data <<= 1) { - int video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); - bitmap.pix32(vbp + y, hbp + x++) = pen[video]; + int const video = (((BIT(data, 7) ^ BIT(lsd, 7)) && no_row) && de); + bitmap.pix(vbp + y, hbp + x++) = pen[video]; } } } diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index 998d9831fe7..b71f5d74306 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -339,13 +339,12 @@ void pg685_state::video_start() MC6845_UPDATE_ROW( pg685_state::crtc_update_row ) { static const uint32_t palette[2] = { 0x00d000, 0 }; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - uint8_t *vram = (uint8_t *)m_vram.target(); - uint8_t *fontram = (uint8_t *)m_fontram.target(); + uint8_t const *const vram = (uint8_t *)m_vram.target(); + uint8_t const *const fontram = (uint8_t *)m_fontram.target(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ) & 0x7ff; uint8_t chr = vram[ offset ]; @@ -353,27 +352,26 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row ) uint8_t fg = 1; uint8_t bg = 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[( data & 0x80 ) ? fg : bg]; + *p++ = palette[( data & 0x40 ) ? fg : bg]; + *p++ = palette[( data & 0x20 ) ? fg : bg]; + *p++ = palette[( data & 0x10 ) ? fg : bg]; + *p++ = palette[( data & 0x08 ) ? fg : bg]; + *p++ = palette[( data & 0x04 ) ? fg : bg]; + *p++ = palette[( data & 0x02 ) ? fg : bg]; + *p++ = palette[( data & 0x01 ) ? fg : bg]; } } MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) { static const uint32_t palette[2] = { 0x00d000, 0 }; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = ra; - int i; - uint16_t *vram = (uint16_t *)m_vram16.target(); - uint8_t *fontram = (uint8_t *)memregion("chargen")->base(); + uint16_t const *const vram = (uint16_t *)m_vram16.target(); + uint8_t const *const fontram = (uint8_t *)memregion("chargen")->base(); - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { uint16_t offset = ( ma + i ) & 0x7ff; uint16_t chr = vram[ offset ] & 0xff; @@ -381,14 +379,14 @@ MC6845_UPDATE_ROW( pg685_state::crtc_update_row_oua12 ) uint8_t fg = 1; uint8_t bg = 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[( data & 0x80 ) ? fg : bg]; + *p++ = palette[( data & 0x40 ) ? fg : bg]; + *p++ = palette[( data & 0x20 ) ? fg : bg]; + *p++ = palette[( data & 0x10 ) ? fg : bg]; + *p++ = palette[( data & 0x08 ) ? fg : bg]; + *p++ = palette[( data & 0x04 ) ? fg : bg]; + *p++ = palette[( data & 0x02 ) ? fg : bg]; + *p++ = palette[( data & 0x01 ) ? fg : bg]; } } diff --git a/src/mame/drivers/photon2.cpp b/src/mame/drivers/photon2.cpp index bd10463a35e..6994861ad22 100644 --- a/src/mame/drivers/photon2.cpp +++ b/src/mame/drivers/photon2.cpp @@ -163,48 +163,46 @@ WRITE_LINE_MEMBER(photon2_state::screen_vblank_spectrum) static inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t photon2_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* for now do a full-refresh */ - int x, y, b, scrx, scry; - unsigned short ink, pap; - unsigned char *attr, *scr; // int full_refresh = 1; - scr=m_spectrum_video_ram; + unsigned char const *scr=m_spectrum_video_ram; bitmap.fill(m_spectrum_port_fe & 0x07, cliprect); - for (y=0; y<192; y++) + for (int y=0; y<192; y++) { - scrx=SPEC_LEFT_BORDER; - scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; + int scrx=SPEC_LEFT_BORDER; + int scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); + unsigned char const *attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; - for (x=0;x<32;x++) + for (int x=0;x<32;x++) { - /* Get ink and paper colour with bright */ - if (m_spectrum_flash_invert && (*attr & 0x80)) - { - ink=((*attr)>>3) & 0x0f; - pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - } + /* Get ink and paper colour with bright */ + unsigned short ink, pap; + if (m_spectrum_flash_invert && (*attr & 0x80)) + { + ink=((*attr)>>3) & 0x0f; + pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + } + else + { + ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); + pap=((*attr)>>3) & 0x0f; + } + + for (int b=0x80;b!=0;b>>=1) + { + if (*scr&b) + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); else - { - ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); - pap=((*attr)>>3) & 0x0f; - } - - for (b=0x80;b!=0;b>>=1) - { - if (*scr&b) - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); - else - spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); - } + spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); + } scr++; attr++; } diff --git a/src/mame/drivers/phunsy.cpp b/src/mame/drivers/phunsy.cpp index 1ff20267bb1..fc5c5776fa5 100644 --- a/src/mame/drivers/phunsy.cpp +++ b/src/mame/drivers/phunsy.cpp @@ -218,19 +218,19 @@ void phunsy_state::phunsy_palette(palette_device &palette) const uint32_t phunsy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,col; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+64; x++) + for (uint16_t x = ma; x < ma+64; x++) { - chr = m_p_videoram[x]; + uint8_t const chr = m_p_videoram[x]; + uint8_t gfx,col; if (BIT(chr, 7)) { /* Graphics mode */ diff --git a/src/mame/drivers/piggypas.cpp b/src/mame/drivers/piggypas.cpp index c816a490e07..1a144a47e39 100644 --- a/src/mame/drivers/piggypas.cpp +++ b/src/mame/drivers/piggypas.cpp @@ -184,7 +184,7 @@ void piggypas_state::machine_reset() HD44780_PIXEL_UPDATE(piggypas_state::piggypas_pixel_update) { if (pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } void piggypas_state::piggypas(machine_config &config) diff --git a/src/mame/drivers/pinball2k.cpp b/src/mame/drivers/pinball2k.cpp index 56ef596d861..fe6160b1543 100644 --- a/src/mame/drivers/pinball2k.cpp +++ b/src/mame/drivers/pinball2k.cpp @@ -165,19 +165,17 @@ void pinball2k_state::video_start() void pinball2k_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y) { - int i,j; - const uint8_t *dp; int index = 0; - const pen_t *pens = m_palette->pens(); + pen_t const *const pens = m_palette->pens(); - dp = gfx->get_data(ch); + uint8_t const *const dp = gfx->get_data(ch); - for (j=y; j < y+8; j++) + for (int j=y; j < y+8; j++) { - uint32_t *p = &bitmap.pix32(j); - for (i=x; i < x+8; i++) + uint32_t *const p = &bitmap.pix(j); + for (int i=x; i < x+8; i++) { - uint8_t pen = dp[index++]; + uint8_t const pen = dp[index++]; if (pen) p[i] = pens[gfx->colorbase() + (att & 0xf)]; else @@ -191,7 +189,6 @@ void pinball2k_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; int width, height; int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4; @@ -218,14 +215,14 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode { - uint8_t *framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; - uint8_t *pal = m_pal; + uint8_t const *const framebuf = (uint8_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint8_t const *const pal = m_pal; - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint8_t *si = &framebuf[j * line_delta]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint8_t const *si = &framebuf[j * line_delta]; + for (int i=0; i < m_frame_width; i++) { int c = *si++; int r = pal[(c*3)+0] << 2; @@ -238,16 +235,16 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl } else // 16-bit { - uint16_t *framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; + uint16_t const *const framebuf = (uint16_t*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4]; // RGB 5-6-5 mode if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0) { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { uint16_t c = *si++; int r = ((c >> 11) & 0x1f) << 3; @@ -261,11 +258,11 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl // RGB 5-5-5 mode else { - for (j=0; j < m_frame_height; j++) + for (int j=0; j < m_frame_height; j++) { - uint32_t *p = &bitmap.pix32(j); - uint16_t *si = &framebuf[j * (line_delta/2)]; - for (i=0; i < m_frame_width; i++) + uint32_t *const p = &bitmap.pix(j); + uint16_t const *si = &framebuf[j * (line_delta/2)]; + for (int i=0; i < m_frame_width; i++) { uint16_t c = *si++; int r = ((c >> 10) & 0x1f) << 3; @@ -281,14 +278,13 @@ void pinball2k_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cl void pinball2k_state::draw_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; gfx_element *gfx = m_gfxdecode->gfx(0); - uint32_t *cga = m_cga_ram; + uint32_t const *const cga = m_cga_ram; int index = 0; - for (j=0; j < 25; j++) + for (int j=0; j < 25; j++) { - for (i=0; i < 80; i+=2) + for (int i=0; i < 80; i+=2) { int att0 = (cga[index] >> 8) & 0xff; int ch0 = (cga[index] >> 0) & 0xff; diff --git a/src/mame/drivers/plan80.cpp b/src/mame/drivers/plan80.cpp index c06159475f0..d1de5e6ce91 100644 --- a/src/mame/drivers/plan80.cpp +++ b/src/mame/drivers/plan80.cpp @@ -195,19 +195,18 @@ void plan80_state::machine_start() u32 plan80_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; - for (y = 0; y < 32; y++) + for (u8 y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (u8 ra = 0; ra < 8; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma+48; x++) + for (u16 x = ma; x < ma+48; x++) { - chr = m_vram[x]; - gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); + u8 chr = m_vram[x]; + u8 gfx = m_p_chargen[(chr << 3) | ra] ^ (BIT(chr, 7) ? 0xff : 0); /* Display a scanline of a character */ *p++ = BIT(gfx, 6); diff --git a/src/mame/drivers/pmd85.cpp b/src/mame/drivers/pmd85.cpp index b8eab04d666..07c15748cb8 100644 --- a/src/mame/drivers/pmd85.cpp +++ b/src/mame/drivers/pmd85.cpp @@ -245,12 +245,12 @@ uint32_t pmd85_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { int pen = BIT(line[x], 7) ? 1 : 2; - bitmap.pix16(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; - bitmap.pix16(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; - bitmap.pix16(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; - bitmap.pix16(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; - bitmap.pix16(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; - bitmap.pix16(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; + bitmap.pix(y, x * 6 + 0) = BIT(line[x], 0) ? pen : 0; + bitmap.pix(y, x * 6 + 1) = BIT(line[x], 1) ? pen : 0; + bitmap.pix(y, x * 6 + 2) = BIT(line[x], 2) ? pen : 0; + bitmap.pix(y, x * 6 + 3) = BIT(line[x], 3) ? pen : 0; + bitmap.pix(y, x * 6 + 4) = BIT(line[x], 4) ? pen : 0; + bitmap.pix(y, x * 6 + 5) = BIT(line[x], 5) ? pen : 0; } } diff --git a/src/mame/drivers/pockstat.cpp b/src/mame/drivers/pockstat.cpp index 3820b1fc410..551f48b3a3f 100644 --- a/src/mame/drivers/pockstat.cpp +++ b/src/mame/drivers/pockstat.cpp @@ -940,7 +940,7 @@ uint32_t pockstat_state::screen_update_pockstat(screen_device &screen, bitmap_rg { for (int y = 0; y < 32; y++) { - uint32_t *scanline = &bitmap.pix32(y); + uint32_t *const scanline = &bitmap.pix(y); for (int x = 0; x < 32; x++) { if (m_lcd_control != 0) // Hack diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp index 9bd74e066e2..6e988f870e9 100644 --- a/src/mame/drivers/poisk1.cpp +++ b/src/mame/drivers/poisk1.cpp @@ -323,15 +323,13 @@ void p1_state::set_palette_luts(void) POISK1_UPDATE_ROW(p1_state::cga_gfx_2bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); - uint16_t odd, offset; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); if (ra == 0) LOG("cga_gfx_2bpp_update_row\n"); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; @@ -350,16 +348,14 @@ POISK1_UPDATE_ROW(p1_state::cga_gfx_2bpp_update_row) POISK1_UPDATE_ROW(p1_state::cga_gfx_1bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); uint8_t fg = 15, bg = BG_COLOR(m_video.color_select_68); - uint16_t odd, offset; - int i; if (ra == 0) LOG("cga_gfx_1bpp_update_row bg %d\n", bg); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; @@ -382,20 +378,18 @@ POISK1_UPDATE_ROW(p1_state::cga_gfx_1bpp_update_row) POISK1_UPDATE_ROW(p1_state::poisk1_gfx_1bpp_update_row) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(ra); - uint8_t fg, bg = BG_COLOR(m_video.color_select_68); - uint16_t odd, offset; - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(ra); + uint8_t bg = BG_COLOR(m_video.color_select_68); if (ra == 0) LOG("poisk1_gfx_1bpp_update_row bg %d\n", bg); - odd = (ra & 1) << 13; - offset = (ma & 0x1fff) | odd; - for (i = 0; i < stride; i++) + uint16_t odd = (ra & 1) << 13; + uint16_t offset = (ma & 0x1fff) | odd; + for (int i = 0; i < stride; i++) { uint8_t data = videoram[ offset++ ]; - fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX + uint8_t fg = (data & 0x80) ? ( (m_video.color_select_68 & 0x20) ? 10 : 11 ) : 15; // XXX *p = palette[bg]; p++; *p = palette[( data & 0x40 ) ? fg : bg ]; p++; *p = palette[( data & 0x20 ) ? fg : bg ]; p++; diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp index 70205b76e24..d99f74beb14 100644 --- a/src/mame/drivers/pokemini.cpp +++ b/src/mame/drivers/pokemini.cpp @@ -1554,12 +1554,10 @@ void pokemini_state::prc_counter_callback() /* Check if the background should be drawn */ if ( m_prc.background_enabled ) { - int x, y; - for ( y = 0; y < 8; y++ ) { - for ( x = 0; x < 12; x++ ) { + for ( int y = 0; y < 8; y++ ) { + for ( int x = 0; x < 12; x++ ) { uint8_t tile = m_p_ram[ 0x360 + ( y * m_prc.map_size_x ) + x ]; - int i; - for( i = 0; i < 8; i++ ) { + for( int i = 0; i < 8; i++ ) { m_p_ram[ ( y * 96 ) + ( x * 8 ) + i ] = space.read_byte( m_prc.bg_tiles + ( tile * 8 ) + i ); } } @@ -1569,9 +1567,7 @@ void pokemini_state::prc_counter_callback() /* Check if the sprites should be drawn */ if ( m_prc.sprites_enabled ) { - uint16_t spr; - - for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) + for ( uint16_t spr = 0x35C; spr >= 0x300; spr -= 4 ) { int spr_x = ( m_p_ram[ spr + 0 ] & 0x7F ) - 16; int spr_y = ( m_p_ram[ spr + 1 ] & 0x7F ) - 16; @@ -1580,19 +1576,17 @@ void pokemini_state::prc_counter_callback() if ( spr_flag & 0x08 ) { - uint16_t gfx, mask; uint32_t spr_base = m_prc.spr_tiles + spr_tile * 64; - int i, j; - for ( i = 0; i < 16; i++ ) + for ( int i = 0; i < 16; i++ ) { if ( spr_x + i >= 0 && spr_x + i < 96 ) { int rel_x = ( spr_flag & 0x01 ) ? 15 - i : i; uint32_t s = spr_base + ( ( rel_x & 0x08 ) << 2 ) + ( rel_x & 0x07 ); - mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); - gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); + uint16_t mask = ~ ( space.read_byte( s ) | ( space.read_byte( s + 8 ) << 8 ) ); + uint16_t gfx = space.read_byte( s + 16 ) | ( space.read_byte( s + 24 ) << 8 ); /* Are the colors inverted? */ if ( spr_flag & 0x04 ) @@ -1600,7 +1594,7 @@ void pokemini_state::prc_counter_callback() gfx = ~gfx; } - for ( j = 0; j < 16; j++ ) + for ( int j = 0; j < 16; j++ ) { if ( spr_y + j >= 0 && spr_y + j < 64 ) { @@ -1647,20 +1641,18 @@ void pokemini_state::prc_counter_callback() /* Check if the rendered data should be copied to the LCD */ if ( m_prc.copy_enabled ) { - int x, y; - - for( y = 0; y < 64; y += 8 ) { - for( x = 0; x < 96; x++ ) { + for( int y = 0; y < 64; y += 8 ) { + for( int x = 0; x < 96; x++ ) { uint8_t data = m_p_ram[ ( y * 12 ) + x ]; - m_bitmap.pix16(y + 0, x) = ( data & 0x01 ) ? 3 : 0; - m_bitmap.pix16(y + 1, x) = ( data & 0x02 ) ? 3 : 0; - m_bitmap.pix16(y + 2, x) = ( data & 0x04 ) ? 3 : 0; - m_bitmap.pix16(y + 3, x) = ( data & 0x08 ) ? 3 : 0; - m_bitmap.pix16(y + 4, x) = ( data & 0x10 ) ? 3 : 0; - m_bitmap.pix16(y + 5, x) = ( data & 0x20 ) ? 3 : 0; - m_bitmap.pix16(y + 6, x) = ( data & 0x40 ) ? 3 : 0; - m_bitmap.pix16(y + 7, x) = ( data & 0x80 ) ? 3 : 0; + m_bitmap.pix(y + 0, x) = ( data & 0x01 ) ? 3 : 0; + m_bitmap.pix(y + 1, x) = ( data & 0x02 ) ? 3 : 0; + m_bitmap.pix(y + 2, x) = ( data & 0x04 ) ? 3 : 0; + m_bitmap.pix(y + 3, x) = ( data & 0x08 ) ? 3 : 0; + m_bitmap.pix(y + 4, x) = ( data & 0x10 ) ? 3 : 0; + m_bitmap.pix(y + 5, x) = ( data & 0x20 ) ? 3 : 0; + m_bitmap.pix(y + 6, x) = ( data & 0x40 ) ? 3 : 0; + m_bitmap.pix(y + 7, x) = ( data & 0x80 ) ? 3 : 0; } } diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp index c0ffcf1f21c..80a6ec1e430 100644 --- a/src/mame/drivers/popobear.cpp +++ b/src/mame/drivers/popobear.cpp @@ -343,7 +343,7 @@ void popobear_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect // colours on game over screen are still wrong without the weird param kludge above if (pix&0x3f) { - bitmap.pix16(y_draw, x_draw) = m_palette->pen(((pix+(add_it))&0xff)+0x100); + bitmap.pix(y_draw, x_draw) = m_palette->pen(((pix+(add_it))&0xff)+0x100); } } diff --git a/src/mame/drivers/pp.cpp b/src/mame/drivers/pp.cpp index 72a4edca6bf..a029c2acb70 100644 --- a/src/mame/drivers/pp.cpp +++ b/src/mame/drivers/pp.cpp @@ -183,11 +183,11 @@ SCN2672_DRAW_CHARACTER_MEMBER(pp_state::display_char) for (int i = 0; i < 7; i++) { - bitmap.pix32(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); dots <<= 1; } if (!BIT(m_mode, 6)) - bitmap.pix32(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 7) ? fg : rgb_t::black(); } diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp index 2e12d7db1dc..4cd781a74fd 100644 --- a/src/mame/drivers/prestige.cpp +++ b/src/mame/drivers/prestige.cpp @@ -734,7 +734,7 @@ uint32_t prestige_state::screen_update(int bpp, screen_device &screen, bitmap_in pix |= BIT(data, 7 - b) << b; if (cliprect.contains(sx * 8 / bpp + x, y)) - bitmap.pix16(y, sx * 8 / bpp + x) = pix; + bitmap.pix(y, sx * 8 / bpp + x) = pix; data <<= bpp; } diff --git a/src/mame/drivers/progolf.cpp b/src/mame/drivers/progolf.cpp index 7ef19a14771..d77ca7444f0 100644 --- a/src/mame/drivers/progolf.cpp +++ b/src/mame/drivers/progolf.cpp @@ -224,18 +224,16 @@ void progolf_state::video_start() uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count,color,x,y,xi,yi; - { - int scroll = (m_scrollx_lo | ((m_scrollx_hi & 0x03) << 8)); + int const scroll = (m_scrollx_lo | ((m_scrollx_hi & 0x03) << 8)); - count = 0; + int count = 0; - for(x=0;x<128;x++) + for(int x=0;x<128;x++) { - for(y=0;y<32;y++) + for(int y=0;y<32;y++) { - int tile = m_videoram[count]; + int const tile = m_videoram[count]; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,tile,1,0,0,(256-x*8)+scroll,y*8); /* wrap-around */ @@ -248,20 +246,20 @@ uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // framebuffer is 8x8 chars arranged like a bitmap + a register that controls the pen handling. { - count = 0; + int count = 0; - for(y=0;y<256;y+=8) + for(int y=0;y<256;y+=8) { - for(x=0;x<256;x+=8) + for(int x=0;x<256;x+=8) { - for (yi=0;yi<8;yi++) + for (int yi=0;yi<8;yi++) { - for (xi=0;xi<8;xi++) + for (int xi=0;xi<8;xi++) { - color = m_fg_fb[(xi+yi*8)+count*0x40]; + int const color = m_fg_fb[(xi+yi*8)+count*0x40]; if(color != 0 && cliprect.contains(x+yi, 256-y+xi)) - bitmap.pix32(x+yi, 256-y+xi) = m_palette->pen((color & 0x7)); + bitmap.pix(x+yi, 256-y+xi) = m_palette->pen((color & 0x7)); } } diff --git a/src/mame/drivers/proteus3.cpp b/src/mame/drivers/proteus3.cpp index 5717d4125f9..25b11c513ca 100644 --- a/src/mame/drivers/proteus3.cpp +++ b/src/mame/drivers/proteus3.cpp @@ -300,26 +300,24 @@ WRITE_LINE_MEMBER( proteus3_state::ca2_w ) u32 proteus3_state::screen_update_proteus3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_flashcnt++; - for(y = 0; y < 16; y++ ) + for (u8 y = 0; y < 16; y++ ) { - for (ra = 0; ra < 12; ra++) + for (u8 ra = 0; ra < 12; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]; // get char in videoram + u8 chr = m_vram[x]; // get char in videoram gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen } - else - if ((ra == 9) && (m_curs_pos == x) && BIT(m_flashcnt, 4)) + else if ((ra == 9) && (m_curs_pos == x) && BIT(m_flashcnt, 4)) gfx = 0xff; /* Display a scanline of a character */ diff --git a/src/mame/drivers/psion.cpp b/src/mame/drivers/psion.cpp index 32614e2e5b0..047c8b13424 100644 --- a/src/mame/drivers/psion.cpp +++ b/src/mame/drivers/psion.cpp @@ -518,14 +518,14 @@ HD44780_PIXEL_UPDATE(psion_state::lz_pixel_update) }; uint8_t char_pos = psion_display_layout[line*40 + pos]; - bitmap.pix16((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; + bitmap.pix((char_pos / 20) * 9 + y, (char_pos % 20) * 6 + x) = state; } } HD44780_PIXEL_UPDATE(psion1_state::psion1_pixel_update) { if (pos < 8 && line < 2) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } void psion_state::psion_palette(palette_device &palette) const diff --git a/src/mame/drivers/ptcsol.cpp b/src/mame/drivers/ptcsol.cpp index 4b1b07e0782..8427c1ff915 100644 --- a/src/mame/drivers/ptcsol.cpp +++ b/src/mame/drivers/ptcsol.cpp @@ -650,8 +650,7 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons // any character with bit 7 set will blink. With DPMON, do DA C000 C2FF to see what happens u16 which = (m_iop_config->read() & 2) << 10; u8 s1 = m_iop_s1->read(); - u8 y,ra,chr,gfx; - u16 sy=0,ma,x,inv; + u16 sy=0; u8 polarity = (s1 & 8) ? 0xff : 0; bool cursor_inv = false; @@ -660,18 +659,18 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons m_framecnt++; - ma = m_sol20_fe << 6; // scroll register + u16 ma = m_sol20_fe << 6; // scroll register - for (y = 0; y < 16; y++) + for (u8 y = 0; y < 16; y++) { - for (ra = 0; ra < 13; ra++) + for (u8 ra = 0; ra < 13; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (u16 x = ma; x < ma + 64; x++) { - inv = polarity; - chr = m_vram[x & 0x3ff]; + u16 inv = polarity; + u8 chr = m_vram[x & 0x3ff]; // cursor if (BIT(chr, 7) && cursor_inv) @@ -679,10 +678,10 @@ u32 sol20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons chr &= 0x7f; + u8 gfx; if ((ra == 0) || ((s1 & 4) && (chr < 0x20))) gfx = inv; - else - if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) + else if ((chr==0x2C) || (chr==0x3B) || (chr==0x67) || (chr==0x6A) || (chr==0x70) || (chr==0x71) || (chr==0x79)) { if (ra < 4) gfx = inv; diff --git a/src/mame/drivers/pv1000.cpp b/src/mame/drivers/pv1000.cpp index a78004c2ad4..63b19c16975 100644 --- a/src/mame/drivers/pv1000.cpp +++ b/src/mame/drivers/pv1000.cpp @@ -31,7 +31,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: @@ -60,7 +60,7 @@ pv1000_sound_device::pv1000_sound_device(const machine_config &mconfig, const ch void pv1000_sound_device::device_start() { - m_sh_channel = stream_alloc_legacy(0, 1, clock() / 1024); + m_sh_channel = stream_alloc(0, 1, clock() / 1024); save_item(NAME(m_voice[0].count)); save_item(NAME(m_voice[0].period)); @@ -84,7 +84,7 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data) } //------------------------------------------------- -// sound_stream_update_legacy - handle a stream update +// sound_stream_update - handle a stream update //------------------------------------------------- @@ -98,20 +98,20 @@ void pv1000_sound_device::voice_w(offs_t offset, uint8_t data) Note: the register periods are inverted. */ -void pv1000_sound_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void pv1000_sound_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; - while (samples > 0) + for (int sampindex = 0; sampindex < buffer.samples(); sampindex++) { - *buffer=0; + s32 sum = 0; for (int i = 0; i < 3; i++) { uint32_t per = (0x3f - (m_voice[i].period & 0x3f)); if (per != 0) //OFF! - *buffer += m_voice[i].val * 8192; + sum += m_voice[i].val * 8192; m_voice[i].count++; @@ -122,8 +122,7 @@ void pv1000_sound_device::sound_stream_update_legacy(sound_stream &stream, strea } } - buffer++; - samples--; + buffer.put_int(sampindex, sum, 32768); } } diff --git a/src/mame/drivers/px4.cpp b/src/mame/drivers/px4.cpp index 0bddf1212b4..2f539d2c1e6 100644 --- a/src/mame/drivers/px4.cpp +++ b/src/mame/drivers/px4.cpp @@ -1177,26 +1177,24 @@ uint32_t px4_state::screen_update_px4(screen_device &screen, bitmap_ind16 &bitma // display enabled? if (BIT(m_yoff, 7)) { - int y, x; - // get vram start address - uint8_t *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; + uint8_t const *vram = &m_ram->pointer()[(m_vadr & 0xf8) << 8]; - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { // adjust against y-offset uint8_t row = (y - (m_yoff & 0x3f)) & 0x3f; - for (x = 0; x < 240/8; x++) + for (int x = 0; x < 240/8; x++) { - bitmap.pix16(row, x * 8 + 0) = BIT(*vram, 7); - bitmap.pix16(row, x * 8 + 1) = BIT(*vram, 6); - bitmap.pix16(row, x * 8 + 2) = BIT(*vram, 5); - bitmap.pix16(row, x * 8 + 3) = BIT(*vram, 4); - bitmap.pix16(row, x * 8 + 4) = BIT(*vram, 3); - bitmap.pix16(row, x * 8 + 5) = BIT(*vram, 2); - bitmap.pix16(row, x * 8 + 6) = BIT(*vram, 1); - bitmap.pix16(row, x * 8 + 7) = BIT(*vram, 0); + bitmap.pix(row, x * 8 + 0) = BIT(*vram, 7); + bitmap.pix(row, x * 8 + 1) = BIT(*vram, 6); + bitmap.pix(row, x * 8 + 2) = BIT(*vram, 5); + bitmap.pix(row, x * 8 + 3) = BIT(*vram, 4); + bitmap.pix(row, x * 8 + 4) = BIT(*vram, 3); + bitmap.pix(row, x * 8 + 5) = BIT(*vram, 2); + bitmap.pix(row, x * 8 + 6) = BIT(*vram, 1); + bitmap.pix(row, x * 8 + 7) = BIT(*vram, 0); vram++; } diff --git a/src/mame/drivers/pyl601.cpp b/src/mame/drivers/pyl601.cpp index e20146877e1..52270235c3e 100644 --- a/src/mame/drivers/pyl601.cpp +++ b/src/mame/drivers/pyl601.cpp @@ -414,27 +414,26 @@ void pyl601_state::machine_start() MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charrom = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charrom = memregion("chargen")->base(); - int column, bit, i; - uint8_t data; if (BIT(m_video_mode, 5) == 0) { - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { uint8_t code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; code = ((code << 1) | (code >> 7)) & 0xff; + uint8_t data; if (column == cursor_x-2) data = 0xff; else data = charrom[((code << 3) | (ra & 0x07)) & 0x7ff]; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; - bitmap.pix32(y, x) = palette[BIT(data, 7)]; + bitmap.pix(y, x) = palette[BIT(data, 7)]; data <<= 1; } @@ -442,12 +441,12 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) } else { - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) + uint8_t data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (int bit = 0; bit < 8; bit++) { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + bitmap.pix(y, (i * 8) + bit) = palette[BIT(data, 7)]; data <<= 1; } } @@ -456,25 +455,23 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601_update_row ) MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charrom = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charrom = memregion("chargen")->base(); - int column, bit, i; - uint8_t data; if (BIT(m_video_mode, 5) == 0) { - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { - uint8_t code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; - data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; + uint8_t const code = m_ram->pointer()[(((ma + column) & 0x0fff) + 0xf000)]; + uint8_t data = charrom[((code << 4) | (ra & 0x07)) & 0xfff]; if (column == cursor_x) data = 0xff; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { - int x = (column * 8) + bit; + int const x = (column * 8) + bit; - bitmap.pix32(y, x) = palette[BIT(data, 7)]; + bitmap.pix(y, x) = palette[BIT(data, 7)]; data <<= 1; } @@ -482,12 +479,12 @@ MC6845_UPDATE_ROW( pyl601_state::pyl601a_update_row ) } else { - for (i = 0; i < x_count; i++) + for (int i = 0; i < x_count; i++) { - data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; - for (bit = 0; bit < 8; bit++) + uint8_t data = m_ram->pointer()[(((ma + i) << 3) | (ra & 0x07)) & 0xffff]; + for (int bit = 0; bit < 8; bit++) { - bitmap.pix32(y, (i * 8) + bit) = palette[BIT(data, 7)]; + bitmap.pix(y, (i * 8) + bit) = palette[BIT(data, 7)]; data <<= 1; } } diff --git a/src/mame/drivers/pzletime.cpp b/src/mame/drivers/pzletime.cpp index 856ad762bc3..60c7cbc6caa 100644 --- a/src/mame/drivers/pzletime.cpp +++ b/src/mame/drivers/pzletime.cpp @@ -117,9 +117,6 @@ void pzletime_state::video_start() uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count; - int y, x; - bitmap.fill(m_palette[0]->pen(0), cliprect); //bg pen m_txt_tilemap->set_scrolly(0, m_tilemap_regs[0] - 3); @@ -130,14 +127,14 @@ uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rg if (m_video_regs[2] & 1) { - count = 0; + int count = 0; - for (y = 255; y >= 0; y--) + for (int y = 255; y >= 0; y--) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { if (m_bg_videoram[count] & 0x8000) - bitmap.pix32((y - 18) & 0xff, (x - 32) & 0x1ff) = m_palette[1]->pen(m_bg_videoram[count] & 0x7fff); + bitmap.pix((y - 18) & 0xff, (x - 32) & 0x1ff) = m_palette[1]->pen(m_bg_videoram[count] & 0x7fff); count++; } @@ -146,24 +143,20 @@ uint32_t pzletime_state::screen_update_pzletime(screen_device &screen, bitmap_rg m_mid_tilemap->draw(screen, bitmap, cliprect, 0, 0); + uint16_t const *const spriteram = m_spriteram; + for (int offs = 0; offs < 0x2000 / 2; offs += 4) { - uint16_t *spriteram = m_spriteram; - int offs, spr_offs, colour, sx, sy; - - for(offs = 0; offs < 0x2000 / 2; offs += 4) - { - if(spriteram[offs + 0] == 8) - break; + if(spriteram[offs + 0] == 8) + break; - spr_offs = spriteram[offs + 3] & 0x0fff; - sy = 0x200 - (spriteram[offs + 0] & 0x1ff) - 35; - sx = (spriteram[offs + 1] & 0x1ff) - 30; - colour = (spriteram[offs + 0] & 0xf000) >> 12; + int spr_offs = spriteram[offs + 3] & 0x0fff; + int sy = 0x200 - (spriteram[offs + 0] & 0x1ff) - 35; + int sx = (spriteram[offs + 1] & 0x1ff) - 30; + int colour = (spriteram[offs + 0] & 0xf000) >> 12; - // is spriteram[offs + 0] & 0x200 flipy? it's always set + // is spriteram[offs + 0] & 0x200 flipy? it's always set - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, spr_offs, colour, 0, 1, sx, sy, 0); - } + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, spr_offs, colour, 0, 1, sx, sy, 0); } m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0); diff --git a/src/mame/drivers/quizo.cpp b/src/mame/drivers/quizo.cpp index 1e3e27e9f0b..835d42e31ed 100644 --- a/src/mame/drivers/quizo.cpp +++ b/src/mame/drivers/quizo.cpp @@ -104,10 +104,10 @@ uint32_t quizo_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, uint8_t data2 = m_vram[y * 80 + x + 0x4000]; // draw 4 pixels - bitmap.pix32(y, x * 4 + 0) = m_palette->pen((BIT(data2, 7) << 3) | (BIT(data2, 3) << 2) | (BIT(data1, 7) << 1) | BIT(data1, 3)); - bitmap.pix32(y, x * 4 + 1) = m_palette->pen((BIT(data2, 6) << 3) | (BIT(data2, 2) << 2) | (BIT(data1, 6) << 1) | BIT(data1, 2)); - bitmap.pix32(y, x * 4 + 2) = m_palette->pen((BIT(data2, 5) << 3) | (BIT(data2, 1) << 2) | (BIT(data1, 5) << 1) | BIT(data1, 1)); - bitmap.pix32(y, x * 4 + 3) = m_palette->pen((BIT(data2, 4) << 3) | (BIT(data2, 0) << 2) | (BIT(data1, 4) << 1) | BIT(data1, 0)); + bitmap.pix(y, x * 4 + 0) = m_palette->pen((BIT(data2, 7) << 3) | (BIT(data2, 3) << 2) | (BIT(data1, 7) << 1) | BIT(data1, 3)); + bitmap.pix(y, x * 4 + 1) = m_palette->pen((BIT(data2, 6) << 3) | (BIT(data2, 2) << 2) | (BIT(data1, 6) << 1) | BIT(data1, 2)); + bitmap.pix(y, x * 4 + 2) = m_palette->pen((BIT(data2, 5) << 3) | (BIT(data2, 1) << 2) | (BIT(data1, 5) << 1) | BIT(data1, 1)); + bitmap.pix(y, x * 4 + 3) = m_palette->pen((BIT(data2, 4) << 3) | (BIT(data2, 0) << 2) | (BIT(data1, 4) << 1) | BIT(data1, 0)); } } diff --git a/src/mame/drivers/qvt102.cpp b/src/mame/drivers/qvt102.cpp index 78ebd367020..c2be43eccd9 100644 --- a/src/mame/drivers/qvt102.cpp +++ b/src/mame/drivers/qvt102.cpp @@ -491,7 +491,7 @@ MC6845_UPDATE_ROW( qvt102_state::crtc_update_row ) p = !(p & !((BIT(attr, 3) & (ra == 11)))); // underline p = p ^ (BIT(attr, 2) ^ ((x == cursor_x) | BIT(m_latch, 2))); // reverse - bitmap.pix32(y, x*9 + (8-i)) = palette[p ? 2 - half : 0]; + bitmap.pix(y, x*9 + (8-i)) = palette[p ? 2 - half : 0]; } } diff --git a/src/mame/drivers/qvt103.cpp b/src/mame/drivers/qvt103.cpp index 553d6f2d8c8..020b2981d50 100644 --- a/src/mame/drivers/qvt103.cpp +++ b/src/mame/drivers/qvt103.cpp @@ -52,7 +52,7 @@ u32 qvt103_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con uint16_t gfx = m_p_chargen[code << 4 | y]; for (int x = 0; x < 8; x++) - bitmap.pix32(col*12 + y, row*8 + (7 - x)) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(col*12 + y, row*8 + (7 - x)) = BIT(gfx, x) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/qvt190.cpp b/src/mame/drivers/qvt190.cpp index 0e4778308e0..03cbf1316f5 100644 --- a/src/mame/drivers/qvt190.cpp +++ b/src/mame/drivers/qvt190.cpp @@ -64,7 +64,7 @@ MC6845_UPDATE_ROW(qvt190_state::update_row) gfx = ~gfx; for (int i = 0; i < 9; i++) - bitmap.pix32(y, x*9 + (8-i)) = palette[BIT(gfx, i) ? 2 : 0]; + bitmap.pix(y, x*9 + (8-i)) = palette[BIT(gfx, i) ? 2 : 0]; } } diff --git a/src/mame/drivers/qvt70.cpp b/src/mame/drivers/qvt70.cpp index e4cd22ee6fe..2e40ec44d68 100644 --- a/src/mame/drivers/qvt70.cpp +++ b/src/mame/drivers/qvt70.cpp @@ -226,7 +226,7 @@ uint32_t qvt70_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // 8 pixels of the character for (int p = 0; p < 8; p++) - bitmap.pix32(y * 16 + i, x * 8 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 16 + i, x * 8 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); } } } diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index eecc0c61e84..a1ac1e0557f 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -173,9 +173,8 @@ private: UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,gfx[3]; - uint8_t pen; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + int gfx[3]; if(m_color_mode) { @@ -190,13 +189,14 @@ UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels ) gfx[2] = 0; } - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { + uint8_t pen; pen = ((gfx[0] >> xi) & 1) ? 1 : 0; pen|= ((gfx[1] >> xi) & 1) ? 2 : 0; pen|= ((gfx[2] >> xi) & 1) ? 4 : 0; - bitmap.pix32(y, x + xi) = palette[pen]; + bitmap.pix(y, x + xi) = palette[pen]; } } @@ -239,7 +239,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text ) pen = ((tile_data >> xi) & 1) ? color : 0; if(pen) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; } } } diff --git a/src/mame/drivers/r2dtank.cpp b/src/mame/drivers/r2dtank.cpp index 1c9adc338d7..11fdb0c0802 100644 --- a/src/mame/drivers/r2dtank.cpp +++ b/src/mame/drivers/r2dtank.cpp @@ -279,8 +279,6 @@ MC6845_UPDATE_ROW( r2dtank_state::crtc_update_row ) for (uint8_t cx = 0; cx < x_count; cx++) { - uint8_t data, fore_color; - /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 3) & 0x1f00) | ((ra << 5) & 0x00e0) | @@ -289,31 +287,31 @@ MC6845_UPDATE_ROW( r2dtank_state::crtc_update_row ) if (m_flipscreen) offs = offs ^ 0x1fff; - data = m_videoram[offs]; - fore_color = (m_colorram[offs] >> 5) & 0x07; + uint8_t data = m_videoram[offs]; + uint8_t fore_color = (m_colorram[offs] >> 5) & 0x07; for (int i = 0; i < 8; i++) { - uint8_t bit, color; + uint8_t bit; if (m_flipscreen) { bit = data & 0x01; - data = data >> 1; + data >>= 1; } else { bit = data & 0x80; - data = data << 1; + data <<= 1; } - color = bit ? fore_color : 0; - bitmap.pix32(y, x) = m_palette->pen_color(color); + uint8_t const color = bit ? fore_color : 0; + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } - ma = ma + 1; + ma++; } } diff --git a/src/mame/drivers/rabbit.cpp b/src/mame/drivers/rabbit.cpp index 17335829a49..182773d4a09 100644 --- a/src/mame/drivers/rabbit.cpp +++ b/src/mame/drivers/rabbit.cpp @@ -340,26 +340,21 @@ void rabbit_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* the sprite bitmap can probably be handled better than this ... */ void rabbit_state::clearspritebitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int startx, starty; - int y; - int amountx,amounty; - uint16_t *dstline; - /* clears a *sensible* amount of the sprite bitmap */ - startx = (m_spriteregs[0]&0x00000fff); - starty = (m_spriteregs[1]&0x0fff0000)>>16; + int startx = (m_spriteregs[0]&0x00000fff); + int starty = (m_spriteregs[1]&0x0fff0000)>>16; startx-=200; starty-=200; - amountx =650; - amounty =600; + int amountx =650; + int amounty =600; if (startx < 0) { amountx += startx; startx = 0; } if ((startx+amountx)>=0x1000) amountx-=(0x1000-(startx+amountx)); - for (y=0; y<amounty;y++) + for (int y=0; y<amounty;y++) { - dstline = &m_sprite_bitmap->pix16((starty+y)&0xfff); + uint16_t *const dstline = &m_sprite_bitmap->pix((starty+y)&0xfff); memset(dstline+startx,0x00,amountx*2); } } @@ -367,17 +362,11 @@ void rabbit_state::clearspritebitmap( bitmap_ind16 &bitmap, const rectangle &cli /* todo: fix zoom, it's inaccurate and this code is ugly */ void rabbit_state::draw_sprite_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint32_t x,y; - uint16_t *srcline; - uint16_t *dstline; - uint16_t pixdata; uint32_t xsize, ysize; - uint32_t xdrawpos, ydrawpos; uint32_t xstep,ystep; - int startx, starty; - startx = ((m_spriteregs[0]&0x00000fff)); - starty = ((m_spriteregs[1]&0x0fff0000)>>16); + int startx = ((m_spriteregs[0]&0x00000fff)); + int starty = ((m_spriteregs[1]&0x0fff0000)>>16); /* zoom compensation? */ startx-=((m_spriteregs[1]&0x000001ff)>>1); @@ -390,22 +379,21 @@ void rabbit_state::draw_sprite_bitmap( bitmap_ind16 &bitmap, const rectangle &cl ysize+=0x80; xstep = ((320*128)<<16) / xsize; ystep = ((224*128)<<16) / ysize; - ydrawpos = 0; - for (y=0;y<ysize;y+=0x80) + for (uint32_t y=0;y<ysize;y+=0x80) { - ydrawpos = ((y>>7)*ystep); + uint32_t ydrawpos = ((y>>7)*ystep); ydrawpos >>=16; if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - srcline = &m_sprite_bitmap->pix16((starty+(y>>7))&0xfff); - dstline = &bitmap.pix16(ydrawpos); + uint16_t const *const srcline = &m_sprite_bitmap->pix((starty+(y>>7))&0xfff); + uint16_t *const dstline = &bitmap.pix(ydrawpos); - for (x=0;x<xsize;x+=0x80) + for (uint32_t x=0;x<xsize;x+=0x80) { - xdrawpos = ((x>>7)*xstep); + uint32_t xdrawpos = ((x>>7)*xstep); xdrawpos >>=16; - pixdata = srcline[(startx+(x>>7))&0xfff]; + uint16_t const pixdata = srcline[(startx+(x>>7))&0xfff]; if (pixdata) if ((xdrawpos >= cliprect.min_x) && (xdrawpos <= cliprect.max_x)) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 1b28e1aa030..15889f0a18d 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -830,7 +830,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_base_state::hgdc_display_pixels ) for (int xi = 0; xi < 16; xi++) // blank screen when VT102 output active (..) { if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = 0; + bitmap.pix(y, x + xi) = 0; } return; // no output from graphics option } @@ -864,7 +864,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( rainbow_base_state::hgdc_display_pixels ) (BIT(plane3 ,xi) << 3); if (bitmap.cliprect().contains(x + xi, y)) - bitmap.pix32(y, x + xi) = paletteX[mono ? (pen + 16) : pen]; + bitmap.pix(y, x + xi) = paletteX[mono ? (pen + 16) : pen]; } } diff --git a/src/mame/drivers/rastersp.cpp b/src/mame/drivers/rastersp.cpp index eddccf092e9..b5925895b1a 100644 --- a/src/mame/drivers/rastersp.cpp +++ b/src/mame/drivers/rastersp.cpp @@ -244,7 +244,7 @@ void rastersp_state::dpylist_w(uint32_t data) int y = 0; int x = 0; - uint16_t *bmpptr = &m_update_bitmap.pix16(0, 0); + uint16_t *bmpptr = &m_update_bitmap.pix(0, 0); while (y < 240) { diff --git a/src/mame/drivers/rc702.cpp b/src/mame/drivers/rc702.cpp index 2f54c89d024..31c43417c83 100644 --- a/src/mame/drivers/rc702.cpp +++ b/src/mame/drivers/rc702.cpp @@ -281,13 +281,13 @@ I8275_DRAW_CHARACTER_MEMBER( rc702_state::display_pixels ) gfx ^= 0xff; // Highlight not used - bitmap.pix32(y, x++) = palette[BIT(gfx, 1) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 2) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 3) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 4) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 5) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 6) ? 1 : 0]; - bitmap.pix32(y, x++) = palette[BIT(gfx, 7) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 1) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 2) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 3) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 4) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 5) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 6) ? 1 : 0]; + bitmap.pix(y, x++) = palette[BIT(gfx, 7) ? 1 : 0]; } // Baud rate generator. All inputs are 0.614MHz. diff --git a/src/mame/drivers/rc759.cpp b/src/mame/drivers/rc759.cpp index 35dac7a1991..4867bb84cf7 100644 --- a/src/mame/drivers/rc759.cpp +++ b/src/mame/drivers/rc759.cpp @@ -356,7 +356,7 @@ I82730_UPDATE_ROW( rc759_state::txt_update_row ) width = 15 - width; for (int p = 0; p < width; p++) - bitmap.pix32(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, i * width + p) = BIT(gfx, 15 - p) ? rgb_t::white() : rgb_t::black(); } } diff --git a/src/mame/drivers/rd100.cpp b/src/mame/drivers/rd100.cpp index 7f9cb4ea167..2e71d92b050 100644 --- a/src/mame/drivers/rd100.cpp +++ b/src/mame/drivers/rd100.cpp @@ -77,7 +77,7 @@ void rd100_state::machine_reset() HD44780_PIXEL_UPDATE(rd100_state::pixel_update) { if (pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } uint8_t rd100_state::keys_r() diff --git a/src/mame/drivers/rex6000.cpp b/src/mame/drivers/rex6000.cpp index 81812f8a1c0..acf8a15ae3e 100644 --- a/src/mame/drivers/rex6000.cpp +++ b/src/mame/drivers/rex6000.cpp @@ -623,7 +623,7 @@ void oz750_state::machine_reset() uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); + uint16_t const lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); if (m_lcd_enabled) { @@ -634,7 +634,7 @@ uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int b=0; b<8; b++) { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 7); + bitmap.pix(y, (x * 8) + b) = BIT(data, 7); data <<= 1; } } @@ -649,7 +649,7 @@ uint32_t rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitma uint32_t oz750_state::screen_update_oz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); + uint16_t const lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); if (m_lcd_enabled && m_power_on) { @@ -660,7 +660,7 @@ uint32_t oz750_state::screen_update_oz(screen_device &screen, bitmap_ind16 &bitm for (int b=0; b<8; b++) { - bitmap.pix16(y, (x * 8) + b) = BIT(data, 0); + bitmap.pix(y, (x * 8) + b) = BIT(data, 0); data >>= 1; } } diff --git a/src/mame/drivers/roland_cm32p.cpp b/src/mame/drivers/roland_cm32p.cpp index 9229131cd89..2c3da094385 100644 --- a/src/mame/drivers/roland_cm32p.cpp +++ b/src/mame/drivers/roland_cm32p.cpp @@ -333,20 +333,19 @@ cm32p_state::cm32p_state(const machine_config &mconfig, device_type type, const // screen update function from Roland D-110 uint32_t cm32p_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,gfx; - uint16_t sy=0,x; - const u8 *data = lcd->render(); + u16 sy=0; + u8 const *const data = lcd->render(); bitmap.fill(0); - for (y = 0; y < 2; y++) + for (u8 y = 0; y < 2; y++) { - for (ra = 0; ra < 9; ra++) + for (u8 ra = 0; ra < 9; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = 0; x < 16; x++) + for (u16 x = 0; x < 16; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) gfx = data[x*16 + y*640 + ra]; diff --git a/src/mame/drivers/roland_d10.cpp b/src/mame/drivers/roland_d10.cpp index c6f952eb399..3df347a0777 100644 --- a/src/mame/drivers/roland_d10.cpp +++ b/src/mame/drivers/roland_d10.cpp @@ -109,20 +109,19 @@ private: uint32_t roland_d10_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx; - uint16_t sy=0,x; - const uint8_t *data = m_lcd->render(); + uint16_t sy=0; + uint8_t const *const data = m_lcd->render(); bitmap.fill(0); - for (y = 0; y < 2; y++) + for (uint8_t y = 0; y < 2; y++) { - for (ra = 0; ra < 9; ra++) + for (uint8_t ra = 0; ra < 9; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 16; x++) + for (uint16_t x = 0; x < 16; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 8) gfx = data[x*16 + y*640 + ra]; diff --git a/src/mame/drivers/roland_mt32.cpp b/src/mame/drivers/roland_mt32.cpp index 73da136698d..7e1da5e0e19 100644 --- a/src/mame/drivers/roland_mt32.cpp +++ b/src/mame/drivers/roland_mt32.cpp @@ -249,7 +249,7 @@ uint32_t mt32_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for(int y=0; y<8; y++) { uint8_t v = data[c*8+y]; for(int x=0; x<5; x++) - bitmap.pix16(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; + bitmap.pix(y == 7 ? 8 : y, c*6+x) = v & (0x10 >> x) ? 1 : 0; } return 0; } diff --git a/src/mame/drivers/roland_s10.cpp b/src/mame/drivers/roland_s10.cpp index 7b063794a06..7c198ac45b5 100644 --- a/src/mame/drivers/roland_s10.cpp +++ b/src/mame/drivers/roland_s10.cpp @@ -90,13 +90,13 @@ private: HD44780_PIXEL_UPDATE(roland_s10_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 8) - bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state; + bitmap.pix(y, (line * 8 + pos) * 6 + x) = state; } HD44780_PIXEL_UPDATE(roland_s220_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } u8 roland_s10_state::qdd_r(offs_t offset) diff --git a/src/mame/drivers/rollext.cpp b/src/mame/drivers/rollext.cpp index 28dc8130117..d7ce3409478 100644 --- a/src/mame/drivers/rollext.cpp +++ b/src/mame/drivers/rollext.cpp @@ -123,7 +123,7 @@ void rollext_renderer::render_texture_scan(int32_t scanline, const extent_t &ext float du = extent.param[0].dpdx; float dv = extent.param[1].dpdx; - uint32_t *fb = &m_fb->pix32(scanline); + uint32_t *fb = &m_fb->pix(scanline); uint32_t texbot = extradata.tex_bottom; uint32_t texleft = extradata.tex_left; @@ -361,7 +361,7 @@ uint32_t rollext_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma int ii=0; for (int j=0; j < 384; j++) { - uint32_t *fb = &bitmap.pix32(j); + uint32_t *fb = &bitmap.pix(j); for (int i=0; i < 512; i++) { uint8_t p = m_texture[ii++]; diff --git a/src/mame/drivers/rotaryf.cpp b/src/mame/drivers/rotaryf.cpp index 2b288225fd6..fd7da906eda 100644 --- a/src/mame/drivers/rotaryf.cpp +++ b/src/mame/drivers/rotaryf.cpp @@ -166,24 +166,20 @@ TIMER_DEVICE_CALLBACK_MEMBER(rotaryf_state::rotaryf_interrupt) uint32_t rotaryf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - pen_t pens[2]; - pens[0] = rgb_t::black(); - pens[1] = rgb_t::white(); - uint8_t i,x,y,data; + pen_t const pens[2] = { rgb_t::black(), rgb_t::white() }; - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - x = offs << 3; - y = offs >> 5; - data = m_videoram[offs]; + uint8_t x = offs << 3; + uint8_t y = offs >> 5; + uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (uint8_t i = 0; i < 8; i++) { if (m_flipscreen) - bitmap.pix32(255-y, 247-(x|i)) = pens[data & 1]; + bitmap.pix(255-y, 247-(x|i)) = pens[data & 1]; else - bitmap.pix32(y, x|i) = pens[data & 1]; + bitmap.pix(y, x|i) = pens[data & 1]; data >>= 1; } diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp index d6d9188f32e..4bee2a01fbc 100644 --- a/src/mame/drivers/roul.cpp +++ b/src/mame/drivers/roul.cpp @@ -255,10 +255,9 @@ void roul_state::video_start() uint32_t roul_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i,j; - for (i = 0; i < 256; i++) - for (j = 0; j < 256; j++) - bitmap.pix16(j, i) = m_videobuf[j * 256 + 255 - i]; + for (int i = 0; i < 256; i++) + for (int j = 0; j < 256; j++) + bitmap.pix(j, i) = m_videobuf[j * 256 + 255 - i]; return 0; } diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp index 7fcb6e4df24..6cc15457f04 100644 --- a/src/mame/drivers/royalmah.cpp +++ b/src/mame/drivers/royalmah.cpp @@ -441,7 +441,7 @@ uint32_t royalmah_state::screen_update_royalmah(screen_device &screen, bitmap_rg { uint8_t pen = ((data2 >> 1) & 0x08) | ((data2 << 2) & 0x04) | ((data1 >> 3) & 0x02) | ((data1 >> 0) & 0x01); - bitmap.pix32(y, x) = m_palette->pen((m_palette_base << 4) | pen); + bitmap.pix(y, x) = m_palette->pen((m_palette_base << 4) | pen); x = (m_flip_screen) ? x - 1 : x + 1; data1 = data1 >> 1; diff --git a/src/mame/drivers/rt1715.cpp b/src/mame/drivers/rt1715.cpp index 271d03ded1c..8e7c10ca402 100644 --- a/src/mame/drivers/rt1715.cpp +++ b/src/mame/drivers/rt1715.cpp @@ -424,7 +424,7 @@ WRITE_LINE_MEMBER(rt1715_state::crtc_drq_w) I8275_DRAW_CHARACTER_MEMBER(rt1715_state::crtc_display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = (lten) ? 0xff : 0; if (!vsp) @@ -434,7 +434,7 @@ I8275_DRAW_CHARACTER_MEMBER(rt1715_state::crtc_display_pixels) gfx ^= 0xff; for (u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/rx78.cpp b/src/mame/drivers/rx78.cpp index dcc51357c52..0fb4bb262e3 100644 --- a/src/mame/drivers/rx78.cpp +++ b/src/mame/drivers/rx78.cpp @@ -160,7 +160,7 @@ uint32_t rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, color |= ((pen[2] & 1) << 2); if(color) - bitmap.pix16(y+bordery, x+i+borderx) = color | 8; + bitmap.pix(y+bordery, x+i+borderx) = color | 8; /* fg color */ pen[0] = (m_pri_mask & 0x01) ? (m_vram[count + 0x0000] >> (i)) : 0x00; @@ -172,7 +172,7 @@ uint32_t rx78_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, color |= ((pen[2] & 1) << 2); if(color) - bitmap.pix16(y+bordery, x+i+borderx) = color; + bitmap.pix(y+bordery, x+i+borderx) = color; } count++; } diff --git a/src/mame/drivers/rz1.cpp b/src/mame/drivers/rz1.cpp index c90929eca84..2bd594b568b 100644 --- a/src/mame/drivers/rz1.cpp +++ b/src/mame/drivers/rz1.cpp @@ -206,7 +206,7 @@ HD44780_PIXEL_UPDATE( rz1_state::lcd_pixel_update ) return; if (line < 1 && pos < 16) - bitmap.pix16(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*8*6 + pos*6 + x) = state ? 1 : 2; } uint8_t rz1_state::upd934g_c_data_r(offs_t offset) diff --git a/src/mame/drivers/saitek_intchess.cpp b/src/mame/drivers/saitek_intchess.cpp index 7a65f4aa0f7..3e7d65bf3f8 100644 --- a/src/mame/drivers/saitek_intchess.cpp +++ b/src/mame/drivers/saitek_intchess.cpp @@ -136,7 +136,7 @@ u32 intchess_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c // draw chessboard background for (int y = cliprect.top(); y <= cliprect.bottom(); y++) for (int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix16(y, x) = ((x / 20) ^ (y / 16)) << 1 & 2; + bitmap.pix(y, x) = ((x / 20) ^ (y / 16)) << 1 & 2; // draw the sprites for (int i = 0; i < 64; i++) diff --git a/src/mame/drivers/saitek_risc2500.cpp b/src/mame/drivers/saitek_risc2500.cpp index 1126bfb9e94..6ac03d1ae67 100644 --- a/src/mame/drivers/saitek_risc2500.cpp +++ b/src/mame/drivers/saitek_risc2500.cpp @@ -119,7 +119,7 @@ uint32_t risc2500_state::screen_update(screen_device &screen, bitmap_ind16 &bitm uint8_t gfx = bitswap<8>(m_vram[c*5 + x], 6,5,0,1,2,3,4,7); for(int y=0; y<7; y++) - bitmap.pix16(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; + bitmap.pix(y + 1, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1; } // LCD digits and symbols diff --git a/src/mame/drivers/samcoupe.cpp b/src/mame/drivers/samcoupe.cpp index 6f9032e9052..d6d86d434b2 100644 --- a/src/mame/drivers/samcoupe.cpp +++ b/src/mame/drivers/samcoupe.cpp @@ -383,15 +383,15 @@ uint32_t samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitm void samcoupe_state::draw_mode4_line(int y, int hpos) { /* get start address */ - uint8_t *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + uint8_t const *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 2 pixels (doublewidth) */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; /* move to next address */ vram++; @@ -405,15 +405,15 @@ void samcoupe_state::draw_mode4_line(int y, int hpos) void samcoupe_state::draw_mode3_line(int y, int hpos) { /* get start address */ - uint8_t *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); + uint8_t const *vram = m_videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 4 pixels */ - m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; - m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; + m_bitmap.pix(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; /* move to next address */ vram++; @@ -433,8 +433,8 @@ void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, /* draw block of 8 pixels (doubled to 16) */ for (int i = 0; i < SAM_BLOCK; i++) { - bitmap.pix16(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; - bitmap.pix16(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix(vpos, hpos + i*2 + 0) = BIT(mask, 7 - i) ? ink : pap; + bitmap.pix(vpos, hpos + i*2 + 1) = BIT(mask, 7 - i) ? ink : pap; } } diff --git a/src/mame/drivers/sapi1.cpp b/src/mame/drivers/sapi1.cpp index 0dd6efdc9c2..ef319a6012b 100644 --- a/src/mame/drivers/sapi1.cpp +++ b/src/mame/drivers/sapi1.cpp @@ -383,24 +383,20 @@ INPUT_PORTS_END uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool val; - uint16_t addr,xpos; - uint8_t chr,attr,ra,x,y,b; - - for(y = 0; y < 24; y++ ) + for(uint8_t y = 0; y < 24; y++ ) { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) + uint16_t addr = y*64; + uint16_t xpos = 0; + for(uint8_t x = 0; x < 40; x++ ) { - chr = m_p_videoram[addr + x]; - attr = (chr >> 6) & 3; + uint8_t chr = m_p_videoram[addr + x]; + uint8_t attr = (chr >> 6) & 3; chr &= 0x3f; - for(ra = 0; ra < 9; ra++ ) + for(uint8_t ra = 0; ra < 9; ra++ ) { - for(b = 0; b < 6; b++ ) + for(uint8_t b = 0; b < 6; b++ ) { - val = 0; + bool val = 0; if (ra==8) { @@ -416,12 +412,12 @@ uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bi if(attr==3) { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + bitmap.pix(y*9+ra, xpos+2*b ) = val; + bitmap.pix(y*9+ra, xpos+2*b+1 ) = val; } else { - bitmap.pix16(y*9+ra, xpos+b ) = val; + bitmap.pix(y*9+ra, xpos+b ) = val; } } } @@ -436,26 +432,22 @@ uint32_t sapi_state::screen_update_sapi1(screen_device &screen, bitmap_ind16 &bi // The attributes seem to be different on this one, they need to be understood, so disabled for now uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - bool val; - uint16_t addr,xpos; - uint8_t chr,attr,ra,x,y,b; - - for(y = 0; y < 20; y++ ) + for(uint8_t y = 0; y < 20; y++ ) { - addr = y*64; - xpos = 0; - for(x = 0; x < 40; x++ ) + uint16_t addr = y*64; + uint16_t xpos = 0; + for(uint8_t x = 0; x < 40; x++ ) { - chr = m_p_videoram[addr + x]; - attr = 0;//(chr >> 6) & 3; + uint8_t chr = m_p_videoram[addr + x]; + uint8_t attr = 0;//(chr >> 6) & 3; if (chr > 0x3f) chr &= 0x1f; - for(ra = 0; ra < 9; ra++ ) + for(uint8_t ra = 0; ra < 9; ra++ ) { - for(b = 0; b < 6; b++ ) + for(uint8_t b = 0; b < 6; b++ ) { - val = 0; + bool val = 0; if (ra==8) { @@ -471,12 +463,12 @@ uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bi if(attr==3) { - bitmap.pix16(y*9+ra, xpos+2*b ) = val; - bitmap.pix16(y*9+ra, xpos+2*b+1 ) = val; + bitmap.pix(y*9+ra, xpos+2*b ) = val; + bitmap.pix(y*9+ra, xpos+2*b+1 ) = val; } else { - bitmap.pix16(y*9+ra, xpos+b ) = val; + bitmap.pix(y*9+ra, xpos+b ) = val; } } } @@ -490,17 +482,15 @@ uint32_t sapi_state::screen_update_sapi3(screen_device &screen, bitmap_ind16 &bi MC6845_UPDATE_ROW( sapi_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = gfx = 0; + uint8_t inv = 0, gfx = 0; if (x == cursor_x) inv ^= 0xff; - mem = (2*(ma + x)) & 0xfff; - chr = m_p_videoram[mem] & 0x3f; + uint16_t mem = (2*(ma + x)) & 0xfff; + uint8_t chr = m_p_videoram[mem] & 0x3f; if (ra < 8) gfx = MHB2501[(chr<<3) | ra] ^ inv; diff --git a/src/mame/drivers/sbowling.cpp b/src/mame/drivers/sbowling.cpp index 8e279a63412..96afdf9cba8 100644 --- a/src/mame/drivers/sbowling.cpp +++ b/src/mame/drivers/sbowling.cpp @@ -116,7 +116,7 @@ static void plot_pixel_sbw(bitmap_ind16 *tmpbitmap, int x, int y, int col, int f x = 255 - x; } - tmpbitmap->pix16(y, x) = col; + tmpbitmap->pix(y, x) = col; } void sbowling_state::videoram_w(offs_t offset, uint8_t data) diff --git a/src/mame/drivers/sbrain.cpp b/src/mame/drivers/sbrain.cpp index 19fa3f5d163..d1bdf6adeed 100644 --- a/src/mame/drivers/sbrain.cpp +++ b/src/mame/drivers/sbrain.cpp @@ -624,8 +624,7 @@ u32 sbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con return 0; } - u8 y,ra,chr,gfx; - uint16_t sy=0,x; + uint16_t sy=0; // Where attributes come from: // - Most systems use ram for character-based attributes, but this one uses strictly hardware which would seem cumbersome @@ -639,18 +638,18 @@ u32 sbrain_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con uint16_t ma = m_crtc->top_of_page(); uint16_t cr = m_crtc->cursor_address(); uint8_t *videoram = &m_ram->pointer()[m_ram->size() - 0x800]; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); - for (x = 0; x < 80; x++) + for (uint16_t x = 0; x < 80; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra > 0) { - chr = videoram[(x + ma) & 0x7ff]; + uint8_t chr = videoram[(x + ma) & 0x7ff]; if (!BIT(chr, 7) || BIT(m_framecnt, 5)) { diff --git a/src/mame/drivers/scopus.cpp b/src/mame/drivers/scopus.cpp index 8ec7a778a4b..373e23dafaa 100644 --- a/src/mame/drivers/scopus.cpp +++ b/src/mame/drivers/scopus.cpp @@ -94,11 +94,10 @@ GFXDECODE_END I8275_DRAW_CHARACTER_MEMBER(sagitta180_state::crtc_display_pixels) { - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; - uint8_t pixels; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + uint8_t pixels; if (lten) { pixels = ~0; } else if (vsp != 0 || (linecount & 8) != 0) { @@ -111,8 +110,8 @@ I8275_DRAW_CHARACTER_MEMBER(sagitta180_state::crtc_display_pixels) pixels = ~pixels; } - for (i = 0; i < 7; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (7 - i))) != 0 ]; + for (unsigned i = 0; i < 7; i++) { + bitmap.pix(y, x + i) = palette[ BIT(pixels, 7 - i) ]; } } diff --git a/src/mame/drivers/scv.cpp b/src/mame/drivers/scv.cpp index 3a69a469bee..e9079dd40d7 100644 --- a/src/mame/drivers/scv.cpp +++ b/src/mame/drivers/scv.cpp @@ -300,16 +300,16 @@ inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, uint8_t x, uint8_ x -= 4; if (pat & 0x08) - bitmap.pix16(y + 2, x) = col; + bitmap.pix(y + 2, x) = col; if (pat & 0x04 && x < 255 ) - bitmap.pix16(y + 2, x + 1) = col; + bitmap.pix(y + 2, x + 1) = col; if (pat & 0x02 && x < 254) - bitmap.pix16(y + 2, x + 2) = col; + bitmap.pix(y + 2, x + 2) = col; if (pat & 0x01 && x < 253) - bitmap.pix16(y + 2, x + 3) = col; + bitmap.pix(y + 2, x + 3) = col; } } @@ -354,32 +354,30 @@ inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, inline void scv_state::draw_text( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t *char_data, uint8_t fg, uint8_t bg ) { - int i; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - uint8_t d = char_data[i]; - - bitmap.pix16(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; - bitmap.pix16(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; - bitmap.pix16(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; - bitmap.pix16(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; - bitmap.pix16(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; - bitmap.pix16(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; - bitmap.pix16(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; - bitmap.pix16(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; + uint8_t const d = char_data[i]; + + bitmap.pix(y + i, x + 0 ) = ( d & 0x80 ) ? fg : bg; + bitmap.pix(y + i, x + 1 ) = ( d & 0x40 ) ? fg : bg; + bitmap.pix(y + i, x + 2 ) = ( d & 0x20 ) ? fg : bg; + bitmap.pix(y + i, x + 3 ) = ( d & 0x10 ) ? fg : bg; + bitmap.pix(y + i, x + 4 ) = ( d & 0x08 ) ? fg : bg; + bitmap.pix(y + i, x + 5 ) = ( d & 0x04 ) ? fg : bg; + bitmap.pix(y + i, x + 6 ) = ( d & 0x02 ) ? fg : bg; + bitmap.pix(y + i, x + 7 ) = ( d & 0x01 ) ? fg : bg; } - for ( i = 8; i < 16; i++ ) + for ( int i = 8; i < 16; i++ ) { - bitmap.pix16(y + i, x + 0 ) = bg; - bitmap.pix16(y + i, x + 1 ) = bg; - bitmap.pix16(y + i, x + 2 ) = bg; - bitmap.pix16(y + i, x + 3 ) = bg; - bitmap.pix16(y + i, x + 4 ) = bg; - bitmap.pix16(y + i, x + 5 ) = bg; - bitmap.pix16(y + i, x + 6 ) = bg; - bitmap.pix16(y + i, x + 7 ) = bg; + bitmap.pix(y + i, x + 0 ) = bg; + bitmap.pix(y + i, x + 1 ) = bg; + bitmap.pix(y + i, x + 2 ) = bg; + bitmap.pix(y + i, x + 3 ) = bg; + bitmap.pix(y + i, x + 4 ) = bg; + bitmap.pix(y + i, x + 5 ) = bg; + bitmap.pix(y + i, x + 6 ) = bg; + bitmap.pix(y + i, x + 7 ) = bg; } } @@ -387,35 +385,31 @@ inline void scv_state::draw_text( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, ui inline void scv_state::draw_semi_graph( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t data, uint8_t fg ) { - int i; - if ( ! data ) return; - for ( i = 0; i < 4; i++ ) + for ( int i = 0; i < 4; i++ ) { - bitmap.pix16(y + i, x + 0) = fg; - bitmap.pix16(y + i, x + 1) = fg; - bitmap.pix16(y + i, x + 2) = fg; - bitmap.pix16(y + i, x + 3) = fg; + bitmap.pix(y + i, x + 0) = fg; + bitmap.pix(y + i, x + 1) = fg; + bitmap.pix(y + i, x + 2) = fg; + bitmap.pix(y + i, x + 3) = fg; } } inline void scv_state::draw_block_graph( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t col ) { - int i; - - for ( i = 0; i < 8; i++ ) + for ( int i = 0; i < 8; i++ ) { - bitmap.pix16(y + i, x + 0) = col; - bitmap.pix16(y + i, x + 1) = col; - bitmap.pix16(y + i, x + 2) = col; - bitmap.pix16(y + i, x + 3) = col; - bitmap.pix16(y + i, x + 4) = col; - bitmap.pix16(y + i, x + 5) = col; - bitmap.pix16(y + i, x + 6) = col; - bitmap.pix16(y + i, x + 7) = col; + bitmap.pix(y + i, x + 0) = col; + bitmap.pix(y + i, x + 1) = col; + bitmap.pix(y + i, x + 2) = col; + bitmap.pix(y + i, x + 3) = col; + bitmap.pix(y + i, x + 4) = col; + bitmap.pix(y + i, x + 5) = col; + bitmap.pix(y + i, x + 6) = col; + bitmap.pix(y + i, x + 7) = col; } } diff --git a/src/mame/drivers/scyclone.cpp b/src/mame/drivers/scyclone.cpp index cedb403dc5d..113d0d23104 100644 --- a/src/mame/drivers/scyclone.cpp +++ b/src/mame/drivers/scyclone.cpp @@ -234,9 +234,9 @@ uint32_t scyclone_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bit if (y == star && star != 0 && noclipped) - bitmap.pix32(ypos, x) = paldata[7]; + bitmap.pix(ypos, x) = paldata[7]; else - bitmap.pix32(ypos, x) = paldata[0]; + bitmap.pix(ypos, x) = paldata[0]; } } } @@ -273,13 +273,13 @@ uint32_t scyclone_state::draw_bitmap_and_sprite(screen_device &screen, bitmap_rg uint8_t pal = get_bitmap_pixel(realx, realy); - if (pal) bitmap.pix32(y, (x*8)+i) = paldata[pal]; + if (pal) bitmap.pix(y, (x*8)+i) = paldata[pal]; uint8_t pal2 = get_sprite_pixel(realx, realy); if (pal2 & 0x3) { - bitmap.pix32(y, (x*8)+i) = paldata[8+pal2]; + bitmap.pix(y, (x*8)+i) = paldata[8+pal2]; if (pal == 0x7) m_hascollided = 1; } } diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp index 0ef43817215..c9556c8abe3 100644 --- a/src/mame/drivers/seabattl.cpp +++ b/src/mame/drivers/seabattl.cpp @@ -160,14 +160,12 @@ void seabattl_state::seabattl_colorram_w(offs_t offset, uint8_t data) uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y, offset; - // wave if ( m_waveenable ) { - for ( y = 0; y < 32; y++ ) + for ( int y = 0; y < 32; y++ ) { - for ( x = 0; x < 32; x++ ) + for ( int x = 0; x < 32; x++ ) { m_gfxdecode->gfx(2)->opaque(bitmap,cliprect, (y & 0x0f) + (((x & 0x0f) + ((screen.frame_number() & 0xe0) >> 4)) << 4), 0, 0, 0, x*8, y*8 ); } @@ -183,7 +181,7 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in m_bg_tilemap->draw(screen, m_collision_bg, cliprect, TILEMAP_DRAW_OPAQUE, 0); // sprites (m.obj) - for ( offset = 0; offset < 256; offset++ ) + for ( int offset = 0; offset < 256; offset++ ) { // bits 0-3: sprite num // bits 4-7: x coordinate @@ -200,15 +198,15 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in bitmap_ind16 const &s2636_0_bitmap = m_s2636->update(cliprect); // collisions - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { // bit 0: m.obj - pvi-bkg // bit 1: pvi-bkg - scr.sm.obj // bit 2: m.obj - scr.sm.obj bool obj = (bitmap.pix(y,x) > 0) && (bitmap.pix(y,x) < 8); - bool pvi = S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix16(y, x)); + bool pvi = S2636_IS_PIXEL_DRAWN(s2636_0_bitmap.pix(y, x)); bool scr = (m_collision_bg.pix(y,x) & 1) != 0; if (obj && pvi) @@ -223,14 +221,14 @@ uint32_t seabattl_state::screen_update_seabattl(screen_device &screen, bitmap_in } // s2636 layer - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int pixel = s2636_0_bitmap.pix16(y, x); + int pixel = s2636_0_bitmap.pix(y, x); if (S2636_IS_PIXEL_DRAWN(pixel)) { - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel); } } } diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp index dda7283b45f..15fb868b587 100644 --- a/src/mame/drivers/segac2.cpp +++ b/src/mame/drivers/segac2.cpp @@ -1513,10 +1513,8 @@ uint32_t segac2_state::screen_update_segac2_new(screen_device &screen, bitmap_rg /* Copy our screen buffer here */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t* desty = &bitmap.pix32(y, 0); - uint16_t* srcy; - - srcy = m_vdp->m_render_line_raw.get(); + uint32_t *const desty = &bitmap.pix(y, 0); + uint16_t const *const srcy = m_vdp->m_render_line_raw.get(); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index 1ab6b3be2f9..e9d547ebe07 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -858,16 +858,16 @@ INPUT_PORTS_END uint32_t systeme_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - bitmap_rgb32 &vdp1_bitmap = m_vdp1->get_bitmap(); - bitmap_rgb32 &vdp2_bitmap = m_vdp2->get_bitmap(); - bitmap_ind8 &vdp2_y1 = m_vdp2->get_y1_bitmap(); + bitmap_rgb32 const &vdp1_bitmap = m_vdp1->get_bitmap(); + bitmap_rgb32 const &vdp2_bitmap = m_vdp2->get_bitmap(); + bitmap_ind8 const &vdp2_y1 = m_vdp2->get_y1_bitmap(); for( int y = cliprect.min_y; y <= cliprect.max_y; y++ ) { - uint32_t *dest_ptr = &bitmap.pix32(y); - uint32_t *vdp1_ptr = &vdp1_bitmap.pix32(y); - uint32_t *vdp2_ptr = &vdp2_bitmap.pix32(y); - uint8_t *y1_ptr = &vdp2_y1.pix8(y); + uint32_t *const dest_ptr = &bitmap.pix(y); + uint32_t const *const vdp1_ptr = &vdp1_bitmap.pix(y); + uint32_t const *const vdp2_ptr = &vdp2_bitmap.pix(y); + uint8_t const *const y1_ptr = &vdp2_y1.pix(y); for ( int x = cliprect.min_x; x <= cliprect.max_x; x++ ) { diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp index 533ee43debe..155be049a30 100644 --- a/src/mame/drivers/segahang.cpp +++ b/src/mame/drivers/segahang.cpp @@ -1148,6 +1148,71 @@ ROM_START( hangon2 ) ROM_END //************************************************************************************************************************* +// # VF # +// Hang On spanish bootleg. +// Some customs were replaced with logic components. +// +ROM_START( hangonvf ) + ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code + ROM_LOAD16_BYTE( "9.3n", 0x000000, 0x8000, CRC(20b1c2b0) SHA1(01b4f5105e2bbeb6ec6dbd18bfb728e3a973e0ca) ) + ROM_LOAD16_BYTE( "11.1n", 0x000001, 0x8000, CRC(7d9db1bf) SHA1(952ee3e7a0d57ec1bb3385e0e6675890b8378d31) ) + ROM_LOAD16_BYTE( "8.3k", 0x010000, 0x8000, CRC(fea12367) SHA1(9a1ce5863c562160b657ad948812b43f42d7d0cc) ) + ROM_LOAD16_BYTE( "10.1k", 0x010001, 0x8000, CRC(ac883240) SHA1(f943341ae13e062f3d12c6221180086ce8bdb8c4) ) + + ROM_REGION( 0x40000, "subcpu", 0 ) // second 68000 CPU + ROM_LOAD16_BYTE( "6.6l", 0x0000, 0x8000, CRC(1c95013e) SHA1(8344ac953477279c2c701f984d98292a21dd2f7d) ) + ROM_LOAD16_BYTE( "7.5l", 0x0001, 0x8000, CRC(6ca30d69) SHA1(ed933351883ebf6d9ef9428a81d09749b609cd60) ) + + ROM_REGION( 0x18000, "gfx1", 0 ) // tiles + ROM_LOAD( "2.3j", 0x00000, 0x08000, CRC(255a3a58) SHA1(980372ab94949d1476282c83af0a08cc0555f1cd) ) + ROM_LOAD( "3.2j", 0x08000, 0x08000, CRC(88b9ffd9) SHA1(7ecfab266f05d5f919806f195fb2572f220fdf68) ) + ROM_LOAD( "4.1j", 0x10000, 0x08000, CRC(18882328) SHA1(737c025701877845fad63af145506a57c775f8e0) ) + + ROM_REGION16_BE( 0x80000, "sprites", 0 ) // sprites + ROM_LOAD16_BYTE( "19.5b", 0x000001, 0x8000, CRC(469dad07) SHA1(6d01c0b3506e28832928ad74d518577ff5be323b) ) + ROM_LOAD16_BYTE( "25.6b", 0x000000, 0x8000, CRC(87cbc6de) SHA1(b64652e062e1b88c6f6ae8dd2ffe4533bb27ba45) ) + ROM_LOAD16_BYTE( "18.5c", 0x010001, 0x8000, CRC(15792969) SHA1(b061dbf24e8b511116446794753c8b0cc49e2149) ) + ROM_LOAD16_BYTE( "24.6c", 0x010000, 0x8000, CRC(e9718de5) SHA1(30e3a7d5b33504da03c5780b4a946b977e46098a) ) + ROM_LOAD16_BYTE( "17.5d", 0x020001, 0x8000, CRC(49422691) SHA1(caee2a4a3f4587ae27dec330214edaa1229012af) ) + ROM_LOAD16_BYTE( "23.6d", 0x020000, 0x8000, CRC(701deaa4) SHA1(053032ef886b85a4cb4753d17b3c27d228695157) ) + ROM_LOAD16_BYTE( "16.5e", 0x030001, 0x8000, CRC(f003a000) SHA1(da7fc41d3116ebb108effcd9ffa86e873e8ff6e7) ) + ROM_LOAD16_BYTE( "22.6e", 0x030000, 0x8000, CRC(08b007e2) SHA1(db63d38472c8df13f0bbabb20b6e33c9c6c46664) ) + ROM_LOAD16_BYTE( "15.5f", 0x040001, 0x8000, CRC(7fa1bfb6) SHA1(a27b54c93613372f59050f0b2182d2984a8d2efe) ) + ROM_LOAD16_BYTE( "21.6f", 0x040000, 0x8000, CRC(8e880c93) SHA1(8c55deec065daf09a5d1c1c1f3f3f7bc1aeaf563) ) + ROM_LOAD16_BYTE( "14.5h", 0x050001, 0x8000, CRC(47e63dd1) SHA1(40fb4400e1e8c8193c69154c5c08a9a69a8bca0d) ) + ROM_LOAD16_BYTE( "20.6h", 0x050000, 0x8000, CRC(33d1aa6e) SHA1(1bd78d442cce2a39f1186b142d8a24bce286ad64) ) + ROM_LOAD16_BYTE( "12.3f", 0x060001, 0x8000, CRC(22fc088e) SHA1(d84570a802e696b67a587bee154620d97d75a7aa) ) + ROM_LOAD16_BYTE( "13.4f", 0x060000, 0x8000, CRC(032738ba) SHA1(6b8e7e229d04f852e72acfdfa8721b4b22681208) ) + + ROM_REGION( 0x8000, "segaic16road", 0 ) // road gfx + ROM_LOAD( "5.9r", 0x0000, 0x8000, CRC(581230e3) SHA1(954eab35059322a12a197bba04bf85f816132f20) ) + + ROM_REGION( 0x10000, "soundcpu", 0 ) // sound CPU + ROM_LOAD( "28.12h", 0x00000, 0x4000, CRC(3b942f5f) SHA1(4384b5c090954e69de561dde0ef32104aa11399a) ) + + ROM_REGION( 0x10000, "pcm", 0 ) // Sega PCM sound data + ROM_LOAD( "26.1e", 0x00000, 0x8000, CRC(cfef5481) SHA1(c04b302fee58f0e59a097b2be2b61e5d03df7c91) ) + ROM_LOAD( "27.1g", 0x08000, 0x8000, CRC(4165aea5) SHA1(be05c6d295807af2f396a1ff72d5a3d2a1e6054d) ) + + ROM_REGION( 0x2000, "sprites:zoom", 0 ) // zoom table + ROM_LOAD( "1.9d", 0x0000, 0x2000, CRC(e3ec7bd6) SHA1(feec0fe664e16fac0fde61cf64b401b9b0575323) ) + + ROM_REGION( 0x1400, "plds", 0 ) + ROM_LOAD( "a_pal16r4a.9e", 0x0000, 0x0104, NO_DUMP ) + ROM_LOAD( "b_pls153an.9f", 0x0200, 0x00eb, NO_DUMP ) + ROM_LOAD( "c_pal16r6a.7m", 0x0400, 0x0104, NO_DUMP ) + ROM_LOAD( "d_pal16r6a.7r", 0x0600, 0x0104, NO_DUMP ) + ROM_LOAD( "e_pal16r6a.7s", 0x0800, 0x0104, NO_DUMP ) + ROM_LOAD( "f_pls153n.6s", 0x0a00, 0x00eb, NO_DUMP ) + ROM_LOAD( "g_pal16l8a.3r", 0x0c00, 0x0104, NO_DUMP ) + // no PLD marked 'H' + ROM_LOAD( "i_pls153n_snd.6f", 0x0e00, 0x00eb, NO_DUMP ) + ROM_LOAD( "j_pal16l8a_db.bin", 0x1000, 0x0104, NO_DUMP ) + ROM_LOAD( "k_pal16r4a_db.bin", 0x1200, 0x0104, NO_DUMP ) +ROM_END + + +//************************************************************************************************************************* //************************************************************************************************************************* //************************************************************************************************************************* // Super Hang-On (Japan Ver.) @@ -2195,26 +2260,27 @@ void segahang_state::init_endurob2() // GAME DRIVERS //************************************************************************** -// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS -GAME( 1985, hangon, 0, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A)", 0 ) -GAME( 1985, hangon1, hangon, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On", 0 ) -GAME( 1985, hangon2, hangon, hangon, hangon2, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A, ride-on)", 0 ) +// YEAR, NAME, PARENT, MACHINE, INPUT, STATE INIT, ROT, COMPANY, FULLNAME, FLAGS +GAME( 1985, hangon, 0, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A)", 0 ) +GAME( 1985, hangon1, hangon, hangon, hangon, segahang_state, init_generic, ROT0, "Sega", "Hang-On", 0 ) +GAME( 1985, hangon2, hangon, hangon, hangon2, segahang_state, init_generic, ROT0, "Sega", "Hang-On (Rev A, ride-on)", 0 ) +GAME( 1985, hangonvf, hangon, hangon, hangon, segahang_state, init_generic, ROT0, "bootleg", "VF (bootleg of Hang-On)", 0 ) -GAME( 1987, shangonro, shangon, shangonro,shangonro, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, ride-on, Japan, FD1094 317-0038)", 0 ) -GAME( 1987, shangonho, shangon, shangonro,shangupb, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, Japan, FD1094 317-0039)", 0 ) -GAME( 1992, shangonrb, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg", "Super Hang-On (Hang-On conversion, bootleg)", 0 ) -GAME( 1987, shangonrb2, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg (Beta)", "Super Hang-On (Hang-On conversion, Beta bootleg)", 0 ) +GAME( 1987, shangonro, shangon, shangonro,shangonro, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, ride-on, Japan, FD1094 317-0038)", 0 ) +GAME( 1987, shangonho, shangon, shangonro,shangupb, segahang_state, init_generic, ROT0, "Sega", "Super Hang-On (Hang-On conversion, Japan, FD1094 317-0039)", 0 ) +GAME( 1992, shangonrb, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg", "Super Hang-On (Hang-On conversion, bootleg)", 0 ) +GAME( 1987, shangonrb2, shangon, shangupb, shangupb, segahang_state, init_generic, ROT0, "bootleg (Beta)", "Super Hang-On (Hang-On conversion, Beta bootleg)", 0 ) -GAME( 1985, sharrier, 0, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (Rev A, 8751 315-5163A)", 0 ) -GAME( 1985, sharrier1, sharrier, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (8751 315-5163)", 0 ) +GAME( 1985, sharrier, 0, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (Rev A, 8751 315-5163A)", 0 ) +GAME( 1985, sharrier1, sharrier, sharrier, sharrier, segahang_state, init_sharrier, ROT0, "Sega", "Space Harrier (8751 315-5163)", 0 ) -GAME( 1986, enduror, 0, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, FD1089B 317-0013A)", 0 ) -GAME( 1986, endurora, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, mask ROM sprites, FD1089B 317-0013A)", 0 ) -GAME( 1986, endurorb, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2151, FD1089B 317-0013A)", 0 ) -GAME( 1986, enduror1, enduror, enduror1, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2203, FD1089B 317-0013A)", 0 ) -GAME( 1986, endurobl, enduror, endurobl, enduror, segahang_state, init_endurobl, ROT0, "bootleg", "Enduro Racer (bootleg set 1)", 0 ) -GAME( 1986, endurob2, enduror, endurob2, enduror, segahang_state, init_endurob2, ROT0, "bootleg", "Enduro Racer (bootleg set 2)", MACHINE_NOT_WORKING ) +GAME( 1986, enduror, 0, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, FD1089B 317-0013A)", 0 ) +GAME( 1986, endurora, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (Rev A, YM2151, mask ROM sprites, FD1089B 317-0013A)", 0 ) +GAME( 1986, endurorb, enduror, enduror, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2151, FD1089B 317-0013A)", 0 ) +GAME( 1986, enduror1, enduror, enduror1, enduror, segahang_state, init_enduror, ROT0, "Sega", "Enduro Racer (YM2203, FD1089B 317-0013A)", 0 ) +GAME( 1986, endurobl, enduror, endurobl, enduror, segahang_state, init_endurobl, ROT0, "bootleg", "Enduro Racer (bootleg set 1)", 0 ) +GAME( 1986, endurob2, enduror, endurob2, enduror, segahang_state, init_endurob2, ROT0, "bootleg", "Enduro Racer (bootleg set 2)", MACHINE_NOT_WORKING ) -GAME( 1986, endurord, enduror, endurord, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of Rev A, YM2151, FD1089B 317-0013A set)", 0 ) -GAME( 1986, enduror1d, enduror, enduror1d, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of YM2203, FD1089B 317-0013A set)", 0 ) +GAME( 1986, endurord, enduror, endurord, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of Rev A, YM2151, FD1089B 317-0013A set)", 0 ) +GAME( 1986, enduror1d, enduror, enduror1d, enduror, segahang_state, init_enduror, ROT0, "bootleg", "Enduro Racer (bootleg of YM2203, FD1089B 317-0013A set)", 0 ) diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp index 6450e7079d1..0f582a324d8 100644 --- a/src/mame/drivers/sfbonus.cpp +++ b/src/mame/drivers/sfbonus.cpp @@ -1036,17 +1036,15 @@ uint32_t sfbonus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* render reels to bitmap */ draw_reel_layer(screen,*m_temp_reel_bitmap,cliprect,0); + for (int y = 0; y < 288; y++) { - for (int y = 0; y < 288; y++) + uint16_t const *const src = &m_temp_reel_bitmap->pix(y); + uint16_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 512; x++) { - for (int x = 0; x < 512; x++) - { - uint16_t* src = &m_temp_reel_bitmap->pix16(y, x); - uint16_t* dst = &bitmap.pix16(y, x); - - if ((src[0]&0x100)==0x000) - dst[0] = src[0]; - } + if ((src[x]&0x100)==0x000) + dst[x] = src[x]; } } @@ -1059,17 +1057,15 @@ uint32_t sfbonus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } m_tilemap->draw(screen, bitmap, cliprect, 0,0); + for (int y = 0; y < 288; y++) { - for (int y = 0; y < 288; y++) + uint16_t const *const src = &m_temp_reel_bitmap->pix(y); + uint16_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 512; x++) { - for (int x = 0; x < 512; x++) - { - uint16_t* src = &m_temp_reel_bitmap->pix16(y, x); - uint16_t* dst = &bitmap.pix16(y, x); - - if ((src[0]&0x100)==0x100) - dst[0] = src[0]-0x100; - } + if ((src[x]&0x100)==0x100) + dst[x] = src[x]-0x100; } } #if 0 diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp index 625c19ff817..4dc39adc9fb 100644 --- a/src/mame/drivers/shougi.cpp +++ b/src/mame/drivers/shougi.cpp @@ -217,7 +217,7 @@ uint32_t shougi_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap color= ((data1>>x) & 1) | (((data1>>(4+x)) & 1)<<1); data = ((data2>>x) & 1) | (((data2>>(4+x)) & 1)<<1); - bitmap.pix16(255-sy, 255-(sx*4 + x)) = color*4 + data; + bitmap.pix(255-sy, 255-(sx*4 + x)) = color*4 + data; } } diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp index 99fdfb37bbd..0ec089f9b74 100644 --- a/src/mame/drivers/sigmab98.cpp +++ b/src/mame/drivers/sigmab98.cpp @@ -528,8 +528,8 @@ void sigmab98_base_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl dstdyy /= 2; // Transform the source image while drawing to the screen - uint16_t *src = &m_sprite_bitmap->pix16(0); - uint16_t *dst = &bitmap.pix16(0); + uint16_t const *const src = &m_sprite_bitmap->pix(0); + uint16_t *const dst = &bitmap.pix(0); int src_rowpixels = m_sprite_bitmap->rowpixels(); int dst_rowpixels = bitmap.rowpixels(); diff --git a/src/mame/drivers/sk101bl.cpp b/src/mame/drivers/sk101bl.cpp index 0e60fa81c86..8abd709bea2 100644 --- a/src/mame/drivers/sk101bl.cpp +++ b/src/mame/drivers/sk101bl.cpp @@ -87,7 +87,7 @@ void sk101bl_state::machine_reset() HD44780_PIXEL_UPDATE(sk101bl_state::pixel_update) { if (pos < 16 && line == 0) - bitmap.pix16(line * 10 + y, pos * 6 + x) = state; + bitmap.pix(line * 10 + y, pos * 6 + x) = state; } u8 sk101bl_state::p1_r() diff --git a/src/mame/drivers/skeetsht.cpp b/src/mame/drivers/skeetsht.cpp index 4ffb1851f85..1d468709110 100644 --- a/src/mame/drivers/skeetsht.cpp +++ b/src/mame/drivers/skeetsht.cpp @@ -90,13 +90,12 @@ void skeetsht_state::video_start() TMS340X0_SCANLINE_RGB32_CB_MEMBER(skeetsht_state::scanline_update) { - const pen_t *const pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); uint16_t *vram = &m_tms_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint32_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/skimaxx.cpp b/src/mame/drivers/skimaxx.cpp index f50ead130f9..d7d4b13cb00 100644 --- a/src/mame/drivers/skimaxx.cpp +++ b/src/mame/drivers/skimaxx.cpp @@ -224,9 +224,9 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(skimaxx_state::scanline_update) if (params->rowaddr >= 0x220) { u32 const rowaddr = (params->rowaddr - 0x220); - u16 *fg = &m_fg_buffer[rowaddr << 8]; - u32 *bg = &m_bg_buffer_front[rowaddr/2 * 1024/2]; - u16 *dest = &bitmap.pix16(scanline); + u16 const *fg = &m_fg_buffer[rowaddr << 8]; + u32 const *bg = &m_bg_buffer_front[rowaddr/2 * 1024/2]; + u16 *dest = &bitmap.pix(scanline); //int coladdr = params->coladdr; //coladdr = 0; diff --git a/src/mame/drivers/sliver.cpp b/src/mame/drivers/sliver.cpp index 9aec09572d3..13110011ade 100644 --- a/src/mame/drivers/sliver.cpp +++ b/src/mame/drivers/sliver.cpp @@ -169,21 +169,19 @@ void sliver_state::plot_pixel_rgb(int x, int y, uint32_t r, uint32_t g, uint32_t if (y < 0 || x < 0 || x > 383 || y > 255) return; - m_bitmap_bg.pix32(y, x) = r | (g<<8) | (b<<16); + m_bitmap_bg.pix(y, x) = r | (g<<8) | (b<<16); } void sliver_state::plot_pixel_pal(int x, int y, int addr) { - uint32_t r,g,b; - if (y < 0 || x < 0 || x > 383 || y > 255) return; - b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3); - g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3); - r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3); + uint32_t b=(m_colorram[addr] << 2) | (m_colorram[addr] & 0x3); + uint32_t g=(m_colorram[addr+0x100] << 2) | (m_colorram[addr+0x100] & 3); + uint32_t r=(m_colorram[addr+0x200] << 2) | (m_colorram[addr+0x200] & 3); - m_bitmap_fg.pix32(y, x) = r | (g<<8) | (b<<16); + m_bitmap_fg.pix(y, x) = r | (g<<8) | (b<<16); } void sliver_state::fifo_data_w(offs_t offset, uint16_t data, uint16_t mem_mask) diff --git a/src/mame/drivers/slotcarn.cpp b/src/mame/drivers/slotcarn.cpp index 937273676ac..436dae1b6f0 100644 --- a/src/mame/drivers/slotcarn.cpp +++ b/src/mame/drivers/slotcarn.cpp @@ -115,28 +115,23 @@ MC6845_UPDATE_ROW( slotcarn_state::crtc_update_row ) int extra_video_bank_bit = 0; // not used? int lscnblk = 0; // not used? - uint8_t *gfx[2]; uint16_t x = 0; - int rlen; - gfx[0] = memregion("gfx1")->base(); - gfx[1] = memregion("gfx2")->base(); - rlen = memregion("gfx2")->bytes(); + uint8_t const *const gfx[2] = { memregion("gfx1")->base(), memregion("gfx2")->base() }; + int const rlen = memregion("gfx2")->bytes(); //ma = ma ^ 0x7ff; for (uint8_t cx = 0; cx < x_count; cx++) { - int i; int attr = m_ram_attr[ma & 0x7ff]; int region = (attr & 0x40) >> 6; int addr = ((m_ram_video[ma & 0x7ff] | ((attr & 0x80) << 1) | (extra_video_bank_bit)) << 4) | (ra & 0x0f); int colour = (attr & 0x7f) << 3; - uint8_t *data; addr &= (rlen-1); - data = gfx[region]; + uint8_t const *const data = gfx[region]; - for (i = 7; i>=0; i--) + for (int i = 7; i>=0; i--) { int col = colour; @@ -150,7 +145,7 @@ MC6845_UPDATE_ROW( slotcarn_state::crtc_update_row ) col |= 0x03; col = m_ram_palette[col & 0x3ff]; - bitmap.pix32(y, x) = m_pens[col ? col & (NUM_PENS-1) : (lscnblk ? 8 : 0)]; + bitmap.pix(y, x) = m_pens[col ? col & (NUM_PENS-1) : (lscnblk ? 8 : 0)]; x++; } diff --git a/src/mame/drivers/sm1800.cpp b/src/mame/drivers/sm1800.cpp index 342991fa81c..949ceb2f7c2 100644 --- a/src/mame/drivers/sm1800.cpp +++ b/src/mame/drivers/sm1800.cpp @@ -99,9 +99,8 @@ INTERRUPT_GEN_MEMBER(sm1800_state::vblank_interrupt) I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *charmap = memregion("chargen")->base(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const charmap = memregion("chargen")->base(); uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; @@ -112,8 +111,8 @@ I8275_DRAW_CHARACTER_MEMBER( sm1800_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - for(i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + for(int i=0;i<8;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } void sm1800_state::portb_w(uint8_t data) diff --git a/src/mame/drivers/sm7238.cpp b/src/mame/drivers/sm7238.cpp index 636ad4e0c7b..037dbee0c1f 100644 --- a/src/mame/drivers/sm7238.cpp +++ b/src/mame/drivers/sm7238.cpp @@ -228,30 +228,30 @@ void sm7238_state::recompute_parameters() uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y, ra, gfx, fg, bg, attr, ctl1, ctl2 = 0; - uint16_t chr, chraddr, sy = 0, ma = 0, x = 0; - bool double_width = false, double_height = false, bottom_half = false; - bool blink((m_screen->frame_number() % 30) > 14); // XXX guess - if (!BIT(m_video.control, 3)) { bitmap.fill(0); return 0; } - for (y = 0; y < 26; y++) + uint8_t ctl2 = 0; + uint16_t sy = 0, ma = 0; + bool double_width = false, double_height = false, bottom_half = false; + bool blink((m_screen->frame_number() % 30) > 14); // XXX guess + + for (uint8_t y = 0; y < 26; y++) { - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { if (y == 1 && ctl2 && ra < ctl2) continue; - uint16_t *p = &bitmap.pix16(sy++, 0); + uint16_t *p = &bitmap.pix(sy++, 0); - for (x = ma; x < ma + m_video.stride; x++) + for (uint16_t x = ma; x < ma + m_video.stride; x++) { - chr = m_p_videoram[x] << 4; - attr = m_p_videoram[x + 0x1000]; + uint16_t chr = m_p_videoram[x] << 4; + uint8_t const attr = m_p_videoram[x + 0x1000]; // alternate font 1 if (BIT(attr, 6)) @@ -259,9 +259,10 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap chr += 0x1000; } - bg = 0; - fg = 1; + uint8_t bg = 0; + uint8_t fg = 1; + uint16_t chraddr; if (double_height) { chraddr = chr | (bottom_half ? (5 + (ra >> 1)) : (ra >> 1)); @@ -272,6 +273,7 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } // alternate font 2 (downloadable font) -- only in models .05 and .06 + uint8_t gfx; if (BIT(attr, 7) && m_p_charram[chr + 15]) { gfx = m_p_charram[chraddr] ^ 255; @@ -318,7 +320,7 @@ uint32_t sm7238_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (double_width) x++; } } - ctl1 = m_p_videoram[ma + 0x1000 + m_video.stride]; + uint8_t const ctl1 = m_p_videoram[ma + 0x1000 + m_video.stride]; double_width = BIT(ctl1, 6); double_height = BIT(ctl1, 7); bottom_half = BIT(ctl1, 5); diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp index ab95effa741..980990dc82d 100644 --- a/src/mame/drivers/smc777.cpp +++ b/src/mame/drivers/smc777.cpp @@ -164,47 +164,44 @@ void smc777_state::video_start() uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,yi; uint16_t count; - int x_width; // popmessage("%d %d %d %d",mc6845_v_char_total,mc6845_v_total_adj,mc6845_v_display,mc6845_v_sync_pos); bitmap.fill(m_palette->pen(m_backdrop_pen), cliprect); - x_width = ((m_display_reg & 0x80) >> 7); + int x_width = ((m_display_reg & 0x80) >> 7); count = 0x0000; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(y=0;y<200;y+=8) + for(int y=0;y<200;y+=8) { - for(x=0;x<160;x++) + for(int x=0;x<160;x++) { - uint16_t color; + uint16_t color = (m_gvram[count] & 0xf0) >> 4; - color = (m_gvram[count] & 0xf0) >> 4; /* todo: clean this up! */ //if(x_width) { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+0+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+1+CRTC_MIN_X) = m_palette->pen(color); } //else //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); + // bitmap.pix(y+yi+CRTC_MIN_Y, x*2+0+CRTC_MIN_X) = m_palette->pen(color); //} color = (m_gvram[count] & 0x0f) >> 0; //if(x_width) { - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); - bitmap.pix16(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+2+CRTC_MIN_X) = m_palette->pen(color); + bitmap.pix(y+yi+CRTC_MIN_Y, x*4+3+CRTC_MIN_X) = m_palette->pen(color); } //else //{ - // bitmap.pix16(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); + // bitmap.pix(y+yi+CRTC_MIN_Y, x*2+1+CRTC_MIN_X) = m_palette->pen(color); //} count++; @@ -216,9 +213,9 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 count = 0x0000; - for(y=0;y<25;y++) + for(int y=0;y<25;y++) { - for(x=0;x<80/(x_width+1);x++) + for(int x=0;x<80/(x_width+1);x++) { /* -x-- ---- blink @@ -229,11 +226,9 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 int color = m_attr[count] & 7; int bk_color = (m_attr[count] & 0x18) >> 3; int blink = m_attr[count] & 0x40; - int xi; - int bk_pen; //int bk_struct[4] = { -1, 0x10, 0x11, (color & 7) ^ 8 }; - bk_pen = -1; + int bk_pen = -1; switch(bk_color & 3) { case 0: bk_pen = -1; break; //transparent @@ -245,23 +240,21 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 if(blink && m_screen->frame_number() & 0x10) //blinking, used by Dragon's Alphabet color = bk_pen; - for(yi=0;yi<8;yi++) + for(int yi=0;yi<8;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int pen; - - pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; + int pen = ((m_pcg[tile*8+yi]>>(7-xi)) & 1) ? (color+m_pal_mode) : bk_pen; if (pen != -1) { if(x_width) { - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); - bitmap.pix16(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+0+CRTC_MIN_X) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, (x*8+xi)*2+1+CRTC_MIN_X) = m_palette->pen(pen); } else - bitmap.pix16(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); + bitmap.pix(y*8+CRTC_MIN_Y+yi, x*8+CRTC_MIN_X+xi) = m_palette->pen(pen); } } } @@ -269,9 +262,7 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 // draw cursor if(mc6845_cursor_addr == count) { - int xc,yc,cursor_on; - - cursor_on = 0; + int cursor_on = 0; switch(mc6845_cursor_y_start & 0x60) { case 0x00: cursor_on = 1; break; //always on @@ -282,17 +273,17 @@ uint32_t smc777_state::screen_update_smc777(screen_device &screen, bitmap_ind16 if(cursor_on) { - for(yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) + for(int yc=0;yc<(8-(mc6845_cursor_y_start & 7));yc++) { - for(xc=0;xc<8;xc++) + for(int xc=0;xc<8;xc++) { if(x_width) { - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+0+CRTC_MIN_X) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, (x*8+xc)*2+1+CRTC_MIN_X) = m_palette->pen(0x7); } else - bitmap.pix16(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); + bitmap.pix(y*8+CRTC_MIN_Y-yc+7, x*8+CRTC_MIN_X+xc) = m_palette->pen(0x7); } } } diff --git a/src/mame/drivers/smotor.cpp b/src/mame/drivers/smotor.cpp index 0479bb8b41b..7bca82cc50d 100644 --- a/src/mame/drivers/smotor.cpp +++ b/src/mame/drivers/smotor.cpp @@ -233,7 +233,7 @@ uint32_t smotor_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_bg_tilemap->set_scrolly((m_videoreg[3] + (m_videoreg[5] << 8))); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); } else { - bitmap.fill(rgb_t::black(), cliprect); + bitmap.fill(0, cliprect); } m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); diff --git a/src/mame/drivers/smsmcorp.cpp b/src/mame/drivers/smsmcorp.cpp index c89f7cfce31..d67da1b4289 100644 --- a/src/mame/drivers/smsmcorp.cpp +++ b/src/mame/drivers/smsmcorp.cpp @@ -448,7 +448,6 @@ void smsmfg_state::video_w(offs_t offset, uint8_t data) m_vid_regs[offset] = data; if ( offset == 5 ) { - int x,y; int xstart = m_vid_regs[0] + m_vid_regs[1]*256; int width = m_vid_regs[2]; int ystart = m_vid_regs[3]; @@ -461,12 +460,12 @@ void smsmfg_state::video_w(offs_t offset, uint8_t data) if ( width == 0 ) width = 256; - for ( y = ystart; y < ystart + height; y++ ) + for ( int y = ystart; y < ystart + height; y++ ) { - for ( x = xstart; x < xstart + width; x++ ) + for ( int x = xstart; x < xstart + width; x++ ) { if ( y < 256 ) - m_bitmap.pix16(y, x) = color; + m_bitmap.pix(y, x) = color; } } } diff --git a/src/mame/drivers/socrates.cpp b/src/mame/drivers/socrates.cpp index 768feeac3a2..4c2da8d187e 100644 --- a/src/mame/drivers/socrates.cpp +++ b/src/mame/drivers/socrates.cpp @@ -809,36 +809,33 @@ void socrates_state::video_start() uint32_t socrates_state::screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - static const uint8_t fixedcolors[8] = - { - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 - }; - uint8_t *videoram = m_vram_reg->base(); - int x, y, colidx, color; + static const uint8_t fixedcolors[8] = { + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0xF7 }; + uint8_t const *const videoram = m_vram_reg->base(); int lineoffset = 0; // if display ever tries to display data at 0xfxxx, offset line displayed by 0x1000 - for (y = 0; y < 228; y++) + for (int y = 0; y < 228; y++) { if ((((y+m_scroll_offset)*128)&0xffff) >= 0xf000) lineoffset = 0x1000; // see comment above - for (x = 0; x < 264; x++) + for (int x = 0; x < 264; x++) { + int color; if (x < 256) { - colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; + int colidx =videoram[(((y+m_scroll_offset)*128)+(x>>1)+lineoffset)&0xffff]; if (x&1) colidx >>=4; colidx &= 0xF; if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; } else { - colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; + int colidx = videoram[(((y+m_scroll_offset)*128)+(127)+lineoffset)&0xffff]; colidx >>=4; colidx &= 0xF; if (colidx > 7) color=videoram[0xF000+(colidx<<8)+((y+m_scroll_offset)&0xFF)]; else color=fixedcolors[colidx]; - bitmap.pix16(y, x) = color; } + bitmap.pix(y, x) = color; } } return 0; @@ -898,7 +895,7 @@ uint32_t iqunlimz_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for(int b=0; b<2; b++) { - bitmap.pix16(y, x*2 + b) = get_color(data & 0x0f, y); + bitmap.pix(y, x*2 + b) = get_color(data & 0x0f, y); data >>= 4; } } @@ -932,7 +929,7 @@ uint32_t iqunlimz_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int cx=0; cx<6; cx++) { int px = 8 + x*6 + cx; - bitmap.pix16(py, px) = BIT(data, 7) ? col1 : col0; + bitmap.pix(py, px) = BIT(data, 7) ? col1 : col0; data <<= 1; } } diff --git a/src/mame/drivers/sorcerer.cpp b/src/mame/drivers/sorcerer.cpp index 63b2002ad13..8e507a39ca7 100644 --- a/src/mame/drivers/sorcerer.cpp +++ b/src/mame/drivers/sorcerer.cpp @@ -391,22 +391,20 @@ GFXDECODE_END uint32_t sorcerer_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space& program = m_maincpu->space(AS_PROGRAM); - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0xf080,x; - uint16_t *p; + uint16_t sy=0,ma=0xf080; - for (y = 0; y < 30; y++) + for (uint8_t y = 0; y < 30; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+64; x++) + for (uint16_t x = ma; x < ma+64; x++) { - chr = program.read_byte(x); + uint8_t const chr = program.read_byte(x); /* get pattern of pixels for that character scanline */ - gfx = program.read_byte(0xf800 | (chr<<3) | ra); + uint8_t const gfx = program.read_byte(0xf800 | (chr<<3) | ra); /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/spaceg.cpp b/src/mame/drivers/spaceg.cpp index 176219979db..5c8e169c2d0 100644 --- a/src/mame/drivers/spaceg.cpp +++ b/src/mame/drivers/spaceg.cpp @@ -341,18 +341,15 @@ uint8_t spaceg_state::colorram_r(offs_t offset) uint32_t spaceg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; uint8_t data = m_videoram[offs]; int y = offs & 0xff; int x = (offs >> 8) << 3; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - bitmap.pix16(y, x) = (data & 0x80) ? m_colorram[offs] : 0; + bitmap.pix(y, x) = (data & 0x80) ? m_colorram[offs] : 0; x++; data <<= 1; diff --git a/src/mame/drivers/spc1500.cpp b/src/mame/drivers/spc1500.cpp index c6732deed1f..8fc2d1eefac 100644 --- a/src/mame/drivers/spc1500.cpp +++ b/src/mame/drivers/spc1500.cpp @@ -523,36 +523,29 @@ MC6845_RECONFIGURE(spc1500_state::crtc_reconfig) MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) { - uint8_t han2; - uint8_t *pf; + uint8_t const *pf; uint16_t hfnt; - int i; - int j; - int h1, h2, h3; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); unsigned char cho[] ={1,1,1,1,1,1,1,1,0,0,1,1,1,3,5,5,0,0,5,3,3,5,5,5,0,0,3,3,5,1}; unsigned char jong[]={0,0,0,1,1,1,1,1,0,0,1,1,1,2,2,2,0,0,2,2,2,2,2,2,0,0,2,2,1,1}; - bool inv = false; char hs = (m_crtc_vreg[0x9] < 15 ? 3 : 4); int n = y & (m_crtc_vreg[0x9]); bool ln400 = (hs == 4 && m_crtc_vreg[0x4] > 20); - uint8_t *vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13]; - for (i = 0; i < x_count; i++) + uint8_t const *const vram = &m_p_videoram[0] + (m_crtc_vreg[12] << 8) + m_crtc_vreg[13]; + for (int i = 0; i < x_count; i++) { - uint8_t *pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)]; - uint8_t *pv = &vram[(y>>hs)*x_count + i]; + uint8_t const *const pp = &vram[0x2000+((y>>hs)*x_count+(((y)&7)<<11))+i+(((hs==4)&&(y&8))?0x400:0)]; + uint8_t const *const pv = &vram[(y>>hs)*x_count + i]; uint8_t ascii = *(pv+0x1000); uint8_t attr = *pv; - inv = (attr & 0x8 ? true : false); + bool inv = (attr & 0x8 ? true : false); uint8_t color = attr & 0x7; uint8_t pixelb = *(pp+0); uint8_t pixelr = *(pp+0x4000); uint8_t pixelg = *(pp+0x8000); bool nopalet = ((m_palet[0] | m_palet[1] | m_palet[2])==0 || ln400); uint8_t pen = (nopalet ? color : m_paltbl[color]); - uint8_t pixelpen = 0; - uint8_t pixel = 0; if (hs == 4 && (ascii & 0x80)) { uint16_t wpixelb = (pixelb << 8) + (*(pp+1)); @@ -560,10 +553,10 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) uint16_t wpixelg = (pixelg << 8) + (*(pp+0x8001)); if (ascii != 0xfa) { - han2 = *(pv+0x1001); - h1 = (ascii>>2)&0x1f; - h2 = ((ascii<<3)|(han2>>5))&0x1f; - h3 = (han2)&0x1f; + uint8_t han2 = *(pv+0x1001); + int h1 = (ascii>>2)&0x1f; + int h2 = ((ascii<<3)|(han2>>5))&0x1f; + int h3 = (han2)&0x1f; pf = &m_font[0x2000+(h1 * 32) + (cho[h2] + (h3 != 0) -1) * 16 * 2 * 32 + n]; hfnt = (*pf << 8) | (*(pf+16)); pf = &m_font[0x4000+(h2 * 32) + (h3 == 0 ? 0 : 1) * 16 * 2 * 32 + n]; @@ -578,26 +571,26 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) hfnt = (*pf << 8) | (*(pf+16)); } hfnt = (inv ? 0xffff - hfnt : hfnt); - for (j = 0x8000; j > 0; j>>=1) + for (int j = 0x8000; j > 0; j>>=1) { - pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0)); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixel = ((wpixelg&j ? 4:0 )|(wpixelr&j? 2:0)|(wpixelb&j ? 1:0)); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); *p++ = m_palette->pen(((hfnt & j) || (m_priority & (1<<pixel))) ? pixelpen : pen); } i++; } else if (attr & 0x20) { - uint8_t *pa = &m_pcgram[(ascii*(m_crtc_vreg[0x9]+1))+n]; + uint8_t const *pa = &m_pcgram[(ascii*(m_crtc_vreg[0x9]+1))+n]; uint8_t b = *pa; uint8_t r = *(pa+0x800); uint8_t g = *(pa+0x1000); - for (j = 0x80; j > 0; j>>=1) + for (int j = 0x80; j > 0; j>>=1) { - pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0); + uint8_t pixel = ((g & j)?4:0)|((r & j)?2:0)|((b & j)?1:0); pen = (pixel == 7 ? color : pixel); pixel = (pixelg&j ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); *p++ = m_palette->pen((m_priority & (1<<pixel)) ? pixelpen : pen); } } @@ -609,10 +602,10 @@ MC6845_UPDATE_ROW(spc1500_state::crtc_update_row) fnt = 0xff; } fnt = (inv ? 0xff - fnt : fnt); - for (j = 0x80; j > 0; j>>=1) + for (int j = 0x80; j > 0; j>>=1) { - pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); - pixelpen = (nopalet ? pixel : m_paltbl[pixel]); + uint8_t pixel = ((pixelg&j) ? 4 : 0)|(pixelr&j ? 2:0)|(pixelb&j ? 1:0 ); + uint8_t pixelpen = (nopalet ? pixel : m_paltbl[pixel]); if (ascii == 0 && attr == 0 && !inv) *p++ = m_palette->pen(pixelpen); else diff --git a/src/mame/drivers/special_gambl.cpp b/src/mame/drivers/special_gambl.cpp index b04b71edb2f..f81628ffdd1 100644 --- a/src/mame/drivers/special_gambl.cpp +++ b/src/mame/drivers/special_gambl.cpp @@ -201,9 +201,9 @@ u32 dinaris_state::screen_update_dice(screen_device &screen, bitmap_ind16 &bitma u8 const color1 = m_vram[0x4000 + (y & 0xfe) + x * 256]; u8 const color2 = m_vram[0x4000 + (y | 0x01) + x * 256]; for (int b = 7; b >= 4; b--) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(code, b) ? (color1 & 0xf) : (color1 >> 4); + bitmap.pix(y, x * 8 + (7 - b)) = BIT(code, b) ? (color1 & 0xf) : (color1 >> 4); for (int b = 3; b >= 0; b--) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(code, b) ? (color2 & 0xf) : (color2 >> 4); + bitmap.pix(y, x * 8 + (7 - b)) = BIT(code, b) ? (color2 & 0xf) : (color2 >> 4); } } return 0; diff --git a/src/mame/drivers/speglsht.cpp b/src/mame/drivers/speglsht.cpp index 5ec410fe31a..03e67016e09 100644 --- a/src/mame/drivers/speglsht.cpp +++ b/src/mame/drivers/speglsht.cpp @@ -374,18 +374,16 @@ VIDEO_START_MEMBER(speglsht_state,speglsht) #define PLOT_PIXEL_RGB(x,y,r,g,b) if(y>=0 && x>=0 && x<512 && y<512) \ { \ - bitmap.pix32(y, x) = (b) | ((g)<<8) | ((r)<<16); \ + bitmap.pix(y, x) = (b) | ((g)<<8) | ((r)<<16); \ } uint32_t speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,dy; + int dy=(m_videoreg&0x20)?(256*512):0; //visible frame - dy=(m_videoreg&0x20)?(256*512):0; //visible frame - - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<512;x++) + for(int x=0;x<512;x++) { int tmp=dy+y*512+x; PLOT_PIXEL_RGB(x-67,y-5,(m_framebuffer[tmp]>>0)&0xff,(m_framebuffer[tmp]>>8)&0xff,(m_framebuffer[tmp]>>16)&0xff); @@ -397,10 +395,10 @@ uint32_t speglsht_state::screen_update_speglsht(screen_device &screen, bitmap_rg m_maincpu->draw_screen(screen, *m_bitmap, cliprect); //copy temporary bitmap to rgb 32 bit bitmap - for(y=cliprect.min_y; y<cliprect.max_y;y++) + for(int y=cliprect.min_y; y<cliprect.max_y;y++) { - uint16_t *srcline = &m_bitmap->pix16(y); - for(x=cliprect.min_x; x<cliprect.max_x;x++) + uint16_t const *const srcline = &m_bitmap->pix(y); + for(int x=cliprect.min_x; x<cliprect.max_x;x++) { if(srcline[x]) { diff --git a/src/mame/drivers/spg29x.cpp b/src/mame/drivers/spg29x.cpp index dc25021cc42..79144684df1 100644 --- a/src/mame/drivers/spg29x.cpp +++ b/src/mame/drivers/spg29x.cpp @@ -245,8 +245,8 @@ uint32_t spg29x_game_state::spg290_screen_update(screen_device &screen, bitmap_r for (int y=0; y <= cliprect.max_y; y++) for (int x=0; x <= cliprect.max_x; x++) { - auto pix = rgb_t(bitmap.pix32(y, x)); - bitmap.pix32(y, x) = rgb_t(pix.r() * fade_offset / 255, pix.g() * fade_offset / 255, pix.b() * fade_offset / 255); + rgb_t pix(bitmap.pix(y, x)); + bitmap.pix(y, x) = rgb_t(pix.r() * fade_offset / 255, pix.g() * fade_offset / 255, pix.b() * fade_offset / 255); } } diff --git a/src/mame/drivers/spiders.cpp b/src/mame/drivers/spiders.cpp index 2f77fc485fe..b1dd2729510 100644 --- a/src/mame/drivers/spiders.cpp +++ b/src/mame/drivers/spiders.cpp @@ -285,8 +285,6 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) for (uint8_t cx = 0; cx < x_count; cx++) { - uint8_t data1, data2, data3; - /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 3) & 0x3f00) | ((ra << 5) & 0x00e0) | @@ -295,9 +293,9 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) if (m_flipscreen) offs = offs ^ 0x3fff; - data1 = m_ram[0x0000 | offs]; - data2 = m_ram[0x4000 | offs]; - data3 = m_ram[0x8000 | offs]; + uint8_t data1 = m_ram[0x0000 | offs]; + uint8_t data2 = m_ram[0x4000 | offs]; + uint8_t data3 = m_ram[0x8000 | offs]; for (int i = 0; i < 8; i++) { @@ -309,9 +307,9 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) ((data2 & 0x80) >> 6) | ((data1 & 0x80) >> 7); - data1 = data1 << 1; - data2 = data2 << 1; - data3 = data3 << 1; + data1 <<= 1; + data2 <<= 1; + data3 <<= 1; } else { @@ -319,17 +317,17 @@ MC6845_UPDATE_ROW( spiders_state::crtc_update_row ) ((data2 & 0x01) << 1) | ((data1 & 0x01) << 0); - data1 = data1 >> 1; - data2 = data2 >> 1; - data3 = data3 >> 1; + data1 >>= 1; + data2 >>= 1; + data3 >>= 1; } - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } - ma = ma + 1; + ma++; } } diff --git a/src/mame/drivers/spinb.cpp b/src/mame/drivers/spinb.cpp index f7235c7ecfb..bebb8c64b7c 100644 --- a/src/mame/drivers/spinb.cpp +++ b/src/mame/drivers/spinb.cpp @@ -599,7 +599,7 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 16; x++) { uint8_t const gfx = m_dmdram[ma+0x200]; @@ -622,7 +622,7 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (uint8_t y = 0; y < 32; y++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 16; x++) { uint8_t const gfx = m_dmdram[ma++]; diff --git a/src/mame/drivers/splash_ms.cpp b/src/mame/drivers/splash_ms.cpp index ac4c1e33ba4..f16b9504ccb 100644 --- a/src/mame/drivers/splash_ms.cpp +++ b/src/mame/drivers/splash_ms.cpp @@ -184,11 +184,11 @@ uint32_t splashms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = 0; y < 256; y++) { - uint16_t* dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); for (int x = 0; x < 512; x++) { - uint8_t pix = m_bitmapram[(y * 512) + x]; + uint8_t const pix = m_bitmapram[(y * 512) + x]; //if (pix) dst[x] = pix + 0x100; } diff --git a/src/mame/drivers/srmp5.cpp b/src/mame/drivers/srmp5.cpp index 9ef4d397dfa..414d65e9829 100644 --- a/src/mame/drivers/srmp5.cpp +++ b/src/mame/drivers/srmp5.cpp @@ -137,7 +137,7 @@ private: uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,address,xs,xs2,ys,ys2,height,width,xw,yw,xb,yb,sizex,sizey; + int address,height,width,sizex,sizey; uint16_t *sprite_list=m_sprram.get(); uint16_t *sprite_list_end=&m_sprram[0x4000]; //guess uint8_t *pixels=(uint8_t *)m_tileram.get(); @@ -152,22 +152,22 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b { // 16x16 tile uint16_t *map = &sprram[0x2000]; - for(yw = 0; yw < tile_height; yw++) + for(int yw = 0; yw < tile_height; yw++) { - for(xw = 0; xw < tile_width; xw++) + for(int xw = 0; xw < tile_width; xw++) { uint16_t tile = map[yw * 128 + xw * 2]; if(tile >= 0x2000) continue; address = tile * SPRITE_DATA_GRANULARITY; - for(y = 0; y < 16; y++) + for(int y = 0; y < 16; y++) { - for(x = 0; x < 16; x++) + for(int x = 0; x < 16; x++) { uint8_t pen = pixels[BYTE_XOR_LE(address)]; if(pen) { - bitmap.pix32(yw * 16 + y, xw * 16 + x) = pens[pen]; + bitmap.pix(yw * 16 + y, xw * 16 + x) = pens[pen]; } address++; } @@ -191,8 +191,8 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b global_y=(int16_t)sprite_list[SPRITE_GLOBAL_Y]; while(sublist_length) { - x=(int16_t)sprite_sublist[SPRITE_LOCAL_X]+global_x; - y=(int16_t)sprite_sublist[SPRITE_LOCAL_Y]+global_y; + int x=(int16_t)sprite_sublist[SPRITE_LOCAL_X]+global_x; + int y=(int16_t)sprite_sublist[SPRITE_LOCAL_Y]+global_y; width =(sprite_sublist[SPRITE_SIZE]>> 4)&0xf; height=(sprite_sublist[SPRITE_SIZE]>>12)&0xf; @@ -201,24 +201,24 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b address=(sprite_sublist[SPRITE_TILE] & ~(sprite_sublist[SPRITE_SIZE] >> 11 & 7))*SPRITE_DATA_GRANULARITY; y -= (height + 1) * (sizey + 1)-1; - for(xw=0;xw<=width;xw++) + for(int xw=0;xw<=width;xw++) { - xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; - for(yw=0;yw<=height;yw++) + int xb = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (width-xw)*(sizex+1)+x: xw*(sizex+1)+x; + for(int yw=0;yw<=height;yw++) { - yb = yw*(sizey+1)+y; - for(ys=0;ys<=sizey;ys++) + int yb = yw*(sizey+1)+y; + for(int ys=0;ys<=sizey;ys++) { - ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); - for(xs=0;xs<=sizex;xs++) + int ys2 = (sprite_sublist[SPRITE_PALETTE] & 0x4000) ? ys : (sizey - ys); + for(int xs=0;xs<=sizex;xs++) { uint8_t pen=pixels[BYTE_XOR_LE(address)&(0x100000-1)]; - xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; + int xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; if(pen) { if(cliprect.contains(xb+xs2, yb+ys2)) { - bitmap.pix32(yb+ys2, xb+xs2) = pens[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; + bitmap.pix(yb+ys2, xb+xs2) = pens[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; } } ++address; @@ -235,8 +235,7 @@ uint32_t srmp5_state::screen_update_srmp5(screen_device &screen, bitmap_rgb32 &b #ifdef DEBUG_CHAR { - int i; - for(i = 0; i < 0x2000; i++) + for(int i = 0; i < 0x2000; i++) { if (m_tileduty[i] == 1) { diff --git a/src/mame/drivers/ssem.cpp b/src/mame/drivers/ssem.cpp index 62b543c48cf..bb232317522 100644 --- a/src/mame/drivers/ssem.cpp +++ b/src/mame/drivers/ssem.cpp @@ -437,9 +437,8 @@ void ssem_state::glyph_print(bitmap_rgb32 &bitmap, int32_t x, int32_t y, Format int32_t line = 0; for(line = 0; line < 8; line++) { - uint32_t *d = &bitmap.pix32(y + line); - int32_t bit = 0; - for(bit = 0; bit < 8; bit++) + uint32_t *const d = &bitmap.pix(y + line); + for(uint32_t bit = 0; bit < 8; bit++) { if(char_glyphs[cur][line] & (1 << (7 - bit))) { diff --git a/src/mame/drivers/ssingles.cpp b/src/mame/drivers/ssingles.cpp index 8b1fd2918f9..8ad3cc7f007 100644 --- a/src/mame/drivers/ssingles.cpp +++ b/src/mame/drivers/ssingles.cpp @@ -218,20 +218,18 @@ static constexpr rgb_t ssingles_colors[NUM_PENS] = MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) { - uint32_t tile_address; - uint16_t cell, palette; - uint8_t b0, b1; - const uint8_t *gfx = memregion("gfx1")->base(); + uint8_t const *const gfx = memregion("gfx1")->base(); for (int cx = 0; cx < x_count; ++cx) { int address = ((ma >> 1) + (cx >> 1)) & 0xff; - cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); - tile_address = ((cell & 0x3ff) << 4) + ra; - palette = (cell >> 10) & 0x1c; + uint32_t tile_address = ((cell & 0x3ff) << 4) + ra; + uint16_t palette = (cell >> 10) & 0x1c; + uint8_t b0, b1; if (cx & 1) { b0 = gfx[tile_address + 0x0000]; /* 9.bin */ @@ -245,7 +243,7 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) for (int x = 7; x >= 0; --x) { - bitmap.pix32(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; + bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; b0 >>= 1; b1 >>= 1; } @@ -254,20 +252,18 @@ MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row ) MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) { - uint32_t tile_address; - uint16_t cell, palette; - uint8_t b0, b1; const uint8_t *gfx = memregion("gfx1")->base(); for (int cx = 0; cx < x_count; ++cx) { int address = ((ma >> 1) + (cx >> 1)) & 0xff; - cell = m_videoram[address] + (m_colorram[address] << 8); + uint16_t cell = m_videoram[address] + (m_colorram[address] << 8); - tile_address = ((cell & 0x1ff) << 4) + ra; - palette = (cell >> 10) & 0x1c; + uint32_t tile_address = ((cell & 0x1ff) << 4) + ra; + uint16_t palette = (cell >> 10) & 0x1c; + uint8_t b0, b1; if (cx & 1) { b0 = gfx[tile_address + 0x0000]; /* 9.bin */ @@ -281,7 +277,7 @@ MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row ) for (int x = 7; x >= 0; --x) { - bitmap.pix32(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; + bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))]; b0 >>= 1; b1 >>= 1; } diff --git a/src/mame/drivers/sstrangr.cpp b/src/mame/drivers/sstrangr.cpp index c83a1ed145c..ac633ef2d8b 100644 --- a/src/mame/drivers/sstrangr.cpp +++ b/src/mame/drivers/sstrangr.cpp @@ -403,17 +403,17 @@ uint32_t sstrangr_state::screen_update_sstrangr(screen_device &screen, bitmap_rg if (m_flip_screen) { pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - data = data << 1; + data <<= 1; } else { pen = (data & 0x01) ? rgb_t::white() : rgb_t::black(); - data = data >> 1; + data >>= 1; } - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; - x = x + 1; + x++; } } @@ -441,17 +441,17 @@ uint32_t sstrangr_state::screen_update_sstrngr2(screen_device &screen, bitmap_rg if (m_flip_screen) { color = (data & 0x80) ? fore_color : 0; - data = data << 1; + data <<= 1; } else { color = (data & 0x01) ? fore_color : 0; - data = data >> 1; + data >>= 1; } - bitmap.pix32(y, x) = m_palette->pen_color(color); + bitmap.pix(y, x) = m_palette->pen_color(color); - x = x + 1; + x++; } } diff --git a/src/mame/drivers/studio2.cpp b/src/mame/drivers/studio2.cpp index 3365c1005a2..44278fe4780 100644 --- a/src/mame/drivers/studio2.cpp +++ b/src/mame/drivers/studio2.cpp @@ -518,7 +518,7 @@ void visicom_state::dma_w(offs_t offset, uint8_t data) for (int x = 0; x < 8; x++) { int color = (BIT(color1, 7) << 1) | BIT(color0, 7); - m_vdc->m_bitmap.pix32(y, sx + x) = VISICOM_PALETTE[color]; + m_vdc->m_bitmap.pix(y, sx + x) = VISICOM_PALETTE[color]; color0 <<= 1; color1 <<= 1; } diff --git a/src/mame/drivers/sun2.cpp b/src/mame/drivers/sun2.cpp index 8f43b4249dd..f6b895fd502 100644 --- a/src/mame/drivers/sun2.cpp +++ b/src/mame/drivers/sun2.cpp @@ -624,29 +624,26 @@ void sun2_state::mbustype3space_map(address_map &map) uint32_t sun2_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); if (!(m_bw2_ctrl & 0x8000)) return 0; - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/sun3.cpp b/src/mame/drivers/sun3.cpp index 01418f6ca10..5650ba652ed 100644 --- a/src/mame/drivers/sun3.cpp +++ b/src/mame/drivers/sun3.cpp @@ -283,8 +283,8 @@ private: uint8_t rtc7170_r(offs_t offset); void rtc7170_w(offs_t offset, uint8_t data); + template <unsigned W, unsigned H> uint32_t bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(sun3_timer); @@ -898,57 +898,27 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3_state::sun3_timer) } } +template <unsigned W, unsigned H> uint32_t sun3_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); - for (y = 0; y < 900; y++) + for (int y = 0; y < H; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < W/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; - } - } - return 0; -} - -uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - uint32_t *scanline; - int x, y; - uint8_t pixels; - static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); - - for (y = 0; y < 1100; y++) - { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1600/8; x++) - { - pixels = m_vram[(y * (1600/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (W/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } return 0; @@ -956,27 +926,24 @@ uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t sun3_state::bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)]; + uint8_t const *const m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)]; - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } return 0; @@ -1013,7 +980,7 @@ void sun3_state::sun3(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(SCREEN(config, "bwtwo", SCREEN_TYPE_RASTER)); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1152, 900>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1152-1, 0, 900-1); bwtwo.set_refresh_hz(72); @@ -1079,7 +1046,7 @@ void sun3_state::sun3_60(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(*subdevice<screen_device>("bwtwo")); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1600-1, 0, 1100-1); bwtwo.set_refresh_hz(72); @@ -1102,7 +1069,7 @@ void sun3_state::sun3200(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem); screen_device &bwtwo(*subdevice<screen_device>("bwtwo")); - bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update)); + bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>))); bwtwo.set_size(1600,1100); bwtwo.set_visarea(0, 1600-1, 0, 1100-1); bwtwo.set_refresh_hz(72); diff --git a/src/mame/drivers/sun3x.cpp b/src/mame/drivers/sun3x.cpp index c79ca22c57f..08f9c6e9ef2 100644 --- a/src/mame/drivers/sun3x.cpp +++ b/src/mame/drivers/sun3x.cpp @@ -531,27 +531,24 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3x_state::sun380_timer) uint32_t sun3x_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *m_vram = (uint8_t *)m_bw2_vram.target(); + uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target(); - for (y = 0; y < 900; y++) + for (int y = 0; y < 900; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/8; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/8; x++) { - pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))]; + + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; } } diff --git a/src/mame/drivers/supertnk.cpp b/src/mame/drivers/supertnk.cpp index 32c3b059d65..8d7dbad2182 100644 --- a/src/mame/drivers/supertnk.cpp +++ b/src/mame/drivers/supertnk.cpp @@ -281,12 +281,8 @@ WRITE_LINE_MEMBER(supertnk_state::bitplane_select_1_w) uint32_t supertnk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; @@ -294,16 +290,16 @@ uint32_t supertnk_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm uint8_t data1 = m_videoram[1][offs]; uint8_t data2 = m_videoram[2][offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { uint8_t color = ((data0 & 0x80) >> 5) | ((data1 & 0x80) >> 6) | ((data2 & 0x80) >> 7); - bitmap.pix32(y, x) = m_pens[color]; + bitmap.pix(y, x) = m_pens[color]; - data0 = data0 << 1; - data1 = data1 << 1; - data2 = data2 << 1; + data0 <<= 1; + data1 <<= 1; + data2 <<= 1; - x = x + 1; + x++; } } diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp index 3a75624bb61..d37796980ae 100644 --- a/src/mame/drivers/supracan.cpp +++ b/src/mame/drivers/supracan.cpp @@ -553,8 +553,8 @@ void supracan_state::draw_sprite_tile(bitmap_ind16 &dst, bitmap_ind8 &priomap, c for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint8_t *priop = &priomap.pix8(y, dstx); - uint16_t *dstp = &dst.pix16(y, dstx); + uint8_t *priop = &priomap.pix(y, dstx); + uint16_t *dstp = &dst.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { const uint32_t srcdata = *srcp; @@ -627,7 +627,7 @@ void supracan_state::draw_sprite_tile_mask(bitmap_ind8 &dst, const rectangle &cl for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint8_t *dstp = &dst.pix8(y, dstx); + uint8_t *dstp = &dst.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { if (*srcp) @@ -697,9 +697,9 @@ void supracan_state::draw_sprite_tile_masked(bitmap_ind16 &dst, bitmap_ind8 &mas for (int y = dsty; y <= dstendy; y++) { const uint8_t *srcp = &src_data[srcx]; - uint16_t *dstp = &dst.pix16(y, dstx); - uint8_t *priop = &priomap.pix8(y, dstx); - uint8_t *maskp = &mask.pix8(y, dstx); + uint16_t *dstp = &dst.pix(y, dstx); + uint8_t *priop = &priomap.pix(y, dstx); + uint8_t *maskp = &mask.pix(y, dstx); for (int x = dstx; x <= dstendx; x++) { const uint32_t srcdata = *srcp; @@ -838,8 +838,8 @@ void supracan_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &maskmap, bi uint32_t delta = (1 << 17) / xscale; for (int sy = 0; sy < ysize * 8; sy++) { - uint16_t *src = &sprite_bitmap->pix16(sy); - uint16_t *dst = &bitmap.pix16(y + sy); + uint16_t *src = &sprite_bitmap->pix(sy); + uint16_t *dst = &bitmap.pix(y + sy); uint32_t dx = x << 16; for (int sx = 0; sx < xsize * 8; sx++) { @@ -897,7 +897,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr uint32_t cy = starty; /* get dest and priority pointers */ - uint16_t *dest = &bitmap.pix16(sy, sx); + uint16_t *dest = &bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) @@ -909,7 +909,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr { int scroll = 0; // scrollram[(cx>>16)&0x3ff]); - uint16_t data = &srcbitmap.pix16(((cy >> 16) - scroll) & ymask, (cx >> 16) & xmask)[0]; + uint16_t data = &srcbitmap.pix(((cy >> 16) - scroll) & ymask, (cx >> 16) & xmask)[0]; if ((data & transmask) != 0) dest[0] = data; @@ -918,7 +918,7 @@ void supracan_state::draw_roz_layer(bitmap_ind16 &bitmap, const rectangle &clipr #endif { int scroll = 0;//scrollram[(cy>>16)&0x3ff]); - uint16_t data = srcbitmap.pix16((cy >> 16) & ymask, ((cx >> 16) - scroll) & xmask); + uint16_t data = srcbitmap.pix((cy >> 16) & ymask, ((cx >> 16) - scroll) & xmask); if ((data & transmask) != 0) *dest = data; @@ -1059,8 +1059,8 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - // these will have to change to pix32 etc. once alpha blending is supported - uint16_t* screen = &bitmap.pix16(y); + // these will have to change to uint32_t* etc. once alpha blending is supported + uint16_t* screen = &bitmap.pix(y); int actualy = y & mosaic_mask; int realy = actualy + scrolly; @@ -1069,8 +1069,8 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (scrolly + y < 0 || scrolly + y > ((ysize * 8) - 1)) continue; - uint16_t* src = &src_bitmap.pix16(realy & ((ysize * 8) - 1)); - uint8_t* priop = &m_prio_bitmap.pix8(y); + uint16_t* src = &src_bitmap.pix(realy & ((ysize * 8) - 1)); + uint8_t* priop = &m_prio_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { @@ -1163,9 +1163,9 @@ uint32_t supracan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t* dstp = &bitmap.pix16(y); - uint8_t* priop = &m_prio_bitmap.pix8(y); - uint16_t* spritep = &m_sprite_final_bitmap.pix16(y); + uint16_t* dstp = &bitmap.pix(y); + uint8_t* priop = &m_prio_bitmap.pix(y); + uint16_t* spritep = &m_sprite_final_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/suprgolf.cpp b/src/mame/drivers/suprgolf.cpp index 41cabcb5380..3b39c581fd9 100644 --- a/src/mame/drivers/suprgolf.cpp +++ b/src/mame/drivers/suprgolf.cpp @@ -135,40 +135,36 @@ void suprgolf_state::video_start() uint32_t suprgolf_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,count,color; + int count; bitmap.fill(m_palette->black_pen(), cliprect); - { - count = 0; + count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) + { + for(int x=0;x<512;x++) { - for(x=0;x<512;x++) - { - color = m_bg_fb[count]; + int const color = m_bg_fb[count]; - if(x <= cliprect.max_x && y <= cliprect.max_y) - bitmap.pix16(y, x) = m_palette->pen((color & 0x7ff)); + if(x <= cliprect.max_x && y <= cliprect.max_y) + bitmap.pix(y, x) = m_palette->pen((color & 0x7ff)); - count++; - } + count++; } } - { - count = 0; + count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) + { + for(int x=0;x<512;x++) { - for(x=0;x<512;x++) - { - color = m_fg_fb[count]; + int const color = m_fg_fb[count]; - if(((m_fg_fb[count] & 0x0f) != 0x0f) && (x <= cliprect.max_x && y <= cliprect.max_y)) - bitmap.pix16(y, x) = m_palette->pen((color & 0x7ff)); + if(((m_fg_fb[count] & 0x0f) != 0x0f) && (x <= cliprect.max_x && y <= cliprect.max_y)) + bitmap.pix(y, x) = m_palette->pen((color & 0x7ff)); - count++; - } + count++; } } diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp index 6f852db02ab..41aebc4abee 100644 --- a/src/mame/drivers/svision.cpp +++ b/src/mame/drivers/svision.cpp @@ -362,7 +362,7 @@ uint32_t svision_state::screen_update_svision(screen_device &screen, bitmap_ind1 { const int start_x = 3 - (m_reg[XPOS] & 3); const int end_x = std::min(163, m_reg[XSIZE] | 3); - uint16_t *line = &bitmap.pix16(y, start_x); + uint16_t *line = &bitmap.pix(y, start_x); for (int x = start_x, i = 0; x < end_x; x+=4, i++) { uint8_t b = m_videoram[j+i]; @@ -394,7 +394,7 @@ uint32_t svision_state::screen_update_tvlink(screen_device &screen, bitmap_rgb32 { const int start_x = 3 - (m_reg[XPOS] & 3); const int end_x = std::min(163, m_reg[XSIZE] | 3); - uint32_t *line = &bitmap.pix32(y, start_x); + uint32_t *line = &bitmap.pix(y, start_x); for (int x = start_x, i = 0; x < end_x; x += 4, i++) { uint8_t b = m_videoram[j + i]; diff --git a/src/mame/drivers/swyft.cpp b/src/mame/drivers/swyft.cpp index 5030904123d..a4d20d070d4 100644 --- a/src/mame/drivers/swyft.cpp +++ b/src/mame/drivers/swyft.cpp @@ -599,19 +599,16 @@ void swyft_state::video_start() uint32_t swyft_state::screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t code; - int y, x, b; - int addr = 0; - for (y = 0; y < 242; y++) + for (int y = 0; y < 242; y++) { int horpos = 0; - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - code = m_p_swyft_videoram[addr++]; - for (b = 7; b >= 0; b--) + uint16_t code = m_p_swyft_videoram[addr++]; + for (int b = 7; b >= 0; b--) { - bitmap.pix16(y, horpos++) = (code >> b) & 0x01; + bitmap.pix(y, horpos++) = (code >> b) & 0x01; } } } diff --git a/src/mame/drivers/sys9002.cpp b/src/mame/drivers/sys9002.cpp index 37bf2d7abfa..3e113c90f59 100644 --- a/src/mame/drivers/sys9002.cpp +++ b/src/mame/drivers/sys9002.cpp @@ -91,18 +91,16 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( sys9002_state::crtc_update_row ) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem] & 0x7f; + uint16_t mem = (ma + x) & 0x7ff; + uint8_t chr = m_vram[mem] & 0x7f; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + uint8_t gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7)]; diff --git a/src/mame/drivers/systel1.cpp b/src/mame/drivers/systel1.cpp index 98bd3af70bc..b02d503ea1c 100644 --- a/src/mame/drivers/systel1.cpp +++ b/src/mame/drivers/systel1.cpp @@ -108,7 +108,7 @@ I8275_DRAW_CHARACTER_MEMBER(systel1_state::draw_character) for (int i = 0; i < 7; i++) { - bitmap.pix32(y, x + i) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x + i) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/taitotz.cpp b/src/mame/drivers/taitotz.cpp index 84840c89d54..431db2869a2 100644 --- a/src/mame/drivers/taitotz.cpp +++ b/src/mame/drivers/taitotz.cpp @@ -845,12 +845,12 @@ static inline uint32_t generate_texel_address(int iu, int iv) void taitotz_renderer::draw_scanline_noz(int32_t scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); float u = extent.param[POLY_U].start; float v = extent.param[POLY_V].start; - float du = extent.param[POLY_U].dpdx; - float dv = extent.param[POLY_V].dpdx; + float const du = extent.param[POLY_U].dpdx; + float const dv = extent.param[POLY_V].dpdx; uint32_t *texram = &m_texture[extradata.texture * 0x1000]; @@ -879,24 +879,24 @@ void taitotz_renderer::draw_scanline_noz(int32_t scanline, const extent_t &exten void taitotz_renderer::draw_scanline(int32_t scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zbuffer->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zbuffer->pix(scanline); float ooz = extent.param[POLY_Z].start; float uoz = extent.param[POLY_U].start; float voz = extent.param[POLY_V].start; - float dooz = extent.param[POLY_Z].dpdx; - float duoz = extent.param[POLY_U].dpdx; - float dvoz = extent.param[POLY_V].dpdx; + const float dooz = extent.param[POLY_Z].dpdx; + const float duoz = extent.param[POLY_U].dpdx; + const float dvoz = extent.param[POLY_V].dpdx; float nx= extent.param[POLY_NX].start; float dnx = extent.param[POLY_NX].dpdx; float ny = extent.param[POLY_NY].start; - float dny = extent.param[POLY_NY].dpdx; + const float dny = extent.param[POLY_NY].dpdx; float nz = extent.param[POLY_NZ].start; - float dnz = extent.param[POLY_NZ].dpdx; + const float dnz = extent.param[POLY_NZ].dpdx; - uint32_t *texram = &m_texture[extradata.texture * 0x1000]; + uint32_t *const texram = &m_texture[extradata.texture * 0x1000]; uint32_t alpha = extradata.alpha & 0x1f; uint32_t alpha_enable = extradata.alpha & 0x80; @@ -1435,11 +1435,11 @@ uint32_t taitotz_state::screen_update_taitotz(screen_device &screen, bitmap_rgb3 { m_renderer->draw(bitmap, cliprect); - uint16_t *screen_src = (uint16_t*)&m_screen_ram[m_scr_base]; + uint16_t const *screen_src = (uint16_t*)&m_screen_ram[m_scr_base]; for (int j=0; j < 384; j++) { - uint32_t *fb = &bitmap.pix32(j); + uint32_t *const fb = &bitmap.pix(j); for (int i=0; i < 512; i++) { uint16_t p = *screen_src++; diff --git a/src/mame/drivers/taitowlf.cpp b/src/mame/drivers/taitowlf.cpp index dc57211b3d3..74d86eefeb7 100644 --- a/src/mame/drivers/taitowlf.cpp +++ b/src/mame/drivers/taitowlf.cpp @@ -113,22 +113,18 @@ private: #if !TAITOWLF_ENABLE_VGA uint32_t taitowlf_state::screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int x,y,count; - bitmap.fill(m_palette->black_pen(), cliprect); - count = (0); + int count = 0; - for(y=0;y<256;y++) + for(int y=0;y<256;y++) { - for(x=0;x<512;x++) + for(int x=0;x<512;x++) { - uint32_t color; - - color = (m_bootscreen_rom[count] & 0xff); + uint32_t color = m_bootscreen_rom[count] & 0xff; if(cliprect.contains(x+0, y)) - bitmap.pix32(y, x+0) = m_palette->pen(color); + bitmap.pix(y, x+0) = m_palette->pen(color); count++; } diff --git a/src/mame/drivers/tamag1.cpp b/src/mame/drivers/tamag1.cpp index 649a6ca54cc..a0f77f5df63 100644 --- a/src/mame/drivers/tamag1.cpp +++ b/src/mame/drivers/tamag1.cpp @@ -69,7 +69,7 @@ E0C6S46_PIXEL_UPDATE(tamag1_state::pixel_update) int y = com, x = seg2x[seg]; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = state; + bitmap.pix(y, x) = state; // 2 rows of indicators: // above screen: 0:meal, 1:lamp, 2:play, 3:medicine diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp index 69b7ba9e13a..3cac1126519 100644 --- a/src/mame/drivers/tandy2k.cpp +++ b/src/mame/drivers/tandy2k.cpp @@ -502,7 +502,7 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 0; x < 8; x++) { int color = BIT(a, x) | (BIT(b, x) << 1) | (BIT(c, x) << 2); - bitmap.pix32(y, (sx * 8) + (7 - x)) = cpen[color]; + bitmap.pix(y, (sx * 8) + (7 - x)) = cpen[color]; } } else @@ -517,7 +517,7 @@ uint32_t tandy2k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 0; x < 8; x++) { int color = 4 | (BIT(attr, 6) << 1) | BIT(data, 7); - bitmap.pix32(y, (sx * 8) + x) = cpen[color]; + bitmap.pix(y, (sx * 8) + x) = cpen[color]; data <<= 1; } } @@ -624,7 +624,7 @@ CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character ) { int color = BIT(video, 7 - i); - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } } diff --git a/src/mame/drivers/tapatune.cpp b/src/mame/drivers/tapatune.cpp index e98f02f8b83..7ce930e02eb 100644 --- a/src/mame/drivers/tapatune.cpp +++ b/src/mame/drivers/tapatune.cpp @@ -180,10 +180,10 @@ MC6845_BEGIN_UPDATE( tapatune_state::crtc_begin_update ) MC6845_UPDATE_ROW( tapatune_state::crtc_update_row ) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); offs_t offs = (ma*2 + ra*0x40)*4; - uint8_t *videoram = reinterpret_cast<uint8_t *>(m_videoram.target()); + uint8_t const *const videoram = reinterpret_cast<uint8_t *>(m_videoram.target()); for (uint32_t x = 0; x < x_count*4; x++) { diff --git a/src/mame/drivers/tattack.cpp b/src/mame/drivers/tattack.cpp index 5d1b56b7910..8f419a20d2c 100644 --- a/src/mame/drivers/tattack.cpp +++ b/src/mame/drivers/tattack.cpp @@ -144,13 +144,11 @@ void tattack_state::draw_edge_bitmap(bitmap_ind16 &bitmap, const rectangle &clip void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t ram_offs; const uint16_t ram_base = 0x40+(m_ram[0x33] & 0x10); const int x_base = -8; - int xi,yi; // draw brick pattern - for(ram_offs=ram_base;ram_offs<ram_base+0xe;ram_offs++) + for(uint16_t ram_offs=ram_base;ram_offs<ram_base+0xe;ram_offs++) { uint8_t cur_column = m_ram[ram_offs]; @@ -174,15 +172,15 @@ void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle & if(draw_block == true) { - for(xi=0;xi<3;xi++) + for(int xi=0;xi<3;xi++) { - for(yi=0;yi<15;yi++) + for(int yi=0;yi<15;yi++) { int resx = bit*4+xi+160+x_base; int resy = (ram_offs & 0xf)*16+yi+16; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = m_bricks_color_bank == true ? red_pen : (bit & 4 ? yellow_pen : green_pen); + bitmap.pix(resy, resx) = m_bricks_color_bank == true ? red_pen : (bit & 4 ? yellow_pen : green_pen); } } } @@ -192,25 +190,25 @@ void tattack_state::draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle & // draw paddle if(m_bottom_edge_enable == false) { - for(xi=0;xi<4;xi++) - for(yi=0;yi<m_paddle_ysize;yi++) + for(int xi=0;xi<4;xi++) + for(int yi=0;yi<m_paddle_ysize;yi++) { int resx =(paddle_xpos+xi); int resy = m_paddle_reg+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = white_pen; + bitmap.pix(resy, resx) = white_pen; } } // draw ball - for(xi=0;xi<3;xi++) - for(yi=0;yi<3;yi++) + for(int xi=0;xi<3;xi++) + for(int yi=0;yi<3;yi++) { int resx = m_ball_regs[0]+xi-2+x_base; int resy = m_ball_regs[1]+yi; if(cliprect.contains(resx,resy)) - bitmap.pix16(resy, resx) = (white_pen); + bitmap.pix(resy, resx) = (white_pen); } } diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp index 0293cc0ad34..21748861b5c 100644 --- a/src/mame/drivers/tavernie.cpp +++ b/src/mame/drivers/tavernie.cpp @@ -255,19 +255,17 @@ void ivg09_state::ds_w(u8 data) // Attributes when high: 0 = alpha rom; 1 = flash; 2 = reverse video; 3 = highlight off MC6845_UPDATE_ROW( ivg09_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 gfx,attr; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); m_flashcnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0xfff; - attr = m_vram[mem] >> 8; - u8 inv = ((x == cursor_x) ^ (BIT(attr, 2)) ^ (BIT(attr, 1) && BIT(m_flashcnt, 6))) ? 0xff : 0; - gfx = m_p_chargen[((m_vram[mem] & 0x1ff)<<4) | ra] ^ inv; // takes care of attr bit 0 too - u8 pen = BIT(attr, 3) ? 1 : 2; + u16 const mem = (ma + x) & 0xfff; + u8 const attr = m_vram[mem] >> 8; + u8 const inv = ((x == cursor_x) ^ (BIT(attr, 2)) ^ (BIT(attr, 1) && BIT(m_flashcnt, 6))) ? 0xff : 0; + u8 const gfx = m_p_chargen[((m_vram[mem] & 0x1ff)<<4) | ra] ^ inv; // takes care of attr bit 0 too + u8 const pen = BIT(attr, 3) ? 1 : 2; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7) ? pen : 0]; diff --git a/src/mame/drivers/tek440x.cpp b/src/mame/drivers/tek440x.cpp index 1dac2008b89..e04123889ee 100644 --- a/src/mame/drivers/tek440x.cpp +++ b/src/mame/drivers/tek440x.cpp @@ -131,22 +131,17 @@ void tek440x_state::machine_reset() u32 tek440x_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const u16 *video_ram; - u16 word; - u16 *line; - int y, x, b; - - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - line = &bitmap.pix16(y); - video_ram = &m_vram[y * 64]; + u16 *const line = &bitmap.pix(y); + u16 const *video_ram = &m_vram[y * 64]; - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + u16 const word = *(video_ram++); + for (int b = 0; b < 16; b++) { - line[x + b] = (word >> (15 - b)) & 0x0001; + line[x + b] = BIT(word, 15 - b); } } } diff --git a/src/mame/drivers/teleray10.cpp b/src/mame/drivers/teleray10.cpp index e603a734327..2aa362e4dec 100644 --- a/src/mame/drivers/teleray10.cpp +++ b/src/mame/drivers/teleray10.cpp @@ -158,7 +158,7 @@ u32 teleray10_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (unsigned scan = 0; scan < 12; scan++) { - u32 *px = &bitmap.pix32(y * 12 + scan); + u32 *px = &bitmap.pix(y * 12 + scan); for (unsigned x = 0; x < 80; x++) { u8 ch = m_displayram[offset + x]; diff --git a/src/mame/drivers/tgtpanic.cpp b/src/mame/drivers/tgtpanic.cpp index 1077dbb4251..8e7598b7796 100644 --- a/src/mame/drivers/tgtpanic.cpp +++ b/src/mame/drivers/tgtpanic.cpp @@ -59,33 +59,31 @@ void tgtpanic_state::machine_start() uint32_t tgtpanic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { uint32_t colors[4]; - uint32_t offs; - uint32_t x, y; colors[0] = 0; colors[1] = 0xffffffff; colors[2] = rgb_t(pal1bit(m_color >> 2), pal1bit(m_color >> 1), pal1bit(m_color >> 0)); colors[3] = rgb_t(pal1bit(m_color >> 6), pal1bit(m_color >> 5), pal1bit(m_color >> 4)); - for (offs = 0; offs < 0x2000; ++offs) + for (uint32_t offs = 0; offs < 0x2000; ++offs) { uint8_t val = m_ram[offs]; - y = (offs & 0x7f) << 1; - x = (offs >> 7) << 2; + uint32_t const y = (offs & 0x7f) << 1; + uint32_t const x = (offs >> 7) << 2; /* I'm guessing the hardware doubles lines */ - bitmap.pix32(y + 0, x + 0) = colors[val & 3]; - bitmap.pix32(y + 1, x + 0) = colors[val & 3]; + bitmap.pix(y + 0, x + 0) = colors[val & 3]; + bitmap.pix(y + 1, x + 0) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 1) = colors[val & 3]; - bitmap.pix32(y + 1, x + 1) = colors[val & 3]; + bitmap.pix(y + 0, x + 1) = colors[val & 3]; + bitmap.pix(y + 1, x + 1) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 2) = colors[val & 3]; - bitmap.pix32(y + 1, x + 2) = colors[val & 3]; + bitmap.pix(y + 0, x + 2) = colors[val & 3]; + bitmap.pix(y + 1, x + 2) = colors[val & 3]; val >>= 2; - bitmap.pix32(y + 0, x + 3) = colors[val & 3]; - bitmap.pix32(y + 1, x + 3) = colors[val & 3]; + bitmap.pix(y + 0, x + 3) = colors[val & 3]; + bitmap.pix(y + 1, x + 3) = colors[val & 3]; } return 0; diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp index ed51e4dffce..d473b040492 100644 --- a/src/mame/drivers/ti74.cpp +++ b/src/mame/drivers/ti74.cpp @@ -201,7 +201,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti74_pixel_update) { // internal: 2*16, external: 1*31 if (y == 7) y++; // the cursor is slightly below the character - bitmap.pix16(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + line*16*6 + pos*6 + x) = state ? 1 : 2; } } @@ -220,7 +220,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) { // 1st line is simply 16 chars if (y == 7) y++; // the cursor is slightly below the char - bitmap.pix16(10 + y, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(10 + y, 1 + pos*6 + x) = state ? 1 : 2; } else if (line == 1 && pos < 15 && y < 7) { @@ -228,7 +228,7 @@ HD44780_PIXEL_UPDATE(ti74_state::ti95_pixel_update) // note: the chars are smaller than on the 1st line (this is handled in .lay file) const int gap = 9; int group = pos / 3; - bitmap.pix16(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y, 1 + group*gap + pos*6 + x) = state ? 1 : 2; } } diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp index 700e3b978f1..b7815de0f74 100644 --- a/src/mame/drivers/ti89.cpp +++ b/src/mame/drivers/ti89.cpp @@ -498,19 +498,18 @@ void ti68k_state::machine_reset() uint32_t ti68k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* preliminary implementation, doesn't use the contrast value */ - uint8_t width = screen.width(); - uint8_t height = screen.height(); - uint8_t x, y, b; + uint8_t const width = screen.width(); + uint8_t const height = screen.height(); if (!m_lcd_on || !m_lcd_base) bitmap.fill(0); else - for (y = 0; y < height; y++) - for (x = 0; x < width / 8; x++) + for (uint8_t y = 0; y < height; y++) + for (uint8_t x = 0; x < width / 8; x++) { uint8_t s_byte= m_maincpu->space(AS_PROGRAM).read_byte(m_lcd_base + y * (width/8) + x); - for (b = 0; b<8; b++) - bitmap.pix16(y, x * 8 + (7 - b)) = BIT(s_byte, b); + for (uint8_t b = 0; b<8; b++) + bitmap.pix(y, x * 8 + (7 - b)) = BIT(s_byte, b); } return 0; diff --git a/src/mame/drivers/ti931.cpp b/src/mame/drivers/ti931.cpp index 3531bf7ea13..aabcfe9839e 100644 --- a/src/mame/drivers/ti931.cpp +++ b/src/mame/drivers/ti931.cpp @@ -52,10 +52,10 @@ SCN2672_DRAW_CHARACTER_MEMBER(ti931_state::draw_character) { if (!half_shift) dots <<= 1; - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); if (half_shift) dots <<= 1; - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); } } diff --git a/src/mame/drivers/tickee.cpp b/src/mame/drivers/tickee.cpp index 076043c17f6..a0ca3cf7f1e 100644 --- a/src/mame/drivers/tickee.cpp +++ b/src/mame/drivers/tickee.cpp @@ -220,21 +220,20 @@ VIDEO_START_MEMBER(tickee_state,tickee) TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::scanline_update) { - uint16_t *src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; /* blank palette: fill with pen 255 */ if (m_control[2]) { - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = pens[0xff]; } else /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = src[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; @@ -245,16 +244,15 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::scanline_update) TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::rapidfir_scanline_update) { - uint16_t *src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const src = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); const pen_t *pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; if (m_palette_bank) { /* blank palette: fill with pen 255 */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { dest[x + 0] = pens[0xff]; dest[x + 1] = pens[0xff]; @@ -263,7 +261,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(tickee_state::rapidfir_scanline_update) else { /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = src[coladdr++ & 0xff]; dest[x + 0] = pens[pixels & 0xff]; diff --git a/src/mame/drivers/tiki100.cpp b/src/mame/drivers/tiki100.cpp index c9dce4cdd35..3c1b19f2f1a 100644 --- a/src/mame/drivers/tiki100.cpp +++ b/src/mame/drivers/tiki100.cpp @@ -493,13 +493,13 @@ uint32_t tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // // - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (int vaddr = cliprect.min_y; vaddr <= cliprect.max_y; vaddr++) { // This is at the start of a line int haddr = (cliprect.min_x>>4); - int haddr_end = (cliprect.max_x>>4); + int const haddr_end = (cliprect.max_x>>4); for (; haddr <= haddr_end; haddr++) { // This is at the start of a 16-dot cluster. Changes in m_scroll and m_video_ram come into effect here. @@ -521,7 +521,7 @@ uint32_t tiki100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // m_current_pixel = data&0x0F; } - bitmap.pix32(vaddr, (haddr<<4) + dot) = palette[m_current_pixel&0x0F]; + bitmap.pix(vaddr, (haddr<<4) + dot) = palette[m_current_pixel&0x0F]; // This will run the dot-shifter and add the TEST-pattern to the upper bits (usually hidden by palette). data = (data>>1)|((haddr&0x02)<<14); diff --git a/src/mame/drivers/tim100.cpp b/src/mame/drivers/tim100.cpp index 2c8a8f7997c..447708f15a9 100644 --- a/src/mame/drivers/tim100.cpp +++ b/src/mame/drivers/tim100.cpp @@ -118,11 +118,10 @@ GFXDECODE_END I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t pixels; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); for (uint8_t i = 0; i < 2; i++) { - pixels = m_charmap[(i * 0x1000) | (linecount & 15) | (charcode << 4)]; + uint8_t pixels = m_charmap[(i * 0x1000) | (linecount & 15) | (charcode << 4)]; if (vsp) pixels = 0; @@ -132,12 +131,12 @@ I8275_DRAW_CHARACTER_MEMBER( tim100_state::crtc_display_pixels ) if (rvv) pixels ^= 0xff; - bitmap.pix32(y, x++) = palette[BIT(pixels, 7) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 6) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 5) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 4) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 3) ? (hlgt ? 2 : 1) : 0]; - bitmap.pix32(y, x++) = palette[BIT(pixels, 2) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 7) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 6) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 5) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 4) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 3) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x++) = palette[BIT(pixels, 2) ? (hlgt ? 2 : 1) : 0]; } } diff --git a/src/mame/drivers/tk635.cpp b/src/mame/drivers/tk635.cpp index e57e27e870d..3b27c8907c5 100644 --- a/src/mame/drivers/tk635.cpp +++ b/src/mame/drivers/tk635.cpp @@ -122,10 +122,10 @@ uint32_t tk635_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, // 8 pixels of the character for (int p = 0; p < 8; p++) - bitmap.pix32(y * 16 + i, x * 9 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y * 16 + i, x * 9 + p) = BIT(data, 7 - p) ? rgb_t::white() : rgb_t::black(); // 9th pixel empty - bitmap.pix32(y * 16 + i, x * 9 + 8) = rgb_t::black(); + bitmap.pix(y * 16 + i, x * 9 + 8) = rgb_t::black(); } } } diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp index 4315b0c991c..50c527f21ff 100644 --- a/src/mame/drivers/tmmjprd.cpp +++ b/src/mame/drivers/tmmjprd.cpp @@ -235,30 +235,25 @@ void tmmjprd_state::draw_tile(bitmap_ind16 &bitmap, const rectangle &cliprect, i { for (int drawx=x;drawx<x+sizex;drawx++) { - uint16_t dat; - uint16_t* dst; - if (!depth) { if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; + uint16_t dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; if (dat!=15) { //dat += (colour<<8); - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } drawx++; if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0x0f); + uint16_t dat = (rom[(tileaddr*32)+count] & 0x0f); if (dat!=15) { //dat += (colour<<8); - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } @@ -268,12 +263,11 @@ void tmmjprd_state::draw_tile(bitmap_ind16 &bitmap, const rectangle &cliprect, i { if (cliprect.contains(drawx, drawy)) { - dat = (rom[(tileaddr*32)+count] & 0xff); + uint16_t dat = (rom[(tileaddr*32)+count] & 0xff); if (dat!=255) { dat += (colour<<8) & 0xf00; - dst = &bitmap.pix16(drawy, drawx); - dst[0] = dat; + bitmap.pix(drawy, drawx) = dat; } } count++; diff --git a/src/mame/drivers/toratora.cpp b/src/mame/drivers/toratora.cpp index 805860a038f..4e3e827f373 100644 --- a/src/mame/drivers/toratora.cpp +++ b/src/mame/drivers/toratora.cpp @@ -121,20 +121,16 @@ WRITE_LINE_MEMBER(toratora_state::cb2_u2_w) uint32_t toratora_state::screen_update_toratora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - offs_t offs; - - for (offs = 0; offs < m_videoram.bytes(); offs++) + for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { - int i; - uint8_t y = offs >> 5; uint8_t x = offs << 3; uint8_t data = m_videoram[offs]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { pen_t pen = (data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; data = data << 1; x = x + 1; diff --git a/src/mame/drivers/toypop.cpp b/src/mame/drivers/toypop.cpp index b257d003dd1..2883d32f8c5 100644 --- a/src/mame/drivers/toypop.cpp +++ b/src/mame/drivers/toypop.cpp @@ -180,14 +180,14 @@ void namcos16_state::toypop_palette(palette_device &palette) const void namcos16_state::legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip) { - const uint16_t pal_base = 0x300 + (m_pal_bank << 4); - const uint32_t src_base = 0x200/2; - const uint16_t src_pitch = 288 / 2; + uint16_t const pal_base = 0x300 + (m_pal_bank << 4); + uint32_t const src_base = 0x200/2; + uint16_t const src_pitch = 288 / 2; for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint16_t *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base]; - uint16_t *dst = &bitmap.pix16(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x); + uint16_t const *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base]; + uint16_t *dst = &bitmap.pix(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/drivers/trs80dt1.cpp b/src/mame/drivers/trs80dt1.cpp index 0aa9fc23e79..c4446f0048e 100644 --- a/src/mame/drivers/trs80dt1.cpp +++ b/src/mame/drivers/trs80dt1.cpp @@ -310,7 +310,7 @@ I8275_DRAW_CHARACTER_MEMBER( trs80dt1_state::crtc_update_row ) charcode &= 0x7f; linecount &= 15; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = 0; if (lten) // underline attr @@ -326,7 +326,7 @@ I8275_DRAW_CHARACTER_MEMBER( trs80dt1_state::crtc_update_row ) gfx ^= 0xff; for(u8 i=0; i<8; i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } diff --git a/src/mame/drivers/trs80m2.cpp b/src/mame/drivers/trs80m2.cpp index 2a249824e59..6b971840d1f 100644 --- a/src/mame/drivers/trs80m2.cpp +++ b/src/mame/drivers/trs80m2.cpp @@ -391,7 +391,7 @@ INPUT_PORTS_END MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); int x = 0; @@ -409,7 +409,7 @@ MC6845_UPDATE_ROW( trs80m2_state::crtc_update_row ) int dout = BIT(data, 7); int color = (dcursor ^ drevid ^ dout) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; data <<= 1; } diff --git a/src/mame/drivers/ts803.cpp b/src/mame/drivers/ts803.cpp index 3e088f09bbd..62a1a03033a 100644 --- a/src/mame/drivers/ts803.cpp +++ b/src/mame/drivers/ts803.cpp @@ -327,24 +327,23 @@ MC6845_ON_UPDATE_ADDR_CHANGED( ts803_state::crtc_update_addr ) MC6845_UPDATE_ROW( ts803_state::crtc_update_row ) { bool rv = BIT(m_io_dsw->read(), 8) ? 0 : 1; - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = (rv ^ (x == cursor_x)) ? 0xff : 0; + uint8_t inv = (rv ^ (x == cursor_x)) ? 0xff : 0; + uint8_t gfx; if (m_graphics_mode) { - mem = (ra*0x2000 + ma + x) & 0x7fff; + uint16_t mem = (ra*0x2000 + ma + x) & 0x7fff; gfx = m_videoram[mem] ^ inv; } else { - mem = 0x1800 + ((ma + x) & 0x7ff); - chr = m_videoram[mem]; + uint16_t mem = 0x1800 + ((ma + x) & 0x7ff); + uint8_t chr = m_videoram[mem]; gfx = (ra > 7) ? inv : m_p_chargen[(chr<<3) | ((ra+1)&7)] ^ inv; } diff --git a/src/mame/drivers/ttchamp.cpp b/src/mame/drivers/ttchamp.cpp index 41a8430f9ac..17523eb68fe 100644 --- a/src/mame/drivers/ttchamp.cpp +++ b/src/mame/drivers/ttchamp.cpp @@ -186,45 +186,43 @@ void ttchamp_state::video_start() uint32_t ttchamp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { logerror("update\n"); - int y,x,count; + int count; static const int xxx=320,yyy=204; bitmap.fill(m_palette->black_pen()); - uint8_t *videoramfg; - uint8_t* videorambg; + uint8_t const *const videoramfg = (uint8_t*)m_videoram2; + uint8_t const *const videorambg = (uint8_t*)m_videoram0; count=0; - videorambg = (uint8_t*)m_videoram0; - videoramfg = (uint8_t*)m_videoram2; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) + for(int x=0;x<xxx;x++) { - bitmap.pix16(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; + bitmap.pix(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; count++; } } - /* +#if 0 count=0; videoram = (uint8_t*)m_videoram1; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) - { - uint8_t pix = videoram[BYTE_XOR_LE(count)]; - if (pix) bitmap.pix16(y, x) = pix+0x200; - count++; - } + for (int x=0;x<xxx;x++) + { + uint8_t pix = videoram[BYTE_XOR_LE(count)]; + if (pix) bitmap.pix(y, x) = pix+0x200; + count++; + } } - */ +#endif count=0; - for (y=0;y<yyy;y++) + for (int y=0;y<yyy;y++) { - for(x=0;x<xxx;x++) + for(int x=0;x<xxx;x++) { uint8_t pix = videoramfg[BYTE_XOR_LE(count)]; if (pix) @@ -239,16 +237,16 @@ uint32_t ttchamp_state::screen_update(screen_device &screen, bitmap_ind16 &bitma if (pix == 0x01) // blend mode 1 { uint8_t pix = videorambg[BYTE_XOR_LE(count)]; - bitmap.pix16(y, x) = pix + 0x200; + bitmap.pix(y, x) = pix + 0x200; } else if (pix == 0x02) // blend mode 2 { uint8_t pix = videorambg[BYTE_XOR_LE(count)]; - bitmap.pix16(y, x) = pix + 0x100; + bitmap.pix(y, x) = pix + 0x100; } else { - bitmap.pix16(y, x) = pix + 0x000; + bitmap.pix(y, x) = pix + 0x000; } } count++; diff --git a/src/mame/drivers/tulip1.cpp b/src/mame/drivers/tulip1.cpp index b2af48f7fca..a52a7ae8864 100644 --- a/src/mame/drivers/tulip1.cpp +++ b/src/mame/drivers/tulip1.cpp @@ -118,7 +118,7 @@ GFXDECODE_END MC6845_UPDATE_ROW( tulip1_state::crtc_update_row ) { - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < x_count; i++) { @@ -127,7 +127,7 @@ MC6845_UPDATE_ROW( tulip1_state::crtc_update_row ) // draw 8 pixels of the character for (int x = 0; x < 8; x++) - bitmap.pix32(y, x + i*8) = pen[BIT(data, 7 - x)]; + bitmap.pix(y, x + i*8) = pen[BIT(data, 7 - x)]; } } diff --git a/src/mame/drivers/tv910.cpp b/src/mame/drivers/tv910.cpp index c5b3803cdf8..3ef568eb70f 100644 --- a/src/mame/drivers/tv910.cpp +++ b/src/mame/drivers/tv910.cpp @@ -465,7 +465,7 @@ void tv910_state::vbl_ack_w(uint8_t data) MC6845_UPDATE_ROW( tv910_state::crtc_update_row ) { - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); uint16_t chr_base = (ra & 7) | m_charset->read() << 10; uint8_t chr = m_vram[0x7ff]; uint8_t att = (chr & 0xf0) == 0x90 ? chr & 0x0f : 0; @@ -498,14 +498,14 @@ MC6845_UPDATE_ROW( tv910_state::crtc_update_row ) if (bow) data ^= 0xff; - *p = BIT(data, 7) ? bg : fg; p++; - *p = BIT(data, 6) ? bg : fg; p++; - *p = BIT(data, 5) ? bg : fg; p++; - *p = BIT(data, 4) ? bg : fg; p++; - *p = BIT(data, 3) ? bg : fg; p++; - *p = BIT(data, 2) ? bg : fg; p++; - *p = BIT(data, 1) ? bg : fg; p++; - *p = BIT(data, 0) ? bg : fg; p++; + *p++ = BIT(data, 7) ? bg : fg; + *p++ = BIT(data, 6) ? bg : fg; + *p++ = BIT(data, 5) ? bg : fg; + *p++ = BIT(data, 4) ? bg : fg; + *p++ = BIT(data, 3) ? bg : fg; + *p++ = BIT(data, 2) ? bg : fg; + *p++ = BIT(data, 1) ? bg : fg; + *p++ = BIT(data, 0) ? bg : fg; } } diff --git a/src/mame/drivers/tv950.cpp b/src/mame/drivers/tv950.cpp index 4b46e96315b..3db629e060c 100644 --- a/src/mame/drivers/tv950.cpp +++ b/src/mame/drivers/tv950.cpp @@ -259,7 +259,7 @@ MC6845_UPDATE_ROW( tv950_state::crtc_update_row ) else m_attr_screen = m_attr_row; - uint32_t *p = &bitmap.pix32(m_row); + uint32_t *p = &bitmap.pix(m_row); rgb_t fg(255,255,255,255); rgb_t bg(0,0,0,0); diff --git a/src/mame/drivers/tv955.cpp b/src/mame/drivers/tv955.cpp index dfc6f9f67c7..b0f4f055bab 100644 --- a/src/mame/drivers/tv955.cpp +++ b/src/mame/drivers/tv955.cpp @@ -77,7 +77,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(tv955_state::draw_character) for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } diff --git a/src/mame/drivers/tv990.cpp b/src/mame/drivers/tv990.cpp index 38de5f3b54a..f28d5b01c42 100644 --- a/src/mame/drivers/tv990.cpp +++ b/src/mame/drivers/tv990.cpp @@ -194,51 +194,43 @@ void tv990_state::tvi1111_w(offs_t offset, uint16_t data, uint16_t mem_mask) uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels, pixels2; - uint16_t *vram = (uint16_t *)m_vram.target(); - uint8_t *fontram = (uint8_t *)m_fontram.target(); - uint16_t *curchar; - uint8_t *fontptr; - int miny = cliprect.min_y / m_rowh; - int maxy = cliprect.max_y / m_rowh; + uint16_t const *const vram = (uint16_t *)m_vram.target(); + uint8_t const *const fontram = (uint8_t *)m_fontram.target(); + int const miny = cliprect.min_y / m_rowh; + int const maxy = cliprect.max_y / m_rowh; bitmap.fill(0, cliprect); - for (y = miny; y <= maxy; y++) + for (int y = miny; y <= maxy; y++) { - int i; - for(i = 7; i >= 0; i--) + for(int i = 7; i >= 0; i--) { if(!BIT(tvi1111_regs[0x1f], i)) continue; - int starty = tvi1111_regs[i + 0x40] >> 8; - int endy = tvi1111_regs[i + 0x40] & 0xff; + int const starty = tvi1111_regs[i + 0x40] >> 8; + int const endy = tvi1111_regs[i + 0x40] & 0xff; if((y < starty) || (y >= endy)) continue; - uint16_t row_offset = tvi1111_regs[i + 0x50]; - curchar = &vram[row_offset]; + uint16_t const row_offset = tvi1111_regs[i + 0x50]; + uint16_t const *curchar = &vram[row_offset]; int minx = tvi1111_regs[i + 0x30] >> 8; int maxx = tvi1111_regs[i + 0x30] & 0xff; if(maxx > m_width) maxx = m_width; - uint16_t cursor_x = tvi1111_regs[0x16] - row_offset; + uint16_t const cursor_x = tvi1111_regs[0x16] - row_offset; - for (x = minx; x < maxx; x++) + for (int x = minx; x < maxx; x++) { uint8_t chr = curchar[x - minx] >> 8; uint8_t attr = curchar[x - minx] & 0xff; if((attr & 2) && (m_screen->frame_number() & 32)) // blink rate? continue; - fontptr = (uint8_t *)&fontram[(chr + (attr & 0x40 ? 256 : 0)) * 64]; - - uint32_t palette[2]; + uint8_t const *fontptr = &fontram[(chr + (attr & 0x40 ? 256 : 0)) * 64]; if (BIT(tvi1111_regs[0x1b], 0) && x == cursor_x) { @@ -253,6 +245,7 @@ uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, attr ^= attrchg; } + uint32_t palette[2]; if (attr & 0x4) // inverse video? { palette[1] = m_palette->pen(0); @@ -266,32 +259,32 @@ uint32_t tv990_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int chary = 0; chary < m_rowh; chary++) { - scanline = &bitmap.pix32((y*m_rowh)+chary, (x*16)); + uint32_t *scanline = &bitmap.pix((y*m_rowh)+chary, (x*16)); - pixels = *fontptr++; - pixels2 = *fontptr++; + uint8_t pixels = *fontptr++; + uint8_t pixels2 = *fontptr++; if((attr & 0x8) && (chary == m_rowh - 1)) { pixels = 0xff; pixels2 = 0xff; } - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels2>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels2>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels2>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels2>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels2>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels2>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels2>>1)&1]; - *scanline++ = palette[(pixels&1)]; - *scanline++ = palette[(pixels2&1)]; + *scanline++ = palette[BIT(pixels, 7)]; + *scanline++ = palette[BIT(pixels2, 7)]; + *scanline++ = palette[BIT(pixels, 6)]; + *scanline++ = palette[BIT(pixels2, 6)]; + *scanline++ = palette[BIT(pixels, 5)]; + *scanline++ = palette[BIT(pixels2, 5)]; + *scanline++ = palette[BIT(pixels, 4)]; + *scanline++ = palette[BIT(pixels2, 4)]; + *scanline++ = palette[BIT(pixels, 3)]; + *scanline++ = palette[BIT(pixels2, 3)]; + *scanline++ = palette[BIT(pixels, 2)]; + *scanline++ = palette[BIT(pixels2, 2)]; + *scanline++ = palette[BIT(pixels, 1)]; + *scanline++ = palette[BIT(pixels2, 1)]; + *scanline++ = palette[BIT(pixels, 0)]; + *scanline++ = palette[BIT(pixels2, 0)]; } } } diff --git a/src/mame/drivers/tvc.cpp b/src/mame/drivers/tvc.cpp index 3fff0ca5fca..7dac19358ff 100644 --- a/src/mame/drivers/tvc.cpp +++ b/src/mame/drivers/tvc.cpp @@ -635,18 +635,17 @@ void tvc64p_state::machine_reset() MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vram = &m_vram_base[(m_vram_bank & 0x30)<<10]; - uint16_t offset = ((ma*4 + ra*0x40) & 0x3fff); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vram = &m_vram_base[(m_vram_bank & 0x30)<<10]; + uint16_t const offset = ((ma*4 + ra*0x40) & 0x3fff); switch(m_video_mode) { case 0 : // 2 colors mode - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; + uint8_t const data = vram[offset + i]; *p++ = palette[m_col[BIT(data,7)]]; *p++ = palette[m_col[BIT(data,6)]]; *p++ = palette[m_col[BIT(data,5)]]; @@ -660,9 +659,9 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) case 1 : // 4 colors mode // a0 b0 c0 d0 a1 b1 c1 d1 - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; + uint8_t const data = vram[offset + i]; *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; *p++ = palette[m_col[BIT(data,3)*2 + BIT(data,7)]]; *p++ = palette[m_col[BIT(data,2)*2 + BIT(data,6)]]; @@ -676,11 +675,11 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row ) default: // 16 colors mode // IIGG RRBB - for ( i = 0; i < x_count; i++ ) + for ( int i = 0; i < x_count; i++ ) { - uint8_t data = vram[offset + i]; - uint8_t col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); - uint8_t col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); + uint8_t const data = vram[offset + i]; + uint8_t const col0 = ((data & 0x80)>>4) | ((data & 0x20)>>3) | ((data & 0x08)>>2) | ((data & 0x02)>>1); + uint8_t const col1 = ((data & 0x40)>>3) | ((data & 0x10)>>2) | ((data & 0x04)>>1) | (data & 0x01); *p++ = palette[col0]; *p++ = palette[col0]; *p++ = palette[col0]; diff --git a/src/mame/drivers/tvgame.cpp b/src/mame/drivers/tvgame.cpp index 9e8334e16bd..5f2ec5156c5 100644 --- a/src/mame/drivers/tvgame.cpp +++ b/src/mame/drivers/tvgame.cpp @@ -76,15 +76,14 @@ void tvgame_state::speaker_w(uint8_t data) uint32_t tvgame_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,gfx; - uint16_t sy=0,ma=241,x; + uint16_t sy=0,ma=241; - for (y = 0; y < 213; y++) + for (uint8_t y = 0; y < 213; y++) { - uint16_t *p = &bitmap.pix16(sy++); - for (x = ma; x < ma+27; x++) + uint16_t *p = &bitmap.pix(sy++); + for (uint16_t x = ma; x < ma+27; x++) { - gfx = m_p_videoram[x]; + uint8_t gfx = m_p_videoram[x]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 0); diff --git a/src/mame/drivers/twins.cpp b/src/mame/drivers/twins.cpp index 787cfc93da5..611402fdeea 100644 --- a/src/mame/drivers/twins.cpp +++ b/src/mame/drivers/twins.cpp @@ -238,7 +238,7 @@ void twins_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprec { int count = (y * 320) + cliprect.left(); for(int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix16(y, x) = videoram[BYTE_XOR_LE(count++)]; + bitmap.pix(y, x) = videoram[BYTE_XOR_LE(count++)]; } } @@ -260,7 +260,7 @@ void spider_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &clipre { u8 pixel = videoram[BYTE_XOR_LE(count++)]; if (pixel) - bitmap.pix16(y, x) = pixel; + bitmap.pix(y, x) = pixel; } } } diff --git a/src/mame/drivers/ultrsprt.cpp b/src/mame/drivers/ultrsprt.cpp index f79dd7229da..315951ef4fa 100644 --- a/src/mame/drivers/ultrsprt.cpp +++ b/src/mame/drivers/ultrsprt.cpp @@ -72,16 +72,16 @@ private: u32 ultrsprt_state::screen_update_ultrsprt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 *vram = m_vram.get() + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES; + u8 const *const vram = m_vram.get() + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES; for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { int fb_index = y * 1024; - u16 *dest = &bitmap.pix16(y, cliprect.min_x); + u16 *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - u8 p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)]; + u8 const p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)]; if (p1 == 0) *dest++ = vram[BYTE4_XOR_BE(fb_index + x)]; diff --git a/src/mame/drivers/unior.cpp b/src/mame/drivers/unior.cpp index 1e8fafe958f..054e52e24e3 100644 --- a/src/mame/drivers/unior.cpp +++ b/src/mame/drivers/unior.cpp @@ -281,7 +281,7 @@ void unior_state::scroll_w(u8 data) I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = m_p_chargen[(linecount & 7) | (charcode << 3)]; if (vsp) @@ -294,7 +294,7 @@ I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels) gfx ^= 0xff; for(u8 i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t unior_pens[3] = diff --git a/src/mame/drivers/unistar.cpp b/src/mame/drivers/unistar.cpp index ea086d988f9..49b9b68a54e 100644 --- a/src/mame/drivers/unistar.cpp +++ b/src/mame/drivers/unistar.cpp @@ -136,7 +136,7 @@ void unistar_state::unistar_palette(palette_device &palette) const I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character) { // This code just a guess, so that we can see something - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); u8 gfx = m_chargen[(linecount & 15) | (charcode << 4)]; if (vsp) @@ -149,7 +149,7 @@ I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character) gfx ^= 0xff; for(u8 i=0;i<8;i++) - bitmap.pix32(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[BIT(gfx, 7-i) ? (hlgt ? 2 : 1) : 0]; } /* F4 Character Displayer */ diff --git a/src/mame/drivers/univac.cpp b/src/mame/drivers/univac.cpp index 403e2ad029f..b0d98788273 100644 --- a/src/mame/drivers/univac.cpp +++ b/src/mame/drivers/univac.cpp @@ -502,7 +502,7 @@ uint32_t univac_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap { for (u8 ra = 0; ra < 14; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); for (uint16_t x = ma; x < ma + 80; x++) { diff --git a/src/mame/drivers/unixpc.cpp b/src/mame/drivers/unixpc.cpp index fa042790363..c28fc92cc3d 100644 --- a/src/mame/drivers/unixpc.cpp +++ b/src/mame/drivers/unixpc.cpp @@ -309,7 +309,7 @@ uint32_t unixpc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 348; y++) for (int x = 0; x < 720/16; x++) for (int b = 0; b < 16; b++) - bitmap.pix16(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); + bitmap.pix(y, x * 16 + b) = BIT(m_videoram[y * (720/16) + x], b); return 0; } diff --git a/src/mame/drivers/unkhorse.cpp b/src/mame/drivers/unkhorse.cpp index 432c2ccb57d..ddb9c514cb7 100644 --- a/src/mame/drivers/unkhorse.cpp +++ b/src/mame/drivers/unkhorse.cpp @@ -86,7 +86,7 @@ uint32_t horse_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, uint8_t color = m_colorram[(y << 1 & 0x1e0) | x] >> 4; for (int i = 0; i < 8; i++) - bitmap.pix16(y, x << 3 | i) = (data >> i & 1) ? color : 0; + bitmap.pix(y, x << 3 | i) = (data >> i & 1) ? color : 0; } } diff --git a/src/mame/drivers/unkpoker.cpp b/src/mame/drivers/unkpoker.cpp index 1445d167f1d..4f60318aaa0 100644 --- a/src/mame/drivers/unkpoker.cpp +++ b/src/mame/drivers/unkpoker.cpp @@ -70,7 +70,7 @@ uint32_t unkpoker_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { diff --git a/src/mame/drivers/uzebox.cpp b/src/mame/drivers/uzebox.cpp index f7407df54c4..2d1399d0b1c 100644 --- a/src/mame/drivers/uzebox.cpp +++ b/src/mame/drivers/uzebox.cpp @@ -242,10 +242,10 @@ void uzebox_state::line_update() for (uint32_t x = m_line_pos_cycles; x < cycles; x++) { if (m_bitmap.cliprect().contains(x, m_vpos)) - m_bitmap.pix32(m_vpos, x) = color; + m_bitmap.pix(m_vpos, x) = color; if (!INTERLACED) if (m_bitmap.cliprect().contains(x, m_vpos + 1)) - m_bitmap.pix32(m_vpos + 1, x) = color; + m_bitmap.pix(m_vpos + 1, x) = color; } m_line_pos_cycles = cycles; diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index 60103982180..ab00be275cd 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -177,16 +177,14 @@ GFXDECODE_END MC6845_UPDATE_ROW( v6809_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = (ma + x) & 0x7ff; - chr = m_vram[mem]; - gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + u16 mem = (ma + x) & 0x7ff; + u8 chr = m_vram[mem]; + u8 gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/drivers/vboy.cpp b/src/mame/drivers/vboy.cpp index ef69def55cc..3dbaf47a3eb 100644 --- a/src/mame/drivers/vboy.cpp +++ b/src/mame/drivers/vboy.cpp @@ -227,7 +227,7 @@ void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, { uint8_t const col = (pal >> (dat * 2)) & 3; - bitmap.pix16((res_y), (res_x)) = m_palette->pen(col); + bitmap.pix((res_y), (res_x)) = m_palette->pen(col); } } } @@ -288,9 +288,8 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num) { // g_profiler.start(PROFILER_USER2); - int x,y; - for(y=0;y<=h;y++) + for(int y=0;y<=h;y++) { int32_t y1 = (y+gy); @@ -299,7 +298,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui int src_y = y+my; - for(x=0;x<=w;x++) + for(int x=0;x<=w;x++) { int32_t x1 = (x+gx); @@ -336,7 +335,7 @@ void vboy_state::draw_bg_map(bitmap_ind16 &bitmap, const rectangle &cliprect, ui } if(pix != -1) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + bitmap.pix(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -346,9 +345,8 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num) { // g_profiler.start(PROFILER_USER3); - int x,y; - for(y=0;y<=h;y++) + for(int y=0;y<=h;y++) { float h_skw = (int16_t)READ_BGMAP(param_base + (y*8+0)) / 8.0; float prlx = (int16_t)READ_BGMAP(param_base + (y*8+1)) / 8.0; @@ -358,7 +356,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect h_skw += right ? -prlx : prlx; - for(x=0;x<=w;x++) + for(int x=0;x<=w;x++) { int32_t src_x,src_y; int16_t y1 = (y+gy); @@ -381,7 +379,7 @@ void vboy_state::draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect if(pix != -1) if (cliprect.contains(x1, y1)) - bitmap.pix16(y1, x1) = m_palette->pen(pix & 3); + bitmap.pix(y1, x1) = m_palette->pen(pix & 3); } } // g_profiler.stop(); @@ -421,7 +419,6 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle uint16_t param_base = READ_WORLD(num+9) & 0xfff0; uint16_t ovr_char = READ_BGMAP(READ_WORLD(num+10)); uint8_t bg_map_num = def & 0x0f; - int i; if(end) return 1; @@ -458,21 +455,19 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle } else if (mode==3) // OBJ Mode { - int start_offs, end_offs; - if(cur_spt == -1) { popmessage("Cur spt used with -1 pointer!"); return 0; } - start_offs = m_vip_regs.SPT[cur_spt]; + int start_offs = m_vip_regs.SPT[cur_spt]; - end_offs = 0x3ff; + int end_offs = 0x3ff; if(cur_spt != 0) end_offs = m_vip_regs.SPT[cur_spt-1]; - i = start_offs; + int i = start_offs; do { uint16_t start_ndx = i * 4; @@ -489,12 +484,12 @@ uint8_t vboy_state::display_world(int num, bitmap_ind16 &bitmap, const rectangle if(right && jron) put_obj(bitmap, cliprect, (jx+jp) & 0x1ff, jy, val & 0x3fff, m_vip_regs.JPLT[(val>>14) & 3]); - i --; + i--; i &= 0x3ff; }while(i != end_offs); if((lon && !right) || (ron && right)) - cur_spt --; + cur_spt--; } return 0; @@ -514,21 +509,15 @@ uint32_t vboy_state::screen_update_vboy_left(screen_device &screen, bitmap_ind16 if(0) { - int x,y; - - for(y=0;y<224;y++) + for(int y=0;y<224;y++) { - for(x=0;x<384;x++) + for(int x=0;x<384;x++) { - uint8_t pen; - uint8_t pix; - int yi; - - pen = m_l_frame_1[(x*0x40)+(y >> 2)]; - yi = ((y & 0x3)*2); - pix = (pen >> yi) & 3; + uint8_t pen = m_l_frame_1[(x*0x40)+(y >> 2)]; + int yi = ((y & 0x3)*2); + uint8_t pix = (pen >> yi) & 3; - bitmap.pix16(y, x) = m_palette->pen(pix & 3); + bitmap.pix(y, x) = m_palette->pen(pix & 3); } } } diff --git a/src/mame/drivers/vcombat.cpp b/src/mame/drivers/vcombat.cpp index ef93aec1594..3dd856f4fb8 100644 --- a/src/mame/drivers/vcombat.cpp +++ b/src/mame/drivers/vcombat.cpp @@ -173,20 +173,18 @@ uint32_t vcombat_state::update_screen(screen_device &screen, bitmap_rgb32 &bitma for (y = cliprect.min_y; y <= cliprect.max_y; ++y) { - int x; int src_addr = 256/2 * y; const uint16_t *m68k_src = &m68k_buf[src_addr]; const uint16_t *i860_src = &i860_buf[src_addr]; - uint32_t *dst = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dst = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { - int i; uint16_t m68k_pix = *m68k_src++; uint16_t i860_pix = *i860_src++; /* Draw two pixels */ - for (i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) { /* Vcombat's screen renders 'flopped' - very likely because VR headset displays may reflect off mirrors. Shadfgtr isn't flopped, so it's not a constant feature of the hardware. */ diff --git a/src/mame/drivers/vegaeo.cpp b/src/mame/drivers/vegaeo.cpp index 796a3c03332..62fb7c9f077 100644 --- a/src/mame/drivers/vegaeo.cpp +++ b/src/mame/drivers/vegaeo.cpp @@ -167,7 +167,7 @@ uint32_t vegaeo_state::screen_update_vega(screen_device &screen, bitmap_ind16 &b { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[0x14000 * (m_vbuffer ^ 1) + (y * 320) + x] & 0xff; + bitmap.pix(y, x) = m_vram[0x14000 * (m_vbuffer ^ 1) + (y * 320) + x] & 0xff; } } return 0; diff --git a/src/mame/drivers/victor9k.cpp b/src/mame/drivers/victor9k.cpp index fae63959c6e..b42e75619b5 100644 --- a/src/mame/drivers/victor9k.cpp +++ b/src/mame/drivers/victor9k.cpp @@ -304,7 +304,7 @@ MC6845_UPDATE_ROW( victor9k_state::crtc_update_row ) color = palette[pen]; } - bitmap.pix32(vbp + y, x++) = color; + bitmap.pix(vbp + y, x++) = color; } aa += 2; diff --git a/src/mame/drivers/video21.cpp b/src/mame/drivers/video21.cpp index 66a1ed5521e..6af36ce0652 100644 --- a/src/mame/drivers/video21.cpp +++ b/src/mame/drivers/video21.cpp @@ -74,19 +74,18 @@ private: uint32_t video21_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 28; y++) + for (uint8_t y = 0; y < 28; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 32; x++) + for (uint16_t x = 0; x < 32; x++) { - chr = m_p_videoram[x+ma] & 0x7f; - gfx = m_p_chargen[(chr<<3) | ra ]; + uint8_t chr = m_p_videoram[x+ma] & 0x7f; + uint8_t gfx = m_p_chargen[(chr<<3) | ra ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/vis.cpp b/src/mame/drivers/vis.cpp index 1ade543187c..816e0764017 100644 --- a/src/mame/drivers/vis.cpp +++ b/src/mame/drivers/vis.cpp @@ -316,11 +316,11 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect { const uint32_t IV = 0xff000000; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); - int pos, line, column, col, addr, curr_addr = 0; + int curr_addr = 0; const uint8_t decode_tbl[] = {0, 1, 2, 3, 4, 5, 6, 9, 12, 17, 22, 29, 38, 50, 66, 91, 128, 165, 190, 206, 218, 227, 234, 239, 244, 247, 250, 251, 252, 253, 254, 255}; - for (addr = vga.crtc.start_addr, line=0; line<(vga.crtc.vert_disp_end+1); line+=height, addr+=offset(), curr_addr+=offset()) + for (int addr = vga.crtc.start_addr, line=0; line<(vga.crtc.vert_disp_end+1); line+=height, addr+=offset(), curr_addr+=offset()) { for(int yi = 0;yi < height; yi++) { @@ -329,7 +329,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect curr_addr = addr; if((line + yi) == (vga.crtc.line_compare & 0x3ff)) curr_addr = 0; - for (pos=curr_addr, col=0, column=0; column<(vga.crtc.horz_disp_end+1); column++, col+=8, pos+=8) + for (int pos=curr_addr, col=0, column=0; column<(vga.crtc.horz_disp_end+1); column++, col+=8, pos+=8) { if(pos + 0x08 > 0x80000) return; @@ -340,8 +340,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect continue; uint8_t a = vga.memory[pos + xi], b = vga.memory[pos + xi + 1]; uint8_t c = vga.memory[pos + xi + 2], d = vga.memory[pos + xi + 3]; - uint8_t y[4], ub, vb, trans; - uint16_t u, v; + uint8_t y[4], ub, vb; if(col || xi) { y[0] = decode_tbl[a & 0x1f] + ydelta; @@ -357,9 +356,9 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect y[1] = decode_tbl[b & 0x1f] + y[0]; y[2] = decode_tbl[c & 0x1f] + y[1]; y[3] = decode_tbl[d & 0x1f] + y[2]; - trans = (a >> 7) | ((c >> 6) & 2); - u = ua; - v = va; + uint8_t trans = (a >> 7) | ((c >> 6) & 2); + uint16_t u = ua; + uint16_t v = va; for(int i = 0; i < 4; i++) { if(i == trans) @@ -372,7 +371,7 @@ void vis_vga_device::vga_vh_yuv8(bitmap_rgb32 &bitmap, const rectangle &cliprect u = ub; v = vb; } - bitmap.pix32(line + yi, col + xi + i) = IV | (uint32_t)yuv_to_rgb(y[i], u, v); + bitmap.pix(line + yi, col + xi + i) = IV | (uint32_t)yuv_to_rgb(y[i], u, v); } ua = ub; va = vb; diff --git a/src/mame/drivers/vixen.cpp b/src/mame/drivers/vixen.cpp index 545e5f83ead..4c926f7c6ea 100644 --- a/src/mame/drivers/vixen.cpp +++ b/src/mame/drivers/vixen.cpp @@ -417,7 +417,7 @@ uint32_t vixen_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { int color = BIT(gfx, 7 - b); - bitmap.pix32((y * 10) + ra, (x * 8) + b) = pen[color]; + bitmap.pix((y * 10) + ra, (x * 8) + b) = pen[color]; } } } diff --git a/src/mame/drivers/vk100.cpp b/src/mame/drivers/vk100.cpp index b56b800fdbb..cb3e4ee42db 100644 --- a/src/mame/drivers/vk100.cpp +++ b/src/mame/drivers/vk100.cpp @@ -1025,7 +1025,7 @@ MC6845_UPDATE_ROW( vk100_state::crtc_update_row ) // display a 12-bit wide chunk for (int j = 0; j < 12; j++) { - bitmap.pix32(y, (12*i)+j) = (((block&(0x0001<<j))?1:0)^(m_vgSOPS&1))?fgColor:bgColor; + bitmap.pix(y, (12*i)+j) = (((block&(0x0001<<j))?1:0)^(m_vgSOPS&1))?fgColor:bgColor; } } } diff --git a/src/mame/drivers/vp101.cpp b/src/mame/drivers/vp101.cpp index dc094bf91b7..aea28ee884f 100644 --- a/src/mame/drivers/vp101.cpp +++ b/src/mame/drivers/vp101.cpp @@ -275,7 +275,7 @@ uint32_t vp10x_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for (int y = 0; y < 240; y++) { - uint32_t *line = &bitmap.pix32(y); + uint32_t *line = &bitmap.pix(y); const uint32_t *video_ram = (const uint32_t *) &m_mainram[(m_fb_base/4) + (y * (0x1000/4)) + 4]; for (int x = 0; x < 320; x++) @@ -306,7 +306,7 @@ uint32_t vp10x_state::vp50_screen_update(screen_device &screen, bitmap_rgb32 &bi for (int y = 0; y < 240; y++) { - uint32_t *line = &bitmap.pix32(y); + uint32_t *line = &bitmap.pix(y); const uint8_t *video_ram = (const uint8_t *) &m_mainram[(0x10000/4)+(y * 100)]; for (int x = 0; x < 400; x++) diff --git a/src/mame/drivers/vt1682.cpp b/src/mame/drivers/vt1682.cpp index 82dc11ebf92..3c815bbe116 100644 --- a/src/mame/drivers/vt1682.cpp +++ b/src/mame/drivers/vt1682.cpp @@ -4295,11 +4295,11 @@ void vt_vt1682_state::draw_tile_pixline(int segment, int tile, int tileline, int else currentaddress = startaddress + ((tilesize_high - 1) - tileline) * linebytes; - uint8_t* pri2ptr = &m_pal2_priority_bitmap.pix8(y); - uint8_t* pri1ptr = &m_pal1_priority_bitmap.pix8(y); + uint8_t *const pri2ptr = &m_pal2_priority_bitmap.pix(y); + uint8_t *const pri1ptr = &m_pal1_priority_bitmap.pix(y); - uint8_t* pix2ptr = &m_pal2_pix_bitmap.pix8(y); - uint8_t* pix1ptr = &m_pal1_pix_bitmap.pix8(y); + uint8_t *const pix2ptr = &m_pal2_pix_bitmap.pix(y); + uint8_t *const pix1ptr = &m_pal1_pix_bitmap.pix(y); int shift_amount, mask, bytes_in; @@ -5042,12 +5042,12 @@ uint32_t vt_vt1682_state::screen_update(screen_device& screen, bitmap_rgb32& bit for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const pen_t* paldata = m_palette->pens(); - uint8_t* pri2ptr = &m_pal2_priority_bitmap.pix8(y); - uint8_t* pri1ptr = &m_pal1_priority_bitmap.pix8(y); - uint8_t* pix2ptr = &m_pal2_pix_bitmap.pix8(y); - uint8_t* pix1ptr = &m_pal1_pix_bitmap.pix8(y); - uint32_t* dstptr = &bitmap.pix32(y); + pen_t const *const paldata = m_palette->pens(); + uint8_t const *const pri2ptr = &m_pal2_priority_bitmap.pix(y); + uint8_t const *const pri1ptr = &m_pal1_priority_bitmap.pix(y); + uint8_t const *const pix2ptr = &m_pal2_pix_bitmap.pix(y); + uint8_t const *const pix1ptr = &m_pal1_pix_bitmap.pix(y); + uint32_t *const dstptr = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp index b8a29a08829..c40cc146cf2 100644 --- a/src/mame/drivers/vt240.cpp +++ b/src/mame/drivers/vt240.cpp @@ -201,10 +201,7 @@ READ_LINE_MEMBER(vt240_state::i8085_sid_r) UPD7220_DISPLAY_PIXELS_MEMBER( vt240_state::hgdc_draw ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - int xi, gfx1, gfx2; - uint8_t vom; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(!BIT(m_reg0, 7)) { @@ -212,14 +209,14 @@ UPD7220_DISPLAY_PIXELS_MEMBER( vt240_state::hgdc_draw ) vram_w((0x20000 + address) >> 1, 0); } - gfx1 = m_video_ram[(address & 0x7fff) >> 1]; - gfx2 = m_video_ram[((address & 0x7fff) + 0x8000) >> 1]; + int const gfx1 = m_video_ram[(address & 0x7fff) >> 1]; + int const gfx2 = m_video_ram[((address & 0x7fff) + 0x8000) >> 1]; - bool color = m_monitor->read() ? true : false; - for(xi=0;xi<16;xi++) + bool const color = m_monitor->read() ? true : false; + for(int xi=0;xi<16;xi++) { - vom = BIT(gfx1, xi) | (BIT(gfx2, xi) << 1) | ((m_reg0 & 3) << 2); - bitmap.pix32(y, x + xi) = palette[color ? (vom + 16) : vom]; + uint8_t const vom = BIT(gfx1, xi) | (BIT(gfx2, xi) << 1) | ((m_reg0 & 3) << 2); + bitmap.pix(y, x + xi) = palette[color ? (vom + 16) : vom]; } } diff --git a/src/mame/drivers/vta2000.cpp b/src/mame/drivers/vta2000.cpp index 974bd16f0d0..db6f3cea898 100644 --- a/src/mame/drivers/vta2000.cpp +++ b/src/mame/drivers/vta2000.cpp @@ -100,29 +100,28 @@ void vta2000_state::machine_reset() uint32_t vta2000_state::screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) /* Cursor is missing. */ { - static uint8_t framecnt=0; - uint8_t y,ra,gfx,attr,fg,bg; - uint16_t sy=0,ma=0,x,xx=0,chr; + static uint8_t framecnt=0; // FIXME: static variable + uint16_t sy=0,ma=0; framecnt++; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - xx = ma << 1; - for (x = ma; x < ma + 80; x++) + uint16_t xx = ma << 1; + for (uint16_t x = ma; x < ma + 80; x++) { - chr = m_p_videoram[xx++]; - attr = m_p_videoram[xx++]; + uint16_t chr = m_p_videoram[xx++]; + uint8_t const attr = m_p_videoram[xx++]; if ((chr & 0x60)==0x60) chr+=256; - gfx = m_p_chargen[(chr<<4) | ra ]; - bg = 0; + uint8_t gfx = m_p_chargen[(chr<<4) | ra ]; + uint8_t fg, bg = 0; /* Process attributes */ if (BIT(attr, 4)) diff --git a/src/mame/drivers/warpsped.cpp b/src/mame/drivers/warpsped.cpp index 53c6360c58d..fe66335c014 100644 --- a/src/mame/drivers/warpsped.cpp +++ b/src/mame/drivers/warpsped.cpp @@ -171,7 +171,7 @@ static void draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l, int colo { if (y >= 0 && y <= bitmap.height() - 1) { - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int h1 = x - l; int h2 = x + l; diff --git a/src/mame/drivers/wheelfir.cpp b/src/mame/drivers/wheelfir.cpp index 0a462c9f937..2443bdf0bf9 100644 --- a/src/mame/drivers/wheelfir.cpp +++ b/src/mame/drivers/wheelfir.cpp @@ -276,9 +276,6 @@ void wheelfir_state::wheelfir_blit_w(offs_t offset, uint16_t data, uint16_t mem_ if(!ACCESSING_BITS_8_15 && offset==0x6) //LSB only! { - int x,y; - - int direct_width=m_direct_write_x1-m_direct_write_x0+1; int direct_height=m_direct_write_y1-m_direct_write_y0+1; @@ -286,203 +283,197 @@ void wheelfir_state::wheelfir_blit_w(offs_t offset, uint16_t data, uint16_t mem_ if(direct_width>0 && direct_height>0) { - x= m_direct_write_idx % direct_width; - y = (m_direct_write_idx / direct_width) %direct_height; + int x = m_direct_write_idx % direct_width; + int y = (m_direct_write_idx / direct_width) % direct_height; x+=m_direct_write_x0; y+=m_direct_write_y0; if(x<512 && y <512) { - m_tmp_bitmap[LAYER_BG]->pix16(y, x) = sixdat; + m_tmp_bitmap[LAYER_BG]->pix(y, x) = sixdat; } } ++m_direct_write_idx; return; - } if(offset==0xf && data==0xffff) { m_maincpu->set_input_line(1, HOLD_LINE); - { - uint8_t *rom = memregion("gfx1")->base(); + uint8_t const *const rom = memregion("gfx1")->base(); - int width = m_screen->width(); - int height = m_screen->height(); + int width = m_screen->width(); + int height = m_screen->height(); - int src_x0=(m_blitter_data[0]>>8)+((m_blitter_data[6]&0x100)?256:0); - int src_y0=(m_blitter_data[2]>>8)+((m_blitter_data[6]&0x200)?256:0); + int src_x0=(m_blitter_data[0]>>8)+((m_blitter_data[6]&0x100)?256:0); + int src_y0=(m_blitter_data[2]>>8)+((m_blitter_data[6]&0x200)?256:0); - int dst_x0=(m_blitter_data[0]&0xff)+((m_blitter_data[7]&0x40)?256:0); - int dst_y0=(m_blitter_data[2]&0xff)+((m_blitter_data[7]&0x80)?256:0); + int dst_x0=(m_blitter_data[0]&0xff)+((m_blitter_data[7]&0x40)?256:0); + int dst_y0=(m_blitter_data[2]&0xff)+((m_blitter_data[7]&0x80)?256:0); - int dst_x1=(m_blitter_data[1]&0xff)+((m_blitter_data[9]&4)?256:0); - int dst_y1=(m_blitter_data[3]&0xff)+((m_blitter_data[9]&8)?256:0); + int dst_x1=(m_blitter_data[1]&0xff)+((m_blitter_data[9]&4)?256:0); + int dst_y1=(m_blitter_data[3]&0xff)+((m_blitter_data[9]&8)?256:0); - int x_dst_step=(m_blitter_data[7]&0x1)?1:-1; - int y_dst_step=(m_blitter_data[7]&0x2)?1:-1; + int x_dst_step=(m_blitter_data[7]&0x1)?1:-1; + int y_dst_step=(m_blitter_data[7]&0x2)?1:-1; - int x_src_step=(m_blitter_data[8]&0x4000)?1:-1; - int y_src_step=(m_blitter_data[8]&0x8000)?1:-1; + int x_src_step=(m_blitter_data[8]&0x4000)?1:-1; + int y_src_step=(m_blitter_data[8]&0x8000)?1:-1; - int page=((m_blitter_data[6])>>10)*0x40000; + int page=((m_blitter_data[6])>>10)*0x40000; - if(page>=0x400000) /* src set to unav. page before direct write to the framebuffer */ - { - m_direct_write_x0=dst_x0; - m_direct_write_x1=dst_x1; - m_direct_write_y0=dst_y0; - m_direct_write_y1=dst_y1; - m_direct_write_idx=0; + if(page>=0x400000) /* src set to unav. page before direct write to the framebuffer */ + { + m_direct_write_x0=dst_x0; + m_direct_write_x1=dst_x1; + m_direct_write_y0=dst_y0; + m_direct_write_y1=dst_y1; + m_direct_write_idx=0; + } + if(x_dst_step<0) + { + if(dst_x0<=dst_x1) + { + return; } - if(x_dst_step<0) + } + else + { + if(dst_x0>=dst_x1) { - if(dst_x0<=dst_x1) - { - return; - } - + return; } - else - { - if(dst_x0>=dst_x1) - { - return; - } - } + } - if(y_dst_step<0) + if(y_dst_step<0) + { + if(dst_y0<=dst_y1) { - if(dst_y0<=dst_y1) - { - return; - } + return; } - else + } + else + { + if(dst_y0>=dst_y1) { - if(dst_y0>=dst_y1) - { - return; - } - + return; } + } - //additional checks - - int d1, d2, hflag, dflag, index; - d1=((m_blitter_data[0x0a]&0x1f00)>>8); + //additional checks - d2=((m_blitter_data[0x0b]&0x1f00)>>8); + int d1, d2, hflag, dflag, index; + d1=((m_blitter_data[0x0a]&0x1f00)>>8); - d1|=((m_blitter_data[0x8]&0x100)>>3); - d2|=((m_blitter_data[0x8]&0x400)>>5); - hflag=(m_blitter_data[0x9]&0x1)?1:0; - dflag=(m_blitter_data[0x8]&0x1000)?1:0; - index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + d2=((m_blitter_data[0x0b]&0x1f00)>>8); - float scale_x=get_scale(index); + d1|=((m_blitter_data[0x8]&0x100)>>3); + d2|=((m_blitter_data[0x8]&0x400)>>5); + hflag=(m_blitter_data[0x9]&0x1)?1:0; + dflag=(m_blitter_data[0x8]&0x1000)?1:0; + index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); - d1=((m_blitter_data[0x0b]&0xc000)>>14) | - ((m_blitter_data[0x0c]&0xc000)>>12) | - ((m_blitter_data[0x0a]&0x4000)>>10); + const float scale_x=get_scale(index); - d2=((m_blitter_data[0x0c]&0x1f00)>>8); + d1=((m_blitter_data[0x0b]&0xc000)>>14) | + ((m_blitter_data[0x0c]&0xc000)>>12) | + ((m_blitter_data[0x0a]&0x4000)>>10); - d1|=((m_blitter_data[0x8]&0x200)>>4); - d2|=((m_blitter_data[0x8]&0x800)>>6); + d2=((m_blitter_data[0x0c]&0x1f00)>>8); - hflag=(m_blitter_data[0x9]&0x2)?1:0; - dflag=(m_blitter_data[0x8]&0x2000)?1:0; - index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + d1|=((m_blitter_data[0x8]&0x200)>>4); + d2|=((m_blitter_data[0x8]&0x800)>>6); - float scale_y=get_scale(index); + hflag=(m_blitter_data[0x9]&0x2)?1:0; + dflag=(m_blitter_data[0x8]&0x2000)?1:0; + index=d1|(d2<<6)|(hflag<<12)|(dflag<<13); + const float scale_y=get_scale(index); - if(scale_x==0 || scale_y==0) return; + if(scale_x==0 || scale_y==0) return; - float scale_x_step=100.f/scale_x; - float scale_y_step=100.f/scale_y; + const float scale_x_step=100.f/scale_x; + const float scale_y_step=100.f/scale_y; - int x,y; - float idx_x,idx_y; - int vpage=LAYER_FG; - if(m_blitter_data[0x7]&0x10) - { - vpage=LAYER_BG; + int vpage=LAYER_FG; + if(m_blitter_data[0x7]&0x10) + { + vpage=LAYER_BG; /* - printf("%s bg -> %d %d %d %d %d %d @ %x\n",machine().describe_context().c_str(), dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0); + printf("%s bg -> %d %d %d %d %d %d @ %x\n",machine().describe_context().c_str(), dst_x0,dst_y0, dst_x1,dst_y1, dst_x1-dst_x0, dst_y1-dst_y0); - for(int i=0;i<16;++i) - { - printf("%x = %.4x\n",i,m_blitter_data[i]); - } + for(int i=0;i<16;++i) + { + printf("%x = %.4x\n",i,m_blitter_data[i]); + } - printf("\n"); + printf("\n"); */ - } + } - bool endx=false; - bool endy=false; + bool endx=false; + bool endy=false; - if(m_blitter_data[0x7]&0x0c) - { - //??? - } + if(m_blitter_data[0x7]&0x0c) + { + //??? + } - for( x=dst_x0, idx_x=0 ; !endx;x+=x_dst_step, idx_x+=scale_x_step ) + float idx_x = 0; + for(int x=dst_x0; !endx; x+=x_dst_step, idx_x+=scale_x_step) + { + endy=false; + float idx_y = 0; + for(int y=dst_y0; !endy; y+=y_dst_step, idx_y+=scale_y_step) { - endy=false; - for( y=dst_y0, idx_y=0 ; !endy;y+=y_dst_step, idx_y+=scale_y_step) - { - endx=(x==dst_x1); - endy=(y==dst_y1); + endx=(x==dst_x1); + endy=(y==dst_y1); - int xx=src_x0+x_src_step*idx_x; - int yy=src_y0+y_src_step*idx_y; + int xx=src_x0+x_src_step*idx_x; + int yy=src_y0+y_src_step*idx_y; - int address=page+yy*512+xx; + int address=page+yy*512+xx; - int pix = rom[address&(0x1000000-1)]; + int pix = rom[address&(0x1000000-1)]; - int screen_x=x; - int screen_y=y; + int screen_x=x; + int screen_y=y; - if(page>=0x400000) + if(page>=0x400000) + { + //hack for clear + if(screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) { - //hack for clear - if(screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) - { - // m_tmp_bitmap[vpage]->pix16(screen_y , screen_x ) =0; - } + // m_tmp_bitmap[vpage]->pix(screen_y , screen_x ) =0; } - else - { - if (vpage == LAYER_FG) screen_y&=0xff; + } + else + { + if (vpage == LAYER_FG) screen_y&=0xff; - if(pix && screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) - { - m_tmp_bitmap[vpage]->pix16(screen_y , screen_x ) = pix; - } + if(pix && screen_x >0 && screen_y >0 && screen_x < width && screen_y <height) + { + m_tmp_bitmap[vpage]->pix(screen_y, screen_x) = pix; } } } @@ -502,22 +493,19 @@ uint32_t wheelfir_state::screen_update_wheelfir(screen_device &screen, bitmap_in for(int y=cliprect.min_y; y < cliprect.max_y; y++) { - uint16_t *source = &m_tmp_bitmap[LAYER_BG]->pix16(( (m_scanlines[y].y)&511)); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const source = &m_tmp_bitmap[LAYER_BG]->pix(( (m_scanlines[y].y)&511)); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x < cliprect.max_x; x++) { - dest[x] = source[ (x+(m_scanlines[y].x)) &511]; + dest[x] = source[(x + m_scanlines[y].x) & 511]; } } copybitmap_trans(bitmap, *m_tmp_bitmap[LAYER_FG], 0, 0, 0, 0, cliprect, 0); /* - { - m_tmp_bitmap[LAYER_BG]->fill(0, screen.visible_area()); - - } + m_tmp_bitmap[LAYER_BG]->fill(0, screen.visible_area()); */ return 0; diff --git a/src/mame/drivers/wicat.cpp b/src/mame/drivers/wicat.cpp index 7c273fc5b04..32283d00bfc 100644 --- a/src/mame/drivers/wicat.cpp +++ b/src/mame/drivers/wicat.cpp @@ -623,13 +623,13 @@ WRITE_LINE_MEMBER(wicat_state::crtc_irq_clear_w) I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels) { uint8_t romdata = vsp ? 0 : m_chargen->base()[(charcode << 4) | linecount]; - const pen_t *pen = m_palette->pens(); + pen_t const *const pen = m_palette->pens(); for (int i = 0; i < 10; i++) { int color = ((romdata & 0xc0) != 0) ^ rvv; - bitmap.pix32(y, x + i) = pen[color]; + bitmap.pix(y, x + i) = pen[color]; romdata <<= 1; } } diff --git a/src/mame/drivers/wpc_dot.cpp b/src/mame/drivers/wpc_dot.cpp index 8dc47fb4784..0b677efd3a6 100644 --- a/src/mame/drivers/wpc_dot.cpp +++ b/src/mame/drivers/wpc_dot.cpp @@ -249,22 +249,21 @@ WRITE_LINE_MEMBER(wpc_dot_state::wpc_firq_w) uint32_t wpc_dot_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y,bit; uint32_t offset = (m_wpc->get_visible_page() * 0x200); - uint32_t col; - for(y=0;y<32;y++) // scanline + for(uint8_t y=0;y<32;y++) // scanline { - for(x=0;x<128;x+=8) // column + for(uint8_t x=0;x<128;x+=8) // column { - for(bit=0;bit<8;bit++) // bits + for(uint8_t bit=0;bit<8;bit++) // bits { assert(offset >= 0 && offset < ARRAY_LENGTH(m_dmdram)); + uint32_t col; if(m_dmdram[offset] & (1<<bit)) col = rgb_t(0xff,0xaa,0x00); else col = rgb_t(0x00,0x00,0x00); - bitmap.pix32(y,x+bit) = col; + bitmap.pix(y,x+bit) = col; } offset++; } diff --git a/src/mame/drivers/wy100.cpp b/src/mame/drivers/wy100.cpp index 693c37039fc..46522a98922 100644 --- a/src/mame/drivers/wy100.cpp +++ b/src/mame/drivers/wy100.cpp @@ -111,7 +111,7 @@ I8275_DRAW_CHARACTER_MEMBER(wy100_state::draw_character) const rgb_t fg = rgb_t::white(); const rgb_t bg = rgb_t::black(); for (int i = 0; i < 10; i++) - bitmap.pix32(y, x + i) = BIT(dots, i < 1 || i > 8 ? 7 : 8 - i) ? fg : bg; + bitmap.pix(y, x + i) = BIT(dots, i < 1 || i > 8 ? 7 : 8 - i) ? fg : bg; } WRITE_LINE_MEMBER(wy100_state::txd_w) diff --git a/src/mame/drivers/wy50.cpp b/src/mame/drivers/wy50.cpp index a8d01829a15..434b0b041ad 100644 --- a/src/mame/drivers/wy50.cpp +++ b/src/mame/drivers/wy50.cpp @@ -158,11 +158,11 @@ SCN2672_DRAW_CHARACTER_MEMBER(wy50_state::draw_character) const rgb_t fg = BIT(m_cur_attr, 0) || (prot && !m_rev_prot) ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white(); for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); dots <<= 1; } if (!m_is_132) - bitmap.pix32(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); + bitmap.pix(y, x++) = BIT(dots, 9) ? fg : rgb_t::black(); } WRITE_LINE_MEMBER(wy50_state::mbc_attr_clock_w) diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index 9a0948aa6db..87fa7b56c7e 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -1094,9 +1094,9 @@ uint32_t x07_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c for(int y = 0; y < 8; y++) for (int x=0; x<6; x++) if(m_cursor.on && m_blink && m_cursor.x == px && m_cursor.y == py) - bitmap.pix16(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; + bitmap.pix(py * 8 + y, px * 6 + x) = (y == 7) ? 1: 0; else - bitmap.pix16(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; + bitmap.pix(py * 8 + y, px * 6 + x) = m_lcd_map[py * 8 + y][px * 6 + x]? 1: 0; } diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp index 64bd8293172..02d48199d76 100644 --- a/src/mame/drivers/xerox820.cpp +++ b/src/mame/drivers/xerox820.cpp @@ -480,25 +480,25 @@ WRITE_LINE_MEMBER( xerox820_state::fdc_drq_w ) uint32_t xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=(m_scroll + 1) * 0x80,x; - const pen_t *pen=m_palette->pens(); + uint16_t sy=0,ma=(m_scroll + 1) * 0x80; + pen_t const *const pen=m_palette->pens(); m_framecnt++; - for (y = 0; y < 24; y++) + for (uint8_t y = 0; y < 24; y++) { if (ma > 0xb80) ma = 0; - for (ra = 0; ra < 10; ra++) + for (uint8_t ra = 0; ra < 10; ra++) { - uint32_t *p = &bitmap.pix32(sy++); + uint32_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { + uint8_t gfx; if (ra < 8) { - chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; + uint8_t chr = m_video_ram[x & XEROX820_VIDEORAM_MASK] ^ 0x80; /* Take care of flashing characters */ if ((chr < 0x80) && (m_framecnt & 0x08)) @@ -510,14 +510,14 @@ uint32_t xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else gfx = 0xff; - /* Display a scanline of a character (7 pixels) */ - *p++ = pen[0]; - *p++ = pen[BIT(gfx, 4) ^ 1]; - *p++ = pen[BIT(gfx, 3) ^ 1]; - *p++ = pen[BIT(gfx, 2) ^ 1]; - *p++ = pen[BIT(gfx, 1) ^ 1]; - *p++ = pen[BIT(gfx, 0) ^ 1]; - *p++ = pen[0]; + /* Display a scanline of a character (7 pixels) */ + *p++ = pen[0]; + *p++ = pen[BIT(gfx, 4) ^ 1]; + *p++ = pen[BIT(gfx, 3) ^ 1]; + *p++ = pen[BIT(gfx, 2) ^ 1]; + *p++ = pen[BIT(gfx, 1) ^ 1]; + *p++ = pen[BIT(gfx, 0) ^ 1]; + *p++ = pen[0]; } } ma+=128; diff --git a/src/mame/drivers/xtheball.cpp b/src/mame/drivers/xtheball.cpp index a1971a6f27f..eae17c07c2a 100644 --- a/src/mame/drivers/xtheball.cpp +++ b/src/mame/drivers/xtheball.cpp @@ -77,19 +77,18 @@ void xtheball_state::machine_start() TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update) { - uint16_t *srcbg = &m_vram_bg[(params->rowaddr << 8) & 0xff00]; - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *const srcbg = &m_vram_bg[(params->rowaddr << 8) & 0xff00]; + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr; - int x; /* bit stored at 3040130 controls which foreground mode to use */ if (!m_foreground_mode) { /* mode 0: foreground is the same as background */ - uint16_t *srcfg = &m_vram_fg[(params->rowaddr << 8) & 0xff00]; + uint16_t const *const srcfg = &m_vram_fg[(params->rowaddr << 8) & 0xff00]; - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t fgpix = srcfg[coladdr & 0xff]; uint16_t bgpix = srcbg[coladdr & 0xff]; @@ -102,9 +101,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(xtheball_state::scanline_update) { /* mode 1: foreground is half background resolution in */ /* X and supports two pages */ - uint16_t *srcfg = &m_vram_fg[(params->rowaddr << 7) & 0xff00]; + uint16_t const *const srcfg = &m_vram_fg[(params->rowaddr << 7) & 0xff00]; - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t fgpix = srcfg[(coladdr >> 1) & 0xff] >> (8 * (coladdr & 1)); uint16_t bgpix = srcbg[coladdr & 0xff]; diff --git a/src/mame/drivers/xyonix.cpp b/src/mame/drivers/xyonix.cpp index 80126638f8d..4308d390c03 100644 --- a/src/mame/drivers/xyonix.cpp +++ b/src/mame/drivers/xyonix.cpp @@ -197,10 +197,10 @@ MC6845_UPDATE_ROW( xyonix_state::crtc_update_row ) uint16_t data = m_gfx->base()[0x8000 | tile] << 8 | m_gfx->base()[tile]; // draw 4 pixels - bitmap.pix32(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; - bitmap.pix32(y, i * 4 + 1) = pen[(attr & 0xf0) | bitswap<4>(data, 5, 1, 13, 9)]; - bitmap.pix32(y, i * 4 + 2) = pen[(attr & 0xf0) | bitswap<4>(data, 6, 2, 14, 10)]; - bitmap.pix32(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; + bitmap.pix(y, i * 4 + 0) = pen[(attr & 0xf0) | bitswap<4>(data, 4, 0, 12, 8)]; + bitmap.pix(y, i * 4 + 1) = pen[(attr & 0xf0) | bitswap<4>(data, 5, 1, 13, 9)]; + bitmap.pix(y, i * 4 + 2) = pen[(attr & 0xf0) | bitswap<4>(data, 6, 2, 14, 10)]; + bitmap.pix(y, i * 4 + 3) = pen[(attr & 0xf0) | bitswap<4>(data, 7, 3, 15, 11)]; } } #endif diff --git a/src/mame/drivers/ymdx11.cpp b/src/mame/drivers/ymdx11.cpp index 0de96879f69..6b131a0dd8e 100644 --- a/src/mame/drivers/ymdx11.cpp +++ b/src/mame/drivers/ymdx11.cpp @@ -57,7 +57,7 @@ void yamaha_dx11_state::machine_start() HD44780_PIXEL_UPDATE(yamaha_dx11_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void yamaha_dx11_state::palette_init(palette_device &palette) diff --git a/src/mame/drivers/ymtx81z.cpp b/src/mame/drivers/ymtx81z.cpp index 21892a615b6..8680a59f698 100644 --- a/src/mame/drivers/ymtx81z.cpp +++ b/src/mame/drivers/ymtx81z.cpp @@ -43,7 +43,7 @@ private: HD44780_PIXEL_UPDATE(ymtx81z_state::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line * 8 + y, pos * 6 + x) = state; + bitmap.pix(line * 8 + y, pos * 6 + x) = state; } void ymtx81z_state::palette_init(palette_device &palette) diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp index fab1cab1f5a..881119f48bc 100644 --- a/src/mame/drivers/z100.cpp +++ b/src/mame/drivers/z100.cpp @@ -309,7 +309,7 @@ void z100_state::memory_ctrl_w(uint8_t data) MC6845_UPDATE_ROW(z100_state::update_row) { - uint32_t *const pix = &bitmap.pix32(y); + uint32_t *const pix = &bitmap.pix(y); const uint16_t amask = m_vram_config->read() ? 0xfff : 0x7ff; for (int x = 0; x < x_count; x++) diff --git a/src/mame/drivers/z1013.cpp b/src/mame/drivers/z1013.cpp index fba061a158f..363738abfc9 100644 --- a/src/mame/drivers/z1013.cpp +++ b/src/mame/drivers/z1013.cpp @@ -240,21 +240,20 @@ INPUT_PORTS_END uint32_t z1013_state::screen_update_z1013(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; - for (y = 0; y < 32; y++) + for (uint8_t y = 0; y < 32; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma+32; x++) + for (uint16_t x = ma; x < ma+32; x++) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/drivers/z22.cpp b/src/mame/drivers/z22.cpp index 7421bf9ad16..b2ab00d41bf 100644 --- a/src/mame/drivers/z22.cpp +++ b/src/mame/drivers/z22.cpp @@ -77,7 +77,7 @@ void z22_state::machine_reset() MC6845_UPDATE_ROW(z22_state::update_row) { - u32 *pix = &bitmap.pix32(y); + u32 *pix = &bitmap.pix(y); for (unsigned x = 0; x < x_count; x++) { diff --git a/src/mame/drivers/z9001.cpp b/src/mame/drivers/z9001.cpp index 3755fcfdd85..3e24d356356 100644 --- a/src/mame/drivers/z9001.cpp +++ b/src/mame/drivers/z9001.cpp @@ -175,23 +175,22 @@ void z9001_state::machine_start() uint32_t z9001_state::screen_update_z9001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,col,fg,bg; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; m_framecnt++; - for(y = 0; y < 24; y++ ) + for (uint8_t y = 0; y < 24; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; // get char in videoram - gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen - col = m_p_colorram[x]; - fg = col>>4; - bg = col&15; + uint8_t chr = m_p_videoram[x]; // get char in videoram + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; // get dot pattern in chargen + uint8_t col = m_p_colorram[x]; + uint8_t fg = col>>4; + uint8_t bg = col&15; /* Check for flashing - swap bg & fg */ if ((BIT(col, 7)) && (m_framecnt & 0x10)) diff --git a/src/mame/drivers/zorba.cpp b/src/mame/drivers/zorba.cpp index 52d667554a5..c0c6f9924cb 100644 --- a/src/mame/drivers/zorba.cpp +++ b/src/mame/drivers/zorba.cpp @@ -490,8 +490,7 @@ void zorba_state::pia1_portb_w(uint8_t data) I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint8_t gfx = m_p_chargen[(linecount & 15) + (charcode << 4) + ((gpa & 1) << 11)]; @@ -505,8 +504,8 @@ I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr ) if (lten) gfx = 0xff; - for(i=0;i<8;i++) - bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; + for (int i = 0; i < 8; i++) + bitmap.pix(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; } diff --git a/src/mame/drivers/zrt80.cpp b/src/mame/drivers/zrt80.cpp index 2d571912ab6..712bfef2cca 100644 --- a/src/mame/drivers/zrt80.cpp +++ b/src/mame/drivers/zrt80.cpp @@ -224,18 +224,16 @@ void zrt80_state::machine_reset() MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chr,gfx,inv; - uint16_t mem,x; - uint32_t *p = &bitmap.pix32(y); - uint8_t polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const polarity = ioport("DIPSW1")->read() & 4 ? 0xff : 0; - for (x = 0; x < x_count; x++) + for (uint16_t x = 0; x < x_count; x++) { - inv = polarity; + uint8_t inv = polarity; if (x == cursor_x) inv ^= 0xff; - mem = (ma + x) & 0x1fff; - chr = m_p_videoram[mem]; + uint16_t const mem = (ma + x) & 0x1fff; + uint8_t chr = m_p_videoram[mem]; if (BIT(chr, 7)) { @@ -243,7 +241,7 @@ MC6845_UPDATE_ROW( zrt80_state::crtc_update_row ) chr &= 0x7f; } - gfx = m_p_chargen[(chr<<4) | ra] ^ inv; + uint8_t const gfx = m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h index 59314a1e903..5fbf6db267f 100644 --- a/src/mame/includes/gridlee.h +++ b/src/mame/includes/gridlee.h @@ -101,7 +101,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; public: void gridlee_sound_w(offs_t offset, uint8_t data); diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h index 14bb5af7651..fe04be66d4d 100644 --- a/src/mame/includes/segag80r.h +++ b/src/mame/includes/segag80r.h @@ -211,7 +211,7 @@ protected: virtual void device_start() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: // internal state diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index f12948d0557..f4b9ee8ba17 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -145,7 +145,7 @@ protected: uint8_t update_tilemaps(screen_device &screen, const rectangle &cliprect); void sprite_erase_buffer(); void sprite_swap_buffers(); - int draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); + int draw_one_sprite(uint16_t const *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout); void sprite_render_list(); inline uint8_t compute_color_offsets(int which, int layerbit, int layerflag); inline uint16_t compute_sprite_blend(uint8_t encoding); diff --git a/src/mame/includes/turrett.h b/src/mame/includes/turrett.h index cce1f821f56..6192a5f56ff 100644 --- a/src/mame/includes/turrett.h +++ b/src/mame/includes/turrett.h @@ -121,7 +121,7 @@ protected: virtual void device_reset() override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; // device_memory_interface overrides virtual space_config_vector memory_space_config() const override; diff --git a/src/mame/includes/xavix.h b/src/mame/includes/xavix.h index 22d4b584d3a..7f24498bbf3 100644 --- a/src/mame/includes/xavix.h +++ b/src/mame/includes/xavix.h @@ -48,7 +48,7 @@ protected: virtual void device_reset() override; // sound stream update overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; private: sound_stream *m_stream; diff --git a/src/mame/machine/3do.cpp b/src/mame/machine/3do.cpp index 245f018fe8b..cf5af65cfe8 100644 --- a/src/mame/machine/3do.cpp +++ b/src/mame/machine/3do.cpp @@ -1046,8 +1046,8 @@ uint32_t _3do_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for ( int y = 0; y < 120; y++ ) { - uint32_t *dest_p0 = &bitmap.pix32(22 + y * 2, 254 ); - uint32_t *dest_p1 = &bitmap.pix32(22 + y * 2 + 1, 254 ); + uint32_t *dest_p0 = &bitmap.pix(22 + y * 2, 254 ); + uint32_t *dest_p1 = &bitmap.pix(22 + y * 2 + 1, 254 ); for ( int x = 0; x < 320; x++ ) { diff --git a/src/mame/machine/3dom2.cpp b/src/mame/machine/3dom2.cpp index dee32da9369..7da659deefa 100644 --- a/src/mame/machine/3dom2.cpp +++ b/src/mame/machine/3dom2.cpp @@ -1336,9 +1336,9 @@ uint32_t m2_vdu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (uint32_t ys = vdouble ? 2 : 1; ys > 0; --ys) { if (hdouble) - draw_scanline_double(&bitmap.pix32(v, 0), srclower, srcupper); + draw_scanline_double(&bitmap.pix(v, 0), srclower, srcupper); else - draw_scanline(&bitmap.pix32(v, 0), srclower, srcupper); + draw_scanline(&bitmap.pix(v, 0), srclower, srcupper); ++v; } @@ -1352,7 +1352,7 @@ uint32_t m2_vdu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitma // Blank this block of lines if DMA is disabled while (lines--) { - uint32_t *dst = &bitmap.pix32(v, cliprect.min_x); + uint32_t *dst = &bitmap.pix(v, cliprect.min_x); for (uint32_t x = cliprect.min_x; x <= cliprect.max_x; ++x) *dst++ = rgb_t::black(); diff --git a/src/mame/machine/aim65.cpp b/src/mame/machine/aim65.cpp index 5c7ce8c221d..cf7b14ba9e1 100644 --- a/src/mame/machine/aim65.cpp +++ b/src/mame/machine/aim65.cpp @@ -315,8 +315,6 @@ void aim65_state::z32_pa_w( u8 data ) // Display printer output uint32_t aim65_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t data; - for (u8 y = 0; y<cliprect.max_y; y++) { u16 sy = m_printer_y*10 - cliprect.max_y + 10 + y; @@ -324,13 +322,14 @@ uint32_t aim65_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, sy += 0x280; for(u8 x = 0; x < 10; x++) { + uint16_t data; if (!BIT(sy, 0)) data = m_printerRAM[sy * 10 + x]; else data = m_printerRAM[sy * 10 + (9 - x)]; for (u8 b = 0; b < 10; b++) - bitmap.pix16(y, 120 - (b * 12) - ((x > 4) ? x+1 : x)) = BIT(data, b); + bitmap.pix(y, 120 - (b * 12) - ((x > 4) ? x+1 : x)) = BIT(data, b); } } diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp index 0fecabe04f1..13109d4da1f 100644 --- a/src/mame/machine/amstrad.cpp +++ b/src/mame/machine/amstrad.cpp @@ -799,7 +799,7 @@ void amstrad_state::amstrad_plus_update_video_sprites() else horiz = m_asic.h_start; - p = &m_gate_array.bitmap->pix16(m_gate_array.y, horiz ); + p = &m_gate_array.bitmap->pix(m_gate_array.y, horiz ); for ( i = 15 * 8; i >= 0; i -= 8 ) { uint8_t xmag = ( m_asic.ram[ 0x2000 + i + 4 ] >> 2 ) & 0x03; @@ -852,7 +852,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_hsync_changed) m_gate_array.line_ticks = 0; if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + m_gate_array.draw_p = &m_gate_array.bitmap->pix(m_gate_array.y); } else { @@ -895,7 +895,7 @@ WRITE_LINE_MEMBER(amstrad_state::amstrad_plus_hsync_changed) m_gate_array.line_ticks = 0; if ( m_gate_array.y >= 0 && m_gate_array.y < m_gate_array.bitmap->height() ) { - m_gate_array.draw_p = &m_gate_array.bitmap->pix16(m_gate_array.y); + m_gate_array.draw_p = &m_gate_array.bitmap->pix(m_gate_array.y); } else { diff --git a/src/mame/machine/apple3.cpp b/src/mame/machine/apple3.cpp index f5849d8ca85..a875d6dfc9e 100644 --- a/src/mame/machine/apple3.cpp +++ b/src/mame/machine/apple3.cpp @@ -680,7 +680,7 @@ uint8_t *apple3_state::apple3_get_indexed_addr(offs_t offset) if ((offset >= 0xFFD0) && (offset <= 0xFFEF)) result = apple3_bankaddr(~0, offset & 0x7FFF); else if (offset < 0x2000) - result = apple3_bankaddr(~0, offset - 0x2000); + result = apple3_bankaddr(~0, offset); else if (offset > 0x9FFF) result = apple3_bankaddr(~0, offset - 0x8000); else @@ -1367,24 +1367,24 @@ WRITE_LINE_MEMBER(apple3_state::a2bus_irq_w) { uint8_t irq_mask = m_a2bus->get_a2bus_irq_mask(); - m_via[0]->write_ca1(state); + m_via[0]->write_ca1(!state); if (irq_mask & (1<<4)) { - m_via[1]->write_pa4(ASSERT_LINE); + m_via[1]->write_pa4(CLEAR_LINE); } else { - m_via[1]->write_pa4(CLEAR_LINE); + m_via[1]->write_pa4(ASSERT_LINE); } if (irq_mask & (1<<3)) { - m_via[1]->write_pa5(ASSERT_LINE); + m_via[1]->write_pa5(CLEAR_LINE); } else { - m_via[1]->write_pa5(CLEAR_LINE); + m_via[1]->write_pa5(ASSERT_LINE); } } diff --git a/src/mame/machine/b2m.cpp b/src/mame/machine/b2m.cpp index 10c892e25db..fae7b699f9c 100644 --- a/src/mame/machine/b2m.cpp +++ b/src/mame/machine/b2m.cpp @@ -280,17 +280,14 @@ void b2m_state::machine_reset() uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1; - uint8_t code2; - uint8_t col; - int y, x, b; - uint8_t *ram = m_ram->pointer(); + u8 const *const ram = m_ram->pointer(); - for (x = 0; x < 48; x++) + for (int x = 0; x < 48; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - u16 t = x*256 + ((y + m_video_scroll) & 0xff); + u16 const t = x*256 + ((y + m_video_scroll) & 0xff); + u8 code1, code2; if (m_video_page==0) { code1 = ram[0x11000 + t]; @@ -301,10 +298,10 @@ uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c code1 = ram[0x19000 + t]; code2 = ram[0x1d000 + t]; } - for (b = 7; b >= 0; b--) + for (int b = 7; b >= 0; b--) { - col = (BIT(code2, b)<<1) + BIT(code1, b); - bitmap.pix16(y, x*8+b) = col; + u8 const col = (BIT(code2, b)<<1) + BIT(code1, b); + bitmap.pix(y, x*8+b) = col; } } } diff --git a/src/mame/machine/bk.cpp b/src/mame/machine/bk.cpp index cd83484112f..d9c5a7c6907 100644 --- a/src/mame/machine/bk.cpp +++ b/src/mame/machine/bk.cpp @@ -151,15 +151,15 @@ void bk_state::floppy_data_w(uint16_t data) u32 bk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u16 nOfs = (m_scroll - 728) % 256; + u16 const nOfs = (m_scroll - 728) % 256; for (u16 y = 0; y < 256; y++) { for (u16 x = 0; x < 32; x++) { - u16 code = m_vram[((y+nOfs) %256)*32 + x]; + u16 const code = m_vram[((y+nOfs) %256)*32 + x]; for (u8 b = 0; b < 16; b++) - bitmap.pix16(y, x*16 + b) = BIT(code, b); + bitmap.pix(y, x*16 + b) = BIT(code, b); } } return 0; diff --git a/src/mame/machine/cedar_magnet_plane.cpp b/src/mame/machine/cedar_magnet_plane.cpp index 094d25ddeab..9ecb7a7eea3 100644 --- a/src/mame/machine/cedar_magnet_plane.cpp +++ b/src/mame/machine/cedar_magnet_plane.cpp @@ -140,7 +140,7 @@ u32 cedar_magnet_plane_device::draw(screen_device &screen, bitmap_ind16 &bitmap, for (int y = 0; y < 256;y++) { - u16 *dst = &bitmap.pix16((y - m_scrolly) & 0xff); + u16 *const dst = &bitmap.pix((y - m_scrolly) & 0xff); for (int x = 0; x < 256;x++) { diff --git a/src/mame/machine/cedar_magnet_sprite.cpp b/src/mame/machine/cedar_magnet_sprite.cpp index 3be7bd8466f..0109d59efe0 100644 --- a/src/mame/machine/cedar_magnet_sprite.cpp +++ b/src/mame/machine/cedar_magnet_sprite.cpp @@ -309,7 +309,7 @@ u32 cedar_magnet_sprite_device::draw(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 256; y++) { - uint16_t *dst = &bitmap.pix16((y) & 0xff); + uint16_t *const dst = &bitmap.pix((y) & 0xff); for (int x = 0; x < 256; x++) { diff --git a/src/mame/machine/concept.cpp b/src/mame/machine/concept.cpp index 83de6b7e48b..ff70dfd656d 100644 --- a/src/mame/machine/concept.cpp +++ b/src/mame/machine/concept.cpp @@ -66,7 +66,7 @@ uint32_t concept_state::screen_update(screen_device &screen, bitmap_ind16 &bitma /* resolution is 720*560 */ for (int y = 0; y < 560; y++) { - uint16_t *line = &bitmap.pix16(560-1-y); + uint16_t *const line = &bitmap.pix(560-1-y); for (int x = 0; x < 720; x++) line[720-1-x] = (m_videoram[(x+48+y*768)>>4] & (0x8000 >> ((x+48+y*768) & 0xf))) ? 1 : 0; } diff --git a/src/mame/machine/dragon.cpp b/src/mame/machine/dragon.cpp index 35f32ef1c31..3499c6553bd 100644 --- a/src/mame/machine/dragon.cpp +++ b/src/mame/machine/dragon.cpp @@ -222,7 +222,7 @@ MC6845_UPDATE_ROW(d64plus_state::crtc_update_row) for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; - bitmap.pix32(y, x) = m_palette->pen(BIT(data, 7) && de); + bitmap.pix(y, x) = m_palette->pen(BIT(data, 7) && de); data <<= 1; } } diff --git a/src/mame/machine/gamepock.cpp b/src/mame/machine/gamepock.cpp index 66de6c28dcb..6b188d2a312 100644 --- a/src/mame/machine/gamepock.cpp +++ b/src/mame/machine/gamepock.cpp @@ -154,14 +154,14 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 50; j++ ) { - bitmap.pix16(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, 49 - j ) = ( m_hd44102ch[0].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } @@ -172,14 +172,14 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 50; j++ ) { - bitmap.pix16(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, j ) = ( m_hd44102ch[1].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } @@ -190,25 +190,25 @@ uint32_t gamepock_state::screen_update_gamepock(screen_device &screen, bitmap_in { for ( int j = 0; j < 25; j++ ) { - bitmap.pix16(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(i * 8 + 0, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(i * 8 + 1, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(i * 8 + 2, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(i * 8 + 3, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(i * 8 + 4, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(i * 8 + 5, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(i * 8 + 6, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(i * 8 + 7, 50 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; } for ( int j = 25; j < 50; j++ ) { - bitmap.pix16(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; - bitmap.pix16(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 0, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x01 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 1, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x02 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 2, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x04 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 3, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x08 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 4, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x10 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 5, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x20 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 6, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x40 ) ? 0 : 1; + bitmap.pix(32 + i * 8 + 7, 25 + j ) = ( m_hd44102ch[2].ram[ad+j] & 0x80 ) ? 0 : 1; } ad += 0x40; } diff --git a/src/mame/machine/imds2ioc.cpp b/src/mame/machine/imds2ioc.cpp index fc9c7a25dd9..1f8008b48b2 100644 --- a/src/mame/machine/imds2ioc.cpp +++ b/src/mame/machine/imds2ioc.cpp @@ -347,9 +347,8 @@ WRITE_LINE_MEMBER(imds2ioc_device::pio_lpt_select_w) I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) { - unsigned i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const chargen_byte = m_chargen[ (linecount & 7) | ((unsigned)charcode << 3) ]; uint16_t pixels; if (lten) { @@ -392,8 +391,8 @@ I8275_DRAW_CHARACTER_MEMBER(imds2ioc_device::crtc_display_pixels) pixels = ~pixels; } - for (i = 0; i < 14; i++) { - bitmap.pix32(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; + for (unsigned i = 0; i < 14; i++) { + bitmap.pix(y, x + i) = palette[ (pixels & (1U << (13 - i))) != 0 ]; } } diff --git a/src/mame/machine/inder_vid.cpp b/src/mame/machine/inder_vid.cpp index e5005ea52b3..ea501338fe2 100644 --- a/src/mame/machine/inder_vid.cpp +++ b/src/mame/machine/inder_vid.cpp @@ -36,17 +36,16 @@ void inder_vid_device::megaphx_tms_map(address_map &map) TMS340X0_SCANLINE_RGB32_CB_MEMBER(inder_vid_device::scanline) { - uint16_t *vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); const pen_t *paldata = m_palette->pens(); int coladdr = params->coladdr; - int x; if (m_bpp_mode == 8) { - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 0] = paldata[pixels & 0xff]; @@ -55,7 +54,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(inder_vid_device::scanline) } else if (m_bpp_mode == 4) { - for (x = params->heblnk; x < params->hsblnk; x += 4) + for (int x = params->heblnk; x < params->hsblnk; x += 4) { uint16_t pixels = vram[coladdr++ & 0xff]; dest[x + 3] = paldata[((pixels & 0xf000) >> 12)]; diff --git a/src/mame/machine/lynx.cpp b/src/mame/machine/lynx.cpp index 0ea49c13a12..7da6ae8f077 100644 --- a/src/mame/machine/lynx.cpp +++ b/src/mame/machine/lynx.cpp @@ -1310,7 +1310,7 @@ void lynx_state::lynx_draw_line() if (m_mikey.data[0x92] & 0x02) { j -= 160 * 102 / 2 - 1; - uint32_t *const line = &m_bitmap_temp.pix32(102 - 1 - y); + uint32_t *const line = &m_bitmap_temp.pix(102 - 1 - y); for (int x = 160 - 2; x >= 0; j++, x -= 2) { uint8_t const byte = lynx_read_ram(j); @@ -1320,7 +1320,7 @@ void lynx_state::lynx_draw_line() } else { - uint32_t *const line = &m_bitmap_temp.pix32(y); + uint32_t *const line = &m_bitmap_temp.pix(y); for (int x = 0; x < 160; j++, x += 2) { uint8_t const byte = lynx_read_ram(j); diff --git a/src/mame/machine/m6502_swap_op_d5_d6.cpp b/src/mame/machine/m6502_swap_op_d5_d6.cpp index d3c661f8c2b..df832634684 100644 --- a/src/mame/machine/m6502_swap_op_d5_d6.cpp +++ b/src/mame/machine/m6502_swap_op_d5_d6.cpp @@ -4,10 +4,13 @@ m6502_swap_op_d5_d6.cpp - 6502 with instruction scrambling + 6502 / N2A03 with instruction scrambling Seen on die marked VH2009, used on polmega, silv35 - but also elsewhere + these are N2A03 derived CPUs used on VTxx systems + + VT1682 systems with this scrambling currently derive from M6502 type + but this might be incorrect ***************************************************************************/ @@ -15,6 +18,7 @@ #include "m6502_swap_op_d5_d6.h" DEFINE_DEVICE_TYPE(M6502_SWAP_OP_D5_D6, m6502_swap_op_d5_d6, "m6502_swap_op_d5_d6", "M6502 swapped D5/D6") +DEFINE_DEVICE_TYPE(N2A03_CORE_SWAP_OP_D5_D6, n2a03_core_swap_op_d5_d6, "n2a03_core_swap_op_d5_d6", "N2A03 core with swapped D5/D6") m6502_swap_op_d5_d6::m6502_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : m6502_device(mconfig, M6502_SWAP_OP_D5_D6, tag, owner, clock) @@ -64,3 +68,57 @@ u8 m6502_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) { return opcode ? mintf->descramble(value) : value; } + + + + + +n2a03_core_swap_op_d5_d6::n2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + n2a03_core_device(mconfig, N2A03_CORE_SWAP_OP_D5_D6, tag, owner, clock) +{ +} + +void n2a03_core_swap_op_d5_d6::device_start() +{ + mintf = std::make_unique<mi_decrypt>(); + init(); +} + +void n2a03_core_swap_op_d5_d6::device_reset() +{ + n2a03_core_device::device_reset(); +} + +uint8_t n2a03_core_swap_op_d5_d6::mi_decrypt::descramble(uint8_t op) +{ + return bitswap<8>(op, 7, 5, 6, 4, 3, 2, 1, 0); +} + +uint8_t n2a03_core_swap_op_d5_d6::mi_decrypt::read_sync(uint16_t adr) +{ + uint8_t res = cprogram.read_byte(adr); + + res = descramble(res); + + return res; +} + +std::unique_ptr<util::disasm_interface> n2a03_core_swap_op_d5_d6::create_disassembler() +{ + return std::make_unique<disassembler>(downcast<mi_decrypt *>(mintf.get())); +} + +n2a03_core_swap_op_d5_d6::disassembler::disassembler(mi_decrypt *mi) : mintf(mi) +{ +} + +u32 n2a03_core_swap_op_d5_d6::disassembler::interface_flags() const +{ + return SPLIT_DECRYPTION; +} + +u8 n2a03_core_swap_op_d5_d6::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const +{ + return opcode ? mintf->descramble(value) : value; +} + diff --git a/src/mame/machine/m6502_swap_op_d5_d6.h b/src/mame/machine/m6502_swap_op_d5_d6.h index efcd4a69c17..aec61cf077f 100644 --- a/src/mame/machine/m6502_swap_op_d5_d6.h +++ b/src/mame/machine/m6502_swap_op_d5_d6.h @@ -4,7 +4,7 @@ m6502_swap_op_d5_d6.h - 6502 with instruction scrambling + 6502 / N2A03 with instruction scrambling ***************************************************************************/ @@ -13,8 +13,8 @@ #pragma once -#include "cpu/m6502/m6502.h" -#include "cpu/m6502/m6502d.h" +#include "cpu/m6502/n2a03.h" +#include "cpu/m6502/n2a03d.h" class m6502_swap_op_d5_d6 : public m6502_device { public: @@ -24,9 +24,6 @@ protected: class mi_decrypt : public mi_default { public: - bool m_scramble_en = false; - bool m_next_scramble = false; - virtual ~mi_decrypt() {} virtual uint8_t read_sync(uint16_t adr) override; @@ -48,6 +45,37 @@ protected: virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; }; +class n2a03_core_swap_op_d5_d6 : public n2a03_core_device { +public: + n2a03_core_swap_op_d5_d6(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + class mi_decrypt : public mi_default { + public: + + virtual ~mi_decrypt() {} + virtual uint8_t read_sync(uint16_t adr) override; + + uint8_t descramble(uint8_t op); + }; + + class disassembler : public n2a03_disassembler { + public: + mi_decrypt *mintf; + + disassembler(mi_decrypt *m); + virtual ~disassembler() = default; + virtual u32 interface_flags() const override; + virtual u8 decrypt8(u8 value, offs_t pc, bool opcode) const override; + }; + + virtual void device_reset() override; + virtual void device_start() override; + virtual std::unique_ptr<util::disasm_interface> create_disassembler() override; +}; + + DECLARE_DEVICE_TYPE(M6502_SWAP_OP_D5_D6, m6502_swap_op_d5_d6) +DECLARE_DEVICE_TYPE(N2A03_CORE_SWAP_OP_D5_D6, n2a03_core_swap_op_d5_d6) #endif // MAME_M6502_SWAP_OP_D5_D6_H diff --git a/src/mame/machine/mega32x.cpp b/src/mame/machine/mega32x.cpp index b8607d8506a..40af33a6965 100644 --- a/src/mame/machine/mega32x.cpp +++ b/src/mame/machine/mega32x.cpp @@ -935,13 +935,10 @@ void sega_32x_device::m68k_pwm_w(offs_t offset, uint16_t data) pwm_w(offset,data); } -void sega_32x_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void sega_32x_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - for (int s = 0; s < samples; s++) - { - outputs[0][s] = inputs[0][s]; - outputs[1][s] = inputs[1][s]; - } + outputs[0] = inputs[0]; + outputs[1] = inputs[1]; } /**********************************************************************************************/ @@ -1742,7 +1739,7 @@ void sega_32x_device::device_start() set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b)); } - m_stream = stream_alloc_legacy(2, 2, 48000 * 4); + m_stream = stream_alloc(2, 2, 48000 * 4); m_32x_pwm_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sega_32x_device::handle_pwm_callback), this)); m_32x_dram0 = std::make_unique<uint16_t[]>(0x40000/2); diff --git a/src/mame/machine/mega32x.h b/src/mame/machine/mega32x.h index e56db24fdb3..51cdf07ad47 100644 --- a/src/mame/machine/mega32x.h +++ b/src/mame/machine/mega32x.h @@ -110,7 +110,7 @@ protected: virtual uint32_t palette_entries() const override { return 32*32*32/**2*/; } // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; void update_total_scanlines(bool mode3) { m_total_scanlines = mode3 ? (m_base_total_scanlines * 2) : m_base_total_scanlines; } // this gets set at each EOF diff --git a/src/mame/machine/megacd.cpp b/src/mame/machine/megacd.cpp index d0b53d9b595..0fefc92c4b6 100644 --- a/src/mame/machine/megacd.cpp +++ b/src/mame/machine/megacd.cpp @@ -1473,7 +1473,7 @@ inline uint8_t sega_segacd_device::read_pixel_from_stampmap(bitmap_ind16* srcbit if (x >= srcbitmap->width) return 0; if (y >= srcbitmap->height) return 0; - uint16_t* cacheptr = &srcbitmap->pix16(y, x); + uint16_t* cacheptr = &srcbitmap->pix(y, x); return cacheptr[0] & 0xf; */ diff --git a/src/mame/machine/megadriv.cpp b/src/mame/machine/megadriv.cpp index b9fb9ec504d..2a277d83789 100644 --- a/src/mame/machine/megadriv.cpp +++ b/src/mame/machine/megadriv.cpp @@ -764,11 +764,11 @@ uint32_t md_base_state::screen_update_megadriv(screen_device &screen, bitmap_rgb /* Copy our screen buffer here */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t* desty = &bitmap.pix32(y, 0); - uint32_t* srcy; + uint32_t *const desty = &bitmap.pix(y, 0); + uint32_t const *srcy; if (!m_vdp->m_use_alt_timing) - srcy = &m_vdp->m_render_bitmap->pix32(y, 0); + srcy = &m_vdp->m_render_bitmap->pix(y, 0); else srcy = m_vdp->m_render_line.get(); diff --git a/src/mame/machine/model1io2.cpp b/src/mame/machine/model1io2.cpp index f47a5b3bda2..9ff771dbcc2 100644 --- a/src/mame/machine/model1io2.cpp +++ b/src/mame/machine/model1io2.cpp @@ -282,7 +282,7 @@ HD44780_PIXEL_UPDATE( model1io2_device::lcd_pixel_update ) return; if (line < 2 && pos < 20) - bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/machine/nes_vt_soc.cpp b/src/mame/machine/nes_vt_soc.cpp index 1237c4e3584..f3ee35252ff 100644 --- a/src/mame/machine/nes_vt_soc.cpp +++ b/src/mame/machine/nes_vt_soc.cpp @@ -473,7 +473,7 @@ uint8_t nes_vt_soc_device::spr_r(offs_t offset) uint8_t nes_vt_soc_device::chr_r(offs_t offset) { - if (m_4242 & 0x1 || m_411d & 0x04) + if (m_4242 & 0x1 || m_411d & 0x04) // newer VT platforms only (not VT03/09), split out { return m_chrram[offset]; } @@ -489,11 +489,18 @@ uint8_t nes_vt_soc_device::chr_r(offs_t offset) void nes_vt_soc_device::chr_w(offs_t offset, uint8_t data) { - if (m_4242 & 0x1 || m_411d & 0x04) + if (m_4242 & 0x1 || m_411d & 0x04) // newer VT platforms only (not VT03/09), split out { logerror("vram write %04x %02x\n", offset, data); m_chrram[offset] = data; } + else + { + int realaddr = calculate_real_video_address(offset, 1, 0); + + address_space& spc = this->space(AS_PROGRAM); + return spc.write_byte(realaddr, data); + } } @@ -775,7 +782,7 @@ void nes_vt_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) offset &= 0x7fff; uint16_t addr = offset+0x8000; - if ((m_411d & 0x01) && (m_411d & 0x03)) + if ((m_411d & 0x01) && (m_411d & 0x03)) // this condition is nonsense, maybe should be ((m_411d & 0x03) == 0x03) check it! (newer VT only, not VT03/09, split) { //CNROM compat logerror("%s: vtxx_cnrom_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); @@ -787,13 +794,13 @@ void nes_vt_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) m_ppu->set_201x_reg(0x5, data * 8 + 7); } - else if (m_411d & 0x01) + else if (m_411d & 0x01) // (newer VT only, not VT03/09, split) { //MMC1 compat, TODO logerror("%s: vtxx_mmc1_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); } - else if (m_411d & 0x02) + else if (m_411d & 0x02) // (newer VT only, not VT03/09, split) { //UNROM compat logerror("%s: vtxx_unrom_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset + 0x8000, data); @@ -802,7 +809,7 @@ void nes_vt_soc_device::scrambled_8000_w(uint16_t offset, uint8_t data) m_410x[0x8] = ((data & 0x0F) << 1) + 1; update_banks(); } - else + else // standard mode (VT03/09) { //logerror("%s: vtxx_mmc3_8000_w real address: (%04x) translated address: (%04x) %02x\n", machine().describe_context(), addr, offset+0x8000, data ); @@ -1214,7 +1221,7 @@ void nes_vt_soc_device::do_pal_timings_and_ppu_replacement(machine_config& confi void nes_vt_soc_device::device_add_mconfig(machine_config &config) { - M6502(config, m_maincpu, NTSC_APU_CLOCK); + N2A03_CORE(config, m_maincpu, NTSC_APU_CLOCK); // Butterfly Catch in vgpocket confirms N2A03 core type, not 6502 m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_device::nes_vt_map); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); @@ -1235,11 +1242,7 @@ void nes_vt_soc_device::device_add_mconfig(machine_config &config) /* sound hardware */ SPEAKER(config, "mono").front_center(); - /* this should actually be a custom *almost* doubled up APU, however requires more thought - than just using 2 APUs as registers in the 2nd one affect the PCM channel mode but the - DMA control still comes from the 1st, but in the new mode, sound always outputs via the - 2nd. Probably need to split the APU into interface and sound gen logic. */ - NES_APU(config, m_apu, NTSC_APU_CLOCK); + NES_APU_VT(config, m_apu, NTSC_APU_CLOCK); m_apu->irq().set(FUNC(nes_vt_soc_device::apu_irq)); m_apu->mem_read().set(FUNC(nes_vt_soc_device::apu_read_mem)); m_apu->add_route(ALL_OUTPUTS, "mono", 0.50); @@ -1260,7 +1263,7 @@ void nes_vt_soc_scramble_device::device_add_mconfig(machine_config& config) { nes_vt_soc_device::device_add_mconfig(config); - M6502_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); + N2A03_CORE_SWAP_OP_D5_D6(config.replace(), m_maincpu, NTSC_APU_CLOCK); // Insect Chase in polmega confirms N2A03 core type, not 6502 m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_scramble_device::nes_vt_map); } @@ -1461,7 +1464,7 @@ void nes_vt_soc_4kram_fp_device::device_add_mconfig(machine_config& config) { nes_vt_soc_device::device_add_mconfig(config); - M6502_VTSCR(config.replace(), m_maincpu, NTSC_APU_CLOCK); + M6502_VTSCR(config.replace(), m_maincpu, NTSC_APU_CLOCK); // are these later chips N2A03 core, or 6502 core derived? m_maincpu->set_addrmap(AS_PROGRAM, &nes_vt_soc_4kram_fp_device::nes_vt_fp_map); } diff --git a/src/mame/machine/nes_vt_soc.h b/src/mame/machine/nes_vt_soc.h index c6695ecf812..18efbcb993f 100644 --- a/src/mame/machine/nes_vt_soc.h +++ b/src/mame/machine/nes_vt_soc.h @@ -7,6 +7,7 @@ #pragma once #include "cpu/m6502/n2a03.h" +#include "sound/nes_apu_vt.h" #include "machine/m6502_vtscr.h" #include "machine/m6502_swap_op_d5_d6.h" #include "video/ppu2c0x_vt.h" @@ -67,7 +68,7 @@ protected: required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; required_device<ppu_vt03_device> m_ppu; - required_device<nesapu_device> m_apu; + required_device<nes_apu_vt_device> m_apu; void nes_vt_map(address_map& map); diff --git a/src/mame/machine/nl_tank.cpp b/src/mame/machine/nl_tank.cpp index 152d7fe01d3..3885aa7a0fd 100644 --- a/src/mame/machine/nl_tank.cpp +++ b/src/mame/machine/nl_tank.cpp @@ -230,14 +230,15 @@ NETLIST_START(tank) QBJT_EB(Q4, "2N3643") QBJT_EB(Q6, "2N3644") QBJT_EB(Q7, "2N3644") - QBJT_EB(Q27, "2N3643") - QBJT_EB(Q28, "2N3644") - QBJT_EB(Q29, "2N3643") - QBJT_EB(Q30, "2N3644") - QBJT_EB(Q31, "2N3643") - QBJT_EB(Q32, "2N3644") - QBJT_EB(Q33, "2N3643") - QBJT_EB(Q34, "2N3644") +// Currently not used +// QBJT_EB(Q27, "2N3643") +// QBJT_EB(Q28, "2N3644") +// QBJT_EB(Q29, "2N3643") +// QBJT_EB(Q30, "2N3644") +// QBJT_EB(Q31, "2N3643") +// QBJT_EB(Q32, "2N3644") +// QBJT_EB(Q33, "2N3643") +// QBJT_EB(Q34, "2N3644") TTL_7404_DIP(IC_H3) TTL_7400_DIP(IC_B6) diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp index 932cabea96b..0b18cfe1193 100644 --- a/src/mame/machine/osborne1.cpp +++ b/src/mame/machine/osborne1.cpp @@ -382,7 +382,7 @@ inline void osborne1_state::draw_rows(uint16_t col, bitmap_ind16 &bitmap, const // Draw a line of the display u8 const ra(y % 10); - uint16_t *p(&bitmap.pix16(y)); + uint16_t *p(&bitmap.pix(y)); uint16_t const row(((m_scroll_y + (y / 10)) << 7) & 0x0F80); for (uint16_t x = 0; Width > x; ++x) @@ -539,7 +539,7 @@ MC6845_UPDATE_ROW(osborne1nv_state::crtc_update_row) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); uint16_t const base = (ma >> 1) & 0xF80; - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (u8 x = 0; x < x_count; ++x) { uint16_t const offset = base | ((ma + x) & 0x7F); diff --git a/src/mame/machine/partner.cpp b/src/mame/machine/partner.cpp index 69f9c201922..0bcc83d5f0a 100644 --- a/src/mame/machine/partner.cpp +++ b/src/mame/machine/partner.cpp @@ -343,9 +343,8 @@ void partner_state::mem_page_w(u8 data) I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) { - int i; - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - const u8 *charmap = m_chargen + 0x400 * (gpa * 2 + hlgt); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u8 const *const charmap = m_chargen + 0x400 * (gpa * 2 + hlgt); u8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; @@ -356,8 +355,8 @@ I8275_DRAW_CHARACTER_MEMBER(partner_state::display_pixels) if (rvv) pixels ^= 0xff; - for(i=0;i<6;i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1]; + for(int i=0;i<6;i++) + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1]; } void partner_state::machine_reset() diff --git a/src/mame/machine/primo.cpp b/src/mame/machine/primo.cpp index 6c76a961e6d..ad4989257f8 100644 --- a/src/mame/machine/primo.cpp +++ b/src/mame/machine/primo.cpp @@ -340,7 +340,7 @@ u32 primo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, cons for (u8 y = 0; y < 192; y++) { - u16 *p = &bitmap.pix16(y); + u16 *p = &bitmap.pix(y); for (u16 x = 0; x < 32; x++) { u8 data = m_vram[ma+x]; diff --git a/src/mame/machine/radio86.cpp b/src/mame/machine/radio86.cpp index 14517a58409..577d141815e 100644 --- a/src/mame/machine/radio86.cpp +++ b/src/mame/machine/radio86.cpp @@ -217,7 +217,7 @@ I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels) pixels ^= 0xff; for (u8 i = 0; i < 6; i++) - bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; + bitmap.pix(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0]; } static constexpr rgb_t radio86_pens[3] = { diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp index 62baaccc2b6..402d9b8a78b 100644 --- a/src/mame/machine/sms.cpp +++ b/src/mame/machine/sms.cpp @@ -1433,7 +1433,7 @@ void gamegear_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rg if (sms_y2 >= vdp_bitmap.cliprect().min_y && sms_y2 <= vdp_bitmap.cliprect().max_y) { - uint32_t *vdp_buffer = &vdp_bitmap.pix32(sms_y2); + uint32_t *const vdp_buffer = &vdp_bitmap.pix(sms_y2); int sms_x = sms_min_x; int x_min_i = plot_min_x - plot_x_first_group; @@ -1496,7 +1496,7 @@ void gamegear_state::screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rg line3 = m_line_buffer.get() + ((sms_y + y_i + 1) & 0x03) * 160; line4 = m_line_buffer.get() + ((sms_y + y_i + 2) & 0x03) * 160; - uint32_t *p_bitmap = &bitmap.pix32(visarea.min_y + plot_y_group + y_i, visarea.min_x); + uint32_t *const p_bitmap = &bitmap.pix(visarea.min_y + plot_y_group + y_i, visarea.min_x); for (int plot_x = plot_min_x; plot_x <= plot_max_x; plot_x++) { @@ -1555,9 +1555,9 @@ uint32_t gamegear_state::screen_update_gamegear(screen_device &screen, bitmap_rg // (it would be better to generalize this in the core, to be used for all LCD systems) for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *linedst = &bitmap.pix32(y); - uint32_t *line0 = &source_bitmap->pix32(y); - uint32_t *line1 = &m_prev_bitmap.pix32(y); + uint32_t *const linedst = &bitmap.pix(y); + uint32_t const *const line0 = &source_bitmap->pix(y); + uint32_t const *const line1 = &m_prev_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint32_t color0 = line0[x]; @@ -1568,9 +1568,9 @@ uint32_t gamegear_state::screen_update_gamegear(screen_device &screen, bitmap_rg uint16_t r1 = (color1 >> 16) & 0x000000ff; uint16_t g1 = (color1 >> 8) & 0x000000ff; uint16_t b1 = (color1 >> 0) & 0x000000ff; - uint8_t r = (uint8_t)((r0 + r1) >> 1); - uint8_t g = (uint8_t)((g0 + g1) >> 1); - uint8_t b = (uint8_t)((b0 + b1) >> 1); + uint8_t r = uint8_t((r0 + r1) >> 1); + uint8_t g = uint8_t((g0 + g1) >> 1); + uint8_t b = uint8_t((b0 + b1) >> 1); linedst[x] = (r << 16) | (g << 8) | b; } } diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 30ea3f738e6..f4cafda3f71 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -511,7 +511,7 @@ void st0016_cpu_device::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip if (!flipy) { drawypos = ypos + yloop; } else { drawypos = (ypos + 8 - 1) - yloop; } - destline = &bitmap.pix16(drawypos); + destline = &bitmap.pix(drawypos); for (xloop = 0; xloop<8; xloop++) { @@ -654,7 +654,7 @@ void st0016_cpu_device::draw_bgmap(bitmap_ind16 &bitmap, const rectangle &clipre if (!flipy) { drawypos = ypos + yloop; } else { drawypos = (ypos + 8 - 1) - yloop; } - destline = &bitmap.pix16(drawypos); + destline = &bitmap.pix(drawypos); for (xloop = 0; xloop<8; xloop++) { diff --git a/src/mame/machine/teleprinter.cpp b/src/mame/machine/teleprinter.cpp index 8ef1576a2c2..75b1654a7ef 100644 --- a/src/mame/machine/teleprinter.cpp +++ b/src/mame/machine/teleprinter.cpp @@ -187,20 +187,17 @@ void teleprinter_device::term_write(uint8_t data) ***************************************************************************/ uint32_t teleprinter_device::tp_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t code; - int y, c, x, b; - - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { - for (c = 0; c < 8; c++) + for (int c = 0; c < 8; c++) { int horpos = 0; - for (x = 0; x < m_width; x++) + for (int x = 0; x < m_width; x++) { - code = teleprinter_font[(m_buffer[y*m_width + x] & 0x7f) *8 + c]; - for (b = 0; b < 8; b++) + uint8_t code = teleprinter_font[(m_buffer[y*m_width + x] & 0x7f) *8 + c]; + for (int b = 0; b < 8; b++) { - bitmap.pix32(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; + bitmap.pix(y*8 + c, horpos++) = (code >> b) & 0x01 ? 0 : 0x00ffffff; } } } diff --git a/src/mame/machine/zx.cpp b/src/mame/machine/zx.cpp index a42a9244108..df7318a34c2 100644 --- a/src/mame/machine/zx.cpp +++ b/src/mame/machine/zx.cpp @@ -70,19 +70,19 @@ void zx_state::drop_sync() xe = 0; } if(ys == ye) { - uint16_t *dest = &m_bitmap_render->pix16(ys, xs); + uint16_t *dest = &m_bitmap_render->pix(ys, xs); for(int x = xs; x < xe; x++) *dest++ = 1; } else { - uint16_t *dest = &m_bitmap_render->pix16(ys, xs); + uint16_t *dest = &m_bitmap_render->pix(ys, xs); for(int x = xs; x < 384; x++) *dest++ = 1; for(int y = ys+1; y < ye; y++) { - dest = &m_bitmap_render->pix16(y, 0); + dest = &m_bitmap_render->pix(y, 0); for(int x = 0; x<384; x++) *dest++ = 1; } - dest = &m_bitmap_render->pix16(ye, 0); + dest = &m_bitmap_render->pix(ye, 0); for(int x = 0; x < xe; x++) *dest++ = 1; } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 7331153061f..cf6e091675e 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -10134,6 +10134,9 @@ millpac // Valadon multiped // hack warlords // 037153-037159 (c) 1980 +@source:ceres.cpp +ceres1 // Eidgenössische Technische Hochschule Zürich Ceres-1 + @source:cesclass.cpp ccclass // hrclass // @@ -36476,6 +36479,7 @@ endurord // bootleg hangon // (c) 1985 (Rev A) hangon1 // (c) 1985 hangon2 // (c) 1985 +hangonvf // bootleg shangonrb // (c) 1992 (but bootleg, hangon hw?) shangonrb2 // bootleg (Beta) shangonro // (c) 1987 (FD1094) diff --git a/src/mame/mess.flt b/src/mame/mess.flt index 6bed3cc1c85..bcb47f7233f 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -155,6 +155,7 @@ cd100.cpp cd2650.cpp cdc721.cpp cdsys5.cpp +ceres.cpp cfx9850.cpp cgc7900.cpp cgenie.cpp diff --git a/src/mame/video/1943.cpp b/src/mame/video/1943.cpp index 545cb91a6da..1a23037cd9b 100644 --- a/src/mame/video/1943.cpp +++ b/src/mame/video/1943.cpp @@ -257,15 +257,15 @@ void _1943_state::_1943_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { if (!(pri[x] & 0x80)) { - u8 c = source[x_index]; + u8 const c = source[x_index]; if (c != transparent_color) { // the priority is actually selected by bit 3 of BMPROM.07 diff --git a/src/mame/video/20pacgal.cpp b/src/mame/video/20pacgal.cpp index f087ed59822..56324388ea6 100644 --- a/src/mame/video/20pacgal.cpp +++ b/src/mame/video/20pacgal.cpp @@ -82,7 +82,7 @@ void _20pacgal_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &clipr for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for(int x = cliprect.min_x; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = pen[bitmap.pix32(y, x)]; + bitmap.pix(y, x) = pen[bitmap.pix(y, x)]; } @@ -139,7 +139,7 @@ void _20pacgal_state::draw_sprite(bitmap_rgb32 &bitmap, const rectangle &cliprec /* pen bits A0-A3 */ if (col) - bitmap.pix32(y, x) = (bitmap.pix32(y, x) & 0xff0) | col; + bitmap.pix(y, x) = (bitmap.pix(y, x) & 0xff0) | col; } /* next pixel */ @@ -278,7 +278,7 @@ void _20pacgal_state::draw_chars(bitmap_rgb32 &bitmap, const rectangle &cliprect /* pen bits A4-A11 */ if ( col != 0 ) - bitmap.pix32(y, x) = (color_base | col) << 4; + bitmap.pix(y, x) = (color_base | col) << 4; /* next pixel */ if (flip) @@ -398,7 +398,7 @@ void _20pacgal_state::draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect if (((lfsr & 0xffc0) == star_seta) || ((lfsr & 0xffc0) == star_setb)) { if (y >= cliprect.min_y && y <= cliprect.max_y) - bitmap.pix32(y, x) = NUM_PENS + (lfsr & 0x3f); + bitmap.pix(y, x) = NUM_PENS + (lfsr & 0x3f); cnt++; } } diff --git a/src/mame/video/40love.cpp b/src/mame/video/40love.cpp index 5a5560c599a..005f02090b7 100644 --- a/src/mame/video/40love.cpp +++ b/src/mame/video/40love.cpp @@ -155,29 +155,16 @@ uint8_t fortyl_state::fortyl_pixram_r(offs_t offset) void fortyl_state::fortyl_plot_pix( int offset ) { - int x, y, i, c, d1, d2; + const int x = (offset & 0x1f) * 8; + const int y = (offset >> 5) & 0xff; - x = (offset & 0x1f) * 8; - y = (offset >> 5) & 0xff; + const int d1 = (m_pixram_sel ? m_pixram2 : m_pixram1)[offset]; + const int d2 = (m_pixram_sel ? m_pixram2 : m_pixram1)[offset + 0x2000]; - if (m_pixram_sel) - { - d1 = m_pixram2[offset]; - d2 = m_pixram2[offset + 0x2000]; - } - else + for (int i = 0; i < 8; i++) { - d1 = m_pixram1[offset]; - d2 = m_pixram1[offset + 0x2000]; - } - - for (i = 0; i < 8; i++) - { - c = ((d2 >> i) & 1) + ((d1 >> i) & 1) * 2; - if (m_pixram_sel) - m_tmp_bitmap2->pix16(y, x + i) = m_pix_color[c] | ((m_color_bank == true) ? 0x200 : 0); - else - m_tmp_bitmap1->pix16(y, x + i) = m_pix_color[c] | ((m_color_bank == true) ? 0x200 : 0); + const int c = BIT(d2, i) | (BIT(d1, i) << 1); + (m_pixram_sel ? m_tmp_bitmap2 : m_tmp_bitmap1)->pix(y, x + i) = m_pix_color[c] | (m_color_bank ? 0x200 : 0); } } diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp index e97df1fd17f..c19d45b60c5 100644 --- a/src/mame/video/733_asr.cpp +++ b/src/mame/video/733_asr.cpp @@ -207,7 +207,7 @@ void asr733_device::linefeed() assert(asr_window_offset_y + asr_window_height <= m_bitmap->height()); for (int y=asr_window_offset_y; y<asr_window_offset_y+asr_window_height-asr_scroll_step; y++) { - std::copy_n(&m_bitmap->pix16(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); + std::copy_n(&m_bitmap->pix(y+asr_scroll_step, asr_window_offset_x), asr_window_width, buf); draw_scanline8(*m_bitmap, asr_window_offset_x, y, asr_window_width, buf, palette().pens()); } diff --git a/src/mame/video/8080bw.cpp b/src/mame/video/8080bw.cpp index f3df7201358..65c51ba6ebe 100644 --- a/src/mame/video/8080bw.cpp +++ b/src/mame/video/8080bw.cpp @@ -56,9 +56,9 @@ inline void _8080bw_state::set_pixel( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x if (y >= MW8080BW_VCOUNTER_START_NO_VBLANK) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = m_palette->pen_color(color); + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = m_palette->pen_color(color); } } @@ -80,18 +80,16 @@ inline void _8080bw_state::set_8_pixels( bitmap_rgb32 &bitmap, uint8_t y, uint8_ /* this is needed as this driver doesn't emulate the shift register like mw8080bw does */ void _8080bw_state::clear_extra_columns( bitmap_rgb32 &bitmap, int color ) { - uint8_t x; - - for (x = 0; x < 4; x++) + for (uint8_t x = 0; x < 4; x++) { uint8_t y; for (y = MW8080BW_VCOUNTER_START_NO_VBLANK; y != 0; y++) { if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + x)) = m_palette->pen_color(color); else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + x) = m_palette->pen_color(color); } } } @@ -379,9 +377,9 @@ uint32_t _8080bw_state::screen_update_shuttlei(screen_device &screen, bitmap_rgb for (int i = 0; i < 8; i++) { if (m_flip_screen) - bitmap.pix32(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); + bitmap.pix(191-y, 255-(x|i)) = m_palette->pen_color(BIT(data, 7)); else - bitmap.pix32(y, x|i) = m_palette->pen_color(BIT(data, 7)); + bitmap.pix(y, x|i) = m_palette->pen_color(BIT(data, 7)); data <<= 1; } } @@ -402,7 +400,7 @@ uint32_t _8080bw_state::screen_update_spacecom(screen_device &screen, bitmap_rgb for (int i = 0; i < 8; i++) { - bitmap.pix32(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); + bitmap.pix(y, x | (i^flipx)) = m_palette->pen_color(BIT(data, 0)); data >>= 1; } } diff --git a/src/mame/video/abc1600.cpp b/src/mame/video/abc1600.cpp index 5b9e8919f12..b8b87f295bd 100644 --- a/src/mame/video/abc1600.cpp +++ b/src/mame/video/abc1600.cpp @@ -180,7 +180,7 @@ MC6845_UPDATE_ROW(abc1600_mover_device::crtc_update_row) { int color = ((BIT(data, 15) ^ PIX_POL) && !BLANK) && de; - bitmap.pix32(vbp + y, hbp + x++) = pen[color]; + bitmap.pix(vbp + y, hbp + x++) = pen[color]; data <<= 1; } diff --git a/src/mame/video/abc80.cpp b/src/mame/video/abc80.cpp index 5aa828894cf..c5cf846b425 100644 --- a/src/mame/video/abc80.cpp +++ b/src/mame/video/abc80.cpp @@ -128,7 +128,7 @@ void abc80_state::draw_scanline(bitmap_rgb32 &bitmap, int y) color ^= (cursor & m_blink); color &= blank; - bitmap.pix32(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); data <<= 1; } diff --git a/src/mame/video/abc800.cpp b/src/mame/video/abc800.cpp index 386ba12581c..bc6f3636a9d 100644 --- a/src/mame/video/abc800.cpp +++ b/src/mame/video/abc800.cpp @@ -73,16 +73,16 @@ void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) if (color) { - bool black = bitmap.pix32(y, x) == rgb_t::black(); + bool black = bitmap.pix(y, x) == rgb_t::black(); bool opaque = !BIT(fgctl, 3); if (black || opaque) { - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; + bitmap.pix(y, x) = pen[color]; + bitmap.pix(y, x + 1) = pen[color]; - bitmap.pix32(y + 1, x) = pen[color]; - bitmap.pix32(y + 1, x + 1) = pen[color]; + bitmap.pix(y + 1, x) = pen[color]; + bitmap.pix(y + 1, x + 1) = pen[color]; } } @@ -200,8 +200,8 @@ void abc800m_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) uint16_t fgctl_addr = ((m_fgctl & 0x7f) << 2) | ((data >> 6) & 0x03); int color = (m_fgctl_prom->base()[fgctl_addr] & 0x07) ? 1 : 0; - bitmap.pix32(y, x++) = pen[color]; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; data <<= 2; } @@ -241,7 +241,7 @@ MC6845_UPDATE_ROW( abc800m_state::abc800m_update_row ) if (BIT(data, 7) && de) { - bitmap.pix32(y, x) = fgpen; + bitmap.pix(y, x) = fgpen; } data <<= 1; diff --git a/src/mame/video/abc802.cpp b/src/mame/video/abc802.cpp index 5037c6a69fd..e42d84afc5f 100644 --- a/src/mame/video/abc802.cpp +++ b/src/mame/video/abc802.cpp @@ -127,7 +127,7 @@ MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + bit; int color = (BIT(data, 7) ^ ri) && de; - bitmap.pix32(y, x) = pen[color]; + bitmap.pix(y, x) = pen[color]; data <<= 1; } @@ -139,8 +139,8 @@ MC6845_UPDATE_ROW( abc802_state::abc802_update_row ) int x = hbp + ((column + 3) * ABC800_CHAR_WIDTH) + (bit << 1); int color = (BIT(data, 7) ^ ri) && de; - bitmap.pix32(y, x) = pen[color]; - bitmap.pix32(y, x + 1) = pen[color]; + bitmap.pix(y, x) = pen[color]; + bitmap.pix(y, x + 1) = pen[color]; data <<= 1; } diff --git a/src/mame/video/abc806.cpp b/src/mame/video/abc806.cpp index f9a8b7209f8..558b217832c 100644 --- a/src/mame/video/abc806.cpp +++ b/src/mame/video/abc806.cpp @@ -310,11 +310,11 @@ MC6845_UPDATE_ROW( abc806_state::abc806_update_row ) int color = BIT(chargen_data, 7) ? fg_color : bg_color; if (!de) color = 0; - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; if (e5 || e6) { - bitmap.pix32(y, x++) = pen[color]; + bitmap.pix(y, x++) = pen[color]; } chargen_data <<= 1; @@ -407,9 +407,9 @@ void abc806_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int x = HORIZONTAL_PORCH_HACK + (ABC800_CHAR_WIDTH * 4) - 16 + (sx * 4) + pixel; - if (BIT(dot, 15) || (bitmap.pix32(y, x) == rgb_t::black())) + if (BIT(dot, 15) || (bitmap.pix(y, x) == rgb_t::black())) { - bitmap.pix32(y, x) = pen[(dot >> 12) & 0x07]; + bitmap.pix(y, x) = pen[(dot >> 12) & 0x07]; } dot <<= 4; diff --git a/src/mame/video/advision.cpp b/src/mame/video/advision.cpp index b0eec08439b..3dcbbc11433 100644 --- a/src/mame/video/advision.cpp +++ b/src/mame/video/advision.cpp @@ -96,9 +96,9 @@ uint32_t advision_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (int y = 0; y < 128; y+=2) { if (*led > 0) - bitmap.pix16(30 + y, 85 + x) = --(*led); + bitmap.pix(30 + y, 85 + x) = --(*led); else - bitmap.pix16(30 + y, 85 + x) = 0; + bitmap.pix(30 + y, 85 + x) = 0; led += 256; } diff --git a/src/mame/video/aeroboto.cpp b/src/mame/video/aeroboto.cpp index 50fb751fe95..a7257ddec08 100644 --- a/src/mame/video/aeroboto.cpp +++ b/src/mame/video/aeroboto.cpp @@ -120,9 +120,7 @@ void aeroboto_state::aeroboto_tilecolor_w(offs_t offset, uint8_t data) void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { int x = m_spriteram[offs + 3]; int y = 240 - m_spriteram[offs]; @@ -144,10 +142,9 @@ void aeroboto_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const rectangle splitrect1(0, 255, 0, 39); - const rectangle splitrect2(0, 255, 40, 255); - uint8_t *src_base, *src_colptr, *src_rowptr; - int src_offsx, src_colmask, sky_color, star_color, x, y, i, j, pen; + rectangle const splitrect1(0, 255, 0, 39); + rectangle const splitrect2(0, 255, 40, 255); + int sky_color, star_color; sky_color = star_color = *m_bgcolor << 2; @@ -165,30 +162,30 @@ uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_in bitmap.fill(sky_color, cliprect); // actual scroll speed is unknown but it can be adjusted by changing the SCROLL_SPEED constant - m_sx += (char)(*m_starx - m_ox); + m_sx += char(*m_starx - m_ox); m_ox = *m_starx; - x = m_sx / SCROLL_SPEED; + int const x = m_sx / SCROLL_SPEED; if (*m_vscroll != 0xff) - m_sy += (char)(*m_stary - m_oy); + m_sy += char(*m_stary - m_oy); m_oy = *m_stary; - y = m_sy / SCROLL_SPEED; + int const y = m_sy / SCROLL_SPEED; - src_base = m_stars_rom; + uint8_t const *const src_base = m_stars_rom; - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { - src_offsx = (x + i) & 0xff; - src_colmask = 1 << (src_offsx & 7); + int src_offsx = (x + i) & 0xff; + int const src_colmask = 1 << (src_offsx & 7); src_offsx >>= 3; - src_colptr = src_base + src_offsx; - pen = star_color + ((i + 8) >> 4 & 1); + uint8_t const *const src_colptr = src_base + src_offsx; + int const pen = star_color + ((i + 8) >> 4 & 1); - for (j = 0; j < 256; j++) + for (int j = 0; j < 256; j++) { - src_rowptr = src_colptr + (((y + j) & 0xff) << 5 ); + uint8_t const *const src_rowptr = src_colptr + (((y + j) & 0xff) << 5 ); if (!((unsigned)*src_rowptr & src_colmask)) - bitmap.pix16(j, i) = pen; + bitmap.pix(j, i) = pen; } } } @@ -199,7 +196,7 @@ uint32_t aeroboto_state::screen_update_aeroboto(screen_device &screen, bitmap_in bitmap.fill(sky_color, cliprect); } - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) m_bg_tilemap->set_scrollx(y, m_hscroll[y]); // the playfield is part of a splitscreen and should not overlap with status display diff --git a/src/mame/video/aerofgt.cpp b/src/mame/video/aerofgt.cpp index 1fb4a2d8d5f..217de0c076a 100644 --- a/src/mame/video/aerofgt.cpp +++ b/src/mame/video/aerofgt.cpp @@ -640,17 +640,15 @@ void aerofgt_state::aerfboot_draw_sprites( screen_device &screen, bitmap_ind16 & // BOOTLEG void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) { - int x, y, count; - - count = 16; // weird, the bitmap doesn't start at 0? - for (y = 0; y < 256; y++) - for (x = 0; x < 512; x++) + int count = 16; // weird, the bitmap doesn't start at 0? + for (int y = 0; y < 256; y++) + for (int x = 0; x < 512; x++) { int color = m_bitmapram[count] >> 1; /* data is GRB; convert to RGB */ rgb_t pen = rgb_t(pal5bit((color & 0x3e0) >> 5), pal5bit((color & 0x7c00) >> 10), pal5bit(color & 0x1f)); - bitmap.pix32(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; + bitmap.pix(y, (10 + x - m_rasterram[(y & 0x7f)]) & 0x1ff) = pen; count++; count &= 0x1ffff; @@ -660,11 +658,9 @@ void aerofgt_state::wbbc97_draw_bitmap( bitmap_rgb32 &bitmap ) // BOOTLEG uint32_t aerofgt_state::screen_update_pspikesb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i, scrolly; - m_tilemap[0]->set_scroll_rows(256); - scrolly = m_scrolly[0]; - for (i = 0; i < 256; i++) + int scrolly = m_scrolly[0]; + for (int i = 0; i < 256; i++) m_tilemap[0]->set_scrollx((i + scrolly) & 0xff, m_rasterram[i] + 22); m_tilemap[0]->set_scrolly(0, scrolly); diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp index 50bfd364300..891d89c25af 100644 --- a/src/mame/video/agat7.cpp +++ b/src/mame/video/agat7.cpp @@ -146,22 +146,18 @@ void agat7video_device::do_io(int offset) void agat7video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { - color = (chardata[y] & (1 << (7-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (7-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -226,26 +222,22 @@ void agat7video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 32; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 32; col++) { - address = m_start_address + col + (row * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + (row * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80); + uint8_t const v = (gfx & 0x80); gfx <<= 1; *(p++) = v ? fg : bg; *(p++) = v ? fg : bg; @@ -256,25 +248,20 @@ void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &b void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row/2) * 0x40); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row/2) * 0x40); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t const v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; @@ -287,25 +274,20 @@ void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 & void agat7video_device::graph_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x20; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x20; col++) { - address = m_start_address + col + ((row/4) * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row/4) * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t const v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; diff --git a/src/mame/video/agat9.cpp b/src/mame/video/agat9.cpp index 9e2f48ba42f..841f69bec26 100644 --- a/src/mame/video/agat9.cpp +++ b/src/mame/video/agat9.cpp @@ -294,33 +294,29 @@ void agat9video_device::do_io(int offset) void agat9video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { - color = (chardata[y] & (1 << (7 - x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (7 - x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } } -int color_1_p[4] = +static constexpr int color_1_p[4] = { 0, 4, 0, 5 }; -int color_2_p[4][2] = +static constexpr int color_2_p[4][2] = { { 0, 7 }, { 7, 0 }, @@ -392,26 +388,22 @@ void agat9video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b void agat9video_device::graph_update_mono_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 32; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 32; col++) { - address = m_start_address + col + (row * 0x20); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + (row * 0x20); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80) >> 7; + uint8_t v = (gfx & 0x80) >> 7; v = color_2_p[palette_index][v]; gfx <<= 1; *(p++) = v ? fg : bg; @@ -423,26 +415,22 @@ void agat9video_device::graph_update_mono_lores(screen_device &screen, bitmap_in void agat9video_device::graph_update_mono_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; int fg = 7, bg = 0; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 64; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 64; col++) { - address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - v = (gfx & 0x80) >> 7; + uint8_t v = (gfx & 0x80) >> 7; v = color_2_p[palette_index][v]; gfx <<= 1; *(p++) = v ? fg : bg; @@ -451,7 +439,7 @@ void agat9video_device::graph_update_mono_hires(screen_device &screen, bitmap_in } } -int color_4_p[4][4] = +static constexpr int color_4_p[4][4] = { { 0, 1, 2, 4 }, { 7, 1, 2, 4 }, @@ -461,25 +449,20 @@ int color_4_p[4][4] = void agat9video_device::graph_update_color_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40) + 0x2000 * (row & 1); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { - v = (gfx & 0xc0) >> 6; + uint8_t v = (gfx & 0xc0) >> 6; v = color_4_p[palette_index][v]; gfx <<= 2; *(p++) = v; @@ -491,25 +474,20 @@ void agat9video_device::graph_update_color_hires(screen_device &screen, bitmap_i void agat9video_device::graph_update_color_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b; - uint32_t address; - uint16_t *p; - uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - p = &bitmap.pix16(row); - for (col = 0; col < 0x40; col++) + uint16_t *p = &bitmap.pix(row); + for (int col = 0; col < 0x40; col++) { - address = m_start_address + col + ((row / 2) * 0x40); - gfx = m_ram_dev->read(address); + uint32_t const address = m_start_address + col + ((row / 2) * 0x40); + uint8_t gfx = m_ram_dev->read(address); - for (b = 0; b < 2; b++) + for (int b = 0; b < 2; b++) { - v = (gfx & 0xf0) >> 4; + uint8_t v = (gfx & 0xf0) >> 4; gfx <<= 4; *(p++) = v; *(p++) = v; @@ -525,34 +503,29 @@ void agat9video_device::graph_update_color_lores(screen_device &screen, bitmap_i void agat9video_device::plot_text_character_apple(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { code &= 0x3f; if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6 - x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6 - x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -560,25 +533,20 @@ void agat9video_device::plot_text_character_apple(bitmap_ind16 &bitmap, int xpos void agat9video_device::text_update_apple(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address; - uint32_t address; - int fg, bg; - - start_address = m_page2 ? 0x800 : 0x400; + uint32_t const start_address = m_page2 ? 0x800 : 0x400; - fg = color_2_p[palette_index][1]; - bg = color_2_p[palette_index][0]; + int const fg = color_2_p[palette_index][1]; + int const bg = color_2_p[palette_index][0]; beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); plot_text_character_apple(bitmap, col * 7, row, 1, m_ram_dev->read(address), m_char_ptr, m_char_size, fg, bg); } @@ -587,13 +555,7 @@ void agat9video_device::text_update_apple(screen_device &screen, bitmap_ind16 &b void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, b, va; - int offset; uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; int begincol = 0, endcol = 40; /* sanity checks */ @@ -614,20 +576,20 @@ void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, if (endcol < begincol) return; - va = m_page2 ? 0x4000 : 0x2000; + int const va = m_page2 ? 0x4000 : 0x2000; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = begincol; col < endcol; col++) + for (int col = begincol; col < endcol; col++) { - offset = ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row / 8) & 0x07) << 7) | (((row / 8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1 + col] = m_ram_dev->read(va + offset); } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); /* * p. 50 of technical manual: @@ -638,17 +600,17 @@ void agat9video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, * 4. odd pixels can be 'black', 'green' (2) or 'red' (1) * 5. bit 7 affects color of pixels in this byte. zero = 'blue' or 'red', one = 'purple' or 'green'. */ - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t const w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); - artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; + uint16_t const *const artifact_map_ptr = &m_hires_artifact_map[((vram_row[col + 1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7 - 1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7 - 1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; } } diff --git a/src/mame/video/airraid_dev.cpp b/src/mame/video/airraid_dev.cpp index 5b02b48a517..4a25c6e99c7 100644 --- a/src/mame/video/airraid_dev.cpp +++ b/src/mame/video/airraid_dev.cpp @@ -176,8 +176,8 @@ void airraid_video_device::mix_layer(screen_device &screen, bitmap_ind16 &bitmap { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_temp_bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &m_temp_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint8_t pix = src[x] & 0xff; diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp index 1194a8d422c..2ff7c7b6fdc 100644 --- a/src/mame/video/amiga.cpp +++ b/src/mame/video/amiga.cpp @@ -705,7 +705,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) if ((scanline & 1) ^ lof) { // lof matches? then render this scanline - dst = &bitmap.pix32(scanline); + dst = &bitmap.pix(scanline); } else { @@ -715,7 +715,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // otherwise just render the contents of the previous frame's scanline int shift = (m_previous_lof == lof) ? 1 : 0; - std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline)); + std::copy_n(&m_flickerfixer.pix(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix(scanline)); return; } } @@ -1026,7 +1026,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // save if (dst != nullptr) - std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline)); + std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix(save_scanline)); #if GUESS_COPPER_OFFSET if (m_screen->frame_number() % 64 == 0 && scanline == 0) diff --git a/src/mame/video/amigaaga.cpp b/src/mame/video/amigaaga.cpp index 46a5d092623..59e99a9bcbc 100644 --- a/src/mame/video/amigaaga.cpp +++ b/src/mame/video/amigaaga.cpp @@ -475,7 +475,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) if ((scanline & 1) ^ lof) { // lof matches? then render this scanline - dst = &bitmap.pix32(scanline); + dst = &bitmap.pix(scanline); } else { @@ -485,7 +485,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) // otherwise just render the contents of the previous frame's scanline int shift = (m_previous_lof == lof) ? 1 : 0; - std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline)); + std::copy_n(&m_flickerfixer.pix(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix(scanline)); return; } } @@ -829,7 +829,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) // save if (dst != nullptr) - std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline)); + std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix(save_scanline)); #if GUESS_COPPER_OFFSET if (m_screen->frame_number() % 64 == 0 && scanline == 0) diff --git a/src/mame/video/ams40041.cpp b/src/mame/video/ams40041.cpp index fc0143efa91..6dacc421a29 100644 --- a/src/mame/video/ams40041.cpp +++ b/src/mame/video/ams40041.cpp @@ -488,10 +488,10 @@ offs_t ams40041_device::get_char_rom_offset() MC6845_UPDATE_ROW( ams40041_device::draw_alpha ) { offs_t char_rom_offset = get_char_rom_offset(); - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); if (get_display_mode(m_vdu_mode) == ALPHA_40) - p = &bitmap.pix32(y + vbp, hbp); + p = &bitmap.pix(y + vbp, hbp); if (y > 199) return; @@ -558,7 +558,7 @@ MC6845_UPDATE_ROW( ams40041_device::draw_graphics_1 ) { if (y > 199) return; - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); for (int column = 0; column < x_count; column++) { @@ -578,7 +578,7 @@ MC6845_UPDATE_ROW( ams40041_device::draw_graphics_2 ) { if (y > 199) return; - uint32_t *p = &bitmap.pix32(y + vbp, hbp); + uint32_t *p = &bitmap.pix(y + vbp, hbp); for (int column = 0; column < x_count; column++) { diff --git a/src/mame/video/apexc.cpp b/src/mame/video/apexc.cpp index 095763b9c40..683e55e642b 100644 --- a/src/mame/video/apexc.cpp +++ b/src/mame/video/apexc.cpp @@ -72,7 +72,7 @@ void apexc_state::draw_led(bitmap_ind16 &bitmap, int x, int y, int state) { for (int yy = 1; yy < 7; yy++) for (int xx = 1; xx < 7; xx++) - bitmap.pix16(y + yy, x + xx) = state ? 2 : 3; + bitmap.pix(y + yy, x + xx) = state ? 2 : 3; } /* write a single char on screen */ @@ -134,7 +134,7 @@ void apexc_state::teletyper_linefeed() assert(teletyper_window_offset_y + teletyper_window_height <= m_bitmap->height()); for (int y = teletyper_window_offset_y; y < teletyper_window_offset_y + teletyper_window_height - teletyper_scroll_step; y++) { - std::copy_n(&m_bitmap->pix16(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); + std::copy_n(&m_bitmap->pix(y+teletyper_scroll_step, teletyper_window_offset_x), teletyper_window_width, buf); draw_scanline8(*m_bitmap, teletyper_window_offset_x, y, teletyper_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/apollo.cpp b/src/mame/video/apollo.cpp index e4124bab8cd..84183400c2a 100644 --- a/src/mame/video/apollo.cpp +++ b/src/mame/video/apollo.cpp @@ -1563,24 +1563,22 @@ uint32_t apollo_graphics_15i::screen_update(screen_device &screen, bitmap_rgb32 void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint16_t *source_ptr = m_image_memory.get(); - int x, y; - uint16_t data, mask; - uint16_t inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; + uint16_t const *source_ptr = m_image_memory.get(); + uint16_t const inverse = (m_cr1 & CR1_INV) ? 0xffff : 0; MLOG1(("screen_update1: size=%0x rowpixels=%d", m_image_memory_size, bitmap.rowpixels())); if ((m_cr1 & CR1_DISP_EN) == 0) { // display is disabled - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { - bitmap.pix32(y, dest++) = 0; + bitmap.pix(y, dest++) = 0; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1588,23 +1586,24 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else if (m_n_planes == 4) { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { uint16_t data0 = source_ptr[0]; uint16_t data1 = source_ptr[m_image_plane_size]; uint16_t data2 = source_ptr[m_image_plane_size * 2]; uint16_t data3 = source_ptr[m_image_plane_size * 3]; source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { + uint16_t data; data = (data0 & mask) ? 1 : 0; data |= (data1 & mask) ? 2 : 0; data |= (data2 & mask) ? 4 : 0; data |= (data3 & mask) ? 8 : 0; - bitmap.pix32(y, dest++) = m_color_lookup_table[data]; + bitmap.pix(y, dest++) = m_color_lookup_table[data]; } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1612,10 +1611,10 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else if (m_n_planes == 8) { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { uint16_t data0 = source_ptr[0]; uint16_t data1 = source_ptr[m_image_plane_size]; @@ -1626,8 +1625,9 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & uint16_t data6 = source_ptr[m_image_plane_size * 6]; uint16_t data7 = source_ptr[m_image_plane_size * 7]; source_ptr++; - for (mask = 0x8000; mask; mask >>= 1) + for (uint16_t mask = 0x8000; mask; mask >>= 1) { + uint16_t data; data = (data0 & mask) ? 1 : 0; data |= (data1 & mask) ? 2 : 0; data |= (data2 & mask) ? 4 : 0; @@ -1636,7 +1636,7 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & data |= (data5 & mask) ? 0x20 : 0; data |= (data6 & mask) ? 0x40 : 0; data |= (data7 & mask) ? 0x80 : 0; - bitmap.pix32(y, dest++) = m_bt458->get_rgb(data); + bitmap.pix(y, dest++) = m_bt458->get_rgb(data); } } source_ptr += (m_buffer_width - m_width) / 16; @@ -1644,15 +1644,15 @@ void apollo_graphics_15i::screen_update1(bitmap_rgb32 &bitmap, const rectangle & } else // m_n_planes == 1 { - for (y = 0; y < m_height; y++) + for (int y = 0; y < m_height; y++) { int dest = 0; - for (x = 0; x < m_width; x += 16) + for (int x = 0; x < m_width; x += 16) { - data = *source_ptr++ ^ inverse; - for (mask = 0x8000; mask; mask >>= 1) + uint16_t const data = *source_ptr++ ^ inverse; + for (uint16_t mask = 0x8000; mask; mask >>= 1) { - bitmap.pix32(y, dest++) = data & mask ? 0 : 0x00ffffff; + bitmap.pix(y, dest++) = data & mask ? 0 : 0x00ffffff; } } source_ptr += (m_buffer_width - m_width) / 16; diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp index 37e3819052c..65c50741d7f 100644 --- a/src/mame/video/apple2.cpp +++ b/src/mame/video/apple2.cpp @@ -138,6 +138,7 @@ void a2_video_device::device_reset() m_monohgr = false; m_newvideo = 0x01; m_rgbmode = 3; // default to color DHGR + m_monochrome = 0; // TODO: never set, but if left uninitialized could cause the emulation to start in monochrome by accident. Default to color for now } WRITE_LINE_MEMBER(a2_video_device::txt_w) @@ -195,10 +196,6 @@ WRITE_LINE_MEMBER(a2_video_device::an2_w) void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -207,9 +204,8 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -218,24 +214,23 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp if ((code >= 0x60) && (code <= 0x7f)) { code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; + using std::swap;// and flip the color + std::swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << x)) ? bg : fg; + uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -244,10 +239,6 @@ void a2_video_device::plot_text_character(bitmap_ind16 &bitmap, int xpos, int yp void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -256,9 +247,8 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -267,24 +257,23 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i if ((code >= 0x60) && (code <= 0x7f)) { code |= 0x80; // map to lowercase normal - i = fg; // and flip the color - fg = bg; - bg = i; + using std::swap;// and flip the color + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (x+1))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (x+1))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -293,38 +282,32 @@ void a2_video_device::plot_text_character_dodo(bitmap_ind16 &bitmap, int xpos, i void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } else if (code < 0x40) // inverse: flip FG and BG { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -333,25 +316,19 @@ void a2_video_device::plot_text_character_orig(bitmap_ind16 &bitmap, int xpos, i void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { code &= 0x3f; if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } else if (code < 0x40) // inverse: flip FG and BG { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } if (m_an2) @@ -360,17 +337,17 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << (6-x))) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << (6-x))) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -379,32 +356,27 @@ void a2_video_device::plot_text_character_jplus(bitmap_ind16 &bitmap, int xpos, void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if ((code >= 0x40) && (code <= 0x7f)) { if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 1; x < 8; x++) + for (int x = 1; x < 8; x++) { - color = (chardata[y] & (1 << x)) ? fg : bg; + uint16_t const color = (chardata[y] & (1 << x)) ? fg : bg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + ((x-1) * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + ((x-1) * xscale) + i) = color; } } } @@ -413,10 +385,6 @@ void a2_video_device::plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, i void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg) { - int x, y, i; - const uint8_t *chardata; - uint16_t color; - if (!m_altcharset) { if ((code >= 0x40) && (code <= 0x7f)) @@ -425,9 +393,8 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int if (m_flash) { - i = fg; - fg = bg; - bg = i; + using std::swap; + swap(fg, bg); } } } @@ -437,17 +404,17 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int } /* look up the character data */ - chardata = &textgfx_data[(code * 8)]; + uint8_t const *const chardata = &textgfx_data[(code * 8)]; - for (y = 0; y < 8; y++) + for (int y = 0; y < 8; y++) { - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { - color = (chardata[y] & (1 << x)) ? bg : fg; + uint16_t const color = (chardata[y] & (1 << x)) ? bg : fg; - for (i = 0; i < xscale; i++) + for (int i = 0; i < xscale; i++) { - bitmap.pix16(ypos + y, xpos + (x * xscale) + i) = color; + bitmap.pix(ypos + y, xpos + (x * xscale) + i) = color; } } } @@ -455,10 +422,7 @@ void a2_video_device::plot_text_characterGS(bitmap_ind16 &bitmap, int xpos, int void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, y, x; - uint8_t code; - uint32_t start_address = m_page2 ? 0x0800 : 0x0400; - uint32_t address; + uint32_t const start_address = m_page2 ? 0x0800 : 0x0400; int fg = 0; switch (m_sysconfig & 0x03) @@ -475,34 +439,34 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, if (!(m_sysconfig & 0x03)) { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; + uint8_t const code = m_ram_ptr[address]; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { - bitmap.pix16(row + y, col * 14 + x) = (code >> 0) & 0x0F; + bitmap.pix(row + y, col * 14 + x) = (code >> 0) & 0x0F; } } } - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { - bitmap.pix16(row + y, col * 14 + x) = (code >> 4) & 0x0F; + bitmap.pix(row + y, col * 14 + x) = (code >> 4) & 0x0F; } } } @@ -511,58 +475,58 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, } else { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { uint8_t bits; /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; + uint8_t const code = m_ram_ptr[address]; bits = (code >> 0) & 0x0F; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { if (col & 1) { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; } else { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; } } } } bits = (code >> 4) & 0x0F; - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { if ((row + y) <= endrow) { - for (x = 0; x < 14; x++) + for (int x = 0; x < 14; x++) { if (col & 1) { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << ((x+2) % 4)) ? fg : 0; } else { - bitmap.pix16(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; + bitmap.pix(row + y, col * 14 + x) = bits & (1 << (x % 4)) ? fg : 0; } } } } - if (row == 64) printf("\n"); + //if (row == 64) printf("\n"); } } @@ -571,10 +535,7 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col, y; - uint8_t code, auxcode; - uint32_t start_address = m_page2 ? 0x0800 : 0x0400; - uint32_t address; + uint32_t const start_address = m_page2 ? 0x0800 : 0x0400; static const int aux_colors[16] = { 0, 2, 4, 6, 8, 0xa, 0xc, 0xe, 1, 3, 5, 7, 9, 0xb, 0xd, 0xf }; int fg = 0; @@ -592,21 +553,21 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, if (!(m_sysconfig & 0x03)) { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; + uint8_t const code = m_ram_ptr[address]; + uint8_t const auxcode = m_aux_ptr[address]; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; *vram++ = aux_colors[(auxcode >> 0) & 0x0F]; @@ -623,9 +584,9 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, *vram++ = (code >> 0) & 0x0F; *vram++ = (code >> 0) & 0x0F; } - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; *vram++ = aux_colors[(auxcode >> 4) & 0x0F]; @@ -647,26 +608,26 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, } else { - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { uint8_t bits, abits; /* calculate adderss */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); /* perform the lookup */ - code = m_ram_ptr[address]; - auxcode = m_aux_ptr[address]; + uint8_t const code = m_ram_ptr[address]; + uint8_t const auxcode = m_aux_ptr[address]; bits = (code >> 0) & 0x0F; abits = (auxcode >> 0) & 0x0F; /* and now draw */ - for (y = 0; y < 4; y++) + for (int y = 0; y < 4; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); if (col & 1) { @@ -707,9 +668,9 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, bits = (code >> 4) & 0x0F; abits = (auxcode >> 4) & 0x0F; - for (y = 4; y < 8; y++) + for (int y = 4; y < 8; y++) { - uint16_t *vram = &bitmap.pix16(row + y, (col * 14)); + uint16_t *vram = &bitmap.pix(row + y, (col * 14)); if (col & 1) { @@ -753,30 +714,15 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - int row, col; - uint32_t start_address; - uint32_t address; - uint8_t *aux_page = m_ram_ptr; - int fg = 0; - int bg = 0; + uint8_t const *const aux_page = m_aux_ptr ? m_aux_ptr : m_ram_ptr; - if (m_aux_ptr) - { - aux_page = m_aux_ptr; - } - - if (m_80col) - { - start_address = 0x400; - } - else - { - start_address = m_page2 ? 0x800 : 0x400; - } + uint32_t const start_address = m_80col ? 0x400 : m_page2 ? 0x800 : 0x400; beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); + int fg = 0; + int bg = 0; switch (m_sysconfig & 0x03) { case 0: case 4: fg = WHITE; break; @@ -785,14 +731,14 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c case 3: fg = ORANGE; break; } - for (row = beginrow; row <= endrow; row += 8) + for (int row = beginrow; row <= endrow; row += 8) { if (m_80col) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); plot_text_character(bitmap, col * 14, row, 1, aux_page[address], m_char_ptr, m_char_size, fg, bg); @@ -802,10 +748,10 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { /* calculate address */ - address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); + uint32_t const address = start_address + ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)); if (((m_sysconfig & 7) == 4) && (m_dhires)) { u8 tmp = aux_page[address]; @@ -977,14 +923,6 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; int mon_type = m_sysconfig & 0x03; int begincol = 0, endcol = 40; @@ -1008,28 +946,30 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co //printf("HGR draw: page %c, rows %d-%d cols %d-%d\n", m_page2 ? '2' : '1', beginrow, endrow, begincol, endcol); - vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; + uint8_t const *const vram = &m_ram_ptr[(m_page2 ? 0x4000 : 0x2000)]; + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = begincol; col < endcol; col++) + for (int col = begincol; col < endcol; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); // verified on h/w: setting dhires w/o 80col emulates a rev. 0 Apple ][ with no orange/blue + uint16_t const *artifact_map_ptr; if (m_dhires) { artifact_map_ptr = m_hires_artifact_map.get(); @@ -1054,9 +994,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co switch (mon_type) { case 0: - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -1068,9 +1008,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? WHITE : BLACK; *(p++) = v ? WHITE : BLACK; @@ -1087,9 +1027,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? GREEN : BLACK; *(p++) = v ? GREEN : BLACK; @@ -1106,9 +1046,9 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co { p++; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? ORANGE : BLACK; *(p++) = v ? ORANGE : BLACK; @@ -1126,15 +1066,7 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co // similar to regular A2 except page 2 is at $A000 void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram; - int row, col, b; - int offset; - uint8_t vram_row[42]; - uint16_t v; - uint16_t *p; - uint32_t w; - uint16_t *artifact_map_ptr; - int mon_type = m_sysconfig & 0x03; + int const mon_type = m_sysconfig & 0x03; /* sanity checks */ if (beginrow < cliprect.top()) @@ -1144,34 +1076,36 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit if (endrow < beginrow) return; - vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + uint8_t const *const vram = &m_ram_ptr[(m_page2 ? 0xa000 : 0x2000)]; + uint8_t vram_row[42]; vram_row[0] = 0; vram_row[41] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+col] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint16_t const *artifact_map_ptr; switch (mon_type) { case 0: artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; + uint16_t const v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; *(p++) = v; *(p++) = v; } @@ -1183,9 +1117,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? WHITE : BLACK; *(p++) = v ? WHITE : BLACK; @@ -1202,9 +1136,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? GREEN : BLACK; *(p++) = v ? GREEN : BLACK; @@ -1221,9 +1155,9 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit { p--; } - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { - v = (w & 1); + uint16_t const v = (w & 1); w >>= 1; *(p++) = v ? ORANGE : BLACK; *(p++) = v ? ORANGE : BLACK; @@ -1240,17 +1174,11 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow) { - const uint8_t *vram, *vaux; - int row, col, b; - int offset; - uint8_t vram_row[82]; uint16_t v; - uint16_t *p; - uint32_t w; - int page = m_page2 ? 0x4000 : 0x2000; + int const page = m_page2 ? 0x4000 : 0x2000; int mon_type = m_sysconfig & 0x03; - bool bIsRGB = ((m_sysconfig & 7) == 4); - bool bIsRGBMixed = ((bIsRGB) && (m_rgbmode == 1)); + bool const bIsRGB = ((m_sysconfig & 7) == 4); + bool const bIsRGBMixed = ((bIsRGB) && (m_rgbmode == 1)); // IIgs force-monochrome-DHR setting if (m_newvideo & 0x20) @@ -1272,30 +1200,23 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (endrow < beginrow) return; - vram = &m_ram_ptr[page]; - if (m_aux_ptr) - { - vaux = m_aux_ptr; - } - else - { - vaux = vram; - } - vaux += page; + uint8_t const *const vram = &m_ram_ptr[page]; + uint8_t const *const vaux = (m_aux_ptr ? m_aux_ptr : vram) + page; + uint8_t vram_row[82]; vram_row[0] = 0; vram_row[81] = 0; - for (row = beginrow; row <= endrow; row++) + for (int row = beginrow; row <= endrow; row++) { - for (col = 0; col < 40; col++) + for (int col = 0; col < 40; col++) { - offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); + int const offset = ((((row/8) & 0x07) << 7) | (((row/8) & 0x18) * 5 + col)) | ((row & 7) << 10); vram_row[1+(col*2)+0] = vaux[offset]; vram_row[1+(col*2)+1] = vram[offset]; } - p = &bitmap.pix16(row); + uint16_t *p = &bitmap.pix(row); // RGB DHR 160-wide mode if ((bIsRGB) && (m_rgbmode == 2)) @@ -1303,11 +1224,11 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c mon_type = 4; } - for (col = 0; col < 80; col++) + for (int col = 0; col < 80; col++) { - w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) - | (((uint32_t) vram_row[col+1] & 0x7f) << 7) - | (((uint32_t) vram_row[col+2] & 0x7f) << 14); + uint32_t w = (((uint32_t) vram_row[col+0] & 0x7f) << 0) + | (((uint32_t) vram_row[col+1] & 0x7f) << 7) + | (((uint32_t) vram_row[col+2] & 0x7f) << 14); /* DHGR pixel layout: @@ -1333,7 +1254,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!(vram_row[col-1] & 0x80)) { - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { v = (tw & 1); tw >>= 1; @@ -1342,7 +1263,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 0; b < 4; b++) + for (int b = 0; b < 4; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1351,7 +1272,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (!(vram_row[col] & 0x80)) { - for (b = 4; b < 7; b++) + for (int b = 4; b < 7; b++) { v = (tw & 1); tw >>= 1; @@ -1360,7 +1281,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 4; b < 7; b++) + for (int b = 4; b < 7; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1372,7 +1293,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if ((bIsRGBMixed) && !(vram_row[col] & 0x80)) { uint32_t tw = (w >> 6); - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (tw & 1); tw >>= 1; @@ -1381,7 +1302,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c } else { - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; @@ -1392,7 +1313,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 1: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1402,7 +1323,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 2: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1412,7 +1333,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c case 3: w >>= 6; - for (b = 0; b < 7; b++) + for (int b = 0; b < 7; b++) { v = (w & 1); w >>= 1; @@ -1426,7 +1347,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c { // Center the 480-wide image in the 560-wide display. // Aspect ratio won't be perfect, but it's in range. - for (b = 0; b < 40; b++) + for (int b = 0; b < 40; b++) { *(p++) = BLACK; } @@ -1445,7 +1366,7 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c if (mon_type == 4) { - for (b = 0; b < 40; b++) + for (int b = 0; b < 40; b++) { *(p++) = BLACK; } @@ -1490,15 +1411,7 @@ uint32_t a2_video_device::palette_entries() const uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const uint8_t *vram; - uint32_t *scanline; - uint8_t scb, b; - int col, palette; - uint32_t last_pixel = 0, pixel; - int beamy; - uint16_t *a2pixel; - - beamy = cliprect.top(); + int const beamy = cliprect.top(); if (m_newvideo & 0x80) { @@ -1511,24 +1424,24 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & return 0; } - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + uint32_t *const scanline = &bitmap.pix(beamy); + for (int col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; } } else // regular screen area { - int shrline = beamy - BORDER_TOP; + int const shrline = beamy - BORDER_TOP; - scb = m_aux_ptr[0x9D00 + shrline]; - palette = ((scb & 0x0f) << 4); + uint8_t const scb = m_aux_ptr[0x9D00 + shrline]; + int const palette = ((scb & 0x0f) << 4); - vram = &m_aux_ptr[0x2000 + (shrline * 160)]; - scanline = &bitmap.pix32(beamy); + uint8_t const *const vram = &m_aux_ptr[0x2000 + (shrline * 160)]; + uint32_t *const scanline = &bitmap.pix(beamy); // draw left and right borders - for (col = 0; col < BORDER_LEFT; col++) + for (int col = 0; col < BORDER_LEFT; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; scanline[col+BORDER_LEFT+640] = m_GSborder_colors[m_GSborder]; @@ -1536,9 +1449,9 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & if (scb & 0x80) // 640 mode { - for (col = 0; col < 160; col++) + for (int col = 0; col < 160; col++) { - b = vram[col]; + uint8_t const b = vram[col]; scanline[col * 4 + 0 + BORDER_LEFT] = m_shr_palette[palette + 0 + ((b >> 6) & 0x03)]; scanline[col * 4 + 1 + BORDER_LEFT] = m_shr_palette[palette + 4 + ((b >> 4) & 0x03)]; scanline[col * 4 + 2 + BORDER_LEFT] = m_shr_palette[palette + 8 + ((b >> 2) & 0x03)]; @@ -1555,9 +1468,12 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, }; - last_pixel = fillmode_init[scb & 0x1f]; - for (col = 0; col < 160; col++) + uint32_t last_pixel = fillmode_init[scb & 0x1f]; + for (int col = 0; col < 160; col++) { + uint8_t b; + uint32_t pixel; + b = vram[col]; pixel = (b >> 4) & 0x0f; @@ -1588,7 +1504,7 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & /* call legacy Apple II video rendering at scanline 0 to draw into the off-screen buffer */ if (beamy == 0) { - rectangle new_cliprect(0, 559, 0, 191); + rectangle const new_cliprect(0, 559, 0, 191); screen_update_GS_8bit(screen, *m_8bit_graphics, new_cliprect); } @@ -1599,24 +1515,24 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & return 0; } - scanline = &bitmap.pix32(beamy); - for (col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) + uint32_t *const scanline = &bitmap.pix(beamy); + for (int col = 0; col < BORDER_LEFT+BORDER_RIGHT+640; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; } } else { - scanline = &bitmap.pix32(beamy); + uint32_t *const scanline = &bitmap.pix(beamy); // draw left and right borders - for (col = 0; col < BORDER_LEFT + 40; col++) + for (int col = 0; col < BORDER_LEFT + 40; col++) { scanline[col] = m_GSborder_colors[m_GSborder]; scanline[col+BORDER_LEFT+600] = m_GSborder_colors[m_GSborder]; } - a2pixel = &m_8bit_graphics->pix16(beamy-(BORDER_TOP+4)); + uint16_t *a2pixel = &m_8bit_graphics->pix(beamy-(BORDER_TOP+4)); for (int x = 0; x < 560; x++) { scanline[40 + BORDER_LEFT + x] = m_GSborder_colors[*a2pixel++]; diff --git a/src/mame/video/apple3.cpp b/src/mame/video/apple3.cpp index 5eba4a46a4b..940531d5a72 100644 --- a/src/mame/video/apple3.cpp +++ b/src/mame/video/apple3.cpp @@ -138,26 +138,21 @@ void apple3_state::video_start() void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, col, row, lc; - offs_t offset; - uint8_t ch; - const uint8_t *char_data; - pen_t fg, bg, temp; - uint16_t *dest; - uint8_t *ram = m_ram->pointer(); - uint32_t ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; - int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; - - for (y = beginrow; y <= endrow; y++) + uint8_t const *const ram = m_ram->pointer(); + uint32_t const ram_size = m_ram->size(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + int const beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int const endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; + + for (int y = beginrow; y <= endrow; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); - ch = ram[offset]; + offs_t offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); + uint8_t const ch = ram[offset]; // no color text in emulation mode + pen_t fg, bg; if ((m_flags & VAR_VM0) && (m_via_1_a & 0x40)) { /* color text */ @@ -175,17 +170,17 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) /* inverse? */ if (!(ch & 0x80)) { - temp = fg; - fg = bg; - bg = temp; + using std::swap; + swap(fg, bg); } - char_data = &m_char_mem[(ch & 0x7F) * 8]; + uint8_t const *const char_data = &m_char_mem[(ch & 0x7F) * 8]; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { + int lc; if (m_smoothscr) { // get the offset into the group of 8 lines @@ -196,7 +191,7 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) lc = col; } - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc * 2); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + lc * 2); dest[0] = (char_data[row] & (1 << col)) ? fg : bg; dest[1] = (char_data[row] & (1 << col)) ? fg : bg; } @@ -209,23 +204,20 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, col, row, lc; - offs_t offset; - uint8_t ch; - const uint8_t *char_data; - pen_t fg, bg; - uint16_t *dest; - uint8_t *ram = m_ram->pointer(); - uint32_t ram_size = m_ram->size(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; - int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; - - for (y = beginrow; y <= endrow; y++) + uint8_t const *const ram = m_ram->pointer(); + uint32_t const ram_size = m_ram->size(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + int const beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int const endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; + + for (int y = beginrow; y <= endrow; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x; + offs_t const offset = ram_size - 0x8000 + text_map[y] + x; + uint8_t ch; + uint8_t const *char_data; + pen_t fg, bg; /* first character */ ch = ram[offset + 0x0000]; @@ -233,10 +225,11 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { + int lc; if (m_smoothscr) { // get the offset into the group of 8 lines @@ -247,7 +240,7 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) lc = col; } - dest = &bitmap.pix16(y * 8 + row, x * 14 + lc + 0); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + lc + 0); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -258,11 +251,11 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; - for (row = 0; row < 8; row++) + for (int row = 0; row < 8; row++) { - for (col = 0; col < 7; col++) + for (int col = 0; col < 7; col++) { - dest = &bitmap.pix16(y * 8 + row, x * 14 + col + 7); + uint16_t *const dest = &bitmap.pix(y * 8 + row, x * 14 + col + 7); *dest = (char_data[row] & (1 << col)) ? fg : bg; } } @@ -275,37 +268,34 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* hi-res mode: 280x192x2 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info; - uint16_t *ptr; - uint8_t b; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info; if (m_flags & VAR_VM2) pix_info = &ram[m_hgr_map[ly]]; else pix_info = &ram[m_hgr_map[ly] - 0x2000]; - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - b = *(pix_info++); + uint8_t b = *(pix_info++); - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { ptr[0] = ptr[1] = (b & 0x01) ? WHITE : BLACK; ptr += 2; @@ -318,28 +308,24 @@ void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* color hi-res mode: 280x192x16 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info; - const uint8_t *col_info; - uint16_t *ptr; - uint8_t b; - uint16_t fgcolor, bgcolor; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info; + uint8_t const *col_info; if (m_flags & VAR_VM2) { pix_info = &ram[m_hgr_map[ly] + 0x2000]; @@ -350,16 +336,16 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect pix_info = &ram[m_hgr_map[ly] - 0x2000]; col_info = &ram[m_hgr_map[ly]]; } - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - bgcolor = ((*col_info >> 0) & 0x0F) + 16; - fgcolor = ((*col_info >> 4) & 0x0F) + 16; + uint16_t const bgcolor = ((*col_info >> 0) & 0x0F) + 16; + uint16_t const fgcolor = ((*col_info >> 4) & 0x0F) + 16; - b = *pix_info; + uint8_t b = *pix_info; - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { ptr[0] = ptr[1] = (b & 1) ? fgcolor : bgcolor; ptr += 2; @@ -376,27 +362,24 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* super hi-res mode: 560x192x2 */ - int y, i, x, ly, lyb; - const uint8_t *pix_info1; - const uint8_t *pix_info2; - uint16_t *ptr; - uint8_t b1, b2; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); + + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } + uint8_t const *pix_info1; + uint8_t const *pix_info2; if (m_flags & VAR_VM2) { pix_info1 = &ram[m_hgr_map[ly] + 0x2000]; @@ -407,20 +390,20 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect pix_info1 = &ram[m_hgr_map[ly] - 0x2000]; pix_info2 = &ram[m_hgr_map[ly]]; } - ptr = &bitmap.pix16(y); + uint16_t *ptr = &bitmap.pix(y); - for (i = 0; i < 40; i++) + for (int i = 0; i < 40; i++) { - b1 = *(pix_info1++); - b2 = *(pix_info2++); + uint8_t b1 = *(pix_info1++); + uint8_t b2 = *(pix_info2++); - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { *(ptr++) = (b1 & 0x01) ? WHITE : BLACK; b1 >>= 1; } - for (x = 0; x < 7; x++) + for (int x = 0; x < 7; x++) { *(ptr++) = (b2 & 0x01) ? WHITE : BLACK; b2 >>= 1; @@ -433,28 +416,26 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect void apple3_state::graphics_chires(bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *pen; - uint8_t p1, p2, p3, p4; - int y, i, ly, lyb; - uint8_t *ram = m_ram->pointer(); - int smooth = m_va | (m_vb << 1) | (m_vc << 2); + uint8_t const *const ram = m_ram->pointer(); + int const smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - ly = y; + int ly = y; if (m_smoothscr) { // get our base Y position ly = y & ~7; // get the offset into the group of 8 lines - lyb = ((y % 8) + smooth) & 7; + int const lyb = ((y % 8) + smooth) & 7; // add to the base ly += lyb; } - pen = &bitmap.pix16(y); - for (i = 0; i < 20; i++) + uint16_t *pen = &bitmap.pix(y); + for (int i = 0; i < 20; i++) { + uint8_t p1, p2, p3, p4; if (m_flags & VAR_VM2) { p1 = ram[m_hgr_map[ly] + 0x2000 + (i * 2) + 0]; diff --git a/src/mame/video/arcadecl.cpp b/src/mame/video/arcadecl.cpp index 446ebb928a5..aa8ec654940 100644 --- a/src/mame/video/arcadecl.cpp +++ b/src/mame/video/arcadecl.cpp @@ -80,8 +80,8 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -107,12 +107,12 @@ uint32_t sparkz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { const uint16_t *const src = &m_bitmap[256 * y]; - uint16_t *const dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* regenerate the line */ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { - int bits = src[(x - 8) / 2]; + int const bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; dst[x + 1] = bits & 0xff; } diff --git a/src/mame/video/arcadia.cpp b/src/mame/video/arcadia.cpp index 491d30d9556..8940bdbc8ae 100644 --- a/src/mame/video/arcadia.cpp +++ b/src/mame/video/arcadia.cpp @@ -584,7 +584,7 @@ void arcadia_state::draw_sprites() for (j=0,m=0x80; j<8; j++, m>>=1) { if (b & m) - m_bitmap->pix16(y, x + j) = color; + m_bitmap->pix(y, x + j) = color; } } else @@ -594,8 +594,8 @@ void arcadia_state::draw_sprites() { if (b & m) { - m_bitmap->pix16(y, x + j) = color; - m_bitmap->pix16(y+1, x + j) = color; + m_bitmap->pix(y, x + j) = color; + m_bitmap->pix(y+1, x + j) = color; } } } diff --git a/src/mame/video/argus.cpp b/src/mame/video/argus.cpp index 023c5f2bf8b..443f6f5d0a2 100644 --- a/src/mame/video/argus.cpp +++ b/src/mame/video/argus.cpp @@ -719,36 +719,30 @@ void valtric_state::draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con else { m_bg_tilemap[1]->draw(screen, m_mosaicbitmap, cliprect, 0, 0); - { - int step=m_mosaic; - u32 *dest; - int x,y,xx,yy,c=0; - int width = screen.width(); - int height = screen.height(); + int step=m_mosaic; + int c=0; + int width = screen.width(); + int height = screen.height(); - if (m_mosaic<0)step*=-1; + if (m_mosaic<0)step*=-1; - for (y=0;y<width+step;y+=step) - for (x=0;x<height+step;x+=step) - { - if (y < height && x < width) - c=m_mosaicbitmap.pix32(y, x); - - if (m_mosaic<0) - if (y+step-1<height && x+step-1< width) - c = m_mosaicbitmap.pix32(y+step-1, x+step-1); - - for (yy=0;yy<step;yy++) - for (xx=0;xx<step;xx++) - { - if (xx+x < width && yy+y<height) - { - dest=&bitmap.pix32(y+yy, x+xx); - *dest=c; - } - } - } - } + for (int y=0;y<width+step;y+=step) + for (int x=0;x<height+step;x+=step) + { + if (y < height && x < width) + c=m_mosaicbitmap.pix(y, x); + + if (m_mosaic<0) + if (y+step-1<height && x+step-1< width) + c = m_mosaicbitmap.pix(y+step-1, x+step-1); + + for (int yy=0;yy<step;yy++) + for (int xx=0;xx<step;xx++) + { + if (xx+x < width && yy+y<height) + bitmap.pix(y+yy, x+xx) = c; + } + } } } #else @@ -761,33 +755,27 @@ void valtric_state::draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, con else { m_bg_tilemap[1]->draw(screen, m_mosaicbitmap, cliprect, 0, 0); - { - u32 *dest; - int x,y,xx,yy,c=0; - int width = screen.width(); - int height = screen.height(); + int c=0; + int width = screen.width(); + int height = screen.height(); - for (y = 0; y < width+step; y += step) - for (x = 0; x < height+step; x += step) - { - if (y < height && x < width) - c = m_mosaicbitmap.pix32(y, x); - - if (m_valtric_mosaic & 0x80) - if (y+step-1 < height && x+step-1 < width) - c = m_mosaicbitmap.pix32(y+step-1, x+step-1); - - for (yy = 0; yy < step; yy++) - for (xx = 0; xx < step; xx++) - { - if (xx+x < width && yy+y < height) - { - dest = &bitmap.pix32(y+yy, x+xx); - *dest = c; - } - } - } - } + for (int y = 0; y < width+step; y += step) + for (int x = 0; x < height+step; x += step) + { + if (y < height && x < width) + c = m_mosaicbitmap.pix(y, x); + + if (m_valtric_mosaic & 0x80) + if (y+step-1 < height && x+step-1 < width) + c = m_mosaicbitmap.pix(y+step-1, x+step-1); + + for (int yy = 0; yy < step; yy++) + for (int xx = 0; xx < step; xx++) + { + if (xx+x < width && yy+y < height) + bitmap.pix(y+yy, x+xx) = c; + } + } } } #endif diff --git a/src/mame/video/armedf.cpp b/src/mame/video/armedf.cpp index 45a9b36f1f8..11995cb029e 100644 --- a/src/mame/video/armedf.cpp +++ b/src/mame/video/armedf.cpp @@ -281,28 +281,24 @@ void armedf_state::armedf_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,g if (ex > sx) { /* skip if inner loop doesn't draw anything */ - int x, y; - + for (int y = sy; y < ey; y++) { - for (y = sy; y < ey; y++) + u8 const *const source = source_base + y_index*gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const destpri = &primap.pix(y); + int x_index = x_index_base; + for (int x = sx; x < ex; x++) { - const u8 *source = source_base + y_index*gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *destpri = &primap.pix8(y); - int x_index = x_index_base; - for (x = sx; x < ex; x++) + int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); + if (c != transparent_color) { - int c = (source[x_index] & ~0xf) | ((m_spr_pal_clut[clut*0x10+(source[x_index] & 0xf)]) & 0xf); - if (c != transparent_color) - { - if (((1 << (destpri[x] & 0x1f)) & pmask) == 0) - dest[x] = pal[c]; - destpri[x] = 0x1f; - } - x_index += xinc; + if (((1 << (destpri[x] & 0x1f)) & pmask) == 0) + dest[x] = pal[c]; + destpri[x] = 0x1f; } - y_index += yinc; + x_index += xinc; } + y_index += yinc; } } } diff --git a/src/mame/video/artmagic.cpp b/src/mame/video/artmagic.cpp index 1060e828688..0fede06b4a5 100644 --- a/src/mame/video/artmagic.cpp +++ b/src/mame/video/artmagic.cpp @@ -334,13 +334,12 @@ void artmagic_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) TMS340X0_SCANLINE_RGB32_CB_MEMBER(artmagic_state::scanline) { offs_t offset = (params->rowaddr << 12) & 0x7ff000; - uint16_t *vram = address_to_vram(&offset); - uint32_t *dest = &bitmap.pix32(scanline); - const pen_t *pens = m_tlc34076->pens(); + uint16_t const *vram = address_to_vram(&offset); + uint32_t *const dest = &bitmap.pix(scanline); + pen_t const *const pens = m_tlc34076->pens(); int coladdr = params->coladdr << 1; - int x; vram += offset; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = pens[vram[coladdr++ & 0x1ff] & 0xff]; } diff --git a/src/mame/video/astrocde.cpp b/src/mame/video/astrocde.cpp index 43bb3cb1a97..d89d431a2e6 100644 --- a/src/mame/video/astrocde.cpp +++ b/src/mame/video/astrocde.cpp @@ -256,11 +256,10 @@ void astrocde_state::init_savestate() uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; + uint8_t const *const videoram = m_videoram; uint32_t sparklebase = 0; const int colormask = (m_video_config & AC_MONITOR_BW) ? 0 : 0x1f0; int xystep = 2 - m_video_mode; - int y; /* compute the starting point of sparkle for the current frame */ int width = screen.width(); @@ -270,13 +269,12 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in sparklebase = (screen.frame_number() * (uint64_t)(width * height)) % RNG_PERIOD; /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); int effy = mame_vpos_to_astrocade_vpos(y); uint16_t offset = (effy / xystep) * (80 / xystep); uint32_t sparkleoffs = 0, staroffs = 0; - int x; /* compute the star and sparkle offset at the start of this line */ if (m_video_config & AC_STARS) @@ -288,23 +286,20 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in } /* iterate over groups of 4 pixels */ - for (x = 0; x < 456/4; x += xystep) + for (int x = 0; x < 456/4; x += xystep) { int effx = x - HORZ_OFFSET/4; const uint8_t *colorbase = &m_colors[(effx < m_colorsplit) ? 4 : 0]; - uint8_t data; - int xx; /* select either video data or background data */ - data = (effx >= 0 && effx < 80 && effy >= 0 && effy < m_vblank) ? videoram[offset++] : m_bgdata; + uint8_t data = (effx >= 0 && effx < 80 && effy >= 0 && effy < m_vblank) ? videoram[offset++] : m_bgdata; /* iterate over the 4 pixels */ - for (xx = 0; xx < 4; xx++) + for (int xx = 0; xx < 4; xx++) { uint8_t pixdata = (data >> 6) & 3; int colordata = colorbase[pixdata] << 1; int luma = colordata & 0x0f; - rgb_t color; /* handle stars/sparkle */ if (m_video_config & AC_STARS) @@ -324,7 +319,7 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in if (++sparkleoffs >= RNG_PERIOD) sparkleoffs = 0; } - color = (colordata & colormask) | luma; + rgb_t const color = (colordata & colormask) | luma; /* store the final color to the destination and shift */ *dest++ = color; @@ -341,20 +336,17 @@ uint32_t astrocde_state::screen_update_astrocde(screen_device &screen, bitmap_in uint32_t astrocde_state::screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = mame_vpos_to_astrocade_vpos(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); uint16_t offset = m_profpac_vispage * 0x4000 + effy * 80; - int x; /* star with black */ /* iterate over groups of 4 pixels */ - for (x = 0; x < 456/4; x++) + for (int x = 0; x < 456/4; x++) { int effx = x - HORZ_OFFSET/4; diff --git a/src/mame/video/atarig42.cpp b/src/mame/video/atarig42.cpp index b3b8b197ba5..67a50a0478b 100644 --- a/src/mame/video/atarig42.cpp +++ b/src/mame/video/atarig42.cpp @@ -174,23 +174,22 @@ uint32_t atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.left(); - int top = cliprect.top(); - int right = cliprect.right() + 1; - int bottom = cliprect.bottom() + 1; - int x, y; + int const left = cliprect.left(); + int const top = cliprect.top(); + int const right = cliprect.right() + 1; + int const bottom = cliprect.bottom() + 1; /* now blend with the playfield */ - for (y = top; y < bottom; y++) + for (int y = top; y < bottom; y++) { - uint16_t *pf = &bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); - for (x = left; x < right; x++) + uint16_t *const pf = &bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); + for (int x = left; x < right; x++) if (mo[x]) { - int pfpri = pri[x]; - int mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; + int const pfpri = pri[x]; + int const mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; if (mopri >= pfpri) pf[x] = mo[x] & ATARIRLE_DATA_MASK; } diff --git a/src/mame/video/atarigt.cpp b/src/mame/video/atarigt.cpp index 711b792ec6d..490e5376ad2 100644 --- a/src/mame/video/atarigt.cpp +++ b/src/mame/video/atarigt.cpp @@ -486,9 +486,6 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 { bitmap_ind16 &mo_bitmap = m_rle->vram(0); bitmap_ind16 &tm_bitmap = m_rle->vram(1); - uint16_t *cram, *tram; - int color_latch; - int x, y; /* draw the playfield */ m_playfield_tilemap->draw(screen, m_pf_bitmap, cliprect, 0, 0); @@ -497,32 +494,31 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 m_alpha_tilemap->draw(screen, m_an_bitmap, cliprect, 0, 0); /* cache pointers */ - color_latch = m_colorram[0x30000>>1]; - cram = (uint16_t *)&m_colorram[0x00000>>1] + ((color_latch & 0x08) << 10); - tram = (uint16_t *)&m_colorram[0x20000>>1] + ((color_latch & 0x30) << 8); - const pen_t *mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; + int const color_latch = m_colorram[0x30000>>1]; + uint16_t const *const cram = (uint16_t *)&m_colorram[0x00000>>1] + ((color_latch & 0x08) << 10); + uint16_t const *const tram = (uint16_t *)&m_colorram[0x20000>>1] + ((color_latch & 0x30) << 8); + pen_t const *const mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; /* now do the nasty blend */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *an = &m_an_bitmap.pix16(y); - uint16_t *pf = &m_pf_bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint16_t *tm = &tm_bitmap.pix16(y); - uint32_t *dst = &bitmap.pix32(y); + uint16_t const *const an = &m_an_bitmap.pix(y); + uint16_t const *const pf = &m_pf_bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint16_t const *const tm = &tm_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y); /* Primal Rage: no TRAM, slightly different priorities */ if (m_is_primrage) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pfpri = (pf[x] >> 10) & 7; uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; uint8_t mgep = (mopri >= pfpri) && !(pfpri & 4); - uint16_t cra; - uint32_t rgb; /* compute CRA -- unlike T-Mek, MVID11 enforces MO priority and is ignored */ + uint16_t cra; if (an[x] & 0x8f) cra = an[x] & 0xff; else if ((mo[x] & 0x3f) && ((mo[x] & 0x800) || mgep || !(pf[x] & 0x3f))) @@ -532,6 +528,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 cra = cram[cra]; /* compute the result */ + uint32_t rgb; rgb = mram[((cra >> 10) & 0x01f)] & 0xff0000; rgb |= mram[((cra >> 5) & 0x01f)] & 0x00ff00; rgb |= mram[((cra >> 0) & 0x01f)] & 0x0000ff; @@ -548,16 +545,14 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 /* T-Mek: full TRAM and all effects */ else { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint8_t pfpri = (pf[x] >> 10) & 7; - uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; - uint8_t mgep = (mopri >= pfpri) && !(pfpri & 4); - int no_tra = 0, no_cra = 0; - uint16_t cra, tra, mra; - uint32_t rgb; + uint8_t const pfpri = (pf[x] >> 10) & 7; + uint8_t const mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; + uint8_t const mgep = (mopri >= pfpri) && !(pfpri & 4); /* compute CRA/TRA */ + uint16_t cra, tra; if (an[x] & 0x8f) { cra = an[x] & 0xff; @@ -577,9 +572,10 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 tra = tram[tra]; /* compute MRA */ - mra = (tm[x] & 0xe00) << 1; + uint16_t const mra = (tm[x] & 0xe00) << 1; /* turn off CRA/TRA as appropriate */ + int no_tra = 0, no_cra = 0; if (!(pf[x] & 0x1000) && (tra & 0x8000)) no_cra = 1; if (!(!(cra & 0x8000) && (!(pf[x] & 0x1000) || !(pf[x] & 0x3f)))) @@ -590,6 +586,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 tra = 0; /* compute the result */ + uint32_t rgb; rgb = mram[mra | ((cra >> 10) & 0x01f) | ((tra >> 5) & 0x3e0)] & 0xff0000; rgb |= mram[mra | ((cra >> 5) & 0x01f) | ((tra >> 0) & 0x3e0)] & 0x00ff00; rgb |= mram[mra | ((cra >> 0) & 0x01f) | ((tra << 5) & 0x3e0)] & 0x0000ff; diff --git a/src/mame/video/atarigx2.cpp b/src/mame/video/atarigx2.cpp index 870fbbe9b42..c376ac43112 100644 --- a/src/mame/video/atarigx2.cpp +++ b/src/mame/video/atarigx2.cpp @@ -182,19 +182,18 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.left(); - int top = cliprect.top(); - int right = cliprect.right() + 1; - int bottom = cliprect.bottom() + 1; - int x, y; + int const left = cliprect.left(); + int const top = cliprect.top(); + int const right = cliprect.right() + 1; + int const bottom = cliprect.bottom() + 1; /* now blend with the playfield */ - for (y = top; y < bottom; y++) + for (int y = top; y < bottom; y++) { - uint16_t *pf = &bitmap.pix16(y); - uint16_t *mo = &mo_bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); - for (x = left; x < right; x++) + uint16_t *const pf = &bitmap.pix(y); + uint16_t const *const mo = &mo_bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); + for (int x = left; x < right; x++) if (mo[x] && (mo[x] >> ATARIRLE_PRIORITY_SHIFT) >= pri[x]) pf[x] = mo[x] & ATARIRLE_DATA_MASK; } diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp index 3db58a6d8d2..7ceb6e23699 100644 --- a/src/mame/video/atarimo.cpp +++ b/src/mame/video/atarimo.cpp @@ -234,7 +234,7 @@ void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cl // a stop or the end of line. //------------------------------------------------- -void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y) +void atari_motion_objects_device::apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t const *mo, int x, int y) { const uint16_t START_MARKER = ((4 << PRIORITY_SHIFT) | 2); const uint16_t END_MARKER = ((4 << PRIORITY_SHIFT) | 4); diff --git a/src/mame/video/atarimo.h b/src/mame/video/atarimo.h index 2de0270217f..8fc8e2db95d 100644 --- a/src/mame/video/atarimo.h +++ b/src/mame/video/atarimo.h @@ -101,7 +101,7 @@ public: // rendering virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; - void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t *mo, int x, int y); + void apply_stain(bitmap_ind16 &bitmap, uint16_t *pf, uint16_t const *mo, int x, int y); // memory access uint16_t &slipram(int offset) { return m_slipram[offset]; } diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp index 5112e2f8afc..5063ea02590 100644 --- a/src/mame/video/atarirle.cpp +++ b/src/mame/video/atarirle.cpp @@ -606,7 +606,7 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang int current_row = 0; for (int y = sy; y <= ey; y++, sourcey += dy) { - u16 *dest = &bitmap.pix16(y, sx); + u16 *dest = &bitmap.pix(y, sx); int sourcex = dx / 2, rle_end = 0; // loop until we hit the row we're on @@ -665,7 +665,7 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang // clipped case else { - const u16 *end = &bitmap.pix16(y, ex); + const u16 *end = &bitmap.pix(y, ex); int to_be_skipped = pixels_to_skip; // decode the pixels @@ -785,7 +785,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r int current_row = 0; for (int y = sy; y <= ey; y++, sourcey += dy) { - u16 *dest = &bitmap.pix16(y, ex); + u16 *dest = &bitmap.pix(y, ex); int sourcex = dx / 2, rle_end = 0; // loop until we hit the row we're on @@ -844,7 +844,7 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r // clipped case else { - const u16 *start = &bitmap.pix16(y, sx); + const u16 *start = &bitmap.pix(y, sx); int to_be_skipped = pixels_to_skip; // decode the pixels @@ -989,19 +989,19 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite) for (int ty = sy; ty <= ey; ty++) { - bitmap.pix16(ty, sx) = machine().rand() & 0xff; - bitmap.pix16(ty, ex) = machine().rand() & 0xff; + bitmap.pix(ty, sx) = machine().rand() & 0xff; + bitmap.pix(ty, ex) = machine().rand() & 0xff; } for (int tx = sx; tx <= ex; tx++) { - bitmap.pix16(sy, tx) = machine().rand() & 0xff; - bitmap.pix16(ey, tx) = machine().rand() & 0xff; + bitmap.pix(sy, tx) = machine().rand() & 0xff; + bitmap.pix(ey, tx) = machine().rand() & 0xff; } } while (0); - fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", - code, color, hflip, - x, -scaled_xoffs, (scale * info.width) >> 12, - y, -scaled_yoffs, (scale * info.height) >> 12, scale); + osd_printf_info(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", + code, color, hflip, + x, -scaled_xoffs, (scale * info.width) >> 12, + y, -scaled_yoffs, (scale * info.height) >> 12, scale); } } diff --git a/src/mame/video/atarist.cpp b/src/mame/video/atarist.cpp index 89f0d060ece..093c118f982 100644 --- a/src/mame/video/atarist.cpp +++ b/src/mame/video/atarist.cpp @@ -156,7 +156,7 @@ void st_state::shifter_tick() break; } - m_bitmap.pix32(y, x) = pen; + m_bitmap.pix(y, x) = pen; } @@ -192,7 +192,7 @@ inline void st_state::shifter_load() void st_state::draw_pixel(int x, int y, u32 pen) { if(x < m_bitmap.width() && y < m_bitmap.height()) - m_bitmap.pix32(y, x) = pen; + m_bitmap.pix(y, x) = pen; } void st_state::glue_tick() diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp index 44a7129aff6..8c77c936622 100644 --- a/src/mame/video/atarisy1.cpp +++ b/src/mame/video/atarisy1.cpp @@ -487,8 +487,8 @@ uint32_t atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp index 95c75cfee5b..a3acaa781e2 100644 --- a/src/mame/video/atarisy2.cpp +++ b/src/mame/video/atarisy2.cpp @@ -248,13 +248,13 @@ uint32_t atarisy2_state::screen_update_atarisy2(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; // high priority PF? if ((mopriority + pri[x]) & 2) diff --git a/src/mame/video/aussiebyte.cpp b/src/mame/video/aussiebyte.cpp index faf67b30126..65aceaa2cab 100644 --- a/src/mame/video/aussiebyte.cpp +++ b/src/mame/video/aussiebyte.cpp @@ -166,23 +166,22 @@ u8 aussiebyte_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, u16 ac_cnt, bool a MC6845_UPDATE_ROW( aussiebyte_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u8 chr,gfx,attr; - u16 mem,x; - u32 *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); ra &= 15; m_cnt++; - for (x = 0; x < x_count; x++) + for (u16 x = 0; x < x_count; x++) { - mem = ma + x; - attr = m_aram[mem & 0x7ff]; + u16 mem = ma + x; + u8 attr = m_aram[mem & 0x7ff]; + u8 chr; if (BIT(attr, 7)) chr = m_vram[mem & 0x3fff]; // alpha else chr = m_vram[(mem << 4) | ra]; // gfx - gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); + u8 gfx = crt8002(ra, chr, attr, m_cnt, (x==cursor_x)); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; diff --git a/src/mame/video/avigo.cpp b/src/mame/video/avigo.cpp index 5e84eb94e69..9bb5d450ed6 100644 --- a/src/mame/video/avigo.cpp +++ b/src/mame/video/avigo.cpp @@ -78,32 +78,26 @@ void avigo_state::video_start() uint32_t avigo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - int b; - int x; - /* draw avigo display */ - for (y=0; y<AVIGO_SCREEN_HEIGHT; y++) + for (int y=0; y<AVIGO_SCREEN_HEIGHT; y++) { - int by; uint8_t *line_ptr = &m_video_memory[y*(AVIGO_SCREEN_WIDTH>>3)]; - x = 0; - for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) + int x = 0; + for (int by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--) { - int px; uint8_t byte = line_ptr[0]; - px = x; - for (b=7; b>=0; b--) + int px = x; + for (int b=7; b>=0; b--) { - bitmap.pix16(y, px) = ((byte>>7) & 0x01); + bitmap.pix(y, px) = ((byte>>7) & 0x01); px++; - byte = byte<<1; + byte <<= 1; } x = px; - line_ptr = line_ptr+1; + line_ptr++; } } return 0; diff --git a/src/mame/video/badlands.cpp b/src/mame/video/badlands.cpp index 9582a100e23..27fd00abf7e 100644 --- a/src/mame/video/badlands.cpp +++ b/src/mame/video/badlands.cpp @@ -114,13 +114,12 @@ uint32_t badlands_state::screen_update_badlands(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not yet verified - */ + // not yet verified if ((mo[x] & atari_motion_objects_device::PRIORITY_MASK) || !(pf[x] & 8)) pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK; } diff --git a/src/mame/video/balsente.cpp b/src/mame/video/balsente.cpp index 3b7e65aec1a..ad5737a2db7 100644 --- a/src/mame/video/balsente.cpp +++ b/src/mame/video/balsente.cpp @@ -127,27 +127,25 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip int image = sprite[1] | ((flags & 7) << 8); int ypos = sprite[2] + 17 + BALSENTE_VBEND; int xpos = sprite[3]; - uint8_t *src; - int x, y; /* get a pointer to the source image */ - src = &m_sprite_data[(64 * image) & m_sprite_mask]; + uint8_t const *src = &m_sprite_data[(64 * image) & m_sprite_mask]; if (flags & 0x80) src += 4 * 15; /* loop over y */ - for (y = 0; y < 16; y++, ypos = (ypos + 1) & 255) + for (int y = 0; y < 16; y++, ypos = (ypos + 1) & 255) { if (ypos >= (16 + BALSENTE_VBEND) && ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - const pen_t *pens = &m_palette->pen(m_palettebank_vis * 256); - uint8_t *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; + pen_t const *const pens = &m_palette->pen(m_palettebank_vis * 256); + const uint8_t *old = &m_expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos]; int currx = xpos; /* standard case */ if (!(flags & 0x40)) { /* loop over x */ - for (x = 0; x < 4; x++, old += 2) + for (int x = 0; x < 4; x++, old += 2) { int ipixel = *src++; int left = ipixel & 0xf0; @@ -155,12 +153,12 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip /* left pixel, combine with the background */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[left | old[0]]; + bitmap.pix(ypos, currx) = pens[left | old[0]]; currx++; /* right pixel, combine with the background */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[right | old[1]]; + bitmap.pix(ypos, currx) = pens[right | old[1]]; currx++; } } @@ -171,7 +169,7 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip src += 4; /* loop over x */ - for (x = 0; x < 4; x++, old += 2) + for (int x = 0; x < 4; x++, old += 2) { int ipixel = *--src; int left = (ipixel << 4) & 0xf0; @@ -179,12 +177,12 @@ void balsente_state::draw_one_sprite(bitmap_ind16 &bitmap, const rectangle &clip /* left pixel, combine with the background */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[left | old[0]]; + bitmap.pix(ypos, currx) = pens[left | old[0]]; currx++; /* right pixel, combine with the background */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx) = pens[right | old[1]]; + bitmap.pix(ypos, currx) = pens[right | old[1]]; currx++; } src += 4; diff --git a/src/mame/video/batman.cpp b/src/mame/video/batman.cpp index eb5b4c27f25..9d9746580ec 100644 --- a/src/mame/video/batman.cpp +++ b/src/mame/video/batman.cpp @@ -120,9 +120,9 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -143,7 +143,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 obscured by high fg playfield pens priority 3 only obscured by bg playfield priority 3 only */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -152,7 +152,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* foreground playfield case */ if (pri[x] & 0x80) { - int pfpriority = (pri[x] >> 2) & 3; + int const pfpriority = (pri[x] >> 2) & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -170,7 +170,7 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* background playfield case */ else { - int pfpriority = pri[x] & 3; + int const pfpriority = pri[x] & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -192,12 +192,12 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/battlane.cpp b/src/mame/video/battlane.cpp index 83de94e3da9..f9ba9320711 100644 --- a/src/mame/video/battlane.cpp +++ b/src/mame/video/battlane.cpp @@ -69,22 +69,19 @@ void battlane_state::battlane_spriteram_w(offs_t offset, uint8_t data) void battlane_state::battlane_bitmap_w(offs_t offset, uint8_t data) { - int i, orval; - - orval = (~m_video_ctrl >> 1) & 0x07; - + int orval = (~m_video_ctrl >> 1) & 0x07; if (!orval) orval = 7; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (data & 1 << i) { - m_screen_bitmap.pix8(offset % 0x100, (offset / 0x100) * 8 + i) |= orval; + m_screen_bitmap.pix(offset % 0x100, (offset / 0x100) * 8 + i) |= orval; } else { - m_screen_bitmap.pix8(offset % 0x100, (offset / 0x100) * 8 + i) &= ~orval; + m_screen_bitmap.pix(offset % 0x100, (offset / 0x100) * 8 + i) &= ~orval; } } } @@ -207,20 +204,18 @@ void battlane_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre void battlane_state::draw_fg_bitmap( bitmap_ind16 &bitmap ) { - int x, y, data; - - for (y = 0; y < 32 * 8; y++) + for (int y = 0; y < 32 * 8; y++) { - for (x = 0; x < 32 * 8; x++) + for (int x = 0; x < 32 * 8; x++) { - data = m_screen_bitmap.pix8(y, x); + int const data = m_screen_bitmap.pix(y, x); if (data) { if (flip_screen()) - bitmap.pix16(255 - y, 255 - x) = data; + bitmap.pix(255 - y, 255 - x) = data; else - bitmap.pix16(y, x) = data; + bitmap.pix(y, x) = data; } } } diff --git a/src/mame/video/bbc.cpp b/src/mame/video/bbc.cpp index d599169000a..5ba8ced6e97 100644 --- a/src/mame/video/bbc.cpp +++ b/src/mame/video/bbc.cpp @@ -308,7 +308,7 @@ MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) int col = m_trom->get_rgb() ^ ((x_pos == cursor_x) ? 7 : 0); - bitmap.pix32(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); + bitmap.pix(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); } } } @@ -324,7 +324,7 @@ MC6845_UPDATE_ROW( bbc_state::crtc_update_row ) col ^= ((cursor_x != -1 && x_pos >= cursor_x && x_pos < (cursor_x + m_cursor_size)) ? 7 : 0); - bitmap.pix32(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); + bitmap.pix(y, (x_pos*m_pixels_per_byte) + pixelno) = de ? palette[col] : rgb_t::black(); data = (data << 1) | 1; } } diff --git a/src/mame/video/bbusters.cpp b/src/mame/video/bbusters.cpp index 9f9132cf9ff..ffb748fab9a 100644 --- a/src/mame/video/bbusters.cpp +++ b/src/mame/video/bbusters.cpp @@ -137,31 +137,30 @@ void bbusters_state_base::draw_block(screen_device &screen, bitmap_ind16 &dest,i gfx_element *gfx = m_gfxdecode->gfx(bank); pen_t pen_base = gfx->colorbase() + gfx->granularity() * (color % gfx->colors()); uint32_t xinc=(m_scale_line_count * 0x10000 ) / size; - uint8_t pixel; - int x_index; int dy=y; - int sx, ex = m_scale_line_count; + int ex = m_scale_line_count; while (m_scale_line_count) { if (dy>=16 && dy<240) { - uint16_t *destline = &dest.pix16(dy); - uint8_t *priorityline = &screen.priority().pix8(dy); + uint16_t *const destline = &dest.pix(dy); + uint8_t *const priorityline = &screen.priority().pix(dy); uint8_t srcline=*m_scale_table_ptr; const uint8_t *srcptr=nullptr; if (!flipy) srcline=size-srcline-1; + int x_index; if (flipx) x_index=(ex-1)*0x10000; else x_index=0; - for (sx=0; sx<size; sx++) { + for (int sx=0; sx<size; sx++) { if ((sx%16)==0) srcptr=get_source_ptr(gfx,sprite,sx,srcline,block); - pixel=*srcptr++; + uint8_t pixel=*srcptr++; if (pixel!=15 && priority > priorityline[(x+(x_index>>16)) & 0x1ff]) { priorityline[(x+(x_index>>16)) & 0x1ff] = priority; diff --git a/src/mame/video/bigevglf.cpp b/src/mame/video/bigevglf.cpp index f7cc450a09f..7b05c7443a2 100644 --- a/src/mame/video/bigevglf.cpp +++ b/src/mame/video/bigevglf.cpp @@ -35,12 +35,11 @@ void bigevglf_state::bigevglf_vidram_addr_w(uint8_t data) void bigevglf_state::bigevglf_vidram_w(offs_t offset, uint8_t data) { - uint32_t x, y, o; - o = m_vidram_bank + offset; + uint32_t o = m_vidram_bank + offset; m_vidram[o + 0x10000 * m_plane_selected] = data; - y = o >>8; - x = (o & 255); - m_tmp_bitmap[m_plane_selected].pix16(y, x) = data; + uint32_t y = o >>8; + uint32_t x = (o & 255); + m_tmp_bitmap[m_plane_selected].pix(y, x) = data; } uint8_t bigevglf_state::bigevglf_vidram_r(offs_t offset) diff --git a/src/mame/video/bking.cpp b/src/mame/video/bking.cpp index 868a648a01e..62cd0dd73d7 100644 --- a/src/mame/video/bking.cpp +++ b/src/mame/video/bking.cpp @@ -291,12 +291,12 @@ WRITE_LINE_MEMBER(bking_state::screen_vblank_bking) m_bg_tilemap->set_scrolly(0, 0); // check for collision - const uint8_t* colmask = memregion("user1")->base() + 8 * m_hit; + uint8_t const *const colmask = memregion("user1")->base() + 8 * m_hit; for (int y = rect.min_y; y <= rect.max_y; y++) { - const uint16_t* p0 = &m_colmap_bg.pix16(y); - const uint16_t* p1 = &m_colmap_ball.pix16(y); + uint16_t const *const p0 = &m_colmap_bg.pix(y); + uint16_t const *const p1 = &m_colmap_ball.pix(y); for (int x = rect.min_x; x <= rect.max_x; x++) { diff --git a/src/mame/video/blockout.cpp b/src/mame/video/blockout.cpp index 1206a755bf5..1e84ca939e8 100644 --- a/src/mame/video/blockout.cpp +++ b/src/mame/video/blockout.cpp @@ -79,7 +79,7 @@ void blockout_state::videoram_w(offs_t offset, u8 data) else color = back | 0x100; - m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix(y, x) = color; } } @@ -96,7 +96,7 @@ u32 blockout_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { const u16 d = m_frontvideoram[((y & 0xff) << 6) + ((x & 0x1ff) >> 3)]; if (d & (1 << (7 - (x & 7)))) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp index e903a2be935..d71c2db6ca0 100644 --- a/src/mame/video/blstroid.cpp +++ b/src/mame/video/blstroid.cpp @@ -152,8 +152,8 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -161,7 +161,7 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in priority address = HPPPMMMM */ - int priaddr = ((pf[x] & 8) << 4) | (pf[x] & 0x70) | ((mo[x] & 0xf0) >> 4); + int const priaddr = ((pf[x] & 8) << 4) | (pf[x] & 0x70) | ((mo[x] & 0xf0) >> 4); if (m_priorityram[priaddr] & 1) pf[x] = mo[x]; } diff --git a/src/mame/video/boogwing.cpp b/src/mame/video/boogwing.cpp index 6668fc3b6d2..5095b54e964 100644 --- a/src/mame/video/boogwing.cpp +++ b/src/mame/video/boogwing.cpp @@ -37,8 +37,7 @@ constexpr u32 sub_blend_r32(u32 d, u32 s, u8 level) */ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y, x; - const pen_t *paldata = &m_deco_ace->pen(0); + pen_t const *const paldata = &m_deco_ace->pen(0); bitmap_ind16 *sprite_bitmap1, *sprite_bitmap2, *alpha_tmap_bitmap; bitmap_ind8* priority_bitmap; @@ -49,21 +48,17 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c alpha_tmap_bitmap = &m_alpha_tmap_bitmap; priority_bitmap = &screen.priority(); - uint32_t* dstline; - uint16_t *srcline1, *srcline2, *srcline3, *tmapline; - uint8_t *srcpriline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top();y<=cliprect.bottom();y++) { - srcline1=&sprite_bitmap1->pix16(y,0); - srcline2=&sprite_bitmap2->pix16(y,0); - srcline3=&alpha_tmap_bitmap->pix16(y,0); - tmapline=&m_temp_bitmap.pix16(y,0); - srcpriline=&priority_bitmap->pix8(y,0); + uint16_t *srcline1=&sprite_bitmap1->pix(y,0); + uint16_t *srcline2=&sprite_bitmap2->pix(y,0); + uint16_t *srcline3=&alpha_tmap_bitmap->pix(y,0); + uint16_t *tmapline=&m_temp_bitmap.pix(y,0); + uint8_t *srcpriline=&priority_bitmap->pix(y,0); - dstline=&bitmap.pix32(y,0); + uint32_t *dstline=&bitmap.pix(y,0); - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix1 = srcline1[x]; uint16_t pix2 = srcline2[x]; diff --git a/src/mame/video/bosco.cpp b/src/mame/video/bosco.cpp index 62b366cebf9..8e7b869c3aa 100644 --- a/src/mame/video/bosco.cpp +++ b/src/mame/video/bosco.cpp @@ -266,16 +266,16 @@ uint32_t bosco_state::screen_update_bosco(screen_device &screen, bitmap_ind16 &b { for (int x = 63; x >= 0; x--) { - bitmap.pix16(y, x + 3) = bitmap.pix16(y, x); - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x + 3) = bitmap.pix(y, x); + bitmap.pix(y, x) = m_palette->black_pen(); } } else { for (int x = 224; x < 288; x++) { - bitmap.pix16(y, x - 3) = bitmap.pix16(y, x); - bitmap.pix16(y, x) = m_palette->black_pen(); + bitmap.pix(y, x - 3) = bitmap.pix(y, x); + bitmap.pix(y, x) = m_palette->black_pen(); } } } diff --git a/src/mame/video/btoads.cpp b/src/mame/video/btoads.cpp index b891357d00e..a4203790a1d 100644 --- a/src/mame/video/btoads.cpp +++ b/src/mame/video/btoads.cpp @@ -307,10 +307,9 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) uint16_t *bg0_base = &m_vram_bg0[(fulladdr + (m_yscroll0 << 10)) & 0x3fc00]; uint16_t *bg1_base = &m_vram_bg1[(fulladdr + (m_yscroll1 << 10)) & 0x3fc00]; uint8_t *spr_base = &m_vram_fg_display[fulladdr & 0x3fc00]; - uint32_t *dst = &bitmap.pix32(scanline); + uint32_t *const dst = &bitmap.pix(scanline); const pen_t *pens = m_tlc34076->pens(); int coladdr = fulladdr & 0x3ff; - int x; /* for each scanline, switch off the render mode */ switch (m_screen_control & 3) @@ -324,7 +323,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG0 */ case 0: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -369,7 +368,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG1 */ case 1: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -411,7 +410,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 3. BG0 */ case 2: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint8_t sprpix = spr_base[coladdr & 0xff]; @@ -447,7 +446,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) 5. BG0 */ case 3: - for (x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) + for (int x = params->heblnk; x < params->hsblnk; x += 2, coladdr++) { uint16_t bg0pix = bg0_base[(coladdr + m_xscroll0) & 0xff]; uint16_t bg1pix = bg1_base[(coladdr + m_xscroll1) & 0xff]; @@ -486,7 +485,6 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) { char name[10]; FILE *f; - int i; while (machine().input().code_pressed(KEYCODE_X)) ; @@ -494,7 +492,7 @@ TMS340X0_SCANLINE_RGB32_CB_MEMBER(btoads_state::scanline_update) f = fopen(name, "w"); fprintf(f, "screen_control = %04X\n\n", m_screen_control << 8); - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { uint16_t *base = (i == 0) ? (uint16_t *)m_vram_fg_display : (i == 1) ? m_vram_bg0 : m_vram_bg1; int xscr = (i == 0) ? 0 : (i == 1) ? m_xscroll0 : m_xscroll1; diff --git a/src/mame/video/buggychl.cpp b/src/mame/video/buggychl.cpp index e3c98e953c9..7ac9ed42437 100644 --- a/src/mame/video/buggychl.cpp +++ b/src/mame/video/buggychl.cpp @@ -77,7 +77,7 @@ void buggychl_state::draw_sky( bitmap_ind16 &bitmap, const rectangle &cliprect ) { for (int y = 0; y < 256; y++) for (int x = 0; x < 256; x++) - bitmap.pix16(y, x) = 128 + x / 2; + bitmap.pix(y, x) = 128 + x / 2; } @@ -158,28 +158,21 @@ void buggychl_state::draw_fg( bitmap_ind16 &bitmap, const rectangle &cliprect ) void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - const uint8_t *gfx; - g_profiler.start(PROFILER_USER1); - gfx = memregion("gfx2")->base(); - for (offs = 0; offs < m_spriteram.bytes(); offs += 4) + uint8_t const *const gfx = memregion("gfx2")->base(); + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int sx, sy, flipy, zoom, ch, x, px, y; - const uint8_t *lookup; - const uint8_t *zoomx_rom, *zoomy_rom; + int sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); + int sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); + int flipy = m_spriteram[offs + 1] & 0x40; + int zoom = m_spriteram[offs + 1] & 0x3f; + uint8_t const *const zoomy_rom = gfx + (zoom << 6); + uint8_t const *const zoomx_rom = gfx + 0x2000 + (zoom << 3); - sx = m_spriteram[offs + 3] - ((m_spriteram[offs + 2] & 0x80) << 1); - sy = 256 - 64 - m_spriteram[offs] + ((m_spriteram[offs + 1] & 0x80) << 1); - flipy = m_spriteram[offs + 1] & 0x40; - zoom = m_spriteram[offs + 1] & 0x3f; - zoomy_rom = gfx + (zoom << 6); - zoomx_rom = gfx + 0x2000 + (zoom << 3); + uint8_t const *const lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - lookup = m_sprite_lookup + ((m_spriteram[offs + 2] & 0x7f) << 6); - - for (y = 0; y < 64; y++) + for (int y = 0; y < 64; y++) { int dy = flip_screen_y() ? (255 - sy - y) : (sy + y); @@ -192,26 +185,23 @@ void buggychl_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre if (flipy) base_pos ^= 0x38; - px = 0; - for (ch = 0; ch < 4; ch++) + int px = 0; + for (int ch = 0; ch < 4; ch++) { - int pos, code, realflipy; - const uint8_t *pendata; - - pos = base_pos + 2 * ch; - code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); - realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; + int pos = base_pos + 2 * ch; + int code = 8 * (lookup[pos] | ((lookup[pos + 1] & 0x07) << 8)); + int realflipy = (lookup[pos + 1] & 0x80) ? !flipy : flipy; code += (realflipy ? (charline ^ 7) : charline); - pendata = m_gfxdecode->gfx(1)->get_data(code); + uint8_t const *const pendata = m_gfxdecode->gfx(1)->get_data(code); - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { int col = pendata[x]; if (col) { int dx = flip_screen_x() ? (255 - sx - px) : (sx + px); if ((dx & ~0xff) == 0) - bitmap.pix16(dy, dx) = m_sprite_color_base + col; + bitmap.pix(dy, dx) = m_sprite_color_base + col; } /* the following line is almost certainly wrong */ diff --git a/src/mame/video/busicom.cpp b/src/mame/video/busicom.cpp index 81c0c715f9a..711d1917915 100644 --- a/src/mame/video/busicom.cpp +++ b/src/mame/video/busicom.cpp @@ -1826,10 +1826,10 @@ uint32_t busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind1 for (u8 j = 0; j < 44; j++) { for (u8 b = 0; b < 34; b++) - bitmap.pix16((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; + bitmap.pix((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; for (u8 b = 34; b < 40; b++) - bitmap.pix16((y*44)+j, x*40+b) = 0; + bitmap.pix((y*44)+j, x*40+b) = 0; } } } diff --git a/src/mame/video/capbowl.cpp b/src/mame/video/capbowl.cpp index f39ea193571..0e4faece1ec 100644 --- a/src/mame/video/capbowl.cpp +++ b/src/mame/video/capbowl.cpp @@ -140,8 +140,8 @@ uint32_t capbowl_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* now regenerate the bitmap */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t const *src = &m_tms34061->vram(y); - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const src = &m_tms34061->vram(y); + uint32_t *dest = &bitmap.pix(y); for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { diff --git a/src/mame/video/carpolo.cpp b/src/mame/video/carpolo.cpp index 7942b6a6eaf..69d6b50713f 100644 --- a/src/mame/video/carpolo.cpp +++ b/src/mame/video/carpolo.cpp @@ -321,8 +321,6 @@ int carpolo_state::check_sprite_sprite_collision(int x1, int y1, int code1, int /* check if the two sprites are even within collision range */ if ((abs(x1 - x2) < SPRITE_WIDTH) && (abs(y1 - y2) < SPRITE_HEIGHT)) { - int x,y; - normalize_coordinates(&x1, &y1, &x2, &y2); m_sprite_sprite_collision_bitmap1->fill(0); @@ -338,10 +336,10 @@ int carpolo_state::check_sprite_sprite_collision(int x1, int y1, int code1, int 0,flipy2, x2,y2); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if ((m_sprite_sprite_collision_bitmap1->pix16(y, x) == 1) && - (m_sprite_sprite_collision_bitmap2->pix16(y, x) == 1)) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if ((m_sprite_sprite_collision_bitmap1->pix(y, x) == 1) && + (m_sprite_sprite_collision_bitmap2->pix(y, x) == 1)) { *col_x = (x1 + x) & 0x0f; *col_y = (y1 + y) & 0x0f; @@ -369,12 +367,8 @@ int carpolo_state::check_sprite_left_goal_collision(int x1, int y1, int code1, i if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) && ((x1 + 16) > LEFT_GOAL_X) && (x1 < (LEFT_GOAL_X + GOAL_WIDTH))) { - int x,y; - int x2,y2; - - - x2 = LEFT_GOAL_X; - y2 = GOAL_Y; + int x2 = LEFT_GOAL_X; + int y2 = GOAL_Y; normalize_coordinates(&x1, &y1, &x2, &y2); @@ -392,11 +386,11 @@ int carpolo_state::check_sprite_left_goal_collision(int x1, int y1, int code1, i x2,y2, 0x20000,0x20000,0); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if (m_sprite_goal_collision_bitmap1->pix16(y, x) == 1) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if (m_sprite_goal_collision_bitmap1->pix(y, x) == 1) { - pen_t pix = m_sprite_goal_collision_bitmap2->pix16(y, x); + pen_t pix = m_sprite_goal_collision_bitmap2->pix(y, x); if (pix == LEFT_GOAL_PEN) { @@ -427,11 +421,8 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, if (((y1 + 16) > GOAL_Y) && (y1 < (GOAL_Y + GOAL_HEIGHT)) && ((x1 + 16) > RIGHT_GOAL_X) && (x1 < (RIGHT_GOAL_X + GOAL_WIDTH))) { - int x,y; - int x2,y2; - - x2 = RIGHT_GOAL_X; - y2 = GOAL_Y; + int x2 = RIGHT_GOAL_X; + int y2 = GOAL_Y; normalize_coordinates(&x1, &y1, &x2, &y2); @@ -449,11 +440,11 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, x2,y2, 0x20000,0x20000,0); - for (x = x1; x < x1 + SPRITE_WIDTH; x++) - for (y = y1; y < y1 + SPRITE_HEIGHT; y++) - if (m_sprite_goal_collision_bitmap1->pix16(y, x) == 1) + for (int x = x1; x < x1 + SPRITE_WIDTH; x++) + for (int y = y1; y < y1 + SPRITE_HEIGHT; y++) + if (m_sprite_goal_collision_bitmap1->pix(y, x) == 1) { - pen_t pix = m_sprite_goal_collision_bitmap2->pix16(y, x); + pen_t pix = m_sprite_goal_collision_bitmap2->pix(y, x); if (pix == RIGHT_GOAL_PEN) { @@ -477,7 +468,6 @@ int carpolo_state::check_sprite_right_goal_collision(int x1, int y1, int code1, 2 for collision with horizontal border */ int carpolo_state::check_sprite_border_collision(uint8_t x1, uint8_t y1, int code1, int flipy1) { - uint8_t x,y; int collided = 0; x1 = 240 - x1; @@ -488,9 +478,9 @@ int carpolo_state::check_sprite_border_collision(uint8_t x1, uint8_t y1, int cod 0,flipy1, 0,0); - for (x = 0; x < SPRITE_WIDTH; x++) - for (y = 0; y < SPRITE_HEIGHT; y++) - if (m_sprite_border_collision_bitmap->pix16(y, x) == 1) + for (uint8_t x = 0; x < SPRITE_WIDTH; x++) + for (uint8_t y = 0; y < SPRITE_HEIGHT; y++) + if (m_sprite_border_collision_bitmap->pix(y, x) == 1) { if (((uint8_t)(x1 + x) == LEFT_BORDER) || ((uint8_t)(x1 + x) == RIGHT_BORDER)) diff --git a/src/mame/video/ccastles.cpp b/src/mame/video/ccastles.cpp index 175f7f694d0..4784167e80b 100644 --- a/src/mame/video/ccastles.cpp +++ b/src/mame/video/ccastles.cpp @@ -254,49 +254,47 @@ void ccastles_state::ccastles_bitmode_addr_w(offs_t offset, uint8_t data) uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteaddr = &m_spriteram[m_outlatch[1]->q7_r() * 0x100]; /* BUF1/BUF2 */ - int flip = m_outlatch[1]->q4_r() ? 0xff : 0x00; /* PLAYER2 */ - pen_t black = m_palette->black_pen(); - int x, y, offs; + uint8_t const *const spriteaddr = &m_spriteram[m_outlatch[1]->q7_r() * 0x100]; /* BUF1/BUF2 */ + int const flip = m_outlatch[1]->q4_r() ? 0xff : 0x00; /* PLAYER2 */ + pen_t const black = m_palette->black_pen(); /* draw the sprites */ m_spritebitmap.fill(0x0f, cliprect); - for (offs = 0; offs < 320/2; offs += 4) + for (int offs = 0; offs < 320/2; offs += 4) { - int x = spriteaddr[offs + 3]; - int y = 256 - 16 - spriteaddr[offs + 1]; - int which = spriteaddr[offs]; - int color = spriteaddr[offs + 2] >> 7; + int const x = spriteaddr[offs + 3]; + int const y = 256 - 16 - spriteaddr[offs + 1]; + int const which = spriteaddr[offs]; + int const color = spriteaddr[offs + 2] >> 7; m_gfxdecode->gfx(0)->transpen(m_spritebitmap,cliprect, which, color, flip, flip, x, y, 7); } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* if we're in the VBLANK region, just fill with black */ if (m_syncprom[y] & 1) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } /* non-VBLANK region: merge the sprites and the bitmap */ else { - uint16_t *mosrc = &m_spritebitmap.pix16(y); - int effy = (((y - m_vblank_end) + (flip ? 0 : m_vscroll)) ^ flip) & 0xff; - uint8_t *src; + uint16_t const *const mosrc = &m_spritebitmap.pix(y); /* the "POTATO" chip does some magic here; this is just a guess */ + int effy = (((y - m_vblank_end) + (flip ? 0 : m_vscroll)) ^ flip) & 0xff; if (effy < 24) effy = 24; - src = &m_videoram[effy * 128]; + uint8_t const *const src = &m_videoram[effy * 128]; /* loop over X */ - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) @@ -305,12 +303,11 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in /* otherwise, process normally */ else { - int effx = (m_hscroll + (x ^ flip)) & 255; + int const effx = (m_hscroll + (x ^ flip)) & 255; /* low 4 bits = left pixel, high 4 bits = right pixel */ uint8_t pix = (src[effx / 2] >> ((effx & 1) * 4)) & 0x0f; - uint8_t mopix = mosrc[x]; - uint8_t prindex, prvalue; + uint8_t const mopix = mosrc[x]; /* Inputs to the priority PROM: @@ -323,11 +320,12 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in Bit 1 = MPI Bit 0 = BIT3 */ + uint8_t prindex; prindex = 0x40; prindex |= (mopix & 7) << 2; prindex |= (mopix & 8) >> 2; prindex |= (pix & 8) >> 3; - prvalue = m_priprom[prindex]; + uint8_t const prvalue = m_priprom[prindex]; /* Bit 1 of prvalue selects the low 4 bits of the final pixel */ if (prvalue & 2) diff --git a/src/mame/video/cclimber.cpp b/src/mame/video/cclimber.cpp index d476216a1a8..9da5443bf3f 100644 --- a/src/mame/video/cclimber.cpp +++ b/src/mame/video/cclimber.cpp @@ -691,16 +691,14 @@ uint32_t cclimber_state::screen_update_cclimber(screen_device &screen, bitmap_in uint32_t cclimber_state::screen_update_yamato(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - uint8_t *sky_rom = memregion("user1")->base() + 0x1200; + uint8_t const *const sky_rom = memregion("user1")->base() + 0x1200; - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) { - int j; pen_t pen = YAMATO_SKY_PEN_BASE + sky_rom[(m_flip_x ? 0x80 : 0) + (i >> 1)]; - for (j = 0; j < 0x100; j++) - bitmap.pix16(j, (i - 8) & 0xff) = pen; + for (int j = 0; j < 0x100; j++) + bitmap.pix(j, (i - 8) & 0xff) = pen; } draw_playfield(screen, bitmap, cliprect); diff --git a/src/mame/video/cgc7900.cpp b/src/mame/video/cgc7900.cpp index 4ce2acbd448..90ff7bd702e 100644 --- a/src/mame/video/cgc7900.cpp +++ b/src/mame/video/cgc7900.cpp @@ -159,18 +159,18 @@ void cgc7900_state::draw_overlay(screen_device *screen, bitmap_rgb32 &bitmap) { if (!OVERLAY_CURSOR_BLINK || m_blink) { - bitmap.pix32(y, (sx * 8) + x) = pen[7]; + bitmap.pix(y, (sx * 8) + x) = pen[7]; } } else { if (!BIT(data, x) || (OVERLAY_BLK && OVERLAY_CHARACTER_BLINK && !m_blink)) { - if (OVERLAY_VB) bitmap.pix32(y, (sx * 8) + x) = pen[bg]; + if (OVERLAY_VB) bitmap.pix(y, (sx * 8) + x) = pen[bg]; } else { - if (OVERLAY_VF) bitmap.pix32(y, (sx * 8) + x) = pen[fg]; + if (OVERLAY_VF) bitmap.pix(y, (sx * 8) + x) = pen[fg]; } } } diff --git a/src/mame/video/chaknpop.cpp b/src/mame/video/chaknpop.cpp index 06905c73deb..675b0f3644b 100644 --- a/src/mame/video/chaknpop.cpp +++ b/src/mame/video/chaknpop.cpp @@ -208,9 +208,8 @@ void chaknpop_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ) { int dx = m_flip_x ? -1 : 1; - int offs, i; - for (offs = 0; offs < 0x2000; offs++) + for (int offs = 0; offs < 0x2000; offs++) { int x = ((offs & 0x1f) << 3) + 7; int y = offs >> 5; @@ -221,7 +220,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec if (!m_flip_y) y = 255 - y; - for (i = 0x80; i > 0; i >>= 1, x += dx) + for (int i = 0x80; i > 0; i >>= 1, x += dx) { pen_t color = 0; @@ -235,11 +234,7 @@ void chaknpop_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprec color |= 0x040; // tx mask if (color) - { - pen_t pen = bitmap.pix16(y, x); - pen |= color; - bitmap.pix16(y, x) = pen; - } + bitmap.pix(y, x) |= color; } } } diff --git a/src/mame/video/changela.cpp b/src/mame/video/changela.cpp index 098359b15f4..5c2f57e3f1f 100644 --- a/src/mame/video/changela.cpp +++ b/src/mame/video/changela.cpp @@ -44,12 +44,10 @@ void changela_state::video_start() void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) { - int sx, i; + uint8_t const *const ROM = memregion("user1")->base(); + uint8_t const *const RAM = m_spriteram; - uint8_t* ROM = memregion("user1")->base(); - uint8_t* RAM = m_spriteram; - - for (sx = 0; sx < 256; sx++) + for (int sx = 0; sx < 256; sx++) { int vr = (RAM[sx * 4 + 0] & 0x80) >> 7; int hr = (RAM[sx * 4 + 0] & 0x40) >> 6; @@ -61,27 +59,26 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) if (sy - ypos <= vsize) { - for (i = 0; i < 16; i++) + for (int i = 0; i < 16; i++) { - uint32_t A7, A8, rom_addr; - uint8_t counter, data; uint8_t sum = sy - ypos; - counter = i; + uint8_t counter = i; if (hr) counter ^= 0x0f; - A8 = ((tile & 0x02) >> 1) ^ ((hr & hs) ^ hs); - A7 = ((((vr ^ ((sum & 0x10) >> 4)) & ((vsize & 0x10) >> 4)) ^ 0x01) & (tile & 0x01) ) ^ 0x01; - rom_addr = (counter >> 1) | ((sum & 0x0f) << 3) | (A7 << 7) | (A8 << 8) | ((tile >> 2) << 9); + uint32_t A8 = ((tile & 0x02) >> 1) ^ ((hr & hs) ^ hs); + uint32_t A7 = ((((vr ^ ((sum & 0x10) >> 4)) & ((vsize & 0x10) >> 4)) ^ 0x01) & (tile & 0x01) ) ^ 0x01; + uint32_t rom_addr = (counter >> 1) | ((sum & 0x0f) << 3) | (A7 << 7) | (A8 << 8) | ((tile >> 2) << 9); if (vr) rom_addr ^= (0x0f << 3); + uint8_t data; if (counter & 1) data = ROM[rom_addr] & 0x0f; else data = (ROM[rom_addr] & 0xf0) >> 4; if ((data != 0x0f) && (data != 0)) - bitmap.pix16(sy, xpos + i) = data | 0x10; + bitmap.pix(sy, xpos + i) = data | 0x10; if (hs) { @@ -91,7 +88,7 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) data = (ROM[rom_addr ^ 0x100] & 0xf0) >> 4; if ((data != 0x0f) && (data != 0)) - bitmap.pix16(sy, xpos + i + 16) = data | 0x10; + bitmap.pix(sy, xpos + i + 16) = data | 0x10; } } } @@ -106,22 +103,17 @@ void changela_state::draw_obj0( bitmap_ind16 &bitmap, int sy ) void changela_state::draw_obj1( bitmap_ind16 &bitmap ) { - int sx, sy; - - uint8_t* ROM = memregion("gfx2")->base(); - uint8_t* RAM = m_videoram; + uint8_t const *const ROM = memregion("gfx2")->base(); + uint8_t const *const RAM = m_videoram; uint8_t reg[4] = { 0 }; /* 4x4-bit registers (U58, U59) */ - uint8_t tile; uint8_t attrib = 0; - for (sy = 0; sy < 256; sy++) + for (int sy = 0; sy < 256; sy++) { - for (sx = 0; sx < 256; sx++) + for (int sx = 0; sx < 256; sx++) { - int c0, c1, col, sum; - /* 11 Bits: H1, H3, H4, H5, H6, H7, V3, V4, V5, V6, V7 */ int ram_addr = ((sx & 0xf8) >> 2) | ((sy & 0xf8) << 3); int tile_addr = RAM[ram_addr]; @@ -129,11 +121,12 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) if (!(RAM[ram_addr + 1] & 0x10) && (sx & 0x04)) /* D4=0 enables latch at U32 */ attrib = RAM[ram_addr + 1]; - tile = ROM[(tile_addr << 4) | ((sx & 0x04) >> 2) | ((sy & 0x07) << 1)]; + uint8_t tile = ROM[(tile_addr << 4) | ((sx & 0x04) >> 2) | ((sy & 0x07) << 1)]; reg[(sx & 0x0c) >> 2] = tile; - sum = (sx & 0x0f) + (attrib & 0x0f); /* 4-bit adder (U45) */ + int sum = (sx & 0x0f) + (attrib & 0x0f); /* 4-bit adder (U45) */ /* Multiplexors (U57) */ + int c0, c1; if ((sum & 0x03) == 0) { c0 = (reg[(sum & 0x0c) >> 2] & 0x08) >> 3; @@ -155,9 +148,9 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) c1 = (reg[(sum & 0x0c) >> 2] & 0x10) >> 4; } - col = c0 | (c1 << 1) | ((attrib & 0xc0) >> 4); + int col = c0 | (c1 << 1) | ((attrib & 0xc0) >> 4); if ((col & 0x07) != 0x07) - bitmap.pix16(sy, sx) = col | 0x20; + bitmap.pix(sy, sx) = col | 0x20; } } } @@ -170,20 +163,17 @@ void changela_state::draw_obj1( bitmap_ind16 &bitmap ) void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) { - int sx, i, j; - - uint8_t* ROM = memregion("user2")->base(); - uint8_t* RAM = m_memory_devices.get() + 0x800; - uint8_t* TILE_ROM = memregion("gfx1")->base(); - uint8_t* TILE_RAM = m_memory_devices.get() + 0x1000; - uint8_t* PROM = memregion("proms")->base(); + uint8_t const *const ROM = memregion("user2")->base(); + uint8_t *const RAM = m_memory_devices.get() + 0x800; + uint8_t const *const TILE_ROM = memregion("gfx1")->base(); + uint8_t const *const TILE_RAM = m_memory_devices.get() + 0x1000; + uint8_t const *const PROM = memregion("proms")->base(); int preload = ((sy < 32) ? 1 : 0); uint8_t math_train[10] = { 0 }; uint8_t pre_train[3] = { 0 }; - uint8_t curr_state = 0; uint8_t prev_state = 0; uint8_t ram_count = 0; @@ -197,12 +187,9 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) m_v_count_river = (m_v_count_river + 1) & 0xff; /* ----- STATE MACHINE ----- */ - for (i = 0; i < 0x20; i++) + for (int i = 0; i < 0x20; i++) { - int rom_addr, ram_addr, ram_a5; - int mux45, mux61; - - curr_state = PROM[i]; + uint8_t curr_state = PROM[i]; /* Update Counters */ if (prev_state & 0x80) @@ -218,11 +205,11 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) if (prev_state & 0x10) hosc = (math_train[8] << 4) | math_train[9]; - rom_addr = m_slopeROM_bank | ((m_v_count_river & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); - ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; - ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); - mux45 = rom_count & 0x01; - mux61 = m_v_count_river & 0x01; + int rom_addr = m_slopeROM_bank | ((m_v_count_river & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); + int ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; + int ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); + int mux45 = rom_count & 0x01; + int mux61 = m_v_count_river & 0x01; switch (curr_state) { @@ -255,7 +242,7 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) /* Shift each item down the train */ if (curr_state & 0x02) { - for (j = 9; j > 0; j--) + for (int j = 9; j > 0; j--) { math_train[j] = math_train[j - 1]; } @@ -276,12 +263,9 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) int tile_h = (math_train[7] & 0x0f) | ((math_train[6] & 0x0f) << 4) | ((math_train[5] & 0x01) << 8); /* Burst of 16 10Mhz Clocks */ - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - int ram_addr, rom_addr; - int col; - - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (h_count > 0xff) { @@ -296,23 +280,21 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else col = (TILE_ROM[rom_addr] & 0xf0) >> 4; - bitmap.pix16(sy, sx) = col; + bitmap.pix(sy, sx) = col; } - for (sx = 16; sx < 256; sx++) + for (int sx = 16; sx < 256; sx++) { - int ram_addr, rom_addr; - int col; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (h_count > 0xff) { @@ -327,15 +309,16 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else col = (TILE_ROM[rom_addr] & 0xf0) >> 4; - bitmap.pix16(sy, sx) = col; + bitmap.pix(sy, sx) = col; } } } @@ -348,17 +331,15 @@ void changela_state::draw_river( bitmap_ind16 &bitmap, int sy ) void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) { - int sx, i, j; - /* State machine */ - uint8_t* ROM = memregion("user2")->base(); - uint8_t* RAM = m_memory_devices.get() + 0x840 + 0x40 * tree_num; - uint8_t* PROM = memregion("proms")->base(); + uint8_t const *const ROM = memregion("user2")->base(); + uint8_t *const RAM = m_memory_devices.get() + 0x840 + 0x40 * tree_num; + uint8_t const *const PROM = memregion("proms")->base(); /* Tree Data */ - uint8_t* RAM2 = m_tree_ram.get() + 0x20 * tree_num; - uint8_t* TILE_ROM = (tree_num ? (memregion("user3")->base() + 0x1000) : (memregion("gfx1")->base() + 0x2000)); - uint8_t* TILE_RAM = (tree_num ? (memregion("user3")->base()) : (m_memory_devices.get() + 0x1800)); + uint8_t *const RAM2 = m_tree_ram.get() + 0x20 * tree_num; + uint8_t const *const TILE_ROM = (tree_num ? (memregion("user3")->base() + 0x1000) : (memregion("gfx1")->base() + 0x2000)); + uint8_t const *const TILE_RAM = (tree_num ? (memregion("user3")->base()) : (m_memory_devices.get() + 0x1800)); int preload = ((sy < 32) ? 1 : 0); @@ -366,7 +347,6 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) uint8_t pre_train[3] = { 0 }; uint8_t tree_train[3] = { 0 }; - uint8_t curr_state = 0; uint8_t prev_state = 0; uint8_t ram_count = 0; @@ -390,12 +370,9 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) m_v_count_tree = (m_v_count_tree + 1) & 0xff; /* ----- STATE MACHINE ----- */ - for (i = 0; i < 0x20; i++) + for (int i = 0; i < 0x20; i++) { - int rom_addr, ram_addr, ram_a5, ram2_addr; - int mux45, mux61; - - curr_state = PROM[i]; + uint8_t curr_state = PROM[i]; /* Update Counters */ if (prev_state & 0x80) @@ -414,12 +391,12 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) if (prev_state & 0x10) hosc = (math_train[8] << 4) | math_train[9]; - rom_addr = m_slopeROM_bank | ((m_v_count_tree & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); - ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; - ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); - ram2_addr = (ram_count << 1) | ((curr_state & 0x20) >> 5); - mux45 = rom_count & 0x01; - mux61 = m_v_count_tree & 0x01; + int rom_addr = m_slopeROM_bank | ((m_v_count_tree & 0x7e) << 2) | ((rom_count & 0x0e) >> 1); + int ram_a5 = ((curr_state & 0x01) & ((curr_state & 0x40) >> 6) & preload) ^ 0x01; + int ram_addr = (ram_a5 << 5) | (ram_count << 1) | ((curr_state & 0x20) >> 5); + int ram2_addr = (ram_count << 1) | ((curr_state & 0x20) >> 5); + int mux45 = rom_count & 0x01; + int mux61 = m_v_count_tree & 0x01; switch(curr_state) { @@ -487,7 +464,7 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) /* Shift each item down the train */ if (curr_state & 0x02) { - for (j = 9; j > 0; j--) + for (int j = 9; j > 0; j--) math_train[j] = math_train[j-1]; } else @@ -507,11 +484,9 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 1; /* Burst of 16 10Mhz clocks */ - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - int ram_addr, rom_addr, col; - - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { if (h_count > 0xff) { @@ -526,14 +501,15 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); if (!(m_v_count_tree & 0x80) && (m_tree_en & (0x01 << tree_num)) && ((TILE_ROM[rom_addr] & 0xf0) == 0)) m_tree_on[tree_num] = 1; if (m_tree_on[tree_num]) { + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else @@ -543,15 +519,13 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 0; if (col != 0x0f && col != 0x00) - bitmap.pix16(sy, sx) = col | 0x30; + bitmap.pix(sy, sx) = col | 0x30; } } - for (sx = 16; sx < 256; sx++) + for (int sx = 16; sx < 256; sx++) { - int ram_addr, rom_addr, col; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (h_count > 0xff) { @@ -566,14 +540,15 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) h_count++; } - ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); - rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); + int ram_addr = ((tile_h & 0x1f8) >> 3) | ((tile_v & 0x1f0) << 2); + int rom_addr = ((tile_h & 0x06) >> 1) | ((tile_v & 0x0f) << 2) | ((TILE_RAM[ram_addr] & 0x7f) << 6); if (!(m_v_count_tree & 0x80) && (m_tree_en & (0x01 << tree_num)) && ((TILE_ROM[rom_addr] & 0xf0) == 0)) m_tree_on[tree_num] = 1; if (m_tree_on[tree_num]) { + int col; if (tile_h & 0x01) col = TILE_ROM[rom_addr] & 0x0f; else @@ -583,7 +558,7 @@ void changela_state::draw_tree( bitmap_ind16 &bitmap, int sy, int tree_num ) all_ff = 0; if (col != 0x0f && col != 0x00) - bitmap.pix16(sy, sx) = col | 0x30; + bitmap.pix(sy, sx) = col | 0x30; } } @@ -644,7 +619,6 @@ e:|7 6 5 4 3 2 1 0 Hex|/RAMw /RAMr /ROM /AdderOutput AdderInput TrainInputs| TIMER_CALLBACK_MEMBER(changela_state::changela_scanline_callback) { int sy = param; - int sx; /* clear the current scanline first */ const rectangle rect(0, 255, sy, sy); @@ -659,32 +633,32 @@ TIMER_CALLBACK_MEMBER(changela_state::changela_scanline_callback) draw_tree(m_tree1_bitmap, sy, 1); /* Collision Detection */ - for (sx = 1; sx < 256; sx++) + for (int sx = 1; sx < 256; sx++) { - int riv_col, prev_col; - - if ((m_river_bitmap.pix16(sy, sx) == 0x08) - || (m_river_bitmap.pix16(sy, sx) == 0x09) - || (m_river_bitmap.pix16(sy, sx) == 0x0a)) + int riv_col; + if ((m_river_bitmap.pix(sy, sx) == 0x08) + || (m_river_bitmap.pix(sy, sx) == 0x09) + || (m_river_bitmap.pix(sy, sx) == 0x0a)) riv_col = 1; else riv_col = 0; - if ((m_river_bitmap.pix16(sy, sx-1) == 0x08) - || (m_river_bitmap.pix16(sy, sx-1) == 0x09) - || (m_river_bitmap.pix16(sy, sx-1) == 0x0a)) + int prev_col; + if ((m_river_bitmap.pix(sy, sx-1) == 0x08) + || (m_river_bitmap.pix(sy, sx-1) == 0x09) + || (m_river_bitmap.pix(sy, sx-1) == 0x0a)) prev_col = 1; else prev_col = 0; - if (m_obj0_bitmap.pix16(sy, sx) == 0x14) /* Car Outline Color */ + if (m_obj0_bitmap.pix(sy, sx) == 0x14) /* Car Outline Color */ { /* Tree 0 Collision */ - if (m_tree0_bitmap.pix16(sy, sx) != 0) + if (m_tree0_bitmap.pix(sy, sx) != 0) m_tree0_col = 1; /* Tree 1 Collision */ - if (m_tree1_bitmap.pix16(sy, sx) != 0) + if (m_tree1_bitmap.pix(sy, sx) != 0) m_tree1_col = 1; /* Hit Right Bank */ diff --git a/src/mame/video/channelf.cpp b/src/mame/video/channelf.cpp index c9d47bf65fd..9b8d254f79c 100644 --- a/src/mame/video/channelf.cpp +++ b/src/mame/video/channelf.cpp @@ -52,18 +52,16 @@ int channelf_state::recalc_palette_offset(int reg1, int reg2) uint32_t channelf_state::screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,col; - uint16_t ma=0,x; - int palette_offset; + uint16_t ma=0; - for(y = 0; y < 64; y++ ) + for (uint8_t y = 0; y < 64; y++ ) { - uint16_t *p = &bitmap.pix16(y); - palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); + uint16_t *p = &bitmap.pix(y); + int const palette_offset = recalc_palette_offset(m_p_videoram[y*128+125]&3, m_p_videoram[y*128+126]&3); - for (x = ma; x < ma + 128; x++) + for (uint16_t x = ma; x < ma + 128; x++) { - col = palette_offset+(m_p_videoram[x|(y<<7)]&3); + uint8_t const col = palette_offset+(m_p_videoram[x|(y<<7)]&3); *p++ = colormap[col]; } ma+=128; diff --git a/src/mame/video/cheekyms.cpp b/src/mame/video/cheekyms.cpp index ffbb90db6aa..438084a922d 100644 --- a/src/mame/video/cheekyms.cpp +++ b/src/mame/video/cheekyms.cpp @@ -151,7 +151,6 @@ void cheekyms_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clipre uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x; int scrolly = ((*m_port_80 >> 3) & 0x07); int flip = *m_port_80 & 0x80; @@ -168,9 +167,9 @@ uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm m_cm_tilemap->draw(screen, *m_bitmap_buffer, cliprect, 0, 0); /* draw the tilemap to the final bitmap applying the scroll to the man character */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int in_man_area; @@ -185,13 +184,13 @@ uint32_t cheekyms_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (in_man_area) { - if ((y + scrolly) < 27 * 8 && m_bitmap_buffer->pix16(y + scrolly, x) != 0) - bitmap.pix16(y, x) = m_bitmap_buffer->pix16(y + scrolly, x); + if ((y + scrolly) < 27 * 8 && m_bitmap_buffer->pix(y + scrolly, x) != 0) + bitmap.pix(y, x) = m_bitmap_buffer->pix(y + scrolly, x); } else { - if(m_bitmap_buffer->pix16(y, x) != 0) - bitmap.pix16(y, x) = m_bitmap_buffer->pix16(y, x); + if(m_bitmap_buffer->pix(y, x) != 0) + bitmap.pix(y, x) = m_bitmap_buffer->pix(y, x); } } } diff --git a/src/mame/video/circus.cpp b/src/mame/video/circus.cpp index e70aad8cb83..dfcfeb51ad5 100644 --- a/src/mame/video/circus.cpp +++ b/src/mame/video/circus.cpp @@ -54,35 +54,34 @@ void circus_state::draw_line( bitmap_ind16 &bitmap, const rectangle &cliprect, i if (x1 == x2) for (count = y2; count >= y1; count -= skip) - bitmap.pix16(count, x1) = 1; + bitmap.pix(count, x1) = 1; else for (count = x2; count >= x1; count -= skip) - bitmap.pix16(y1, count) = 1; + bitmap.pix(y1, count) = 1; } void circus_state::draw_sprite_collision( bitmap_ind16 &bitmap, const rectangle &cliprect ) { gfx_element *sprite_gfx = m_gfxdecode->gfx(1); const uint8_t *sprite_data = sprite_gfx->get_data(m_clown_z); - int sx, sy, dx, dy; - int pixel, collision = 0; + int collision = 0; // draw sprite and check collision on a pixel basis - for (sy = 0; sy < 16; sy++) + for (int sy = 0; sy < 16; sy++) { - dy = m_clown_x + sy-1; + int dy = m_clown_x + sy-1; if (dy>=0 && dy<bitmap.height()) { - for (sx = 0; sx < 16; sx++) + for (int sx = 0; sx < 16; sx++) { - dx = m_clown_y + sx; + int dx = m_clown_y + sx; if (dx>=0 && dx<bitmap.width()) { - pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; + int pixel = sprite_data[sy * sprite_gfx->rowbytes() + sx]; if (pixel) { - collision |= bitmap.pix16(dy, dx); - bitmap.pix16(dy, dx) = m_palette->pen(pixel); + collision |= bitmap.pix(dy, dx); + bitmap.pix(dy, dx) = m_palette->pen(pixel); } } } diff --git a/src/mame/video/cloak.cpp b/src/mame/video/cloak.cpp index 92208ef7ac4..24dd7a086de 100644 --- a/src/mame/video/cloak.cpp +++ b/src/mame/video/cloak.cpp @@ -178,15 +178,13 @@ void cloak_state::video_start() void cloak_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - pen_t pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; + pen_t const pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; if (pen) - bitmap.pix16(y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen; + bitmap.pix(y, (x - 6) & 0xff) = 0x10 | ((x & 0x80) >> 4) | pen; } } diff --git a/src/mame/video/cloud9.cpp b/src/mame/video/cloud9.cpp index c3debb52445..bb9cb18ae98 100644 --- a/src/mame/video/cloud9.cpp +++ b/src/mame/video/cloud9.cpp @@ -223,22 +223,21 @@ void cloud9_state::cloud9_bitmode_addr_w(offs_t offset, uint8_t data) uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *spriteaddr = m_spriteram; - int flip = m_videolatch->q5_r() ? 0xff : 0x00; /* PLAYER2 */ - pen_t black = m_palette->black_pen(); - int x, y, offs; + uint8_t const *const spriteaddr = m_spriteram; + int const flip = m_videolatch->q5_r() ? 0xff : 0x00; /* PLAYER2 */ + pen_t const black = m_palette->black_pen(); /* draw the sprites */ m_spritebitmap.fill(0x00, cliprect); - for (offs = 0; offs < 0x20; offs++) + for (int offs = 0; offs < 0x20; offs++) if (spriteaddr[offs + 0x00] != 0) { - int x = spriteaddr[offs + 0x60]; - int y = 256 - 15 - spriteaddr[offs + 0x00]; - int xflip = spriteaddr[offs + 0x40] & 0x80; - int yflip = spriteaddr[offs + 0x40] & 0x40; - int which = spriteaddr[offs + 0x20]; - int color = 0; + int const x = spriteaddr[offs + 0x60]; + int const y = 256 - 15 - spriteaddr[offs + 0x00]; + int const xflip = spriteaddr[offs + 0x40] & 0x80; + int const yflip = spriteaddr[offs + 0x40] & 0x40; + int const which = spriteaddr[offs + 0x20]; + int const color = 0; m_gfxdecode->gfx(0)->transpen(m_spritebitmap,cliprect, which, color, xflip, yflip, x, y, 0); if (x >= 256 - 16) @@ -246,30 +245,28 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); /* if we're in the VBLANK region, just fill with black */ if (~m_syncprom[y] & 2) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } /* non-VBLANK region: merge the sprites and the bitmap */ else { - uint16_t *mosrc = &m_spritebitmap.pix16(y); - int effy = y ^ flip; - uint8_t *src[2]; + uint16_t const *const mosrc = &m_spritebitmap.pix(y); + int const effy = y ^ flip; /* two videoram arrays */ - src[0] = &m_videoram[0x4000 | (effy * 64)]; - src[1] = &m_videoram[0x0000 | (effy * 64)]; + uint8_t const *const src[2]{ &m_videoram[0x4000 | (effy * 64)], &m_videoram[0x0000 | (effy * 64)] }; /* loop over X */ - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) @@ -278,11 +275,11 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 /* otherwise, process normally */ else { - int effx = x ^ flip; + int const effx = x ^ flip; /* low 4 bits = left pixel, high 4 bits = right pixel */ uint8_t pix = (src[(effx >> 1) & 1][effx / 4] >> ((~effx & 1) * 4)) & 0x0f; - uint8_t mopix = mosrc[x]; + uint8_t const mopix = mosrc[x]; /* sprites have priority if sprite pixel != 0 or some other condition */ if (mopix != 0) diff --git a/src/mame/video/copsnrob.cpp b/src/mame/video/copsnrob.cpp index 109f13fcf9b..5ea31ff2c68 100644 --- a/src/mame/video/copsnrob.cpp +++ b/src/mame/video/copsnrob.cpp @@ -12,16 +12,12 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs, x, y; - /* redrawing the entire display is faster in this case */ - for (offs = m_videoram.bytes(); offs >= 0; offs--) + for (int offs = m_videoram.bytes(); offs >= 0; offs--) { - int sx,sy; - - sx = 31 - (offs % 32); - sy = offs / 32; + int const sx = 31 - (offs % 32); + int const sy = offs / 32; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, m_videoram[offs] & 0x3f,0, @@ -66,7 +62,7 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in care of the problem of displaying multiple beer trucks and of scrolling truck images smoothly off the top of the screen. */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { /* y is going up the screen, but the truck window RAM locations go down the screen. */ @@ -104,27 +100,25 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in They are flickered on/off every frame by the software, so don't play it with frameskip 1 or 3, as they could become invisible */ - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { - int bullet, mask1, mask2, val; - - val = m_bulletsram[x]; + int const val = m_bulletsram[x]; // Check for the most common case if (!(val & 0x0f)) continue; - mask1 = 0x01; - mask2 = 0x10; + int mask1 = 0x01; + int mask2 = 0x10; // Check each bullet - for (bullet = 0; bullet < 4; bullet++) + for (int bullet = 0; bullet < 4; bullet++) { if (val & mask1) { - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) if (m_bulletsram[y] & mask2) - bitmap.pix16(y, 256 - x) = 1; + bitmap.pix(y, 256 - x) = 1; } mask1 <<= 1; diff --git a/src/mame/video/cosmic.cpp b/src/mame/video/cosmic.cpp index f8fa7e1f4e5..12a9f6c6673 100644 --- a/src/mame/video/cosmic.cpp +++ b/src/mame/video/cosmic.cpp @@ -227,9 +227,9 @@ void cosmic_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect if (data & 0x80) { if (flip_screen()) - bitmap.pix16(255-y, 255-x) = pen; + bitmap.pix(255-y, 255-x) = pen; else - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } x++; @@ -308,7 +308,7 @@ void cosmic_state::cosmica_draw_starfield( screen_device &screen, bitmap_ind16 & /* RGB order is reversed -- bit 7=R, 6=G, 5=B */ int col = (map >> 7) | ((map >> 5) & 0x02) | ((map >> 3) & 0x04); - bitmap.pix16(y, x) = col; + bitmap.pix(y, x) = col; } x++; @@ -323,23 +323,20 @@ void cosmic_state::cosmica_draw_starfield( screen_device &screen, bitmap_ind16 & void cosmic_state::devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint8_t y; - uint8_t *horz_PROM = memregion("user2")->base(); - uint8_t *vert_PROM = memregion("user3")->base(); + uint8_t const *const horz_PROM = memregion("user2")->base(); + uint8_t const *const vert_PROM = memregion("user3")->base(); offs_t horz_addr = 0; uint8_t count = 0; uint8_t horz_data = 0; uint8_t vert_data; - for (y = 32; y < 224; y++) + for (int y = 32; y < 224; y++) { uint8_t x = 0; while (1) { - int x1; - /* for the vertical lines, each bit indicates if there should be a line at the x position */ vert_data = vert_PROM[x >> 3]; @@ -356,15 +353,15 @@ void cosmic_state::devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cli if (count == 0) horz_data = horz_PROM[horz_addr++]; - for (x1 = 0; x1 < 8; x1++) + for (int x1 = 0; x1 < 8; x1++) { if (!(vert_data & horz_data & 0x80)) /* NAND gate */ { /* blue */ if (flip_screen()) - bitmap.pix16(255-y, 255-x) = 4; + bitmap.pix(255-y, 255-x) = 4; else - bitmap.pix16(y, x) = 4; + bitmap.pix(y, x) = 4; } horz_data = (horz_data << 1) | 0x01; @@ -481,9 +478,9 @@ void cosmic_state::nomnlnd_draw_background( screen_device &screen, bitmap_ind16 if (color != 0) { if (flip_screen()) - bitmap.pix16(255-y, 255-x) = color; + bitmap.pix(255-y, 255-x) = color; else - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } x++; diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp index 16191c7f57e..1670851c092 100644 --- a/src/mame/video/cps1.cpp +++ b/src/mame/video/cps1.cpp @@ -3145,8 +3145,7 @@ void cps2_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitma void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; - uint8_t *stars_rom = m_region_stars->base(); + uint8_t const *const stars_rom = m_region_stars->base(); if (!stars_rom && (m_stars_enabled[0] || m_stars_enabled[1])) { @@ -3158,7 +3157,7 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, if (m_stars_enabled[0]) { - for (offs = 0; offs < m_stars_rom_size / 2; offs++) + for (int offs = 0; offs < m_stars_rom_size / 2; offs++) { int col = stars_rom[8 * offs + 4]; if (col != 0x0f) @@ -3176,14 +3175,14 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0xa00 + col; + bitmap.pix(sy, sx) = 0xa00 + col; } } } if (m_stars_enabled[1]) { - for (offs = 0; offs < m_stars_rom_size / 2; offs++) + for (int offs = 0; offs < m_stars_rom_size / 2; offs++) { int col = stars_rom[8*offs]; if (col != 0x0f) @@ -3201,7 +3200,7 @@ void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0x800 + col; + bitmap.pix(sy, sx) = 0x800 + col; } } } diff --git a/src/mame/video/crbaloon.cpp b/src/mame/video/crbaloon.cpp index 2de79bf7b2f..d1da8d7cc97 100644 --- a/src/mame/video/crbaloon.cpp +++ b/src/mame/video/crbaloon.cpp @@ -118,12 +118,12 @@ void crbaloon_state::draw_sprite_and_check_collision(bitmap_ind16 &bitmap) /* draw the current pixel, but check collision first */ if (bit) { - if (bitmap.pix16(sy, sx) & 0x01) + if (bitmap.pix(sy, sx) & 0x01) /* compute the collision address -- the +1 is via observation of the game code, probably wrong for cocktail mode */ m_collision_address = ((((sy ^ 0xff) >> 3) << 5) | ((sx ^ 0xff) >> 3)) + 1; - bitmap.pix16(sy, sx) = (color << 1) | 1; + bitmap.pix(sy, sx) = (color << 1) | 1; } sx = sx + 1; diff --git a/src/mame/video/crgolf.cpp b/src/mame/video/crgolf.cpp index a12e514fc68..43d5bb8802f 100644 --- a/src/mame/video/crgolf.cpp +++ b/src/mame/video/crgolf.cpp @@ -68,13 +68,9 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 { int flip = m_screen_flip; - offs_t offs; - /* for each byte in the video RAM */ - for (offs = 0; offs < VIDEORAM_SIZE / 3; offs++) + for (offs_t offs = 0; offs < VIDEORAM_SIZE / 3; offs++) { - int i; - uint8_t y = (offs & 0x1fe0) >> 5; uint8_t x = (offs & 0x001f) << 3; @@ -92,7 +88,7 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 } /* for each pixel in the byte */ - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { offs_t color; uint8_t data_b = 0; @@ -114,7 +110,7 @@ uint32_t crgolf_state::screen_update_crgolf(screen_device &screen, bitmap_ind16 if (m_color_select) color = color | 0x10; - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; /* next pixel */ data_a0 = data_a0 << 1; diff --git a/src/mame/video/crt.cpp b/src/mame/video/crt.cpp index 68af26f59ba..d8ee79d1bde 100644 --- a/src/mame/video/crt.cpp +++ b/src/mame/video/crt.cpp @@ -134,19 +134,16 @@ void crt_device::eof() // void crt_device::update(bitmap_ind16 &bitmap) { - int i, p_i; - int y; - //if (m_decay_counter) { /* some time has elapsed: let's update the screen */ - for (y=0; y<m_window_height; y++) + for (int y=0; y<m_window_height; y++) { - uint16_t *line = &bitmap.pix16(y+m_window_offset_y); + uint16_t *const line = &bitmap.pix(y+m_window_offset_y); - p_i = -1; + int p_i = -1; - for (i=m_list_head[y]; (i != -1); i=m_list[i].next) + for (int i=m_list_head[y]; (i != -1); i=m_list[i].next) { crt_point *node = &m_list[i]; int x = (i % m_window_width) + m_window_offset_x; diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp index 243ebd384de..a8327bde897 100644 --- a/src/mame/video/cvs.cpp +++ b/src/mame/video/cvs.cpp @@ -135,13 +135,12 @@ VIDEO_START_MEMBER(cvs_state,cvs) uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 }; - offs_t offs; int scroll[8]; set_pens(); /* draw the background */ - for (offs = 0; offs < 0x0400; offs++) + for (offs_t offs = 0; offs < 0x0400; offs++) { int collision_color = 0x100; uint8_t code = m_video_ram[offs]; @@ -194,63 +193,56 @@ uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitma bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect); /* Bullet Hardware */ - for (offs = 8; offs < 256; offs++ ) + for (offs_t offs = 8; offs < 256; offs++ ) { if (m_bullet_ram[offs] != 0) { - int ct; - for (ct = 0; ct < 4; ct++) + for (int ct = 0; ct < 4; ct++) { int bx = 255 - 7 - m_bullet_ram[offs] - ct; /* Bullet/Object Collision */ - if ((s2636_0_bitmap.pix16(offs, bx) != 0) || - (s2636_1_bitmap.pix16(offs, bx) != 0) || - (s2636_2_bitmap.pix16(offs, bx) != 0)) + if ((s2636_0_bitmap.pix(offs, bx) != 0) || + (s2636_1_bitmap.pix(offs, bx) != 0) || + (s2636_2_bitmap.pix(offs, bx) != 0)) m_collision_register |= 0x08; /* Bullet/Background Collision */ - if (m_palette->pen_indirect(m_scrolled_collision_background.pix16(offs, bx))) + if (m_palette->pen_indirect(m_scrolled_collision_background.pix(offs, bx))) m_collision_register |= 0x80; - bitmap.pix16(offs, bx) = BULLET_STAR_PEN; + bitmap.pix(offs, bx) = BULLET_STAR_PEN; } } } /* mix and copy the S2636 images into the main bitmap, also check for collision */ + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - int y; - - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - int x; + int pixel0 = s2636_0_bitmap.pix(y, x); + int pixel1 = s2636_1_bitmap.pix(y, x); + int pixel2 = s2636_2_bitmap.pix(y, x); + + int pixel = pixel0 | pixel1 | pixel2; - for (x = cliprect.left(); x <= cliprect.right(); x++) + if (S2636_IS_PIXEL_DRAWN(pixel)) { - int pixel0 = s2636_0_bitmap.pix16(y, x); - int pixel1 = s2636_1_bitmap.pix16(y, x); - int pixel2 = s2636_2_bitmap.pix16(y, x); + bitmap.pix(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel); - int pixel = pixel0 | pixel1 | pixel2; + /* S2636 vs. S2636 collision detection */ + if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01; + if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; + if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04; - if (S2636_IS_PIXEL_DRAWN(pixel)) + /* S2636 vs. background collision detection */ + if (m_palette->pen_indirect(m_scrolled_collision_background.pix(y, x))) { - bitmap.pix16(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel); - - /* S2636 vs. S2636 collision detection */ - if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01; - if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; - if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04; - - /* S2636 vs. background collision detection */ - if (m_palette->pen_indirect(m_scrolled_collision_background.pix16(y, x))) - { - if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; - if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20; - if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; - } + if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; + if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20; + if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; } } } @@ -275,21 +267,18 @@ void cvs_state::cvs_scroll_stars( ) void cvs_state::cvs_init_stars( ) { int generator = 0; - int x, y; /* precalculate the star background */ m_total_stars = 0; - for (y = 255; y >= 0; y--) + for (int y = 255; y >= 0; y--) { - for (x = 511; x >= 0; x--) + for (int x = 511; x >= 0; x--) { - int bit1, bit2; - generator <<= 1; - bit1 = (~generator >> 17) & 1; - bit2 = (generator >> 5) & 1; + int const bit1 = (~generator >> 17) & 1; + int const bit2 = (generator >> 5) & 1; if (bit1 ^ bit2) generator |= 1; @@ -328,8 +317,8 @@ void cvs_state::cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect y = ~y; if ((y >= cliprect.top()) && (y <= cliprect.bottom()) && - (update_always || (m_palette->pen_indirect(bitmap.pix16(y, x)) == 0))) - bitmap.pix16(y, x) = star_pen; + (update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0))) + bitmap.pix(y, x) = star_pen; } } } diff --git a/src/mame/video/cyberbal.cpp b/src/mame/video/cyberbal.cpp index 053cde7ae86..1f5cb34f233 100644 --- a/src/mame/video/cyberbal.cpp +++ b/src/mame/video/cyberbal.cpp @@ -233,13 +233,12 @@ uint32_t cyberbal_base_state::update_one_screen(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = curmob.first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not verified: logic is all controlled in a PAL - */ + // not verified: logic is all controlled in a PAL pf[x] = mo[x]; } } diff --git a/src/mame/video/cybstorm.cpp b/src/mame/video/cybstorm.cpp index 70c071be563..b27c73824c8 100644 --- a/src/mame/video/cybstorm.cpp +++ b/src/mame/video/cybstorm.cpp @@ -131,13 +131,13 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x]) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -149,7 +149,7 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* foreground playfield case */ if (pri[x] & 0x80) { - int pfpriority = (pri[x] >> 2) & 3; + int const pfpriority = (pri[x] >> 2) & 3; if (mopriority > pfpriority) pf[x] = (mo[x] & atari_motion_objects_device::DATA_MASK) | 0x1000; @@ -158,7 +158,7 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* background playfield case */ else { - int pfpriority = pri[x] & 3; + int const pfpriority = pri[x] & 3; /* playfield priority 3 always wins */ if (pfpriority == 3) @@ -177,8 +177,8 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); int count = 0; for (int x = rect->left(); x <= rect->right() || (count && x < bitmap.width()); x++) { diff --git a/src/mame/video/dai.cpp b/src/mame/video/dai.cpp index 13891a8cda9..a5c7488b12a 100644 --- a/src/mame/video/dai.cpp +++ b/src/mame/video/dai.cpp @@ -50,12 +50,11 @@ void dai_state::dai_palette(palette_device &palette) const uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space &space = m_maincpu->space(AS_PROGRAM); - int i, j, k, l; - uint8_t* char_rom = memregion("chargen")->base(); + uint8_t const *const char_rom = memregion("chargen")->base(); - uint16_t dai_video_memory_start = 0xbfff; - uint16_t dai_scan_lines = 604; /* scan lines of PAL tv */ + uint16_t const dai_video_memory_start = 0xbfff; + uint16_t const dai_scan_lines = 604; /* scan lines of PAL tv */ uint16_t current_scan_line = 0; uint16_t current_video_memory_address = dai_video_memory_start; @@ -85,12 +84,8 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c 01 - four colour characters 10 - sixteen colour graphics 11 - sixteen colour characters */ - uint8_t unit_mode; - uint8_t current_data_1, current_data_2; - uint8_t current_colour; - while (current_scan_line < dai_scan_lines) { mode = space.read_byte(current_video_memory_address--); @@ -98,7 +93,7 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c line_repeat_count = mode & 0x0f; horizontal_resolution = (mode & 0x30) >> 4; display_mode = (mode & 0xc0) >> 6; - unit_mode = (colour & 0x40) >> 6; + uint8_t const unit_mode = (colour & 0x40) >> 6; if (colour & 0x80) m_4_colours_palette[(colour & 0x30) >> 4] = colour & 0x0f; @@ -115,32 +110,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -154,32 +149,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -193,31 +188,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -231,31 +226,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_1>>(7-k)) & 0x01)<<1) | ((current_data_2>>(7-k)) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -275,33 +270,33 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -316,33 +311,33 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -357,32 +352,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -396,32 +391,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address); current_data_2 = space.read_byte(current_video_memory_address-1); current_video_memory_address-=2; - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = m_4_colours_palette[(((current_data_2 >> k)&0x01)<<1) | ((char_rom[current_data_1*16+j]>>k) & 0x01)]; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -440,32 +435,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -479,32 +474,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -518,31 +513,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -556,31 +551,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((current_data_1>>(7-k)) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } @@ -598,32 +593,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<11; i++) + for (int i=0; i<11; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<12; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<12; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*12+l) = current_colour; } } } @@ -637,32 +632,32 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } current_video_memory_address-=2; break; case 1: - for (i=0; i<22; i++) + for (int i=0; i<22; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<6; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<6; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*6+l) = current_colour; } } } @@ -676,31 +671,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } break; case 1: - for (i=0; i<44; i++) + for (int i=0; i<44; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<3; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<3; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*3+l) = current_colour; } } } @@ -713,31 +708,31 @@ uint32_t dai_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c case 0: current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } break; case 1: - for (i=0; i<66; i++) + for (int i=0; i<66; i++) { current_data_1 = space.read_byte(current_video_memory_address--); current_data_2 = space.read_byte(current_video_memory_address--); - for (j=0; j<=line_repeat_count; j++) + for (int j=0; j<=line_repeat_count; j++) { - for (k=0; k<8; k++) + for (int k=0; k<8; k++) { - current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; - for (l=0; l<2; l++) - bitmap.pix16(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; + uint8_t const current_colour = ((char_rom[current_data_1*16+j]>>k) & 0x01) ? (current_data_2>>4)&0x0f : current_data_2&0x0f; + for (int l=0; l<2; l++) + bitmap.pix(current_scan_line/2 + j, (i*8+k)*2+l) = current_colour; } } } diff --git a/src/mame/video/darkmist.cpp b/src/mame/video/darkmist.cpp index 9cc0bbd7d45..4a213bf967d 100644 --- a/src/mame/video/darkmist.cpp +++ b/src/mame/video/darkmist.cpp @@ -103,12 +103,12 @@ void darkmist_state::mix_layer(screen_device &screen, bitmap_ind16 &bitmap, cons { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &m_temp_bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &m_temp_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t pix = (src[x] & 0xff); - uint16_t real = clut[pix]; + uint16_t const pix = (src[x] & 0xff); + uint16_t const real = clut[pix]; if (!(real & 0x40)) dest[x] = src[x]; diff --git a/src/mame/video/dassault.cpp b/src/mame/video/dassault.cpp index 5d8c4accad8..77e887cea3b 100644 --- a/src/mame/video/dassault.cpp +++ b/src/mame/video/dassault.cpp @@ -31,25 +31,21 @@ void dassault_state::video_start() void dassault_state::mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite_bitmap, const rectangle &cliprect, uint16_t pri, uint16_t primask, uint16_t penbase, uint8_t alpha) { - int y, x; - const pen_t *paldata = &m_palette->pen(0); + pen_t const *const paldata = &m_palette->pen(0); - uint16_t* srcline; - uint32_t* dstline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top(); y<=cliprect.bottom(); y++) { - srcline=&sprite_bitmap->pix16(y,0); - dstline=&bitmap.pix32(y,0); + uint16_t const *const srcline = &sprite_bitmap->pix(y, 0); + uint32_t *const dstline = &bitmap.pix(y, 0); - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left(); x<=cliprect.right(); x++) { uint16_t pix = srcline[x]; if ((pix & primask) != pri) continue; - if (pix&0xf) + if (pix & 0xf) { uint16_t pen = pix&0x1ff; if (pix & 0x800) pen += 0x200; diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp index 02f530d70d1..2f50d3877a3 100644 --- a/src/mame/video/dcheese.cpp +++ b/src/mame/video/dcheese.cpp @@ -6,10 +6,11 @@ **************************************************************************/ - #include "emu.h" #include "includes/dcheese.h" +#include <algorithm> + /************************************* * @@ -116,8 +117,8 @@ u32 dcheese_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co /* update the pixels */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); - u16 *src = &m_dstbitmap->pix16((y + m_blitter_vidparam[0x28/2]) & 0x1ff); + u16 *const dest = &bitmap.pix(y); + u16 const *const src = &m_dstbitmap->pix((y + m_blitter_vidparam[0x28/2]) & 0x1ff); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = src[x]; @@ -137,7 +138,7 @@ void dcheese_state::do_clear() { /* clear the requested scanlines */ for (int y = m_blitter_vidparam[0x2c/2]; y < m_blitter_vidparam[0x2a/2]; y++) - memset(&m_dstbitmap->pix16(y & 0x1ff), 0, DSTBITMAP_WIDTH * 2); + std::fill_n(&m_dstbitmap->pix(y & 0x1ff), DSTBITMAP_WIDTH, 0); /* signal an IRQ when done (timing is just a guess) */ m_signal_irq_timer->adjust(m_screen->scan_period(), 1); @@ -168,7 +169,7 @@ void dcheese_state::do_blit() /* loop over target rows */ for (int y = ystart; y <= yend; y++) { - u16 *dst = &m_dstbitmap->pix16(y & 0x1ff); + u16 *const dst = &m_dstbitmap->pix(y & 0x1ff); /* loop over target columns */ for (int x = xstart; x <= xend; x++) diff --git a/src/mame/video/dday.cpp b/src/mame/video/dday.cpp index b18a56db2bd..71b6c51297d 100644 --- a/src/mame/video/dday.cpp +++ b/src/mame/video/dday.cpp @@ -302,19 +302,17 @@ uint32_t dday_state::screen_update_dday(screen_device &screen, bitmap_ind16 &bit if (m_sl_enable) { /* apply shadow */ - int x, y; - bitmap_ind16 &sl_bitmap = m_sl_tilemap->pixmap(); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t src_pixel = m_main_bitmap.pix16(y, x); + uint16_t src_pixel = m_main_bitmap.pix(y, x); - if (sl_bitmap.pix16(y, x) == 0xff) + if (sl_bitmap.pix(y, x) == 0xff) src_pixel += m_palette->entries(); - bitmap.pix16(y, x) = src_pixel; + bitmap.pix(y, x) = src_pixel; } } else diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp index ed80c87ec33..a4ed651c7b8 100644 --- a/src/mame/video/decbac06.cpp +++ b/src/mame/video/decbac06.cpp @@ -316,8 +316,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, src_y += cliprect.top(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *dstpix = &bitmap.pix16(y); - u8 *dstpri = &primap.pix8(y); + u16 *dstpix = &bitmap.pix(y); + u8 *dstpri = &primap.pix(y); if (row_scroll_enabled) src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3] & 0xf)) & (0x1ff >> (control1[3] & 0xf))]; else @@ -332,8 +332,8 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, if (col_scroll_enabled) column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2] & 0xf)) & (0x3f >> (control1[2] & 0xf))]; - const u16 p = src_bitmap.pix16((src_y + column_offset) & height_mask, src_x & width_mask); - const u8 colpri = flags_bitmap.pix8((src_y + column_offset) & height_mask, src_x & width_mask); + const u16 p = src_bitmap.pix((src_y + column_offset) & height_mask, src_x & width_mask); + const u8 colpri = flags_bitmap.pix((src_y + column_offset) & height_mask, src_x & width_mask); const bool is_drawn = ((flags & TILEMAP_DRAW_OPAQUE) || ((colpri & TILEMAP_PIXEL_LAYER0) && (flags & TILEMAP_DRAW_LAYER0)) || diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index 497ccc1bb37..39564a86c9d 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -494,21 +494,21 @@ void deco16ic_device::custom_tilemap_draw( else column_offset = 0; - u16 p = src_bitmap0->pix16((src_y + column_offset) & height_mask, src_x); - u8 f = src_flagsmap0->pix8((src_y + column_offset) & height_mask, src_x); + u16 p = src_bitmap0->pix((src_y + column_offset) & height_mask, src_x); + u8 f = src_flagsmap0->pix((src_y + column_offset) & height_mask, src_x); if (src_bitmap1) { - f |= src_flagsmap1->pix8((src_y + column_offset) & height_mask, src_x) & ~TILEMAP_DRAW_CATEGORY_MASK; + f |= src_flagsmap1->pix((src_y + column_offset) & height_mask, src_x) & ~TILEMAP_DRAW_CATEGORY_MASK; if (!m_mix_cb.isnull()) { - const u16 p2 = src_bitmap1->pix16((src_y + column_offset) & height_mask, src_x); + const u16 p2 = src_bitmap1->pix((src_y + column_offset) & height_mask, src_x); p = m_mix_cb(p, p2); } else { // does boogie wings actually use this, or is the tattoo assassin code correct in this mode? - p |= (src_bitmap1->pix16((src_y + column_offset) & height_mask, src_x) & combine_mask) << combine_shift; + p |= (src_bitmap1->pix((src_y + column_offset) & height_mask, src_x) & combine_mask) << combine_shift; } } src_x = (src_x + 1) & width_mask; @@ -525,7 +525,7 @@ void deco16ic_device::custom_tilemap_draw( else dest[x] = m_gfxdecode->palette().pen(p); if (screen.priority().valid()) { - u8 *pri = &screen.priority().pix8(y); + u8 *const pri = &screen.priority().pix(y); pri[x] = (pri[x] & pmask) | priority; } } diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index afc17a93a69..6a225cc1c42 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -261,11 +261,11 @@ void nslasher_state::mix_nslasher(screen_device &screen, bitmap_rgb32 &bitmap, c /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); - const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); - const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); - const u8* tilemapPri = &screen.priority().pix8(y); - u32* destLine = &bitmap.pix32(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix(y); + const u8* tilemapPri = &screen.priority().pix(y); + u32* destLine = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -465,11 +465,11 @@ void nslasher_state::mix_tattass(screen_device &screen, bitmap_rgb32 &bitmap, co /* Mix sprites into main bitmap, based on priority & alpha */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* sprite0 = &sprite0_mix_bitmap.pix16(y); - const u16* sprite1 = &sprite1_mix_bitmap.pix16(y); - const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix16(y); - const u8* tilemapPri = &screen.priority().pix8(y); - u32* destLine = &bitmap.pix32(y); + const u16* sprite0 = &sprite0_mix_bitmap.pix(y); + const u16* sprite1 = &sprite1_mix_bitmap.pix(y); + const u16* alphaTilemap = &m_tilemap_alpha_bitmap->pix(y); + const u8* tilemapPri = &screen.priority().pix(y); + u32* destLine = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/deco_mlc.cpp b/src/mame/video/deco_mlc.cpp index 40631a9622a..9c92baf65ef 100644 --- a/src/mame/video/deco_mlc.cpp +++ b/src/mame/video/deco_mlc.cpp @@ -546,8 +546,8 @@ u32 deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c for (int i = cliprect.top(); i <= cliprect.bottom(); i++) { - u32 *dest = &bitmap.pix32(i); - u8 *pri = &screen.priority().pix8(i); + u32 *dest = &bitmap.pix(i); + u8 *pri = &screen.priority().pix(i); /* printf("%d -", i); diff --git a/src/mame/video/deco_zoomspr.cpp b/src/mame/video/deco_zoomspr.cpp index 3413231f01d..e7c0871d883 100644 --- a/src/mame/video/deco_zoomspr.cpp +++ b/src/mame/video/deco_zoomspr.cpp @@ -119,21 +119,20 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( if( ex>sx ) { /* skip if inner loop doesn't draw anything */ - int y; /* case 1: no alpha */ if (alpha == 0xff) { { - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &temp_bitmap.pix32(y); - uint8_t *pri = &pri_bitmap.pix8(y); + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &temp_bitmap.pix(y); + uint8_t *const pri = &pri_bitmap.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if (c != transparent_color) @@ -161,16 +160,16 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( else { { - for( y=sy; y<ey; y++ ) + for( int y=sy; y<ey; y++ ) { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - uint32_t *dest = &temp_bitmap.pix32(y); - uint8_t *pri = &pri_bitmap.pix8(y); - uint32_t *tmapcolor = &dest_bmp.pix32(y); + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + uint32_t *const dest = &temp_bitmap.pix(y); + uint8_t *const pri = &pri_bitmap.pix(y); + uint32_t *const tmapcolor = &dest_bmp.pix(y); - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { int c = source[x_index>>16]; if (c != transparent_color) @@ -399,12 +398,12 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *src = &temp_bitmap.pix32(y); - uint32_t *dst = &bitmap.pix32(y); + uint32_t const *const src = &temp_bitmap.pix(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { - uint32_t srcpix = src[x]; + uint32_t const srcpix = src[x]; if ((srcpix & 0xff000000) == 0xff000000) { diff --git a/src/mame/video/decocass.cpp b/src/mame/video/decocass.cpp index 5cbc3d5e104..a9b0e6ea8ae 100644 --- a/src/mame/video/decocass.cpp +++ b/src/mame/video/decocass.cpp @@ -279,13 +279,13 @@ void decocass_state::draw_special_priority(bitmap_ind16 &bitmap, bitmap_ind8 &pr (dy >= 0 && dy < 64 && dx >= 0 && dx < 64 && objdata1[dy * 64 + dx] != 0)) { pri2 = true; - if (BIT(m_mode_set, 5) && priority.pix8(y, x) == 0) // least priority? - bitmap.pix16(y, x) = color; + if (BIT(m_mode_set, 5) && priority.pix(y, x) == 0) // least priority? + bitmap.pix(y, x) = color; } } if (!pri2) - bitmap.pix16(y, x) |= 0x10; + bitmap.pix(y, x) |= 0x10; } } } @@ -313,7 +313,7 @@ void decocass_state::draw_center(bitmap_ind16 &bitmap, const rectangle &cliprect if (((sy + y) & m_color_center_bot & 3) == (sy & m_color_center_bot & 3)) for (x = 0; x < 256; x++) if (0 != (x & 16) || 0 != (m_center_h_shift_space & 1)) - bitmap.pix16(sy + y, (sx + x) & 255) = color; + bitmap.pix(sy + y, (sx + x) & 255) = color; } } @@ -572,16 +572,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, int missile_y_adjust, int missile_y_adjust_flip_screen, uint8_t *missile_ram, int interleave) { - int i, offs, x; - /* Draw the missiles (16 of them) seemingly with alternating colors * from the E302 latch (color_missiles) */ - for (i = 0, offs = 0; i < 8; i++, offs += 4 * interleave) + for (int i = 0, offs = 0; i < 8; i++, offs += 4 * interleave) { - int sx, sy; - - sy = 255 - missile_ram[offs + 0 * interleave]; - sx = 255 - missile_ram[offs + 2 * interleave]; + int sy = 255 - missile_ram[offs + 0 * interleave]; + int sx = 255 - missile_ram[offs + 2 * interleave]; if (flip_screen()) { sx = 240 - sx; @@ -589,12 +585,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, } sy -= missile_y_adjust; if (sy >= cliprect.top() && sy <= cliprect.bottom()) - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { if (sx >= cliprect.left() && sx <= cliprect.right()) { - bitmap.pix16(sy, sx) = (m_color_missiles & 7) | 8; - priority.pix8(sy, sx) |= 1 << 2; + bitmap.pix(sy, sx) = (m_color_missiles & 7) | 8; + priority.pix(sy, sx) |= 1 << 2; } sx++; } @@ -608,12 +604,12 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, } sy -= missile_y_adjust; if (sy >= cliprect.top() && sy <= cliprect.bottom()) - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { if (sx >= cliprect.left() && sx <= cliprect.right()) { - bitmap.pix16(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; - priority.pix8(sy, sx) |= 1 << 3; + bitmap.pix(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; + priority.pix(sy, sx) |= 1 << 3; } sx++; } @@ -657,19 +653,17 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, srcbitmap = &m_bg_tilemap_r->pixmap(); } - int y,x; - // printf("m_mode_set %d\n", m_mode_set & 0x3); // technically our y drawing probably shouldn't wrap / mask, but simply draw the 128pixel high 'edge' at the requested position // see note above this funciton - for (y=clip.top(); y<=clip.bottom(); y++) + for (int y=clip.top(); y<=clip.bottom(); y++) { int srcline = (y + scrolly) & 0x1ff; - uint16_t* src = &srcbitmap->pix16(srcline); - uint16_t* dst = &bitmap.pix16(y); + uint16_t const *const src = &srcbitmap->pix(srcline); + uint16_t *const dst = &bitmap.pix(y); - for (x=clip.left(); x<=clip.right(); x++) + for (int x=clip.left(); x<=clip.right(); x++) { int srccol = 0; @@ -683,7 +677,7 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, case 0x03: srccol = (x + scrollx) & 0x1ff; break; // hwy, burnrub etc. } - uint16_t pix = src[srccol]; + uint16_t const pix = src[srccol]; if ((pix & 0x3) || opaque) dst[x] = pix; diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp index 4d6f61a3238..6450af9e97d 100644 --- a/src/mame/video/decodmd1.cpp +++ b/src/mame/video/decodmd1.cpp @@ -261,37 +261,35 @@ void decodmd_type1_device::device_reset() uint32_t decodmd_type1_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) { uint8_t ptr = 0; - uint8_t x,y,dot; - uint32_t data1,data2,data3,data4; - uint32_t col; if(m_frameswap) ptr = 0x80; - for(y=0;y<16;y++) // scanline + for(uint8_t y=0;y<16;y++) // scanline { - for(x=0;x<128;x+=64) + for(uint8_t x=0;x<128;x+=64) { - data1 = m_pixels[ptr]; - data2 = m_pixels[ptr+1]; - data3 = m_pixels[ptr+2]; - data4 = m_pixels[ptr+3]; - for(dot=0;dot<64;dot+=2) + uint32_t data1 = m_pixels[ptr]; + uint32_t data2 = m_pixels[ptr+1]; + uint32_t data3 = m_pixels[ptr+2]; + uint32_t data4 = m_pixels[ptr+3]; + for(uint8_t dot=0;dot<64;dot+=2) { + uint32_t col; if((data1 & 0x01) != (data3 & 0x01)) col = rgb_t(0x7f,0x55,0x00); else if (data1 & 0x01) // both are the same, so either high intensity or none at all col = rgb_t(0xff,0xaa,0x00); else col = rgb_t::black(); - bitmap.pix32(y,x+dot) = col; + bitmap.pix(y,x+dot) = col; if((data2 & 0x01) != (data4 & 0x01)) col = rgb_t(0x7f,0x55,0x00); else if (data2 & 0x01) // both are the same, so either high intensity or none at all col = rgb_t(0xff,0xaa,0x00); else col = rgb_t::black(); - bitmap.pix32(y,x+dot+1) = col; + bitmap.pix(y,x+dot+1) = col; data1 >>= 1; data2 >>= 1; data3 >>= 1; diff --git a/src/mame/video/decodmd2.cpp b/src/mame/video/decodmd2.cpp index 2bb975e2f61..81b3cad15ec 100644 --- a/src/mame/video/decodmd2.cpp +++ b/src/mame/video/decodmd2.cpp @@ -102,16 +102,15 @@ TIMER_DEVICE_CALLBACK_MEMBER(decodmd_type2_device::dmd_firq) MC6845_UPDATE_ROW( decodmd_type2_device::crtc_update_row ) { - uint8_t *RAM = m_ram->pointer(); - uint8_t intensity; + uint8_t const *const RAM = m_ram->pointer(); uint16_t addr = (ma & 0xfc00) + ((ma & 0x100)<<2) + (ra << 4); for (int x = 0; x < 128; x += 8) { for (int dot = 0; dot < 8; dot++) { - intensity = ((RAM[addr] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x200] >> (7-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + uint8_t intensity = ((RAM[addr] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x200] >> (7-dot) & 0x01); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } addr++; } diff --git a/src/mame/video/decodmd3.cpp b/src/mame/video/decodmd3.cpp index 34d26f5bde4..6a7a2a94902 100644 --- a/src/mame/video/decodmd3.cpp +++ b/src/mame/video/decodmd3.cpp @@ -110,12 +110,12 @@ MC6845_UPDATE_ROW( decodmd_type3_device::crtc_update_row ) for (int dot = 0; dot < 8; dot++) { intensity = ((RAM[addr + 1] >> (7-dot) & 0x01) << 1) | (RAM[addr + 0x801] >> (7-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } for (int dot = 8; dot < 16; dot++) { intensity = ((RAM[addr] >> (15-dot) & 0x01) << 1) | (RAM[addr + 0x800] >> (15-dot) & 0x01); - bitmap.pix32(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); + bitmap.pix(y, x + dot) = rgb_t(0x3f * intensity, 0x2a * intensity, 0x00); } addr += 2; } diff --git a/src/mame/video/decospr.cpp b/src/mame/video/decospr.cpp index a86c21976b8..1d085dd5869 100644 --- a/src/mame/video/decospr.cpp +++ b/src/mame/video/decospr.cpp @@ -563,26 +563,22 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const if (!m_sprite_bitmap.valid()) fatalerror("decospr_device::inefficient_copy_sprite_bitmap with no m_sprite_bitmap\n"); - int y, x; - const pen_t *paldata = m_gfxdecode->palette().pens(); + pen_t const *const paldata = m_gfxdecode->palette().pens(); - uint16_t* srcline; - uint32_t* dstline; - - for (y=cliprect.top();y<=cliprect.bottom();y++) + for (int y=cliprect.top();y<=cliprect.bottom();y++) { - srcline= &m_sprite_bitmap.pix16(y); - dstline= &bitmap.pix32(y); + uint16_t const *const srcline= &m_sprite_bitmap.pix(y); + uint32_t *const dstline= &bitmap.pix(y); if (alpha==0xff) { - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { - uint16_t pix = srcline[x]; + uint16_t const pix = srcline[x]; if (pix&0xf) { - if ((pix & priority_mask) ==pri ) + if ((pix & priority_mask) == pri) { dstline[x] = paldata[(pix&palmask) + colbase]; } @@ -591,16 +587,16 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const } else { - for (x=cliprect.left();x<=cliprect.right();x++) + for (int x=cliprect.left();x<=cliprect.right();x++) { - uint16_t pix = srcline[x]; + uint16_t const pix = srcline[x]; if (pix&m_pixmask) { - if ((pix & priority_mask) ==pri ) + if ((pix & priority_mask) == pri) { - uint32_t pal1 = paldata[(pix&palmask) + colbase]; - uint32_t pal2 = dstline[x]; + uint32_t const pal1 = paldata[(pix&palmask) + colbase]; + uint32_t const pal2 = dstline[x]; dstline[x] = alpha_blend_r32(pal2, pal1, alpha); } } diff --git a/src/mame/video/deniam.cpp b/src/mame/video/deniam.cpp index 439c15026ae..c5676be36e1 100644 --- a/src/mame/video/deniam.cpp +++ b/src/mame/video/deniam.cpp @@ -236,9 +236,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] & 0x0f); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -255,9 +255,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16+(rom[i] >> 4); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -278,9 +278,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] >> 4); + screen.priority().pix(y, sx + x) = 8; } } x++; @@ -297,9 +297,9 @@ void deniam_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { if (cliprect.contains(sx + x, y)) { - if ((screen.priority().pix8(y, sx + x) & primask) == 0) - bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); - screen.priority().pix8(y, sx + x) = 8; + if ((screen.priority().pix(y, sx + x) & primask) == 0) + bitmap.pix(y, sx + x) = color * 16 + (rom[i] & 0x0f); + screen.priority().pix(y, sx + x) = 8; } } x++; diff --git a/src/mame/video/dgn_beta.cpp b/src/mame/video/dgn_beta.cpp index 8d1795f2e72..1850f89f815 100644 --- a/src/mame/video/dgn_beta.cpp +++ b/src/mame/video/dgn_beta.cpp @@ -100,9 +100,9 @@ the access to the video memory is unclear to me at the moment. MC6845_UPDATE_ROW( dgn_beta_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint8_t *videoram = m_videoram; - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint8_t const *const videoram = m_videoram; + uint32_t *p = &bitmap.pix(y); int i; if(IsTextMode) { diff --git a/src/mame/video/dkong.cpp b/src/mame/video/dkong.cpp index bab2c20a215..91dbfba9031 100644 --- a/src/mame/video/dkong.cpp +++ b/src/mame/video/dkong.cpp @@ -796,25 +796,22 @@ void dkong_state::radarscp_step(int line_cnt) void dkong_state::radarscp_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { const uint8_t *htable = nullptr; - int x,y; - uint8_t draw_ok; - uint16_t *pixel; if (m_hardware_type == HARDWARE_TRS01) htable = m_gfx4; - y = cliprect.min_y; + int y = cliprect.min_y; while (y <= cliprect.max_y) { - x = cliprect.min_x; + int x = cliprect.min_x; while (x <= cliprect.max_x) { - pixel = &bitmap.pix16(y, x); - draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02); + uint16_t *const pixel = &bitmap.pix(y, x); + uint8_t draw_ok = !(*pixel & 0x01) && !(*pixel & 0x02); if (m_hardware_type == HARDWARE_TRS01) /* Check again from schematics */ draw_ok = draw_ok && !((htable[ (!m_rflip_sig<<7) | (x>>2)] >>2) & 0x01); if (draw_ok) - *pixel = *(&m_bg_bits.pix16(y, x)); + *pixel = m_bg_bits.pix(y, x); x++; } y++; @@ -823,21 +820,19 @@ void dkong_state::radarscp_draw_background(bitmap_ind16 &bitmap, const rectangle void dkong_state::radarscp_scanline(int scanline) { - const uint8_t *table = m_gfx3; + uint8_t const *const table = m_gfx3; int table_len = m_gfx3_len; - int x,y,offset; - uint16_t *pixel; const rectangle &visarea = m_screen->visible_area(); - y = scanline; + int y = scanline; radarscp_step(y); if (y <= visarea.min_y || y > visarea.max_y) m_counter = 0; - offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400; - x = 0; + int offset = (m_flip ^ m_rflip_sig) ? 0x000 : 0x400; + int x = 0; while (x < m_screen->width()) { - pixel = &m_bg_bits.pix16(y, x); + uint16_t *const pixel = &m_bg_bits.pix(y, x); if ((m_counter < table_len) && (x == 4 * (table[m_counter|offset] & 0x7f))) { if ( m_star_ff && (table[m_counter|offset] & 0x80) ) /* star */ @@ -852,7 +847,7 @@ void dkong_state::radarscp_scanline(int scanline) *pixel = RADARSCP_BCK_COL_OFFSET + m_blue_level; x++; } - while ((m_counter < table_len) && ( x < 4 * (table[m_counter|offset] & 0x7f))) + while ((m_counter < table_len) && (x < 4 * (table[m_counter|offset] & 0x7f))) m_counter++; } diff --git a/src/mame/video/dogfgt.cpp b/src/mame/video/dogfgt.cpp index 154e2d2380a..a8e3ee9fa8f 100644 --- a/src/mame/video/dogfgt.cpp +++ b/src/mame/video/dogfgt.cpp @@ -116,9 +116,9 @@ void dogfgt_state::internal_bitmapram_w(offs_t offset, uint8_t data) color |= ((m_bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i; if (flip_screen()) - m_pixbitmap.pix16(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + m_pixbitmap.pix(y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; else - m_pixbitmap.pix16(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; + m_pixbitmap.pix(y, x + subx) = PIXMAP_COLOR_BASE + 8 * m_pixcolor + color; } } diff --git a/src/mame/video/dpb_combiner.cpp b/src/mame/video/dpb_combiner.cpp index 29819661e35..48440eeec02 100644 --- a/src/mame/video/dpb_combiner.cpp +++ b/src/mame/video/dpb_combiner.cpp @@ -206,7 +206,7 @@ void dpb7000_combiner_card_device::fsck_tick() { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x && x < 256; x++) { *dest++ = 0xff000000 | (m_lum_out << 16) | (m_lum_out << 8) | m_lum_out; diff --git a/src/mame/video/dribling.cpp b/src/mame/video/dribling.cpp index a8e40930674..510dccb5c5e 100644 --- a/src/mame/video/dribling.cpp +++ b/src/mame/video/dribling.cpp @@ -62,7 +62,7 @@ uint32_t dribling_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // loop over rows for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); // loop over columns for (int x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp index 0fd9007937c..6cdbf33beca 100644 --- a/src/mame/video/dynax.cpp +++ b/src/mame/video/dynax.cpp @@ -647,7 +647,6 @@ VIDEO_START_MEMBER(dynax_state,neruton) void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &cliprect, int i ) { int color; - int scrollx, scrolly; switch (i) { @@ -660,8 +659,8 @@ void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &clipr color += (m_blit_palbank & 0x0f) * 16; - scrollx = m_blit_scroll_x; - scrolly = m_blit_scroll_y; + int scrollx = m_blit_scroll_x; + int scrolly = m_blit_scroll_y; if (i == 1 && (m_layer_layout == LAYOUT_HANAMAI || m_layer_layout == LAYOUT_HNORIDUR)) { @@ -670,16 +669,16 @@ void dynax_state::hanamai_copylayer(bitmap_ind16 &bitmap, const rectangle &clipr } { - int dy, length, pen; - uint8_t *src1 = m_pixmap[i][1].get(); - uint8_t *src2 = m_pixmap[i][0].get(); + uint8_t const *src1 = m_pixmap[i][1].get(); + uint8_t const *src2 = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { + int length, pen; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16((dy - scrolly) & 0xff); + uint16_t *const dstbase = &bitmap.pix((dy - scrolly) & 0xff); length = scrollx; dst = dstbase + 2 * (256 - length); @@ -736,17 +735,17 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli } { - int dy, length, pen; - uint8_t *src1 = m_pixmap[i][1].get(); - uint8_t *src2 = m_pixmap[i][0].get(); + uint8_t const *src1 = m_pixmap[i][1].get(); + uint8_t const *src2 = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { - int sy = ((dy - scrolly) & 0xff) + y; + int length, pen; + int const sy = ((dy - scrolly) & 0xff) + y; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16(sy); + uint16_t *const dstbase = &bitmap.pix(sy); if ((sy < cliprect.top()) || (sy > cliprect.bottom())) { @@ -784,7 +783,6 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli void dynax_state::mjdialq2_copylayer( bitmap_ind16 &bitmap, const rectangle &cliprect, int i ) { int color; - int scrollx, scrolly; switch (i) { @@ -795,19 +793,19 @@ void dynax_state::mjdialq2_copylayer( bitmap_ind16 &bitmap, const rectangle &cli color += (m_blit_palbank & 1) * 16; - scrollx = m_blit_scroll_x; - scrolly = m_blit_scroll_y; + int const scrollx = m_blit_scroll_x; + int const scrolly = m_blit_scroll_y; { - int dy, length, pen; - uint8_t *src = m_pixmap[i][0].get(); + uint8_t const *src = m_pixmap[i][0].get(); - int palbase = 16 * color; + int const palbase = 16 * color; - for (dy = 0; dy < 256; dy++) + for (int dy = 0; dy < 256; dy++) { + int length, pen; uint16_t *dst; - uint16_t *dstbase = &bitmap.pix16((dy - scrolly) & 0xff); + uint16_t *const dstbase = &bitmap.pix((dy - scrolly) & 0xff); length = scrollx; dst = dstbase + 256 - length; diff --git a/src/mame/video/dynduke.cpp b/src/mame/video/dynduke.cpp index 6d6295411a4..2f0fff57946 100644 --- a/src/mame/video/dynduke.cpp +++ b/src/mame/video/dynduke.cpp @@ -164,9 +164,6 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr { /* The transparency / palette handling on the background layer is very strange */ bitmap_ind16 &bm = m_bg_layer->pixmap(); - int scrolly, scrollx; - int x,y; - /* if we're disabled, don't draw */ if (!m_back_enable) { @@ -174,8 +171,8 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr return; } - scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7); - scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7); + int scrolly = ((m_scroll_ram[0x01]&0x30)<<4)+((m_scroll_ram[0x02]&0x7f)<<1)+((m_scroll_ram[0x02]&0x80)>>7); + int scrollx = ((m_scroll_ram[0x09]&0x30)<<4)+((m_scroll_ram[0x0a]&0x7f)<<1)+((m_scroll_ram[0x0a]&0x80)>>7); if (flip_screen()) { @@ -183,14 +180,14 @@ void dynduke_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipr scrollx = 256 - scrollx; } - for (y=0;y<256;y++) + for (int y=0;y<256;y++) { int realy = (y + scrolly) & 0x1ff; - uint16_t *src = &bm.pix16(realy); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &bm.pix(realy); + uint16_t *const dst = &bitmap.pix(y); - for (x=0;x<256;x++) + for (int x=0;x<256;x++) { int realx = (x + scrollx) & 0x1ff; uint16_t srcdat = src[realx]; diff --git a/src/mame/video/elan_eu3a05vid.cpp b/src/mame/video/elan_eu3a05vid.cpp index 46f39a1975e..5ea11e30bd9 100644 --- a/src/mame/video/elan_eu3a05vid.cpp +++ b/src/mame/video/elan_eu3a05vid.cpp @@ -245,11 +245,11 @@ void elan_eu3a05vid_device::draw_sprites(screen_device &screen, bitmap_ind16 &bi if (flags & 0x08) // guess flipy { - row = &bitmap.pix16((y + (sizey - 1 - yy)) & 0xff); + row = &bitmap.pix((y + (sizey - 1 - yy)) & 0xff); } else { - row = &bitmap.pix16((y + yy) & 0xff); + row = &bitmap.pix((y + yy) & 0xff); } for (int xx = 0; xx < sizex; xx++) @@ -457,7 +457,7 @@ void elan_eu3a05vid_device::draw_tilemaps(screen_device& screen, bitmap_ind16& b tile += ((m_tile_gfxbase_lo_data | m_tile_gfxbase_hi_data << 8) << 5); - uint16_t* row = &bitmap.pix16(drawline); + uint16_t *const row = &bitmap.pix(drawline); if (m_vidctrl & 0x20) // 4bpp { diff --git a/src/mame/video/elan_eu3a14vid.cpp b/src/mame/video/elan_eu3a14vid.cpp index bf7d92eb0ac..9f31ef164fc 100644 --- a/src/mame/video/elan_eu3a14vid.cpp +++ b/src/mame/video/elan_eu3a14vid.cpp @@ -252,8 +252,8 @@ void elan_eu3a14vid_device::draw_background_tile(bitmap_ind16& bitmap, const rec // RAM tile layer has no scrolling? (or we've never seen it used / enabled) } - uint16_t* dst = &bitmap.pix16(ypos + y); - uint8_t* pridst = &m_prioritybitmap.pix8(ypos + y); + uint16_t *const dst = &bitmap.pix(ypos + y); + uint8_t *const pridst = &m_prioritybitmap.pix(ypos + y); for (int x = 0; x < xstride; x++) { @@ -692,8 +692,8 @@ void elan_eu3a14vid_device::draw_sprite_line(screen_device &screen, bitmap_ind16 if (ypos >= cliprect.min_y && ypos <= cliprect.max_y) { - uint16_t* dst = &bitmap.pix16(ypos); - uint8_t* pridst = &m_prioritybitmap.pix8(ypos); + uint16_t *const dst = &bitmap.pix(ypos); + uint8_t *const pridst = &m_prioritybitmap.pix(ypos); int count = 0; for (int x = 0; x < 8/bppdiv;x++) diff --git a/src/mame/video/electron.cpp b/src/mame/video/electron.cpp index e506a4e930c..352e4710769 100644 --- a/src/mame/video/electron.cpp +++ b/src/mame/video/electron.cpp @@ -80,7 +80,7 @@ inline uint8_t electron_state::read_vram( uint16_t addr ) inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/eolith.cpp b/src/mame/video/eolith.cpp index c31fea64fc2..fa18bbb3709 100644 --- a/src/mame/video/eolith.cpp +++ b/src/mame/video/eolith.cpp @@ -34,7 +34,7 @@ uint32_t eolith_state::screen_update_eolith(screen_device &screen, bitmap_ind16 { for (int x = 0; x < 320; x++) { - bitmap.pix16(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; + bitmap.pix(y, x) = m_vram[(0x40000/2) * (m_buffer ^ 1) + (y * 336) + x] & 0x7fff; } } diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp index 91a0b77299f..886582a9a3e 100644 --- a/src/mame/video/epos.cpp +++ b/src/mame/video/epos.cpp @@ -89,13 +89,13 @@ uint32_t epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, if (flip_screen()) { - bitmap.pix32(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix32(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + bitmap.pix(240 - y, 270 - x + 1) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(240 - y, 270 - x + 0) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); } else { - bitmap.pix32(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); - bitmap.pix32(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); + bitmap.pix(y, x + 0) = m_palette->pen((m_palette_bank << 4) | (data & 0x0f)); + bitmap.pix(y, x + 1) = m_palette->pen((m_palette_bank << 4) | (data >> 4)); } } diff --git a/src/mame/video/eprom.cpp b/src/mame/video/eprom.cpp index fad474f1502..2150f9c37ff 100644 --- a/src/mame/video/eprom.cpp +++ b/src/mame/video/eprom.cpp @@ -221,8 +221,8 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -266,15 +266,15 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b * * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected */ - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int pfpriority = (pf[x] >> 4) & 3; - int forcemc0 = 0, shade = 1, pfm = 1, m7 = 0; + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 4) & 3; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) continue; /* compute the FORCEMC signal */ + int forcemc0 = 0; if (!(pf[x] & 8)) { if (((pfpriority == 3) && !(mopriority & 1)) || @@ -284,12 +284,14 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b } /* compute the SHADE signal */ + int shade = 1; if (((mo[x] & 0x0f) != 1) || ((mo[x] & 0xf0) == 0) || forcemc0) shade = 0; /* compute the PF/M signal */ + int pfm = 1; if ((mopriority == 3) || (pf[x] & 8) || (!(pfpriority & 1) && (mopriority & 2)) || @@ -299,6 +301,7 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b pfm = 0; /* compute the M7 signal */ + int m7 = 0; if ((mo[x] & 0x0f) == 1) m7 = 1; @@ -327,12 +330,12 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) @@ -368,13 +371,13 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; - int pfpriority = (pf[x] >> 5) & 3; + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; + int const pfpriority = (pf[x] >> 5) & 3; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -393,12 +396,12 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/equites.cpp b/src/mame/video/equites.cpp index 26f64b55e9b..a0193cdebeb 100644 --- a/src/mame/video/equites.cpp +++ b/src/mame/video/equites.cpp @@ -350,7 +350,7 @@ void splndrbt_state::splndrbt_draw_sprites(bitmap_ind16 &bitmap, const rectangle int pen = srcgfx[offset]; if ((transmask & (1 << pen)) == 0) - bitmap.pix16(y, bx) = paldata[pen]; + bitmap.pix(y, bx) = paldata[pen]; } } } @@ -383,9 +383,9 @@ void splndrbt_state::splndrbt_copy_bg(bitmap_ind16 &dst_bitmap, const rectangle if (dst_y >= cliprect.top() && dst_y <= cliprect.bottom()) { const uint8_t * const romline = &xrom[(dst_y ^ dinvert) << 5]; - const uint16_t * const src_line = &src_bitmap.pix16((src_y + scroll_y) & 0x1ff); - const uint8_t * const flags_line = &flags_bitmap.pix8((src_y + scroll_y) & 0x1ff); - uint16_t * const dst_line = &dst_bitmap.pix16(dst_y); + const uint16_t * const src_line = &src_bitmap.pix((src_y + scroll_y) & 0x1ff); + const uint8_t * const flags_line = &flags_bitmap.pix((src_y + scroll_y) & 0x1ff); + uint16_t * const dst_line = &dst_bitmap.pix(dst_y); int dst_x = 0; int src_x; diff --git a/src/mame/video/esripsys.cpp b/src/mame/video/esripsys.cpp index 9db24deaa78..fd6e4b33aeb 100644 --- a/src/mame/video/esripsys.cpp +++ b/src/mame/video/esripsys.cpp @@ -151,18 +151,17 @@ void esripsys_state::video_start() uint32_t esripsys_state::screen_update_esripsys(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - struct line_buffer_t *line_buffer = m_line_buffer; - int x, y; + struct line_buffer_t *const line_buffer = m_line_buffer; - uint8_t *colour_buf = line_buffer[m_12sel ? 0 : 1].colour_buf.get(); - uint8_t *intensity_buf = line_buffer[m_12sel ? 0 : 1].intensity_buf.get(); - uint8_t *priority_buf = line_buffer[m_12sel ? 0 : 1].priority_buf.get(); + uint8_t *const colour_buf = line_buffer[m_12sel ? 0 : 1].colour_buf.get(); + uint8_t *const intensity_buf = line_buffer[m_12sel ? 0 : 1].intensity_buf.get(); + uint8_t *const priority_buf = line_buffer[m_12sel ? 0 : 1].priority_buf.get(); - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix(y, cliprect.min_x); - for (x = 0; x < 512; ++x) + for (int x = 0; x < 512; ++x) { int idx = colour_buf[x]; int r = (m_pal_ram[idx] & 0xf); diff --git a/src/mame/video/exidy.cpp b/src/mame/video/exidy.cpp index 8c7146a847d..2df9ef5470d 100644 --- a/src/mame/video/exidy.cpp +++ b/src/mame/video/exidy.cpp @@ -134,12 +134,10 @@ void exidy_state::draw_background() for (offs = 0; offs < 0x400; offs++) { - uint8_t cy; - pen_t on_pen_1, on_pen_2; - uint8_t y = offs >> 5 << 3; - uint8_t code = m_videoram[offs]; + uint8_t const code = m_videoram[offs]; + pen_t on_pen_1, on_pen_2; if (m_is_2bpp) { on_pen_1 = 4 + ((code >> 6) & 0x02); @@ -151,9 +149,8 @@ void exidy_state::draw_background() on_pen_2 = off_pen; /* unused */ } - for (cy = 0; cy < 8; cy++) + for (uint8_t cy = 0; cy < 8; cy++) { - int i; uint8_t x = offs << 3; if (m_is_2bpp) @@ -161,16 +158,16 @@ void exidy_state::draw_background() uint8_t data1 = m_characterram[0x000 | (code << 3) | cy]; uint8_t data2 = m_characterram[0x800 | (code << 3) | cy]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { if (data1 & 0x80) - m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; + m_background_bitmap.pix(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; else - m_background_bitmap.pix16(y, x) = off_pen; + m_background_bitmap.pix(y, x) = off_pen; - x = x + 1; - data1 = data1 << 1; - data2 = data2 << 1; + x++; + data1 <<= 1; + data2 <<= 1; } } /* 1bpp */ @@ -178,16 +175,16 @@ void exidy_state::draw_background() { uint8_t data = m_characterram[(code << 3) | cy]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen; + m_background_bitmap.pix(y, x) = (data & 0x80) ? on_pen_1 : off_pen; - x = x + 1; - data = data << 1; + x++; + data <<= 1; } } - y = y + 1; + y++; } } } @@ -282,7 +279,6 @@ void exidy_state::check_collision() const rectangle clip(0, 15, 0, 15); int org_1_x = 0, org_1_y = 0; int org_2_x = 0, org_2_y = 0; - int sx, sy; int count = 0; /* if there is nothing to detect, bail */ @@ -312,27 +308,27 @@ void exidy_state::check_collision() m_motion_object_2_clip.fill(0xff, clip); if (sprite_1_enabled()) { - sx = org_2_x - org_1_x; - sy = org_2_y - org_1_y; + int sx = org_2_x - org_1_x; + int sy = org_2_y - org_1_y; m_gfxdecode->gfx(0)->transpen(m_motion_object_2_clip,clip, ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, 0, 0, sx, sy, 0); } /* scan for collisions */ - for (sy = 0; sy < 16; sy++) - for (sx = 0; sx < 16; sx++) + for (int sy = 0; sy < 16; sy++) + for (int sx = 0; sx < 16; sx++) { - if (m_motion_object_1_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_1_vid.pix(sy, sx) != 0xff) { uint8_t current_collision_mask = 0; /* check for background collision (M1CHAR) */ - if (m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0) + if (m_background_bitmap.pix(org_1_y + sy, org_1_x + sx) != 0) current_collision_mask |= 0x04; /* check for motion object collision (M1M2) */ - if (m_motion_object_2_clip.pix16(sy, sx) != 0xff) + if (m_motion_object_2_clip.pix(sy, sx) != 0xff) current_collision_mask |= 0x10; /* if we got one, trigger an interrupt */ @@ -340,10 +336,10 @@ void exidy_state::check_collision() timer_set(m_screen->time_until_pos(org_1_x + sx, org_1_y + sy), TIMER_COLLISION_IRQ, current_collision_mask); } - if (m_motion_object_2_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_2_vid.pix(sy, sx) != 0xff) { /* check for background collision (M2CHAR) */ - if (m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0) + if (m_background_bitmap.pix(org_2_y + sy, org_2_x + sx) != 0) if ((m_collision_mask & 0x08) && (count++ < 128)) timer_set(m_screen->time_until_pos(org_2_x + sx, org_2_y + sy), TIMER_COLLISION_IRQ, 0x08); } diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index 11c83976dfa..2106e4ac16e 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -306,7 +306,6 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c int image = (~sprite[3] & 0x3f); int xoffs = (~((sprite[1] << 8) | sprite[2]) & 0x1ff); int yoffs = (~sprite[0] & 0xff) + 1; - int x, y, sy; uint8_t *src; /* skip if out of range */ @@ -321,8 +320,8 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c xoffs -= 0x1ff; /* loop over y */ - sy = yoffs + scroll_offset; - for (y = 0; y < 16; y++, yoffs--, sy--) + int sy = yoffs + scroll_offset; + for (int y = 0; y < 16; y++, yoffs--, sy--) { /* wrap at the top and bottom of the screen */ if (sy >= VBSTART) @@ -341,7 +340,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c int currx = xoffs; /* loop over x */ - for (x = 0; x < 8; x++, old += 2) + for (int x = 0; x < 8; x++, old += 2) { int ipixel = *src++; int left = ipixel & 0xf0; @@ -353,7 +352,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { /* combine with the background */ pen = left | old[0]; - bitmap.pix16(yoffs, currx) = pen; + bitmap.pix(yoffs, currx) = pen; /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) @@ -366,7 +365,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c { /* combine with the background */ pen = right | old[1]; - bitmap.pix16(yoffs, currx) = pen; + bitmap.pix(yoffs, currx) = pen; /* check the collisions bit */ if (check_collision && (palette[2 * pen] & 0x80) && (count++ < 128)) diff --git a/src/mame/video/exterm.cpp b/src/mame/video/exterm.cpp index 7a6373fdff4..4049ab85571 100644 --- a/src/mame/video/exterm.cpp +++ b/src/mame/video/exterm.cpp @@ -64,9 +64,8 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(exterm_state::from_shiftreg_slave) TMS340X0_SCANLINE_IND16_CB_MEMBER(exterm_state::scanline_update) { - uint16_t *bgsrc = &m_master_videoram[(params->rowaddr << 8) & 0xff00]; - uint16_t *fgsrc = nullptr; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const bgsrc = &m_master_videoram[(params->rowaddr << 8) & 0xff00]; + uint16_t *const dest = &bitmap.pix(scanline); tms340x0_device::display_params fgparams; int coladdr = params->coladdr; int fgcoladdr = 0; @@ -75,6 +74,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(exterm_state::scanline_update) m_slave->get_display_params(&fgparams); /* compute info about the slave vram */ + uint16_t *fgsrc = nullptr; if (fgparams.enabled && scanline >= fgparams.veblnk && scanline < fgparams.vsblnk && fgparams.heblnk < fgparams.hsblnk) { fgsrc = &m_slave_videoram[((fgparams.rowaddr << 8) + (fgparams.yoffset << 7)) & 0xff80]; diff --git a/src/mame/video/fgoal.cpp b/src/mame/video/fgoal.cpp index fb9de83dec5..8152f58a0ad 100644 --- a/src/mame/video/fgoal.cpp +++ b/src/mame/video/fgoal.cpp @@ -40,11 +40,7 @@ void fgoal_state::video_start() uint32_t fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint8_t* VRAM = m_video_ram; - - int x; - int y; - int n; + uint8_t const *VRAM = m_video_ram; /* draw color overlay foreground and background */ @@ -83,31 +79,31 @@ uint32_t fgoal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, /* the ball has a fixed color */ - for (y = m_ypos; y < m_ypos + 8; y++) + for (int y = m_ypos; y < m_ypos + 8; y++) { - for (x = m_xpos; x < m_xpos + 8; x++) + for (int x = m_xpos; x < m_xpos + 8; x++) { if (y < 256 && x < 256) { - m_fgbitmap.pix16(y, x) = 128 + 16; + m_fgbitmap.pix(y, x) = 128 + 16; } } } /* draw bitmap layer */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* p = &bitmap.pix16(y); + uint16_t *const p = &bitmap.pix(y); - const uint16_t* FG = &m_fgbitmap.pix16(y); - const uint16_t* BG = &m_bgbitmap.pix16(y); + uint16_t const *const FG = &m_fgbitmap.pix(y); + uint16_t const *const BG = &m_bgbitmap.pix(y); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { uint8_t v = *VRAM++; - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { if (v & (1 << n)) { diff --git a/src/mame/video/firetrk.cpp b/src/mame/video/firetrk.cpp index 935cc97ed66..800cb5dd5e2 100644 --- a/src/mame/video/firetrk.cpp +++ b/src/mame/video/firetrk.cpp @@ -318,13 +318,11 @@ void firetrk_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, u void firetrk_state::check_collision(int which) { - int y, x; - - for (y = playfield_window.top(); y <= playfield_window.bottom(); y++) - for (x = playfield_window.left(); x <= playfield_window.right(); x++) + for (int y = playfield_window.top(); y <= playfield_window.bottom(); y++) + for (int x = playfield_window.left(); x <= playfield_window.right(); x++) { - pen_t a = m_helper1.pix16(y, x); - pen_t b = m_helper2.pix16(y, x); + pen_t const a = m_helper1.pix(y, x); + pen_t const b = m_helper2.pix(y, x); if (b != 0xff && (m_color1_mask >> a) & 1) m_crash[which] = 1; diff --git a/src/mame/video/fm7.cpp b/src/mame/video/fm7.cpp index 16eede8b9c9..e942d086b8b 100644 --- a/src/mame/video/fm7.cpp +++ b/src/mame/video/fm7.cpp @@ -1424,8 +1424,6 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma uint8_t code_r2 = 0,code_g2 = 0,code_b2 = 0; uint8_t code_r3 = 0,code_g3 = 0,code_b3 = 0; uint8_t code_r4 = 0,code_g4 = 0,code_b4 = 0; - uint16_t col; - int y, x, b; uint16_t page = 0x0000; if(m_video.display_video_page != 0) @@ -1436,9 +1434,9 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma if(m_video.modestatus & 0x40) // 320x200 mode { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { if(!(m_video.multi_page & 0x40)) { @@ -1461,21 +1459,22 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma code_b3 = m_video_ram[0xc000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; code_b4 = m_video_ram[0xe000 + ((y*40 + x + m_video.vram_offset2) & 0x1fff)]; } - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { + uint16_t col; col = (((code_b >> b) & 0x01) ? 8 : 0) | (((code_b2 >> b) & 0x01) ? 4 : 0) | (((code_b3 >> b) & 0x01) ? 2 : 0) | (((code_b4 >> b) & 0x01) ? 1 : 0); col |= (((code_g >> b) & 0x01) ? 128 : 0) | (((code_g2 >> b) & 0x01) ? 64 : 0) | (((code_g3 >> b) & 0x01) ? 32 : 0) | (((code_g4 >> b) & 0x01) ? 16 : 0); col |= (((code_r >> b) & 0x01) ? 2048 : 0) | (((code_r2 >> b) & 0x01) ? 1024 : 0) | (((code_r3 >> b) & 0x01) ? 512 : 0) | (((code_r4 >> b) & 0x01) ? 256 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_av_palette->pen_color(col); + bitmap.pix(y, x*8+(7-b)) = m_av_palette->pen_color(col); } } } } else { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - for (x = 0; x < 80; x++) + for (int x = 0; x < 80; x++) { if(!(m_video.multi_page & 0x40)) code_r = m_video_ram[page + 0x8000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; @@ -1483,10 +1482,10 @@ uint32_t fm7_state::screen_update_fm7(screen_device &screen, bitmap_rgb32 &bitma code_g = m_video_ram[page + 0x4000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; if(!(m_video.multi_page & 0x10)) code_b = m_video_ram[page + 0x0000 + ((y*80 + x + m_video.vram_offset) & 0x3fff)]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { - col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); - bitmap.pix32(y, x*8+(7-b)) = m_palette->pen_color(col); + uint16_t col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0); + bitmap.pix(y, x*8+(7-b)) = m_palette->pen_color(col); } } } diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp index d60da80b198..ef6515700e9 100644 --- a/src/mame/video/fmtowns.cpp +++ b/src/mame/video/fmtowns.cpp @@ -975,13 +975,10 @@ void towns_state::render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, boo void towns_state::draw_sprites(const rectangle* rect) { uint16_t sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff; - int n; - uint16_t x,y,attr,colour; uint16_t xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff; uint16_t yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff; uint32_t poffset,coffset; int linesize = m_video.towns_crtc_reg[24] * 4; - bool xflip, yflip, xhalfsize, yhalfsize, rotation; if(!(m_video.towns_sprite_reg[1] & 0x80)) return; @@ -998,17 +995,17 @@ void towns_state::draw_sprites(const rectangle* rect) for(int i = linesize; i < 0x20000; i += linesize) memcpy(vram + i, vram, linesize); - for(n=sprite_limit;n<1024;n++) + for(int n=sprite_limit;n<1024;n++) { - x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); - y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); - attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); - colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); - xflip = (attr & 0x2000) >> 13; - yflip = (attr & 0x1000) >> 12; - rotation = (attr & 0x4000) >> 14; - xhalfsize = (attr & 0x400) >> 10; - yhalfsize = (attr & 0x800) >> 11; + uint16_t x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); + uint16_t y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); + uint16_t attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); + uint16_t colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); + bool xflip = (attr & 0x2000) >> 13; + bool yflip = (attr & 0x1000) >> 12; + bool rotation = (attr & 0x4000) >> 14; + bool xhalfsize = (attr & 0x400) >> 10; + bool yhalfsize = (attr & 0x800) >> 11; if(attr & 0x8000) { @@ -1053,12 +1050,10 @@ void towns_state::draw_sprites(const rectangle* rect) void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { uint32_t off = 0; - int x; uint16_t colour; int hzoom = 1; int linesize; uint32_t scroll; - int pixel; int page = 0; bool sphscroll = !(m_video.towns_crtc_reg[28] & (layer ? 0x20 : 0x10)); @@ -1111,7 +1106,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const off += line * linesize; off &= ~1; - for(x=rect->min_x;x<rect->max_x;x+=hzoom) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom) { int offpage; int curoff; @@ -1128,8 +1123,8 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const colour = (m_towns_gfxvram[curoff+(offpage*0x40000)+1] << 8) | m_towns_gfxvram[curoff+(offpage*0x40000)]; if(!(m_video.towns_video_reg[0] & 0x10) || (m_video.towns_video_reg[1] & 0x01) != layer || colour < 0x8000) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = ((colour & 0x001f) << 3) | ((colour & 0x7c00) << 1) | ((colour & 0x03e0) << 14); @@ -1143,12 +1138,10 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline) { int off = 0; - int x; uint8_t colour; int hzoom = 1; int linesize; uint32_t scroll; - int pixel; int page = 0; bool sphscroll = !(m_video.towns_crtc_reg[28] & 0x10); @@ -1174,12 +1167,12 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect off += (subpix >> 1) & ~3; subpix = subpix & 7; - for(x=rect->min_x;x<rect->max_x;x+=hzoom) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom) { off &= 0x3ffff; colour = m_towns_gfxvram[off+(subpix >= 4 ? (subpix & 3)+0x40000 : subpix)]; - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = m_palette->pen(colour); subpix++; if(subpix == 8) { @@ -1194,12 +1187,8 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { int off = 0; - int x; - uint8_t colour; int hzoom = 1; - int linesize; uint32_t scroll; - int pixel; int page = 0; palette_device* pal = m_palette16[layer]; bool sphscroll = !(m_video.towns_crtc_reg[28] & (layer ? 0x20 : 0x10)); @@ -1215,6 +1204,7 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta // if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) // off = 0x20000; + int linesize; if(layer == 0) linesize = m_video.towns_crtc_reg[20] * 4; else @@ -1249,23 +1239,24 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta off += line * linesize; - for(x=rect->min_x;x<rect->max_x;x+=hzoom*2) + for(int x=rect->min_x;x<rect->max_x;x+=hzoom*2) { if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer + uint8_t colour; colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0 || bottom_layer) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+hzoom+pixel) = pal->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+hzoom+pixel) = pal->pen(colour); } colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0 || bottom_layer) { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = pal->pen(colour); + for (int pixel = 0; pixel < hzoom; pixel++) + bitmap.pix(scanline, x+pixel) = pal->pen(colour); } off++; if ((off - (page * 0x20000)) % linesize == 0 && sphscroll) @@ -1275,7 +1266,6 @@ void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const recta void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer) { - int line; int scanline; int bottom; int top; @@ -1294,7 +1284,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re switch(m_video.towns_video_reg[0] & 0x03) { case 0x01: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1306,7 +1296,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x02: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1318,7 +1308,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x03: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1343,7 +1333,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re switch(m_video.towns_video_reg[0] & 0x0c) { case 0x04: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1355,7 +1345,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re } break; case 0x0c: - for(line=top;line<=bottom;line++) + for(int line=top;line<=bottom;line++) { do { @@ -1376,11 +1366,7 @@ void towns_state::render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t uint32_t vram_addr; uint16_t linesize = m_video.towns_crtc_reg[24] * 4; uint8_t code_h,code_l; - uint8_t colour; - uint8_t data; - uint8_t temp; uint8_t* font_rom = m_user->base(); - int a,b; // all characters are 16 pixels high vram_addr = (x * 4) + (y * (linesize * 16)); @@ -1415,29 +1401,27 @@ void towns_state::render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t | 0x38000; } } - colour = attr & 0x07; + uint8_t colour = attr & 0x07; if(attr & 0x20) colour |= 0x08; - for(a=0;a<16;a++) // for each scanline + for(int a=0;a<16;a++) // for each scanline { + uint8_t data; if((attr & 0xc0) == 0) data = font_rom[0x180000 + rom_addr + a]; + else if((attr & 0xc0) == 0x80) + data = font_rom[0x180000 + rom_addr + (a*2)]; else - { - if((attr & 0xc0) == 0x80) - data = font_rom[0x180000 + rom_addr + (a*2)]; - else - data = font_rom[0x180000 + rom_addr + (a*2) + 1]; - } + data = font_rom[0x180000 + rom_addr + (a*2) + 1]; if(attr & 0x08) data = ~data; // inverse // and finally, put the data in VRAM - for(b=0;b<8;b+=2) + for(int b=0;b<8;b+=2) { - temp = 0; + uint8_t temp = 0; if(data & (1<<b)) temp |= ((colour & 0x0f) << 4); if(data & (1<<(b+1))) @@ -1469,11 +1453,11 @@ void towns_state::draw_text_layer() * * The video hardware renders text to VRAM layer 1, there is no separate text layer */ - int x,y,c = 0; + int c = 0; - for(y=0;y<40;y++) + for(int y=0;y<40;y++) { - for(x=0;x<80;x++) + for(int x=0;x<80;x++) { render_text_char(x,y,m_towns_txtvram[c],((m_towns_txtvram[c+0x2000] << 8)|(m_towns_txtvram[c+0x2001])),m_towns_txtvram[c+1]); c+=2; diff --git a/src/mame/video/gaelco2.cpp b/src/mame/video/gaelco2.cpp index e9c0368e8f5..26d8902f2cb 100644 --- a/src/mame/video/gaelco2.cpp +++ b/src/mame/video/gaelco2.cpp @@ -393,7 +393,7 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { /* get a pointer to the current line in the screen bitmap */ const int ypos = ((sy + ey * 16 + py) & 0x1ff); - u16 *srcy = &bitmap.pix16(ypos); + u16 *const srcy = &bitmap.pix(ypos); const int gfx_py = yflip ? (gfx->height() - 1 - py) : py; @@ -403,7 +403,7 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { /* get current pixel */ const int xpos = (((sx + ex * 16 + px) & 0x3ff) + spr_x_adjust) & 0x3ff; - u16 *pixel = srcy + xpos; + u16 *const pixel = srcy + xpos; const u16 src_color = *pixel; const int gfx_px = xflip ? (gfx->width() - 1 - px) : px; diff --git a/src/mame/video/gaelco3d.cpp b/src/mame/video/gaelco3d.cpp index 2010e5d2738..6a10b3d4ec9 100644 --- a/src/mame/video/gaelco3d.cpp +++ b/src/mame/video/gaelco3d.cpp @@ -210,8 +210,8 @@ void gaelco3d_state::gaelco3d_renderer::render_noz_noperspective(int32_t scanlin offs_t endmask = m_texture_size - 1; const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float uoz = (object.uoz_base + scanline * object.uoz_dy + startx * object.uoz_dx) * zbase; float voz = (object.voz_base + scanline * object.voz_dy + startx * object.voz_dx) * zbase; @@ -249,8 +249,8 @@ void gaelco3d_state::gaelco3d_renderer::render_normal(int32_t scanline, const ex const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; float z0 = object.z0; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float ooz = object.ooz_base + scanline * object.ooz_dy + startx * ooz_dx; float uoz = object.uoz_base + scanline * object.uoz_dy + startx * uoz_dx; @@ -299,8 +299,8 @@ void gaelco3d_state::gaelco3d_renderer::render_alphablend(int32_t scanline, cons const rgb_t *palsource = m_state.m_palette.get() + object.color; uint32_t tex = object.tex; float z0 = object.z0; - uint16_t *dest = &m_screenbits.pix16(scanline); - uint16_t *zbuf = &m_zbuffer.pix16(scanline); + uint16_t *dest = &m_screenbits.pix(scanline); + uint16_t *zbuf = &m_zbuffer.pix(scanline); int startx = extent.startx; float ooz = object.ooz_base + object.ooz_dy * scanline + startx * ooz_dx; float uoz = object.uoz_base + object.uoz_dy * scanline + startx * uoz_dx; @@ -454,7 +454,7 @@ uint32_t gaelco3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitm for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *dest = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { int offs = (yv + y - cliprect.min_y) * 4096 + xv + x - cliprect.min_x; diff --git a/src/mame/video/gaelco_wrally_sprites.cpp b/src/mame/video/gaelco_wrally_sprites.cpp index c865e658a66..b1ade9e73e1 100644 --- a/src/mame/video/gaelco_wrally_sprites.cpp +++ b/src/mame/video/gaelco_wrally_sprites.cpp @@ -99,7 +99,7 @@ void gaelco_wrally_sprites_device::draw_sprites(const rectangle &cliprect, uint1 { /* get a pointer to the current line in the screen bitmap */ int ypos = ((sy + py) & 0x1ff); - uint16_t *srcy = &m_temp_bitmap_sprites.pix16(ypos); + uint16_t *const srcy = &m_temp_bitmap_sprites.pix(ypos); int gfx_py = yflip ? (gfx->height() - 1 - py) : py; @@ -109,7 +109,7 @@ void gaelco_wrally_sprites_device::draw_sprites(const rectangle &cliprect, uint1 { /* get current pixel */ int xpos = (((sx + px) & 0x3ff) - 0x0f) & 0x3ff; - uint16_t *pixel = srcy + xpos; + uint16_t *const pixel = srcy + xpos; int gfx_px = xflip ? (gfx->width() - 1 - px) : px; /* get asociated pen for the current sprite pixel */ @@ -152,8 +152,8 @@ void gaelco_wrally_sprites_device::mix_sprites(bitmap_ind16 &bitmap, const recta { for (int y = cliprect.min_y; y < cliprect.max_y; y++) { - const uint16_t* spriteptr = &m_temp_bitmap_sprites.pix16(y); - uint16_t* dstptr = &bitmap.pix16(y); + uint16_t const *const spriteptr = &m_temp_bitmap_sprites.pix(y); + uint16_t *const dstptr = &bitmap.pix(y); for (int x = cliprect.min_x; x < cliprect.max_x; x++) { diff --git a/src/mame/video/galastrm.cpp b/src/mame/video/galastrm.cpp index 07e23705512..63a1461ed91 100644 --- a/src/mame/video/galastrm.cpp +++ b/src/mame/video/galastrm.cpp @@ -209,7 +209,7 @@ void galastrm_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c void galastrm_renderer::tc0610_draw_scanline(s32 scanline, const extent_t& extent, const gs_poly_data& object, int threadid) { - u16 *framebuffer = &m_screenbits.pix16(scanline); + u16 *const framebuffer = &m_screenbits.pix(scanline); const s32 dudx = extent.param[0].dpdx; const s32 dvdx = extent.param[1].dpdx; @@ -217,7 +217,7 @@ void galastrm_renderer::tc0610_draw_scanline(s32 scanline, const extent_t& exten s32 v = extent.param[1].start; for (int x = extent.startx; x < extent.stopx; x++) { - framebuffer[x] = object.texbase->pix16(v >> 16, u >> 16); + framebuffer[x] = object.texbase->pix(v >> 16, u >> 16); u += dudx; v += dvdx; } @@ -466,8 +466,8 @@ u32 galastrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x = 0; x < priority_bitmap.width; x++) { - u8 *pri = &priority_bitmap.pix8(y, x); - if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x)) + u8 *pri = &priority_bitmap.pix(y, x); + if (!(*pri & 0x02) && m_tmpbitmaps.pix(y, x)) *pri |= 0x04; } } @@ -510,8 +510,8 @@ u32 galastrm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c { for (int x=0; x < priority_bitmap.width(); x++) { - u8 *pri = &priority_bitmap.pix8(y, x); - if (!(*pri & 0x02) && m_tmpbitmaps.pix16(y, x)) + u8 *pri = &priority_bitmap.pix(y, x); + if (!(*pri & 0x02) && m_tmpbitmaps.pix(y, x)) *pri |= 0x04; } } diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp index 5a6377f8062..2b4d8506769 100644 --- a/src/mame/video/galaxia.cpp +++ b/src/mame/video/galaxia.cpp @@ -110,8 +110,6 @@ VIDEO_START_MEMBER(galaxia_state,astrowar) uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect); bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect); bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect); @@ -120,12 +118,12 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 cvs_update_stars(bitmap, cliprect, STAR_PEN, 1); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { - bool bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); - bool background = (bitmap.pix16(y, x) & 3) != 0; + bool const bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); + bool const background = (bitmap.pix(y, x) & 3) != 0; // draw bullets (guesswork) if (bullet) @@ -134,16 +132,16 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 if (background) m_collision_register |= 0x80; // bullet size/color/priority is guessed - bitmap.pix16(y, x) = BULLET_PEN; - if (x) bitmap.pix16(y, x-1) = BULLET_PEN; + bitmap.pix(y, x) = BULLET_PEN; + if (x) bitmap.pix(y, x-1) = BULLET_PEN; } // copy the S2636 images into the main bitmap and check collision - int pixel0 = s2636_0_bitmap.pix16(y, x); - int pixel1 = s2636_1_bitmap.pix16(y, x); - int pixel2 = s2636_2_bitmap.pix16(y, x); + int const pixel0 = s2636_0_bitmap.pix(y, x); + int const pixel1 = s2636_1_bitmap.pix(y, x); + int const pixel2 = s2636_2_bitmap.pix(y, x); - int pixel = pixel0 | pixel1 | pixel2; + int const pixel = pixel0 | pixel1 | pixel2; if (S2636_IS_PIXEL_DRAWN(pixel)) { @@ -164,7 +162,7 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40; } - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } @@ -176,8 +174,6 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // astrowar has only one S2636 - int x, y; - bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect); bitmap.fill(0, cliprect); @@ -185,43 +181,43 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect); - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { // draw bullets (guesswork) if (m_bullet_ram[y]) { - uint8_t pos = m_bullet_ram[y] ^ 0xff; + uint8_t const pos = m_bullet_ram[y] ^ 0xff; // background vs. bullet collision detection - if (m_temp_bitmap.pix16(y, pos) & 1) + if (m_temp_bitmap.pix(y, pos) & 1) m_collision_register |= 0x02; // bullet size/color/priority is guessed - bitmap.pix16(y, pos) = BULLET_PEN; - if (pos) bitmap.pix16(y, pos-1) = BULLET_PEN; + bitmap.pix(y, pos) = BULLET_PEN; + if (pos) bitmap.pix(y, pos-1) = BULLET_PEN; } - for (x = cliprect.left(); x <= cliprect.right(); x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { // NOTE: similar to zac2650.c, the sprite chip runs at a different frequency than the background generator // the exact timing ratio is unknown, so we'll have to do with guesswork - float s_ratio = 256.0f / 196.0f; + float const s_ratio = 256.0f / 196.0f; - float sx = x * s_ratio; + float const sx = x * s_ratio; if (int(sx + 0.5f) > cliprect.right()) break; // copy the S2636 bitmap into the main bitmap and check collision - int pixel = s2636_0_bitmap.pix16(y, x); + int const pixel = s2636_0_bitmap.pix(y, x); if (S2636_IS_PIXEL_DRAWN(pixel)) { // S2636 vs. background collision detection - if ((m_temp_bitmap.pix16(y, int(sx)) | m_temp_bitmap.pix16(y, int(sx + 0.5f))) & 1) + if ((m_temp_bitmap.pix(y, int(sx)) | m_temp_bitmap.pix(y, int(sx + 0.5f))) & 1) m_collision_register |= 0x01; - bitmap.pix16(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; - bitmap.pix16(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } diff --git a/src/mame/video/galaxian.cpp b/src/mame/video/galaxian.cpp index 51395d7a521..7f6d24c192c 100644 --- a/src/mame/video/galaxian.cpp +++ b/src/mame/video/galaxian.cpp @@ -905,7 +905,7 @@ void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) - bitmap.pix32(y, m_x_scale*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ star = m_stars[star_offs++]; @@ -913,8 +913,8 @@ void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 star_offs = 0; if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) { - bitmap.pix32(y, m_x_scale*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, m_x_scale*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, m_x_scale*x + 2) = m_star_color[star & 0x3f]; } } } @@ -1150,15 +1150,15 @@ inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rect x *= m_x_scale; x += m_h0_start; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; x++; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; x++; if (x >= cliprect.min_x && x <= cliprect.max_x) - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; } } diff --git a/src/mame/video/galaxold.cpp b/src/mame/video/galaxold.cpp index 51b18fc6b55..7f3a46a8238 100644 --- a/src/mame/video/galaxold.cpp +++ b/src/mame/video/galaxold.cpp @@ -531,16 +531,13 @@ VIDEO_START_MEMBER(galaxold_state,pisces) #ifdef UNUSED_FUNCTION void galaxold_state::theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i; - - /* same as Galaxian, but all bullets are yellow */ - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { x--; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = BULLETS_COLOR_BASE; + bitmap.pix(y, x) = BULLETS_COLOR_BASE; } } @@ -1040,22 +1037,16 @@ void galaxold_state::drivfrcg_modify_color(uint8_t *color) void galaxold_state::galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i; - - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { x--; if (cliprect.contains(x, y)) { - int color; - - /* yellow missile, white shells (this is the terminology on the schematics) */ - color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); + int const color = ((offs == 7*4) ? BULLETS_COLOR_BASE : BULLETS_COLOR_BASE + 1); - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } } @@ -1068,7 +1059,7 @@ void galaxold_state::scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangl if (cliprect.contains(x, y)) /* yellow bullets */ - bitmap.pix16(y, x) = BULLETS_COLOR_BASE; + bitmap.pix(y, x) = BULLETS_COLOR_BASE; } void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) @@ -1078,32 +1069,32 @@ void galaxold_state::darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle x = x - 6; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 32 + m_darkplnt_bullet_color; + bitmap.pix(y, x) = 32 + m_darkplnt_bullet_color; } void galaxold_state::dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y) { - int i, color; - if (flip_screen_x()) x++; x = x - 6; /* bullets are 2 pixels wide */ - for (i = 0; i < 2; i++) + for (int i = 0; i < 2; i++) { + int color; if (offs < 4*4) { color = BULLETS_COLOR_BASE; y--; } - else { + else + { color = BULLETS_COLOR_BASE + 1; x--; } if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } @@ -1368,7 +1359,7 @@ void galaxold_state::plot_star(bitmap_ind16 &bitmap, int x, int y, int color, co y = 255 - y; if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = m_stars_colors_start + color; + bitmap.pix(y, x) = m_stars_colors_start + color; } void galaxold_state::noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/galaxy.cpp b/src/mame/video/galaxy.cpp index a74a5631566..ab6428a993b 100644 --- a/src/mame/video/galaxy.cpp +++ b/src/mame/video/galaxy.cpp @@ -18,7 +18,6 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) { address_space &space = m_maincpu->space(AS_PROGRAM); - int y, x; if (m_interrupts_enabled == true) { uint8_t dat = BIT(m_latch_value, 2, 4); @@ -43,17 +42,17 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = m_p_chargen[(m_code & 0x7f) +(dat << 7 )] ^ 0xff; m_first = 0; } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; - - m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); - m_bitmap.pix16(y, x ) = BIT(m_code, 7); + int y = m_gal_cnt / 48 - 2; + int x = (m_gal_cnt % 48) * 8; + + m_bitmap.pix(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix(y, x ) = BIT(m_code, 7); } else { // Graphics mode @@ -70,8 +69,8 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = space.read_byte(addr) ^ 0xff; m_first = 0; } - y = m_gal_cnt / 48 - 2; - x = (m_gal_cnt % 48) * 8; + int y = m_gal_cnt / 48 - 2; + int x = (m_gal_cnt % 48) * 8; /* hack - until calc of R is fixed in Z80 */ if (x == 11 * 8 && y == 0) @@ -83,14 +82,14 @@ TIMER_CALLBACK_MEMBER(galaxy_state::gal_video) m_code = 0x00; /* end of hack */ - m_bitmap.pix16(y, x++ ) = BIT(m_code, 0); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 1); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 2); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 3); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 4); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 5); - m_bitmap.pix16(y, x++ ) = BIT(m_code, 6); - m_bitmap.pix16(y, x ) = BIT(m_code, 7); + m_bitmap.pix(y, x++ ) = BIT(m_code, 0); + m_bitmap.pix(y, x++ ) = BIT(m_code, 1); + m_bitmap.pix(y, x++ ) = BIT(m_code, 2); + m_bitmap.pix(y, x++ ) = BIT(m_code, 3); + m_bitmap.pix(y, x++ ) = BIT(m_code, 4); + m_bitmap.pix(y, x++ ) = BIT(m_code, 5); + m_bitmap.pix(y, x++ ) = BIT(m_code, 6); + m_bitmap.pix(y, x ) = BIT(m_code, 7); } } m_gal_cnt++; diff --git a/src/mame/video/galpani2.cpp b/src/mame/video/galpani2.cpp index 2168e2d219a..186be0d1c63 100644 --- a/src/mame/video/galpani2.cpp +++ b/src/mame/video/galpani2.cpp @@ -78,13 +78,13 @@ void galpani2_state::copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const int y = + ( *m_bg8_scrolly[layer] + 0x200 - 0x0f5 ); uint16_t* ram = m_bg8[layer]; - const pen_t *clut = &m_bg8palette->pen(0); + pen_t const *const clut = &m_bg8palette->pen(0); for (int xx = 0; xx < 320; xx++) { for (int yy = 0; yy < 240; yy++) { uint16_t pen = ram[(((y + yy) & 0xff) * 512) + ((x + xx) & 0x1ff)]; - if (pen) bitmap.pix32(yy, xx) = clut[pen & 0xff]; + if (pen) bitmap.pix(yy, xx) = clut[pen & 0xff]; } } } @@ -101,13 +101,13 @@ void galpani2_state::copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const //int x = 0; //int y = 0; - const pen_t *clut = &m_bg15palette->pen(0); + pen_t const *const clut = &m_bg15palette->pen(0); for (int xx = 0; xx < 320; xx++) { for (int yy = 0; yy < 240; yy++) { uint16_t pen = ram[(xx * 0x800) + yy]; - bitmap.pix32(yy, xx) = clut[pen & 0x7fff]; + bitmap.pix(yy, xx) = clut[pen & 0x7fff]; } } } diff --git a/src/mame/video/galpanic.cpp b/src/mame/video/galpanic.cpp index 994ce0b799b..a306fc143b9 100644 --- a/src/mame/video/galpanic.cpp +++ b/src/mame/video/galpanic.cpp @@ -28,18 +28,18 @@ void galpanic_state::bgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mas int sy = offset / 256; int sx = offset % 256; - m_bitmap.pix16(sy, sx) = 1024 + (data >> 1); + m_bitmap.pix(sy, sx) = 1024 + (data >> 1); } void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { for (int offs = 0;offs < m_fgvideoram.bytes()/2;offs++) { - int sx = offs % 256; - int sy = offs / 256; - int color = m_fgvideoram[offs]; + int const sx = offs % 256; + int const sy = offs / 256; + int const color = m_fgvideoram[offs]; if (color) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } diff --git a/src/mame/video/galspnbl.cpp b/src/mame/video/galspnbl.cpp index d93f8387511..d1c1c611588 100644 --- a/src/mame/video/galspnbl.cpp +++ b/src/mame/video/galspnbl.cpp @@ -22,7 +22,7 @@ void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cli int const y = offs >> 9; int const x = offs & 0x1ff; - bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1); + bitmap.pix(y, x) = 1024 + (m_bgvideoram[offs] >> 1); } } @@ -36,8 +36,8 @@ void galspnbl_state::mix_sprite_layer(screen_device &screen, bitmap_ind16 &bitma { for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint16_t *dd = &bitmap.pix16(y); - uint16_t *sd2 = &m_sprite_bitmap.pix16(y); + uint16_t *const dd = &bitmap.pix(y); + uint16_t const *const sd2 = &m_sprite_bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp index 70cfd554ac1..2aed5a48e83 100644 --- a/src/mame/video/gamate.cpp +++ b/src/mame/video/gamate.cpp @@ -274,7 +274,7 @@ uint32_t gamate_video_device::screen_update(screen_device &screen, bitmap_ind16 if (m_displayblank) pix = 0; - bitmap.pix16(y, x) = pix; + bitmap.pix(y, x) = pix; } } diff --git a/src/mame/video/gamecom.cpp b/src/mame/video/gamecom.cpp index ea987a07adc..41403441bbb 100644 --- a/src/mame/video/gamecom.cpp +++ b/src/mame/video/gamecom.cpp @@ -23,9 +23,8 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) } else { - uint8_t *line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; + uint8_t const *const line = &m_p_videoram[ m_base_address + 40 * m_scanline ]; int pal[4]; - int i; switch( m_p_ram[SM8521_LCDC] & 0x30 ) { @@ -54,13 +53,13 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_scanline) pal[3] = 0; break; } - for( i = 0; i < 40; i++ ) + for( int i = 0; i < 40; i++ ) { uint8_t p = line[i]; - m_bitmap.pix16(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; - m_bitmap.pix16(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; - m_bitmap.pix16(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; - m_bitmap.pix16(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; + m_bitmap.pix(i * 4 + 0, m_scanline) = pal[ ( p >> 6 ) & 3 ]; + m_bitmap.pix(i * 4 + 1, m_scanline) = pal[ ( p >> 4 ) & 3 ]; + m_bitmap.pix(i * 4 + 2, m_scanline) = pal[ ( p >> 2 ) & 3 ]; + m_bitmap.pix(i * 4 + 3, m_scanline) = pal[ ( p ) & 3 ]; } } diff --git a/src/mame/video/gameplan.cpp b/src/mame/video/gameplan.cpp index 85b8d5216a7..0438c012db5 100644 --- a/src/mame/video/gameplan.cpp +++ b/src/mame/video/gameplan.cpp @@ -96,16 +96,15 @@ void gameplan_state::leprechn_get_pens( pen_t *pens ) uint32_t gameplan_state::screen_update_gameplan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[GAMEPLAN_NUM_PENS]; - offs_t offs; gameplan_get_pens(pens); - for (offs = 0; offs < m_videoram_size; offs++) + for (offs_t offs = 0; offs < m_videoram_size; offs++) { uint8_t y = offs >> 8; uint8_t x = offs & 0xff; - bitmap.pix32(y, x) = pens[m_videoram[offs] & 0x07]; + bitmap.pix(y, x) = pens[m_videoram[offs] & 0x07]; } return 0; @@ -115,16 +114,15 @@ uint32_t gameplan_state::screen_update_gameplan(screen_device &screen, bitmap_rg uint32_t gameplan_state::screen_update_leprechn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[LEPRECHN_NUM_PENS]; - offs_t offs; leprechn_get_pens(pens); - for (offs = 0; offs < m_videoram_size; offs++) + for (offs_t offs = 0; offs < m_videoram_size; offs++) { uint8_t y = offs >> 8; uint8_t x = offs & 0xff; - bitmap.pix32(y, x) = pens[m_videoram[offs] & (LEPRECHN_NUM_PENS-1)]; + bitmap.pix(y, x) = pens[m_videoram[offs] & (LEPRECHN_NUM_PENS-1)]; } return 0; diff --git a/src/mame/video/gaplus.cpp b/src/mame/video/gaplus.cpp index 2691ff9bedc..ff72474ac4e 100644 --- a/src/mame/video/gaplus.cpp +++ b/src/mame/video/gaplus.cpp @@ -262,7 +262,7 @@ void gaplus_base_state::starfield_render(bitmap_ind16 &bitmap) if (x >= 0 && x < width && y >= 0 && y < height) { - bitmap.pix16(y, x) = m_stars[i].col; + bitmap.pix(y, x) = m_stars[i].col; } } } diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp index 87120366b7a..08603b09784 100644 --- a/src/mame/video/gauntlet.cpp +++ b/src/mame/video/gauntlet.cpp @@ -168,8 +168,8 @@ uint32_t gauntlet_state::screen_update_gauntlet(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/gic.cpp b/src/mame/video/gic.cpp index 9f9f8d8aff8..65deaf5b7f7 100644 --- a/src/mame/video/gic.cpp +++ b/src/mame/video/gic.cpp @@ -118,7 +118,7 @@ void gic_device::device_start() m_vblank_timer->adjust( screen().time_until_pos(1, END_ACTIVE_SCAN + 18 ), 0, screen().scan_period() ); // allocate the audio stream - m_stream = stream_alloc_legacy( 0, 1, clock()/(2*228) ); + m_stream = stream_alloc( 0, 1, clock()/(2*228) ); m_ram.resolve_safe(0xff); } @@ -147,7 +147,7 @@ void gic_device::draw_char_left(int startx, int starty, uint8_t code, bitmap_ind uint8_t curry= starty+y; for(uint8_t x=0x20;x!=0;x=x/2){ if (current&x) - m_bitmap.pix16(curry,startx+nextx) = GIC_WHITE; + m_bitmap.pix(curry,startx+nextx) = GIC_WHITE; nextx++; } } @@ -161,15 +161,15 @@ void gic_device::draw_char_right(int startx, int starty, uint8_t code, bitmap_in uint8_t nextx=0; uint8_t curry= starty+y; - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; nextx++; for(uint8_t x=0x20;x!=0;x=x/2){ - m_bitmap.pix16(curry,startx+nextx) = (current&x)?GIC_WHITE:bg_col; + m_bitmap.pix(curry,startx+nextx) = (current&x)?GIC_WHITE:bg_col; nextx++; } - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; nextx++; - m_bitmap.pix16(curry,startx+nextx) = bg_col; + m_bitmap.pix(curry,startx+nextx) = bg_col; } } @@ -252,9 +252,9 @@ void gic_device::device_timer(emu_timer &timer, device_timer_id id, int param, v #define GIC_AUDIO_BYTE 0x96 -void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) +void gic_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) { - stream_sample_t *buffer = outputs[0]; + auto &buffer = outputs[0]; //Audio is basic and badly implemented (doubt that was the intent) //The datasheet lists the 3 different frequencies the GIC can generate: 500,1000 and 2000Hz @@ -298,8 +298,7 @@ void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_ uint8_t audioByte = m_ram(GIC_AUDIO_BYTE)*2; if(!audioByte){ - for(size_t i = 0; i < samples; i++) - *buffer++ = 0; + buffer.fill(0); m_audioval = 0; m_audiocnt = 0; @@ -314,12 +313,12 @@ void gic_device::sound_stream_update_legacy(sound_stream &stream, stream_sample_ m_audioreset = 0; } - for(size_t i=0; i < samples; i++){ + for(size_t i=0; i < buffer.samples(); i++){ m_audiocnt++; if(m_audiocnt >= audioByte){ m_audioval = !m_audioval; m_audiocnt=0; } - *buffer++ = m_audioval<<13; + buffer.put(i, m_audioval ? 1.0 : 0.0); } } diff --git a/src/mame/video/gic.h b/src/mame/video/gic.h index a393b88c4e2..579ddec7b12 100644 --- a/src/mame/video/gic.h +++ b/src/mame/video/gic.h @@ -74,7 +74,7 @@ protected: virtual const tiny_rom_entry *device_rom_region() const override; // device_sound_interface overrides - virtual void sound_stream_update_legacy(sound_stream &stream, stream_sample_t const * const *inputs, stream_sample_t * const *outputs, int samples) override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; /* timers */ static const device_timer_id TIMER_VBLANK = 0; diff --git a/src/mame/video/gladiatr.cpp b/src/mame/video/gladiatr.cpp index 378c32228c2..bda3c5ed176 100644 --- a/src/mame/video/gladiatr.cpp +++ b/src/mame/video/gladiatr.cpp @@ -278,10 +278,10 @@ uint32_t ppking_state::screen_update_ppking(screen_device &screen, bitmap_ind16 int x = sx; int y = (sy + m_fg_scrolly) & 0x1ff; - uint16_t *dest = &bitmap.pix16(sy, sx); + uint16_t *dest = &bitmap.pix(sy, sx); while( x <= cliprect.max_x ) { - if( flagsbitmap.pix8(y, x)&TILEMAP_PIXEL_LAYER0 ) + if( flagsbitmap.pix(y, x)&TILEMAP_PIXEL_LAYER0 ) { *dest += 512; } diff --git a/src/mame/video/glass.cpp b/src/mame/video/glass.cpp index f0e0d89e453..c20835ac0f6 100644 --- a/src/mame/video/glass.cpp +++ b/src/mame/video/glass.cpp @@ -69,19 +69,17 @@ void glass_state::blitter_w(uint16_t data) /* fill the screen bitmap with the current picture */ { - int i, j; - - uint8_t *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; + uint8_t const *gfx = m_bmap + (m_blitter_command & 0x07) * 0x10000 + (m_blitter_command & 0x08) * 0x10000 + 0x140; if ((m_blitter_command & 0x18) != 0) { - for (j = 0; j < 200; j++) + for (int j = 0; j < 200; j++) { - for (i = 0; i < 320; i++) + for (int i = 0; i < 320; i++) { - int color = *gfx; + int const color = *gfx; gfx++; - m_screen_bitmap->pix16(j, i) = color & 0xff; + m_screen_bitmap->pix(j, i) = color & 0xff; } } } diff --git a/src/mame/video/gomoku.cpp b/src/mame/video/gomoku.cpp index d9e3c77560b..17d6c6266af 100644 --- a/src/mame/video/gomoku.cpp +++ b/src/mame/video/gomoku.cpp @@ -121,7 +121,7 @@ void gomoku_state::video_start() if (bgdata & 0x01) color = 0x21; // board (brown) if (bgdata & 0x02) color = 0x20; // frame line (while) - m_bg_bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + m_bg_bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } @@ -170,7 +170,7 @@ uint32_t gomoku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else continue; - bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } @@ -198,7 +198,7 @@ uint32_t gomoku_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } else continue; - bitmap.pix16((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; + bitmap.pix((255 - y - 1) & 0xff, (255 - x + 7) & 0xff) = color; } } } diff --git a/src/mame/video/gp9001.cpp b/src/mame/video/gp9001.cpp index 6a42ea9c6e7..04e9cac909a 100644 --- a/src/mame/video/gp9001.cpp +++ b/src/mame/video/gp9001.cpp @@ -778,8 +778,8 @@ void gp9001vdp_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip if (cliprect.contains(drawxx, drawyy)) { const u8 pix = srcdata[count]; - u16* dstptr = &bitmap.pix16(drawyy, drawxx); - u8* dstpri = &this->custom_priority_bitmap->pix8(drawyy, drawxx); + u16 *const dstptr = &bitmap.pix(drawyy, drawxx); + u8 *const dstpri = &this->custom_priority_bitmap->pix(drawyy, drawxx); if (priority >= dstpri[0]) { @@ -820,9 +820,9 @@ void gp9001vdp_device::draw_custom_tilemap( bitmap_ind16 &bitmap, const rectangl { const int realy = (y + scrolly) & 0x1ff; - u16* srcptr = &tmb.pix16(realy); - u16* dstptr = &bitmap.pix16(y); - u8* dstpriptr = &this->custom_priority_bitmap->pix8(y); + u16 const *const srcptr = &tmb.pix(realy); + u16 *const dstptr = &bitmap.pix(y); + u8 *const dstpriptr = &this->custom_priority_bitmap->pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/grchamp.cpp b/src/mame/video/grchamp.cpp index 32a359f7b87..c684ae199cb 100644 --- a/src/mame/video/grchamp.cpp +++ b/src/mame/video/grchamp.cpp @@ -115,15 +115,13 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) const rectangle &visarea = m_screen->visible_area(); int y0 = 240 - m_cpu0_out[3]; int x0 = 256 - m_cpu0_out[2]; - int x,y,sx,sy; - int pixel; int result = 0; if( which==0 ) { /* draw the current player sprite into a work bitmap */ - m_gfxdecode->gfx(4)->opaque(m_work_bitmap, + m_gfxdecode->gfx(4)->opaque(m_work_bitmap, m_work_bitmap.cliprect(), m_cpu0_out[4]&0xf, 1, /* color */ @@ -131,28 +129,28 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) 0,0 ); } - for( y = 0; y <32; y++ ) + for( int y = 0; y <32; y++ ) { - for( x = 0; x<32; x++ ) + for( int x = 0; x<32; x++ ) { - pixel = m_work_bitmap.pix16(y, x); - if( pixel != sprite_transp ){ - sx = x+x0; - sy = y+y0; + int pixel = m_work_bitmap.pix(y, x); + if( pixel != sprite_transp ) + { + int sx = x+x0; + int sy = y+y0; if(visarea->contains(sx, sy)) { // Collision check uses only 16 pens! - pixel = bitmap.pix16(sy, sx) % 16; + pixel = bitmap.pix(sy, sx) % 16; if( pixel != bgcolor ) { result = 1; /* flag collision */ /* wipe this pixel, so collision checks with the ** next layer work */ - bitmap.pix16(sy, sx) = bgcolor; + bitmap.pix(sy, sx) = bgcolor; } } } - } } return result?(1<<which):0; @@ -160,17 +158,15 @@ int grchamp_state::collision_check(bitmap_ind16 &bitmap, int which ) void grchamp_state::draw_fog(bitmap_ind16 &bitmap, const rectangle &cliprect, int fog) { - int x,y,offs; - // Emulation of analog fog effect - for (x = 0; x < 100; x++) + for (int x = 0; x < 100; x++) { - offs = 0x40; + int offs = 0x40; if(x > (100-FOG_SIZE-1)) offs = 0x40*(x-(100-FOG_SIZE-1)); - for(y=16;y<240;y++) + for(int y=16;y<240;y++) { - bitmap.pix16(y, x) = bitmap.pix16(y, x) + offs; + bitmap.pix(y, x) = bitmap.pix(y, x) + offs; } } } @@ -179,8 +175,8 @@ void grchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect { gfx_element *gfx = m_gfxdecode->gfx(5); int bank = (m_cpu0_out[0] & 0x20) ? 0x40 : 0x00; - const uint8_t *source = m_spriteram + 0x40; - const uint8_t *finish = source + 0x40; + uint8_t const *source = m_spriteram + 0x40; + uint8_t const *const finish = source + 0x40; while (source < finish) { @@ -189,7 +185,7 @@ void grchamp_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int color = source[2]; int code = source[1); - gfx->transpen(bitmap,cliprect, + gfx->transpen(bitmap,cliprect, bank + (code & 0x3f), color, code & 0x40, @@ -241,14 +237,13 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) const uint8_t *prom = memregion("proms")->base() + 0x20; gfx_element *gfx; int change = (m_cpu0_out[0] & 0x20) << 3; - int num; /* first clear to 0; this is done as the previous scanline was scanned */ memset(objdata, 0, 256); /* now draw the sprites; this is done during HBLANK */ gfx = m_gfxdecode->gfx(4); - for (num = 0; num < 16; num++) + for (int num = 0; num < 16; num++) { /* Each sprite is 4 bytes. The logic reads one byte every 2H: @@ -278,10 +273,9 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) /* the fourth byte is the X position */ int sx = m_spriteram[0x43 + dataoffs]; - int x; /* draw 16 pixels */ - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) { int dx = ~(x + sx) & 0xff; @@ -300,7 +294,7 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) /* finally draw the text characters; this is done as we read out the object buffers */ gfx = m_gfxdecode->gfx(0); - for (num = 0; num < 32; num++) + for (int num = 0; num < 32; num++) { /* The logic reads one byte every 4H, 64 bytes total: @@ -316,10 +310,9 @@ void grchamp_state::draw_objects(int y, uint8_t *objdata) int color = (m_spriteram[0x01 + dataoffs] & 0x07) << 2; int code = m_videoram[hprime | ((dy & 0xf8) << 2)] + change; const uint8_t *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes(); - int x; /* draw 8 pixels */ - for (x = 0; x < 8; x++) + for (int x = 0; x < 8; x++) { int pix = src[x ^ 7]; @@ -356,74 +349,67 @@ uint32_t grchamp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma rgb_t(RGB_MAX,RGB_MAX,RGB_MAX) }; - const pen_t *bgpen = m_palette->pens(); - const uint8_t *amedata = memregion("gfx5")->base(); - const uint8_t *headdata = memregion("gfx6")->base(); - const uint8_t *pldata = memregion("gfx7")->base(); - bitmap_ind16 &lpixmap = m_left_tilemap->pixmap(); - bitmap_ind16 &rpixmap = m_right_tilemap->pixmap(); - bitmap_ind16 &cpixmap = m_center_tilemap->pixmap(); - int lrxscroll, cxscroll, lyscroll, ryscroll, cyscroll; + pen_t const *const bgpen = m_palette->pens(); + uint8_t const *const amedata = memregion("gfx5")->base(); + uint8_t const *const headdata = memregion("gfx6")->base(); + uint8_t const *const pldata = memregion("gfx7")->base(); + bitmap_ind16 const &lpixmap = m_left_tilemap->pixmap(); + bitmap_ind16 const &rpixmap = m_right_tilemap->pixmap(); + bitmap_ind16 const &cpixmap = m_center_tilemap->pixmap(); int bgcolor = m_cpu1_out[3] & 0x10; int amebase = m_cpu0_out[4] >> 4; int plbase = m_cpu0_out[4] & 0x0f; - int cxmask; - int x, y; /* ensure that the tilemaps are the same size */ assert(lpixmap.width() == rpixmap.width() && lpixmap.width() == cpixmap.width()); assert(lpixmap.height() == rpixmap.height() && lpixmap.height() == cpixmap.height()); /* extract background scroll values; left and right share the same X scroll */ - lrxscroll = m_cpu1_out[0] + (m_cpu1_out[1] & 1) * 256; - lyscroll = m_cpu1_out[2]; - ryscroll = m_cpu1_out[7]; - cxscroll = m_cpu1_out[9] + (m_cpu1_out[10] & 1) * 256; - cyscroll = m_cpu1_out[11]; + int lrxscroll = m_cpu1_out[0] + (m_cpu1_out[1] & 1) * 256; + int lyscroll = m_cpu1_out[2]; + int ryscroll = m_cpu1_out[7]; + int cxscroll = m_cpu1_out[9] + (m_cpu1_out[10] & 1) * 256; + int cyscroll = m_cpu1_out[11]; /* determine the center background mask, controlled by attribute bit 0x20 */ - cxmask = (m_cpu1_out[3] & 0x20) ? 0xff : 0x1ff; + int cxmask = (m_cpu1_out[3] & 0x20) ? 0xff : 0x1ff; /* iterate over scanlines */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { /* select either left or right tilemaps based on Y */ - bitmap_ind16 &lrpixmap = (y < 128) ? lpixmap : rpixmap; + bitmap_ind16 const &lrpixmap = (y < 128) ? lpixmap : rpixmap; int lryscroll = (y < 128) ? lyscroll : ryscroll; /* get source/dest pointers */ /* the Y counter starts counting when VBLANK goes to 0, which is at Y=16 */ - uint16_t *lrsrc = &lrpixmap.pix16((lryscroll + y - 16) & 0xff); - uint16_t *csrc = &cpixmap.pix16((cyscroll + y - 16) & 0xff); - uint32_t *dest = &bitmap.pix32(y); + uint16_t const *const lrsrc = &lrpixmap.pix((lryscroll + y - 16) & 0xff); + uint16_t const *const csrc = &cpixmap.pix((cyscroll + y - 16) & 0xff); + uint32_t *const dest = &bitmap.pix(y); uint8_t objdata[256]; /* draw the objects for this scanline */ draw_objects(y, objdata); /* iterate over columns */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - rgb_t finalpix; int headbit = 0; int kill = 0; - int mydh, mydv; - int objpix; - int mvid; /* the X counter starts counting when HSYNC goes to 0 */ /* HYSYNC is high from X=304 through X=336; this means it has */ /* been counting from 336 through 384 before HBLANK is low */ - mvid = csrc[(cxscroll + x + (384-336)) & cxmask]; + int mvid = csrc[(cxscroll + x + (384-336)) & cxmask]; if ((mvid & 0x0f) == 0) mvid = lrsrc[(lrxscroll + x + (384-336)) & 0x1ff]; /* objdata contains the REDA/GREENA/BLUEA states */ - objpix = objdata[x]; + int objpix = objdata[x]; /* if the headlamp is visible, determine that now */ - mydh = (m_cpu0_out[2] - x) & 0xff; - mydv = (m_cpu0_out[3] - (y - 16)) & 0xff; + int mydh = (m_cpu0_out[2] - x) & 0xff; + int mydv = (m_cpu0_out[3] - (y - 16)) & 0xff; if ((m_cpu0_out[0] & 0x10) && (mydh & 0xc0) == 0xc0 && ((mydv ^ (mydv >> 1)) & 0x40) == 0) { int bits = headdata[((mydh & 0x38) >> 3) | @@ -490,7 +476,7 @@ uint32_t grchamp_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* handle collision detection between MVID and OBJECT */ if (!(m_collide & 0x1000) && (objpix & 0x08) && (mvid & 0x0f) != 0) { -osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); + osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); m_collide = 0x1000 | 0x8000 | ((~y & 0x80) << 3) | ((~y & 0xf8) << 2) | ((~x & 0xf8) >> 3); } @@ -514,6 +500,8 @@ osd_printf_debug("Collide bg/object @ (%d,%d)\n", x, y); real headlamp effect */ + rgb_t finalpix; + /* if the object data is non-zero, it gets priority */ if ((objpix & 7) != 0) finalpix = objpix_lookup[objpix & 7]; diff --git a/src/mame/video/gridlee.cpp b/src/mame/video/gridlee.cpp index 9a665c204b6..b5e4cf5320a 100644 --- a/src/mame/video/gridlee.cpp +++ b/src/mame/video/gridlee.cpp @@ -128,12 +128,10 @@ void gridlee_state::gridlee_palette_select_w(uint8_t data) uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const pen_t *pens = &m_palette->pen(m_palettebank_vis * 32); - uint8_t *gfx; - int x, y, i; + pen_t const *const pens = &m_palette->pen(m_palettebank_vis * 32); /* draw scanlines from the VRAM directly */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { /* non-flipped: draw directly from the bitmap */ if (!m_cocktail_flip) @@ -144,29 +142,27 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 { int srcy = GRIDLEE_VBSTART - 1 - y; uint8_t temp[256]; - int xx; - for (xx = 0; xx < 256; xx++) + for (int xx = 0; xx < 256; xx++) temp[xx] = m_local_videoram[srcy * 256 + 255 - xx]; draw_scanline8(bitmap, 0, y, 256, temp, pens + 16); } } /* draw the sprite images */ - gfx = memregion("gfx1")->base(); - for (i = 0; i < 32; i++) + uint8_t const *const gfx = memregion("gfx1")->base(); + for (int i = 0; i < 32; i++) { - uint8_t *sprite = m_spriteram + i * 4; - uint8_t *src; + const uint8_t *sprite = m_spriteram + i * 4; int image = sprite[0]; int ypos = sprite[2] + 17 + GRIDLEE_VBEND; int xpos = sprite[3]; /* get a pointer to the source image */ - src = &gfx[64 * image]; + const uint8_t *src = &gfx[64 * image]; /* loop over y */ - for (y = 0; y < 16; y++, ypos = (ypos + 1) & 255) + for (int y = 0; y < 16; y++, ypos = (ypos + 1) & 255) { int currxor = 0; @@ -182,7 +178,7 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 int currx = xpos; /* loop over x */ - for (x = 0; x < 4; x++) + for (int x = 0; x < 4; x++) { int ipixel = *src++; int left = ipixel >> 4; @@ -190,12 +186,12 @@ uint32_t gridlee_state::screen_update_gridlee(screen_device &screen, bitmap_ind1 /* left pixel */ if (left && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx ^ currxor) = pens[left]; + bitmap.pix(ypos, currx ^ currxor) = pens[left]; currx++; /* right pixel */ if (right && currx >= 0 && currx < 256) - bitmap.pix16(ypos, currx ^ currxor) = pens[right]; + bitmap.pix(ypos, currx ^ currxor) = pens[right]; currx++; } } diff --git a/src/mame/video/h01x.cpp b/src/mame/video/h01x.cpp index f5fac3b4f4e..900dee4b01d 100644 --- a/src/mame/video/h01x.cpp +++ b/src/mame/video/h01x.cpp @@ -10,28 +10,27 @@ uint32_t h01x_state::screen_update_h01x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx; - uint16_t sy=0,ma=0,x; - uint8_t skip = 16; + uint16_t sy=0; + uint8_t const skip = 16; //screen.set_visible_area(0, 336-1, 0, 192-1); // 336*192 = 84*4 * 12*16 // 12*16*84 - // uint16_t *p = &bitmap.pix16(sy++); + // uint16_t *p = &bitmap.pix(sy++); // _PixelType &pixt(int32_t y, int32_t x = 0) const { return *(reinterpret_cast<_PixelType *>(m_base) + y * m_rowpixels + x); } // set_raw(u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) // bitmap.rowpixels() == htotal // printf("%d ", bitmap.rowpixels()); - //uint16_t *p = &bitmap.pix16(0); - for(ra=0; ra<12; ra++) { - for(y=0; y<16; y++) { - ma = ra*84*16+y; - uint16_t *p = &bitmap.pix16(sy++); - for(x=ma; x<ma+84*skip; x+=skip) { - gfx = m_vram_ptr[x]; + //uint16_t *p = &bitmap.pix(0); + for(uint8_t ra=0; ra<12; ra++) { + for(uint8_t y=0; y<16; y++) { + uint16_t const ma = ra*84*16+y; + uint16_t *p = &bitmap.pix(sy++); + for(uint16_t x=ma; x<ma+84*skip; x+=skip) { + uint8_t const gfx = m_vram_ptr[x]; *p++ = BIT(gfx, 3); *p++ = BIT(gfx, 2); *p++ = BIT(gfx, 1); diff --git a/src/mame/video/harddriv.cpp b/src/mame/video/harddriv.cpp index 1a3b8b0f535..b8277e1d88d 100644 --- a/src/mame/video/harddriv.cpp +++ b/src/mame/video/harddriv.cpp @@ -409,15 +409,13 @@ static void display_speedups(void) TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) { - uint8_t *vram_base = &m_gsp_vram[(params->rowaddr << 12) & m_vram_mask]; + if (!m_gsp_vram) return; + uint8_t const *const vram_base = &m_gsp_vram[(params->rowaddr << 12) & m_vram_mask]; - if (!vram_base) return; - - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = (params->yoffset << 9) + ((params->coladdr & 0xff) << 4) - 15 + (m_gfx_finescroll & 0x0f); - int x; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0xfff)]; if (scanline == screen.visible_area().bottom()) @@ -427,15 +425,13 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_multisync) { - uint8_t *vram_base = &m_gsp_vram[(params->rowaddr << 11) & m_vram_mask]; - - if (!vram_base) return; + if (!m_gsp_vram) return; + uint8_t const *const vram_base = &m_gsp_vram[(params->rowaddr << 11) & m_vram_mask]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = (params->yoffset << 9) + ((params->coladdr & 0xff) << 3) - 7 + (m_gfx_finescroll & 0x07); - int x; - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0x7ff)]; if (scanline == screen.visible_area().bottom()) diff --git a/src/mame/video/hec2hrp.cpp b/src/mame/video/hec2hrp.cpp index 9212b796b80..77011d332fe 100644 --- a/src/mame/video/hec2hrp.cpp +++ b/src/mame/video/hec2hrp.cpp @@ -45,7 +45,7 @@ void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, uint8_t *page, int ymax, int int ma = 0; for (int y = 0; y <= ymax; y++) { - uint16_t *pix = &bitmap.pix16(sy++); + uint16_t *pix = &bitmap.pix(sy++); for (int x = ma; x < ma + yram; x++) { uint8_t gfx = *(page + x); @@ -71,7 +71,7 @@ void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, uint8_t *page, int ymax, in int ma = 0; for (int y = 0; y <= ymax; y++) { - uint16_t *pix = &bitmap.pix16(sy++); + uint16_t *pix = &bitmap.pix(sy++); for (int x = ma; x < ma + yram; x++) { uint8_t gfx = *(page + x); diff --git a/src/mame/video/hnayayoi.cpp b/src/mame/video/hnayayoi.cpp index ec3c6f95924..8afb5f9359b 100644 --- a/src/mame/video/hnayayoi.cpp +++ b/src/mame/video/hnayayoi.cpp @@ -200,7 +200,7 @@ void hnayayoi_state::draw_layer_interleaved(bitmap_rgb32 &bitmap, const rectangl { uint8_t *src1 = &m_pixmap[left_pixmap][(row & 255) * 256]; uint8_t *src2 = &m_pixmap[right_pixmap][(row & 255) * 256]; - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); const pen_t *pal = &m_palette->pens()[palbase * 16]; diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp index 5b24b36ae62..86d76c647a6 100644 --- a/src/mame/video/hng64.cpp +++ b/src/mame/video/hng64.cpp @@ -240,11 +240,11 @@ do { void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t *tmap, const blit_parameters *blit, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound) { - const pen_t *clut = &m_palette->pen(blit->tilemap_priority_code >> 16); + pen_t const *const clut = &m_palette->pen(blit->tilemap_priority_code >> 16); bitmap_ind8 &priority_bitmap = screen.priority(); bitmap_rgb32 &destbitmap = *blit->bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - bitmap_ind8 &flagsmap = tmap->flagsmap(); + const bitmap_ind16 &srcbitmap = tmap->pixmap(); + const bitmap_ind8 &flagsmap = tmap->flagsmap(); const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; @@ -253,27 +253,16 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * uint8_t mask = blit->mask; uint8_t value = blit->value; uint8_t alpha = blit->alpha; - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; - uint32_t *dest; - uint8_t *pri; - const uint16_t *src; - const uint8_t *maskptr; /* pre-advance based on the cliprect */ startx += blit->cliprect.min_x * incxx + blit->cliprect.min_y * incyx; starty += blit->cliprect.min_x * incxy + blit->cliprect.min_y * incyy; /* extract start/end points */ - sx = blit->cliprect.min_x; - sy = blit->cliprect.min_y; - ex = blit->cliprect.max_x; - ey = blit->cliprect.max_y; + int sx = blit->cliprect.min_x; + int sy = blit->cliprect.min_y; + int ex = blit->cliprect.max_x; + int ey = blit->cliprect.max_y; /* optimized loop for the not rotated case */ if (incxy == 0 && incyx == 0 && !wraparound) @@ -296,15 +285,15 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * if (starty < heightshifted) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty >> 16; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty >> 16; /* get source and priority pointers */ - pri = &priority_bitmap.pix8(sy, sx); - src = &srcbitmap.pix16(cy); - maskptr = &flagsmap.pix8(cy); - dest = &destbitmap.pix32(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); + uint16_t const *const src = &srcbitmap.pix(cy); + uint8_t const *const maskptr = &flagsmap.pix(cy); + uint32_t *dest = &destbitmap.pix(sy, sx); /* loop over columns */ while (x <= ex && cx < widthshifted) @@ -337,21 +326,21 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * while (sy <= ey) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; /* get dest and priority pointers */ - dest = &destbitmap.pix32(sy, sx); - pri = &priority_bitmap.pix8(sy, sx); + uint32_t *dest = &destbitmap.pix(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) { /* plot if we match the mask */ - if ((flagsmap.pix8((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) + if ((flagsmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask) & mask) == value) { - HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix16((cy >> 16) & ymask, (cx >> 16) & xmask)); + HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix((cy >> 16) & ymask, (cx >> 16) & xmask)); *pri = (*pri & (priority >> 8)) | priority; } @@ -377,22 +366,22 @@ void hng64_state::hng64_tilemap_draw_roz_core(screen_device &screen, tilemap_t * while (sy <= ey) { /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; /* get dest and priority pointers */ - dest = &destbitmap.pix32(sy, sx); - pri = &priority_bitmap.pix8(sy, sx); + uint32_t *dest = &destbitmap.pix(sy, sx); + uint8_t *pri = &priority_bitmap.pix(sy, sx); /* loop over columns */ while (x <= ex) { /* plot if we're within the bitmap and we match the mask */ if (cx < widthshifted && cy < heightshifted) - if ((flagsmap.pix8(cy >> 16, cx >> 16) & mask) == value) + if ((flagsmap.pix(cy >> 16, cx >> 16) & mask) == value) { - HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix16(cy >> 16, cx >> 16)); + HNG64_ROZ_PLOT_PIXEL(srcbitmap.pix(cy >> 16, cx >> 16)); *pri = (*pri & (priority >> 8)) | priority; } @@ -573,11 +562,7 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, } // Set the transmask so our manual copy is correct - int transmask = 0x00; - if (bppBit) - transmask = 0xff; - else - transmask = 0xf; + const int transmask = bppBit ? 0xff : 0xf; if (floorModeBit == 0x0000) { @@ -614,7 +599,7 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, //if (lineCount < visarea.height()) //{ // for (int ii = 0; ii < visarea.width(); ii++) - // bitmap.pix32((visarea.height()-lineCount), ii) = 0xff00ff00; + // bitmap.pix((visarea.height()-lineCount), ii) = 0xff00ff00; //} // HACK : Clear RAM - this is "needed" in fatfurwa since it doesn't clear its own ram (buriki does) @@ -654,13 +639,13 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, // } // else // 'simple' mode with linescroll, used in some ss64_2 levels (assumed to be correct, but doesn't do much with it.. so could be wrong) { - int32_t xtopleft, xmiddle; - int32_t ytopleft, ymiddle; - for (int line=0; line < 448; line++) { clip.min_y = clip.max_y = line; + int32_t xtopleft, xmiddle; + int32_t ytopleft, ymiddle; + if (global_zoom_disable) // disable all scrolling / zoom (test screen) (maybe) { // If this bit is active the scroll registers don't seem valid at all? @@ -713,10 +698,6 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, */ - int32_t xtopleft,xmiddle, xalt; - int32_t ytopleft,ymiddle, yalt; - int xinc, xinc2, yinc, yinc2; - #if HNG64_VIDEO_DEBUG if (0) if (tm==2) @@ -732,53 +713,44 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, /*m_videoram[(0x4001c+(scrollbase<<4))/4]);*/ // unused? (dupe value on fatfurwa, 00 on rest) #endif + int32_t xtopleft = (m_videoram[(0x40000+(scrollbase<<4))/4]); + const int32_t xalt = (m_videoram[(0x40004+(scrollbase<<4))/4]); // middle screen point + const int32_t xmiddle = (m_videoram[(0x40010+(scrollbase<<4))/4]); - xtopleft = (m_videoram[(0x40000+(scrollbase<<4))/4]); - xalt = (m_videoram[(0x40004+(scrollbase<<4))/4]); // middle screen point - xmiddle = (m_videoram[(0x40010+(scrollbase<<4))/4]); - - ytopleft = (m_videoram[(0x40008+(scrollbase<<4))/4]); - yalt = (m_videoram[(0x40018+(scrollbase<<4))/4]); // middle screen point - ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); - - xinc = (xmiddle - xtopleft) / 512; - yinc = (ymiddle - ytopleft) / 512; - xinc2 = (xalt-xtopleft) / 512; - yinc2 = (yalt-ytopleft) /512; + int32_t ytopleft = (m_videoram[(0x40008+(scrollbase<<4))/4]); + const int32_t yalt = (m_videoram[(0x40018+(scrollbase<<4))/4]); // middle screen point + const int32_t ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); + const int xinc = (xmiddle - xtopleft) / 512; + const int yinc = (ymiddle - ytopleft) / 512; + const int xinc2 = (xalt-xtopleft) / 512; + const int yinc2 = (yalt-ytopleft) /512; /* manual copy = slooow */ if (BLEND_TEST) { - bitmap_ind16 &bm = tilemap->pixmap(); - int bmheight = bm.height(); - int bmwidth = bm.width(); - const pen_t *paldata = m_palette->pens(); - uint32_t* dstptr; - uint16_t* srcptr; - int xx,yy; - + const bitmap_ind16 &bm = tilemap->pixmap(); + const int bmheight = bm.height(); + const int bmwidth = bm.width(); + pen_t const *const paldata = m_palette->pens(); - int tmp = xtopleft; - int tmp2 = ytopleft; //printf("start %08x end %08x start %08x end %08x\n", xtopleft, xmiddle, ytopleft, ymiddle); - for (yy=0;yy<448;yy++) + for (int yy=0; yy<448; yy++) { - dstptr = &bitmap.pix32(yy); + uint32_t *dstptr = &bitmap.pix(yy); - tmp = xtopleft; - tmp2 = ytopleft; + int tmp = xtopleft; + int tmp2 = ytopleft; - for (xx=0;xx<512;xx++) + for (int xx=0; xx<512; xx++) { int realsrcx = (xtopleft>>16)&(bmwidth-1); int realsrcy = (ytopleft>>16)&(bmheight-1); - uint16_t pen; - srcptr = &bm.pix16(realsrcy); + uint16_t const *const srcptr = &bm.pix(realsrcy); - pen = srcptr[realsrcx]; + uint16_t pen = srcptr[realsrcx]; if (pen&transmask) *dstptr = paldata[pen]; @@ -807,10 +779,6 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, /* in this mode they can only specify the top left and middle screen points for each tilemap, this allows simple zooming, but not rotation */ - int32_t xtopleft,xmiddle; - int32_t ytopleft,ymiddle; - int xinc,yinc; - #if HNG64_VIDEO_DEBUG if (0) if (tm==2) @@ -821,6 +789,9 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, m_videoram[(0x4001c+(scrollbase<<4))/4]); #endif + int32_t xtopleft,xmiddle; + int32_t ytopleft,ymiddle; + if (global_zoom_disable) // disable all scrolling / zoom (test screen) (maybe) { /* If this bit is active the scroll registers don't seem valid at all? @@ -842,40 +813,35 @@ void hng64_state::hng64_drawtilemap(screen_device &screen, bitmap_rgb32 &bitmap, ymiddle = (m_videoram[(0x4000c+(scrollbase<<4))/4]); // middle screen point } - xinc = (xmiddle - xtopleft) / 512; - yinc = (ymiddle - ytopleft) / 512; + const int xinc = (xmiddle - xtopleft) / 512; + const int yinc = (ymiddle - ytopleft) / 512; /* manual copy = slooow */ if (BLEND_TEST) { - bitmap_ind16 &bm = tilemap->pixmap(); - int bmheight = bm.height(); - int bmwidth = bm.width(); - const pen_t *paldata = m_palette->pens(); - uint32_t* dstptr; - uint16_t* srcptr; - int xx,yy; + const bitmap_ind16 &bm = tilemap->pixmap(); + const int bmheight = bm.height(); + const int bmwidth = bm.width(); + pen_t const *const paldata = m_palette->pens(); int tmp = xtopleft; //printf("start %08x end %08x start %08x end %08x\n", xtopleft, xmiddle, ytopleft, ymiddle); - for (yy=0;yy<448;yy++) + for (int yy=0; yy<448; yy++) { int realsrcy = (ytopleft>>16)&(bmheight-1); - dstptr = &bitmap.pix32(yy); - srcptr = &bm.pix16(realsrcy); + uint32_t *dstptr = &bitmap.pix(yy); + uint16_t const *const srcptr = &bm.pix(realsrcy); xtopleft = tmp; - for (xx=0;xx<512;xx++) + for (int xx=0; xx<512; xx++) { int realsrcx = (xtopleft>>16)&(bmwidth-1); - uint16_t pen; - - pen = srcptr[realsrcx]; + uint16_t pen = srcptr[realsrcx]; if (pen&transmask) *dstptr = paldata[pen]; @@ -980,15 +946,13 @@ uint32_t hng64_state::screen_update_hng64(screen_device &screen, bitmap_rgb32 &b // 3d gets drawn next if(!(m_fbcontrol[0] & 0x01)) { - int x, y; - // Blit the color buffer into the primary bitmap - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *src = &m_poly_renderer->colorBuffer3d().pix32(y, cliprect.min_x); - uint32_t *dst = &bitmap.pix32(y, cliprect.min_x); + const uint32_t *src = &m_poly_renderer->colorBuffer3d().pix(y, cliprect.min_x); + uint32_t *dst = &bitmap.pix(y, cliprect.min_x); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if(*src & 0xff000000) *dst = *src; @@ -1139,13 +1103,12 @@ void hng64_state::tcram_w(offs_t offset, uint32_t data, uint32_t mem_mask) if(offset == 0x02) { - uint16_t min_x, min_y, max_x, max_y; rectangle visarea = m_screen->visible_area(); - min_x = (hng64_tcram[1] & 0xffff0000) >> 16; - min_y = (hng64_tcram[1] & 0x0000ffff) >> 0; - max_x = (hng64_tcram[2] & 0xffff0000) >> 16; - max_y = (hng64_tcram[2] & 0x0000ffff) >> 0; + const uint16_t min_x = (hng64_tcram[1] & 0xffff0000) >> 16; + const uint16_t min_y = (hng64_tcram[1] & 0x0000ffff) >> 0; + const uint16_t max_x = (hng64_tcram[2] & 0xffff0000) >> 16; + const uint16_t max_y = (hng64_tcram[2] & 0x0000ffff) >> 0; if(max_x == 0 || max_y == 0) // bail out if values are invalid, Fatal Fury WA sets this to disable the screen. { @@ -1173,8 +1136,6 @@ uint32_t hng64_state::tcram_r(offs_t offset) // Very much a work in progress - no hard testing has been done void hng64_state::transition_control( bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - // float colorScaleR, colorScaleG, colorScaleB; int32_t finR, finG, finB; @@ -1192,11 +1153,11 @@ void hng64_state::transition_control( bitmap_rgb32 &bitmap, const rectangle &cli brigG = (int32_t)((m_tcram[0x0000000a] >> 8) & 0xff); brigB = (int32_t)((m_tcram[0x0000000a] >> 16) & 0xff); - for (i = cliprect.min_x; i < cliprect.max_x; i++) + for (int i = cliprect.min_x; i < cliprect.max_x; i++) { - for (j = cliprect.min_y; j < cliprect.max_y; j++) + for (int j = cliprect.min_y; j < cliprect.max_y; j++) { - rgb_t* thePixel = reinterpret_cast<rgb_t *>(&bitmap.pix32(j, i)); + rgb_t* thePixel = reinterpret_cast<rgb_t *>(&bitmap.pix(j, i)); finR = (int32_t)thePixel->r(); finG = (int32_t)thePixel->g(); diff --git a/src/mame/video/hng64_3d.hxx b/src/mame/video/hng64_3d.hxx index 46a12c13a8b..444911ff4c3 100644 --- a/src/mame/video/hng64_3d.hxx +++ b/src/mame/video/hng64_3d.hxx @@ -1206,7 +1206,7 @@ void hng64_poly_renderer::render_scanline(int32_t scanline, const extent_t& exte const float dt = extent.param[6].dpdx; // Pointers to the pixel buffers - uint32_t* colorBuffer = &m_colorBuffer3d.pix32(scanline, extent.startx); + uint32_t* colorBuffer = &m_colorBuffer3d.pix(scanline, extent.startx); float* depthBuffer = &m_depthBuffer3d[(scanline * m_state.m_screen->visible_area().width()) + extent.startx]; const uint8_t *textureOffset = &m_state.m_texturerom[renderData.texIndex * 1024 * 1024]; @@ -1226,7 +1226,7 @@ void hng64_poly_renderer::render_scanline(int32_t scanline, const extent_t& exte if ((renderData.debugColor & 0xff000000) == 0x01000000) { // ST color mode - *colorBuffer = rgb_t(255, (uint8_t)(sCorrect*255.0f), (uint8_t)(tCorrect*255.0f), (uint8_t)(0)); + *colorBuffer = rgb_t(255, uint8_t(sCorrect*255.0f), uint8_t(tCorrect*255.0f), uint8_t(0)); } else if ((renderData.debugColor & 0xff000000) == 0x02000000) { diff --git a/src/mame/video/hp48.cpp b/src/mame/video/hp48.cpp index 0f224bae73d..572610024ef 100644 --- a/src/mame/video/hp48.cpp +++ b/src/mame/video/hp48.cpp @@ -192,7 +192,7 @@ uint32_t hp48_state::screen_update_hp48(screen_device &screen, bitmap_ind16 &bit acc += m_screens[ i ][ y ][ x+8 ]; } acc = (acc * 255) / (33 * HP48_NB_SCREENS); - bitmap.pix16(y, x ) = acc; + bitmap.pix(y, x ) = acc; } } diff --git a/src/mame/video/hyhoo.cpp b/src/mame/video/hyhoo.cpp index c953b2011c1..aeac3bc32ac 100644 --- a/src/mame/video/hyhoo.cpp +++ b/src/mame/video/hyhoo.cpp @@ -67,18 +67,11 @@ void hyhoo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void hyhoo_state::hyhoo_gfxdraw() { - uint8_t *GFX = memregion("gfx1")->base(); + uint8_t const *const GFX = memregion("gfx1")->base(); - int x, y; - int dx1, dx2, dy; int startx, starty; int sizex, sizey; int skipx, skipy; - int ctrx, ctry; - int gfxaddr, gfxlen; - uint8_t color, color1, color2; - int r, g, b; - pen_t pen; m_nb1413m3->m_busyctr = 0; @@ -109,12 +102,12 @@ void hyhoo_state::hyhoo_gfxdraw() skipy = -1; } - gfxlen = memregion("gfx1")->bytes(); - gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); + int const gfxlen = memregion("gfx1")->bytes(); + int gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1); - for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) + for (int y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) { - for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) + for (int x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) { if ((gfxaddr > (gfxlen - 1))) { @@ -124,11 +117,11 @@ void hyhoo_state::hyhoo_gfxdraw() gfxaddr = 0; } - color = GFX[gfxaddr++]; + uint8_t color = GFX[gfxaddr++]; - dx1 = (2 * x + 0) & 0x1ff; - dx2 = (2 * x + 1) & 0x1ff; - dy = y & 0xff; + int dx1 = (2 * x + 0) & 0x1ff; + int dx2 = (2 * x + 1) & 0x1ff; + int dy = y & 0xff; if (m_highcolorflag & 0x04) { @@ -143,14 +136,14 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbbggrrr // dst xxbbbxxx_ggxxxrrr - r = ((color & 0x07) >> 0) & 0x07; - g = ((color & 0x18) >> 3) & 0x03; - b = ((color & 0xe0) >> 5) & 0x07; + int r = ((color & 0x07) >> 0) & 0x07; + int g = ((color & 0x18) >> 3) & 0x03; + int b = ((color & 0xe0) >> 5) & 0x07; - pen = rgb_t(pal6bit(r), pal5bit(g), pal5bit(b)); + pen_t pen = rgb_t(pal6bit(r), pal5bit(g), pal5bit(b)); - m_tmpbitmap.pix32(dy, dx1) = m_tmpbitmap.pix32(dy, dx1) | pen; - m_tmpbitmap.pix32(dy, dx2) = m_tmpbitmap.pix32(dy, dx2) | pen; + m_tmpbitmap.pix(dy, dx1) |= pen; + m_tmpbitmap.pix(dy, dx2) |= pen; } else { @@ -159,20 +152,21 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((color & 0x07) >> 0) & 0x07; - g = ((color & 0x38) >> 3) & 0x07; - b = ((color & 0xc0) >> 6) & 0x03; + int r = ((color & 0x07) >> 0) & 0x07; + int g = ((color & 0x38) >> 3) & 0x07; + int b = ((color & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx1) = pen; - m_tmpbitmap.pix32(dy, dx2) = pen; + m_tmpbitmap.pix(dy, dx1) = pen; + m_tmpbitmap.pix(dy, dx2) = pen; } } } else { // lookup table mode + uint8_t color1, color2; if (m_blitter_direction_x) { @@ -192,13 +186,13 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((~m_clut[color1] & 0x07) >> 0) & 0x07; - g = ((~m_clut[color1] & 0x38) >> 3) & 0x07; - b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03; + int r = ((~m_clut[color1] & 0x07) >> 0) & 0x07; + int g = ((~m_clut[color1] & 0x38) >> 3) & 0x07; + int b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx1) = pen; + m_tmpbitmap.pix(dy, dx1) = pen; } if (m_clut[color2]) @@ -206,13 +200,13 @@ void hyhoo_state::hyhoo_gfxdraw() // src xxxxxxxx_bbgggrrr // dst bbxxxggg_xxrrrxxx - r = ((~m_clut[color2] & 0x07) >> 0) & 0x07; - g = ((~m_clut[color2] & 0x38) >> 3) & 0x07; - b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03; + int r = ((~m_clut[color2] & 0x07) >> 0) & 0x07; + int g = ((~m_clut[color2] & 0x38) >> 3) & 0x07; + int b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03; - pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); + pen_t pen = rgb_t(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3)); - m_tmpbitmap.pix32(dy, dx2) = pen; + m_tmpbitmap.pix(dy, dx2) = pen; } } diff --git a/src/mame/video/igs017_igs031.cpp b/src/mame/video/igs017_igs031.cpp index 9248d9074df..a214d93d2e4 100644 --- a/src/mame/video/igs017_igs031.cpp +++ b/src/mame/video/igs017_igs031.cpp @@ -305,8 +305,8 @@ void igs017_igs031_device::draw_sprite(bitmap_ind16 &bitmap, const rectangle &cl { // skip if inner loop doesn't draw anything for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * dimx; - u16 *dest = &bitmap.pix16(y); + u8 const *const source = source_base + y_index * dimx; + u16 *const dest = &bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { diff --git a/src/mame/video/ikki.cpp b/src/mame/video/ikki.cpp index 38ad37c38f5..f50ab80ac84 100644 --- a/src/mame/video/ikki.cpp +++ b/src/mame/video/ikki.cpp @@ -97,10 +97,10 @@ void ikki_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint16_t const pen = m_sprite_bitmap.pix16(y, x); + uint16_t const pen = m_sprite_bitmap.pix(y, x); if (m_palette->pen_indirect(pen) != 0x100) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } } } diff --git a/src/mame/video/itech8.cpp b/src/mame/video/itech8.cpp index 003b0d2aab3..e89e5ef5496 100644 --- a/src/mame/video/itech8.cpp +++ b/src/mame/video/itech8.cpp @@ -587,9 +587,7 @@ void grmatch_state::palette_update() uint32_t itech8_state::screen_update_2layer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -601,19 +599,19 @@ uint32_t itech8_state::screen_update_2layer(screen_device &screen, bitmap_rgb32 return 0; } - /* there are two layers: */ - /* top layer @ 0x00000 is only 4bpp, colors come from the first 16 palettes */ - /* bottom layer @ 0x20000 is full 8bpp */ - page_offset = m_tms34061->m_display.dispstart & 0x0ffff; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two layers: + // top layer @ 0x00000 is only 4bpp, colors come from the first 16 palettes + // bottom layer @ 0x20000 is full 8bpp + uint32_t const page_offset = m_tms34061->m_display.dispstart & 0x0ffff; + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base0 = &m_tms34061->m_display.vram[(0x00000 + page_offset + y * 256) & VRAM_MASK]; - uint8_t *base2 = &m_tms34061->m_display.vram[(0x20000 + page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base0 = &m_tms34061->m_display.vram[(0x00000 + page_offset + y * 256) & VRAM_MASK]; + uint8_t const *const base2 = &m_tms34061->m_display.vram[(0x20000 + page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int pix0 = base0[x] & 0x0f; + int const pix0 = base0[x] & 0x0f; dest[x] = pens[pix0 ? pix0 : base2[x]]; } } @@ -633,22 +631,22 @@ uint32_t grmatch_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma return 0; } - /* there are two layers: */ - /* top layer @ 0x00000 is 4bpp, colors come from TMS34070, enabled via palette control */ - /* bottom layer @ 0x20000 is 4bpp, colors come from TMS34070, enabled via palette control */ - /* 4bpp pixels are packed 2 to a byte */ - /* xscroll is set via a separate register */ - uint32_t page_offset = (m_tms34061->m_display.dispstart & 0x0ffff) | m_xscroll; + // there are two layers: + // top layer @ 0x00000 is 4bpp, colors come from TMS34070, enabled via palette control + // bottom layer @ 0x20000 is 4bpp, colors come from TMS34070, enabled via palette control + // 4bpp pixels are packed 2 to a byte + // xscroll is set via a separate register + uint32_t const page_offset = (m_tms34061->m_display.dispstart & 0x0ffff) | m_xscroll; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base0 = &m_tms34061->m_display.vram[0x00000 + ((page_offset + y * 256) & 0xffff)]; - uint8_t *base2 = &m_tms34061->m_display.vram[0x20000 + ((page_offset + y * 256) & 0xffff)]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base0 = &m_tms34061->m_display.vram[0x00000 + ((page_offset + y * 256) & 0xffff)]; + uint8_t const *const base2 = &m_tms34061->m_display.vram[0x20000 + ((page_offset + y * 256) & 0xffff)]; + uint32_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - uint8_t pix0 = base0[x / 2]; - uint8_t pix2 = base2[x / 2]; + uint8_t const pix0 = base0[x / 2]; + uint8_t const pix2 = base2[x / 2]; if ((pix0 & 0xf0) != 0) dest[x] = m_palette[0][pix0 >> 4]; @@ -667,9 +665,7 @@ uint32_t grmatch_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -681,15 +677,15 @@ uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 & return 0; } - /* there are two pages, each of which is a full 8bpp */ - /* page index is selected by the top bit of the page_select register */ - page_offset = ((m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two pages, each of which is a full 8bpp + // page index is selected by the top bit of the page_select register + uint32_t const page_offset = ((m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = pens[base[x]]; } return 0; @@ -698,9 +694,7 @@ uint32_t itech8_state::screen_update_2page(screen_device &screen, bitmap_rgb32 & uint32_t itech8_state::screen_update_2page_large(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t page_offset; - int x, y; - const pen_t *pens = m_tlc34076->pens(); + pen_t const *const pens = m_tlc34076->pens(); /* first get the current display state */ m_tms34061->get_display_state(); @@ -712,18 +706,18 @@ uint32_t itech8_state::screen_update_2page_large(screen_device &screen, bitmap_r return 0; } - /* there are two pages, each of which is a full 8bpp */ - /* the low 4 bits come from the bitmap directly */ - /* the upper 4 bits were latched on each write into a separate bitmap */ - /* page index is selected by the top bit of the page_select register */ - page_offset = ((~m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + // there are two pages, each of which is a full 8bpp + // the low 4 bits come from the bitmap directly + // the upper 4 bits were latched on each write into a separate bitmap + // page index is selected by the top bit of the page_select register + uint32_t const page_offset = ((~m_page_select & 0x80) << 10) | (m_tms34061->m_display.dispstart & 0x0ffff); + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; - uint8_t *latch = &m_tms34061->m_display.latchram[(page_offset + y * 256) & VRAM_MASK]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const base = &m_tms34061->m_display.vram[(page_offset + y * 256) & VRAM_MASK]; + uint8_t const *const latch = &m_tms34061->m_display.latchram[(page_offset + y * 256) & VRAM_MASK]; + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { dest[x + 0] = pens[(latch[x/2] & 0xf0) | (base[x/2] >> 4)]; dest[x + 1] = pens[((latch[x/2] << 4) & 0xf0) | (base[x/2] & 0x0f)]; diff --git a/src/mame/video/jaguar.cpp b/src/mame/video/jaguar.cpp index bb745c11dc7..b9a9b89cffb 100644 --- a/src/mame/video/jaguar.cpp +++ b/src/mame/video/jaguar.cpp @@ -775,7 +775,7 @@ void jaguar_state::scanline_update(int param) /* only run if video is enabled and we are past the "display begin" */ if ((m_gpu_regs[VMODE] & 1) && vc >= (m_gpu_regs[VDB] & 0x7ff)) { - uint32_t *dest = &m_screen_bitmap.pix32(vc >> 1); + uint32_t *dest = &m_screen_bitmap.pix(vc >> 1); int maxx = visarea.right(); int hde = effective_hvalue(m_gpu_regs[HDE]) >> 1; uint16_t x,scanline[760]; diff --git a/src/mame/video/jedi.cpp b/src/mame/video/jedi.cpp index ea68c645413..709ea5dd73c 100644 --- a/src/mame/video/jedi.cpp +++ b/src/mame/video/jedi.cpp @@ -124,7 +124,7 @@ void jedi_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect) { for (int y = cliprect.top(); y <= cliprect.bottom(); y++) for(int x = cliprect.left(); x <= cliprect.right(); x++) - bitmap.pix32(y, x) = m_palette->pen(bitmap.pix32(y, x)); + bitmap.pix(y, x) = m_palette->pen(bitmap.pix(y, x)); } @@ -223,8 +223,8 @@ void jedi_state::draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle the next pixel just uses the current value directly. After we done with a pixel save it for later in the line buffer RAM */ const u8 bg_tempcol = prom1[(bg_last_col << 4) | bg_col]; - bitmap.pix32(y, x + 0) = tx_col1 | prom2[(background_line_buffer[x + 0] << 4) | bg_tempcol]; - bitmap.pix32(y, x + 1) = tx_col2 | prom2[(background_line_buffer[x + 1] << 4) | bg_col]; + bitmap.pix(y, x + 0) = tx_col1 | prom2[(background_line_buffer[x + 0] << 4) | bg_tempcol]; + bitmap.pix(y, x + 1) = tx_col2 | prom2[(background_line_buffer[x + 1] << 4) | bg_col]; background_line_buffer[x + 0] = bg_tempcol; background_line_buffer[x + 1] = bg_col; @@ -296,7 +296,7 @@ void jedi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) x = x & 0x1ff; if (col) - bitmap.pix32(y, x) = (bitmap.pix32(y, x) & 0x30f) | col; + bitmap.pix(y, x) = (bitmap.pix(y, x) & 0x30f) | col; /* next pixel */ if (flip_x) diff --git a/src/mame/video/jpmimpct.cpp b/src/mame/video/jpmimpct.cpp index 2edc65cbd58..798316cfcec 100644 --- a/src/mame/video/jpmimpct.cpp +++ b/src/mame/video/jpmimpct.cpp @@ -107,14 +107,13 @@ TMS340X0_FROM_SHIFTREG_CB_MEMBER(jpmimpct_state::from_shiftreg) TMS340X0_SCANLINE_RGB32_CB_MEMBER(jpmimpct_state::scanline_update) { - uint16_t *vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; - uint32_t *dest = &bitmap.pix32(scanline); + uint16_t const *const vram = &m_vram[(params->rowaddr << 8) & 0x3ff00]; + uint32_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int x; - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { - uint16_t pixels = vram[coladdr++ & 0xff]; + uint16_t const pixels = vram[coladdr++ & 0xff]; dest[x + 0] = m_palette->pen(pixels & 0xff); dest[x + 1] = m_palette->pen(pixels >> 8); } diff --git a/src/mame/video/k001005.cpp b/src/mame/video/k001005.cpp index 55ae7629a90..b0477c51b21 100644 --- a/src/mame/video/k001005.cpp +++ b/src/mame/video/k001005.cpp @@ -880,12 +880,11 @@ void k001005_renderer::render_polygons() void k001005_renderer::draw_scanline_2d(int32_t scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid) { - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; - int x; - for (x = extent.startx; x < extent.stopx; x++) + for (int x = extent.startx; x < extent.stopx; x++) { if (color & 0xff000000) { @@ -906,8 +905,8 @@ void k001005_renderer::draw_scanline_2d_tex(int32_t scanline, const extent_t &ex float v = extent.param[POLY_V].start; float du = extent.param[POLY_U].dpdx; float dv = extent.param[POLY_V].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; int texture_mirror_x = extradata.texture_mirror_x; int texture_mirror_y = extradata.texture_mirror_y; @@ -949,8 +948,8 @@ void k001005_renderer::draw_scanline(int32_t scanline, const extent_t &extent, c float dbri = extent.param[POLY_BRI].dpdx; float fog = extent.param[POLY_FOG].start; float dfog = extent.param[POLY_FOG].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); uint32_t color = extradata.color; int poly_light_r = extradata.light_r + extradata.ambient_r; @@ -1039,8 +1038,8 @@ void k001005_renderer::draw_scanline_tex(int32_t scanline, const extent_t &exten int poly_fog_g = extradata.fog_g; int poly_fog_b = extradata.fog_b; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); int *x_mirror_table = m_tex_mirror_table[texture_mirror_x][texture_width].get(); int *y_mirror_table = m_tex_mirror_table[texture_mirror_y][texture_height].get(); @@ -1113,8 +1112,8 @@ void k001005_renderer::draw_scanline_gouraud_blend(int32_t scanline, const exten float db = extent.param[POLY_B].dpdx; float a = extent.param[POLY_A].start; float da = extent.param[POLY_A].dpdx; - uint32_t *fb = &m_fb[m_fb_page]->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb[m_fb_page]->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -1161,14 +1160,12 @@ void k001005_renderer::draw_scanline_gouraud_blend(int32_t scanline, const exten void k001005_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - for (j = cliprect.min_y; j <= cliprect.max_y; j++) + for (int j = cliprect.min_y; j <= cliprect.max_y; j++) { - uint32_t *bmp = &bitmap.pix32(j); - uint32_t *src = &m_fb[m_fb_page^1]->pix32(j); + uint32_t *const bmp = &bitmap.pix(j); + uint32_t const *const src = &m_fb[m_fb_page^1]->pix(j); - for (i = cliprect.min_x; i <= cliprect.max_x; i++) + for (int i = cliprect.min_x; i <= cliprect.max_x; i++) { if (src[i] & 0xff000000) { diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp index bf3105d065b..bb00c46e75c 100644 --- a/src/mame/video/k001604.cpp +++ b/src/mame/video/k001604.cpp @@ -256,7 +256,7 @@ void k001604_device::draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cli // loop over columns while (x <= ex) { - *dest = clut[pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x)]; + *dest = clut[pixmap.pix(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x)]; // advance in X cx += incxx; @@ -322,7 +322,7 @@ void k001604_device::draw_front_layer( screen_device &screen, bitmap_rgb32 &bitm // loop over columns while (x <= ex) { - uint16_t pix = pixmap.pix16(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); + uint16_t pix = pixmap.pix(((cy >> 16) & window_ymask) + window_y, ((cx >> 16) & window_xmask) + window_x); if ((pix & 0xff) != 0) { *dest = clut[pix]; diff --git a/src/mame/video/k053246_k053247_k055673.cpp b/src/mame/video/k053246_k053247_k055673.cpp index 93bf4ac03b5..26845ed68d3 100644 --- a/src/mame/video/k053246_k053247_k055673.cpp +++ b/src/mame/video/k053246_k053247_k055673.cpp @@ -496,7 +496,7 @@ void k053247_device::zdrawgfxzoom32GP( pal_base = palette().pens() + m_gfx->colorbase() + (color % m_gfx->colors()) * granularity; shd_base = palette().shadow_table(); - dst_ptr = &bitmap.pix32(0); + dst_ptr = &bitmap.pix(0); dst_pitch = bitmap.rowpixels(); dst_minx = cliprect.min_x; dst_maxx = cliprect.max_x; diff --git a/src/mame/video/k053250.cpp b/src/mame/video/k053250.cpp index 6363569a761..6022f059d68 100644 --- a/src/mame/video/k053250.cpp +++ b/src/mame/video/k053250.cpp @@ -151,16 +151,16 @@ inline void k053250_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t * // calculate target increment for horizontal scanlines which is exactly one dst_adv = 1; dst_offset = dst_length; - pri_base = &priority.pix8(linepos, dst_start + dst_offset); - dst_base = &bitmap.pix32(linepos, dst_start + dst_length); + pri_base = &priority.pix(linepos, dst_start + dst_offset); + dst_base = &bitmap.pix(linepos, dst_start + dst_length); } else { // calculate target increment for vertical scanlines which is the bitmap's pitch value dst_adv = bitmap.rowpixels(); dst_offset= dst_length * dst_adv; - pri_base = &priority.pix8(dst_start, linepos + dst_offset); - dst_base = &bitmap.pix32(dst_start, linepos + dst_offset); + pri_base = &priority.pix(dst_start, linepos + dst_offset); + dst_base = &bitmap.pix(dst_start, linepos + dst_offset); } // generalized diff --git a/src/mame/video/k053250_ps.cpp b/src/mame/video/k053250_ps.cpp index 9f62bd0b0fb..dfb35d4531a 100644 --- a/src/mame/video/k053250_ps.cpp +++ b/src/mame/video/k053250_ps.cpp @@ -195,16 +195,16 @@ inline void k053250ps_device::pdraw_scanline32(bitmap_rgb32 &bitmap, const pen_t // calculate target increment for horizontal scanlines which is exactly one dst_adv = 1; dst_offset = dst_length; - pri_base = &priority.pix8(linepos, dst_start + dst_offset); - dst_base = &bitmap.pix32(linepos, dst_start + dst_length); + pri_base = &priority.pix(linepos, dst_start + dst_offset); + dst_base = &bitmap.pix(linepos, dst_start + dst_length); } else { // calculate target increment for vertical scanlines which is the bitmap's pitch value dst_adv = bitmap.rowpixels(); dst_offset= dst_length * dst_adv; - pri_base = &priority.pix8(dst_start, linepos + dst_offset); - dst_base = &bitmap.pix32(dst_start, linepos + dst_offset); + pri_base = &priority.pix(dst_start, linepos + dst_offset); + dst_base = &bitmap.pix(dst_start, linepos + dst_offset); } // generalized diff --git a/src/mame/video/k053936.cpp b/src/mame/video/k053936.cpp index 3be4ff7a48e..a86814041c2 100644 --- a/src/mame/video/k053936.cpp +++ b/src/mame/video/k053936.cpp @@ -589,7 +589,7 @@ static inline void K053936GP_copyroz32clip( running_machine &machine, // adjust entry points and other loop constants dst_pitch = dst_bitmap.rowpixels(); - dst_base = &dst_bitmap.pix32(0); + dst_base = &dst_bitmap.pix(0); dst_base2 = sy * dst_pitch + sx + tx; ecx = tx = -tx; @@ -598,7 +598,7 @@ static inline void K053936GP_copyroz32clip( running_machine &machine, cmask = colormask[tilebpp]; src_pitch = src_bitmap.rowpixels(); - src_base = &src_bitmap.pix16(0); + src_base = &src_bitmap.pix(0); src_size = src_bitmap.width() * src_bitmap.height(); dst_size = dst_bitmap.width() * dst_bitmap.height(); dst_ptr = 0;//dst_base; diff --git a/src/mame/video/k054156_k054157_k056832.cpp b/src/mame/video/k054156_k054157_k056832.cpp index 26bc2f48982..0d50a5a3933 100644 --- a/src/mame/video/k054156_k054157_k056832.cpp +++ b/src/mame/video/k054156_k054157_k056832.cpp @@ -1177,8 +1177,8 @@ int k056832_device::update_linemap( screen_device &screen, BitmapClass &bitmap, { tile_data tileinfo = {0}; - dst_ptr = &pixmap->pix16(line); - xpr_ptr = &xprmap.pix8(line); + dst_ptr = &pixmap->pix(line); + xpr_ptr = &xprmap.pix(line); if (!all_dirty) { @@ -2106,8 +2106,8 @@ int k056832_device::altK056832_update_linemap(screen_device &screen, bitmap_rgb3 { tile_data tileinfo = {0}; - dst_ptr = &pixmap->pix16(line); - xpr_ptr = &xprmap.pix8(line); + dst_ptr = &pixmap->pix(line); + xpr_ptr = &xprmap.pix(line); if (!all_dirty) { diff --git a/src/mame/video/k054338.cpp b/src/mame/video/k054338.cpp index 11374ee01b4..8e0e61fd5c3 100644 --- a/src/mame/video/k054338.cpp +++ b/src/mame/video/k054338.cpp @@ -110,7 +110,7 @@ void k054338_device::fill_backcolor(bitmap_rgb32 &bitmap, const rectangle &clipr } else { - uint32_t *dst_ptr = &bitmap.pix32(cliprect.min_y); + uint32_t *dst_ptr = &bitmap.pix(cliprect.min_y); int dst_pitch = bitmap.rowpixels(); if ((mode & 0x01) == 0) // vertical gradient fill diff --git a/src/mame/video/k057714.cpp b/src/mame/video/k057714.cpp index 6e336987041..a61711be54a 100644 --- a/src/mame/video/k057714.cpp +++ b/src/mame/video/k057714.cpp @@ -370,7 +370,7 @@ void k057714_device::draw_frame(int frame, bitmap_ind16 &bitmap, const rectangle for (int j = 0; j < height; j++) { - uint16_t *d = &bitmap.pix16(j + m_frame[frame].y, m_frame[frame].x); + uint16_t *const d = &bitmap.pix(j + m_frame[frame].y, m_frame[frame].x); int li = (j * fb_pitch); for (int i = 0; i < width; i++) { diff --git a/src/mame/video/k1ge.cpp b/src/mame/video/k1ge.cpp index eb3d5d44447..0dec7b55d8a 100644 --- a/src/mame/video/k1ge.cpp +++ b/src/mame/video/k1ge.cpp @@ -243,13 +243,12 @@ void k1ge_device::draw_sprite_plane( uint16_t *p, uint16_t priority, int line, i void k1ge_device::draw( int line ) { - uint16_t *p = &m_bitmap->pix16(line); + uint16_t *const p = &m_bitmap->pix(line); uint16_t oowcol = m_vram[0x012] & 0x07; - int i; if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) { - for( i = 0; i < 160; i++ ) + for( int i = 0; i < 160; i++ ) { p[i] = oowcol; } @@ -258,7 +257,7 @@ void k1ge_device::draw( int line ) { uint16_t col = ( ( m_vram[0x118] & 0xc0 ) == 0x80 ) ? m_vram[0x118] & 0x07 : 0; - for ( i = 0; i < 160; i++ ) + for ( int i = 0; i < 160; i++ ) p[i] = col; if ( m_vram[0x030] & 0x80 ) @@ -296,12 +295,12 @@ void k1ge_device::draw( int line ) draw_sprite_plane( p, 3, line, m_vram[0x020], m_vram[0x021] ); } - for( i = 0; i < m_wba_h; i++ ) + for( int i = 0; i < m_wba_h; i++ ) { p[i] = oowcol; } - for( i = m_wba_h + m_wsi_h; i < 160; i++ ) + for( int i = m_wba_h + m_wsi_h; i < 160; i++ ) { p[i] = oowcol; } @@ -605,17 +604,16 @@ void k2ge_device::k1ge_draw_sprite_plane( uint16_t *p, uint16_t priority, int li void k2ge_device::draw( int line ) { - uint16_t *p = &m_bitmap->pix16(line); + uint16_t *const p = &m_bitmap->pix(line); uint16_t col = 0; uint16_t oowcol; - int i; oowcol = ( m_vram[0x012] & 0x07 ) * 2; oowcol = m_vram[0x3f0 + oowcol ] | ( m_vram[0x3f1 + oowcol ] << 8 ); if ( line < m_wba_v || line >= m_wba_v + m_wsi_v ) { - for( i = 0; i < 160; i++ ) + for( int i = 0; i < 160; i++ ) { p[i] = oowcol; } @@ -630,7 +628,7 @@ void k2ge_device::draw( int line ) col = m_vram[0x3e0 + col ] | ( m_vram[0x3e1 + col ] << 8 ); /* Set the bacground color */ - for ( i = 0; i < 160; i++ ) + for ( int i = 0; i < 160; i++ ) { p[i] = col; } @@ -712,12 +710,12 @@ void k2ge_device::draw( int line ) } } - for ( i = 0; i < m_wba_h; i++ ) + for ( int i = 0; i < m_wba_h; i++ ) { p[i] = oowcol; } - for ( i = m_wba_h + m_wsi_h; i < 160; i++ ) + for ( int i = m_wba_h + m_wsi_h; i < 160; i++ ) { p[i] = oowcol; } diff --git a/src/mame/video/kaneko16.cpp b/src/mame/video/kaneko16.cpp index 4f4aff0ed8b..a52fa9ebeb2 100644 --- a/src/mame/video/kaneko16.cpp +++ b/src/mame/video/kaneko16.cpp @@ -132,7 +132,7 @@ void kaneko16_berlwall_state::video_start() if ((r & 0x10) && (b & 0x10)) g = (g - 1) & 0x1f; /* decrease with wraparound */ - m_bg15_bitmap[screen].pix16(y, x) = ((g << 10) | (r << 5) | b) & 0x7fff; + m_bg15_bitmap[screen].pix(y, x) = ((g << 10) | (r << 5) | b) & 0x7fff; } } } @@ -197,16 +197,15 @@ void kaneko16_berlwall_state::render_15bpp_bitmap(bitmap_rgb32 &bitmap, const re scrolly -= 0xff - 0x08; } - const pen_t *pal = m_bgpalette->pens(); - u16* srcbitmap; - u32* dstbitmap; + pen_t const *const pal = m_bgpalette->pens(); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - if (!flip) srcbitmap = &m_bg15_bitmap[screen].pix16( (y - scrolly) & 0xff ); - else srcbitmap = &m_bg15_bitmap[screen].pix16( 255 - ((y - scrolly) & 0xff) ); + u16 const *srcbitmap; + if (!flip) srcbitmap = &m_bg15_bitmap[screen].pix( (y - scrolly) & 0xff ); + else srcbitmap = &m_bg15_bitmap[screen].pix( 255 - ((y - scrolly) & 0xff) ); - dstbitmap = &bitmap.pix32(y); + u32 *const dstbitmap = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/kaneko_spr.cpp b/src/mame/video/kaneko_spr.cpp index 1bd0c19d02f..80800d4665e 100644 --- a/src/mame/video/kaneko_spr.cpp +++ b/src/mame/video/kaneko_spr.cpp @@ -304,9 +304,9 @@ void kaneko16_sprite_device::draw_sprites_custom(const rectangle &clip,gfx_eleme { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - u16 *dest = &m_sprites_bitmap.pix16(y); - u8 *pri = &m_sprites_maskmap.pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u16 *const dest = &m_sprites_bitmap.pix(y); + u8 *const pri = &m_sprites_maskmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -549,18 +549,15 @@ void kaneko16_sprite_device::copybitmap(bitmap_rgb32 &bitmap, const rectangle &c template<class BitmapClass> void kaneko16_sprite_device::copybitmap_common(BitmapClass &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap) { - const pen_t *pal = gfx(0)->palette().pens(); + pen_t const *const pal = gfx(0)->palette().pens(); - typename BitmapClass::pixel_t *dstbitmap; - int rgb; - if (sizeof(*dstbitmap) == 2) rgb = 0; - else rgb = 1; + constexpr bool rgb = sizeof(typename BitmapClass::pixel_t) != 2; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - dstbitmap = &bitmap.pix(y); - u8 *dstprimap = &priority_bitmap.pix8(y); - u16* srcbitmap = &m_sprites_bitmap.pix16(y); + typename BitmapClass::pixel_t *const dstbitmap = &bitmap.pix(y); + u8 *const dstprimap = &priority_bitmap.pix(y); + u16 *const srcbitmap = &m_sprites_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/kangaroo.cpp b/src/mame/video/kangaroo.cpp index 89425997add..bd40a7141a5 100644 --- a/src/mame/video/kangaroo.cpp +++ b/src/mame/video/kangaroo.cpp @@ -141,14 +141,13 @@ uint32_t kangaroo_state::screen_update_kangaroo(screen_device &screen, bitmap_rg uint8_t enab = (m_video_control[9] & 0x04); uint8_t pria = (~m_video_control[9] & 0x02); uint8_t prib = (~m_video_control[9] & 0x01); - int x, y; /* iterate over pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2) { uint8_t effxa = scrollx + ((x / 2) ^ xora); uint8_t effya = scrolly + (y ^ xora); diff --git a/src/mame/video/kaypro.cpp b/src/mame/video/kaypro.cpp index f2e41fc47a1..b579a0f4484 100644 --- a/src/mame/video/kaypro.cpp +++ b/src/mame/video/kaypro.cpp @@ -29,24 +29,23 @@ u32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bi During the "off" period of blanking, the first half is used. Only 5 pixels are connected from the rom to the shift register, the remaining pixels are held high. */ - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]^0x80; + u8 chr = m_vram[x]^0x80; /* Take care of flashing characters */ if ((chr < 0x80) && (m_framecnt & 0x08)) @@ -73,24 +72,23 @@ u32 kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bi u32 kaypro_state::screen_update_omni2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u8 y,ra,chr,gfx; - u16 sy=0,ma=0,x; + u16 sy=0,ma=0; m_framecnt++; - for (y = 0; y < 24; y++) + for (u8 y = 0; y < 24; y++) { - for (ra = 0; ra < 10; ra++) + for (u8 ra = 0; ra < 10; ra++) { - u16 *p = &bitmap.pix16(sy++); + u16 *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 80; x++) + for (u16 x = ma; x < ma + 80; x++) { - gfx = 0; + u8 gfx = 0; if (ra < 8) { - chr = m_vram[x]; + u8 chr = m_vram[x]; /* Take care of flashing characters */ if ((chr > 0x7f) && (m_framecnt & 0x08)) @@ -137,32 +135,29 @@ u32 kaypro_state::screen_update_kaypro484(screen_device &screen, bitmap_rgb32 &b MC6845_UPDATE_ROW( kaypro_state::kaypro484_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - u32 *p = &bitmap.pix32(y); - u16 x; - u8 gfx,fg,bg; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + u32 *p = &bitmap.pix(y); - for (x = 0; x < x_count; x++) // for each character + for (u16 x = 0; x < x_count; x++) // for each character { u8 inv=0; if (x == cursor_x) inv=0xff; - u16 mem = (ma + x) & 0x7ff; - u8 chr = m_vram[mem]; - u8 attr = m_vram[mem | 0x800]; + u16 const mem = (ma + x) & 0x7ff; + u8 const chr = m_vram[mem]; + u8 const attr = m_vram[mem | 0x800]; + u8 fg, bg; if ((attr & 3) == 3) { fg = 0; bg = 2; } - else - if ((attr & 3) == 2) + else if ((attr & 3) == 2) { fg = 2; bg = 0; } - else - if ((attr & 3) == 1) + else if ((attr & 3) == 1) { fg = 0; bg = 1; @@ -178,6 +173,7 @@ MC6845_UPDATE_ROW( kaypro_state::kaypro484_update_row ) fg = bg; /* get pattern of pixels for that character scanline */ + u8 gfx; if ( (ra == 15) & (BIT(attr, 3)) ) /* underline */ gfx = 0xff; else diff --git a/src/mame/video/kc.cpp b/src/mame/video/kc.cpp index 52b37fbbe3b..b9ccc6cdbea 100644 --- a/src/mame/video/kc.cpp +++ b/src/mame/video/kc.cpp @@ -69,19 +69,17 @@ WRITE_LINE_MEMBER( kc_state::video_toggle_blink_state ) /* draw 8 pixels */ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t colour_byte, uint8_t gfx_byte) { - int pens[4]; - int px; - if (m_high_resolution) { /* High resolution: 4 colors for block */ - pens[0] = 0; // black - pens[1] = 2; // red - pens[2] = 5; // cyan - pens[3] = 7; // white + int const pens[4] = { + 0, // black + 2, // red + 5, // cyan + 7 }; // white - px = x; + int px = x; for (int a=0; a<8; a++) { @@ -89,7 +87,7 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) { - bitmap.pix16(y, px) = pen; + bitmap.pix(y, px) = pen; } px++; @@ -121,10 +119,9 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c foreground_pen = background_pen; } - pens[0] = background_pen; - pens[1] = foreground_pen; + int const pens[2] = { background_pen, foreground_pen }; - px = x; + int px = x; for (int a=0; a<8; a++) { @@ -132,10 +129,10 @@ void kc_state::video_draw_8_pixels(bitmap_ind16 &bitmap, int x, int y, uint8_t c if ((px >= 0) && (px < bitmap.width()) && (y >= 0) && (y < bitmap.height())) { - bitmap.pix16(y, px) = pen; + bitmap.pix(y, px) = pen; } px++; - gfx_byte = gfx_byte<<1; + gfx_byte <<= 1; } } } diff --git a/src/mame/video/klax.cpp b/src/mame/video/klax.cpp index a99221d701c..4ec30e3ae40 100644 --- a/src/mame/video/klax.cpp +++ b/src/mame/video/klax.cpp @@ -98,8 +98,8 @@ u32 klax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - const u16 *mo = &mobitmap.pix16(y); - u16 *pf = &bitmap.pix16(y); + u16 const *const mo = &mobitmap.pix(y); + u16 *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/konamigx.cpp b/src/mame/video/konamigx.cpp index 3f3cef92899..3f246d148c8 100644 --- a/src/mame/video/konamigx.cpp +++ b/src/mame/video/konamigx.cpp @@ -284,7 +284,7 @@ void konamigx_state::konamigx_mixer_init(screen_device &screen, int objdma) m_gx_objdma = 0; m_gx_primode = 0; - m_gx_objzbuf = &screen.priority().pix8(0); + m_gx_objzbuf = &screen.priority().pix(0); m_gx_shdzbuf = std::make_unique<uint8_t[]>(GX_ZBUFSIZE); gx_objpool = auto_alloc_array(machine(), struct GX_OBJ, GX_MAX_OBJECTS); @@ -327,7 +327,7 @@ void konamigx_state::konamigx_mixer(screen_device &screen, bitmap_rgb32 &bitmap, int cltc_shdpri, /*prflp,*/ disp; // buffer can move when it's resized, so refresh the pointer - m_gx_objzbuf = &screen.priority().pix8(0); + m_gx_objzbuf = &screen.priority().pix(0); // abort if object database failed to initialize objpool = gx_objpool; @@ -778,22 +778,21 @@ void konamigx_state::gx_draw_basic_extended_tilemaps_2(screen_device &screen, bi { if (extra_bitmap) // soccer superstars roz layer { - int xx,yy; int width = screen.width(); int height = screen.height(); - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); // the output size of the roz layer has to be doubled horizontally // so that it aligns with the sprites and normal tilemaps. This appears // to be done as a post-processing / mixing step effect // // - todo, use the pixeldouble_output I just added for vsnet instead? - for (yy=0;yy<height;yy++) + for (int yy=0;yy<height;yy++) { - uint16_t* src = &extra_bitmap->pix16(yy); - uint32_t* dst = &bitmap.pix32(yy); + uint16_t const *const src = &extra_bitmap->pix(yy); + uint32_t *const dst = &bitmap.pix(yy); int shiftpos = 0; - for (xx=0;xx<width;xx+=2) + for (int xx=0;xx<width;xx+=2) { uint16_t dat = src[(((xx/2)+shiftpos))%width]; if (dat&0xff) @@ -1462,29 +1461,27 @@ uint32_t konamigx_state::screen_update_konamigx(screen_device &screen, bitmap_rg /* Hack! draw type-1 roz layer here for testing purposes only */ if (m_gx_specialrozenable == 1) { - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); // hack, draw the roz tilemap if W is held if ( machine().input().code_pressed(KEYCODE_W) ) { - int y,x; - // make it flicker, to compare positioning //if (screen.frame_number() & 1) { - for (y=0;y<256;y++) + for (int y=0;y<256;y++) { - //uint32_t* dst = &bitmap.pix32(y); + //uint32_t *const dst = &bitmap.pix(y); // ths K053936 rendering should probably just be flipped // this is just kludged to align the racing force 2d logo - uint16_t* src = &m_gxtype1_roz_dstbitmap2->pix16(y); - //uint16_t* src = &m_gxtype1_roz_dstbitmap->pix16(y); + uint16_t const *const src = &m_gxtype1_roz_dstbitmap2->pix(y); + //uint16_t const *const src = &m_gxtype1_roz_dstbitmap->pix(y); - uint32_t* dst = &bitmap.pix32((256+16)-y); + uint32_t *const dst = &bitmap.pix((256+16)-y); - for (x=0;x<512;x++) + for (int x=0;x<512;x++) { - uint16_t dat = src[x]; + uint16_t const dat = src[x]; dst[x] = paldata[dat]; } } diff --git a/src/mame/video/ladybug.cpp b/src/mame/video/ladybug.cpp index 13171816a7f..622423fbad3 100644 --- a/src/mame/video/ladybug.cpp +++ b/src/mame/video/ladybug.cpp @@ -207,7 +207,7 @@ void zerohour_stars_device::draw(bitmap_ind16 &bitmap, rectangle const &cliprect if (cliprect.contains(xloc, yloc) && (hcond == vcond)) { if (((state & 0x000ff) == 0x000ff) && !feedback && (xloc >= firstx) && (xloc <= lastx)) - bitmap.pix16(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f); + bitmap.pix(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f); } // update LFSR state diff --git a/src/mame/video/laserbat.cpp b/src/mame/video/laserbat.cpp index 0dae5a95f7d..09af495c61b 100644 --- a/src/mame/video/laserbat.cpp +++ b/src/mame/video/laserbat.cpp @@ -177,8 +177,8 @@ uint32_t laserbat_state_base::screen_update_laserbat(screen_device &screen, bitm for (int y = cliprect.min_y; cliprect.max_y >= y; y++) { - uint16_t const *const src = &m_bitmap.pix16(flip_y ? (offs_y - y) : y); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &m_bitmap.pix(flip_y ? (offs_y - y) : y); + uint16_t *dst = &bitmap.pix(y); for (int x = cliprect.min_x; cliprect.max_x >= x; x++) { dst[x] = uint16_t(m_gfxmix->read(src[flip_x ? (offs_x - x) : x])); @@ -223,7 +223,7 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) int const max_x = m_screen->visible_area().max_x; int const x_offset = min_x - (8 * 3); int const y_offset = m_screen->visible_area().min_y - 8; - uint16_t *const row = &m_bitmap.pix16(y); + uint16_t *const row = &m_bitmap.pix(y); // wait for next scanline m_scanline_timer->adjust(m_screen->time_until_pos(y + 1, 0)); @@ -241,9 +241,9 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line) m_pvi[1]->render_next_line(); m_pvi[2]->render_next_line(); } - uint16_t const *const pvi1_row = &m_pvi[0]->bitmap().pix16(y); - uint16_t const *const pvi2_row = &m_pvi[1]->bitmap().pix16(y); - uint16_t const *const pvi3_row = &m_pvi[2]->bitmap().pix16(y); + uint16_t const *const pvi1_row = &m_pvi[0]->bitmap().pix(y); + uint16_t const *const pvi2_row = &m_pvi[1]->bitmap().pix(y); + uint16_t const *const pvi3_row = &m_pvi[2]->bitmap().pix(y); // don't draw outside the visible area m_bitmap.plot_box(0, y, m_bitmap.width(), 1, 0); diff --git a/src/mame/video/lasso.cpp b/src/mame/video/lasso.cpp index edc07e73df0..cd3c1d81cab 100644 --- a/src/mame/video/lasso.cpp +++ b/src/mame/video/lasso.cpp @@ -303,14 +303,10 @@ void lasso_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - offs_t offs; pen_t pen = 0x3f; - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int bit; - uint8_t data; - uint8_t x; uint8_t y = offs >> 5; if (flip_screen_y()) @@ -319,23 +315,23 @@ void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect ) if ((y < cliprect.min_y) || (y > cliprect.max_y)) continue; - x = (offs & 0x1f) << 3; - data = m_bitmap_ram[offs]; + uint8_t x = (offs & 0x1f) << 3; + uint8_t data = m_bitmap_ram[offs]; if (flip_screen_x()) x = ~x; - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x)) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; if (flip_screen_x()) - x = x - 1; + x--; else - x = x + 1; + x++; - data = data << 1; + data <<= 1; } } } diff --git a/src/mame/video/lazercmd.cpp b/src/mame/video/lazercmd.cpp index 818e8abdfcd..7971c9cf3bf 100644 --- a/src/mame/video/lazercmd.cpp +++ b/src/mame/video/lazercmd.cpp @@ -28,25 +28,23 @@ int lazercmd_state::vert_scale(int data) /* meadows lanes normaly use 2x2 pixels and lazer command uses either */ void lazercmd_state::plot_pattern( bitmap_ind16 &bitmap, int x, int y ) { - int xbit, ybit, size; - - size = 2; + int size = 2; if (ioport("DSW")->read() & 0x40) { size = 4; } - for (ybit = 0; ybit < 2; ybit++) + for (int ybit = 0; ybit < 2; ybit++) { if (y + ybit < 0 || y + ybit >= VERT_RES * VERT_CHR) return; - for (xbit = 0; xbit < size; xbit++) + for (int xbit = 0; xbit < size; xbit++) { if (x + xbit < 0 || x + xbit >= HORZ_RES * HORZ_CHR) continue; - bitmap.pix16(y + ybit, x + xbit) = 4; + bitmap.pix(y + ybit, x + xbit) = 4; } } } diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp index e0e33b33c03..6a8b3d065c0 100644 --- a/src/mame/video/leland.cpp +++ b/src/mame/video/leland.cpp @@ -450,7 +450,7 @@ u32 leland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, con /* for each scanline in the visible region */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *const dst = &bitmap.pix16(y); + u16 *const dst = &bitmap.pix(y); u8 const *const fg_src = &m_video_ram[y << 8]; /* for each pixel on the scanline */ diff --git a/src/mame/video/lemmings.cpp b/src/mame/video/lemmings.cpp index 5851be91a0a..aa8fa71ab43 100644 --- a/src/mame/video/lemmings.cpp +++ b/src/mame/video/lemmings.cpp @@ -68,22 +68,20 @@ WRITE_LINE_MEMBER(lemmings_state::screen_vblank_lemmings) // RAM based void lemmings_state::lemmings_pixel_0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - int sx, sy, src, old; - - old = m_pixel_data[0][offset]; + int const old = m_pixel_data[0][offset]; COMBINE_DATA(&m_pixel_data[0][offset]); - src = m_pixel_data[0][offset]; + int const src = m_pixel_data[0][offset]; if (old == src) return; - sy = (offset << 1) >> 11; - sx = (offset << 1) & 0x7ff; + int const sy = (offset << 1) >> 11; + int const sx = (offset << 1) & 0x7ff; if (sx > 2047 || sy > 255) return; - m_bitmap0.pix16(sy, sx + 0) = ((src >> 8) & 0xf) | 0x100; - m_bitmap0.pix16(sy, sx + 1) = ((src >> 0) & 0xf) | 0x100; + m_bitmap0.pix(sy, sx + 0) = ((src >> 8) & 0xf) | 0x100; + m_bitmap0.pix(sy, sx + 1) = ((src >> 0) & 0xf) | 0x100; } // RAM based tiles for the FG tilemap @@ -115,16 +113,15 @@ void lemmings_state::lemmings_vram_w(offs_t offset, uint16_t data, uint16_t mem_ void lemmings_state::lemmings_copy_bitmap(bitmap_rgb32& bitmap, int* xscroll, int* yscroll, const rectangle& cliprect) { - int y,x; - const pen_t *paldata = m_palette->pens(); + pen_t const *const paldata = m_palette->pens(); - for (y=cliprect.top(); y<cliprect.bottom();y++) + for (int y=cliprect.top(); y<cliprect.bottom();y++) { - uint32_t* dst = &bitmap.pix32(y,0); + uint32_t *const dst = &bitmap.pix(y,0); - for (x=cliprect.left(); x<cliprect.right();x++) + for (int x=cliprect.left(); x<cliprect.right();x++) { - uint16_t src = m_bitmap0.pix16((y-*yscroll)&0xff,(x-*xscroll)&0x7ff); + uint16_t const src = m_bitmap0.pix((y-*yscroll)&0xff,(x-*xscroll)&0x7ff); if (src!=0x100) dst[x] = paldata[src]; diff --git a/src/mame/video/lethalj.cpp b/src/mame/video/lethalj.cpp index d813632965b..0eda14955c9 100644 --- a/src/mame/video/lethalj.cpp +++ b/src/mame/video/lethalj.cpp @@ -187,22 +187,22 @@ void lethalj_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) TMS340X0_SCANLINE_IND16_CB_MEMBER(lethalj_state::scanline_update) { - uint16_t *src = &m_screenram[(m_vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_screenram[(m_vispage << 17) | ((params->rowaddr << 9) & 0x3fe00)]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; - int x; /* blank palette: fill with white */ if (m_blank_palette) { - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = 0x7fff; if (scanline == screen.visible_area().max_y) m_blank_palette = 0; - return; } - - /* copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x++) - dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; + else + { + /* copy the non-blanked portions of this scanline */ + for (int x = params->heblnk; x < params->hsblnk; x++) + dest[x] = src[coladdr++ & 0x1ff] & 0x7fff; + } } diff --git a/src/mame/video/liberatr.cpp b/src/mame/video/liberatr.cpp index 82c5cbcdc25..0c5cdbb8ad6 100644 --- a/src/mame/video/liberatr.cpp +++ b/src/mame/video/liberatr.cpp @@ -249,35 +249,29 @@ void liberatr_state::get_pens(pen_t *pens) void liberatr_state::draw_planet(bitmap_rgb32 &bitmap, pen_t *pens) { - uint8_t latitude; - - uint8_t *buffer = m_planets[m_planet_select].frames[*m_planet_frame]; + uint8_t const *buffer = m_planets[m_planet_select].frames[*m_planet_frame]; /* for each latitude */ - for (latitude = 0; latitude < 0x80; latitude++) + for (uint8_t latitude = 0; latitude < 0x80; latitude++) { - uint8_t segment; - /* grab the color value for the base (if any) at this latitude */ - uint8_t base_color = m_base_ram[latitude >> 3] ^ 0x0f; + uint8_t const base_color = m_base_ram[latitude >> 3] ^ 0x0f; - uint8_t segment_count = *buffer++; + uint8_t const segment_count = *buffer++; uint8_t x = *buffer++; - uint8_t y = 64 + latitude; + uint8_t const y = 64 + latitude; /* run through the segments, drawing its color until its x_array value comes up. */ - for (segment = 0; segment < segment_count; segment++) + for (uint8_t segment = 0; segment < segment_count; segment++) { - uint8_t i; - uint8_t color = *buffer++; uint8_t segment_length = *buffer++; if ((color & 0x0c) == 0x0c) color = base_color; - for (i = 0; i < segment_length; i++, x++) - bitmap.pix32(y, x) = pens[color]; + for (uint8_t i = 0; i < segment_length; i++, x++) + bitmap.pix(y, x) = pens[color]; } } } @@ -285,17 +279,15 @@ void liberatr_state::draw_planet(bitmap_rgb32 &bitmap, pen_t *pens) void liberatr_state::draw_bitmap(bitmap_rgb32 &bitmap, pen_t *pens) { - offs_t offs; - - for (offs = 0; offs < 0x10000; offs++) + for (offs_t offs = 0; offs < 0x10000; offs++) { - uint8_t data = m_videoram[offs]; + uint8_t const data = m_videoram[offs]; - uint8_t y = offs >> 8; - uint8_t x = offs & 0xff; + uint8_t const y = offs >> 8; + uint8_t const x = offs & 0xff; if (data) - bitmap.pix32(y, x) = pens[(data >> 5) | 0x10]; + bitmap.pix(y, x) = pens[(data >> 5) | 0x10]; } } diff --git a/src/mame/video/light.cpp b/src/mame/video/light.cpp index 8092c1db2ca..50fdb9e004b 100644 --- a/src/mame/video/light.cpp +++ b/src/mame/video/light.cpp @@ -132,10 +132,10 @@ void light_video_device::device_reset() uint32_t light_video_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const rgb_t *pens = m_palette->palette()->entry_list_raw(); - const uint8_t *src = &m_framebuffer[0]; + rgb_t const *const pens = m_palette->palette()->entry_list_raw(); + uint8_t const *src = &m_framebuffer[0]; for (uint32_t y = 0; y < y_res; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *dst = &bitmap.pix(y); for (uint32_t x = 0; x < x_res; x++) { *dst++ = pens[*src++]; } diff --git a/src/mame/video/lockon.cpp b/src/mame/video/lockon.cpp index 09051177dc3..f3513693800 100644 --- a/src/mame/video/lockon.cpp +++ b/src/mame/video/lockon.cpp @@ -166,23 +166,19 @@ void lockon_state::lockon_scene_v_scr_w(uint16_t data) void lockon_state::scene_draw( ) { - uint32_t y; - /* 3bpp characters */ const uint8_t *const gfx1 = memregion("gfx2")->base(); const uint8_t *const gfx2 = gfx1 + 0x10000; const uint8_t *const gfx3 = gfx1 + 0x20000; const uint8_t *const clut = gfx1 + 0x30000; - for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) + for (uint32_t y = 0; y < FRAMEBUFFER_MAX_Y; ++y) { - uint32_t x; uint32_t d0 = 0, d1 = 0, d2 = 0; uint32_t colour = 0; uint32_t y_offs; uint32_t x_offs; uint32_t y_gran; - uint16_t *bmpaddr; uint32_t ram_mask = 0x7ff; y_offs = (y + m_scroll_v) & 0x1ff; @@ -208,9 +204,9 @@ void lockon_state::scene_draw( ) d2 = *(gfx3 + tileidx); } - bmpaddr = &m_back_buffer->pix16(y); + uint16_t *bmpaddr = &m_back_buffer->pix(y); - for (x = 0; x < FRAMEBUFFER_MAX_X; ++x) + for (uint32_t x = 0; x < FRAMEBUFFER_MAX_X; ++x) { uint32_t x_gran = (x_offs & 7) ^ 7; uint32_t col; @@ -315,7 +311,7 @@ void lockon_state::ground_draw( ) /* TODO: Clean up and emulate CS of GFX ROMs? */ for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) { - uint16_t *bmpaddr = &m_back_buffer->pix16(y); + uint16_t *bmpaddr = &m_back_buffer->pix(y); uint8_t ls163; uint32_t clut_addr; uint32_t gfx_addr; @@ -426,38 +422,23 @@ do { \ void lockon_state::objects_draw( ) { - uint32_t offs; - const uint8_t *const romlut = memregion("user1")->base(); const uint16_t *const chklut = (uint16_t*)memregion("user2")->base(); const uint8_t *const gfxrom = memregion("gfx5")->base(); const uint8_t *const sproms = memregion("proms")->base() + 0x800; - for (offs = 0; offs < m_object_ram.bytes(); offs += 4) + for (uint32_t offs = 0; offs < m_object_ram.bytes(); offs += 4) { - uint32_t y; - uint32_t xpos; - uint32_t ypos; - uint32_t xsize; - uint32_t ysize; - uint32_t xflip; - uint32_t yflip; - uint32_t scale; - uint32_t pal; - uint32_t lines; - uint32_t opsta; - uint32_t opsta15_8; - /* Retrieve the object attributes */ - ypos = m_object_ram[offs] & 0x03ff; - xpos = m_object_ram[offs + 3] & 0x07ff; - ysize = (m_object_ram[offs] >> 10) & 0x3; - xsize = (m_object_ram[offs] >> 12) & 0x3; - yflip = BIT(m_object_ram[offs], 14); - xflip = BIT(m_object_ram[offs], 15); - scale = m_object_ram[offs + 1] & 0xff; - pal = (m_object_ram[offs + 1] >> 8) & 0x7f; - opsta = m_object_ram[offs + 2]; + uint32_t ypos = m_object_ram[offs] & 0x03ff; + uint32_t xpos = m_object_ram[offs + 3] & 0x07ff; + uint32_t ysize = (m_object_ram[offs] >> 10) & 0x3; + uint32_t xsize = (m_object_ram[offs] >> 12) & 0x3; + uint32_t yflip = BIT(m_object_ram[offs], 14); + uint32_t xflip = BIT(m_object_ram[offs], 15); + uint32_t scale = m_object_ram[offs + 1] & 0xff; + uint32_t pal = (m_object_ram[offs + 1] >> 8) & 0x7f; + uint32_t opsta = m_object_ram[offs + 2]; if (m_iden) { @@ -466,14 +447,14 @@ void lockon_state::objects_draw( ) } /* How many lines will this sprite occupy? The PAL @ IC154 knows... */ - lines = scale >> (3 - ysize); + uint32_t lines = scale >> (3 - ysize); - opsta15_8 = opsta & 0xff00; + uint32_t opsta15_8 = opsta & 0xff00; /* Account for line buffering */ ypos -=1; - for (y = 0; y < FRAMEBUFFER_MAX_Y; y++) + for (uint32_t y = 0; y < FRAMEBUFFER_MAX_Y; y++) { uint32_t cy = (y + ypos) & 0x3ff; uint32_t optab; @@ -481,7 +462,7 @@ void lockon_state::objects_draw( ) uint32_t tile; uint8_t cnt; uint32_t yidx; - uint16_t *line = &m_back_buffer->pix16(y); + uint16_t *line = &m_back_buffer->pix(y); uint32_t px = xpos; /* Outside the limits? */ @@ -683,8 +664,6 @@ do { \ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint32_t y; - /* Counters */ uint32_t cxy = m_xsal & 0xff; uint32_t cyy = m_ysal & 0x1ff; @@ -704,11 +683,10 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect uint32_t axy_en = !BIT(m_dx0ll, 8); uint32_t ayy_en = !BIT(m_dy0ll, 8); - for (y = 0; y <= cliprect.max_y; ++y) + for (uint32_t y = 0; y <= cliprect.max_y; ++y) { uint32_t carry; - uint16_t *dst = &bitmap.pix16(y); - uint32_t x; + uint16_t *dst = &bitmap.pix(y); uint32_t cx = cxy; uint32_t cy = cyy; @@ -716,12 +694,12 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect uint8_t axx = axy; uint8_t ayx = ayy; - for (x = 0; x <= cliprect.max_x; ++x) + for (uint32_t x = 0; x <= cliprect.max_x; ++x) { cx &= 0x1ff; cy &= 0x1ff; - *dst++ = m_front_buffer->pix16(cy, cx); + *dst++ = m_front_buffer->pix(cy, cx); if (axx_en) INCREMENT(axx, cx); @@ -787,12 +765,10 @@ void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - uint8_t *tile_rom = memregion("gfx3")->base(); - uint32_t offs; + uint8_t const *const tile_rom = memregion("gfx3")->base(); - for (offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) + for (uint32_t offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2) { - uint32_t y; uint32_t y_pos; uint32_t x_pos; uint32_t y_size; @@ -825,7 +801,7 @@ void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) else y_size = 8; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (uint32_t y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint32_t xt; uint32_t cy; @@ -866,7 +842,7 @@ void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect ) if (x <= cliprect.max_x) { - uint16_t *dst = &bitmap.pix16(y, x); + uint16_t *const dst = &bitmap.pix(y, x); if (BIT(gfx_strip, px ^ 7) && *dst > 255) *dst = colour; diff --git a/src/mame/video/lordgun.cpp b/src/mame/video/lordgun.cpp index 755a09a887c..84b686eda1b 100644 --- a/src/mame/video/lordgun.cpp +++ b/src/mame/video/lordgun.cpp @@ -309,12 +309,10 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma // Scrolling - int x, y; - m_tilemap[0]->set_scrollx(0, *m_scroll_x[0] ); m_tilemap[0]->set_scrolly(0, *m_scroll_y[0] ); - for (y = 0; y < 0x200; y++) + for (int y = 0; y < 0x200; y++) m_tilemap[1]->set_scrollx(y, (*m_scroll_x[1]) + m_scrollram[y * 4/2 + 2/2]); m_tilemap[1]->set_scrolly(0, *m_scroll_y[1] ); @@ -331,8 +329,7 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma pen_t trans_pen = 0 * 0x800 + 0x3f; // pri = 0, pen = 3f (transparent) - int l; - for (l = 0; l < 5; l++) + for (int l = 0; l < 5; l++) m_bitmaps[l]->fill(trans_pen, cliprect); if (layers_ctrl & 1) m_tilemap[0]->draw(screen, *m_bitmaps[0], cliprect, 0, 0); @@ -348,18 +345,18 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma // layer index (0-3, 4 for sprites) -> priority address bit const int layer2bit[5] = {0,1,2,4,3}; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t pens[5]; int pri_addr = 0; // bits 0-4: layer transparency - for (l = 0; l < 5; l++) + for (int l = 0; l < 5; l++) { - pens[l] = m_bitmaps[l]->pix16(y, x); + pens[l] = m_bitmaps[l]->pix(y, x); if (pens[l] == trans_pen) pri_addr |= 1 << layer2bit[l]; } @@ -375,9 +372,9 @@ uint32_t lordgun_state::screen_update(screen_device &screen, bitmap_ind16 &bitma pri_addr &= 0x7fff; - l = pri2layer[m_priority_ram[pri_addr] & 7]; + int l = pri2layer[m_priority_ram[pri_addr] & 7]; - bitmap.pix16(y, x) = pens[l] & 0x7ff; + bitmap.pix(y, x) = pens[l] & 0x7ff; } } diff --git a/src/mame/video/lviv.cpp b/src/mame/video/lviv.cpp index e53ccfd9768..65aeb6ced32 100644 --- a/src/mame/video/lviv.cpp +++ b/src/mame/video/lviv.cpp @@ -63,18 +63,19 @@ uint32_t lviv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int x = 0; x < 256; x += 4) { const uint8_t data = m_vram[(y << 6) | (x >> 2)]; + int pen; - int pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; - bitmap.pix16(y, x + 0) = pen; + pen = m_colortable[0][((data & 0x08) >> 3) | ((data & 0x80) >> (3+3))]; + bitmap.pix(y, x + 0) = pen; pen = m_colortable[0][((data & 0x04) >> 2) | ((data & 0x40) >> (2+3))]; - bitmap.pix16(y, x + 1) = pen; + bitmap.pix(y, x + 1) = pen; pen = m_colortable[0][((data & 0x02) >> 1) | ((data & 0x20) >> (1+3))]; - bitmap.pix16(y, x + 2) = pen; + bitmap.pix(y, x + 2) = pen; pen = m_colortable[0][((data & 0x01) >> 0) | ((data & 0x10) >> (0+3))]; - bitmap.pix16(y, x + 3) = pen; + bitmap.pix(y, x + 3) = pen; } } return 0; diff --git a/src/mame/video/m10.cpp b/src/mame/video/m10.cpp index 3a0a233c961..5cb29654aca 100644 --- a/src/mame/video/m10.cpp +++ b/src/mame/video/m10.cpp @@ -86,12 +86,12 @@ void m10_state::m15_chargen_w(offs_t offset, uint8_t data) } -inline void m10_state::plot_pixel_m10( bitmap_ind16 &bm, int x, int y, int col ) +inline void m10_state::plot_pixel_m10(bitmap_ind16 &bm, int x, int y, int col) { if (!m_flip) - bm.pix16(y, x) = col; + bm.pix(y, x) = col; else - bm.pix16((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND), + bm.pix((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND), (IREMM10_HBSTART - 1) - (x - IREMM10_HBEND)) = col; // only when flip_screen(?) } diff --git a/src/mame/video/m57.cpp b/src/mame/video/m57.cpp index 1fbd130292e..524ef9d1c45 100644 --- a/src/mame/video/m57.cpp +++ b/src/mame/video/m57.cpp @@ -170,36 +170,35 @@ void m57_state::m57_flipscreen_w(uint8_t data) void m57_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y,x; - int16_t scrolly; - // from 64 to 127: not wrapped - for (y = 64; y < 128; y++) + for (int y = 64; y < 128; y++) m_bg_tilemap->set_scrollx(y, m_scrollram[0x40]); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); // from 128 to 255: wrapped - for (y = 128; y <= cliprect.max_y; y++) + for (int y = 128; y <= cliprect.max_y; y++) { - scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8); + int16_t const scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8); if (scrolly >= 0) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if ((x + scrolly) <= cliprect.max_x) - bitmap.pix16(y, x) = bitmap.pix16(y, x + scrolly); + bitmap.pix(y, x) = bitmap.pix(y, x + scrolly); else - bitmap.pix16(y, x) = bitmap.pix16(y, cliprect.max_x); + bitmap.pix(y, x) = bitmap.pix(y, cliprect.max_x); } - } else { - for (x = cliprect.max_x; x >= cliprect.min_x; x--) + } + else + { + for (int x = cliprect.max_x; x >= cliprect.min_x; x--) { if ((x + scrolly) >= cliprect.min_x) - bitmap.pix16(y, x) = bitmap.pix16(y, x + scrolly); + bitmap.pix(y, x) = bitmap.pix(y, x + scrolly); else - bitmap.pix16(y, x) = bitmap.pix16(y, cliprect.min_x); + bitmap.pix(y, x) = bitmap.pix(y, cliprect.min_x); } } } diff --git a/src/mame/video/m58.cpp b/src/mame/video/m58.cpp index f39d9936556..c986639b8ec 100644 --- a/src/mame/video/m58.cpp +++ b/src/mame/video/m58.cpp @@ -125,8 +125,8 @@ void m58_state::scroll_panel_w(offs_t offset, uint8_t data) col = (data >> i) & 0x11; col = ((col >> 3) | col) & 3; - m_scroll_panel_bitmap.pix16(sy, sx + i) = 0x100 + (sy & 0xfc) + col; - m_scroll_panel_bitmap.pix16(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen + m_scroll_panel_bitmap.pix(sy, sx + i) = 0x100 + (sy & 0xfc) + col; + m_scroll_panel_bitmap.pix(sy, sx + i + 0x2c8) = 0x100 + (sy & 0xfc) + col; // for flipscreen } } diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp index 12ad7e3af40..33625b9359e 100644 --- a/src/mame/video/mac.cpp +++ b/src/mame/video/mac.cpp @@ -77,23 +77,17 @@ VIDEO_START_MEMBER(mac_state,mac) uint32_t mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint32_t const video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); + uint16_t const *video_ram = (const uint16_t *) (m_ram->pointer() + video_base); - video_base = m_ram->size() - (m_screen_buffer ? MAC_MAIN_SCREEN_BUF_OFFSET : MAC_ALT_SCREEN_BUF_OFFSET); - video_ram = (const uint16_t *) (m_ram->pointer() + video_base); - - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = *(video_ram++); - for (b = 0; b < 16; b++) + uint16_t const word = *(video_ram++); + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -104,24 +98,17 @@ uint32_t mac_state::screen_update_mac(screen_device &screen, bitmap_ind16 &bitma uint32_t mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint32_t video_base; - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_base = m_screen_buffer ? 0x8000 : 0; - video_base += (MAC_H_VIS/8); - video_ram = (const uint16_t *) &m_vram[video_base/4]; + uint32_t const video_base = (m_screen_buffer ? 0x8000 : 0) + (MAC_H_VIS/8); + uint16_t const *const video_ram = (const uint16_t *) &m_vram[video_base/4]; - for (y = 0; y < MAC_V_VIS; y++) + for (int y = 0; y < MAC_V_VIS; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < MAC_H_VIS; x += 16) + for (int x = 0; x < MAC_H_VIS; x += 16) { - word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * MAC_H_VIS)/16) + ((x/16)^1)]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -132,21 +119,16 @@ uint32_t mac_state::screen_update_macse30(screen_device &screen, bitmap_ind16 &b uint32_t mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; - - video_ram = (const uint16_t *) m_vram16.target(); + uint16_t const *const video_ram = (const uint16_t *) m_vram16.target(); - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = video_ram[((y * 640)/16) + ((x/16))]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * 640)/16) + ((x/16))]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -157,21 +139,16 @@ uint32_t mac_state::screen_update_macprtb(screen_device &screen, bitmap_ind16 &b uint32_t mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - const uint16_t *video_ram; - uint16_t word; - uint16_t *line; - int y, x, b; + uint16_t const *const video_ram = (const uint16_t *) m_vram.target(); - video_ram = (const uint16_t *) m_vram.target(); - - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *const line = &bitmap.pix(y); - for (x = 0; x < 640; x += 16) + for (int x = 0; x < 640; x += 16) { - word = video_ram[((y * 640)/16) + ((x/16)^1)]; - for (b = 0; b < 16; b++) + uint16_t const word = video_ram[((y * 640)/16) + ((x/16)^1)]; + for (int b = 0; b < 16; b++) { line[x + b] = (word >> (15 - b)) & 0x0001; } @@ -182,18 +159,15 @@ uint32_t mac_state::screen_update_macpb140(screen_device &screen, bitmap_ind16 & uint32_t mac_state::screen_update_macpb160(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint16_t *line; - int y, x; - uint8_t pixels; - uint8_t *vram8 = (uint8_t *)m_vram.target(); + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < 400; y++) + for (int y = 0; y < 400; y++) { - line = &bitmap.pix16(y); + uint16_t *line = &bitmap.pix(y); - for (x = 0; x < 640/4; x++) + for (int x = 0; x < 640/4; x++) { - pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; *line++ = ((pixels>>6)&3); *line++ = ((pixels>>4)&3); @@ -359,9 +333,8 @@ VIDEO_START_MEMBER(mac_state,macv8) uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - uint8_t *vram8 = (uint8_t *)m_ram->pointer(); + uint8_t const *vram8 = (uint8_t *)m_ram->pointer(); + int hres, vres; switch (m_rbv_montype) { @@ -392,14 +365,12 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi { case 0: // 1bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * (hres/8)) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0xfe|(pixels>>7)]; *scanline++ = m_rbv_palette[0xfe|((pixels>>6)&1)]; @@ -416,14 +387,12 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 1: // 2bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; @@ -436,15 +405,13 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 2: // 4bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; @@ -455,15 +422,13 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi case 3: // 8bpp { - uint8_t pixels; - - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * hres) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -475,9 +440,7 @@ uint32_t mac_state::screen_update_macrbv(screen_device &screen, bitmap_rgb32 &bi uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - + int hres, vres; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -501,15 +464,14 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * 0x400) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * 0x400) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -526,15 +488,14 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xfc|((pixels>>6)&3)]; *scanline++ = m_rbv_palette[0xfc|((pixels>>4)&3)]; @@ -547,16 +508,15 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (hres/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0xf0|(pixels>>4)]; *scanline++ = m_rbv_palette[0xf0|(pixels&0xf)]; @@ -567,16 +527,15 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 2048) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -588,9 +547,7 @@ uint32_t mac_state::screen_update_macrbvvram(screen_device &screen, bitmap_rgb32 uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres; - + int hres, vres; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -614,15 +571,14 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * 1024) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * 1024) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -639,15 +595,14 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; @@ -660,16 +615,15 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres/2; x++) + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; @@ -680,16 +634,15 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); + uint32_t *scanline = &bitmap.pix(y); - for (x = 0; x < hres; x++) + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 1024) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -702,9 +655,7 @@ uint32_t mac_state::screen_update_macv8(screen_device &screen, bitmap_rgb32 &bit uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y, hres, vres, stride; - + int hres, vres, stride; switch (m_rbv_montype) { case 1: // 15" portrait display @@ -734,15 +685,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x+=8) { - pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * (stride/8)) + ((x/8)^3)]; *scanline++ = m_rbv_palette[0x7f|(pixels&0x80)]; *scanline++ = m_rbv_palette[0x7f|((pixels<<1)&0x80)]; @@ -759,15 +709,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < hres/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/4; x++) { - pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (stride/4)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[0x3f|(pixels&0xc0)]; *scanline++ = m_rbv_palette[0x3f|((pixels<<2)&0xc0)]; @@ -780,16 +729,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres/2; x++) { - pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * (stride/2)) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels&0xf0) | 0xf]; *scanline++ = m_rbv_palette[((pixels&0x0f)<<4) | 0xf]; @@ -800,16 +747,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *const vram8 = (uint8_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x++) { - pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -818,16 +763,14 @@ uint32_t mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 case 4: // 16bpp { - uint16_t *vram16 = (uint16_t *)m_vram.target(); - uint16_t pixels; + uint16_t const *const vram16 = (uint16_t *)m_vram.target(); - for (y = 0; y < vres; y++) + for (int y = 0; y < vres; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < hres; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < hres; x++) { - pixels = vram16[(y * stride) + (x^1)]; + uint16_t const pixels = vram16[(y * stride) + (x^1)]; *scanline++ = rgb_t(((pixels>>10) & 0x1f)<<3, ((pixels>>5) & 0x1f)<<3, (pixels & 0x1f)<<3); } } @@ -1047,23 +990,19 @@ void mac_state::dafb_dac_w(offs_t offset, uint32_t data, uint32_t mem_mask) uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - switch (m_dafb_mode) { case 0: // 1bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152; x+=8) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x+=8) { - pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + ((x/8)^3)]; *scanline++ = m_rbv_palette[(pixels>>7)&1]; *scanline++ = m_rbv_palette[(pixels>>6)&1]; @@ -1080,16 +1019,15 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b case 1: // 2bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1152/4; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/4; x++) { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[((pixels>>6)&3)]; *scanline++ = m_rbv_palette[((pixels>>4)&3)]; @@ -1102,17 +1040,15 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b case 2: // 4bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152/2; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152/2; x++) { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[(pixels>>4)]; *scanline++ = m_rbv_palette[(pixels&0xf)]; @@ -1123,17 +1059,15 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b case 3: // 8bpp { - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); vram8 += m_dafb_base; - for (y = 0; y < 870; y++) + for (int y = 0; y < 870; y++) { - scanline = &bitmap.pix32(y); - - for (x = 0; x < 1152; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 1152; x++) { - pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * m_dafb_stride) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } @@ -1141,13 +1075,11 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b break; case 4: // 24 bpp - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - uint32_t *base; - - scanline = &bitmap.pix32(y); - base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + uint32_t const *base = (uint32_t *)&m_vram[(y * (m_dafb_stride/4)) + (m_dafb_base/4)]; + for (int x = 0; x < 640; x++) { *scanline++ = *base++; } @@ -1160,19 +1092,16 @@ uint32_t mac_state::screen_update_macdafb(screen_device &screen, bitmap_rgb32 &b uint32_t mac_state::screen_update_macpbwd(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)/* Color PowerBooks using an off-the-shelf WD video chipset */ { - uint32_t *scanline; - int x, y; - uint8_t *vram8 = (uint8_t *)m_vram.target(); - uint8_t pixels; + uint8_t const *vram8 = (uint8_t *)m_vram.target(); // vram8 += 0x40000; - for (y = 0; y < 480; y++) + for (int y = 0; y < 480; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 640; x++) + uint32_t *scanline = &bitmap.pix(y); + for (int x = 0; x < 640; x++) { - pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; + uint8_t const pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; *scanline++ = m_rbv_palette[pixels]; } } diff --git a/src/mame/video/madalien.cpp b/src/mame/video/madalien.cpp index 7c1c2154b3c..8303131ca6a 100644 --- a/src/mame/video/madalien.cpp +++ b/src/mame/video/madalien.cpp @@ -209,8 +209,8 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr if ((hx < cliprect.left()) || (hx > cliprect.right())) continue; - if (m_headlight_bitmap->pix16(y, x) != 0) - bitmap.pix16(hy, hx) |= 8; + if (m_headlight_bitmap->pix(y, x) != 0) + bitmap.pix(hy, hx) |= 8; } } } @@ -277,7 +277,7 @@ uint32_t madalien_state::screen_update_madalien(screen_device &screen, bitmap_in for (y = cliprect.top(); y <= cliprect.bottom(); y++) for (x = min_x; x <= max_x; x++) if ((x >= cliprect.left()) && (x <= cliprect.right())) - bitmap.pix16(y, x) |= 8; + bitmap.pix(y, x) |= 8; } draw_headlight(bitmap, cliprect, flip); diff --git a/src/mame/video/magmax.cpp b/src/mame/video/magmax.cpp index 06d8643b448..0f216c1ed05 100644 --- a/src/mame/video/magmax.cpp +++ b/src/mame/video/magmax.cpp @@ -145,7 +145,7 @@ uint32_t magmax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap /*priority: background over sprites*/ if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c)) - m_bitmap.pix16(v, h) = line_data[h]; + m_bitmap.pix(v, h) = line_data[h]; } if (m_flipscreen) diff --git a/src/mame/video/malzak.cpp b/src/mame/video/malzak.cpp index efc9f7ce1b3..48745186ec7 100644 --- a/src/mame/video/malzak.cpp +++ b/src/mame/video/malzak.cpp @@ -95,20 +95,20 @@ uint32_t malzak_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { int sx = x / 2; - int s2636_pix_0 = s2636_0_bitmap.pix16(sy, sx); - int s2636_pix_1 = s2636_1_bitmap.pix16(sy, sx); - rgb_t trom_pix = m_trom_bitmap->pix32(y, x); - rgb_t play_pix = m_playfield_bitmap->pix32(sy, sx); + int s2636_pix_0 = s2636_0_bitmap.pix(sy, sx); + int s2636_pix_1 = s2636_1_bitmap.pix(sy, sx); + rgb_t trom_pix = m_trom_bitmap->pix(y, x); + rgb_t play_pix = m_playfield_bitmap->pix(sy, sx); // SAA5050 > s2636[1] > s2636[0] > playfield if (trom_pix != rgb_t::black()) - bitmap.pix32(y, x) = trom_pix; + bitmap.pix(y, x) = trom_pix; else if (S2636_IS_PIXEL_DRAWN(s2636_pix_1)) - bitmap.pix32(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_1)]; + bitmap.pix(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_1)]; else if (S2636_IS_PIXEL_DRAWN(s2636_pix_0)) - bitmap.pix32(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_0)]; + bitmap.pix(y, x) = palette[S2636_PIXEL_COLOR(s2636_pix_0)]; else - bitmap.pix32(y, x) = play_pix; + bitmap.pix(y, x) = play_pix; } } diff --git a/src/mame/video/mappy.cpp b/src/mame/video/mappy.cpp index 215f2d281a5..744ba14f4d2 100644 --- a/src/mame/video/mappy.cpp +++ b/src/mame/video/mappy.cpp @@ -507,7 +507,6 @@ void mappy_state::phozon_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cli uint32_t mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &sprite_bitmap = m_sprite_bitmap; - int x,y; m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); @@ -519,14 +518,14 @@ uint32_t mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 m_bg_tilemap->draw(screen, bitmap, cliprect, 1,0); /* sprite color 0/1 still has priority over that (ghost eyes in Pac 'n Pal) */ - for (y = 0;y < sprite_bitmap.height();y++) + for (int y = 0;y < sprite_bitmap.height();y++) { - for (x = 0;x < sprite_bitmap.width();x++) + for (int x = 0;x < sprite_bitmap.width();x++) { - int spr_entry = sprite_bitmap.pix16(y, x); + int spr_entry = sprite_bitmap.pix(y, x); int spr_pen = m_palette->pen_indirect(spr_entry); if (spr_pen == 0 || spr_pen == 1) - bitmap.pix16(y, x) = spr_entry; + bitmap.pix(y, x) = spr_entry; } } return 0; diff --git a/src/mame/video/maria.cpp b/src/mame/video/maria.cpp index 341ed274573..25e5c497dba 100644 --- a/src/mame/video/maria.cpp +++ b/src/mame/video/maria.cpp @@ -291,8 +291,7 @@ void atari_maria_device::draw_scanline() // draw line buffer to screen m_active_buffer = !m_active_buffer; // switch buffers - uint16_t *scanline; - scanline = &m_bitmap.pix16(m_screen->vpos()); + uint16_t *const scanline = &m_bitmap.pix(m_screen->vpos()); for (int i = 0; i < 160; i++) diff --git a/src/mame/video/mbc55x.cpp b/src/mame/video/mbc55x.cpp index c9ab2aac277..4f586d8e4e0 100644 --- a/src/mame/video/mbc55x.cpp +++ b/src/mame/video/mbc55x.cpp @@ -95,21 +95,12 @@ void mbc55x_state::video_debug(int ref, const std::vector<std::string> ¶ms) MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - - uint8_t *ram = &m_ram->pointer()[0]; - uint8_t *red = &m_video_mem[RED_PLANE_OFFSET]; - uint8_t *blue = &m_video_mem[BLUE_PLANE_OFFSET]; - uint8_t *green; - int offset; - uint8_t rpx,gpx,bpx; - uint8_t rb,gb,bb; - - int x_pos; - int pixelno; - uint8_t bitno; - uint8_t shifts; - uint8_t colour; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + + uint8_t const *const ram = &m_ram->pointer()[0]; + uint8_t const *const red = &m_video_mem[RED_PLANE_OFFSET]; + uint8_t const *const blue = &m_video_mem[BLUE_PLANE_OFFSET]; + uint8_t const *green; switch(m_vram_page) { @@ -124,30 +115,30 @@ MC6845_UPDATE_ROW( mbc55x_state::crtc_update_row ) if(DEBUG_SET(DEBUG_LINES)) logerror("MC6845_UPDATE_ROW: ma=%d, ra=%d, y=%d, x_count=%d\n",ma,ra,y,x_count); - offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; + int offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; if(DEBUG_SET(DEBUG_LINES)) logerror("offset=%05X\n",offset); - for(x_pos=0; x_pos<x_count; x_pos++) + for(int x_pos=0; x_pos<x_count; x_pos++) { uint16_t mem = (offset+(x_pos*4)) % COLOUR_PLANE_SIZE; - rpx=red[mem]; - gpx=green[mem]; - bpx=blue[mem]; + uint8_t rpx=red[mem]; + uint8_t gpx=green[mem]; + uint8_t bpx=blue[mem]; - bitno=0x80; - shifts=7; + uint8_t bitno=0x80; + uint8_t shifts=7; - for(pixelno=0; pixelno<8; pixelno++) + for(int pixelno=0; pixelno<8; pixelno++) { - rb=(rpx & bitno) >> shifts; - gb=(gpx & bitno) >> shifts; - bb=(bpx & bitno) >> shifts; + uint8_t rb=(rpx & bitno) >> shifts; + uint8_t gb=(gpx & bitno) >> shifts; + uint8_t bb=(bpx & bitno) >> shifts; - colour=(rb<<2) | (gb<<1) | (bb<<0); + uint8_t colour=(rb<<2) | (gb<<1) | (bb<<0); - bitmap.pix32(y, (x_pos*8)+pixelno)=palette[colour]; + bitmap.pix(y, (x_pos*8)+pixelno)=palette[colour]; //logerror("set pixel (%d,%d)=%d\n",y, ((x_pos*8)+pixelno),colour); bitno=bitno>>1; shifts--; diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp index 42098b97bc9..56416f6b3bd 100644 --- a/src/mame/video/mbee.cpp +++ b/src/mame/video/mbee.cpp @@ -270,7 +270,7 @@ MC6845_UPDATE_ROW( mbee_state::crtc_update_row ) if ((monopal==0) && !BIT(m_features, 0)) monopal = 2; - u32 *p = &bitmap.pix32(y); + u32 *p = &bitmap.pix(y); u8 inv, attr=0, gfx, fg=96+monopal, bg=96, col=0; u16 mem, x, chr; diff --git a/src/mame/video/mcatadv.cpp b/src/mame/video/mcatadv.cpp index 38b7da27c53..56d20dde833 100644 --- a/src/mame/video/mcatadv.cpp +++ b/src/mame/video/mcatadv.cpp @@ -84,8 +84,8 @@ void mcatadv_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, c if ((drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y)) { - u16 *destline = &bitmap.pix16(drawypos); - u8 *priline = &screen.priority().pix8(drawypos); + u16 *const destline = &bitmap.pix(drawypos); + u8 *const priline = &screen.priority().pix(drawypos); for (int xcnt = xstart; xcnt != xend; xcnt += xinc) { diff --git a/src/mame/video/mcd212.cpp b/src/mame/video/mcd212.cpp index 294bc7cabf8..c6e32759101 100644 --- a/src/mame/video/mcd212.cpp +++ b/src/mame/video/mcd212.cpp @@ -1215,15 +1215,14 @@ void mcd212_device::draw_scanline(int y) uint8_t plane_a_r[768], plane_a_g[768], plane_a_b[768]; uint8_t plane_b_r[768], plane_b_g[768], plane_b_b[768]; uint32_t out[768]; - uint32_t *scanline = &m_bitmap.pix32(y); - int x; process_vsr(0, plane_a_r, plane_a_g, plane_a_b); process_vsr(1, plane_b_r, plane_b_g, plane_b_b); mix_lines(plane_a_r, plane_a_g, plane_a_b, plane_b_r, plane_b_g, plane_b_b, out); - for(x = 0; x < 384; x++) + uint32_t *const scanline = &m_bitmap.pix(y); + for(int x = 0; x < 384; x++) { scanline[x] = out[x*2]; } diff --git a/src/mame/video/mcr.cpp b/src/mame/video/mcr.cpp index 48738c0eeef..ee0aa745b42 100644 --- a/src/mame/video/mcr.cpp +++ b/src/mame/video/mcr.cpp @@ -272,9 +272,9 @@ void mcr_state::render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) if (sy >= cliprect.min_y && sy <= cliprect.max_y) { - const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); - uint16_t *dst = &bitmap.pix16(sy); - uint8_t *pri = &screen.priority().pix8(sy); + uint8_t const *const src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); + uint16_t *const dst = &bitmap.pix(sy); + uint8_t *const pri = &screen.priority().pix(sy); /* loop over columns */ for (int x = 0; x < 32; x++) @@ -339,9 +339,9 @@ void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff) if (sy >= 2 && sy >= cliprect.min_y && sy <= cliprect.max_y) { - const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); - uint16_t *dst = &bitmap.pix16(sy); - uint8_t *pri = &screen.priority().pix8(sy); + uint8_t const *const src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); + uint16_t *const dst = &bitmap.pix(sy); + uint8_t *const pri = &screen.priority().pix(sy); /* loop over columns */ for (int x = 0; x < 32; x++) diff --git a/src/mame/video/megasys1.cpp b/src/mame/video/megasys1.cpp index 8a6f6a30d3d..6c1b3b144dd 100644 --- a/src/mame/video/megasys1.cpp +++ b/src/mame/video/megasys1.cpp @@ -334,17 +334,17 @@ void megasys1_state::monkelf_scroll1_w(offs_t offset, u16 data, u16 mem_mask) void megasys1_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { gfx_element *decodegfx = m_gfxdecode->gfx(0); - u16 colorbase = decodegfx->colorbase(); + u16 const colorbase = decodegfx->colorbase(); for (int y = cliprect.min_y;y <= cliprect.max_y;y++) { - u16* srcline = &m_sprite_buffer_bitmap.pix16(y); - u16* dstline = &bitmap.pix16(y); - u8 *prio = &screen.priority().pix8(y); + u16 const *const srcline = &m_sprite_buffer_bitmap.pix(y); + u16 *const dstline = &bitmap.pix(y); + u8 const *const prio = &screen.priority().pix(y); for (int x = cliprect.min_x;x <= cliprect.max_x;x++) { - u16 pixel = srcline[x]; + u16 const pixel = srcline[x]; if ((pixel & 0xf) != 0xf) { @@ -366,11 +366,11 @@ void megasys1_state::partial_clear_sprite_bitmap(screen_device &screen, bitmap_i { for (int y = cliprect.min_y;y <= cliprect.max_y;y++) { - u16* srcline = &m_sprite_buffer_bitmap.pix16(y); + u16 *const srcline = &m_sprite_buffer_bitmap.pix(y); for (int x = cliprect.min_x;x <= cliprect.max_x;x++) { - u16 pixel = srcline[x]; + u16 const pixel = srcline[x]; srcline[x] = pixel & 0x7fff; // wipe our 'drawn here' marker otherwise trails will always have priority over new sprites, which is incorrect. // guess, very unclear from the video refernece we have, used when removing p47 trails @@ -397,9 +397,9 @@ inline void megasys1_state::draw_16x16_priority_sprite(screen_device &screen, bi for (s32 y = 0; y < 16; y++, sy++, sx-=16) { - // u16 *dest = &bitmap.pix16(sy)+ sx; - // u8 *prio = &screen.priority().pix8(sy) + sx; - u16* dest = &m_sprite_buffer_bitmap.pix16(sy)+ sx; + // u16 *const dest = &bitmap.pix(sy)+ sx; + // u8 *const prio = &screen.priority().pix(sy) + sx; + u16 *const dest = &m_sprite_buffer_bitmap.pix(sy)+ sx; for (s32 x = 0; x < 16; x++, sx++) { diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp index 0d3c1be9ed9..d3271d9d4e8 100644 --- a/src/mame/video/mermaid.cpp +++ b/src/mame/video/mermaid.cpp @@ -220,18 +220,14 @@ uint8_t mermaid_state::collision_check( rectangle& rect ) { uint8_t data = 0; - int x; - int y; - - for (y = rect.top(); y <= rect.bottom(); y++) - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) { - uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)) & 0x3f; - uint16_t b = m_palette->pen_indirect(m_helper2.pix16(y, x)) & 0x3f; + uint16_t const a = m_palette->pen_indirect(m_helper.pix(y, x)) & 0x3f; + uint16_t const b = m_palette->pen_indirect(m_helper2.pix(y, x)) & 0x3f; - if (b) - if (a) - data |= 0x01; + if (b && a) + data |= 0x01; } return data; diff --git a/src/mame/video/micro3d.cpp b/src/mame/video/micro3d.cpp index 79e9422b9e2..75f92bf901a 100644 --- a/src/mame/video/micro3d.cpp +++ b/src/mame/video/micro3d.cpp @@ -66,21 +66,18 @@ void micro3d_state::video_reset() TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update) { - uint16_t *src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; + uint16_t *dest = &bitmap.pix(scanline); int coladdr = params->coladdr; int sd_11_7 = (m_creg & 0x1f) << 7; - int x; - - uint16_t *frame_src; scanline = std::max((scanline - params->veblnk), 0); - frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); + uint16_t const *frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); /* TODO: XFER3DK - X/Y offsets for 3D */ /* Copy the non-blanked portions of this scanline */ - for (x = params->heblnk; x < params->hsblnk; x += 2) + for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pix = src[coladdr++ & 0x1ff]; diff --git a/src/mame/video/midtunit.cpp b/src/mame/video/midtunit.cpp index afea37e9f7c..94594884e38 100644 --- a/src/mame/video/midtunit.cpp +++ b/src/mame/video/midtunit.cpp @@ -849,8 +849,8 @@ skipdma: TMS340X0_SCANLINE_IND16_CB_MEMBER(midtunit_video_device::scanline_update) { - uint16_t *src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; /* copy the non-blanked portions of this scanline */ @@ -861,8 +861,8 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(midtunit_video_device::scanline_update) TMS340X0_SCANLINE_IND16_CB_MEMBER(midxunit_video_device::scanline_update) { uint32_t fulladdr = ((params->rowaddr << 16) | params->coladdr) >> 3; - uint16_t *src = &m_local_videoram[fulladdr & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[fulladdr & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); /* copy the non-blanked portions of this scanline */ for (int x = params->heblnk; x < params->hsblnk; x++) diff --git a/src/mame/video/midtview.ipp b/src/mame/video/midtview.ipp index 046a193e8d3..f59a101be40 100644 --- a/src/mame/video/midtview.ipp +++ b/src/mame/video/midtview.ipp @@ -266,7 +266,7 @@ uint32_t midtunit_video_device::debug_screen_update(screen_device &screen, bitma const pen_t *pens = m_debug_palette->pens(); for (int y = 0; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *dest = &bitmap.pix(y); uint16_t *src = &m_debug_videoram[y * 512]; for (int x = 0; x < cliprect.max_x; x++) { diff --git a/src/mame/video/midvunit.cpp b/src/mame/video/midvunit.cpp index 53c51aa6e31..4d8b8e977b6 100644 --- a/src/mame/video/midvunit.cpp +++ b/src/mame/video/midvunit.cpp @@ -548,7 +548,7 @@ uint32_t midvunit_state::midvunit_textureram_r(offs_t offset) uint32_t midvunit_state::screen_update_midvunit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y, width, xoffs; + int width, xoffs; uint32_t offset; m_poly->wait("Refresh Time"); @@ -574,10 +574,10 @@ uint32_t midvunit_state::screen_update_midvunit(screen_device &screen, bitmap_in offset += 512 * (cliprect.min_y - screen.visible_area().min_y); /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); - for (x = 0; x < width; x++) + uint16_t *dest = &bitmap.pix(y, cliprect.min_x); + for (int x = 0; x < width; x++) *dest++ = m_videoram[offset + x] & 0x7fff; offset += 512; } diff --git a/src/mame/video/midyunit.cpp b/src/mame/video/midyunit.cpp index fe3233e827f..e535d74ab75 100644 --- a/src/mame/video/midyunit.cpp +++ b/src/mame/video/midyunit.cpp @@ -557,13 +557,12 @@ TIMER_CALLBACK_MEMBER(midyunit_state::autoerase_line) TMS340X0_SCANLINE_IND16_CB_MEMBER(midyunit_state::scanline_update) { - uint16_t *src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; - uint16_t *dest = &bitmap.pix16(scanline); + uint16_t const *const src = &m_local_videoram[(params->rowaddr << 9) & 0x3fe00]; + uint16_t *const dest = &bitmap.pix(scanline); int coladdr = params->coladdr << 1; - int x; /* adjust the display address to account for ignored bits */ - for (x = params->heblnk; x < params->hsblnk; x++) + for (int x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_pen_map[src[coladdr++ & 0x1ff]]; /* handle autoerase on the previous line */ diff --git a/src/mame/video/midzeus.cpp b/src/mame/video/midzeus.cpp index a633b565e1e..a75ac49ba13 100644 --- a/src/mame/video/midzeus.cpp +++ b/src/mame/video/midzeus.cpp @@ -281,7 +281,7 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma int xoffs = screen.visible_area().min_x; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dest[x] = WAVERAM_READPIX(base, y, x - xoffs) & 0x7fff; } @@ -302,10 +302,10 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - uint8_t tex = get_texel_8bit(base, y, x, m_texel_width); + uint8_t const tex = get_texel_8bit(base, y, x, m_texel_width); dest[x] = (tex << 8) | tex; } } diff --git a/src/mame/video/mikromik.cpp b/src/mame/video/mikromik.cpp index 90c779d5179..ee2fb0f8fe3 100644 --- a/src/mame/video/mikromik.cpp +++ b/src/mame/video/mikromik.cpp @@ -19,7 +19,6 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) int compl_in = rvv; // reverse video int hlt_in = hlgt; // highlight; int color; // 0 = black, 1 = dk green, 2 = lt green; on MikroMikko 1, "highlight" is actually the darker shade of green - int i, qh, video_in; int d7 = BIT(romdata, 7); // save MSB (1 indicates that this is a Visual Attribute or Special Code instead of a normal display character) int d6 = BIT(romdata, 6); // save also first and last char bitmap bits before shifting out the MSB @@ -37,19 +36,19 @@ I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels ) // Step 2: Make sure i8275_device::recompute_parameters() is called in i8275_device::device_start() // Step 3: Fill in missing 2 pixels in the screen bitmap by repeating last column of the char bitmap // (works better with MikroMikko 1 font than duplicating the first and the last column) - qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB - video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; + int qh = d7 & d6; // extend pixels on the right side only if there were two adjacent ones before shifting out the MSB + int video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; color = (hlt_in ? 1 : 2) * (video_in ^ compl_in); - bitmap.pix32(y, x + 8) = m_palette->pen(color); - bitmap.pix32(y, x + 9) = m_palette->pen(color); + bitmap.pix(y, x + 8) = m_palette->pen(color); + bitmap.pix(y, x + 9) = m_palette->pen(color); } - for (i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline + for (int i = 0; i < 8; ++i) // ...and now the actual character bitmap bits for this scanline { - qh = BIT(data, i); - video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; + int qh = BIT(data, i); + int video_in = ((((d7 & llen) | (vsp ? 0 : 1)) & (gpa0 ? 0 : 1)) & qh) | lten; color = (hlt_in ? 1 : 2)*(video_in ^ compl_in); - bitmap.pix32(y, x + i) = m_palette->pen(color); + bitmap.pix(y, x + i) = m_palette->pen(color); } } } @@ -75,7 +74,7 @@ UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels ) uint16_t data = m_video_ram[address >> 1]; for (int i = 0; i < 16; i++) { - if (BIT(data, i)) bitmap.pix32(y, x + i) = m_palette->pen(2); + if (BIT(data, i)) bitmap.pix(y, x + i) = m_palette->pen(2); } } diff --git a/src/mame/video/mmdisplay2.cpp b/src/mame/video/mmdisplay2.cpp index b3f33d21780..74bd90c4139 100644 --- a/src/mame/video/mmdisplay2.cpp +++ b/src/mame/video/mmdisplay2.cpp @@ -70,7 +70,7 @@ void mephisto_display_module2_device::lcd_palette(palette_device &palette) const HD44780_PIXEL_UPDATE(mephisto_display_module2_device::lcd_pixel_update) { if (x < 5 && y < 8 && line < 2 && pos < 16) - bitmap.pix16(line*9 + 1 + y, 1 + pos*6 + x) = state ? 1 : 2; + bitmap.pix(line*9 + 1 + y, 1 + pos*6 + x) = state ? 1 : 2; } diff --git a/src/mame/video/model1.cpp b/src/mame/video/model1.cpp index 9d4c8d428da..0de31d90bc4 100644 --- a/src/mame/video/model1.cpp +++ b/src/mame/video/model1.cpp @@ -91,7 +91,7 @@ void model1_state::view_t::project_point_direct(point_t *p) const void model1_state::draw_hline(bitmap_rgb32 &bitmap, int x1, int x2, int y, int color) { - uint32_t *base = &bitmap.pix32(y); + uint32_t *const base = &bitmap.pix(y); while(x1 <= x2) { base[x1] = color; @@ -101,7 +101,7 @@ void model1_state::draw_hline(bitmap_rgb32 &bitmap, int x1, int x2, int y, int c void model1_state::draw_hline_moired(bitmap_rgb32 &bitmap, int x1, int x2, int y, int color) { - uint32_t *base = &bitmap.pix32(y); + uint32_t *const base = &bitmap.pix(y); while(x1 <= x2) { if((x1^y) & 1) @@ -407,7 +407,7 @@ void model1_state::draw_line(bitmap_rgb32 &bitmap, model1_state::view_t *view, i { if (x >= view->x1 && x <= view->x2 && y >= view->y1 && y <= view->y2) { - bitmap.pix32(y, x) = color; + bitmap.pix(y, x) = color; } x += s1x; y += s1y; @@ -421,7 +421,7 @@ void model1_state::draw_line(bitmap_rgb32 &bitmap, model1_state::view_t *view, i } if (x >= view->x1 && x <= view->x2 && y >= view->y1 && y <= view->y2) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } } #endif diff --git a/src/mame/video/model2.cpp b/src/mame/video/model2.cpp index 427db401050..3e4478a85e4 100644 --- a/src/mame/video/model2.cpp +++ b/src/mame/video/model2.cpp @@ -948,15 +948,14 @@ void model2_state::draw_framebuffer( bitmap_rgb32 &bitmap, const rectangle &clip { for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - int r,g,b; int offset = (x + xoffs) + (y + yoffs)*512; - b = (fbvram[offset] >> 0) & 0x1f; - r = (fbvram[offset] >> 5) & 0x1f; - g = (fbvram[offset] >> 10) & 0x1f; + int b = (fbvram[offset] >> 0) & 0x1f; + int r = (fbvram[offset] >> 5) & 0x1f; + int g = (fbvram[offset] >> 10) & 0x1f; r = pal5bit(r); g = pal5bit(g); b = pal5bit(b); - bitmap.pix32(y, x) = r << 16 | g << 8 | b; + bitmap.pix(y, x) = r << 16 | g << 8 | b; } } } diff --git a/src/mame/video/model2rd.hxx b/src/mame/video/model2rd.hxx index 53325c06b14..7c878868fac 100644 --- a/src/mame/video/model2rd.hxx +++ b/src/mame/video/model2rd.hxx @@ -60,8 +60,7 @@ void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_ex { #if !defined( MODEL2_TRANSLUCENT) model2_state *state = object.state; - bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap; - u32 *p = &destmap->pix32(scanline); + u32 *const p = &m_destmap.pix(scanline); // u8 *gamma_value = &state->m_gamma_table[0]; /* extract color information */ @@ -119,8 +118,7 @@ void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_ex void MODEL2_FUNC_NAME(int32_t scanline, const extent_t& extent, const m2_poly_extra_data& object, int threadid) { model2_state *state = object.state; - bitmap_rgb32 *destmap = (bitmap_rgb32 *)&m_destmap; - u32 *p = &destmap->pix32(scanline); + u32 *const p = &m_destmap.pix(scanline); u32 tex_width = object.texwidth; u32 tex_height = object.texheight; diff --git a/src/mame/video/model3.cpp b/src/mame/video/model3.cpp index d2ebec94fa9..918653160ca 100644 --- a/src/mame/video/model3.cpp +++ b/src/mame/video/model3.cpp @@ -245,12 +245,11 @@ TILE_GET_INFO_MEMBER(model3_state::tile_info_layer3_8bit) { MODEL3_TILE_INFO8(0x #ifdef UNUSED_FUNCTION void model3_state::draw_texture_sheet(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y; - for(y = cliprect.min_y; y <= cliprect.max_y; y++) + for(int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *d = &bitmap.pix16(y); + uint16_t *const d = &bitmap.pix(y); int index = (y*2)*2048; - for(x = cliprect.min_x; x <= cliprect.max_x; x++) { + for(int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t pix = m_texture_ram[0][index]; index+=4; if(pix != 0) { @@ -292,8 +291,8 @@ void model3_state::draw_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, i for (int y = y1; y <= y2; y++) { - uint32_t* dst = &bitmap.pix32(y); - uint16_t* src = &pixmap.pix16(iy & 0x1ff); + uint32_t *const dst = &bitmap.pix(y); + uint16_t const *const src = &pixmap.pix(iy & 0x1ff); int rowscroll = BYTE_REVERSE16(rowscroll_ram[((layer * 0x200) + y) ^ NATIVE_ENDIAN_VALUE_LE_BE(3,0)]) & 0x7fff; if (rowscroll & 0x100) @@ -2024,14 +2023,12 @@ void model3_state::real3d_traverse_display_list() void model3_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int i, j; - - for (j = cliprect.min_y; j <= cliprect.max_y; ++j) + for (int j = cliprect.min_y; j <= cliprect.max_y; ++j) { - uint32_t *dst = &bitmap.pix32(j); - uint32_t *src = &m_fb->pix32(j); + uint32_t *const dst = &bitmap.pix(j); + uint32_t const *const src = &m_fb->pix(j); - for (i = cliprect.min_x; i <= cliprect.max_x; ++i) + for (int i = cliprect.min_x; i <= cliprect.max_x; ++i) { if (src[i] & 0xff000000) { @@ -2191,8 +2188,8 @@ void model3_renderer::draw_alpha_triangles(const m3_triangle* tris, int num_tris void model3_renderer::draw_scanline_solid(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); float z = extent.param[0].start; float dz = extent.param[0].dpdx; @@ -2221,8 +2218,8 @@ void model3_renderer::draw_scanline_solid(int32_t scanline, const extent_t &exte void model3_renderer::draw_scanline_solid_trans(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); float z = extent.param[0].start; float dz = extent.param[0].dpdx; @@ -2289,8 +2286,8 @@ do { void model3_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2333,8 +2330,8 @@ void model3_renderer::draw_scanline_tex(int32_t scanline, const extent_t &extent void model3_renderer::draw_scanline_tex_colormod(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2380,8 +2377,8 @@ void model3_renderer::draw_scanline_tex_colormod(int32_t scanline, const extent_ void model3_renderer::draw_scanline_tex_contour(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2432,8 +2429,8 @@ void model3_renderer::draw_scanline_tex_contour(int32_t scanline, const extent_t void model3_renderer::draw_scanline_tex_trans(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; @@ -2481,8 +2478,8 @@ void model3_renderer::draw_scanline_tex_trans(int32_t scanline, const extent_t & void model3_renderer::draw_scanline_tex_alpha(int32_t scanline, const extent_t &extent, const model3_polydata &polydata, int threadid) { - uint32_t *fb = &m_fb->pix32(scanline); - float *zb = (float*)&m_zb->pix32(scanline); + uint32_t *const fb = &m_fb->pix(scanline); + float *const zb = (float*)&m_zb->pix(scanline); const cached_texture *texture = polydata.texture; float z = extent.param[0].start; diff --git a/src/mame/video/momoko.cpp b/src/mame/video/momoko.cpp index a6ed40f4971..de5e4a5982d 100644 --- a/src/mame/video/momoko.cpp +++ b/src/mame/video/momoko.cpp @@ -70,8 +70,6 @@ void momoko_state::flipscreen_w(u8 data) void momoko_state::draw_bg_pri(bitmap_ind16 &bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri) { - int px, py; - for (int sy = 0; sy < 8; sy++) { const u32 gfxadr = chr * 16 + sy * 2; @@ -83,16 +81,14 @@ void momoko_state::draw_bg_pri(bitmap_ind16 &bitmap, int chr, int col, int flipx for (int sx = 0; sx < 4; sx++) { const u8 dot = (d0 & 0x08) | ((d0 & 0x80) >> 5) | ((d1 & 0x08) >> 2) | ((d1 & 0x80) >> 7); - if (flipx == 0) px = sx + xx * 4 + x; - else px = 7 - sx - xx * 4 + x; - if (flipy == 0) py = sy + y; - else py = 7 - sy + y; + const int px = (flipx == 0) ? (sx + xx * 4 + x) : (7 - sx - xx * 4 + x); + const int py = (flipy == 0) ? (sy + y) : (7 - sy + y); if (dot >= pri) - bitmap.pix16(py, px) = col * 16 + dot + 256; + bitmap.pix(py, px) = col * 16 + dot + 256; - d0 = d0 << 1; - d1 = d1 << 1; + d0 <<= 1; + d1 <<= 1; } } } diff --git a/src/mame/video/ms32.cpp b/src/mame/video/ms32.cpp index 9b49f28cd9a..5336bb60258 100644 --- a/src/mame/video/ms32.cpp +++ b/src/mame/video/ms32.cpp @@ -422,28 +422,20 @@ u32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitmap, the priority ram, probably for per-pixel / pen mixing, or more levels than are supported here.. I don't know, it will need hw tests I think */ { - int xx, yy; int width = screen.width(); int height = screen.height(); - const pen_t *paldata = m_palette->pens(); - - u16* srcptr_tile; - u8* srcptr_tilepri; - u16* srcptr_spri; - //u8* srcptr_spripri; - - u32* dstptr_bitmap; + pen_t const *const paldata = m_palette->pens(); bitmap.fill(0, cliprect); - for (yy=0;yy<height;yy++) + for (int yy=0;yy<height;yy++) { - srcptr_tile = &m_temp_bitmap_tilemaps.pix16(yy); - srcptr_tilepri = &screen.priority().pix8(yy); - srcptr_spri = &m_temp_bitmap_sprites.pix16(yy); - //srcptr_spripri = &m_temp_bitmap_sprites_pri.pix8(yy); - dstptr_bitmap = &bitmap.pix32(yy); - for (xx=0;xx<width;xx++) + u16 const *const srcptr_tile = &m_temp_bitmap_tilemaps.pix(yy); + u8 const *const srcptr_tilepri = &screen.priority().pix(yy); + u16 const *const srcptr_spri = &m_temp_bitmap_sprites.pix(yy); + //u8 const *const srcptr_spripri = &m_temp_bitmap_sprites_pri.pix(yy); + u32 *const dstptr_bitmap = &bitmap.pix(yy); + for (int xx=0;xx<width;xx++) { u16 src_tile = srcptr_tile[xx]; u8 src_tilepri = srcptr_tilepri[xx]; diff --git a/src/mame/video/mw8080bw.cpp b/src/mame/video/mw8080bw.cpp index d7479eb8824..cf86bf10f13 100644 --- a/src/mame/video/mw8080bw.cpp +++ b/src/mame/video/mw8080bw.cpp @@ -21,7 +21,7 @@ uint32_t mw8080bw_state::screen_update_mw8080bw(screen_device &screen, bitmap_rg { // plot the current pixel pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; // next pixel video_data = video_data >> 1; @@ -34,7 +34,7 @@ uint32_t mw8080bw_state::screen_update_mw8080bw(screen_device &screen, bitmap_rg for (int i = 0; i < 4; i++) { pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -144,7 +144,7 @@ uint32_t spcenctr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm if (m_brightness > (pen & 0xff)) pen = rgb_t(m_brightness, m_brightness, m_brightness); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; center = center + 1; width = width + ((center & 0x80) ? -1 : 1); @@ -166,7 +166,7 @@ uint32_t spcenctr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm else pen = rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -266,7 +266,7 @@ uint32_t mw8080bw_state::screen_update_phantom2(screen_device &screen, bitmap_rg else pen = bit ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; /* move to next pixel -- if ripple carry is currently set, prepare for loading the shift register */ @@ -300,7 +300,7 @@ uint32_t mw8080bw_state::screen_update_phantom2(screen_device &screen, bitmap_rg for (i = 0; i < 4; i++) { pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } @@ -365,9 +365,9 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen; + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen; // next pixel video_data = video_data >> 1; @@ -382,9 +382,9 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black(); if (m_flip_screen) - bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen; + bitmap.pix(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen; else - bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; + bitmap.pix(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen; video_data = video_data >> 1; } diff --git a/src/mame/video/mz700.cpp b/src/mame/video/mz700.cpp index e2749ec0cc3..e110e986185 100644 --- a/src/mame/video/mz700.cpp +++ b/src/mame/video/mz700.cpp @@ -17,18 +17,18 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,gfx,col,bg=0,fg=0,oldcol=0x7e; - uint16_t sy=0,ma=0,x,chr; + uint8_t bg=0,fg=0,oldcol=0x7e; + uint16_t sy=0,ma=0; - for (y = 0; y < 25; y++) + for (uint8_t y = 0; y < 25; y++) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - col = m_colorram[x]; + uint8_t col = m_colorram[x]; if (col != oldcol) { oldcol = col; @@ -36,8 +36,8 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitm bg = col & 7; fg = (col >> 3) & 7; } - chr = m_videoram[x] | (BIT(col, 7)<<8); - gfx = m_p_chargen[(chr<<3) | ra ]; + uint16_t chr = m_videoram[x] | (BIT(col, 7)<<8); + uint8_t gfx = m_p_chargen[(chr<<3) | ra ]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -72,20 +72,18 @@ uint32_t mz_state::screen_update_mz800(screen_device &screen, bitmap_ind16 &bitm } else { - int x, y; - - for (x = 0; x < 40; x++) + for (int x = 0; x < 40; x++) { - for (y = 0; y < 200; y++) + for (int y = 0; y < 200; y++) { - bitmap.pix16(y, x * 8 + 0) = BIT(m_videoram[x * 8 + y], 0) ? 7 : 0; - bitmap.pix16(y, x * 8 + 1) = BIT(m_videoram[x * 8 + y], 1) ? 7 : 0; - bitmap.pix16(y, x * 8 + 2) = BIT(m_videoram[x * 8 + y], 2) ? 7 : 0; - bitmap.pix16(y, x * 8 + 3) = BIT(m_videoram[x * 8 + y], 3) ? 7 : 0; - bitmap.pix16(y, x * 8 + 4) = BIT(m_videoram[x * 8 + y], 4) ? 7 : 0; - bitmap.pix16(y, x * 8 + 5) = BIT(m_videoram[x * 8 + y], 5) ? 7 : 0; - bitmap.pix16(y, x * 8 + 6) = BIT(m_videoram[x * 8 + y], 6) ? 7 : 0; - bitmap.pix16(y, x * 8 + 7) = BIT(m_videoram[x * 8 + y], 7) ? 7 : 0; + bitmap.pix(y, x * 8 + 0) = BIT(m_videoram[x * 8 + y], 0) ? 7 : 0; + bitmap.pix(y, x * 8 + 1) = BIT(m_videoram[x * 8 + y], 1) ? 7 : 0; + bitmap.pix(y, x * 8 + 2) = BIT(m_videoram[x * 8 + y], 2) ? 7 : 0; + bitmap.pix(y, x * 8 + 3) = BIT(m_videoram[x * 8 + y], 3) ? 7 : 0; + bitmap.pix(y, x * 8 + 4) = BIT(m_videoram[x * 8 + y], 4) ? 7 : 0; + bitmap.pix(y, x * 8 + 5) = BIT(m_videoram[x * 8 + y], 5) ? 7 : 0; + bitmap.pix(y, x * 8 + 6) = BIT(m_videoram[x * 8 + y], 6) ? 7 : 0; + bitmap.pix(y, x * 8 + 7) = BIT(m_videoram[x * 8 + y], 7) ? 7 : 0; } } } diff --git a/src/mame/video/mz80.cpp b/src/mame/video/mz80.cpp index 3b0c5045e1a..e4ae83a5311 100644 --- a/src/mame/video/mz80.cpp +++ b/src/mame/video/mz80.cpp @@ -38,19 +38,18 @@ uint32_t mz80_state::screen_update_mz80k(screen_device &screen, bitmap_ind16 &bi { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0,ma=0; + uint16_t sy=0,ma=0; - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); @@ -73,19 +72,18 @@ uint32_t mz80_state::screen_update_mz80kj(screen_device &screen, bitmap_ind16 &b { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0,ma=0; + uint16_t sy=0,ma=0; - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 0); @@ -108,19 +106,18 @@ uint32_t mz80_state::screen_update_mz80a(screen_device &screen, bitmap_ind16 &bi { m_mz80k_vertical ^= 1; m_mz80k_cursor_cnt++; - uint8_t y,ra,chr,gfx; - uint16_t x,sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); + uint16_t sy=0, ma=m_p_ram[0x17d] | (m_p_ram[0x17e] << 8); - for(y = 0; y < 25; y++ ) + for(uint8_t y = 0; y < 25; y++ ) { - for (ra = 0; ra < 8; ra++) + for (uint8_t ra = 0; ra < 8; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 40; x++) + for (uint16_t x = ma; x < ma + 40; x++) { - chr = m_p_videoram[x&0x7ff]; - gfx = m_p_chargen[(chr<<3) | ra]; + uint8_t chr = m_p_videoram[x&0x7ff]; + uint8_t gfx = m_p_chargen[(chr<<3) | ra]; /* Display a scanline of a character */ *p++ = BIT(gfx, 7); diff --git a/src/mame/video/n64.cpp b/src/mame/video/n64.cpp index 2a1ba864bff..e0723dfa953 100644 --- a/src/mame/video/n64.cpp +++ b/src/mame/video/n64.cpp @@ -240,7 +240,7 @@ void n64_periphs::video_update16(bitmap_rgb32 &bitmap) { for(int32_t j = 0; j < vres; j++) { - uint32_t* d = &bitmap.pix32(j); + uint32_t *const d = &bitmap.pix(j); for(int32_t i = 0; i < hres; i++) { @@ -289,7 +289,7 @@ void n64_periphs::video_update32(bitmap_rgb32 &bitmap) { for (int32_t j = 0; j < vres; j++) { - uint32_t* d = &bitmap.pix32(j); + uint32_t *const d = &bitmap.pix(j); for (int32_t i = 0; i < hres; i++) { uint32_t pix = *frame_buffer32++; diff --git a/src/mame/video/n8080.cpp b/src/mame/video/n8080.cpp index 393b89a8ed6..7d7a7147d02 100644 --- a/src/mame/video/n8080.cpp +++ b/src/mame/video/n8080.cpp @@ -128,20 +128,15 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm { uint8_t mask = flip_screen() ? 0xff : 0x00; - int x; - int y; + uint8_t const *pRAM = m_videoram; + uint8_t const *const pPROM = memregion("proms")->base(); - const uint8_t* pRAM = m_videoram; - const uint8_t* pPROM = memregion("proms")->base(); - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y ^ mask); + uint16_t *const pLine = &bitmap.pix(y ^ mask); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - int n; - uint8_t color = 0; if (m_red_screen) @@ -172,7 +167,7 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm color = ufo_color[cycle % 6]; } - for (n = color + 1; n < 8; n++) + for (int n = color + 1; n < 8; n++) { if (~val & (1 << n)) { @@ -181,7 +176,7 @@ uint32_t spacefev_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } } - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { pLine[(x + n) ^ mask] = (pRAM[x >> 3] & (1 << n)) ? color : 0; } @@ -197,21 +192,15 @@ uint32_t sheriff_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { uint8_t mask = flip_screen() ? 0xff : 0x00; - const uint8_t* pPROM = memregion("proms")->base(); - - int x; - int y; - - const uint8_t* pRAM = m_videoram; + uint8_t const *pRAM = m_videoram; + uint8_t const *const pPROM = memregion("proms")->base(); - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y ^ mask); + uint16_t *const pLine = &bitmap.pix(y ^ mask); - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { - int n; - uint8_t color = pPROM[32 * (y >> 3) + (x >> 3)]; if (m_sheriff_color_mode == 1 && !(color & 8)) @@ -223,7 +212,7 @@ uint32_t sheriff_state::screen_update(screen_device &screen, bitmap_ind16 &bitma if (m_sheriff_color_mode == 3) color = 7; - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { pLine[(x + n) ^ mask] = ((pRAM[x >> 3] >> n) & 1) ? (color & 7) : 0; } @@ -245,18 +234,15 @@ uint32_t helifire_state::screen_update(screen_device &screen, bitmap_ind16 &bitm unsigned saved_mv = m_mv; unsigned saved_sc = m_sc; - int x; - int y; - - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int level = 120 + wave[m_mv & 7]; /* draw sky */ - for (x = level; x < 256; x++) + for (int x = level; x < 256; x++) { pLine[x] = 0x200 + 8 + SUN_BRIGHTNESS + x - level; } @@ -291,20 +277,18 @@ uint32_t helifire_state::screen_update(screen_device &screen, bitmap_ind16 &bitm /* draw sea */ - for (x = 0; x < level; x++) + for (int x = 0; x < level; x++) { pLine[x] = 8 + SEA_BRIGHTNESS + x; } /* draw foreground */ - for (x = 0; x < 256; x += 8) + for (int x = 0; x < 256; x += 8) { int offset = 32 * y + (x >> 3); - int n; - - for (n = 0; n < 8; n++) + for (int n = 0; n < 8; n++) { if (flip_screen()) { diff --git a/src/mame/video/namco_c355spr.cpp b/src/mame/video/namco_c355spr.cpp index cd06bfe1664..570c6a92e7d 100644 --- a/src/mame/video/namco_c355spr.cpp +++ b/src/mame/video/namco_c355spr.cpp @@ -111,8 +111,8 @@ void namco_c355spr_device::zdrawgfxzoom( { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) { @@ -140,8 +140,8 @@ void namco_c355spr_device::copybitmap(bitmap_ind16 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *dest = &dest_bmp.pix16(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -174,8 +174,8 @@ void namco_c355spr_device::copybitmap(bitmap_ind16 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *dest = &dest_bmp.pix16(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -213,9 +213,9 @@ void namco_c355spr_device::copybitmap(bitmap_rgb32 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *srcrender = &m_screenbitmap.pix16(y); - u32 *dest = &dest_bmp.pix32(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const srcrender = &m_screenbitmap.pix(y); + u32 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) @@ -251,9 +251,9 @@ void namco_c355spr_device::copybitmap(bitmap_rgb32 &dest_bmp, const rectangle &c { for (int y = clip.min_y; y <= clip.max_y; y++) { - u16 *src = &m_tempbitmap.pix16(y); - u16 *srcrender = &m_screenbitmap.pix16(y); - u32 *dest = &dest_bmp.pix32(y); + u16 *const src = &m_tempbitmap.pix(y); + u16 *const srcrender = &m_screenbitmap.pix(y); + u32 *const dest = &dest_bmp.pix(y); for (int x = clip.min_x; x <= clip.max_x; x++) { if (src[x] != 0xffff) diff --git a/src/mame/video/namcona1.cpp b/src/mame/video/namcona1.cpp index 4fcab2c581d..6cedb59394a 100644 --- a/src/mame/video/namcona1.cpp +++ b/src/mame/video/namcona1.cpp @@ -295,10 +295,10 @@ void namcona1_state::pdraw_tile( { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + y_index * gfx->rowbytes(); - const u8 *mask_addr = mask_base + y_index * mask->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &screen.priority().pix8(y); + u8 const *const source = source_base + y_index * gfx->rowbytes(); + u8 const *const mask_addr = mask_base + y_index * mask->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &screen.priority().pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -506,8 +506,8 @@ void namcona1_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap //const pen_t *paldata = &m_palette->pen(m_bg_tilemap[which]->palette_offset()); const pen_t *paldata = &m_palette->pen(0); - draw_pixel_line(cliprect, &bitmap.pix16(line), - &screen.priority().pix8(line), + draw_pixel_line(cliprect, &bitmap.pix(line), + &screen.priority().pix(line), m_videoram + ydata + 25, paldata); } diff --git a/src/mame/video/namcos21_3d.cpp b/src/mame/video/namcos21_3d.cpp index 9858a9afcf4..a6f8921c094 100644 --- a/src/mame/video/namcos21_3d.cpp +++ b/src/mame/video/namcos21_3d.cpp @@ -59,14 +59,12 @@ void namcos21_3d_device::swap_and_clear_poly_framebuffer() void namcos21_3d_device::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const rectangle &clip, int zlo, int zhi) { /* blit the visible framebuffer */ - int sy; - for (sy = clip.top(); sy <= clip.bottom(); sy++) + for (int sy = clip.top(); sy <= clip.bottom(); sy++) { - uint16_t *dest = &bitmap.pix16(sy); - const uint16_t *pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy; - const uint16_t *pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy; - int sx; - for (sx = clip.left(); sx <= clip.right(); sx++) + uint16_t *const dest = &bitmap.pix(sy); + uint16_t const *const pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy; + uint16_t const *const pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy; + for (int sx = clip.left(); sx <= clip.right(); sx++) { int z = pZ[sx]; //if( pZ[sx]!=0x7fff ) diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp index 27354f16379..0fb23435b92 100644 --- a/src/mame/video/namcos22.cpp +++ b/src/mame/video/namcos22.cpp @@ -52,12 +52,12 @@ void namcos22_renderer::renderscanline_uvi_full(int32_t scanline, const extent_t int penmask = 0xff; int penshift = 0; int prioverchar = extra.prioverchar; - u32 *dest = &extra.destbase->pix32(scanline); - u8 *primap = &extra.primap->pix8(scanline); - u16 *ttmap = m_state.m_texture_tilemap; - u8 *ttattr = m_state.m_texture_tileattr.get(); - u8 *ttdata = m_state.m_texture_tiledata; - u8 *tt_ayx_to_pixel = m_state.m_texture_ayx_to_pixel.get(); + u32 *const dest = &extra.destbase->pix(scanline); + u8 *const primap = &extra.primap->pix(scanline); + u16 *const ttmap = m_state.m_texture_tilemap; + u8 *const ttattr = m_state.m_texture_tileattr.get(); + u8 *const ttdata = m_state.m_texture_tiledata; + u8 *const tt_ayx_to_pixel = m_state.m_texture_ayx_to_pixel.get(); if (extra.cmode & 4) { @@ -194,9 +194,9 @@ void namcos22_renderer::renderscanline_sprite(int32_t scanline, const extent_t & int fadefactor = 0xff - extra.fadefactor; rgbaint_t fogcolor(extra.fogcolor); rgbaint_t fadecolor(extra.fadecolor); - u8 *source = (u8 *)extra.source + y_index * extra.line_modulo; - u32 *dest = &extra.destbase->pix32(scanline); - u8 *primap = &extra.primap->pix8(scanline); + u8 *const source = (u8 *)extra.source + y_index * extra.line_modulo; + u32 *const dest = &extra.destbase->pix(scanline); + u8 *const primap = &extra.primap->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -1946,9 +1946,9 @@ void namcos22s_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb // mix textlayer with poly/sprites for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *src = &m_mix_bitmap->pix16(y); - u32 *dest = &bitmap.pix32(y); - u8 *pri = &screen.priority().pix8(y); + u16 const *const src = &m_mix_bitmap->pix(y); + u32 *const dest = &bitmap.pix(y); + u8 const *const pri = &screen.priority().pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { // skip if transparent or under poly/sprite @@ -2019,9 +2019,9 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 // mix textlayer with polys + do final mix for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u16 *src = &m_mix_bitmap->pix16(y); - u32 *dest = &bitmap.pix32(y); - u8 *pri = &screen.priority().pix8(y); + u16 const *const src = &m_mix_bitmap->pix(y); + u32 *const dest = &bitmap.pix(y); + u8 const *const pri = &screen.priority().pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { u32 pixel = dest[x]; @@ -2404,7 +2404,7 @@ u32 namcos22s_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb32 const u8 *blut = (const u8 *)&m_mixer[0x300/4]; for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dest = &bitmap.pix32(y); + u32 *const dest = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { int rgb = dest[x]; diff --git a/src/mame/video/namcos2_roz.cpp b/src/mame/video/namcos2_roz.cpp index 04f7f96ce4f..88ba624009f 100644 --- a/src/mame/video/namcos2_roz.cpp +++ b/src/mame/video/namcos2_roz.cpp @@ -75,7 +75,7 @@ draw_roz_helper_block(const struct roz_param *rozInfo, int destx, int desty, int end_incrx = rozInfo->incyx - (width * rozInfo->incxx); int end_incry = rozInfo->incyy - (width * rozInfo->incxy); - uint16_t *dest = &destbitmap.pix16(desty, destx); + uint16_t *dest = &destbitmap.pix(desty, destx); int dest_rowinc = destbitmap.rowpixels() - width; while (desty < desty_end) @@ -96,9 +96,9 @@ draw_roz_helper_block(const struct roz_param *rozInfo, int destx, int desty, goto L_SkipPixel; } - if (flagsbitmap.pix8(ypos, xpos) & TILEMAP_PIXEL_LAYER0) + if (flagsbitmap.pix(ypos, xpos) & TILEMAP_PIXEL_LAYER0) { - *dest = srcbitmap.pix16(ypos, xpos) + rozInfo->color; + *dest = srcbitmap.pix(ypos, xpos) + rozInfo->color; } L_SkipPixel: diff --git a/src/mame/video/namcos2_sprite.cpp b/src/mame/video/namcos2_sprite.cpp index 7d2f2f434b7..2e6f48abf91 100644 --- a/src/mame/video/namcos2_sprite.cpp +++ b/src/mame/video/namcos2_sprite.cpp @@ -117,9 +117,9 @@ void namcos2_sprite_device::zdrawgfxzoom( { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index>>16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index>>16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; /* this code was previously shared with the c355 where this was needed if (m_palxor) diff --git a/src/mame/video/nbmj8688.cpp b/src/mame/video/nbmj8688.cpp index 75ab83fd15a..e4b8f58dffa 100644 --- a/src/mame/video/nbmj8688.cpp +++ b/src/mame/video/nbmj8688.cpp @@ -244,7 +244,7 @@ void nbmj8688_state::vramflip() void nbmj8688_state::update_pixel(int x, int y) { int color = m_videoram[(y * 512) + x]; - m_tmpbitmap->pix16(y, x) = color; + m_tmpbitmap->pix(y, x) = color; } void nbmj8688_state::writeram_low(int x, int y, int color) diff --git a/src/mame/video/nbmj8891.cpp b/src/mame/video/nbmj8891.cpp index b041106f96d..4b82c47ace7 100644 --- a/src/mame/video/nbmj8891.cpp +++ b/src/mame/video/nbmj8891.cpp @@ -296,13 +296,13 @@ void nbmj8891_state::vramflip(int vram) void nbmj8891_state::update_pixel0(int x, int y) { uint8_t color = m_videoram0[(y * m_screen->width()) + x]; - m_tmpbitmap0.pix16(y, x) = color; + m_tmpbitmap0.pix(y, x) = color; } void nbmj8891_state::update_pixel1(int x, int y) { uint8_t color = m_videoram1[(y * m_screen->width()) + x]; - m_tmpbitmap1.pix16(y, x) = (color == 0x7f) ? 0xff : color; + m_tmpbitmap1.pix(y, x) = (color == 0x7f) ? 0xff : color; } void nbmj8891_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj8900.cpp b/src/mame/video/nbmj8900.cpp index faf75765d88..f6a1e8deff1 100644 --- a/src/mame/video/nbmj8900.cpp +++ b/src/mame/video/nbmj8900.cpp @@ -188,13 +188,13 @@ void nbmj8900_state::vramflip(int vram) void nbmj8900_state::update_pixel0(int x, int y) { uint8_t color = m_videoram0[(y * m_screen_width) + x]; - m_tmpbitmap0.pix16(y, x) = m_palette->pen(color); + m_tmpbitmap0.pix(y, x) = m_palette->pen(color); } void nbmj8900_state::update_pixel1(int x, int y) { uint8_t color = m_videoram1[(y * m_screen_width) + x]; - m_tmpbitmap1.pix16(y, x) = m_palette->pen(color); + m_tmpbitmap1.pix(y, x) = m_palette->pen(color); } void nbmj8900_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj8991.cpp b/src/mame/video/nbmj8991.cpp index e13e5bfb832..5f6862b5a37 100644 --- a/src/mame/video/nbmj8991.cpp +++ b/src/mame/video/nbmj8991.cpp @@ -131,20 +131,18 @@ void nbmj8991_state::clut_w(offs_t offset, uint8_t data) ******************************************************************************/ void nbmj8991_state::vramflip() { - int x, y; - uint8_t color1, color2; int width = m_screen->width(); int height = m_screen->height(); if (m_flipscreen == m_flipscreen_old) return; - for (y = 0; y < height / 2; y++) + for (int y = 0; y < height / 2; y++) { - for (x = 0; x < width / 2; x++) + for (int x = 0; x < width / 2; x++) { // rotate 180 degrees ( 0, 0) - ( 511, 511) - color1 = m_videoram[(y * width) + x]; - color2 = m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; + uint8_t color1 = m_videoram[(y * width) + x]; + uint8_t color2 = m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)]; m_videoram[(y * width) + x] = color2; m_videoram[(((height - 1) - y) * width) + (((width / 2) - 1) - x)] = color1; // rotate 180 degrees ( 512, 0) - (1023, 511) @@ -162,7 +160,7 @@ void nbmj8991_state::vramflip() void nbmj8991_state::update_pixel(int x, int y) { uint8_t color = m_videoram[(y * m_screen->width()) + x]; - m_tmpbitmap.pix16(y, x) = color; + m_tmpbitmap.pix(y, x) = color; } void nbmj8991_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nbmj9195.cpp b/src/mame/video/nbmj9195.cpp index 153b420987f..17446bcc76b 100644 --- a/src/mame/video/nbmj9195.cpp +++ b/src/mame/video/nbmj9195.cpp @@ -176,7 +176,7 @@ void nbmj9195_state::vramflip(int vram) void nbmj9195_state::update_pixel(int vram, int x, int y) { uint16_t color = m_videoram[vram][(y * m_screen->width()) + x]; - m_tmpbitmap[vram].pix16(y, x) = color; + m_tmpbitmap[vram].pix(y, x) = color; } void nbmj9195_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/nc.cpp b/src/mame/video/nc.cpp index 4770ee94f7c..4da4e3d583e 100644 --- a/src/mame/video/nc.cpp +++ b/src/mame/video/nc.cpp @@ -69,7 +69,7 @@ uint32_t nc_state::screen_update_nc(screen_device &screen, bitmap_ind16 &bitmap, for (int b = 0; b < 8; b++) { - bitmap.pix16(y, x) = pens[(byte>>7) & 0x01]; + bitmap.pix(y, x) = pens[(byte>>7) & 0x01]; byte = byte<<1; x++; } diff --git a/src/mame/video/neogeo_spr.cpp b/src/mame/video/neogeo_spr.cpp index b069f8fc143..19dabfc457d 100644 --- a/src/mame/video/neogeo_spr.cpp +++ b/src/mame/video/neogeo_spr.cpp @@ -181,7 +181,7 @@ void neosprite_base_device::draw_fixed_layer(bitmap_rgb32 &bitmap, int scanline) uint8_t* gfx_base = m_fixed_layer_source ? m_region_fixed : m_region_fixedbios->base(); uint32_t addr_mask = ( m_fixed_layer_source ? m_region_fixed_size : m_region_fixedbios->bytes() ) - 1; uint16_t *video_data = &m_videoram_drawsource[0x7000 | (scanline >> 3)]; - uint32_t *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, NEOGEO_HBEND); int garouoffsets[32]; int banked = m_fixed_layer_source && (addr_mask > 0x1ffff); @@ -414,7 +414,7 @@ void neosprite_base_device::draw_sprites(bitmap_rgb32 &bitmap, int scanline) /* draw the line - no wrap-around */ if (x <= 0x01f0) { - uint32_t *pixel_addr = &bitmap.pix32(scanline, x + NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, x + NEOGEO_HBEND); for (int i = 0; i < 0x10; i++) { @@ -436,7 +436,7 @@ void neosprite_base_device::draw_sprites(bitmap_rgb32 &bitmap, int scanline) else { int x_save = x; - uint32_t *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); + uint32_t *pixel_addr = &bitmap.pix(scanline, NEOGEO_HBEND); for (int i = 0; i < 0x10; i++) { diff --git a/src/mame/video/newbrain.cpp b/src/mame/video/newbrain.cpp index 714326050b0..56e7c072b17 100644 --- a/src/mame/video/newbrain.cpp +++ b/src/mame/video/newbrain.cpp @@ -121,10 +121,10 @@ void newbrain_state::do_screen_update(bitmap_rgb32 &bitmap, const rectangle &cli uint8_t sr = gr ? grsr : vsr; int color = BIT(sr, 7) ^ m_rv; - bitmap.pix32(y, x++) = m_palette->pen(color); + bitmap.pix(y, x++) = m_palette->pen(color); if (columns == 40) { - bitmap.pix32(y, x++) = m_palette->pen(color); + bitmap.pix(y, x++) = m_palette->pen(color); } grsr <<= 1; diff --git a/src/mame/video/nick.cpp b/src/mame/video/nick.cpp index 9aa6c940924..ddaf8c0aff2 100644 --- a/src/mame/video/nick.cpp +++ b/src/mame/video/nick.cpp @@ -192,7 +192,7 @@ void nick_device::device_timer(emu_timer &timer, device_timer_id id, int param, if (scanline < ENTERPRISE_SCREEN_HEIGHT) { /* set write address for line */ - m_dest = &m_bitmap.pix32(scanline); + m_dest = &m_bitmap.pix(scanline); m_dest_pos = 0; m_dest_max_pos = m_bitmap.width(); diff --git a/src/mame/video/ninjakd2.cpp b/src/mame/video/ninjakd2.cpp index 700172ce5a9..2ec95db5dff 100644 --- a/src/mame/video/ninjakd2.cpp +++ b/src/mame/video/ninjakd2.cpp @@ -352,7 +352,7 @@ void ninjakd2_state::erase_sprites( bitmap_ind16 &bitmap) { for (int x = 0; x < m_sprites_bitmap.width(); ++x) { - uint16_t* const ptr = &m_sprites_bitmap.pix16(y, x); + uint16_t *const ptr = &m_sprites_bitmap.pix(y, x); if ( (*m_stencil_compare_function)(*ptr) ) *ptr = 0xf; } } diff --git a/src/mame/video/nitedrvr.cpp b/src/mame/video/nitedrvr.cpp index d33c8472bfa..0ccd49114c6 100644 --- a/src/mame/video/nitedrvr.cpp +++ b/src/mame/video/nitedrvr.cpp @@ -16,7 +16,7 @@ void nitedrvr_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, i { for (int x = bx; x < ex; x++) if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; } } diff --git a/src/mame/video/niyanpai.cpp b/src/mame/video/niyanpai.cpp index 3c14c3e1610..6aa036fa502 100644 --- a/src/mame/video/niyanpai.cpp +++ b/src/mame/video/niyanpai.cpp @@ -159,7 +159,7 @@ void niyanpai_state::vramflip(int vram) void niyanpai_state::update_pixel(int vram, int x, int y) { uint16_t color = m_videoram[vram][(y * m_screen->width()) + x]; - m_tmpbitmap[vram].pix16(y, x) = color; + m_tmpbitmap[vram].pix(y, x) = color; } void niyanpai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) diff --git a/src/mame/video/offtwall.cpp b/src/mame/video/offtwall.cpp index f71c058acf6..d60f75dc519 100644 --- a/src/mame/video/offtwall.cpp +++ b/src/mame/video/offtwall.cpp @@ -89,13 +89,12 @@ uint32_t offtwall_state::screen_update_offtwall(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - /* not yet verified - */ + // not yet verified pf[x] = mo[x]; } } diff --git a/src/mame/video/ojankohs.cpp b/src/mame/video/ojankohs.cpp index db98c744a4b..57509869188 100644 --- a/src/mame/video/ojankohs.cpp +++ b/src/mame/video/ojankohs.cpp @@ -208,18 +208,14 @@ void ojankohs_state::ojankoc_flipscreen(int data) void ojankohs_state::ojankoc_videoram_w(offs_t offset, uint8_t data) { - int i; - uint8_t x, y, xx, px, py ; - uint8_t color, color1, color2; - m_videoram[offset] = data; - color1 = m_videoram[offset & 0x3fff]; - color2 = m_videoram[offset | 0x4000]; + uint8_t color1 = m_videoram[offset & 0x3fff]; + uint8_t color2 = m_videoram[offset | 0x4000]; - y = offset >> 6; - x = (offset & 0x3f) << 2; - xx = 0; + uint8_t y = offset >> 6; + uint8_t x = (offset & 0x3f) << 2; + uint8_t xx = 0; if (m_flipscreen) { @@ -228,14 +224,14 @@ void ojankohs_state::ojankoc_videoram_w(offs_t offset, uint8_t data) xx = 3; } - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { - color = ((color1 & 0x01) >> 0) | ((color1 & 0x10) >> 3) | ((color2 & 0x01) << 2) | ((color2 & 0x10) >> 1); + uint8_t color = ((color1 & 0x01) >> 0) | ((color1 & 0x10) >> 3) | ((color2 & 0x01) << 2) | ((color2 & 0x10) >> 1); - px = x + (i ^ xx); - py = y; + uint8_t px = x + (i ^ xx); + uint8_t py = y; - m_tmpbitmap.pix16(py, px) = color; + m_tmpbitmap.pix(py, px) = color; color1 >>= 1; color2 >>= 1; diff --git a/src/mame/video/orion.cpp b/src/mame/video/orion.cpp index b806f87b150..44e49a2afd0 100644 --- a/src/mame/video/orion.cpp +++ b/src/mame/video/orion.cpp @@ -74,7 +74,7 @@ uint32_t orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16 break; } } - bitmap.pix16(y, x*8+(7-b)) = color; + bitmap.pix(y, x*8+(7-b)) = color; } } } diff --git a/src/mame/video/osi.cpp b/src/mame/video/osi.cpp index d06540810e6..222f3fdd560 100644 --- a/src/mame/video/osi.cpp +++ b/src/mame/video/osi.cpp @@ -65,7 +65,7 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; } - bitmap.pix16(y, x++) = color; + bitmap.pix(y, x++) = color; charrom_data <<= 1; } @@ -98,8 +98,8 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma color = (color ^ BIT(colorram_data, 0)) ? (((colorram_data >> 1) & 0x07) + 2) : 0; } - bitmap.pix16(y, x++) = color; - bitmap.pix16(y, x++) = color; + bitmap.pix(y, x++) = color; + bitmap.pix(y, x++) = color; charrom_data <<= 1; } @@ -128,7 +128,7 @@ uint32_t uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (int bit = 0; bit < 8; bit++) { - bitmap.pix16(y, x) = BIT(charrom_data, 7); + bitmap.pix(y, x) = BIT(charrom_data, 7); x++; charrom_data <<= 1; } diff --git a/src/mame/video/p2000t.cpp b/src/mame/video/p2000t.cpp index ad34ae63073..380ee26a143 100644 --- a/src/mame/video/p2000t.cpp +++ b/src/mame/video/p2000t.cpp @@ -22,14 +22,14 @@ void p2000m_state::video_start() uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *videoram = m_videoram; - int offs, sx, sy, code, loop; + uint8_t const *const videoram = m_videoram; - for (offs = 0; offs < 80 * 24; offs++) + for (int offs = 0; offs < 80 * 24; offs++) { - sy = (offs / 80) * 20; - sx = (offs % 80) * 12; + int sy = (offs / 80) * 20; + int sx = (offs % 80) * 12; + int code; if ((m_frame_count > 25) && (videoram[offs + 2048] & 0x40)) code = 32; else @@ -49,10 +49,10 @@ uint32_t p2000m_state::screen_update_p2000m(screen_device &screen, bitmap_ind16 if (videoram[offs] & 0x80) { - for (loop = 0; loop < 12; loop++) + for (int loop = 0; loop < 12; loop++) { - bitmap.pix16(sy + 18, sx + loop) = 0; /* cursor */ - bitmap.pix16(sy + 19, sx + loop) = 0; /* cursor */ + bitmap.pix(sy + 18, sx + loop) = 0; /* cursor */ + bitmap.pix(sy + 19, sx + loop) = 0; /* cursor */ } } } diff --git a/src/mame/video/pacland.cpp b/src/mame/video/pacland.cpp index 30164aeb8bb..7f5be3f9e11 100644 --- a/src/mame/video/pacland.cpp +++ b/src/mame/video/pacland.cpp @@ -334,9 +334,9 @@ void pacland_state::draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const r /* now copy the fg_bitmap to the destination wherever the sprite pixel allows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint8_t *pri = &screen.priority().pix8(y); - uint16_t *src = &m_fg_bitmap.pix16(y); - uint16_t *dst = &bitmap.pix16(y); + uint8_t const *const pri = &screen.priority().pix(y); + uint16_t *const src = &m_fg_bitmap.pix(y); + uint16_t *const dst = &bitmap.pix(y); /* only copy if the priority bitmap is 0 (no high priority sprite) and the source pixel is not the invalid pen; also clear to 0xffff when finished */ @@ -382,8 +382,8 @@ uint32_t pacland_state::screen_update(screen_device &screen, bitmap_ind16 &bitma draw_sprites(screen, m_sprite_bitmap, cliprect, flip, 2); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *spr = &m_sprite_bitmap.pix16(y); - uint16_t *bmp = &bitmap.pix16(y); + uint16_t *const spr = &m_sprite_bitmap.pix(y); + uint16_t const *const bmp = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* clear to 0 if "m_sprite_bitmap" and "bitmap" are different, diff --git a/src/mame/video/paradise.cpp b/src/mame/video/paradise.cpp index 47a012fece8..3aa0a65333a 100644 --- a/src/mame/video/paradise.cpp +++ b/src/mame/video/paradise.cpp @@ -137,15 +137,13 @@ TILE_GET_INFO_MEMBER(paradise_state::get_tile_info_2) void paradise_state::pixmap_w(offs_t offset, uint8_t data) { - int x, y; - m_videoram[offset] = data; - x = (offset & 0x7f) << 1; - y = (offset >> 7); + int x = (offset & 0x7f) << 1; + int y = (offset >> 7); - m_tmpbitmap.pix16(y, x + 0) = 0x80f - (data >> 4); - m_tmpbitmap.pix16(y, x + 1) = 0x80f - (data & 0x0f); + m_tmpbitmap.pix(y, x + 0) = 0x80f - (data >> 4); + m_tmpbitmap.pix(y, x + 1) = 0x80f - (data & 0x0f); } diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp index 8e30aa709a4..c15ea0eea58 100644 --- a/src/mame/video/pastelg.cpp +++ b/src/mame/video/pastelg.cpp @@ -286,7 +286,7 @@ uint32_t pastelg_common_state::screen_update(screen_device &screen, bitmap_ind16 for (int y = 0; y < height; y++) for (int x = 0; x < width; x++) - bitmap.pix16(y, x) = m_videoram[(y * width) + x]; + bitmap.pix(y, x) = m_videoram[(y * width) + x]; } else bitmap.fill(0, cliprect); diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp index 9dc539435cf..2e1d6433c81 100644 --- a/src/mame/video/pc080sn.cpp +++ b/src/mame/video/pc080sn.cpp @@ -362,16 +362,13 @@ static u16 topspeed_get_road_pixel_color( u16 pixel, u16 color ) void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u8 priority, u16 *color_ctrl_ram, u8 pmask) { - u16 *dst16, *src16; - u8 *tsrc; u16 scanline[1024]; /* won't be called by a wide-screen game, but just in case... */ - bitmap_ind16 &srcbitmap = m_tilemap[layer]->pixmap(); - bitmap_ind8 &flagsbitmap = m_tilemap[layer]->flagsmap(); + bitmap_ind16 const &srcbitmap = m_tilemap[layer]->pixmap(); + bitmap_ind8 const &flagsbitmap = m_tilemap[layer]->flagsmap(); - u16 a, color; - int sx, x_index; - int y_index, src_y_index, row_index; + int sx; + int y_index; int flip = 0; @@ -395,21 +392,21 @@ void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &b for (int y = min_y; y <= max_y; y++) { - src_y_index = y_index & 0x1ff; /* tilemaps are 512 px up/down */ - row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff; - color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff]; + int src_y_index = y_index & 0x1ff; /* tilemaps are 512 px up/down */ + int row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff; + u16 color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff]; - x_index = sx - (m_bgscroll_ram[layer][row_index]); + int x_index = sx - (m_bgscroll_ram[layer][row_index]); - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + u16 const *const src16 = &srcbitmap.pix(src_y_index); + u8 const *const tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) { for (int i = 0; i < screen_width; i++) { - a = src16[x_index & width_mask]; + u16 a = src16[x_index & width_mask]; #ifdef TOPSPEED_ROAD_COLORS a = topspeed_get_road_pixel_color(a, color); #endif @@ -423,7 +420,7 @@ void pc080sn_device::topspeed_custom_draw(screen_device &screen, bitmap_ind16 &b { if (tsrc[x_index & width_mask]) { - a = src16[x_index & width_mask]; + u16 a = src16[x_index & width_mask]; #ifdef TOPSPEED_ROAD_COLORS a = topspeed_get_road_pixel_color(a,color); #endif diff --git a/src/mame/video/pc4.cpp b/src/mame/video/pc4.cpp index 4e427652b5b..6f8b1e8543e 100644 --- a/src/mame/video/pc4.cpp +++ b/src/mame/video/pc4.cpp @@ -30,12 +30,12 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c if (m_ddram[char_pos] <= 0x10) { //draw CGRAM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); + bitmap.pix(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); } else { //draw CGROM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); + bitmap.pix(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x); } @@ -45,12 +45,12 @@ uint32_t pc4_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c //draw the cursor if (m_cursor_on) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + 7, i * 6 + x) = 1; + bitmap.pix(l*9 + 7, i * 6 + x) = 1; if (!m_blink && m_blink_on) for (int y=0; y<7; y++) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + y, i * 6 + x) = 1; + bitmap.pix(l*9 + y, i * 6 + x) = 1; } } diff --git a/src/mame/video/pc6001.cpp b/src/mame/video/pc6001.cpp index 8dcb5121ed0..2874283e3fe 100644 --- a/src/mame/video/pc6001.cpp +++ b/src/mame/video/pc6001.cpp @@ -135,9 +135,6 @@ void pc6001sr_state::video_start() /* this is known as gfx mode 4 */ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr) { - int x,y,xi; - int fgcol,color; - int col_setting; static const uint8_t pen_gattr[4][4] = { { 0, 1, 6, 2 }, //Red / Blue { 0, 6, 1, 2 }, //Blue / Red @@ -150,38 +147,38 @@ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect { 0, 5, 2, 7 }, //Pink / Green { 0, 2, 5, 7 }, //Green / Pink }; - col_setting = m_io_mode4_dsw->read() & 7; + int col_setting = m_io_mode4_dsw->read() & 7; if((attr & 0x0c) != 0x0c) popmessage("Mode 4 vram attr != 0x0c, contact MESSdev"); - for(y=0;y<192;y++) + for(int y=0;y<192;y++) { - for(x=0;x<32;x++) + for(int x=0;x<32;x++) { int tile = m_video_ram[(x+(y*32))+0x200]; if(col_setting == 0x00) //monochrome { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - fgcol = (attr & 2) ? 7 : 2; + int fgcol = (attr & 2) ? 7 : 2; - color = ((tile)>>(7-xi) & 1) ? fgcol : 0; + int color = ((tile)>>(7-xi) & 1) ? fgcol : 0; - bitmap.pix16((y+24), (x*8+xi)+32) = m_palette->pen(color); + bitmap.pix((y+24), (x*8+xi)+32) = m_palette->pen(color); } } else { - for(xi=0;xi<4;xi++) + for(int xi=0;xi<4;xi++) { - fgcol = ((tile)>>(6-(xi*2)) & 3); + int fgcol = ((tile)>>(6-(xi*2)) & 3); - color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); + int color = (attr & 2) ? (pen_wattr[col_setting-1][fgcol]) : (pen_gattr[col_setting-1][fgcol]); - bitmap.pix16((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); - bitmap.pix16((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); + bitmap.pix((y+24), ((x*8+xi*2)+0)+32) = m_palette->pen(color); + bitmap.pix((y+24), ((x*8+xi*2)+1)+32) = m_palette->pen(color); } } } @@ -190,8 +187,6 @@ void pc6001_state::draw_gfx_mode4(bitmap_ind16 &bitmap,const rectangle &cliprect void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &cliprect, int attr) { - int color,x,y,xi,yi; - int shrink_x = 2*4; int shrink_y = (attr & 8) ? 1 : 2; int w = (shrink_x == 8) ? 32 : 16; @@ -199,22 +194,21 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre if(attr & 4) { - for(y=0;y<(192/shrink_y);y++) + for(int y=0;y<(192/shrink_y);y++) { - for(x=0;x<w;x++) + for(int x=0;x<w;x++) { int tile = m_video_ram[(x+(y*32))+0x200]; - for(yi=0;yi<shrink_y;yi++) + for(int yi=0;yi<shrink_y;yi++) { - for(xi=0;xi<shrink_x;xi++) + for(int xi=0;xi<shrink_x;xi++) { - int i; - i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; - color = ((tile >> i) & 3)+8; + int i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; + int color = ((tile >> i) & 3)+8; color+= col_bank; - bitmap.pix16(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix(((y*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); } } } @@ -222,24 +216,23 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre } else /* TODO: clean this up */ { - for(y=0;y<(192/shrink_y);y+=3) + for(int y=0;y<(192/shrink_y);y+=3) { - for(x=0;x<w;x++) + for(int x=0;x<w;x++) { int tile = m_video_ram[(x+((y/3)*32))+0x200]; - for(yi=0;yi<shrink_y;yi++) + for(int yi=0;yi<shrink_y;yi++) { - for(xi=0;xi<shrink_x;xi++) + for(int xi=0;xi<shrink_x;xi++) { - int i; - i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; - color = ((tile >> i) & 3)+8; + int i = (shrink_x == 8) ? (xi & 0x06) : (xi & 0x0c)>>1; + int color = ((tile >> i) & 3)+8; color+= col_bank; - bitmap.pix16((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); - bitmap.pix16((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+0)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+1)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); + bitmap.pix((((y+2)*shrink_y+yi)+24), (x*shrink_x+((shrink_x-1)-xi))+32) = m_palette->pen(color); } } } @@ -249,19 +242,17 @@ void pc6001_state::draw_bitmap_2bpp(bitmap_ind16 &bitmap,const rectangle &clipre void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr) { - int color,pen,xi,yi; - + int pen; if(attr & 0x10) //2x2 squares on a single cell pen = (tile & 0x70)>>4; else //2x3 pen = (tile & 0xc0) >> 6 | (attr & 2)<<1; - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int i; - i = (xi & 4)>>2; //x-axis + int i = (xi & 4)>>2; //x-axis if(attr & 0x10) //2x2 { i+= (yi >= 6) ? 2 : 0; //y-axis @@ -272,24 +263,24 @@ void pc6001_state::draw_tile_3bpp(bitmap_ind16 &bitmap,const rectangle &cliprect i+= (yi & 8)>>1; //y-axis 2 } - color = ((tile >> i) & 1) ? pen+8 : 0; + int color = ((tile >> i) & 1) ? pen+8 : 0; - bitmap.pix16(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); + bitmap.pix(((y*12+(11-yi))+24), (x*8+(7-xi))+32) = m_palette->pen(color); } } } void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int tile,int attr,int has_mc6847) { - int xi,yi,pen,fgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int fgcol,color; if(has_mc6847) { fgcol = (attr & 2) ? 0x12 : 0x10; @@ -310,19 +301,18 @@ void pc6001_state::draw_tile_text(bitmap_ind16 &bitmap,const rectangle &cliprect color = pen ? fgcol : 0; } - bitmap.pix16(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); + bitmap.pix(((y*12+yi)+24), (x*8+xi)+32) = m_palette->pen(color); } } } void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,int attr,int has_mc6847) { - int x,y,color; - - for(y=0;y<240;y++) + for(int y=0;y<240;y++) { - for(x=0;x<320;x++) + for(int x=0;x<320;x++) { + int color; if(!has_mc6847) //mk2 border color is always black color = 0; else if((attr & 0x90) == 0x80) //2bpp @@ -332,17 +322,14 @@ void pc6001_state::draw_border(bitmap_ind16 &bitmap,const rectangle &cliprect,in else color = 0; //FIXME: other modes not yet checked - bitmap.pix16(y, x) = m_palette->pen(color); + bitmap.pix(y, x) = m_palette->pen(color); } } } void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &cliprect, int has_mc6847) { - int x,y; - int tile,attr; - - attr = m_video_ram[0]; + int attr = m_video_ram[0]; draw_border(bitmap,cliprect,attr,has_mc6847); @@ -359,11 +346,11 @@ void pc6001_state::pc6001_screen_draw(bitmap_ind16 &bitmap,const rectangle &clip } else // text mode { - for(y=0;y<16;y++) + for(int y=0;y<16;y++) { - for(x=0;x<32;x++) + for(int x=0;x<32;x++) { - tile = m_video_ram[(x+(y*32))+0x200]; + int tile = m_video_ram[(x+(y*32))+0x200]; attr = m_video_ram[(x+(y*32)) & 0x1ff]; if(attr & 0x40) @@ -388,20 +375,16 @@ uint32_t pc6001_state::screen_update_pc6001(screen_device &screen, bitmap_ind16 uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,tile,attr; - /* note: bitmap mode have priority over everything else, check American Truck */ if(m_exgfx_bitmap_mode) { - int count,color,i; + int count = 0; - count = 0; - - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<160;x+=4) + for(int x=0;x<160;x+=4) { - for(i=0;i<4;i++) + for(int i=0;i<4;i++) { int pen[2]; #if 0 @@ -417,16 +400,16 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ pen[0] = m_video_ram[count+0x0000] >> (6-i*2) & 3; pen[1] = m_video_ram[count+0x2000] >> (6-i*2) & 3; - color = 0x10; + int color = 0x10; color |= ((pen[0] & 1) << 2); color |= ((pen[0] & 2) >> 1); color |= ((pen[1] & 1) << 1); color |= ((pen[1] & 2) << 2); if (cliprect.contains((x+i)*2+0, y)) - bitmap.pix16(y, (x+i)*2+0) = m_palette->pen(color); + bitmap.pix(y, (x+i)*2+0) = m_palette->pen(color); if (cliprect.contains((x+i)*2+1, y)) - bitmap.pix16(y, (x+i)*2+1) = m_palette->pen(color); + bitmap.pix(y, (x+i)*2+1) = m_palette->pen(color); } count++; @@ -435,15 +418,13 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } else if(m_exgfx_2bpp_mode) { - int count,color,i; - - count = 0; + int count = 0; - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<320;x+=8) + for(int x=0;x<320;x+=8) { - for(i=0;i<8;i++) + for(int i=0;i<8;i++) { int pen[2]; #if 0 @@ -456,6 +437,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ pen[0] = m_video_ram[count+0x0000] >> (7-i) & 1; pen[1] = m_video_ram[count+0x2000] >> (7-i) & 1; + int color; if(m_bgcol_bank & 4) //PC-6001 emulation mode { color = 0x08; @@ -472,7 +454,7 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } if (cliprect.contains(x+i, y)) - bitmap.pix16(y, (x+i)) = m_palette->pen(color); + bitmap.pix(y, (x+i)) = m_palette->pen(color); } count++; @@ -482,12 +464,11 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ } else if(m_exgfx_text_mode) { - int xi,yi,pen,fgcol,bgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); - for(y=0;y<20;y++) + for(int y=0;y<20;y++) { - for(x=0;x<40;x++) + for(int x=0;x<40;x++) { /* exgfx attr format: @@ -496,23 +477,23 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ ---- xxxx fg color Note that the exgfx banks a different gfx ROM */ - tile = m_video_ram[(x+(y*40))+0x400] + 0x200; - attr = m_video_ram[(x+(y*40)) & 0x3ff]; - tile+= ((attr & 0x80) << 1); + int tile = m_video_ram[(x+(y*40))+0x400] + 0x200; + int attr = m_video_ram[(x+(y*40)) & 0x3ff]; + tile += ((attr & 0x80) << 1); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + int fgcol = (attr & 0x0f) + 0x10; + int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - color = pen ? fgcol : bgcol; + int color = pen ? fgcol : bgcol; if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); } } } @@ -529,35 +510,33 @@ uint32_t pc6001mk2_state::screen_update_pc6001mk2(screen_device &screen, bitmap_ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x,y,tile,attr; - int xi,yi,pen,fgcol,bgcol,color; - uint8_t *gfx_data = m_region_gfx1->base(); + uint8_t const *const gfx_data = m_region_gfx1->base(); bitmap.fill(0,cliprect); if(m_sr_text_mode == true) // text mode { - for(y=0;y<m_sr_text_rows;y++) + for(int y=0;y<m_sr_text_rows;y++) { - for(x=0;x<40;x++) + for(int x=0;x<40;x++) { - tile = m_video_ram[(x+(y*40))*2+0]; - attr = m_video_ram[(x+(y*40))*2+1]; - tile+= ((attr & 0x80) << 1); + int tile = m_video_ram[(x+(y*40))*2+0]; + int attr = m_video_ram[(x+(y*40))*2+1]; + tile += ((attr & 0x80) << 1); - for(yi=0;yi<12;yi++) + for(int yi=0;yi<12;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; + int pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; - fgcol = (attr & 0x0f) + 0x10; - bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); + int fgcol = (attr & 0x0f) + 0x10; + int bgcol = ((attr & 0x70) >> 4) + 0x10 + ((m_bgcol_bank & 2) << 2); - color = pen ? fgcol : bgcol; + int color = pen ? fgcol : bgcol; if (cliprect.contains(x*8+xi, y*12+yi)) - bitmap.pix16(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); + bitmap.pix(((y*12+yi)), (x*8+xi)) = m_palette->pen(color); } } } @@ -565,9 +544,9 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in } else //4bpp bitmap mode (TODO) { - for(y=0;y<200;y++) + for(int y=0;y<200;y++) { - for(x=0;x<320;x+=2) + for(int x=0;x<320;x+=2) { uint32_t vram_addr; @@ -576,15 +555,15 @@ uint32_t pc6001sr_state::screen_update_pc6001sr(screen_device &screen, bitmap_in else vram_addr = x+y*256; - color = (m_gvram[vram_addr] & 0xf0) >> 4; + int color; + color = (m_gvram[vram_addr] & 0xf0) >> 4; if (cliprect.contains(x, y+0)) - bitmap.pix16((y+0), (x+0)) = m_palette->pen(color+0x10); + bitmap.pix((y+0), (x+0)) = m_palette->pen(color+0x10); color = (m_gvram[vram_addr] & 0x0f); - if (cliprect.contains(x+1, y+0)) - bitmap.pix16((y+0), (x+1)) = m_palette->pen(color+0x10); + bitmap.pix((y+0), (x+1)) = m_palette->pen(color+0x10); } } } diff --git a/src/mame/video/pc9801.cpp b/src/mame/video/pc9801.cpp index bddd9e7129e..b069e2af0c4 100644 --- a/src/mame/video/pc9801.cpp +++ b/src/mame/video/pc9801.cpp @@ -41,43 +41,40 @@ uint32_t pc9801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi; - int res_x,res_y; - uint8_t pen; - uint8_t colors16_mode; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(m_video_ff[DISPLAY_REG] == 0) //screen is off return; - colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; + uint8_t colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8; if(m_ex_video_ff[ANALOG_256_MODE]) { uint8_t *ext_gvram = (uint8_t *)m_ext_gvram.target(); - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - res_x = x + xi; - res_y = y; + int res_x = x + xi; + int res_y = y; - pen = ext_gvram[(address >> 1)*16+xi+(m_vram_disp*0x40000)]; + uint8_t pen = ext_gvram[(address >> 1)*16+xi+(m_vram_disp*0x40000)]; - bitmap.pix32(res_y, res_x) = palette[pen + 0x20]; + bitmap.pix(res_y, res_x) = palette[pen + 0x20]; } } else { - for(xi=0;xi<16;xi++) + for(int xi=0;xi<16;xi++) { - res_x = x + xi; - res_y = y; + int res_x = x + xi; + int res_y = y; + uint8_t pen; pen = ((m_video_ram_2[((address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 1 : 0; pen|= ((m_video_ram_2[((address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 2 : 0; pen|= ((m_video_ram_2[((address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 4 : 0; if(m_ex_video_ff[ANALOG_16_MODE]) pen|= ((m_video_ram_2[((address & 0x7fff) + (0) + (m_vram_disp*0x20000)) >> 1] >> xi) & 1) ? 8 : 0; - bitmap.pix32(res_y, res_x) = palette[pen + colors16_mode]; + bitmap.pix(res_y, res_x) = palette[pen + colors16_mode]; } } } @@ -90,40 +87,24 @@ UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - int xi,yi; - int x; - uint8_t char_size; -// uint8_t interlace_on; - uint16_t tile; - uint8_t kanji_lr; - uint8_t kanji_sel; - uint8_t x_step; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); if(m_video_ff[DISPLAY_REG] == 0) //screen is off return; -// interlace_on = m_video_ff[INTERLACE_REG]; - char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - tile = 0; +// uint8_t interlace_on = m_video_ff[INTERLACE_REG]; + uint8_t char_size = m_video_ff[FONTSEL_REG] ? 16 : 8; - for(x=0;x<pitch;x+=x_step) + uint8_t x_step; + for(int x=0;x<pitch;x+=x_step) { - uint8_t tile_data,secret,reverse,u_line,v_line,blink; - uint8_t color; - uint8_t attr; - int pen; - uint32_t tile_addr; - uint8_t knj_tile; - uint8_t gfx_mode; - - tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); + uint32_t tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1)); - kanji_sel = 0; - kanji_lr = 0; + uint8_t kanji_sel = 0; + uint8_t kanji_lr = 0; - tile = m_video_ram_1[tile_addr & 0xfff] & 0xff; - knj_tile = m_video_ram_1[tile_addr & 0xfff] >> 8; + uint16_t tile = m_video_ram_1[tile_addr & 0xfff] & 0xff; + uint8_t knj_tile = m_video_ram_1[tile_addr & 0xfff] >> 8; if(knj_tile) { /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it. @@ -150,36 +131,33 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { /* Rori Rori Rolling definitely uses different colors for brake stop PCG elements, assume that all attributes are recalculated on different strips */ - attr = (m_video_ram_1[((tile_addr+kanji_lr) & 0xfff) | 0x1000] & 0xff); + uint8_t attr = (m_video_ram_1[((tile_addr+kanji_lr) & 0xfff) | 0x1000] & 0xff); - secret = (attr & 1) ^ 1; - blink = attr & 2; - reverse = attr & 4; - u_line = attr & 8; - v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10; - gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0; - color = (attr & 0xe0) >> 5; + uint8_t secret = (attr & 1) ^ 1; + uint8_t blink = attr & 2; + uint8_t reverse = attr & 4; + uint8_t u_line = attr & 8; + uint8_t v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10; + uint8_t gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0; + uint8_t color = (attr & 0xe0) >> 5; - for(yi=0;yi<lr;yi++) + for(int yi=0;yi<lr;yi++) { - for(xi=0;xi<8;xi++) + for(int xi=0;xi<8;xi++) { - int res_x,res_y; - - res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1); - res_y = y+yi - (m_txt_scroll_reg[3] % 20); + int res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1); + int res_y = y+yi - (m_txt_scroll_reg[3] % 20); if(!m_screen->visible_area().contains(res_x, res_y)) continue; - tile_data = 0; + uint8_t tile_data = 0; if(!secret) { /* TODO: priority */ if(gfx_mode) { - int gfx_bit; tile_data = 0; /* @@ -193,6 +171,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) 33337777 */ + int gfx_bit; gfx_bit = (xi & 4); gfx_bit+= (yi & (2 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); gfx_bit+= (yi & (4 << (char_size == 16 ? 0x01 : 0x00)))>>(1+(char_size == 16)); @@ -216,13 +195,14 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) if(blink && m_screen->frame_number() & 0x10) tile_data = 0; + int pen; if(yi >= char_size) pen = -1; else pen = (tile_data >> (7-xi) & 1) ? color : -1; if(pen != -1) - bitmap.pix32(res_y, res_x) = palette[pen]; + bitmap.pix(res_y, res_x) = palette[pen]; if(m_video_ff[WIDTH40_REG]) { @@ -230,7 +210,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) continue; if(pen != -1) - bitmap.pix32(res_y, res_x+1) = palette[pen]; + bitmap.pix(res_y, res_x+1) = palette[pen]; } } } diff --git a/src/mame/video/pc_t1t.cpp b/src/mame/video/pc_t1t.cpp index 6f122e2638c..28ec71c1fd4 100644 --- a/src/mame/video/pc_t1t.cpp +++ b/src/mame/video/pc_t1t.cpp @@ -185,8 +185,8 @@ void pc_t1t_device::pcjr_palette(palette_device &palette) const MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); if ( y == 0 ) logerror("t1000_text_inten_update_row\n"); for (int i = 0; i < x_count; i++) @@ -203,22 +203,22 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row ) data = 0xFF; } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); for (int i = 0; i < x_count; i++) { @@ -244,24 +244,23 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row ) } } - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff; uint8_t chr = m_displayram[ offset ]; @@ -285,157 +284,152 @@ MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjx_text_update_row ) else data = ((i == cursor_x) && (m_pc_framecnt & 8)) ? 0xff: 0; - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_4bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; + uint8_t data = vid[offset]; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; - data = vid[ offset + 1 ]; + data = vid[offset + 1]; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data >> 4 )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; - *p = palette[m_palette_base + m_reg.data[0x10 + ( data & 0x0F )]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data >> 4)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | (data & 0x0f)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; + uint8_t data = vid[offset]; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 6) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 4) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 2) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 0) & 0x03)]]; - data = vid[ offset+1 ]; + data = vid[offset + 1]; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 6 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 4 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( data >> 2 ) & 0x03 ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( data & 0x03 ) ]]; p++; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 6) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 4) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 2) & 0x03)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data >> 0) & 0x03)]]; } } MC6845_UPDATE_ROW( pcvideo_pcjr_device::pcjr_gfx_2bpp_high_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - for ( i = 0; i < x_count; i++ ) + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data0 = vid[ offset ]; - uint8_t data1 = vid[ offset + 1 ]; - - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x80 ) >> 7 ) | ( ( data1 & 0x80 ) >> 6 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x40 ) >> 6 ) | ( ( data1 & 0x40 ) >> 5 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x20 ) >> 5 ) | ( ( data1 & 0x20 ) >> 4 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x10 ) >> 4 ) | ( ( data1 & 0x10 ) >> 3 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x08 ) >> 3 ) | ( ( data1 & 0x08 ) >> 2 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x04 ) >> 2 ) | ( ( data1 & 0x04 ) >> 1 ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x02 ) >> 1 ) | ( ( data1 & 0x02 ) ) ) ]]; p++; - *p = palette[m_palette_base + m_reg.data[ 0x10 + ( ( ( data0 & 0x01 ) ) | ( ( data1 & 0x01 ) << 1 ) ) ]]; p++; + uint8_t data0 = vid[offset]; + uint8_t data1 = vid[offset + 1]; + + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 7) & 0x01) | ((data1 >> 6) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 6) & 0x01) | ((data1 >> 5) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 5) & 0x01) | ((data1 >> 4) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 4) & 0x01) | ((data1 >> 3) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 3) & 0x01) | ((data1 >> 2) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 2) & 0x01) | ((data1 >> 1) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 1) & 0x01) | ((data1 >> 0) & 0x02)]]; + *p++ = palette[m_palette_base + m_reg.data[0x10 | ((data0 >> 0) & 0x01) | ((data1 << 1) & 0x02)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_2bpp_tga_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - int i; + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); - if ( y == 0 ) logerror("t1000_gfx_2bpp_tga_update_row\n"); - for ( i = 0; i < x_count; i++ ) + if (y == 0) logerror("t1000_gfx_2bpp_tga_update_row\n"); + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; - uint16_t data2 = ( vid[ offset + 1 ] ) << 1; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x100 ) | ( data & 0x80 ) ) >> 7 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x80 ) | ( data & 0x40 ) ) >> 6 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x40 ) | ( data & 0x20 ) ) >> 5 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x20 ) | ( data & 0x10 ) ) >> 4 ) ]]; p++; - - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x10 ) | ( data & 0x08 ) ) >> 3 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x08 ) | ( data & 0x04 ) ) >> 2 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( ( data2 & 0x04 ) | ( data & 0x02 ) ) >> 1 ) ]]; p++; - *p = palette[m_reg.data[ 0x10 + ( ( data2 & 0x02 ) | ( data & 0x01 ) ) ]]; p++; + uint8_t data = vid[offset]; + uint8_t data2 = vid[offset + 1] << 1; + + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x100) | (data & 0x80)) >> 7)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x080) | (data & 0x40)) >> 6)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x040) | (data & 0x20)) >> 5)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x020) | (data & 0x10)) >> 4)]]; + + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x010) | (data & 0x08)) >> 3)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x008) | (data & 0x04)) >> 2)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x004) | (data & 0x02)) >> 1)]]; + *p++ = palette[m_reg.data[0x10 | (((data2 & 0x002) | (data & 0x01)) >> 0)]]; } } MC6845_UPDATE_ROW( pc_t1t_device::t1000_gfx_1bpp_update_row ) { - const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); - uint8_t *vid = m_displayram + ( ra << 13 ); - uint8_t fg = m_palette_base + m_reg.data[0x11]; - uint8_t bg = m_palette_base + m_reg.data[0x10]; - int i; - - if ( y == 0 ) logerror("t1000_gfx_1bpp_update_row\n"); - for ( i = 0; i < x_count; i++ ) + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); + uint32_t *p = &bitmap.pix(y); + uint8_t const *const vid = m_displayram + ( ra << 13 ); + uint8_t fg = m_palette_base + m_reg.data[0x11]; + uint8_t bg = m_palette_base + m_reg.data[0x10]; + + if (y == 0) logerror("t1000_gfx_1bpp_update_row\n"); + for (int i = 0; i < x_count; i++) { uint16_t offset = ( ( ma + i ) << 1 ) & 0x1fff; - uint8_t data = vid[ offset ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; - - data = vid[ offset + 1 ]; - - *p = palette[( data & 0x80 ) ? fg : bg]; p++; - *p = palette[( data & 0x40 ) ? fg : bg]; p++; - *p = palette[( data & 0x20 ) ? fg : bg]; p++; - *p = palette[( data & 0x10 ) ? fg : bg]; p++; - *p = palette[( data & 0x08 ) ? fg : bg]; p++; - *p = palette[( data & 0x04 ) ? fg : bg]; p++; - *p = palette[( data & 0x02 ) ? fg : bg]; p++; - *p = palette[( data & 0x01 ) ? fg : bg]; p++; + uint8_t data = vid[offset]; + + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; + + data = vid[offset + 1]; + + *p++ = palette[BIT(data, 7) ? fg : bg]; + *p++ = palette[BIT(data, 6) ? fg : bg]; + *p++ = palette[BIT(data, 5) ? fg : bg]; + *p++ = palette[BIT(data, 4) ? fg : bg]; + *p++ = palette[BIT(data, 3) ? fg : bg]; + *p++ = palette[BIT(data, 2) ? fg : bg]; + *p++ = palette[BIT(data, 1) ? fg : bg]; + *p++ = palette[BIT(data, 0) ? fg : bg]; } } diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp index 4e7a9362730..e472116b2cc 100644 --- a/src/mame/video/pcd.cpp +++ b/src/mame/video/pcd.cpp @@ -182,7 +182,7 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) data = ~data; for(int i = 0; i < 16; i++) { - bitmap.pix32(y, x++) = palette().pen(BIT(data, 15) ? 1 : 0); + bitmap.pix(y, x++) = palette().pen(BIT(data, 15) ? 1 : 0); data <<= 1; } } @@ -209,8 +209,8 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) for(int i = 0; i < 8; i++) { rgb_t pix = palette().pen(BIT(data, 7) ? fgnd : bgnd); - bitmap.pix32(y, x++) = pix; - bitmap.pix32(y, x++) = pix; + bitmap.pix(y, x++) = pix; + bitmap.pix(y, x++) = pix; data <<= 1; } } @@ -229,7 +229,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) for (int i = 0; i < 8; i++) { rgb_t pix = palette().pen(BIT(data, 7) ? 1 : 0); - bitmap.pix32(y, x++) = pix; + bitmap.pix(y, x++) = pix; data <<= 1; } } diff --git a/src/mame/video/pcw.cpp b/src/mame/video/pcw.cpp index 05eeb1a68b7..f0ee1903f5f 100644 --- a/src/mame/video/pcw.cpp +++ b/src/mame/video/pcw.cpp @@ -25,7 +25,7 @@ inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /*************************************************************************** @@ -211,12 +211,12 @@ uint32_t pcw_state::screen_update_pcw_printer(screen_device &screen, bitmap_ind1 rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1); feed = -(m_paper_feed / 2); copyscrollbitmap(bitmap,*m_prn_output,0,nullptr,1,&feed,rect); - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; - bitmap.pix16(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-3, m_printer_headpos) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos-1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos-1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-1, m_printer_headpos+1) = 0; + bitmap.pix(PCW_PRINTER_HEIGHT-2, m_printer_headpos+1) = 0; return 0; } diff --git a/src/mame/video/pcw16.cpp b/src/mame/video/pcw16.cpp index 35177c807b8..1fb7c6eb2f5 100644 --- a/src/mame/video/pcw16.cpp +++ b/src/mame/video/pcw16.cpp @@ -55,7 +55,7 @@ static constexpr rgb_t pcw16_palette[PCW16_NUM_COLOURS] = inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* Initialise the palette */ diff --git a/src/mame/video/pdp1.cpp b/src/mame/video/pdp1.cpp index 793f9ea5a56..cbdb3031fbd 100644 --- a/src/mame/video/pdp1.cpp +++ b/src/mame/video/pdp1.cpp @@ -29,7 +29,7 @@ inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } /* @@ -356,13 +356,12 @@ enum void pdp1_typewriter_device::linefeed() { uint8_t buf[typewriter_window_width]; - int y; assert(typewriter_window_width <= m_bitmap.width()); assert(typewriter_window_height <= m_bitmap.height()); - for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) + for (int y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - std::copy_n(&m_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); + std::copy_n(&m_bitmap.pix(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_bitmap, 0, y, typewriter_window_width, buf, m_driver_state->m_palette->pens()); } diff --git a/src/mame/video/pgm.cpp b/src/mame/video/pgm.cpp index 28b579390e1..fab7088207e 100644 --- a/src/mame/video/pgm.cpp +++ b/src/mame/video/pgm.cpp @@ -229,8 +229,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -252,8 +252,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -289,8 +289,8 @@ void pgm_state::draw_sprite_new_zoomed(int wide, int high, int xpos, int ypos, i if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line(wide, dest, destpri, cliprect, xzoom, xgrow, flip, xpos, pri, realxsize, palt, true); } else @@ -435,8 +435,8 @@ void pgm_state::draw_sprite_new_basic(int wide, int high, int xpos, int ypos, in if ((ydrawpos >= cliprect.min_y) && (ydrawpos <= cliprect.max_y)) { - u16 *dest = &bitmap.pix16(ydrawpos); - u8 *destpri = &priority_bitmap.pix8(ydrawpos); + u16 *dest = &bitmap.pix(ydrawpos); + u8 *destpri = &priority_bitmap.pix(ydrawpos); draw_sprite_line_basic(wide, dest, destpri, cliprect, flip, xpos, pri, realxsize, palt, true); } else diff --git a/src/mame/video/pgm2.cpp b/src/mame/video/pgm2.cpp index 3c7dc40e10e..e235549f8c7 100644 --- a/src/mame/video/pgm2.cpp +++ b/src/mame/video/pgm2.cpp @@ -10,7 +10,7 @@ inline void pgm2_state::draw_sprite_pixel(const rectangle &cliprect, u32 palette { u16 const pix = m_sprites_colour[palette_offset] & 0x3f; // there are some stray 0xff bytes in some roms, so mask u16 const pendat = pix + (pal * 0x40); - u16* dstptr_bitmap = &m_sprite_bitmap.pix16(realy); + u16 *const dstptr_bitmap = &m_sprite_bitmap.pix(realy); dstptr_bitmap[realx] = pendat; } } @@ -270,14 +270,12 @@ void pgm2_state::copy_sprites_from_bitmap(bitmap_rgb32 &bitmap, const rectangle { pri <<= 12; - const pen_t *paldata = m_sp_palette->pens(); - u16* srcptr_bitmap; - u32* dstptr_bitmap; + pen_t const *const paldata = m_sp_palette->pens(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - srcptr_bitmap = &m_sprite_bitmap.pix16(y); - dstptr_bitmap = &bitmap.pix32(y); + u16 const *const srcptr_bitmap = &m_sprite_bitmap.pix(y); + u32 *const dstptr_bitmap = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/pitnrun.cpp b/src/mame/video/pitnrun.cpp index a9ff5caa885..7ab1327869f 100644 --- a/src/mame/video/pitnrun.cpp +++ b/src/mame/video/pitnrun.cpp @@ -104,7 +104,7 @@ void pitnrun_state::spotlights() int datapix = ROM[128*16*i + x + y*16]; for(int b=0; b<8; b++) { - m_tmp_bitmap[i]->pix16(y, x*8 + (7 - b)) = (datapix & 1); + m_tmp_bitmap[i]->pix(y, x*8 + (7 - b)) = (datapix & 1); datapix>>=1; } } diff --git a/src/mame/video/pk8000.cpp b/src/mame/video/pk8000.cpp index e47b81066fe..9f5f3ccc5c5 100644 --- a/src/mame/video/pk8000.cpp +++ b/src/mame/video/pk8000.cpp @@ -104,7 +104,6 @@ void pk8000_base_state::_84_portc_w(uint8_t data) uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *videomem) { - int x,y,j,b; uint16_t offset = (m_video_mode & 0xc0) << 8; rectangle my_rect; my_rect.set(0, 256+32-1, 0, 192+32-1); @@ -116,36 +115,36 @@ uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bi // Text mode if (BIT(m_video_mode,5)==0){ // 32 columns - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t chr = videomem[x +(y*32) + ((m_text_start & 0x0f) << 10)+offset] ; uint8_t color= m_color[chr>>3]; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t code = videomem[((chr<<3) + j) + ((m_chargen_start & 0x0e) << 10)+offset]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { uint8_t col = (code >> b) & 0x01 ? (color & 0x0f) : ((color>>4) & 0x0f); - bitmap.pix16((y*8)+j+16, x*8+(7-b)+16) = col; + bitmap.pix((y*8)+j+16, x*8+(7-b)+16) = col; } } } } } else { // 40 columns - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { - for (x = 0; x < 42; x++) + for (int x = 0; x < 42; x++) { uint8_t chr = videomem[x +(y*64) + ((m_text_start & 0x0e) << 10)+offset] ; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t code = videomem[((chr<<3) + j) + ((m_chargen_start & 0x0e) << 10)+offset]; - for (b = 2; b < 8; b++) + for (int b = 2; b < 8; b++) { uint8_t col = ((code >> b) & 0x01) ? (m_video_color) & 0x0f : (m_video_color>>4) & 0x0f; - bitmap.pix16((y*8)+j+16, x*6+(7-b)+16+8) = col; + bitmap.pix((y*8)+j+16, x*6+(7-b)+16+8) = col; } } } @@ -153,21 +152,21 @@ uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bi } } else { //Graphics - for (y = 0; y < 24; y++) + for (int y = 0; y < 24; y++) { uint16_t off_color = (((~m_color_start) & 0x08) << 10)+offset + ((y>>3)<<11); uint16_t off_code = (((~m_video_start) & 0x08) << 10)+offset + ((y>>3)<<11); - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { uint8_t chr = videomem[x +(y*32) + ((m_chargen_start & 0x0e) << 10)+offset] ; - for (j = 0; j < 8; j++) { + for (int j = 0; j < 8; j++) { uint8_t color= videomem[((chr<<3) + j)+off_color]; uint8_t code = videomem[((chr<<3) + j)+off_code]; - for (b = 0; b < 8; b++) + for (int b = 0; b < 8; b++) { uint8_t col = (code >> b) & 0x01 ? (color & 0x0f) : ((color>>4) & 0x0f); - bitmap.pix16((y*8)+j+16, x*8+(7-b)+16) = col; + bitmap.pix((y*8)+j+16, x*8+(7-b)+16) = col; } } } diff --git a/src/mame/video/pk8020.cpp b/src/mame/video/pk8020.cpp index b4915f1135b..5ac06457619 100644 --- a/src/mame/video/pk8020.cpp +++ b/src/mame/video/pk8020.cpp @@ -135,17 +135,17 @@ void pk8020_state::gzu_w(offs_t offset, uint8_t data) uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); for (int y = 0; y < 16; y++) { for (int x = 0; x < 64; x++) { - uint8_t chr = ram[x +(y*64) + 0x40000]; - uint8_t attr= ram[x +(y*64) + 0x40400]; + uint8_t const chr = ram[x +(y*64) + 0x40000]; + uint8_t const attr= ram[x +(y*64) + 0x40400]; for (int j = 0; j < 16; j++) { - uint32_t addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); + uint32_t const addr = 0x10000 + x + ((y*16+j)*64) + (m_video_page * 0xC000); uint8_t code1 = ram[addr]; uint8_t code2 = ram[addr + 0x4000]; uint8_t code3 = ram[addr + 0x8000]; @@ -157,7 +157,7 @@ uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16 col |= (((code3 >> b) & 0x01) ? 0x04 : 0x00); col |= (((code2 >> b) & 0x01) ? 0x02 : 0x00); col |= (((code1 >> b) & 0x01) ? 0x01 : 0x00); - bitmap.pix16((y*16)+j, x*8+(7-b)) = col; + bitmap.pix((y*16)+j, x*8+(7-b)) = col; } } } diff --git a/src/mame/video/playmark.cpp b/src/mame/video/playmark.cpp index dd6eff32dd6..834a363b4b1 100644 --- a/src/mame/video/playmark.cpp +++ b/src/mame/video/playmark.cpp @@ -437,24 +437,20 @@ void playmark_state::bigtwinb_draw_sprites( screen_device &screen, bitmap_ind16 void playmark_state::draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int x, y, count; - int color; - uint8_t *pri; - - count = 0; - for (y = 0; y < 512; y++) + int count = 0; + for (int y = 0; y < 512; y++) { - for (x = 0; x < 512; x++) + for (int x = 0; x < 512; x++) { - color = m_bgvideoram[count] & 0xff; + int const color = m_bgvideoram[count] & 0xff; if (color) { if (m_bg_full_size) { - bitmap.pix16((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color; + bitmap.pix((y + m_bgscrolly) & 0x1ff, (x + m_bgscrollx) & 0x1ff) = 0x100 + color; - pri = &screen.priority().pix8((y + m_bgscrolly) & 0x1ff); + uint8_t *const pri = &screen.priority().pix((y + m_bgscrolly) & 0x1ff); pri[(x + m_bgscrollx) & 0x1ff] |= 2; } else @@ -462,9 +458,9 @@ void playmark_state::draw_bitmap( screen_device &screen, bitmap_ind16 &bitmap, c /* 50% size */ if(!(x % 2) && !(y % 2)) { - bitmap.pix16((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color; + bitmap.pix((y / 2 + m_bgscrolly) & 0x1ff, (x / 2 + m_bgscrollx) & 0x1ff) = 0x100 + color; - pri = &screen.priority().pix8((y / 2 + m_bgscrolly) & 0x1ff); + uint8_t *const pri = &screen.priority().pix((y / 2 + m_bgscrolly) & 0x1ff); pri[(x / 2 + m_bgscrollx) & 0x1ff] |= 2; } } diff --git a/src/mame/video/pocketc.cpp b/src/mame/video/pocketc.cpp index dc845f029df..2226b23bbbd 100644 --- a/src/mame/video/pocketc.cpp +++ b/src/mame/video/pocketc.cpp @@ -44,5 +44,5 @@ void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, con for (int i = 0; i < 5; i++, y++) for (int j = 0; fig[i][j]; j++) if (fig[i][j] != ' ') - bitmap.pix16(y, x + j) = color; + bitmap.pix(y, x + j) = color; } diff --git a/src/mame/video/polepos.cpp b/src/mame/video/polepos.cpp index eeaf594a590..a6bfbcf6679 100644 --- a/src/mame/video/polepos.cpp +++ b/src/mame/video/polepos.cpp @@ -416,7 +416,7 @@ void polepos_state::zoom_sprite(bitmap_ind16 &bitmap,int big, int pen = src[offs/2 ^ flipx]; if (!((transmask >> pen) & 1)) - bitmap.pix16(yy, xx) = pen + coloroffs; + bitmap.pix(yy, xx) = pen + coloroffs; } offs++; diff --git a/src/mame/video/policetr.cpp b/src/mame/video/policetr.cpp index 4fd79e3f28f..1b0ff34ee5d 100644 --- a/src/mame/video/policetr.cpp +++ b/src/mame/video/policetr.cpp @@ -97,8 +97,8 @@ void policetr_state::render_display_list(offs_t offset) { for (int y = 0; y < dsth; y++) { - uint8_t *dst = &m_dstbitmap->pix8(dsty + y,dstx); - memset(dst, pixel, dstw); + uint8_t *dst = &m_dstbitmap->pix(dsty + y,dstx); + std::fill_n(dst, dstw, pixel); } } } @@ -110,8 +110,8 @@ void policetr_state::render_display_list(offs_t offset) uint32_t cury = srcy; for (int y = 0; y < dsth; y++, cury += srcystep) { - const uint8_t *src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH]; - uint8_t *dst = &m_dstbitmap->pix8((dsty + y), dstx); + uint8_t const *const src = &m_srcbitmap[((cury >> 16) & m_srcbitmap_height_mask) * SRCBITMAP_WIDTH]; + uint8_t *const dst = &m_dstbitmap->pix((dsty + y), dstx); /* loop over columns */ for (int x = 0, curx = srcx; x < dstw; x++, curx += srcxstep) @@ -181,7 +181,7 @@ void policetr_state::video_w(offs_t offset, uint32_t data, uint32_t mem_mask) /* latch 0x50 allows a direct write to the destination bitmap */ case 0x50: if (ACCESSING_BITS_24_31 && m_dst_xoffs < DSTBITMAP_WIDTH && m_dst_yoffs < DSTBITMAP_HEIGHT) - m_dstbitmap->pix8(m_dst_yoffs,m_dst_xoffs) = data >> 24; + m_dstbitmap->pix(m_dst_yoffs,m_dst_xoffs) = data >> 24; break; /* log anything else */ @@ -306,13 +306,13 @@ uint32_t policetr_state::video_r() uint32_t policetr_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { const int width = cliprect.width(); - const rgb_t *palette = m_palette->palette()->entry_list_raw(); + rgb_t const *const palette = m_palette->palette()->entry_list_raw(); /* render all the scanlines from the dstbitmap to MAME's bitmap */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint8_t *src = &m_dstbitmap->pix8(y,cliprect.min_x); - uint32_t *dst = &bitmap.pix32(y,cliprect.min_x); + uint8_t const *src = &m_dstbitmap->pix(y,cliprect.min_x); + uint32_t *dst = &bitmap.pix(y,cliprect.min_x); //draw_scanline8(bitmap, cliprect.min_x, y, width, src, nullptr); for (int x = 0; x < width; x++, dst++, src++) *dst = palette[*src]; diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp index 45d09c0ab12..edb10dc7b1f 100644 --- a/src/mame/video/popeye.cpp +++ b/src/mame/video/popeye.cpp @@ -383,14 +383,14 @@ void tnx1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from + bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from else { // TODO: confirm the memory layout int sx = x + (2 * (m_background_scroll[0] | ((m_background_scroll[2] & 1) << 8))) + 0x70; int shift = (sx & 0x200) / 0x80; - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } @@ -409,14 +409,14 @@ void tpp1_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from + bitmap.pix(y, x) = m_background_ram[0] & 0xf; // TODO: find out exactly where the data is fetched from else { // TODO: confirm the memory layout int sx = x + (2 * m_background_scroll[0]) + 0x70; int shift = (sy & 4); - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } @@ -435,14 +435,14 @@ void tpp2_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (sy < 0) - bitmap.pix16(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf; + bitmap.pix(y, x) = m_background_ram[((sy & 0x100) / 8) * 0x40] & 0xf; else { // TODO: confirm the memory layout int sx = x + (2 * m_background_scroll[0]) + 0x70; int shift = (sy & 4); - bitmap.pix16(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; + bitmap.pix(y, x) = (m_background_ram[((sx / 8) & 0x3f) + ((sy / 8) * 0x40)] >> shift) & 0xf; } } } diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index 1584ac823a4..dd237df28e3 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -2420,7 +2420,7 @@ inline void powervr2_device::render_hline(bitmap_rgb32 &bitmap, texinfo *ti, int offl[idx] += ddx * dodx[idx]; } - tdata = &bitmap.pix32(y, xxl); + tdata = &bitmap.pix(y, xxl); wbufline = &wbuffer[y][xxl]; while(xxl < xxr) { @@ -2881,13 +2881,12 @@ void powervr2_device::render_to_accumulation_buffer(bitmap_rgb32 &bitmap, const /* 0555KRGB = 0 */ void powervr2_device::fb_convert_0555krgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2902,13 +2901,12 @@ void powervr2_device::fb_convert_0555krgb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_0555krgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2923,13 +2921,12 @@ void powervr2_device::fb_convert_0555krgb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_0555krgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2944,13 +2941,12 @@ void powervr2_device::fb_convert_0555krgb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_0555krgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2964,13 +2960,12 @@ void powervr2_device::fb_convert_0555krgb_to_888rgb32(address_space &space, int /* 0565RGB = 1 */ void powervr2_device::fb_convert_0565rgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -2985,13 +2980,12 @@ void powervr2_device::fb_convert_0565rgb_to_555rgb(address_space &space, int x,i void powervr2_device::fb_convert_0565rgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3006,13 +3000,12 @@ void powervr2_device::fb_convert_0565rgb_to_565rgb(address_space &space, int x,i void powervr2_device::fb_convert_0565rgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3027,13 +3020,12 @@ void powervr2_device::fb_convert_0565rgb_to_888rgb24(address_space &space, int x void powervr2_device::fb_convert_0565rgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3047,13 +3039,12 @@ void powervr2_device::fb_convert_0565rgb_to_888rgb32(address_space &space, int x /* 1555ARGB = 3 */ void powervr2_device::fb_convert_1555argb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3068,13 +3059,12 @@ void powervr2_device::fb_convert_1555argb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_1555argb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3089,13 +3079,12 @@ void powervr2_device::fb_convert_1555argb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_1555argb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3110,13 +3099,12 @@ void powervr2_device::fb_convert_1555argb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_1555argb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3130,13 +3118,12 @@ void powervr2_device::fb_convert_1555argb_to_888rgb32(address_space &space, int /* 888RGB = 4 */ void powervr2_device::fb_convert_888rgb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3151,13 +3138,12 @@ void powervr2_device::fb_convert_888rgb_to_555rgb(address_space &space, int x,in void powervr2_device::fb_convert_888rgb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3172,13 +3158,12 @@ void powervr2_device::fb_convert_888rgb_to_565rgb(address_space &space, int x,in void powervr2_device::fb_convert_888rgb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3193,13 +3178,12 @@ void powervr2_device::fb_convert_888rgb_to_888rgb24(address_space &space, int x, void powervr2_device::fb_convert_888rgb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3214,13 +3198,12 @@ void powervr2_device::fb_convert_888rgb_to_888rgb32(address_space &space, int x, /* 8888ARGB = 6 */ void powervr2_device::fb_convert_8888argb_to_555rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3235,13 +3218,12 @@ void powervr2_device::fb_convert_8888argb_to_555rgb(address_space &space, int x, void powervr2_device::fb_convert_8888argb_to_565rgb(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*2); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3256,13 +3238,12 @@ void powervr2_device::fb_convert_8888argb_to_565rgb(address_space &space, int x, void powervr2_device::fb_convert_8888argb_to_888rgb24(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*3); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3277,13 +3258,12 @@ void powervr2_device::fb_convert_8888argb_to_888rgb24(address_space &space, int void powervr2_device::fb_convert_8888argb_to_888rgb32(address_space &space, int x,int y) { - int xcnt,ycnt; - for (ycnt=0;ycnt<32;ycnt++) + for (int ycnt=0;ycnt<32;ycnt++) { uint32_t realwriteoffs = 0x05000000 + fb_w_sof1 + (y+ycnt) * (fb_w_linestride<<3) + (x*4); - uint32_t *src = &fake_accumulationbuffer_bitmap->pix32(y+ycnt, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y+ycnt, x); - for (xcnt=0;xcnt<32;xcnt++) + for (int xcnt=0;xcnt<32;xcnt++) { // data starts in 8888 format, downsample it uint32_t data = src[xcnt]; @@ -3403,16 +3383,11 @@ void powervr2_device::pvr_accumulationbuffer_to_framebuffer(address_space &space void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle &cliprect) { - int x,y,dy,xi; - uint32_t addrp; - uint32_t *fbaddr; - uint32_t c; - uint32_t r,g,b; + int dy,xi; uint8_t interlace_on = ((spg_control & 0x10) >> 4); int32_t ystart_f1 = (vo_starty & 0x3ff) << interlace_on; //int32_t ystart_f2 = (vo_starty >> 16) & 0x3ff; int32_t hstart = (vo_startx & 0x3ff); - int res_x,res_y; // rectangle fbclip; uint8_t unpackmode = (fb_r_ctrl & 0x0000000c) >>2; // aka fb_depth @@ -3443,29 +3418,29 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & { case 0x00: // 0555 RGB 16-bit, Cleo Fortune Plus // should upsample back to 8-bit output using fb_concat - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x03e0) >> 2; - r = (c & 0x7c00) >> 7; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x03e0) >> 2; + uint32_t r = (c & 0x7c00) >> 7; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); addrp+=2; @@ -3473,17 +3448,17 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; + int res_x = x + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x03e0) >> 2; - r = (c & 0x7c00) >> 7; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x03e0) >> 2; + uint32_t r = (c & 0x7c00) >> 7; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3491,32 +3466,32 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } } } - break; + case 0x01: // 0565 RGB 16-bit // should upsample back to 8-bit output using fb_concat - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x07e0) >> 3; - r = (c & 0xf800) >> 8; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x07e0) >> 3; + uint32_t r = (c & 0xf800) >> 8; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; //res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3526,16 +3501,16 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c=*((reinterpret_cast<uint16_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 1)); - b = (c & 0x001f) << 3; - g = (c & 0x07e0) >> 3; - r = (c & 0xf800) >> 8; + uint32_t b = (c & 0x001f) << 3; + uint32_t g = (c & 0x07e0) >> 3; + uint32_t r = (c & 0xf800) >> 8; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3546,34 +3521,31 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & break; case 0x02: ; // 888 RGB 24-bit - suchie3, Soul Calibur - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - b = c; + uint32_t b =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - g = c; + uint32_t g =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); - r = c; + uint32_t r =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3582,20 +3554,17 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - b = c; + uint32_t b =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - g = c; + uint32_t g =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+1)); - c =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); - r = c; + uint32_t r =*(uint8_t *)((reinterpret_cast<uint8_t *>(dc_framebuffer_ram)) + BYTE8_XOR_LE(addrp+2)); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3607,30 +3576,30 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & break; case 0x03: // 0888 ARGB 32-bit - for (y=0;y <= dy;y++) + for (int y=0;y <= dy;y++) { - addrp = fb_r_sof1+y*xi*2; + uint32_t addrp = fb_r_sof1+y*xi*2; if(vo_control & 0x100) { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x*2+0 + hstart; - res_y = y + ystart_f1; + int res_x = x*2+0 + hstart; + int res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); - b = (c & 0x0000ff) >> 0; - g = (c & 0x00ff00) >> 8; - r = (c & 0xff0000) >> 16; + uint32_t b = (c & 0x0000ff) >> 0; + uint32_t g = (c & 0x00ff00) >> 8; + uint32_t r = (c & 0xff0000) >> 16; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); res_x = x*2+1 + hstart; - fbaddr=&bitmap.pix32(res_y, res_x); + fbaddr=&bitmap.pix(res_y, res_x); if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3639,16 +3608,16 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & } else { - for (x=0;x < xi;x++) + for (int x=0;x < xi;x++) { - res_x = x + hstart; - res_y = y + ystart_f1; - fbaddr=&bitmap.pix32(res_y, res_x); - c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); + int res_x = x + hstart; + int res_y = y + ystart_f1; + uint32_t *fbaddr=&bitmap.pix(res_y, res_x); + uint32_t c =*((reinterpret_cast<uint32_t *>(dc_framebuffer_ram)) + (WORD2_XOR_LE(addrp) >> 2)); - b = (c & 0x0000ff) >> 0; - g = (c & 0x00ff00) >> 8; - r = (c & 0xff0000) >> 16; + uint32_t b = (c & 0x0000ff) >> 0; + uint32_t g = (c & 0x00ff00) >> 8; + uint32_t r = (c & 0xff0000) >> 16; if (cliprect.contains(res_x, res_y)) *fbaddr = b | (g<<8) | (r<<16); @@ -3665,23 +3634,19 @@ void powervr2_device::pvr_drawframebuffer(bitmap_rgb32 &bitmap,const rectangle & #if DEBUG_PALRAM void powervr2_device::debug_paletteram() { - uint64_t pal; - uint32_t r,g,b; - int i; - //popmessage("%02x",pal_ram_ctrl); - for(i=0;i<0x400;i++) + for(int i=0;i<0x400;i++) { - pal = palette[i]; + uint64_t pal = palette[i]; switch(pal_ram_ctrl) { case 0: //argb1555 <- guilty gear uses this mode { //a = (pal & 0x8000)>>15; - r = (pal & 0x7c00)>>10; - g = (pal & 0x03e0)>>5; - b = (pal & 0x001f)>>0; + uint32_t r = (pal & 0x7c00)>>10; + uint32_t g = (pal & 0x03e0)>>5; + uint32_t b = (pal & 0x001f)>>0; //a = a ? 0xff : 0x00; m_palette->set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b)); } @@ -3689,27 +3654,27 @@ void powervr2_device::debug_paletteram() case 1: //rgb565 { //a = 0xff; - r = (pal & 0xf800)>>11; - g = (pal & 0x07e0)>>5; - b = (pal & 0x001f)>>0; + uint32_t r = (pal & 0xf800)>>11; + uint32_t g = (pal & 0x07e0)>>5; + uint32_t b = (pal & 0x001f)>>0; m_palette->set_pen_color(i, pal5bit(r), pal6bit(g), pal5bit(b)); } break; case 2: //argb4444 { //a = (pal & 0xf000)>>12; - r = (pal & 0x0f00)>>8; - g = (pal & 0x00f0)>>4; - b = (pal & 0x000f)>>0; + uint32_t r = (pal & 0x0f00)>>8; + uint32_t g = (pal & 0x00f0)>>4; + uint32_t b = (pal & 0x000f)>>0; m_palette->set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b)); } break; case 3: //argb8888 { //a = (pal & 0xff000000)>>20; - r = (pal & 0x00ff0000)>>16; - g = (pal & 0x0000ff00)>>8; - b = (pal & 0x000000ff)>>0; + uint32_t r = (pal & 0x00ff0000)>>16; + uint32_t g = (pal & 0x0000ff00)>>8; + uint32_t b = (pal & 0x000000ff)>>0; m_palette->set_pen_color(i, r, g, b); } break; @@ -3838,7 +3803,6 @@ uint32_t powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bit // static int useframebuffer=1; // const rectangle &visarea = screen.visible_area(); -// int y,x; #if DEBUG_PALRAM debug_paletteram(); @@ -3846,12 +3810,12 @@ uint32_t powervr2_device::screen_update(screen_device &screen, bitmap_rgb32 &bit // copy our fake framebuffer bitmap (where things have been rendered) to the screen #if 0 - for (y = visarea->min_y ; y <= visarea->max_y ; y++) + for (int y = visarea->min_y ; y <= visarea->max_y ; y++) { - for (x = visarea->min_x ; x <= visarea->max_x ; x++) + for (int x = visarea->min_x ; x <= visarea->max_x ; x++) { - uint32_t* src = &fake_accumulationbuffer_bitmap->pix32(y, x); - uint32_t* dst = &bitmap.pix32(y, x); + uint32_t const *const src = &fake_accumulationbuffer_bitmap->pix(y, x); + uint32_t *const dst = &bitmap.pix(y, x); dst[0] = src[0]; } } diff --git a/src/mame/video/pp01.cpp b/src/mame/video/pp01.cpp index 7afc209d8da..eff118c6b2d 100644 --- a/src/mame/video/pp01.cpp +++ b/src/mame/video/pp01.cpp @@ -27,7 +27,7 @@ uint32_t pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bit for (int b = 0; b < 8; b++) { uint8_t const col = (BIT(code_r, b) << 2) | (BIT(code_g, b) << 1) | (BIT(code_b, b) << 0); - bitmap.pix16(y, x*8+(7-b)) = col; + bitmap.pix(y, x*8+(7-b)) = col; } } } diff --git a/src/mame/video/psikyosh.cpp b/src/mame/video/psikyosh.cpp index beaf8088fdf..219a70b416e 100644 --- a/src/mame/video/psikyosh.cpp +++ b/src/mame/video/psikyosh.cpp @@ -342,7 +342,7 @@ void psikyosh_state::draw_bglayerscroll(u8 const layer, bitmap_rgb32 &bitmap, co g_profiler.start(PROFILER_USER2); u32 tilemap_line[32 * 16]; u32 scr_line[64 * 8]; - std::copy_n(&m_bg_bitmap.pix32(tilemap_scanline, 0), 0x200, tilemap_line); + std::copy_n(&m_bg_bitmap.pix(tilemap_scanline, 0), 0x200, tilemap_line); g_profiler.stop(); /* slow bit, needs optimising. apply scrollx and zoomx by assembling scanline from row */ @@ -514,8 +514,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + (y_index) * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -536,7 +536,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -560,8 +560,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -582,7 +582,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -607,8 +607,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl if (z > 0) { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); - u16 *pri = &m_z_bitmap.pix16(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); + u16 *pri = &m_z_bitmap.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -629,7 +629,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl else { const u8 *source = code_base + y_index * gfx->rowbytes() + x_index_base; - u32 *dest = &dest_bmp.pix32(sy, sx); + u32 *dest = &dest_bmp.pix(sy, sx); const int src_modulo = yinc * gfx->rowbytes() - xinc * (ex - sx); const int dst_modulo = dest_bmp.rowpixels() - (ex - sx); @@ -664,7 +664,7 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl for (int ypixel = 0; ypixel < gfx->height(); ypixel++) { const u8 *source = code_base + ypixel * gfx->rowbytes(); - u8 *dest = &m_zoom_bitmap.pix8(ypixel + ytile*gfx->height()); + u8 *dest = &m_zoom_bitmap.pix(ypixel + ytile*gfx->height()); for (int xpixel = 0; xpixel < gfx->width(); xpixel++) { @@ -738,9 +738,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -756,8 +756,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -778,9 +778,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -796,8 +796,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -818,9 +818,9 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); - u16 *pri = &m_z_bitmap.pix16(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); + u16 *pri = &m_z_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -836,8 +836,8 @@ void psikyosh_state::psikyosh_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectangl { for (int y = sy; y < ey; y++) { - const u8 *source = &m_zoom_bitmap.pix8(y_index >> 10); - u32 *dest = &dest_bmp.pix32(y); + const u8 *source = &m_zoom_bitmap.pix(y_index >> 10); + u32 *dest = &dest_bmp.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -1008,7 +1008,7 @@ void psikyosh_state::prelineblend(bitmap_rgb32 &bitmap, const rectangle &cliprec g_profiler.start(PROFILER_USER8); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dstline = &bitmap.pix32(y); + u32 *dstline = &bitmap.pix(y); /* linefill[y] & 0xff does what? */ for (int x = cliprect.left(); x <= cliprect.right(); x++) @@ -1032,7 +1032,7 @@ void psikyosh_state::postlineblend(bitmap_rgb32 &bitmap, const rectangle &clipre g_profiler.start(PROFILER_USER8); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - u32 *dstline = &bitmap.pix32(y); + u32 *dstline = &bitmap.pix(y); if (lineblend[y] & 0x80) /* solid */ { diff --git a/src/mame/video/qix.cpp b/src/mame/video/qix.cpp index 87ef3557296..5a10f61d378 100644 --- a/src/mame/video/qix.cpp +++ b/src/mame/video/qix.cpp @@ -281,8 +281,8 @@ MC6845_BEGIN_UPDATE( qix_state::crtc_begin_update ) MC6845_UPDATE_ROW( qix_state::crtc_update_row ) { - uint32_t *dest = &bitmap.pix32(y); - pen_t *pens = &m_pens[m_palette_bank << 8]; + uint32_t *const dest = &bitmap.pix(y); + pen_t const *const pens = &m_pens[m_palette_bank << 8]; /* the memory is hooked up to the MA, RA lines this way */ offs_t offs = ((ma << 6) & 0xf800) | ((ra << 8) & 0x0700); diff --git a/src/mame/video/quasar.cpp b/src/mame/video/quasar.cpp index ad399cdd07c..742256f8cfd 100644 --- a/src/mame/video/quasar.cpp +++ b/src/mame/video/quasar.cpp @@ -108,7 +108,7 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 for (int ox = 0; ox < 8; ox++) for (int oy = 0; oy < 8; oy++) - bitmap.pix16(y + oy, x + ox) = forecolor; + bitmap.pix(y + oy, x + ox) = forecolor; // Main Screen m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, @@ -144,10 +144,10 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 int const bx = 255 - 9 - m_bullet_ram[offs] - ct; // bullet/object Collision - if (s2636_0_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x04; - if (s2636_2_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x08; + if (s2636_0_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x04; + if (s2636_2_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x08; - bitmap.pix16(offs, bx) = 7; + bitmap.pix(offs, bx) = 7; } } } @@ -158,18 +158,18 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 { for (int x = cliprect.left(); x <= cliprect.right(); x++) { - int const pixel0 = s2636_0_bitmap.pix16(y, x); - int const pixel1 = s2636_1_bitmap.pix16(y, x); - int const pixel2 = s2636_2_bitmap.pix16(y, x); + int const pixel0 = s2636_0_bitmap.pix(y, x); + int const pixel1 = s2636_1_bitmap.pix(y, x); + int const pixel2 = s2636_2_bitmap.pix(y, x); int const pixel = pixel0 | pixel1 | pixel2; if (S2636_IS_PIXEL_DRAWN(pixel)) { - bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel); + bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel); /* S2636 vs. background collision detection */ - if (m_palette->pen_indirect(m_collision_background.pix16(y, x))) + if (m_palette->pen_indirect(m_collision_background.pix(y, x))) { if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01; if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02; diff --git a/src/mame/video/raiden2.cpp b/src/mame/video/raiden2.cpp index ad98fbe44fd..ff06d5906be 100644 --- a/src/mame/video/raiden2.cpp +++ b/src/mame/video/raiden2.cpp @@ -322,12 +322,12 @@ void raiden2_state::blend_layer(bitmap_rgb32 &bitmap, const rectangle &cliprect, if (layer == -1) return; - const pen_t *pens = &m_palette->pen(0); + pen_t const *const pens = &m_palette->pen(0); layer <<= 14; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *src = &source.pix16(y, cliprect.min_x); - u32 *dst = &bitmap.pix32(y, cliprect.min_x); + const u16 *src = &source.pix(y, cliprect.min_x); + u32 *dst = &bitmap.pix(y, cliprect.min_x); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { u16 val = *src++; diff --git a/src/mame/video/rallyx.cpp b/src/mame/video/rallyx.cpp index 081f07da6f1..740b587b6b8 100644 --- a/src/mame/video/rallyx.cpp +++ b/src/mame/video/rallyx.cpp @@ -411,8 +411,8 @@ void rallyx_state::plot_star( bitmap_ind16 &bitmap, const rectangle &cliprect, i if (flip_screen_y()) y = 255 - y; - if (m_palette->pen_indirect(bitmap.pix16(y, x) % 0x144) == 0) - bitmap.pix16(y, x) = STARS_COLOR_BASE + color; + if (m_palette->pen_indirect(bitmap.pix(y, x) % 0x144) == 0) + bitmap.pix(y, x) = STARS_COLOR_BASE + color; } void rallyx_state::draw_stars( bitmap_ind16 &bitmap, const rectangle &cliprect ) diff --git a/src/mame/video/rampart.cpp b/src/mame/video/rampart.cpp index 0d1175045da..1277d658e76 100644 --- a/src/mame/video/rampart.cpp +++ b/src/mame/video/rampart.cpp @@ -76,8 +76,8 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1 for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -101,13 +101,13 @@ void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle /* update any dirty scanlines */ for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const uint16_t *src = &m_bitmap[256 * y]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &m_bitmap[256 * y]; + uint16_t *const dst = &bitmap.pix(y); /* regenerate the line */ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { - int bits = src[(x - 8) / 2]; + int const bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; dst[x + 1] = bits & 0xff; } diff --git a/src/mame/video/redalert.cpp b/src/mame/video/redalert.cpp index 3e216dec401..a29f0f612bd 100644 --- a/src/mame/video/redalert.cpp +++ b/src/mame/video/redalert.cpp @@ -260,16 +260,11 @@ VIDEO_START_MEMBER(redalert_state,ww3) uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_redalert_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -280,6 +275,7 @@ uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rg offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -291,30 +287,29 @@ uint32_t redalert_state::screen_update_redalert(screen_device &screen, bitmap_rg charmap_data_2 = m_charmap_videoram[0x0800 | charmap_data_base]; } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if ((*m_video_control ^ m_control_xor) & 0x04) - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; else - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } @@ -351,16 +346,11 @@ void redalert_state::demoneye_bitmap_layer_w(offs_t offset, uint8_t data) uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_demoneye_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -371,6 +361,7 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -386,30 +377,29 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg //charmap_data_1 = m_charmap_videoram[0x1400 | charmap_data_base]; //charmap_data_2 = m_charmap_videoram[0x1800 | charmap_data_base]; - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if (*m_video_control & 0x04) - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; else - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } @@ -450,7 +440,7 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg int y_dst = 8*width - (y_block*8+iy); int x_dst = 8*width - (x_block*8+7-ix); ccc=pens[NUM_CHARMAP_PENS+ccc]; - bitmap.pix32(y+y_dst, x+x_dst) = ccc; + bitmap.pix(y+y_dst, x+x_dst) = ccc; } l0<<=1; @@ -478,16 +468,11 @@ uint32_t redalert_state::screen_update_demoneye(screen_device &screen, bitmap_rg uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; - offs_t offs; get_panther_pens(pens); - for (offs = 0; offs < 0x2000; offs++) + for (offs_t offs = 0; offs < 0x2000; offs++) { - int i; - uint8_t charmap_data_1; - uint8_t charmap_data_2; - uint8_t y = offs & 0xff; uint8_t x = (~offs >> 8) << 3; @@ -498,6 +483,7 @@ uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ + uint8_t charmap_data_1, charmap_data_2; if (charmap_code & 0x80) { charmap_data_1 = m_charmap_videoram[0x0400 | charmap_data_base]; @@ -509,30 +495,29 @@ uint32_t redalert_state::screen_update_panther(screen_device &screen, bitmap_rgb charmap_data_2 = m_charmap_videoram[0x0800 | charmap_data_base]; } - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { - pen_t pen; - int bitmap_bit = bitmap_data & 0x80; uint8_t color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); /* determine priority */ + pen_t pen; if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; else pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; if ((*m_video_control ^ m_control_xor) & 0x04) - bitmap.pix32(y, x) = pen; + bitmap.pix(y, x) = pen; else - bitmap.pix32(y ^ 0xff, x ^ 0xff) = pen; + bitmap.pix(y ^ 0xff, x ^ 0xff) = pen; /* next pixel */ - x = x + 1; + x++; - bitmap_data = bitmap_data << 1; - charmap_data_1 = charmap_data_1 << 1; - charmap_data_2 = charmap_data_2 << 1; + bitmap_data <<= 1; + charmap_data_1 <<= 1; + charmap_data_2 <<= 1; } } diff --git a/src/mame/video/redclash.cpp b/src/mame/video/redclash.cpp index 631baba737d..c23f67bda3f 100644 --- a/src/mame/video/redclash.cpp +++ b/src/mame/video/redclash.cpp @@ -232,7 +232,7 @@ void redclash_state::draw_bullets( bitmap_ind16 &bitmap, const rectangle &clipre } if (cliprect.contains(sx, sy)) - bitmap.pix16(sy, sx) = 0x19; + bitmap.pix(sy, sx) = 0x19; } } diff --git a/src/mame/video/relief.cpp b/src/mame/video/relief.cpp index 38e25ce71d4..b8a4d405eb2 100644 --- a/src/mame/video/relief.cpp +++ b/src/mame/video/relief.cpp @@ -108,9 +108,9 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -136,13 +136,13 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 * * --- CRA8-1 are the low 8 bits of the color RAM index; set as expected */ - int cs0 = 0; - int cs1 = 1; /* compute the CS0 signal */ + int cs0 = 0; cs0 = ((mo[x] & 0x0f) == 0); /* compute the CS1 signal */ + int cs1 = 1; if ((!cs0 && (mo[x] & 0xe0) == 0xe0) || ((mo[x] & 0xf0) == 0xe0) || (!pri[x] && !cs0) || diff --git a/src/mame/video/rltennis.cpp b/src/mame/video/rltennis.cpp index 84debeca2f1..6a393babd55 100644 --- a/src/mame/video/rltennis.cpp +++ b/src/mame/video/rltennis.cpp @@ -154,10 +154,6 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) int x_src_step=(m_blitter[BLT_FLAGS] & BLTFLAG_SRC_X_DIR)?1:-1; int y_src_step=(m_blitter[BLT_FLAGS] & BLTFLAG_SRC_Y_DIR)?1:-1; - int x,y; - - int idx_x,idx_y; - int blit_w=src_x1-src_x0; int blit_h=src_y1-src_y0; @@ -193,9 +189,9 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) force_blit=true; } - for( x=dst_x0, idx_x=0 ; idx_x<=blit_w1; x+=x_dst_step, idx_x++ ) + for( int x=dst_x0, idx_x=0 ; idx_x<=blit_w1; x+=x_dst_step, idx_x++ ) { - for( y=dst_y0, idx_y=0 ; idx_y<=blit_h1;y+=y_dst_step, idx_y++) + for( int y=dst_y0, idx_y=0 ; idx_y<=blit_h1;y+=y_dst_step, idx_y++) { int xx=src_x0+(x_src_step*idx_x); int yy=src_y0+(y_src_step*idx_y); @@ -213,7 +209,7 @@ void rltennis_state::blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask) if((pix || force_blit)&& screen_x >0 && y >0 && screen_x < 512 && y < 256 ) { - m_tmp_bitmap[layer]->pix16(y , screen_x ) = pix; + m_tmp_bitmap[layer]->pix(y , screen_x ) = pix; } } } diff --git a/src/mame/video/rm380z.cpp b/src/mame/video/rm380z.cpp index 0c03a6805a0..f7ead5a4c27 100644 --- a/src/mame/video/rm380z.cpp +++ b/src/mame/video/rm380z.cpp @@ -271,16 +271,14 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit } } - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); - *dest=chval; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c) = chval; } } // last pixel of underline if (attrUnder&&(!attrRev)) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); - *dest=attrRev?0:1; + bitmap.pix((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX) = attrRev?0:1; } // if reversed, print another column of pixels on the right @@ -288,8 +286,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int r=0;r<RM380Z_CHDIMY;r++) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); - *dest=1; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX) = 1; } } } @@ -319,20 +316,16 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit } } - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); - *dest=chval; - *dest2=chval; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c) = chval; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1) = chval; } } // last 2 pixels of underline if (attrUnder) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1); - *dest=attrRev?0:1; - *dest2=attrRev?0:1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)) = attrRev?0:1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1) = attrRev?0:1; } // if reversed, print another 2 columns of pixels on the right @@ -340,10 +333,8 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int r=0;r<RM380Z_CHDIMY;r++) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1); - *dest=1; - *dest2=1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)) = 1; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1) = 1; } } } @@ -357,8 +348,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int c=0;c<RM380Z_CHDIMX;c++) { - uint16_t *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); - *dest=m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c) = m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; } } } @@ -368,10 +358,8 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit { for (int c=0;c<(RM380Z_CHDIMX*2);c+=2) { - uint16_t *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); - uint16_t *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); - *dest=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; - *dest2=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c) = m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; + bitmap.pix( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1) = m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; } } } @@ -409,22 +397,21 @@ void rm380z_state::update_screen(bitmap_ind16 &bitmap) // This needs the attributes etc from above to be added uint32_t rm380z_state::screen_update_rm480z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t *chargen = memregion("chargen")->base(); - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint8_t const *const chargen = memregion("chargen")->base(); + uint16_t sy=0,ma=0; - for (y = 0; y < RM380Z_SCREENROWS; y++) + for (uint8_t y = 0; y < RM380Z_SCREENROWS; y++) { - for (ra = 0; ra < 11; ra++) + for (uint8_t ra = 0; ra < 11; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - gfx = 0; + uint8_t gfx = 0; if (ra < 10) { - chr = m_vramchars[x]; + uint8_t chr = m_vramchars[x]; gfx = chargen[(chr<<4) | ra ]; } /* Display a scanline of a character */ diff --git a/src/mame/video/rmnimbus.cpp b/src/mame/video/rmnimbus.cpp index b4faeedf0a1..c7b4d385d02 100644 --- a/src/mame/video/rmnimbus.cpp +++ b/src/mame/video/rmnimbus.cpp @@ -105,9 +105,9 @@ uint8_t rmnimbus_state::get_pixel(uint16_t x, uint16_t y) if((x<640) && (y<250)) { if(IS_80COL) - result=m_video_mem.pix16(y, x) >> 2; + result=m_video_mem.pix(y, x) >> 2; else - result=m_video_mem.pix16(y, x*2); + result=m_video_mem.pix(y, x*2); } return result; @@ -295,9 +295,9 @@ void rmnimbus_state::set_pixel(uint16_t x, uint16_t y, uint8_t colour) if((x<640) && (y<250)) { if(IS_XOR) - m_video_mem.pix16(y, x)^=colour; + m_video_mem.pix(y, x)^=colour; else - m_video_mem.pix16(y, x)=colour; + m_video_mem.pix(y, x)=colour; } } @@ -344,7 +344,7 @@ void rmnimbus_state::move_pixel_line(uint16_t x, uint16_t y, uint8_t pixels) { if(DEBUG_SET(DEBUG_TEXT | DEBUG_PIXEL)) logerror("x=%d\n",x + i); - m_video_mem.pix16(m_yline, x + i) = m_video_mem.pix16(y, x + i); + m_video_mem.pix(m_yline, x + i) = m_video_mem.pix(y, x + i); } } diff --git a/src/mame/video/rockrage.cpp b/src/mame/video/rockrage.cpp index baf4d3f7551..02fe31a1a7b 100644 --- a/src/mame/video/rockrage.cpp +++ b/src/mame/video/rockrage.cpp @@ -70,7 +70,7 @@ uint32_t rockrage_state::screen_update_rockrage(screen_device &screen, bitmap_in { m_k007342->tilemap_update(); - bitmap.fill(rgb_t::black(), cliprect); + bitmap.fill(0, cliprect); m_k007342->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); // Tutankhamen eyes go below sprites m_k007342->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); diff --git a/src/mame/video/rohga.cpp b/src/mame/video/rohga.cpp index 51921233c0e..9c6c6c2b343 100644 --- a/src/mame/video/rohga.cpp +++ b/src/mame/video/rohga.cpp @@ -89,8 +89,8 @@ void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &clipre for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16* srcline = &sprite_bitmap->pix16(y,0); - u32* dstline = &bitmap.pix32(y,0); + u16 const *const srcline = &sprite_bitmap->pix(y,0); + u32 *const dstline = &bitmap.pix(y,0); for (int x = cliprect.left(); x <= cliprect.right(); x++) { @@ -168,11 +168,11 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap, for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - const u16 *srcline1 = &sprite_bitmap1->pix16(y,0); - const u16 *srcline2 = &sprite_bitmap2->pix16(y,0); - const u8 *srcpriline = &priority_bitmap->pix8(y,0); + u16 const *const srcline1 = &sprite_bitmap1->pix(y,0); + u16 const *const srcline2 = &sprite_bitmap2->pix(y,0); + u8 const *const srcpriline = &priority_bitmap->pix(y,0); - u32* dstline = &bitmap.pix32(y,0); + u32 *const dstline = &bitmap.pix(y,0); for (int x = cliprect.left(); x <= cliprect.right(); x++) { diff --git a/src/mame/video/route16.cpp b/src/mame/video/route16.cpp index 9d2dc225ac8..97b71c584cd 100644 --- a/src/mame/video/route16.cpp +++ b/src/mame/video/route16.cpp @@ -87,13 +87,13 @@ uint32_t route16_state::screen_update_route16(screen_device &screen, bitmap_rgb3 uint8_t final_color = (color1 | color2) & 0x07; if (m_flipscreen) - bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color); + bitmap.pix(255 - y, 255 - x) = m_palette->pen_color(final_color); else - bitmap.pix32(y, x) = m_palette->pen_color(final_color); + bitmap.pix(y, x) = m_palette->pen_color(final_color); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } @@ -134,13 +134,13 @@ uint32_t route16_state::screen_update_jongpute(screen_device &screen, bitmap_rgb uint8_t final_color = (color1 | color2) & 0x07; if (m_flipscreen) - bitmap.pix32(255 - y, 255 - x) = m_palette->pen_color(final_color); + bitmap.pix(255 - y, 255 - x) = m_palette->pen_color(final_color); else - bitmap.pix32(y, x) = m_palette->pen_color(final_color); + bitmap.pix(y, x) = m_palette->pen_color(final_color); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } diff --git a/src/mame/video/rpunch.cpp b/src/mame/video/rpunch.cpp index 90870ee22e1..02e7dcfbd28 100644 --- a/src/mame/video/rpunch.cpp +++ b/src/mame/video/rpunch.cpp @@ -102,7 +102,7 @@ u8 rpunch_state::pixmap_r(offs_t offset) const int sy = offset >> 8; const int sx = (offset & 0xff) << 1; - return ((m_pixmap->pix16(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix16(sy & 0xff, sx | 1) & 0xf); + return ((m_pixmap->pix(sy & 0xff, sx & ~1) & 0xf) << 4) | (m_pixmap->pix(sy & 0xff, sx | 1) & 0xf); } void rpunch_state::pixmap_w(offs_t offset, u8 data) @@ -110,8 +110,8 @@ void rpunch_state::pixmap_w(offs_t offset, u8 data) const int sy = offset >> 8; const int sx = (offset & 0xff) << 1; - m_pixmap->pix16(sy & 0xff, sx & ~1) = ((data & 0xf0) >> 4); - m_pixmap->pix16(sy & 0xff, sx | 1) = (data & 0x0f); + m_pixmap->pix(sy & 0xff, sx & ~1) = ((data & 0xf0) >> 4); + m_pixmap->pix(sy & 0xff, sx | 1) = (data & 0x0f); } void rpunch_state::videoram_w(offs_t offset, u16 data, u16 mem_mask) @@ -252,8 +252,8 @@ void rpunch_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *src = &m_pixmap->pix16(y & 0xff); - u16 *dst = &bitmap.pix16(y); + u16 const *const src = &m_pixmap->pix(y & 0xff); + u16 *const dst = &bitmap.pix(y); for(int x = cliprect.min_x / 4; x <= cliprect.max_x; x++) { const u16 pix = src[(x + 4) & 0x1ff]; diff --git a/src/mame/video/segag80r.cpp b/src/mame/video/segag80r.cpp index b3bc8eae218..2fbed33e1ca 100644 --- a/src/mame/video/segag80r.cpp +++ b/src/mame/video/segag80r.cpp @@ -670,7 +670,6 @@ void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectang int xoffset = (m_spaceod_bg_control & 0x02) ? 0x10 : 0x00; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* The H and V counters on this board are independent of the ones on */ /* the main board. The H counter starts counting from 0 when EXT BLK */ @@ -679,14 +678,14 @@ void segag80r_state::draw_background_spaceod(bitmap_ind16 &bitmap, const rectang /* 240, giving us an offset of (262-240) = 22 scanlines. */ /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = (y + m_spaceod_vcounter + 22) ^ flipmask; - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = ((x + m_spaceod_hcounter) ^ flipmask) + xoffset; uint8_t fgpix = m_paletteram[dst[x]]; @@ -726,7 +725,6 @@ void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rec int flipmask = (m_video_control & 0x08) ? 0xff : 0x00; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* if disabled, draw nothing */ if (!m_bg_enable) @@ -736,14 +734,14 @@ void segag80r_state::draw_background_page_scroll(bitmap_ind16 &bitmap, const rec } /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = m_bg_scrolly + (((y ^ flipmask) + (flipmask & 0xe0)) & 0xff); - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = m_bg_scrollx + (x ^ flipmask); dst[x] = src[effx & xmask]; @@ -766,7 +764,6 @@ void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rec int flipmask = (m_video_control & 0x08) ? 0x3ff : 0x000; int xmask = pixmap.width() - 1; int ymask = pixmap.height() - 1; - int x, y; /* if disabled, draw nothing */ if (!m_bg_enable) @@ -776,14 +773,14 @@ void segag80r_state::draw_background_full_scroll(bitmap_ind16 &bitmap, const rec } /* now fill in the background wherever there are black pixels */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int effy = (y + m_bg_scrolly) ^ flipmask; - uint16_t *src = &pixmap.pix16(effy & ymask); - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *const src = &pixmap.pix(effy & ymask); + uint16_t *const dst = &bitmap.pix(y); /* loop over horizontal pixels */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { int effx = (x + m_bg_scrollx) ^ flipmask; dst[x] = src[effx & xmask]; diff --git a/src/mame/video/segaic16.cpp b/src/mame/video/segaic16.cpp index 8577151a4b5..2c060d0c947 100644 --- a/src/mame/video/segaic16.cpp +++ b/src/mame/video/segaic16.cpp @@ -1539,23 +1539,22 @@ void segaic16_video_device::rotate_draw(int which, bitmap_ind16 &bitmap, const r int32_t dxx = (info->buffer[0x3f6] << 16) | info->buffer[0x3f7]; int32_t dxy = (info->buffer[0x3f8] << 16) | info->buffer[0x3f9]; int32_t dyx = (info->buffer[0x3fa] << 16) | info->buffer[0x3fb]; - int x, y; /* advance forward based on the clip rect */ currx += dxx * (cliprect.min_x + 27) + dxy * cliprect.min_y; curry += dyx * (cliprect.min_x + 27) + dyy * cliprect.min_y; /* loop over screen Y coordinates */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &srcbitmap.pix16(0); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t *dest = &bitmap.pix(y); + uint16_t const *const src = &srcbitmap.pix(0); + uint8_t *pri = &priority_bitmap.pix(y); int32_t tx = currx; int32_t ty = curry; /* loop over screen X coordinates */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* fetch the pixel from the source bitmap */ int sx = (tx >> 14) & 0x1ff; diff --git a/src/mame/video/segaic16_road.cpp b/src/mame/video/segaic16_road.cpp index 290d1b15c5f..35d31cb4057 100644 --- a/src/mame/video/segaic16_road.cpp +++ b/src/mame/video/segaic16_road.cpp @@ -91,7 +91,7 @@ static void segaic16_road_hangon_draw(segaic16_road_device::road_info *info, bit /* loop over scanlines */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); const u16 control = roadram[0x000 + y]; int hpos = roadram[0x100 + (control & 0xff)]; const u16 color0 = roadram[0x200 + (control & 0xff)]; @@ -364,7 +364,7 @@ static void segaic16_road_outrun_draw(segaic16_road_device::road_info *info, bit // { 0x80,0x81,0x81,0x83,0,0,0,0x00 }, // { 0x81,0x87,0x87,0x8f,0,0,0,0x00 } }; - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); const u16 data0 = roadram[0x000 + y]; const u16 data1 = roadram[0x100 + y]; diff --git a/src/mame/video/segaic24.cpp b/src/mame/video/segaic24.cpp index 805f6bb4cb1..3b07c9e8fa3 100644 --- a/src/mame/video/segaic24.cpp +++ b/src/mame/video/segaic24.cpp @@ -103,16 +103,13 @@ void segas24_tile_device::device_start() void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind8 &tm, bitmap_ind16 &dm, const uint16_t *mask, uint16_t tpri, uint8_t lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) { - int y; - const uint16_t *source = &bm.pix16(sy, sx); - const uint8_t *trans = &tm.pix8(sy, sx); - uint8_t *prib = &screen.priority().pix8(0); - uint16_t *dest = &dm.pix16(0); + const uint16_t *source = &bm.pix(sy, sx); + const uint8_t *trans = &tm.pix(sy, sx); + uint8_t *prib = &screen.priority().pix(yy1, xx1); + uint16_t *dest = &dm.pix(yy1, xx1); tpri |= TILEMAP_PIXEL_LAYER0; - dest += yy1*dm.rowpixels() + xx1; - prib += yy1*screen.priority().rowpixels() + xx1; mask += yy1*4; yy2 -= yy1; @@ -122,7 +119,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit mask++; } - for(y=0; y<yy2; y++) { + for(int y=0; y<yy2; y++) { const uint16_t *src = source; const uint8_t *srct = trans; uint16_t *dst = dest; @@ -142,8 +139,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x=0; x<128; x++) { + for(int x=0; x<128; x++) { if(*srct++ == tpri) { *dst = *src; *pr |= lpri; @@ -162,8 +158,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=0; x<128; x+=8) { + for(int x=0; x<128; x+=8) { if(!(m & 0x8000)) { int xx; for(xx=0; xx<8; xx++) @@ -185,8 +180,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x = cur_x; x<llx1; x++) { + for(int x = cur_x; x<llx1; x++) { if(*srct++ == tpri) { *dst = *src; *pr |= lpri; @@ -205,8 +199,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=cur_x; x<llx1; x++) { + for(int x=cur_x; x<llx1; x++) { if(*srct++ == tpri && !(m & (0x8000 >> (x >> 3)))) { *dst = *src; *pr |= lpri; @@ -237,15 +230,13 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bitmap_ind8 &tm, bitmap_rgb32 &dm, const uint16_t *mask, uint16_t tpri, uint8_t lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2) { - int y; - const uint16_t *source = &bm.pix16(sy, sx); - const uint8_t *trans = &tm.pix8(sy, sx); - uint32_t *dest = &dm.pix32(0); - const pen_t *pens = palette().pens(); + const uint16_t *source = &bm.pix(sy, sx); + const uint8_t *trans = &tm.pix(sy, sx); + uint32_t *dest = &dm.pix(yy1, xx1); + const pen_t *const pens = palette().pens(); tpri |= TILEMAP_PIXEL_LAYER0; - dest += yy1*dm.rowpixels() + xx1; mask += yy1*4; yy2 -= yy1; @@ -255,7 +246,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit mask++; } - for(y=0; y<yy2; y++) { + for(int y=0; y<yy2; y++) { const uint16_t *src = source; const uint8_t *srct = trans; uint32_t *dst = dest; @@ -274,8 +265,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x=0; x<128; x++) { + for(int x=0; x<128; x++) { if(*srct++ == tpri) *dst = pens[*src]; src++; @@ -290,11 +280,9 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit } else { // 3- 128 pixels from both layers - int x; - for(x=0; x<128; x+=8) { + for(int x=0; x<128; x+=8) { if(!(m & 0x8000)) { - int xx; - for(xx=0; xx<8; xx++) + for(int xx=0; xx<8; xx++) if(srct[xx] == tpri) dst[xx] = pens[src[xx]]; } @@ -310,8 +298,7 @@ void segas24_tile_device::draw_rect(screen_device &screen, bitmap_ind16 &bm, bit if(!m) { // 1- 128 pixels from this layer - int x; - for(x = cur_x; x<llx1; x++) { + for(int x = cur_x; x<llx1; x++) { if(*srct++ == tpri) *dst = pens[*src]; src++; @@ -603,16 +590,14 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect { uint16_t curspr = 0; int countspr = 0; - int seen; uint8_t pmt[4]; - int i; uint16_t *sprd[0x2000], *clip[0x2000]; uint16_t *cclip = nullptr; - for(i=0; i<4; i++) + for(int i=0; i<4; i++) pmt[i] = 0xff << (1+spri[3-i]); - for(seen = 0; seen < 0x2000; seen++) { + for(int seen = 0; seen < 0x2000; seen++) { uint16_t *source; uint16_t type; @@ -647,7 +632,6 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect for(countspr--; countspr >= 0; countspr--) { uint16_t *source, *pix; int x, y, sx, sy; - int px, py; uint16_t colors[16]; int flipx, flipy; int zoomx, zoomy; @@ -719,7 +703,7 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect sy = 1 << ((source[4] & 0x7000) >> 12); pix = &sprite_ram[(source[3] & 0x3fff)* 0x8]; - for(px=0; px<8; px++) { + for(int px=0; px<8; px++) { int c; c = pix[px] >> 8; pm[px*2] = pmt[c>>6]; @@ -738,38 +722,36 @@ void segas24_sprite_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect xmod = 0x20; ymod = 0x20; - for(py=0; py<sy; py++) { + for(int py=0; py<sy; py++) { int xmod1 = xmod; int xpos1 = x; int ypos1 = y, ymod1 = ymod; - for(px=0; px<sx; px++) { + for(int px=0; px<sx; px++) { int xmod2 = xmod1, xpos2 = xpos1; - int zy; addoffset = 0x10*(flipx ? sx-px-1 : px) + 0x10*sx*(flipy ? sy-py-1 : py) + (flipy ? 7*2 : 0); newoffset = offset + addoffset; ymod1 = ymod; ypos1 = y; - for(zy=0; zy<8; zy++) { + for(int zy=0; zy<8; zy++) { ymod1 += zoomy; while(ymod1 >= 0x40) { if((ypos1 >= min_y && ypos1 <= max_y) ^ clip_reverse_y) { - int zx; xmod2 = xmod1; xpos2 = xpos1; - for(zx=0; zx<8; zx++) { + for(int zx=0; zx<8; zx++) { xmod2 += zoomx; while(xmod2 >= 0x40) { if(xpos2 >= min_x && xpos2 <= max_x) { int zx1 = flipx ? 7-zx : zx; uint32_t neweroffset = (newoffset+(zx1>>2))&0x1ffff; // crackdown sometimes attempts to use data past the end of spriteram int c = (sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf; - uint8_t *pri = &priority_bitmap.pix8(ypos1, xpos2); + uint8_t *pri = &priority_bitmap.pix(ypos1, xpos2); if(!(*pri & pm[c])) { c = colors[c]; if(c) { - uint16_t *dst = &bitmap.pix16(ypos1, xpos2); + uint16_t *dst = &bitmap.pix(ypos1, xpos2); if(c==1) *dst = (*dst) | 0x2000; else diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp index 58ae7d70632..177a383f851 100644 --- a/src/mame/video/segas32.cpp +++ b/src/mame/video/segas32.cpp @@ -668,21 +668,14 @@ inline void segas32_state::get_tilemaps(int bgnum, tilemap_t **tilemaps) void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect, int bgnum) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - tilemap_t *tilemaps[4]; - uint32_t srcx, srcx_start, srcy; - uint32_t srcxstep, srcystep; - int dstxstep, dstystep; - int opaque; - int x, y; /* get the tilemaps */ + tilemap_t *tilemaps[4]; get_tilemaps(bgnum, tilemaps); /* configure the layer */ - opaque = 0; + int opaque = 0; //opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_Z) && bgnum == 0) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_X) && bgnum == 1) opaque = 1; @@ -692,13 +685,15 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la compute_tilemap_flips(bgnum, flipx, flipy); /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + int clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* extract the X/Y step values (these are in destination space!) */ - dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + int dstxstep = m_videoram[0x1ff50/2 + 2 * bgnum] & 0xfff; + int dstystep; if (m_videoram[0x1ff00/2] & 0x4000) dstystep = m_videoram[0x1ff52/2 + 2 * bgnum] & 0xfff; else @@ -711,13 +706,13 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la dstystep = 0x80; /* compute high-precision reciprocals (in 12.20 format) */ - srcxstep = (0x200 << 20) / dstxstep; - srcystep = (0x200 << 20) / dstystep; + uint32_t srcxstep = (0x200 << 20) / dstxstep; + uint32_t srcystep = (0x200 << 20) / dstystep; /* start with the fractional scroll offsets, in source coordinates */ - srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; + uint32_t srcx_start = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) << 20; srcx_start += (m_videoram[0x1ff10/2 + 4 * bgnum] & 0xff00) << 4; - srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; + uint32_t srcy = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff) << 20; srcy += (m_videoram[0x1ff14/2 + 4 * bgnum] & 0xfe00) << 4; /* then account for the destination center coordinates */ @@ -746,32 +741,30 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la } /* loop over the target rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ if (clipdraw || extents[1] <= cliprect.max_x) { int transparent = 0; - uint16_t *src[2]; /* look up the pages and get their source pixmaps */ - bitmap_ind16 &tm0 = tilemaps[((srcy >> 27) & 2) + 0]->pixmap(); - bitmap_ind16 &tm1 = tilemaps[((srcy >> 27) & 2) + 1]->pixmap(); - src[0] = &tm0.pix16((srcy >> 20) & 0xff); - src[1] = &tm1.pix16((srcy >> 20) & 0xff); + bitmap_ind16 const &tm0 = tilemaps[((srcy >> 27) & 2) + 0]->pixmap(); + bitmap_ind16 const &tm1 = tilemaps[((srcy >> 27) & 2) + 1]->pixmap(); + uint16_t const *const src[2] = { &tm0.pix((srcy >> 20) & 0xff), &tm1.pix((srcy >> 20) & 0xff) }; /* loop over extents */ - srcx = srcx_start; + uint32_t srcx = srcx_start; while (1) { /* if we're drawing on this extent, draw it */ if (clipdraw) { - for (x = extents[0]; x < extents[1]; x++) + for (int x = extents[0]; x < extents[1]; x++) { uint16_t pix = src[(srcx >> 29) & 1][(srcx >> 20) & 0x1ff]; srcx += srcxstep; @@ -785,7 +778,7 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); srcx += srcxstep * pixels; transparent += pixels; } @@ -827,22 +820,14 @@ void segas32_state::update_tilemap_zoom(screen_device &screen, segas32_state::la void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect, int bgnum) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - tilemap_t *tilemaps[4]; - int rowscroll, rowselect; - int xscroll, yscroll; - uint16_t *table; - int srcx, srcy; - int opaque; - int x, y; /* get the tilemaps */ + tilemap_t *tilemaps[4]; get_tilemaps(bgnum, tilemaps); /* configure the layer */ - opaque = 0; + int opaque = 0; //opaque = (m_videoram[0x1ff8e/2] >> (8 + bgnum)) & 1; //if (screen.machine().input().code_pressed(KEYCODE_C) && bgnum == 2) opaque = 1; //if (screen.machine().input().code_pressed(KEYCODE_V) && bgnum == 3) opaque = 1; @@ -854,39 +839,40 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; - clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; - clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> (11 + bgnum)) & 1; + int clipout = (m_videoram[0x1ff02/2] >> (6 + bgnum)) & 1; + int clips = (m_videoram[0x1ff06/2] >> (4 * bgnum)) & 0x0f; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine if row scroll and/or row select is enabled */ - rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; - rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; + int rowscroll = (m_videoram[0x1ff04/2] >> (bgnum - 2)) & 1; + int rowselect = (m_videoram[0x1ff04/2] >> bgnum) & 1; if ((m_videoram[0x1ff04/2] >> (bgnum + 2)) & 1) rowscroll = rowselect = 0; /* get a pointer to the table */ - table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; + uint16_t const *const table = &m_videoram[(m_videoram[0x1ff04/2] >> 10) * 0x400]; /* start with screen-wide X and Y scrolls */ - xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); - yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); + int xscroll = (m_videoram[0x1ff12/2 + 4 * bgnum] & 0x3ff) - (m_videoram[0x1ff30/2 + 2 * bgnum] & 0x1ff); + int yscroll = (m_videoram[0x1ff16/2 + 4 * bgnum] & 0x1ff); /* render the tilemap into its bitmap */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ if (clipdraw || extents[1] <= cliprect.max_x) { int transparent = 0; - uint16_t *src[2]; int srcxstep; /* if we're not flipped, things are straightforward */ + int srcx; if (!flipx) { srcx = cliprect.min_x + xscroll; @@ -898,6 +884,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat srcxstep = -1; } + int srcy; if (!flipy) { srcy = yscroll + y; @@ -916,10 +903,9 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* look up the pages and get their source pixmaps */ - bitmap_ind16 &tm0 = tilemaps[((srcy >> 7) & 2) + 0]->pixmap(); - bitmap_ind16 &tm1 = tilemaps[((srcy >> 7) & 2) + 1]->pixmap(); - src[0] = &tm0.pix16(srcy & 0xff); - src[1] = &tm1.pix16(srcy & 0xff); + bitmap_ind16 const &tm0 = tilemaps[((srcy >> 7) & 2) + 0]->pixmap(); + bitmap_ind16 const &tm1 = tilemaps[((srcy >> 7) & 2) + 1]->pixmap(); + uint16_t const *const src[2] = { &tm0.pix(srcy & 0xff), &tm1.pix(srcy & 0xff) }; /* loop over extents */ while (1) @@ -927,7 +913,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat /* if we're drawing on this extent, draw it */ if (clipdraw) { - for (x = extents[0]; x < extents[1]; x++, srcx += srcxstep) + for (int x = extents[0]; x < extents[1]; x++, srcx += srcxstep) { uint16_t pix = src[(srcx >> 9) & 1][srcx & 0x1ff]; if ((pix & 0x0f) == 0 && !opaque) @@ -940,7 +926,7 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); srcx += srcxstep * pixels; transparent += pixels; } @@ -979,41 +965,35 @@ void segas32_state::update_tilemap_rowscroll(screen_device &screen, segas32_stat void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect) { bitmap_ind16 &bitmap = layer.bitmap; - uint16_t *tilebase; - uint16_t *gfxbase; - int startx, starty; - int endx, endy; - int x, y, iy; - int flip; /* determine if we're flipped */ - flip = (m_videoram[0x1ff00/2] >> 9) & 1; + int flip = (m_videoram[0x1ff00/2] >> 9) & 1; /* determine the base of the tilemap and graphics data */ - tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; - gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; + uint16_t const *const tilebase = &m_videoram[((m_videoram[0x1ff5c/2] >> 4) & 0x1f) * 0x800]; + uint16_t const *const gfxbase = &m_videoram[(m_videoram[0x1ff5c/2] & 7) * 0x2000]; /* compute start/end tile numbers */ - startx = cliprect.min_x / 8; - starty = cliprect.min_y / 8; - endx = cliprect.max_x / 8; - endy = cliprect.max_y / 8; + int startx = cliprect.min_x / 8; + int starty = cliprect.min_y / 8; + int endx = cliprect.max_x / 8; + int endy = cliprect.max_y / 8; /* loop over tiles */ - for (y = starty; y <= endy; y++) - for (x = startx; x <= endx; x++) + for (int y = starty; y <= endy; y++) + for (int x = startx; x <= endx; x++) { int tile = tilebase[y * 64 + x]; - uint16_t *src = &gfxbase[(tile & 0x1ff) * 16]; + uint16_t const *src = &gfxbase[(tile & 0x1ff) * 16]; int color = (tile & 0xfe00) >> 5; /* non-flipped case */ if (!flip) { - uint16_t *dst = &bitmap.pix16(y * 8, x * 8); + uint16_t *dst = &bitmap.pix(y * 8, x * 8); /* loop over rows */ - for (iy = 0; iy < 8; iy++) + for (int iy = 0; iy < 8; iy++) { int pixels = *src++; int pix; @@ -1071,10 +1051,10 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la int effdstx = visarea.max_x - x * 8; int effdsty = visarea.max_y - y * 8; - uint16_t *dst = &bitmap.pix16(effdsty, effdstx); + uint16_t *dst = &bitmap.pix(effdsty, effdstx); /* loop over rows */ - for (iy = 0; iy < 8; iy++) + for (int iy = 0; iy < 8; iy++) { int pixels = *src++; int pix; @@ -1137,33 +1117,28 @@ void segas32_state::update_tilemap_text(screen_device &screen, segas32_state::la void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_info &layer, const rectangle &cliprect) { - int clipenable, clipout, clips, clipdraw_start; bitmap_ind16 &bitmap = layer.bitmap; - extents_list clip_extents; - int xscroll, yscroll; - int color; - int x, y; - int bpp; /* configure the layer */ - bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; + int bpp = (m_videoram[0x1ff00/2] & 0x0800) ? 8 : 4; /* determine the clipping */ - clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; - clipout = (m_videoram[0x1ff02/2] >> 10) & 1; - clips = 0x10; - clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); + int clipenable = (m_videoram[0x1ff02/2] >> 15) & 1; + int clipout = (m_videoram[0x1ff02/2] >> 10) & 1; + int clips = 0x10; + extents_list clip_extents; + int clipdraw_start = compute_clipping_extents(screen, clipenable, clipout, clips, cliprect, &clip_extents); /* determine x/y scroll */ - xscroll = m_videoram[0x1ff88/2] & 0x1ff; - yscroll = m_videoram[0x1ff8a/2] & 0x1ff; - color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); + int xscroll = m_videoram[0x1ff88/2] & 0x1ff; + int yscroll = m_videoram[0x1ff8a/2] & 0x1ff; + int color = (m_videoram[0x1ff8c/2] << 4) & 0x1fff0 & ~((1 << bpp) - 1); /* loop over target rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; - uint16_t *dst = &bitmap.pix16(y); + uint16_t const *extents = &clip_extents.extent[clip_extents.scan_extent[y]][0]; + uint16_t *const dst = &bitmap.pix(y); int clipdraw = clipdraw_start; /* optimize for the case where we are clipped out */ @@ -1180,8 +1155,8 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in /* 8bpp mode case */ if (bpp == 8) { - uint8_t *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; - for (x = extents[0]; x < extents[1]; x++) + uint8_t const *src = (uint8_t *)&m_videoram[512/2 * ((y + yscroll) & 0xff)]; + for (int x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; int pix = src[BYTE_XOR_LE(effx)] + color; @@ -1194,8 +1169,8 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in /* 4bpp mode case */ else { - uint16_t *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; - for (x = extents[0]; x < extents[1]; x++) + uint16_t const *src = &m_videoram[512/4 * ((y + yscroll) & 0x1ff)]; + for (int x = extents[0]; x < extents[1]; x++) { int effx = (x + xscroll) & 0x1ff; int pix = ((src[effx / 4] >> (4 * (effx & 3))) & 0x0f) + color; @@ -1210,7 +1185,7 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in else { int pixels = extents[1] - extents[0]; - memset(&dst[extents[0]], 0, pixels * sizeof(dst[0])); + std::fill_n(&dst[extents[0]], pixels, 0); transparent += pixels; } @@ -1241,11 +1216,10 @@ void segas32_state::update_bitmap(screen_device &screen, segas32_state::layer_in void segas32_state::update_background(segas32_state::layer_info &layer, const rectangle &cliprect) { bitmap_ind16 &bitmap = layer.bitmap; - int x, y; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); + uint16_t *const dst = &bitmap.pix(y); int color; /* determine the color */ @@ -1260,7 +1234,7 @@ void segas32_state::update_background(segas32_state::layer_info &layer, const re /* if the color doesn't match, fill */ if (dst[cliprect.min_x] != color) - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) dst[x] = color; } } @@ -1429,7 +1403,7 @@ void segas32_state::sprite_swap_buffers() } \ } -int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) +int segas32_state::draw_one_sprite(uint16_t const *data, int xoffs, int yoffs, const rectangle &clipin, const rectangle &clipout) { static const int transparency_masks[4][4] = { @@ -1467,9 +1441,9 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r int color = 0x8000 | (data[7] & (bpp8 ? 0x7f00 : 0x7ff0)); int hzoom, vzoom; int xdelta = 1, ydelta = 1; - int x, y, xtarget, ytarget, yacc = 0, pix, transmask; + int xtarget, ytarget, yacc = 0, pix, transmask; const uint32_t *spritedata; - uint32_t addrmask, curaddr; + uint32_t addrmask; uint16_t indtable[16]; /* if hidden, or top greater than/equal to bottom, or invalid bank, punt */ @@ -1484,8 +1458,8 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r /* create the local palette for the indirect case */ if (indirect) { - uint16_t *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; - for (x = 0; x < 16; x++) + uint16_t const *src = indlocal ? &data[8] : &m_spriteram[8 * (data[7] & 0x1fff)]; + for (int x = 0; x < 16; x++) indtable[x] = (src[x] & (bpp8 ? 0xfff0 : 0xffff)) | ((m_sprite_control_latched[0x0a/2] & 1) ? 0x8000 : 0x0000); } @@ -1560,21 +1534,21 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r } /* loop from top to bottom */ - for (y = ypos; y != ytarget; y += ydelta) + for (int y = ypos; y != ytarget; y += ydelta) { /* skip drawing if not within the inclusive cliprect */ if (y >= clipin.min_y && y <= clipin.max_y) { int do_clipout = (y >= clipout.min_y && y <= clipout.max_y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t *const dest = &bitmap.pix(y); int xacc = 0; /* 4bpp case */ if (!bpp8) { /* start at the word before because we preincrement below */ - curaddr = addr - 1; - for (x = xpos; x != xtarget; ) + uint32_t curaddr = addr - 1; + for (int x = xpos; x != xtarget; ) { uint32_t pixels = spritedata[++curaddr & addrmask]; @@ -1598,8 +1572,8 @@ int segas32_state::draw_one_sprite(uint16_t *data, int xoffs, int yoffs, const r else { /* start at the word before because we preincrement below */ - curaddr = addr - 1; - for (x = xpos; x != xtarget; ) + uint32_t curaddr = addr - 1; + for (int x = xpos; x != xtarget; ) { uint32_t pixels = spritedata[++curaddr & addrmask]; @@ -1635,7 +1609,6 @@ void segas32_state::sprite_render_list() int xoffs = 0, yoffs = 0; int numentries = 0; int spritenum = 0; - uint16_t *sprite; g_profiler.start(PROFILER_USER2); @@ -1655,7 +1628,7 @@ void segas32_state::sprite_render_list() while (numentries++ < 0x20000/16) { /* top two bits are a command */ - sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; + uint16_t const *const sprite = &m_spriteram[8 * (spritenum & 0x1fff)]; switch (sprite[0] >> 14) { /* command 0 = draw sprite */ @@ -1764,7 +1737,7 @@ inline uint16_t *segas32_state::get_layer_scanline(int layer, int scanline) { if (m_layer_data[layer].transparent[scanline]) return (layer == MIXER_LAYER_SPRITES) ? m_solid_ffff.get() : m_solid_0000.get(); - return &m_layer_data[layer].bitmap.pix16(scanline); + return &m_layer_data[layer].bitmap.pix(scanline); } void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t enablemask) @@ -1781,14 +1754,6 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c uint8_t mixshift; /* shift from control reg */ uint8_t coloroffs; /* color offset index */ } layerorder[16][8], layersort[8]; - uint8_t sprgroup_shift, sprgroup_mask, sprgroup_or; - int numlayers, laynum, groupnum; - int rgboffs[3][3]; - int sprpixmask, sprshadowmask; - int sprx, spry, sprx_start; - int sprdx, sprdy; - int sprshadow; - int x, y, i; /* if we are the second monitor on multi32, swap in the proper sprite bank */ if (which == 1) @@ -1799,6 +1764,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* extract the RGB offsets */ + int rgboffs[3][3]; rgboffs[0][0] = (int8_t)(m_mixer_control[which][0x40/2] << 2) >> 2; rgboffs[0][1] = (int8_t)(m_mixer_control[which][0x42/2] << 2) >> 2; rgboffs[0][2] = (int8_t)(m_mixer_control[which][0x44/2] << 2) >> 2; @@ -1810,6 +1776,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c rgboffs[2][2] = 0; /* determine the sprite grouping parameters first */ + uint8_t sprgroup_shift, sprgroup_mask, sprgroup_or; switch (m_mixer_control[which][0x4c/2] & 0x0f) { default: @@ -1833,13 +1800,13 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c case 0xe: sprgroup_shift = 11; sprgroup_mask = 0x07; sprgroup_or = 0x00; break; case 0xf: sprgroup_shift = 10; sprgroup_mask = 0x0f; sprgroup_or = 0x00; break; } - sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; - sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; - sprshadow = 0x7ffe & sprpixmask; + int sprshadowmask = (m_mixer_control[which][0x4c/2] & 0x04) ? 0x8000 : 0x0000; + int sprpixmask = ((1 << sprgroup_shift) - 1) & 0x3fff; + int sprshadow = 0x7ffe & sprpixmask; /* extract info about TEXT, NBG0-3, and BITMAP layers, which all follow the same pattern */ - numlayers = 0; - for (laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) + int numlayers = 0; + for (int laynum = MIXER_LAYER_TEXT; laynum <= MIXER_LAYER_BITMAP; laynum++) { int priority = m_mixer_control[which][0x20/2 + laynum] & 0x0f; if ((enablemask & (1 << laynum)) && priority != 0) @@ -1866,8 +1833,8 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c numlayers++; /* now bubble sort the list by effective priority */ - for (laynum = 0; laynum < numlayers; laynum++) - for (i = laynum + 1; i < numlayers; i++) + for (int laynum = 0; laynum < numlayers; laynum++) + for (int i = laynum + 1; i < numlayers; i++) if (layersort[i].effpri > layersort[laynum].effpri) { mixer_layer_info temp = layersort[i]; @@ -1876,7 +1843,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* for each possible sprite group, insert the sprites into the list at the appropriate point */ - for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) + for (int groupnum = 0; groupnum <= sprgroup_mask; groupnum++) { int effgroup = sprgroup_or | groupnum; int priority = m_mixer_control[which][0x00/2 + effgroup] & 0x0f; @@ -1885,7 +1852,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c int dstnum = 0; /* make a copy of the sorted list, finding a location for the sprite entry */ - for (laynum = 0; laynum < numlayers; laynum++) + for (int laynum = 0; laynum < numlayers; laynum++) { if (effpri > layersort[laynum].effpri && sprindex == numlayers) sprindex = dstnum++; @@ -1904,10 +1871,10 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c layerorder[groupnum][sprindex].sprblendmask = 0; layerorder[groupnum][sprindex].coloroffs = compute_color_offsets(which, (m_mixer_control[which][0x3e/2] >> 6) & 1, (m_mixer_control[which][0x4c/2] >> 15) & 1); } -/*\ +/* { static const char *const layname[] = { "TEXT", "NBG0", "NBG1", "NBG2", "NBG3", "BITM", "SPRI", "LINE" }; - for (groupnum = 0; groupnum <= sprgroup_mask; groupnum++) + for (int groupnum = 0; groupnum <= sprgroup_mask; groupnum++) { osd_printf_debug("%X: ", groupnum); for (i = 0; i <= numlayers; i++) @@ -1918,6 +1885,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c /* based on the sprite controller flip bits, the data is scanned to us in different */ /* directions; account for this */ + int sprx_start, sprdx; if (m_sprite_control_latched[0x04/2] & 1) { sprx_start = cliprect.max_x; @@ -1929,6 +1897,7 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c sprdx = 1; } + int spry, sprdy; if (m_sprite_control_latched[0x04/2] & 2) { spry = cliprect.max_y; @@ -1941,9 +1910,9 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c } /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++, spry += sprdy) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++, spry += sprdy) { - uint32_t *dest = &bitmap.pix32(y, xoffs); + uint32_t *const dest = &bitmap.pix(y, xoffs); uint16_t *layerbase[8]; /* get the starting address for each layer */ @@ -1957,18 +1926,15 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c layerbase[MIXER_LAYER_BACKGROUND] = get_layer_scanline(MIXER_LAYER_BACKGROUND, y); /* loop over columns */ - for (x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) + for (int x = cliprect.min_x, sprx = sprx_start; x <= cliprect.max_x; x++, sprx += sprdx) { - mixer_layer_info *first; - int *rgbdelta; - int firstpix; - int sprpix, sprgroup; - int r, g, b; + mixer_layer_info const *first; + int laynum, firstpix; int shadow = 0; /* first grab the current sprite pixel and determine the group */ - sprpix = layerbase[MIXER_LAYER_SPRITES][sprx]; - sprgroup = (sprpix >> sprgroup_shift) & sprgroup_mask; + int sprpix = layerbase[MIXER_LAYER_SPRITES][sprx]; + int sprgroup = (sprpix >> sprgroup_shift) & sprgroup_mask; /* now scan the layers to find the topmost non-transparent pixel */ for (first = &layerorder[sprgroup][0]; ; first++) @@ -2002,15 +1968,15 @@ void segas32_state::mix_all_layers(int which, int xoffs, bitmap_rgb32 &bitmap, c firstpix = m_paletteram[which][(first->palbase + ((firstpix >> first->mixshift) & 0xfff0) + (firstpix & 0x0f)) & 0x3fff]; /* compute R, G, B */ - rgbdelta = &rgboffs[first->coloroffs][0]; - r = ((firstpix >> 0) & 0x1f) + rgbdelta[0]; - g = ((firstpix >> 5) & 0x1f) + rgbdelta[1]; - b = ((firstpix >> 10) & 0x1f) + rgbdelta[2]; + int const *rgbdelta = &rgboffs[first->coloroffs][0]; + int r = ((firstpix >> 0) & 0x1f) + rgbdelta[0]; + int g = ((firstpix >> 5) & 0x1f) + rgbdelta[1]; + int b = ((firstpix >> 10) & 0x1f) + rgbdelta[2]; /* if there are potential blends, keep looking */ if (first->blendmask != 0) { - mixer_layer_info *second; + mixer_layer_info const *second; int secondpix; /* now scan the layers to find the topmost non-transparent pixel */ diff --git a/src/mame/video/seibuspi.cpp b/src/mame/video/seibuspi.cpp index 5a496feeb0f..1654ecf74c2 100644 --- a/src/mame/video/seibuspi.cpp +++ b/src/mame/video/seibuspi.cpp @@ -443,8 +443,8 @@ void seibuspi_state::drawgfx_blend(bitmap_rgb32 &bitmap, const rectangle &clipre // draw for (int y = y1; y <= y2; y++) { - u32 *dest = &bitmap.pix32(y); - u8 *pri = &primap.pix8(y); + u32 *const dest = &bitmap.pix(y); + u8 *const pri = &primap.pix(y); int src_i = (py * width) + px; py += yd; @@ -567,9 +567,9 @@ void seibuspi_state::combine_tilemap(bitmap_rgb32 &bitmap, const rectangle &clip if (rowscroll) rx += rowscroll[(y + 19) & yscroll_mask]; // adder value probably not hardcoded but came from CRTC - u32 *dest = &bitmap.pix32(y); - const u16 *src = &pen_bitmap.pix16((y + sy) & yscroll_mask); - const u8 *flags = &flags_bitmap.pix8((y + sy) & yscroll_mask); + u32 *dest = &bitmap.pix(y); + const u16 *src = &pen_bitmap.pix((y + sy) & yscroll_mask); + const u8 *flags = &flags_bitmap.pix((y + sy) & yscroll_mask); for (int x = cliprect.min_x + rx; x <= cliprect.max_x + rx; x++) { if (opaque || (flags[x & xscroll_mask] & (TILEMAP_PIXEL_LAYER0 | TILEMAP_PIXEL_LAYER1))) diff --git a/src/mame/video/senjyo.cpp b/src/mame/video/senjyo.cpp index c52e56294ea..78e587b8800 100644 --- a/src/mame/video/senjyo.cpp +++ b/src/mame/video/senjyo.cpp @@ -182,10 +182,10 @@ void senjyo_state::draw_bgbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect { if (flip) for (int y = 0;y < 256;y++) - bitmap.pix32(y, 255 - x) = m_palette->pen_color(384 + pen); + bitmap.pix(y, 255 - x) = m_palette->pen_color(384 + pen); else for (int y = 0;y < 256;y++) - bitmap.pix32(y, x) = m_palette->pen_color(384 + pen); + bitmap.pix(y, x) = m_palette->pen_color(384 + pen); count += 0x10; if (count >= strwid) @@ -215,7 +215,7 @@ void senjyo_state::draw_radar(bitmap_rgb32 &bitmap, const rectangle &cliprect) } if (cliprect.contains(sx, sy)) - bitmap.pix32(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); + bitmap.pix(sy, sx) = m_radar_palette->pen_color(offs < 0x200 ? 0 : 1); } } diff --git a/src/mame/video/seta.cpp b/src/mame/video/seta.cpp index 154252c713d..52f09b2cd98 100644 --- a/src/mame/video/seta.cpp +++ b/src/mame/video/seta.cpp @@ -655,24 +655,24 @@ void seta_state::draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectang const bitmap_ind16 &src_bitmap = tilemap->pixmap(); const int opaque_mask = gfx_tilemap->granularity() - 1; const int pixel_effect_mask = gfx_tilemap->colorbase() + (gfx_tilemap->colors() - 1) * gfx_tilemap->granularity(); - int p; const int width_mask = src_bitmap.width() - 1; const int height_mask = src_bitmap.height() - 1; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *dest = &bitmap.pix16(y); + u16 *const dest = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { + int p; if (!flipscreen) { - p = src_bitmap.pix16((y + scrolly) & height_mask, (x + scrollx) & width_mask); + p = src_bitmap.pix((y + scrolly) & height_mask, (x + scrollx) & width_mask); } else { - p = src_bitmap.pix16((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask); + p = src_bitmap.pix((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask); } // draw not transparent pixels diff --git a/src/mame/video/seta2.cpp b/src/mame/video/seta2.cpp index e165212cf96..cea97916aa6 100644 --- a/src/mame/video/seta2.cpp +++ b/src/mame/video/seta2.cpp @@ -318,7 +318,7 @@ inline void seta2_state::drawgfx_line(bitmap_ind16& bitmap, const rectangle& cli if (!use_shadow) shadow = 0; - uint16_t* dest = &bitmap.pix16(screenline); + uint16_t *const dest = &bitmap.pix(screenline); int minx = cliprect.min_x << 16; int maxx = (cliprect.max_x + 1) << 16; @@ -927,7 +927,7 @@ void staraudi_state::draw_rgbram(bitmap_ind16 &bitmap) { int offs = x * 2/2 + y * 0x400/2; uint32_t data = ((m_rgbram[offs + 0x40000/2] & 0xff) << 16) | m_rgbram[offs]; - bitmap.pix16(y, x) = (data & 0x7fff); + bitmap.pix(y, x) = (data & 0x7fff); } } } diff --git a/src/mame/video/shuuz.cpp b/src/mame/video/shuuz.cpp index dc62d134373..8c2013e8c4a 100644 --- a/src/mame/video/shuuz.cpp +++ b/src/mame/video/shuuz.cpp @@ -88,8 +88,8 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -107,10 +107,10 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, * +PFS7*(LBD7&LBD6)*!M3*!O13 * */ - int o13 = ((pf[x] & 0xf0) == 0xf0); - int mopf = 0; + int const o13 = ((pf[x] & 0xf0) == 0xf0); /* compute the MO/PF signal */ + int mopf = 0; if ((!(pf[x] & 0x80) && ((mo[x] & 0xc0) != 0xc0) && ((mo[x] & 0x0e) != 0x00) && !o13) || ((pf[x] & 0x80) && ((mo[x] & 0xc0) == 0xc0) && ((mo[x] & 0x0e) != 0x00) && !o13)) mopf = 1; diff --git a/src/mame/video/sidearms.cpp b/src/mame/video/sidearms.cpp index 20fef5fa3b4..01d4dddeea1 100644 --- a/src/mame/video/sidearms.cpp +++ b/src/mame/video/sidearms.cpp @@ -207,17 +207,16 @@ void sidearms_state::draw_sprites_region(bitmap_ind16 &bitmap, const rectangle & void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) { - int x, y, i; uint32_t hadd_283, vadd_283, _hflop_74a_n, _hcount_191, _vcount_191; uint8_t *sf_rom; uint16_t *lineptr; int pixadv, lineadv; // clear starfield background - lineptr = &bitmap.pix16(16, 64); + lineptr = &bitmap.pix(16, 64); lineadv = bitmap.rowpixels(); - for (i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } + for (int i=224; i; i--) { memset(lineptr, 0, 768); lineptr += lineadv; } // bail if not Side Arms or the starfield has been disabled if (m_gameid || !m_staron) return; @@ -240,16 +239,16 @@ void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) } else { - lineptr = &bitmap.pix16(255, 512 - 1); + lineptr = &bitmap.pix(255, 512 - 1); pixadv = -1; lineadv = -lineadv + 512; } - for (y=0; y<256; y++) // 8-bit V-clock input + for (int y=0; y<256; y++) // 8-bit V-clock input { - for (x=0; x<512; lineptr+=pixadv,x++) // 9-bit H-clock input + for (int x=0; x<512; lineptr+=pixadv,x++) // 9-bit H-clock input { - i = hadd_283; // store horizontal adder's previous state in i + int i = hadd_283; // store horizontal adder's previous state in i hadd_283 = _hcount_191 + (x & 0xff); // add lower 8 bits and preserve carry if (x<64 || x>447 || y<16 || y>239) continue; // clip rejection @@ -277,31 +276,31 @@ void sidearms_state::draw_starfield( bitmap_ind16 &bitmap ) #else // optimized loop if (!m_flipon) { - lineptr = &bitmap.pix16(16, 64); + lineptr = &bitmap.pix(16, 64); pixadv = 1; lineadv = lineadv - 384; } else { - lineptr = &bitmap.pix16(239, 512 - 64 - 1); + lineptr = &bitmap.pix(239, 512 - 64 - 1); pixadv = -1; lineadv = -lineadv + 384; } - for (y=16; y<240; y++) // 8-bit V-clock input (clipped against vertical visible area) + for (int y=16; y<240; y++) // 8-bit V-clock input (clipped against vertical visible area) { // inner loop pre-entry conditioning hadd_283 = (_hcount_191 + 64) & ~0x1f; vadd_283 = _vcount_191 + y; - i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) + int i = vadd_283<<4 & 0xff0; // to starfield EPROM A04-A11 (8 bits) i |= (_hflop_74a_n^(hadd_283>>8)) << 3; // to starfield EPROM A03 (1 bit) i |= hadd_283>>5 & 7; // to starfield EPROM A00-A02 (3 bits) m_latch_374 = sf_rom[i + 0x3000]; // lines A12-A13 are always high hadd_283 = _hcount_191 + 63; - for (x=64; x<448; lineptr+=pixadv,x++) // 9-bit H-clock input (clipped against horizontal visible area) + for (int x=64; x<448; lineptr+=pixadv,x++) // 9-bit H-clock input (clipped against horizontal visible area) { i = hadd_283; // store horizontal adder's previous state in i hadd_283 = _hcount_191 + (x & 0xff); // add lower 8 bits and preserve carry diff --git a/src/mame/video/sknsspr.cpp b/src/mame/video/sknsspr.cpp index 12e70d8536f..43e305321a7 100644 --- a/src/mame/video/sknsspr.cpp +++ b/src/mame/video/sknsspr.cpp @@ -158,7 +158,7 @@ void sknsspr_device::skns_sprite_kludge(int x, int y) #define z_draw_pixel() \ u8 val = src[xs >> 16]; \ if(val) \ - bitmap.pix16(yd>>16, xd>>16) = val + colour; + bitmap.pix(yd>>16, xd>>16) = val + colour; #define z_x_dst(op) \ old = xd; \ @@ -474,81 +474,72 @@ void sknsspr_device::skns_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl sx >>= 6; sy >>= 6; if (!xflip && !yflip) { - int xx,yy; - - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+xx < (cliprect.max_x+1)) && (sx+xx >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+yy < (cliprect.max_y+1)) && (sy+yy >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+yy, sx+xx) = pix+ NewColour; // change later + bitmap.pix(sy+yy, sx+xx) = pix+ NewColour; // change later } } } } } else if (!xflip && yflip) { - int xx,yy; sy -= ysize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+xx < (cliprect.max_x+1)) && (sx+xx >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+(ysize-1-yy) < (cliprect.max_y+1)) && (sy+(ysize-1-yy) >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+(ysize-1-yy), sx+xx) = pix+ NewColour; // change later + bitmap.pix(sy+(ysize-1-yy), sx+xx) = pix+ NewColour; // change later } } } } } else if (xflip && !yflip) { - int xx,yy; sx -= xsize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ( (sx+(xsize-1-xx) < (cliprect.max_x+1)) && (sx+(xsize-1-xx) >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+yy < (cliprect.max_y+1)) && (sy+yy >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+yy, sx+(xsize-1-xx)) = pix+ NewColour; // change later + bitmap.pix(sy+yy, sx+(xsize-1-xx)) = pix+ NewColour; // change later } } } } } else if (xflip && yflip) { - int xx,yy; sx -= xsize; sy -= ysize; - for (xx = 0; xx<xsize; xx++) + for (int xx = 0; xx<xsize; xx++) { if ((sx+(xsize-1-xx) < (cliprect.max_x+1)) && (sx+(xsize-1-xx) >= cliprect.min_x)) { - for (yy = 0; yy<ysize; yy++) + for (int yy = 0; yy<ysize; yy++) { if ((sy+(ysize-1-yy) < (cliprect.max_y+1)) && (sy+(ysize-1-yy) >= cliprect.min_y)) { - int pix; - pix = m_decodebuffer[xsize*yy+xx]; + int const pix = m_decodebuffer[xsize*yy+xx]; if (pix) - bitmap.pix16(sy+(ysize-1-yy), sx+(xsize-1-xx)) = pix+ NewColour; // change later + bitmap.pix(sy+(ysize-1-yy), sx+(xsize-1-xx)) = pix+ NewColour; // change later } } } diff --git a/src/mame/video/skullxbo.cpp b/src/mame/video/skullxbo.cpp index 757b920645b..0d1e5e926ba 100644 --- a/src/mame/video/skullxbo.cpp +++ b/src/mame/video/skullxbo.cpp @@ -243,8 +243,8 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -275,11 +275,11 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in +!CRAMD*LBMISC*(LBPIX!=0) */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - int mopix = mo[x] & 0x1f; - int pfcolor = (pf[x] >> 4) & 0x0f; - int pfpix = pf[x] & 0x0f; - int o17 = ((pf[x] & 0xc8) == 0xc8); + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopix = mo[x] & 0x1f; + int const pfcolor = (pf[x] >> 4) & 0x0f; + int const pfpix = pf[x] & 0x0f; + int const o17 = ((pf[x] & 0xc8) == 0xc8); /* implement the equations */ if ((mopriority == 0 && !o17 && mopix >= 2) || diff --git a/src/mame/video/skyfox.cpp b/src/mame/video/skyfox.cpp index 80a79461e0e..b16bd5bc831 100644 --- a/src/mame/video/skyfox.cpp +++ b/src/mame/video/skyfox.cpp @@ -220,7 +220,7 @@ void skyfox_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre but when strict compared on "1UP START" screen, it seems the blinking pattern in each star may be different. */ if (((m_bg_ctrl >> 4) & 3) != (pen & 3) || !blinking) - bitmap.pix16(y % 256, x % 512) = pen; + bitmap.pix(y % 256, x % 512) = pen; } } diff --git a/src/mame/video/skyraid.cpp b/src/mame/video/skyraid.cpp index 103b38cb0f0..7e15caa40e3 100644 --- a/src/mame/video/skyraid.cpp +++ b/src/mame/video/skyraid.cpp @@ -110,20 +110,17 @@ void skyraid_state::draw_missiles(bitmap_ind16 &bitmap, const rectangle &cliprec void skyraid_state::draw_trapezoid(bitmap_ind16& dst, bitmap_ind16& src) { - const uint8_t* p = memregion("user2")->base(); + uint8_t const *const p = memregion("user2")->base(); - int x; - int y; - - for (y = 0; y < dst.height(); y++) + for (int y = 0; y < dst.height(); y++) { - uint16_t* pSrc = &src.pix16(y); - uint16_t* pDst = &dst.pix16(y); + uint16_t const *const pSrc = &src.pix(y); + uint16_t *const pDst = &dst.pix(y); - int x1 = 0x000 + p[(y & ~1) + 0]; - int x2 = 0x100 + p[(y & ~1) + 1]; + int const x1 = 0x000 + p[(y & ~1) + 0]; + int const x2 = 0x100 + p[(y & ~1) + 1]; - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) pDst[x] = pSrc[128 * (x - x1) / (x2 - x1)]; } } diff --git a/src/mame/video/spacefb.cpp b/src/mame/video/spacefb.cpp index aee54f523b3..845fc6f2525 100644 --- a/src/mame/video/spacefb.cpp +++ b/src/mame/video/spacefb.cpp @@ -146,7 +146,6 @@ void spacefb_state::get_starfield_pens(pen_t *pens) void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int y; pen_t pens[NUM_STARFIELD_PENS]; get_starfield_pens(pens); @@ -154,21 +153,17 @@ void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, /* the shift register is always shifting -- do the portion in the top VBLANK */ if (cliprect.min_y == screen.visible_area().min_y) { - int i; - /* one cycle delay introduced by IC10 D flip-flop at the end of the VBLANK */ int clock_count = (SPACEFB_HBSTART - SPACEFB_HBEND) * SPACEFB_VBEND - 1; - for (i = 0; i < clock_count; i++) + for (int i = 0; i < clock_count; i++) shift_star_generator(); } /* visible region of the screen */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - int x; - - for (x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) + for (int x = SPACEFB_HBEND; x < SPACEFB_HBSTART; x++) { if (m_object_present_map[(y * bitmap.width()) + x] == 0) { @@ -177,9 +172,9 @@ void spacefb_state::draw_starfield(screen_device &screen, bitmap_rgb32 &bitmap, ((m_star_shift_reg & 0x1c0ff) == 0x0c0d7) || ((m_star_shift_reg & 0x1c0ff) == 0x0c0bb) || ((m_star_shift_reg & 0x1c0ff) == 0x0c0db)) - bitmap.pix32(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; + bitmap.pix(y, x) = pens[(m_star_shift_reg >> 8) & 0x3f]; else - bitmap.pix32(y, x) = pens[0]; + bitmap.pix(y, x) = pens[0]; } shift_star_generator(); @@ -254,20 +249,17 @@ void spacefb_state::get_sprite_pens(pen_t *pens) void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) { - uint8_t sy; - - uint8_t *gfx = memregion("gfx2")->base(); + uint8_t const *const gfx = memregion("gfx2")->base(); uint8_t code = m_videoram[offs + 0x0200] & 0x3f; uint8_t y = ~m_videoram[offs + 0x0100] - 2; - for (sy = 0; sy < 4; sy++) + for (uint8_t sy = 0; sy < 4; sy++) { - uint8_t sx, dy; - uint8_t data = gfx[(code << 2) | sy]; uint8_t x = m_videoram[offs + 0x0000]; + uint8_t dy; if (flip) dy = ~y; else @@ -275,53 +267,49 @@ void spacefb_state::draw_bullet(offs_t offs, pen_t pen, bitmap_rgb32 &bitmap, co if ((dy > cliprect.min_y) && (dy < cliprect.max_y)) { - for (sx = 0; sx < 4; sx++) + for (uint8_t sx = 0; sx < 4; sx++) { if (data & 0x01) { uint16_t dx; - if (flip) dx = (255 - x) * 2; else dx = x * 2; - bitmap.pix32(dy, dx + 0) = pen; - bitmap.pix32(dy, dx + 1) = pen; + bitmap.pix(dy, dx + 0) = pen; + bitmap.pix(dy, dx + 1) = pen; m_object_present_map[(dy * bitmap.width()) + dx + 0] = 1; m_object_present_map[(dy * bitmap.width()) + dx + 1] = 1; } - x = x + 1; - data = data >> 1; + x++; + data >>= 1; } } - y = y + 1; + y++; } } void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, const rectangle &cliprect, int flip) { - uint8_t sy; - - uint8_t *gfx = memregion("gfx1")->base(); + uint8_t const *const gfx = memregion("gfx1")->base(); uint8_t code = ~m_videoram[offs + 0x0200]; uint8_t color_base = (~m_videoram[offs + 0x0300] & 0x0f) << 2; uint8_t y = ~m_videoram[offs + 0x0100] - 2; - for (sy = 0; sy < 8; sy++) + for (uint8_t sy = 0; sy < 8; sy++) { - uint8_t sx, dy; - uint8_t data1 = gfx[0x0000 | (code << 3) | (sy ^ 0x07)]; uint8_t data2 = gfx[0x0800 | (code << 3) | (sy ^ 0x07)]; uint8_t x = m_videoram[offs + 0x0000] - 3; + uint8_t dy; if (flip) dy = ~y; else @@ -329,33 +317,30 @@ void spacefb_state::draw_sprite(offs_t offs, pen_t *pens, bitmap_rgb32 &bitmap, if ((dy > cliprect.min_y) && (dy < cliprect.max_y)) { - for (sx = 0; sx < 8; sx++) + for (uint8_t sx = 0; sx < 8; sx++) { uint16_t dx; - uint8_t data; - pen_t pen; - if (flip) dx = (255 - x) * 2; else dx = x * 2; - data = ((data1 << 1) & 0x02) | (data2 & 0x01); - pen = pens[color_base | data]; + uint8_t data = ((data1 << 1) & 0x02) | (data2 & 0x01); + pen_t pen = pens[color_base | data]; - bitmap.pix32(dy, dx + 0) = pen; - bitmap.pix32(dy, dx + 1) = pen; + bitmap.pix(dy, dx + 0) = pen; + bitmap.pix(dy, dx + 1) = pen; m_object_present_map[(dy * bitmap.width()) + dx + 0] = (data != 0); m_object_present_map[(dy * bitmap.width()) + dx + 1] = (data != 0); - x = x + 1; - data1 = data1 >> 1; - data2 = data2 >> 1; + x++; + data1 >>= 1; + data2 >>= 1; } } - y = y + 1; + y++; } } diff --git a/src/mame/video/special.cpp b/src/mame/video/special.cpp index da59ddee831..8e4e52c34f7 100644 --- a/src/mame/video/special.cpp +++ b/src/mame/video/special.cpp @@ -21,7 +21,7 @@ uint32_t special_state::screen_update_special(screen_device &screen, bitmap_ind1 { uint8_t const code = m_vram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = BIT(code, b); + bitmap.pix(y, x*8+(7-b)) = BIT(code, b); } } return 0; @@ -35,7 +35,7 @@ uint32_t special_state::screen_update_specialp(screen_device &screen, bitmap_ind { uint8_t const code = m_vram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = BIT(code, b); + bitmap.pix(y, x*8+(7-b)) = BIT(code, b); } } return 0; @@ -75,7 +75,7 @@ uint32_t special_state::screen_update_specimx(screen_device &screen, bitmap_ind1 uint8_t const code = m_ram->pointer()[0x9000 + y + x*256]; uint8_t const color = m_specimx_colorram[y + x*256]; for (int b = 7; b >= 0; b--) - bitmap.pix16(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f; + bitmap.pix(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f; } } return 0; @@ -100,25 +100,21 @@ void special_state::erik_palette(palette_device &palette) const uint32_t special_state::screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1, code2, color1, color2; - int y, x, b; - uint8_t *erik_video_ram_p1, *erik_video_ram_p2; + uint8_t const *const erik_video_ram_p1 = m_ram->pointer() + 0x9000; + uint8_t const *const erik_video_ram_p2 = m_ram->pointer() + 0xd000; - erik_video_ram_p1 = m_ram->pointer() + 0x9000; - erik_video_ram_p2 = m_ram->pointer() + 0xd000; - - for (x = 0; x < 48; x++) + for (int x = 0; x < 48; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - code1 = erik_video_ram_p1[y + x*256]; - code2 = erik_video_ram_p2[y + x*256]; + uint8_t code1 = erik_video_ram_p1[y + x*256]; + uint8_t code2 = erik_video_ram_p2[y + x*256]; - for (b = 7; b >= 0; b--) + for (int b = 7; b >= 0; b--) { - color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; - color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; - bitmap.pix16(y, x*8+(7-b)) = color1 | color2; + uint8_t color1 = ((code1 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_1; + uint8_t color2 = ((code2 >> b) & 0x01)==0 ? m_erik_background : m_erik_color_2; + bitmap.pix(y, x*8+(7-b)) = color1 | color2; } } } diff --git a/src/mame/video/spectrum.cpp b/src/mame/video/spectrum.cpp index e3a0226ee74..c3a594ce967 100644 --- a/src/mame/video/spectrum.cpp +++ b/src/mame/video/spectrum.cpp @@ -123,7 +123,7 @@ WRITE_LINE_MEMBER(spectrum_state::screen_vblank_spectrum) inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } uint32_t spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -235,7 +235,7 @@ void spectrum_state::spectrum_UpdateScreenBitmap(bool eof) { // this can/must be optimised if ((scrx & 7) == 0) { - uint16_t *bm = &m_screen_bitmap.pix16(m_previous_screen_y, m_previous_screen_x); + uint16_t *bm = &m_screen_bitmap.pix(m_previous_screen_y, m_previous_screen_x); uint8_t attr = *(m_screen_location + ((scry & 0xF8) << 2) + (scrx >> 3) + 0x1800); uint8_t scr = *(m_screen_location + ((scry & 7) << 8) + ((scry & 0x38) << 2) + ((scry & 0xC0) << 5) + (scrx >> 3)); uint16_t ink = (attr & 0x07) + ((attr >> 3) & 0x08); @@ -284,7 +284,7 @@ void spectrum_state::spectrum_UpdateBorderBitmap() do { - m_border_bitmap.pix16(m_previous_border_y, m_previous_border_x) = border; + m_border_bitmap.pix(m_previous_border_y, m_previous_border_x) = border; m_previous_border_x += 1; diff --git a/src/mame/video/splash.cpp b/src/mame/video/splash.cpp index b2f3417cd00..fb8264a6780 100644 --- a/src/mame/video/splash.cpp +++ b/src/mame/video/splash.cpp @@ -151,7 +151,7 @@ void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) } if (sy >= cliprect.min_y && sy <= cliprect.max_y && sx-9 >= cliprect.min_x && sx-9 <= cliprect.max_x) - bitmap.pix16(sy, sx-9) = 0x300+(color^colxor); + bitmap.pix(sy, sx-9) = 0x300+(color^colxor); } } diff --git a/src/mame/video/sprint2.cpp b/src/mame/video/sprint2.cpp index 40b713ac18b..96e04846aa5 100644 --- a/src/mame/video/sprint2.cpp +++ b/src/mame/video/sprint2.cpp @@ -80,13 +80,10 @@ uint8_t sprint2_state::collision_check(rectangle& rect) { uint8_t data = 0; - int x; - int y; - - for (y = rect.top(); y <= rect.bottom(); y++) - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) { - uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)); + uint16_t const a = m_palette->pen_indirect(m_helper.pix(y, x)); if (a == 0) data |= 0x40; diff --git a/src/mame/video/sprint4.cpp b/src/mame/video/sprint4.cpp index 183a91fd058..b6a1ef1b74a 100644 --- a/src/mame/video/sprint4.cpp +++ b/src/mame/video/sprint4.cpp @@ -117,7 +117,7 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank) for (int y = rect.top(); y <= rect.bottom(); y++) for (int x = rect.left(); x <= rect.right(); x++) - if (m_palette->pen_indirect(m_helper.pix16(y, x)) != 0) + if (m_palette->pen_indirect(m_helper.pix(y, x)) != 0) m_collision[i] = 1; } diff --git a/src/mame/video/sprint8.cpp b/src/mame/video/sprint8.cpp index 7b3db9843fc..724d9f4f1ab 100644 --- a/src/mame/video/sprint8.cpp +++ b/src/mame/video/sprint8.cpp @@ -172,8 +172,8 @@ WRITE_LINE_MEMBER(sprint8_state::screen_vblank) for (int y = visarea.top(); y <= visarea.bottom(); y++) { - const uint16_t* p1 = &m_helper1.pix16(y); - const uint16_t* p2 = &m_helper2.pix16(y); + uint16_t const *const p1 = &m_helper1.pix(y); + uint16_t const *const p2 = &m_helper2.pix(y); for (int x = visarea.left(); x <= visarea.right(); x++) if (p1[x] != 0x20 && p2[x] == 0x23) diff --git a/src/mame/video/sspeedr.cpp b/src/mame/video/sspeedr.cpp index 63fa97d3d9c..95849c78231 100644 --- a/src/mame/video/sspeedr.cpp +++ b/src/mame/video/sspeedr.cpp @@ -126,11 +126,11 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) if (counter_x & 2) { - bitmap.pix16(y, x) = m_track[offset] / 16; + bitmap.pix(y, x) = m_track[offset] / 16; } else { - bitmap.pix16(y, x) = m_track[offset] % 16; + bitmap.pix(y, x) = m_track[offset] % 16; } } @@ -138,7 +138,7 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) for (; y < 128 + m_track_vert[1]; y++) { - bitmap.pix16(y, x) = flag ? 15 : 0; + bitmap.pix(y, x) = flag ? 15 : 0; } // lower landscape @@ -154,11 +154,11 @@ void sspeedr_state::draw_track(bitmap_ind16 &bitmap) if (counter_x & 2) { - bitmap.pix16(y, x) = m_track[offset] / 16; + bitmap.pix(y, x) = m_track[offset] / 16; } else { - bitmap.pix16(y, x) = m_track[offset] % 16; + bitmap.pix(y, x) = m_track[offset] % 16; } } } diff --git a/src/mame/video/ssv.cpp b/src/mame/video/ssv.cpp index 4b65573544c..47f9f031654 100644 --- a/src/mame/video/ssv.cpp +++ b/src/mame/video/ssv.cpp @@ -171,7 +171,7 @@ void ssv_state::drawgfx_line(bitmap_ind16 &bitmap, const rectangle &cliprect, in const uint8_t gfxbppmask = BPP_MASK_TABLE[gfx & 0x07].gfx_mask; const uint8_t gfxshift = BPP_MASK_TABLE[gfx & 0x07].gfx_shift; - uint16_t *dest = &bitmap.pix16(realline); + uint16_t *const dest = &bitmap.pix(realline); const int x0 = flipx ? (base_sx + gfxelement->width() - 1) : base_sx; const int x1 = flipx ? (base_sx - 1) : (x0 + gfxelement->width()); diff --git a/src/mame/video/stactics.cpp b/src/mame/video/stactics.cpp index ddeef5ff89e..fee32be9139 100644 --- a/src/mame/video/stactics.cpp +++ b/src/mame/video/stactics.cpp @@ -214,17 +214,14 @@ void stactics_state::update_beam() inline int stactics_state::get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint8_t x, uint8_t y_scroll) { - uint8_t code; - uint8_t gfx; - /* compute effective row */ y = y - y_scroll; /* get the character code at the given pixel */ - code = videoram[((y >> 3) << 5) | (x >> 3)]; + uint8_t code = videoram[((y >> 3) << 5) | (x >> 3)]; /* get the gfx byte */ - gfx = videoram[0x800 | (code << 3) | (y & 0x07)]; + uint8_t gfx = videoram[0x800 | (code << 3) | (y & 0x07)]; /* return the appropriate pixel within the byte */ return (gfx >> (~x & 0x07)) & 0x01; @@ -233,17 +230,13 @@ inline int stactics_state::get_pixel_on_plane(uint8_t *videoram, uint8_t y, uint void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y; - bitmap.fill(0, cliprect); /* for every row */ - for (y = 0; y < 0x100; y++) + for (int y = 0; y < 0x100; y++) { - int x; - /* for every pixel on the row */ - for (x = 0; x < 0x100; x++) + for (int x = 0; x < 0x100; x++) { /* get the pixels for the four planes */ int pixel_b = get_pixel_on_plane(m_videoram_b, y, x, 0); @@ -269,7 +262,7 @@ void stactics_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clip /* plot if visible */ if ((sy >= 0) && (sy < 0x100) && (sx >= 0) && (sx < 0x100)) - bitmap.pix16(sy, sx) = pen; + bitmap.pix(sy, sx) = pen; } } } diff --git a/src/mame/video/starcrus.cpp b/src/mame/video/starcrus.cpp index f3a9875741e..ca7122e3068 100644 --- a/src/mame/video/starcrus.cpp +++ b/src/mame/video/starcrus.cpp @@ -105,7 +105,7 @@ int starcrus_state::collision_check_s1s2() for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) /* Condition 1 - ship 1 = ship 2 */ - if ((m_ship1_vid->pix16(sy, sx) == 1) && (m_ship2_vid->pix16(sy, sx) == 1)) + if ((m_ship1_vid->pix(sy, sx) == 1) && (m_ship2_vid->pix(sy, sx) == 1)) return 1; return 0; @@ -158,7 +158,7 @@ int starcrus_state::collision_check_p1p2() for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) /* Condition 1 - proj 1 = proj 2 */ - if ((m_proj1_vid->pix16(sy, sx) == 1) && (m_proj2_vid->pix16(sy, sx) == 1)) + if ((m_proj1_vid->pix(sy, sx) == 1) && (m_proj2_vid->pix(sy, sx) == 1)) return 1; return 0; @@ -219,13 +219,13 @@ int starcrus_state::collision_check_s1p1p2() /* Now check for collisions */ for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) - if (m_ship1_vid->pix16(sy, sx) == 1) + if (m_ship1_vid->pix(sy, sx) == 1) { /* Condition 1 - ship 1 = proj 1 */ - if (m_proj1_vid->pix16(sy, sx) == 1) + if (m_proj1_vid->pix(sy, sx) == 1) return 1; /* Condition 2 - ship 1 = proj 2 */ - if (m_proj2_vid->pix16(sy, sx) == 1) + if (m_proj2_vid->pix(sy, sx) == 1) return 1; } @@ -286,13 +286,13 @@ int starcrus_state::collision_check_s2p1p2() /* Now check for collisions */ for (int sy = 0; sy < 16; sy++) for (int sx = 0; sx < 16; sx++) - if (m_ship2_vid->pix16(sy, sx) == 1) + if (m_ship2_vid->pix(sy, sx) == 1) { /* Condition 1 - ship 2 = proj 1 */ - if (m_proj1_vid->pix16(sy, sx) == 1) + if (m_proj1_vid->pix(sy, sx) == 1) return 1; /* Condition 2 - ship 2 = proj 2 */ - if (m_proj2_vid->pix16(sy, sx) == 1) + if (m_proj2_vid->pix(sy, sx) == 1) return 1; } diff --git a/src/mame/video/starfield_05xx.cpp b/src/mame/video/starfield_05xx.cpp index 2fb46fd0b24..cdba1b1c7ba 100644 --- a/src/mame/video/starfield_05xx.cpp +++ b/src/mame/video/starfield_05xx.cpp @@ -642,7 +642,7 @@ void starfield_05xx_device::draw_starfield(bitmap_ind16 &bitmap, const rectangle color |= (m_lfsr<<2)&0x20; color = (~color)&0x3F; - bitmap.pix16(y, dx) = STARS_COLOR_BASE + color; + bitmap.pix(y, dx) = STARS_COLOR_BASE + color; } } } diff --git a/src/mame/video/starfire.cpp b/src/mame/video/starfire.cpp index 435a0daf108..b87e215dfd5 100644 --- a/src/mame/video/starfire.cpp +++ b/src/mame/video/starfire.cpp @@ -242,14 +242,14 @@ TIMER_CALLBACK_MEMBER(starfire_base_state::scanline_callback) int data = pix[0]; int color = col[0]; - m_screen_bitmap.pix32(y, x + 0) = pens[color | ((data >> 2) & 0x20)]; - m_screen_bitmap.pix32(y, x + 1) = pens[color | ((data >> 1) & 0x20)]; - m_screen_bitmap.pix32(y, x + 2) = pens[color | ((data >> 0) & 0x20)]; - m_screen_bitmap.pix32(y, x + 3) = pens[color | ((data << 1) & 0x20)]; - m_screen_bitmap.pix32(y, x + 4) = pens[color | ((data << 2) & 0x20)]; - m_screen_bitmap.pix32(y, x + 5) = pens[color | ((data << 3) & 0x20)]; - m_screen_bitmap.pix32(y, x + 6) = pens[color | ((data << 4) & 0x20)]; - m_screen_bitmap.pix32(y, x + 7) = pens[color | ((data << 5) & 0x20)]; + m_screen_bitmap.pix(y, x + 0) = pens[color | ((data >> 2) & 0x20)]; + m_screen_bitmap.pix(y, x + 1) = pens[color | ((data >> 1) & 0x20)]; + m_screen_bitmap.pix(y, x + 2) = pens[color | ((data >> 0) & 0x20)]; + m_screen_bitmap.pix(y, x + 3) = pens[color | ((data << 1) & 0x20)]; + m_screen_bitmap.pix(y, x + 4) = pens[color | ((data << 2) & 0x20)]; + m_screen_bitmap.pix(y, x + 5) = pens[color | ((data << 3) & 0x20)]; + m_screen_bitmap.pix(y, x + 6) = pens[color | ((data << 4) & 0x20)]; + m_screen_bitmap.pix(y, x + 7) = pens[color | ((data << 5) & 0x20)]; pix += 256; col += 256; diff --git a/src/mame/video/starshp1.cpp b/src/mame/video/starshp1.cpp index 4ea20f955cf..eb55d4c57cc 100644 --- a/src/mame/video/starshp1.cpp +++ b/src/mame/video/starshp1.cpp @@ -146,16 +146,13 @@ void starshp1_state::draw_starfield(bitmap_ind16 &bitmap) * really needed by the game. Not emulated. */ - int x; - int y; - - for (y = 0; y < bitmap.height(); y++) + for (int y = 0; y < bitmap.height(); y++) { - const uint16_t* p = m_LSFR.get() + (uint16_t) (512 * y); + uint16_t const *const p = m_LSFR.get() + (uint16_t) (512 * y); - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); - for (x = 0; x < bitmap.width(); x++) + for (int x = 0; x < bitmap.width(); x++) if ((p[x] & 0x5b56) == 0x5b44) pLine[x] = (p[x] & 0x0400) ? 0x0e : 0x0f; } @@ -217,15 +214,13 @@ void starshp1_state::draw_spaceship(bitmap_ind16 &bitmap, const rectangle &clipr void starshp1_state::draw_phasor(bitmap_ind16 &bitmap) { - int i; - - for (i = 128; i < 240; i++) + for (int i = 128; i < 240; i++) if (i >= get_sprite_vpos(13)) { - bitmap.pix16(i, 2 * i + 0) = 0x10; - bitmap.pix16(i, 2 * i + 1) = 0x10; - bitmap.pix16(i, 2 * (255 - i) + 0) = 0x10; - bitmap.pix16(i, 2 * (255 - i) + 1) = 0x10; + bitmap.pix(i, 2 * i + 0) = 0x10; + bitmap.pix(i, 2 * i + 1) = 0x10; + bitmap.pix(i, 2 * (255 - i) + 0) = 0x10; + bitmap.pix(i, 2 * (255 - i) + 1) = 0x10; } } @@ -248,9 +243,9 @@ void starshp1_state::draw_circle_line(bitmap_ind16 &bitmap, int x, int y, int l) { if (y >= 0 && y <= bitmap.height() - 1) { - const uint16_t* p = m_LSFR.get() + (uint16_t) (512 * y); + uint16_t const *const p = m_LSFR.get() + uint16_t(512 * y); - uint16_t* pLine = &bitmap.pix16(y); + uint16_t *const pLine = &bitmap.pix(y); int h1 = x - 2 * l; int h2 = x + 2 * l; @@ -305,7 +300,7 @@ int starshp1_state::spaceship_collision(bitmap_ind16 &bitmap, const rectangle &r { for (int y = rect.top(); y <= rect.bottom(); y++) { - const uint16_t* pLine = &m_helper.pix16(y); + uint16_t const *const pLine = &m_helper.pix(y); for (int x = rect.left(); x <= rect.right(); x++) if (pLine[x] != 0) diff --git a/src/mame/video/stfight_dev.cpp b/src/mame/video/stfight_dev.cpp index 40f2f590bd1..6757fd77d9b 100644 --- a/src/mame/video/stfight_dev.cpp +++ b/src/mame/video/stfight_dev.cpp @@ -285,8 +285,8 @@ void stfight_video_device::mix_txlayer(screen_device &screen, bitmap_ind16 &bitm { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dest = &bitmap.pix16(y); - uint16_t *src = &bitmap2.pix16(y); + uint16_t *const dest = &bitmap.pix(y); + uint16_t const *const src = &bitmap2.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { if (src[x] == -1) diff --git a/src/mame/video/stic.cpp b/src/mame/video/stic.cpp index c6e12e1e1a5..df3499999ce 100644 --- a/src/mame/video/stic.cpp +++ b/src/mame/video/stic.cpp @@ -516,21 +516,19 @@ const tiny_rom_entry *stic_device::device_rom_region() const void stic_device::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - int w, h; - // output scaling x *= m_x_scale; y *= m_y_scale; color = SET_COLOR(color); - for (h = 0; h < m_y_scale; h++) - for (w = 0; w < m_x_scale; w++) - bitmap.pix16(y + h, x + w) = color; + for (int h = 0; h < m_y_scale; h++) + for (int w = 0; w < m_x_scale; w++) + bitmap.pix(y + h, x + w) = color; } uint32_t stic_device::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y) { - return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale)); + return GET_COLOR(bitmap.pix(y * m_y_scale, x * m_x_scale)); } void stic_device::intv_plot_box(bitmap_ind16 &bitmap, int x, int y, int w, int h, int color) diff --git a/src/mame/video/super80.cpp b/src/mame/video/super80.cpp index ccd746c115b..1f19578ece7 100644 --- a/src/mame/video/super80.cpp +++ b/src/mame/video/super80.cpp @@ -85,7 +85,7 @@ uint32_t super80_state::screen_update_super80(screen_device &screen, bitmap_ind1 { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) // done this way to avoid x overflowing on page FF { @@ -141,7 +141,7 @@ uint32_t super80_state::screen_update_super80d(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -191,7 +191,7 @@ uint32_t super80_state::screen_update_super80e(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -245,7 +245,7 @@ uint32_t super80_state::screen_update_super80m(screen_device &screen, bitmap_ind { for (uint8_t ra = 0; ra < 10; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); for (uint16_t x = 0; x < 32; x++) { @@ -372,7 +372,7 @@ uint32_t super80v_state::screen_update_super80v(screen_device &screen, bitmap_rg MC6845_UPDATE_ROW( super80v_state::crtc_update_row ) { const rgb_t *palette = m_palette->palette()->entry_list_raw(); - uint32_t *p = &bitmap.pix32(y); + uint32_t *p = &bitmap.pix(y); for (uint16_t x = 0; x < x_count; x++) // for each character { diff --git a/src/mame/video/superqix.cpp b/src/mame/video/superqix.cpp index 99105c30c24..da863200d39 100644 --- a/src/mame/video/superqix.cpp +++ b/src/mame/video/superqix.cpp @@ -99,8 +99,8 @@ void superqix_state_base::superqix_bitmapram_w(offs_t offset, uint8_t data) m_bitmapram[offset] = data; - m_fg_bitmap[0]->pix16(y, x) = data >> 4; - m_fg_bitmap[0]->pix16(y, x + 1) = data & 0x0f; + m_fg_bitmap[0]->pix(y, x) = data >> 4; + m_fg_bitmap[0]->pix(y, x + 1) = data & 0x0f; } } @@ -113,8 +113,8 @@ void superqix_state_base::superqix_bitmapram2_w(offs_t offset, uint8_t data) m_bitmapram2[offset] = data; - m_fg_bitmap[1]->pix16(y, x) = data >> 4; - m_fg_bitmap[1]->pix16(y, x + 1) = data & 0x0f; + m_fg_bitmap[1]->pix(y, x) = data >> 4; + m_fg_bitmap[1]->pix(y, x + 1) = data & 0x0f; } } diff --git a/src/mame/video/suprloco.cpp b/src/mame/video/suprloco.cpp index 49b76042936..203fe9d38b0 100644 --- a/src/mame/video/suprloco.cpp +++ b/src/mame/video/suprloco.cpp @@ -155,7 +155,7 @@ inline void suprloco_state::draw_pixel(bitmap_ind16 &bitmap,const rectangle &cli } if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } diff --git a/src/mame/video/suprnova.cpp b/src/mame/video/suprnova.cpp index 802c622ab41..a38456e3f84 100644 --- a/src/mame/video/suprnova.cpp +++ b/src/mame/video/suprnova.cpp @@ -11,21 +11,12 @@ void skns_state::draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const rectangle &cliprect, tilemap_t *tmap, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, int wraparound, int columnscroll, uint32_t* scrollram) { //bitmap_ind16 *destbitmap = bitmap; - bitmap_ind16 &srcbitmap = tmap->pixmap(); - bitmap_ind8 &srcbitmapflags = tmap->flagsmap(); + const bitmap_ind16 &srcbitmap = tmap->pixmap(); + const bitmap_ind8 &srcbitmapflags = tmap->flagsmap(); const int xmask = srcbitmap.width()-1; const int ymask = srcbitmap.height()-1; const int widthshifted = srcbitmap.width() << 16; const int heightshifted = srcbitmap.height() << 16; - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; - uint16_t *dest; - uint8_t* destflags; // uint8_t *pri; //const uint16_t *src; //const uint8_t *maskptr; @@ -36,55 +27,53 @@ void skns_state::draw_roz(bitmap_ind16 &bitmap, bitmap_ind8& bitmapflags, const starty += cliprect.min_x * incxy + cliprect.min_y * incyy; /* extract start/end points */ - sx = cliprect.min_x; - sy = cliprect.min_y; - ex = cliprect.max_x; - ey = cliprect.max_y; + int sx = cliprect.min_x; + int sy = cliprect.min_y; + int ex = cliprect.max_x; + int ey = cliprect.max_y; + /* loop over rows */ + while (sy <= ey) { - /* loop over rows */ - while (sy <= ey) - { - /* initialize X counters */ - x = sx; - cx = startx; - cy = starty; + /* initialize X counters */ + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; - /* get dest and priority pointers */ - dest = &bitmap.pix16(sy, sx); - destflags = &bitmapflags.pix8(sy, sx); + /* get dest and priority pointers */ + uint16_t *dest = &bitmap.pix(sy, sx); + uint8_t *destflags = &bitmapflags.pix(sy, sx); - /* loop over columns */ - while (x <= ex) + /* loop over columns */ + while (x <= ex) + { + if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. { - if ((wraparound) || (cx < widthshifted && cy < heightshifted)) // not sure how this will cope with no wraparound, but row/col scroll.. + if (columnscroll) { - if (columnscroll) - { - dest[0] = srcbitmap.pix16(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); - destflags[0] = srcbitmapflags.pix8(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); - } - else - { - dest[0] = srcbitmap.pix16((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); - destflags[0] = srcbitmapflags.pix8((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); - } + dest[0] = srcbitmap.pix(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); + destflags[0] = srcbitmapflags.pix(((cy >> 16) - scrollram[(cx>>16)&0x3ff]) & ymask, (cx >> 16) & xmask); + } + else + { + dest[0] = srcbitmap.pix((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); + destflags[0] = srcbitmapflags.pix((cy >> 16) & ymask, ((cx >> 16) - scrollram[(cy>>16)&0x3ff]) & xmask); } - - /* advance in X */ - cx += incxx; - cy += incxy; - x++; - dest++; - destflags++; -// pri++; } - /* advance in Y */ - startx += incyx; - starty += incyy; - sy++; + /* advance in X */ + cx += incxx; + cy += incxy; + x++; + dest++; + destflags++; +// pri++; } + + /* advance in Y */ + startx += incyx; + starty += incyy; + sy++; } } @@ -467,12 +456,10 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, m_tilemap_bitmapflags_higher.fill(0); { - int supernova_pri_a; - int supernova_pri_b; int tran = 0; - supernova_pri_a = (m_v3_regs[0x10/4] & 0x0002)>>1; - supernova_pri_b = (m_v3_regs[0x34/4] & 0x0002)>>1; + int supernova_pri_a = (m_v3_regs[0x10/4] & 0x0002)>>1; + int supernova_pri_b = (m_v3_regs[0x34/4] & 0x0002)>>1; //popmessage("pri %d %d\n", supernova_pri_a, supernova_pri_b); @@ -481,39 +468,32 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, draw_a(m_tilemap_bitmap_higher,m_tilemap_bitmapflags_higher,cliprect,tran);// tran = 1; { - int x,y; - uint8_t* srcflags, *src2flags; - uint16_t* src, *src2, *src3; - uint32_t* dst; - uint16_t pri, pri2, pri3; uint16_t bgpri; - const pen_t *clut = &m_palette->pen(0); + pen_t const *const clut = &m_palette->pen(0); // int drawpri; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - src = &m_tilemap_bitmap_lower.pix16(y); - srcflags = &m_tilemap_bitmapflags_lower.pix8(y); + uint16_t const *const src = &m_tilemap_bitmap_lower.pix(y); + uint8_t const *const srcflags = &m_tilemap_bitmapflags_lower.pix(y); - src2 = &m_tilemap_bitmap_higher.pix16(y); - src2flags = &m_tilemap_bitmapflags_higher.pix8(y); + uint16_t const *const src2 = &m_tilemap_bitmap_higher.pix(y); + uint8_t const *const src2flags = &m_tilemap_bitmapflags_higher.pix(y); - src3 = &m_sprite_bitmap.pix16(y); + uint16_t const *const src3 = &m_sprite_bitmap.pix(y); - dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { uint16_t pendata = src[x]&0x7fff; uint16_t pendata2 = src2[x]&0x7fff; uint16_t bgpendata; uint16_t pendata3 = m_alt_enable_sprites ? src3[x]&0x3fff : 0; - uint32_t coldat; - - pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); - pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); - pri3 = ((src3[x]&0xc000)>>12)+3; + uint16_t pri = ((srcflags[x] & 0x07)<<1) | (supernova_pri_b); + uint16_t pri2= ((src2flags[x] & 0x07)<<1) | (supernova_pri_a); + uint16_t pri3 = ((src3[x]&0xc000)>>12)+3; // work out which layers bg pixel has the higher priority // note, can the bg layers be blended?? sarukani uses an alpha pen for @@ -560,6 +540,7 @@ uint32_t skns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, } // if the sprites are higher than the bg pixel + uint32_t coldat; if (pri3 > bgpri) { if (pendata3&0xff) diff --git a/src/mame/video/system1.cpp b/src/mame/video/system1.cpp index c02ccd4fa27..e13a2cb618c 100644 --- a/src/mame/video/system1.cpp +++ b/src/mame/video/system1.cpp @@ -419,7 +419,7 @@ void system1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* iterate over all rows of the sprite */ for (int y = top; y < bottom; y++) { - u16 *destbase = &bitmap.pix16(y); + u16 *const destbase = &bitmap.pix(y); /* advance by the row counter */ srcaddr += stride; @@ -515,16 +515,14 @@ void system1_state::video_update_common(screen_device &screen, bitmap_ind16 &bit /* iterate over rows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const u16 *fgbase = &fgpixmap.pix16(y & 0xff); - const u16 *sprbase = &m_sprite_bitmap.pix16(y & 0xff); - u16 *dstbase = &bitmap.pix16(y); + const u16 *const fgbase = &fgpixmap.pix(y & 0xff); + const u16 *const sprbase = &m_sprite_bitmap.pix(y & 0xff); + u16 *const dstbase = &bitmap.pix(y); const int bgy = (y + bgyscroll) & 0x1ff; const int bgxscroll = bgrowscroll[y >> 3 & 0x1f]; - const u16 *bgbase[2]; /* get the base of the left and right pixmaps for the effective background Y */ - bgbase[0] = &bgpixmaps[(bgy >> 8) * 2 + 0]->pix16(bgy & 0xff); - bgbase[1] = &bgpixmaps[(bgy >> 8) * 2 + 1]->pix16(bgy & 0xff); + const u16 *const bgbase[2] = { &bgpixmaps[(bgy >> 8) * 2 + 0]->pix(bgy & 0xff), &bgpixmaps[(bgy >> 8) * 2 + 1]->pix(bgy & 0xff) }; /* iterate over pixels */ for (int x = cliprect.min_x; x <= cliprect.max_x; x++) diff --git a/src/mame/video/taito_b.cpp b/src/mame/video/taito_b.cpp index f401f246a71..e5a6f90e5f4 100644 --- a/src/mame/video/taito_b.cpp +++ b/src/mame/video/taito_b.cpp @@ -13,8 +13,8 @@ void hitice_state::pixelram_w(offs_t offset, uint16_t data, uint16_t mem_mask) if (ACCESSING_BITS_0_7) { /* bit 15 of pixel_scroll[0] is probably flip screen */ - m_pixel_bitmap->pix16(sy, 2 * sx + 0) = m_b_fg_color_base * 16 + (data & 0xff); - m_pixel_bitmap->pix16(sy, 2 * sx + 1) = m_b_fg_color_base * 16 + (data & 0xff); + m_pixel_bitmap->pix(sy, 2 * sx + 0) = m_b_fg_color_base * 16 + (data & 0xff); + m_pixel_bitmap->pix(sy, 2 * sx + 1) = m_b_fg_color_base * 16 + (data & 0xff); } } @@ -106,9 +106,8 @@ uint32_t taitob_state::screen_update_taitob(screen_device &screen, bitmap_ind16 uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *palette = m_palette->pens(); + pen_t const *const palette = m_palette->pens(); uint8_t const video_control = m_tc0180vcu->get_videoctrl(); - int x, y; /* Video blanked? */ if (!(video_control & 0x20)) @@ -128,9 +127,9 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_tc0180vcu->draw_framebuffer(*m_realpunc_bitmap, cliprect, 0); /* Copy the intermediate bitmap to the output bitmap, applying the palette */ - for (y = 0; y <= cliprect.max_y; y++) - for (x = 0; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = palette[m_realpunc_bitmap->pix16(y, x)]; + for (int y = 0; y <= cliprect.max_y; y++) + for (int x = 0; x <= cliprect.max_x; x++) + bitmap.pix(y, x) = palette[m_realpunc_bitmap->pix(y, x)]; /* Draw the 15bpp raw CRTC frame buffer directly to the output bitmap */ if (m_realpunc_video_ctrl & 0x0002) @@ -140,29 +139,28 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_hd63484->update_screen(screen, *m_realpunc_bitmap, cliprect); - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) + for (int x = 0; x <= cliprect.max_x; x++) { - int r, g, b; - uint16_t srcpix = m_realpunc_bitmap->pix16(cliprect.min_y + y, cliprect.min_x + x); + uint16_t srcpix = m_realpunc_bitmap->pix(cliprect.min_y + y, cliprect.min_x + x); - r = (BIT(srcpix, 1)) | ((srcpix >> 11) & 0x1e); - g = (BIT(srcpix, 2)) | ((srcpix >> 7) & 0x1e); - b = (BIT(srcpix, 3)) | ((srcpix >> 3) & 0x1e); + int r = (BIT(srcpix, 1)) | ((srcpix >> 11) & 0x1e); + int g = (BIT(srcpix, 2)) | ((srcpix >> 7) & 0x1e); + int b = (BIT(srcpix, 3)) | ((srcpix >> 3) & 0x1e); if (srcpix) - bitmap.pix32(y, x) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); + bitmap.pix(y, x) = rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)); } } } /* Draw the 15bpp raw output of the camera ADCs (TODO) */ else if (m_realpunc_video_ctrl & 0x0004) { - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) - bitmap.pix32(y, x) = rgb_t(0x00, 0x00, 0x00); + for (int x = 0; x <= cliprect.max_x; x++) + bitmap.pix(y, x) = rgb_t(0x00, 0x00, 0x00); } } @@ -175,12 +173,12 @@ uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rg m_tc0180vcu->tilemap_draw(screen, *m_realpunc_bitmap, cliprect, 2, 0); /* Merge the indexed layers with the output bitmap */ - for (y = 0; y <= cliprect.max_y; y++) + for (int y = 0; y <= cliprect.max_y; y++) { - for (x = 0; x <= cliprect.max_x; x++) + for (int x = 0; x <= cliprect.max_x; x++) { - if (m_realpunc_bitmap->pix16(y, x)) - bitmap.pix32(y, x) = palette[m_realpunc_bitmap->pix16(y, x)]; + if (m_realpunc_bitmap->pix(y, x)) + bitmap.pix(y, x) = palette[m_realpunc_bitmap->pix(y, x)]; } } diff --git a/src/mame/video/taito_f2.cpp b/src/mame/video/taito_f2.cpp index 4ece4e7b83f..a9477c0d9c4 100644 --- a/src/mame/video/taito_f2.cpp +++ b/src/mame/video/taito_f2.cpp @@ -357,9 +357,9 @@ void taitof2_state::taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_i { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) @@ -419,9 +419,9 @@ void taitof2_state::taito_f2_tc360_spritemixdraw(screen_device &screen, bitmap_i { for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u16 *dest = &dest_bmp.pix16(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u16 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/taito_f3.cpp b/src/mame/video/taito_f3.cpp index 73a5df2a6df..5318be6c6f9 100644 --- a/src/mame/video/taito_f3.cpp +++ b/src/mame/video/taito_f3.cpp @@ -1354,7 +1354,7 @@ inline void taito_f3_state::draw_scanlines( yadvp = -yadvp; } - u8 *dstp0 = &m_pri_alp_bitmap.pix8(ty, x); + u8 *dstp0 = &m_pri_alp_bitmap.pix(ty, x); m_pdest_2a = m_alpha_level_2ad ? 0x10 : 0; m_pdest_2b = m_alpha_level_2bd ? 0x20 : 0; @@ -1366,7 +1366,7 @@ inline void taito_f3_state::draw_scanlines( m_tr_3b =(m_alpha_level_3bs == 0 && m_alpha_level_3bd == 255) ? -1 : 1; { - u32 *dsti0 = &bitmap.pix32(ty, x); + u32 *dsti0 = &bitmap.pix(ty, x); while (1) { int cx = 0; @@ -1909,11 +1909,11 @@ void taito_f3_state::get_line_ram_info(tilemap_t *tmap, int sx, int sy, int pos, /* set pixmap index */ line_t->x_count[y]=x_index_fx & 0xffff; // Fractional part - line_t->src_s[y] = src_s = &srcbitmap.pix16(y_index); + line_t->src_s[y] = src_s = &srcbitmap.pix(y_index); line_t->src_e[y] = &src_s[m_width_mask + 1]; line_t->src[y] = &src_s[x_index_fx >> 16]; - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap.pix8(y_index); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap.pix(y_index); line_t->tsrc[y] = &tsrc_s[x_index_fx >> 16]; } @@ -2022,16 +2022,16 @@ void taito_f3_state::get_vram_info(tilemap_t *vram_tilemap, tilemap_t *pixel_til /* set pixmap index */ line_t->x_count[y] = 0xffff; if (usePixelLayer) - line_t->src_s[y] = src_s = &srcbitmap_pixel.pix16(sy & 0xff); + line_t->src_s[y] = src_s = &srcbitmap_pixel.pix(sy & 0xff); else - line_t->src_s[y] = src_s = &srcbitmap_vram.pix16(sy & 0x1ff); + line_t->src_s[y] = src_s = &srcbitmap_vram.pix(sy & 0x1ff); line_t->src_e[y] = &src_s[vram_width_mask + 1]; line_t->src[y] = &src_s[sx]; if (usePixelLayer) - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_pixel.pix8(sy & 0xff); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_pixel.pix(sy & 0xff); else - line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_vram.pix8(sy & 0x1ff); + line_t->tsrc_s[y]=tsrc_s = &flagsbitmap_vram.pix(sy & 0x1ff); line_t->tsrc[y] = &tsrc_s[sx]; } @@ -2537,8 +2537,8 @@ inline void taito_f3_state::f3_drawgfx(bitmap_rgb32 &dest_bmp, const rectangle & int y = ey - sy; const int x = (ex - sx - 1) | (m_tile_opaque_sp[code % gfx->elements()] << 4); const u8 *source0 = code_base + y_index * 16 + x_index_base; - u32 *dest0 = &dest_bmp.pix32(sy, sx); - u8 *pri0 = &m_pri_alp_bitmap.pix8(sy, sx); + u32 *dest0 = &dest_bmp.pix(sy, sx); + u8 *pri0 = &m_pri_alp_bitmap.pix(sy, sx); const int yadv = dest_bmp.rowpixels(); const int yadvp = m_pri_alp_bitmap.rowpixels(); dy = dy * 16; @@ -2686,8 +2686,8 @@ inline void taito_f3_state::f3_drawgfxzoom(bitmap_rgb32 &dest_bmp, const rectang for (int y = sy; y < ey; y++) { const u8 *source = code_base + (y_index >> 16) * 16; - u32 *dest = &dest_bmp.pix32(y); - u8 *pri = &m_pri_alp_bitmap.pix8(y); + u32 *dest = &dest_bmp.pix(y); + u8 *pri = &m_pri_alp_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/taito_helper.cpp b/src/mame/video/taito_helper.cpp index 58c2b3a666c..6785ce576be 100644 --- a/src/mame/video/taito_helper.cpp +++ b/src/mame/video/taito_helper.cpp @@ -9,8 +9,8 @@ void taitoic_drawscanline( bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask) { - u16 *dsti = &bitmap.pix16(y, x); - u8 *dstp = &priority.pix8(y, x); + u16 *dsti = &bitmap.pix(y, x); + u8 *dstp = &priority.pix(y, x); int length = cliprect.width(); src += cliprect.min_x; diff --git a/src/mame/video/taitoair.cpp b/src/mame/video/taitoair.cpp index 3449b002491..f4953002e38 100644 --- a/src/mame/video/taitoair.cpp +++ b/src/mame/video/taitoair.cpp @@ -172,7 +172,7 @@ void taitoair_state::fill_slope(bitmap_ind16 &bitmap, const rectangle &cliprect, while (xx1 <= xx2) { - bitmap.pix16(y1, xx1) = base_color + grad_col; + bitmap.pix(y1, xx1) = base_color + grad_col; xx1++; } } diff --git a/src/mame/video/taitojc.cpp b/src/mame/video/taitojc.cpp index 382d5cfe2bf..529d0773e87 100644 --- a/src/mame/video/taitojc.cpp +++ b/src/mame/video/taitojc.cpp @@ -123,7 +123,6 @@ void taitojc_state::taitojc_char_w(offs_t offset, uint32_t data, uint32_t mem_ma void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t w1, uint32_t w2, uint8_t bank_type) { int x, y, width, height, palette; - int i, j; int x1, x2, y1, y2; int ix, iy; uint32_t address; @@ -212,11 +211,11 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, return; } - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); - for (i=x1; i < x2; i++) + for (int i=x1; i < x2; i++) { d[i] = 0x78; //TODO: black @@ -228,12 +227,12 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, } else if(!color_depth) // Densha de Go 2/2X "credit text", 4bpp { - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); int index = (iy * (width / 2)) + ix; - for (i=x1; i < x2; i+=2) + for (int i=x1; i < x2; i+=2) { uint8_t pen = (v[BYTE4_XOR_BE(index)] & 0xf0) >> 4; if (pen != 0) @@ -252,12 +251,12 @@ void taitojc_state::draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, else // 8bpp { { - for (j=y1; j < y2; j++) + for (int j=y1; j < y2; j++) { - uint16_t *d = &bitmap.pix16(j); + uint16_t *const d = &bitmap.pix(j); int index = (iy * width) + ix; - for (i=x1; i < x2; i++) + for (int i=x1; i < x2; i++) { uint8_t pen = v[BYTE4_XOR_BE(index)]; if (pen != 0) diff --git a/src/mame/video/taitosj.cpp b/src/mame/video/taitosj.cpp index dd453d64d44..2987d159824 100644 --- a/src/mame/video/taitosj.cpp +++ b/src/mame/video/taitosj.cpp @@ -269,7 +269,7 @@ inline gfx_element * taitosj_state::get_sprite_gfx_element(uint8_t which) int taitosj_state::check_sprite_sprite_bitpattern(int sx1, int sy1, int which1,int sx2, int sy2, int which2) { - int x, y, minx, miny, maxx = 16, maxy = 16; + int minx, miny, maxx = 16, maxy = 16; offs_t offs1 = which1 * 4; offs_t offs2 = which2 * 4; @@ -318,10 +318,10 @@ int taitosj_state::check_sprite_sprite_bitpattern(int sx1, int sy1, int which1,i m_spriteram[SPRITE_RAM_PAGE_OFFSET + offs2 + 2] & 0x02, sx2, sy2, 0); - for (y = miny; y < maxy; y++) - for (x = minx; x < maxx; x++) - if ((m_sprite_sprite_collbitmap1.pix16(y, x) != TRANSPARENT_PEN) && - (m_sprite_sprite_collbitmap2.pix16(y, x) != TRANSPARENT_PEN)) + for (int y = miny; y < maxy; y++) + for (int x = minx; x < maxx; x++) + if ((m_sprite_sprite_collbitmap1.pix(y, x) != TRANSPARENT_PEN) && + (m_sprite_sprite_collbitmap2.pix(y, x) != TRANSPARENT_PEN)) return 1; /* collided */ return 0; @@ -439,7 +439,6 @@ void taitosj_state::calculate_sprite_areas(int *sprites_on, rectangle *sprite_ar int taitosj_state::check_sprite_layer_bitpattern(int which, rectangle *sprite_areas) { - int y, x; offs_t offs = which * 4; int result = 0; /* no collisions */ @@ -463,17 +462,17 @@ int taitosj_state::check_sprite_layer_bitpattern(int which, rectangle *sprite_ar flip_x, flip_y, 0,0,0); - for (y = miny; y < maxy; y++) - for (x = minx; x < maxx; x++) - if (m_sprite_layer_collbitmap1.pix16(y - miny, x - minx) != TRANSPARENT_PEN) /* is there anything to check for ? */ + for (int y = miny; y < maxy; y++) + for (int x = minx; x < maxx; x++) + if (m_sprite_layer_collbitmap1.pix(y - miny, x - minx) != TRANSPARENT_PEN) /* is there anything to check for ? */ { - if (check_layer_1 && (m_sprite_layer_collbitmap2[0].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_1 && (m_sprite_layer_collbitmap2[0].pix(y, x) != TRANSPARENT_PEN)) result |= 0x01; /* collided with layer 1 */ - if (check_layer_2 && (m_sprite_layer_collbitmap2[1].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_2 && (m_sprite_layer_collbitmap2[1].pix(y, x) != TRANSPARENT_PEN)) result |= 0x02; /* collided with layer 2 */ - if (check_layer_3 && (m_sprite_layer_collbitmap2[2].pix16(y, x) != TRANSPARENT_PEN)) + if (check_layer_3 && (m_sprite_layer_collbitmap2[2].pix(y, x) != TRANSPARENT_PEN)) result |= 0x04; /* collided with layer 3 */ } @@ -485,10 +484,8 @@ void taitosj_state::check_sprite_layer_collision(int *sprites_on, rectangle *spr { if (SPRITES_ON) { - int which; - /* check each sprite */ - for (which = 0; which < 0x20; which++) + for (int which = 0; which < 0x20; which++) { if ((which >= 0x10) && (which <= 0x17)) continue; /* no sprites here */ diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp index 1f1aae3220d..2d77a22b2ff 100644 --- a/src/mame/video/tank8.cpp +++ b/src/mame/video/tank8.cpp @@ -195,8 +195,6 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) // on falling edge if (!state) { - int x; - int y; const rectangle &visarea = m_screen->visible_area(); m_tilemap->draw(*m_screen, m_helper1, visarea, 0, 0); @@ -207,21 +205,19 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) draw_sprites(m_helper2, visarea); draw_bullets(m_helper3, visarea); - for (y = visarea.top(); y <= visarea.bottom(); y++) + for (int y = visarea.top(); y <= visarea.bottom(); y++) { int _state = 0; - const uint16_t* p1 = &m_helper1.pix16(y); - const uint16_t* p2 = &m_helper2.pix16(y); - const uint16_t* p3 = &m_helper3.pix16(y); + uint16_t const *const p1 = &m_helper1.pix(y); + uint16_t const *const p2 = &m_helper2.pix(y); + uint16_t const *const p3 = &m_helper3.pix(y); if ((m_screen->frame_number() ^ y) & 1) continue; /* video display is interlaced */ - for (x = visarea.left(); x <= visarea.right(); x++) + for (int x = visarea.left(); x <= visarea.right(); x++) { - uint8_t index; - /* neither wall nor mine */ if ((p1[x] != 0x11) && (p1[x] != 0x13)) { @@ -246,6 +242,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) if (_state) continue; + uint8_t index; if (p3[x] != 8) { index = ((p3[x] & ~0x01) >> 1) | 0x18; diff --git a/src/mame/video/tatsumi.cpp b/src/mame/video/tatsumi.cpp index 6114e9cc8be..cf9c9272170 100644 --- a/src/mame/video/tatsumi.cpp +++ b/src/mame/video/tatsumi.cpp @@ -63,14 +63,14 @@ void tatsumi_state::apply_shadow_bitmap(bitmap_rgb32 &bitmap, const rectangle &c { for(int x=cliprect.min_x;x<cliprect.max_x;x++) { - uint8_t shadow = shadow_bitmap.pix8(y, x); + uint8_t shadow = shadow_bitmap.pix(y, x); // xor_output is enabled during Chen boss fight (where shadows have more brightness than everything else) // TODO: transition before fighting him should also black out all the background tilemaps too!? // (more evidence that we need to mix with color bank 0x1400 instead of doing true RGB mixing). if(shadow ^ xor_output) { - rgb_t shadow_pen = bitmap.pix32(y, x); - bitmap.pix32(y, x) = rgb_t(shadow_pen.r() >> 1,shadow_pen.g() >> 1, shadow_pen.b() >> 1); + rgb_t shadow_pen = bitmap.pix(y, x); + bitmap.pix(y, x) = rgb_t(shadow_pen.r() >> 1,shadow_pen.g() >> 1, shadow_pen.b() >> 1); } } } @@ -96,8 +96,6 @@ inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, co gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,uint32_t ssx,uint32_t ssy, int scalex, int scaley, int rotate, int write_priority_only ) { - rectangle myclip; - if (!scalex || !scaley) return; /* @@ -108,215 +106,194 @@ inline void tatsumi_state::roundupt_drawgfxzoomrotate( BitmapClass &dest_bmp, co */ /* KW 991012 -- Added code to force clip to bitmap boundary */ - myclip = clip; + rectangle myclip = clip; myclip &= dest_bmp.cliprect(); + if( gfx ) { - if( gfx ) + const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); + const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors())); + const uint8_t *code_base = gfx->get_data(code % gfx->elements()); + + int block_size = 8 * scalex; + int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; + int sprite_screen_width = ((ssx&0xffff)+block_size)>>16; + + if (sprite_screen_width && sprite_screen_height) { - const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); - const uint8_t *shadow_pens = m_shadow_pen_array.get() + (gfx->granularity() * (color % gfx->colors())); - const uint8_t *code_base = gfx->get_data(code % gfx->elements()); + /* compute sprite increment per screen pixel */ + int dx = (gfx->width()<<16)/sprite_screen_width; + int dy = (gfx->height()<<16)/sprite_screen_height; + + int sx;//=ssx>>16; + int sy;//=ssy>>16; - int block_size = 8 * scalex; - int sprite_screen_height = ((ssy&0xffff)+block_size)>>16; - int sprite_screen_width = ((ssx&0xffff)+block_size)>>16; - if (sprite_screen_width && sprite_screen_height) +// int ex = sx+sprite_screen_width; +// int ey = sy+sprite_screen_height; + + int incxx=0x10000;//(int)((float)dx * cos(theta)); +// int incxy=0x0;//(int)((float)dy * -sin(theta)); + int incyx=0x0;//(int)((float)dx * sin(theta)); +// int incyy=0x10000;//(int)((float)dy * cos(theta)); + + if (flipx) { - /* compute sprite increment per screen pixel */ - int dx = (gfx->width()<<16)/sprite_screen_width; - int dy = (gfx->height()<<16)/sprite_screen_height; + } - int sx;//=ssx>>16; - int sy;//=ssy>>16; + if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16; + if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16; + int ex = sx+sprite_screen_width; + int ey = sy+sprite_screen_height; + int x_index_base; + if( flipx ) + { + x_index_base = (sprite_screen_width-1)*dx; + dx = -dx; + incxx=-incxx; + incyx=-incyx; + } + else + { + x_index_base = 0; + } -// int ex = sx+sprite_screen_width; -// int ey = sy+sprite_screen_height; + int y_index; + if( flipy ) + { + y_index = (sprite_screen_height-1)*dy; + dy = -dy; + } + else + { + y_index = 0; + } - int x_index_base; - int y_index; - int ex,ey; + if( sx < myclip.min_x) + { /* clip left */ + int pixels = myclip.min_x-sx; + sx += pixels; + x_index_base += pixels*dx; + } + if( sy < myclip.min_y ) + { /* clip top */ + int pixels = myclip.min_y-sy; + sy += pixels; + y_index += pixels*dy; + } + /* NS 980211 - fixed incorrect clipping */ + if( ex > myclip.max_x+1 ) + { /* clip right */ + int pixels = ex-myclip.max_x-1; + ex -= pixels; + } + if( ey > myclip.max_y+1 ) + { /* clip bottom */ + int pixels = ey-myclip.max_y-1; + ey -= pixels; + } - int incxx=0x10000;//(int)((float)dx * cos(theta)); -// int incxy=0x0;//(int)((float)dy * -sin(theta)); - int incyx=0x0;//(int)((float)dx * sin(theta)); -// int incyy=0x10000;//(int)((float)dy * cos(theta)); + if( ex>sx ) + { /* skip if inner loop doesn't draw anything */ +#if 0 + int startx=0; + int starty=0; - if (flipx) - { - } +// int incxx=0x10000; +// int incxy=0; +// int incyx=0; +// int incyy=0x10000; + double theta=rotate * ((2.0 * M_PI)/512.0); + double c=cos(theta); + double s=sin(theta); - if (ssx&0x80000000) sx=0-(0x10000 - (ssx>>16)); else sx=ssx>>16; - if (ssy&0x80000000) sy=0-(0x10000 - (ssy>>16)); else sy=ssy>>16; - ex = sx+sprite_screen_width; - ey = sy+sprite_screen_height; - if( flipx ) - { - x_index_base = (sprite_screen_width-1)*dx; - dx = -dx; - incxx=-incxx; - incyx=-incyx; - } - else + // if (ey-sy > 0) + // dy=dy / (ey-sy); { - x_index_base = 0; - } + float angleAsRadians=(float)rotate * (7.28f / 512.0f); + //float ccx = cosf(angleAsRadians); + //float ccy = sinf(angleAsRadians); + float a=0; - if( flipy ) - { - y_index = (sprite_screen_height-1)*dy; - dy = -dy; - } - else - { - y_index = 0; } - if( sx < myclip.min_x) - { /* clip left */ - int pixels = myclip.min_x-sx; - sx += pixels; - x_index_base += pixels*dx; - } - if( sy < myclip.min_y ) - { /* clip top */ - int pixels = myclip.min_y-sy; - sy += pixels; - y_index += pixels*dy; - } - /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) - { /* clip right */ - int pixels = ex-myclip.max_x-1; - ex -= pixels; - } - if( ey > myclip.max_y+1 ) - { /* clip bottom */ - int pixels = ey-myclip.max_y-1; - ey -= pixels; - } + for( int y=sy; y<ey; y++ ) + { + uint32_t *const dest = &dest_bmp.pix(y); + int cx = startx; + int cy = starty; - if( ex>sx ) - { /* skip if inner loop doesn't draw anything */ - int y; -#if 0 + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { + const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes(); + int c = source[(cx >> 16)]; + if( c != transparent_color ) { - int startx=0; - int starty=0; - -// int incxx=0x10000; -// int incxy=0; -// int incyx=0; -// int incyy=0x10000; - double theta=rotate * ((2.0 * M_PI)/512.0); - double c=cos(theta); - double s=sin(theta); - - - // if (ey-sy > 0) - // dy=dy / (ey-sy); - { - float angleAsRadians=(float)rotate * (7.28f / 512.0f); - //float ccx = cosf(angleAsRadians); - //float ccy = sinf(angleAsRadians); - float a=0; - - } - - for( y=sy; y<ey; y++ ) - { - uint32_t *dest = &dest_bmp.pix32(y); - int cx = startx; - int cy = starty; - - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) - { - const uint8_t *source = code_base + (cy>>16) * gfx->rowbytes(); - int c = source[(cx >> 16)]; - if( c != transparent_color ) - { - if (write_priority_only) - dest[x]=shadow_pens[c]; - else - dest[x]=pal[c]; - } - cx += incxx; - cy += incxy; - } - startx += incyx; - starty += incyy; - } + if (write_priority_only) + dest[x]=shadow_pens[c]; + else + dest[x]=pal[c]; } + cx += incxx; + cy += incxy; } + startx += incyx; + starty += incyy; + } #endif #if 1 // old + for( int y=sy; y<ey; y++ ) + { + uint8_t const *const source = code_base + (y_index>>16) * gfx->rowbytes(); + typename BitmapClass::pixel_t *const dest = &dest_bmp.pix(y); + + int x_index = x_index_base; + for( int x=sx; x<ex; x++ ) { + int c = source[x_index>>16]; + if( c ) { - for( y=sy; y<ey; y++ ) - { - const uint8_t *source = code_base + (y_index>>16) * gfx->rowbytes(); - typename BitmapClass::pixel_t *dest = &dest_bmp.pix(y); - - int x, x_index = x_index_base; - for( x=sx; x<ex; x++ ) - { - int c = source[x_index>>16]; - if( c ) - { - // Only draw shadow pens if writing priority buffer - if (write_priority_only) - dest[x]=shadow_pens[c]; - else if (!shadow_pens[c]) - dest[x]=pal[c]; - } - x_index += dx; - } - - y_index += dy; - } + // Only draw shadow pens if writing priority buffer + if (write_priority_only) + dest[x]=shadow_pens[c]; + else if (!shadow_pens[c]) + dest[x]=pal[c]; } + x_index += dx; } -#endif + + y_index += dy; } +#endif } } } } -static void mycopyrozbitmap_core(bitmap_ind8 &bitmap,bitmap_rgb32 &srcbitmap, +static void mycopyrozbitmap_core(bitmap_ind8 &bitmap, const bitmap_rgb32 &srcbitmap, int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy, const rectangle &clip, int transparent_color) { } -static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, +static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap, const bitmap_rgb32 &srcbitmap, int dstx, int dsty, int srcwidth, int srcheight, int incxx, int incxy, int incyx, int incyy, const rectangle &clip, int transparent_color) { - uint32_t cx; - uint32_t cy; - int x; - int sx; - int sy; - int ex; - int ey; // const int xmask = srcbitmap.width()-1; // const int ymask = srcbitmap.height()-1; const int widthshifted = srcwidth << 16; const int heightshifted = srcheight << 16; - uint32_t *dest; uint32_t startx=0; uint32_t starty=0; - sx = dstx; - sy = dsty; - ex = dstx + srcwidth; - ey = dsty + srcheight; + int sx = dstx; + int sy = dsty; + int ex = dstx + srcwidth; + int ey = dsty + srcheight; if (sx<clip.min_x) sx=clip.min_x; if (ex>clip.max_x) ex=clip.max_x; @@ -327,16 +304,16 @@ static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, { while (sy <= ey) { - x = sx; - cx = startx; - cy = starty; - dest = &bitmap.pix32(sy, sx); + int x = sx; + uint32_t cx = startx; + uint32_t cy = starty; + uint32_t *dest = &bitmap.pix(sy, sx); while (x <= ex) { if (cx < widthshifted && cy < heightshifted) { - int c = srcbitmap.pix32(cy >> 16, cx >> 16); + int c = srcbitmap.pix(cy >> 16, cx >> 16); if (c != transparent_color) *dest = c; @@ -357,17 +334,8 @@ static void mycopyrozbitmap_core(bitmap_rgb32 &bitmap,bitmap_rgb32 &srcbitmap, template<class BitmapClass> void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, int write_priority_only, int rambank) { - int offs, flip_x, flip_y, x, y, color; - int w, h, index, lines, scale, rotate; - uint8_t *src1, *src2; - - int y_offset; - - int render_x, render_y; - int extent_x, extent_y; - // Sprite data is double buffered - for (offs = rambank;offs < rambank + 0x800;offs += 6) + for (int offs = rambank;offs < rambank + 0x800;offs += 6) { /* Sprite RAM itself uses an index into two ROM tables to actually draw the object. @@ -401,15 +369,15 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, Bytes 2/3: Tile index to start fetching tiles from (increments per tile). */ - y = m_spriteram[offs+3]; - x = m_spriteram[offs+2]; - scale = m_spriteram[offs+4] & 0x1ff; - color = m_spriteram[offs+1] >> 3 & 0x1ff; - flip_x = m_spriteram[offs+1] & 0x8000; - flip_y = m_spriteram[offs+1] & 0x4000; - rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now + int y = m_spriteram[offs+3]; + int x = m_spriteram[offs+2]; + int scale = m_spriteram[offs+4] & 0x1ff; + int color = m_spriteram[offs+1] >> 3 & 0x1ff; + int flip_x = m_spriteram[offs+1] & 0x8000; + int flip_y = m_spriteram[offs+1] & 0x4000; + int rotate = 0;//m_spriteram[offs+5]&0x1ff; // Todo: Turned off for now - index = m_spriteram[offs]; + int index = m_spriteram[offs]; // if (m_spriteram[offs+1]&0x7) // color=machine().rand()%0xff; @@ -421,16 +389,16 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, if (index >= 0x4000) continue; - src1 = m_rom_sprite_lookup[0] + (index * 4); - src2 = m_rom_sprite_lookup[1] + (index * 4); + uint8_t const *src1 = m_rom_sprite_lookup[0] + (index * 4); + uint8_t const *src2 = m_rom_sprite_lookup[1] + (index * 4); - lines = src1[2]; - y_offset = src1[0]&0xf8; + int lines = src1[2]; + int y_offset = src1[0]&0xf8; lines -= y_offset; - render_x = x << 16; - render_y = y << 16; + int render_x = x << 16; + int render_y = y << 16; scale = scale << 9; /* 0x80 becomes 0x10000 */ if (flip_y) @@ -444,10 +412,10 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, m_temp_bitmap.fill(0); } - extent_x = extent_y = 0; + int extent_x = 0, extent_y = 0; src1 += 4; - h = 0; + int h = 0; while (lines > 0) { int base, x_offs, x_width, x_pos, draw_this_line = 1; @@ -478,7 +446,7 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, else x_pos = x_offs; - for (w = 0; w < x_width; w++) { + for (int w = 0; w < x_width; w++) { if (rotate) roundupt_drawgfxzoomrotate( m_temp_bitmap,cliprect,m_gfxdecode->gfx(0), @@ -550,10 +518,9 @@ void tatsumi_state::draw_sprites(BitmapClass &bitmap, const rectangle &cliprect, void tatsumi_state::update_cluts(int fake_palette_offset, int object_base, int length) { - int i; const uint8_t* bank1 = m_rom_clut[0]; const uint8_t* bank2 = m_rom_clut[1]; - for (i=0; i<length; i+=8) + for (int i=0; i<length; i+=8) { m_palette->set_pen_color(fake_palette_offset+i+0,m_palette->pen_color(bank1[1]+object_base)); m_shadow_pen_array[i+0]=(bank1[1]==255); @@ -598,22 +565,20 @@ void apache3_state::apache3_road_x_w(offs_t offset, uint8_t data) void apache3_state::draw_sky(bitmap_rgb32 &bitmap,const rectangle &cliprect, int palette_base, int start_offset) { - // all todo - int x,y; - + // all TODO if (start_offset&0x8000) start_offset=-(0x10000 - start_offset); start_offset=-start_offset; start_offset-=48; - for (y=0; y<256; y++) { - for (x=0; x<320; x++) { + for (int y=0; y<256; y++) { + for (int x=0; x<320; x++) { int col=palette_base + y + start_offset; if (col<palette_base) col=palette_base; if (col>palette_base+127) col=palette_base+127; - bitmap.pix32(y, x) = m_palette->pen(col); + bitmap.pix(y, x) = m_palette->pen(col); } } } @@ -623,12 +588,10 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) { if (0) { - int x, y; - uint16_t gva = 0x180; // TODO uint8_t sky_val = m_apache3_rotate_ctrl[1] & 0xff; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { uint16_t rgdb = 0;//m_apache3_road_x_ram[gva & 0xff]; uint16_t gha = 0xf60; // test @@ -637,9 +600,9 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) if (gva & 0x100) { /* Sky */ - for (x = cliprect.min_x; x <= cliprect.max_x; ++x) + for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - dst.pix32(y, x) = m_palette->pen(0x100 + (sky_val & 0x7f)); + dst.pix(y, x) = m_palette->pen(0x100 + (sky_val & 0x7f)); /* Update horizontal counter? */ gha = (gha + 1) & 0xfff; @@ -648,28 +611,23 @@ void apache3_state::draw_ground(bitmap_rgb32 &dst, const rectangle &cliprect) else { /* Ground */ - for (x = cliprect.min_x; x <= cliprect.max_x; ++x) + for (int x = cliprect.min_x; x <= cliprect.max_x; ++x) { - uint8_t colour; - uint16_t hval; - uint8_t pixels; - int pix_sel; - - hval = (rgdb + gha) & 0xfff; // Not quite + uint16_t hval = (rgdb + gha) & 0xfff; // Not quite if (hval & 0x800) hval ^= 0x1ff; // TEST //else //hval = hval; - pixels = m_apache3_g_ram[(((gva & 0xff) << 7) | ((hval >> 2) & 0x7f))]; - pix_sel = hval & 3; + uint8_t pixels = m_apache3_g_ram[(((gva & 0xff) << 7) | ((hval >> 2) & 0x7f))]; + int pix_sel = hval & 3; - colour = (pixels >> (pix_sel << 1)) & 3; + uint8_t colour = (pixels >> (pix_sel << 1)) & 3; colour = (BIT(hval, 11) << 4) | (colour << 2) | ln; /* Draw the pixel */ - dst.pix32(y, x) = m_palette->pen(0x200 + colour); + dst.pix(y, x) = m_palette->pen(0x200 + colour); /* Update horizontal counter */ gha = (gha + 1) & 0xfff; @@ -823,8 +781,6 @@ pos is 11.5 fixed point 0x80 */ - int y,x; - int visible_line=0; const uint16_t *data = m_road_ctrl_ram; // Road layer enable (?) @@ -836,12 +792,12 @@ pos is 11.5 fixed point data+=0x400; // Apply clipping: global screen + local road y offsets - y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); + int y = 256 - ((m_vregs[0xa/2] >> 8) + m_road_yclip[0]); data+=y*4; - visible_line=0; + int visible_line=0; - for (/*y=0*/; y<cliprect.max_y+1; y++) + for ( ; y<cliprect.max_y+1; y++) { // TODO: tunnels road drawing has a different format? // shift is always 0x88** while data[3] is a variable argument with bit 15 always on @@ -850,7 +806,7 @@ pos is 11.5 fixed point int pal = 4; //(data[3]>>8)&0xf; int step=((data[1]&0xff)<<8)|((data[1]&0xff00)>>8); int samplePos=0; - const uint16_t* linedata=m_road_pixel_ram;// + (0x100 * pal); + uint16_t const *const linedata=m_road_pixel_ram;// + (0x100 * pal); int startPos=0, endPos=0; int palette_byte;//=m_road_color_ram[visible_line/8]; @@ -890,11 +846,13 @@ offset is from last pixel of first road segment? if (step) startPos=((shift<<8) + 0x80 )/ step; + int x; + /* Fill in left of road segment */ for (x=0; (x < startPos) && (x < cliprect.max_x+1); x++) { int col = linedata[0]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col); } /* If startpos is negative, clip it and adjust the sampling position accordingly */ @@ -918,7 +876,7 @@ offset is from last pixel of first road segment? //if ((samplePos>>11) > 0x7f) // col=linedata[0x7f]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col); samplePos+=step; } @@ -946,7 +904,7 @@ offset is from last pixel of first road segment? //if ((samplePos>>11) > 0x7f) // col=linedata[0x7f]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col + 32); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col + 32); } if (endPos<0) @@ -974,7 +932,7 @@ offset is from last pixel of first road segment? if ((samplePos>>11) > 0x7f) col=linedata[0x7f + 0x200]&0xf; - bitmap.pix32(y, x) = m_palette->pen(256 + pal*16 + col + 32); + bitmap.pix(y, x) = m_palette->pen(256 + pal*16 + col + 32); samplePos+=step; } @@ -1016,10 +974,9 @@ void roundup5_state::draw_landscape(bitmap_rgb32 &bitmap, const rectangle &clipr color &= 0xf; if(cliprect.contains(x, y+y_scroll) && color) - bitmap.pix32(y+y_scroll, x) = m_palette->pen(color+color_base); + bitmap.pix(y+y_scroll, x) = m_palette->pen(color+color_base); } } - } uint32_t roundup5_state::screen_update_roundup5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/taxidriv.cpp b/src/mame/video/taxidriv.cpp index 148e133c12e..ddf06c509a5 100644 --- a/src/mame/video/taxidriv.cpp +++ b/src/mame/video/taxidriv.cpp @@ -13,10 +13,6 @@ void taxidriv_state::spritectrl_w(offs_t offset, uint8_t data) uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; - int sx,sy; - - if (m_bghide) { bitmap.fill(0, cliprect); @@ -28,10 +24,10 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } else { - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(3)->opaque(bitmap,cliprect, m_vram3[offs], @@ -40,10 +36,10 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm (sx*8-m_scroll[0])&0xff,(sy*8-m_scroll[1])&0xff); } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, m_vram2[offs]+256*m_vram2[offs+0x400], @@ -54,62 +50,56 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm if (m_spritectrl[2] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; - - sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff; + int sx = ((offs/2) % 64-m_spritectrl[0]-256*(m_spritectrl[2]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[1]-128*(m_spritectrl[2]&2))&0x1ff; - color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram5[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } if (m_spritectrl[5] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; + int sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff; - sx = ((offs/2) % 64-m_spritectrl[3]-256*(m_spritectrl[5]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[4]-128*(m_spritectrl[5]&2))&0x1ff; - - color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram6[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } if (m_spritectrl[8] & 4) { - for (offs = 0;offs < 0x1000;offs++) + for (int offs = 0;offs < 0x1000;offs++) { - int color; - - sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff; - sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff; + int sx = ((offs/2) % 64-m_spritectrl[6]-256*(m_spritectrl[8]&1))&0x1ff; + int sy = ((offs/2) / 64-m_spritectrl[7]-128*(m_spritectrl[8]&2))&0x1ff; - color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram7[offs/4]>>(2*(offs&3)))&0x03; if (color) { if (sx > 0 && sx < 256 && sy > 0 && sy < 256) - bitmap.pix16(sy, sx) = color; + bitmap.pix(sy, sx) = color; } } } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, m_vram1[offs], @@ -118,25 +108,23 @@ uint32_t taxidriv_state::screen_update(screen_device &screen, bitmap_ind16 &bitm sx*8,sy*8,0); } - for (offs = 0;offs < 0x2000;offs++) + for (int offs = 0;offs < 0x2000;offs++) { - int color; - - sx = (offs/2) % 64; - sy = (offs/2) / 64; + int sx = (offs/2) % 64; + int sy = (offs/2) / 64; - color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03; + int color = (m_vram4[offs/4]>>(2*(offs&3)))&0x03; if (color) { - bitmap.pix16(sy, sx) = 2 * color; + bitmap.pix(sy, sx) = 2 * color; } } } - for (offs = 0;offs < 0x400;offs++) + for (int offs = 0;offs < 0x400;offs++) { - sx = offs % 32; - sy = offs / 32; + int sx = offs % 32; + int sy = offs / 32; m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, m_vram0[offs], diff --git a/src/mame/video/tc0080vco.cpp b/src/mame/video/tc0080vco.cpp index 7c56dd25701..91726187a2d 100644 --- a/src/mame/video/tc0080vco.cpp +++ b/src/mame/video/tc0080vco.cpp @@ -603,8 +603,8 @@ void tc0080vco_device::bg0_tilemap_draw(screen_device &screen, bitmap_ind16 &bit int x_index = sx - ((m_bgscroll_ram[row_index] << 16)); - u16 *src16 = &srcbitmap.pix16(src_y_index); - u8 *tsrc = &flagsbitmap.pix8(src_y_index); + u16 const *src16 = &srcbitmap.pix(src_y_index); + u8 const *tsrc = &flagsbitmap.pix(src_y_index); u16 *dst16 = scanline; int x_step = zoomx; diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index 2417b1146e1..3fa49244a91 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -630,7 +630,7 @@ void tc0100scn_base_device::tilemap_update() void tc0100scn_base_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u8 priority, u8 pmask ) { const bitmap_ind16 &src_bitmap = tmap->pixmap(); - int width_mask, height_mask, x, y, p; + int width_mask, height_mask; int column_offset, src_x = 0, src_y = 0; int scrollx_delta = - tmap->scrolldx(); int scrolly_delta = - tmap->scrolldy(); @@ -646,24 +646,24 @@ void tc0100scn_base_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 src_y += cliprect.top(); // Row offsets are 'screen space' 0-255 regardless of Y scroll - for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { src_x = (m_fgscrollx - m_fgscroll_ram[(y + scrolly_delta) & 0x1ff] + scrollx_delta + cliprect.min_x) & width_mask; if (m_ctrl[0x7] & 1) // Flipscreen src_x = (256 - 64 - src_x) & width_mask; // Col offsets are 'tilemap' space 0-511, and apply to blocks of 8 pixels at once - for (x = 0; x < cliprect.width(); x++) + for (int x = 0; x < cliprect.width(); x++) { column_offset = m_colscroll_ram[(src_x & 0x3ff) / 8]; - p = src_bitmap.pix16((src_y - column_offset) & height_mask, src_x); + int p = src_bitmap.pix((src_y - column_offset) & height_mask, src_x); if ((p & 0xf)!= 0 || (flags & TILEMAP_DRAW_OPAQUE)) { - bitmap.pix16(y, x + cliprect.min_x) = p; + bitmap.pix(y, x + cliprect.min_x) = p; if (screen.priority().valid()) { - u8 *pri = &screen.priority().pix8(y); + u8 *pri = &screen.priority().pix(y); pri[x + cliprect.min_x] = (pri[x + cliprect.min_x] & pmask) | priority; } } diff --git a/src/mame/video/tc0180vcu.cpp b/src/mame/video/tc0180vcu.cpp index fb3df9474de..db1a846e134 100644 --- a/src/mame/video/tc0180vcu.cpp +++ b/src/mame/video/tc0180vcu.cpp @@ -285,7 +285,7 @@ uint16_t tc0180vcu_device::framebuffer_word_r(offs_t offset) int sy = offset >> 8; int sx = 2 * (offset & 0xff); - return (m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 0) << 8) | m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 1); + return (m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 0) << 8) | m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 1); } void tc0180vcu_device::framebuffer_word_w(offs_t offset, uint16_t data, uint16_t mem_mask) @@ -294,9 +294,9 @@ void tc0180vcu_device::framebuffer_word_w(offs_t offset, uint16_t data, uint16_t int sx = 2 * (offset & 0xff); if (ACCESSING_BITS_8_15) - m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 0) = data >> 8; + m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 0) = data >> 8; if (ACCESSING_BITS_0_7) - m_framebuffer[sy >> 8]->pix16(sy & 0xff, sx + 1) = data & 0xff; + m_framebuffer[sy >> 8]->pix(sy & 0xff, sx + 1) = data & 0xff; } TILE_GET_INFO_MEMBER(tc0180vcu_device::get_bg_tile_info) @@ -521,7 +521,6 @@ void tc0180vcu_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip void tc0180vcu_device::draw_framebuffer( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { rectangle myclip = cliprect; - int x, y; g_profiler.start(PROFILER_USER1); @@ -538,14 +537,12 @@ g_profiler.start(PROFILER_USER1); if (m_video_control & 0x10) /*flip screen*/ { /*popmessage("1. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst; + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(bitmap.height()-1-y, myclip.max_x); - dst = &bitmap.pix16(bitmap.height()-1-y, myclip.max_x); - - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -558,12 +555,12 @@ g_profiler.start(PROFILER_USER1); } else { - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst = &bitmap.pix16(y, myclip.min_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(y, myclip.min_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -580,14 +577,12 @@ g_profiler.start(PROFILER_USER1); if (m_video_control & 0x10) /*flip screen*/ { /*popmessage("3. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ - for (y = myclip.min_y ;y <= myclip.max_y; y++) + for (int y = myclip.min_y ;y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst; - - dst = &bitmap.pix16(bitmap.height()-1-y, myclip.max_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(bitmap.height()-1-y, myclip.max_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; @@ -600,12 +595,12 @@ g_profiler.start(PROFILER_USER1); } else { - for (y = myclip.min_y; y <= myclip.max_y; y++) + for (int y = myclip.min_y; y <= myclip.max_y; y++) { - uint16_t *src = &m_framebuffer[m_framebuffer_page]->pix16(y, myclip.min_x); - uint16_t *dst = &bitmap.pix16(y, myclip.min_x); + uint16_t const *src = &m_framebuffer[m_framebuffer_page]->pix(y, myclip.min_x); + uint16_t *dst = &bitmap.pix(y, myclip.min_x); - for (x = myclip.min_x; x <= myclip.max_x; x++) + for (int x = myclip.min_x; x <= myclip.max_x; x++) { uint16_t c = *src++; diff --git a/src/mame/video/tc0480scp.cpp b/src/mame/video/tc0480scp.cpp index d3914e0c4f9..081f918cc2e 100644 --- a/src/mame/video/tc0480scp.cpp +++ b/src/mame/video/tc0480scp.cpp @@ -623,15 +623,12 @@ void tc0480scp_device::bg01_draw(screen_device &screen, bitmap_ind16 &bitmap, co } else /* zoom */ { - u16 *dst16, *src16; - u8 *tsrc; u16 scanline[512]; u32 sx; - bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); + const bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); int flip = m_pri_reg & 0x40; - int y_index, src_y_index, row_index; - int x_index, x_step; + int y_index; u16 screen_width = 512; //cliprect.width(); u16 min_y = cliprect.min_y; @@ -660,20 +657,20 @@ void tc0480scp_device::bg01_draw(screen_device &screen, bitmap_ind16 &bitmap, co for (int y = min_y; y <= max_y; y++) { - src_y_index = (y_index >> 16) & 0x1ff; + int src_y_index = (y_index >> 16) & 0x1ff; /* row areas are the same in flipscreen, so we must read in reverse */ - row_index = src_y_index; + int row_index = src_y_index; if (flip) row_index = 0x1ff - row_index; - x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); + int x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + const u16 *src16 = &srcbitmap.pix(src_y_index); + const u8 *tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; - x_step = zoomx; + int x_step = zoomx; if (flags & TILEMAP_DRAW_OPAQUE) { @@ -744,10 +741,8 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co bitmap_ind16 &srcbitmap = m_tilemap[layer][m_dblwidth]->pixmap(); bitmap_ind8 &flagsbitmap = m_tilemap[layer][m_dblwidth]->flagsmap(); - u16 *dst16, *src16; - u8 *tsrc; - int y_index, src_y_index, row_index, row_zoom; - int sx, x_index, x_step; + int y_index; + int sx; u32 zoomx, zoomy; u16 scanline[512]; int flipscreen = m_pri_reg & 0x40; @@ -786,29 +781,31 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co for (int y = min_y; y <= max_y; y++) { + int src_y_index; if (!flipscreen) src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][(y - m_y_offset) & 0x1ff]) & 0x1ff; else /* colscroll area is back to front in flipscreen */ src_y_index = ((y_index>>16) + m_bgcolumn_ram[layer][0x1ff - ((y - m_y_offset) & 0x1ff)]) & 0x1ff; /* row areas are the same in flipscreen, so we must read in reverse */ - row_index = src_y_index; + int row_index = src_y_index; if (flipscreen) row_index = 0x1ff - row_index; + int row_zoom; if (m_pri_reg & (layer - 1)) /* bit0 enables for BG2, bit1 for BG3 */ row_zoom = m_rowzoom_ram[layer][row_index]; else row_zoom = 0; - x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); + int x_index = sx - ((m_bgscroll_ram[layer][row_index] << 16)) - ((m_bgscroll_ram[layer][row_index + 0x800] << 8) & 0xffff); /* flawed calc ?? */ x_index -= (m_x_offset - 0x1f + layer * 4) * ((row_zoom & 0xff) << 8); /* We used to kludge 270 multiply factor, before adjusting x_index instead */ - x_step = zoomx; + int x_step = zoomx; if (row_zoom) /* need to reduce x_step */ { if (!(row_zoom & 0xff00)) @@ -817,9 +814,9 @@ void tc0480scp_device::bg23_draw(screen_device &screen, bitmap_ind16 &bitmap, co x_step -= (((row_zoom & 0xff) * 256) & 0xffff); } - src16 = &srcbitmap.pix16(src_y_index); - tsrc = &flagsbitmap.pix8(src_y_index); - dst16 = scanline; + const u16 *src16 = &srcbitmap.pix(src_y_index); + const u8 *tsrc = &flagsbitmap.pix(src_y_index); + u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) { diff --git a/src/mame/video/tc0780fpa.cpp b/src/mame/video/tc0780fpa.cpp index 046a03f8750..3cc9da0d271 100644 --- a/src/mame/video/tc0780fpa.cpp +++ b/src/mame/video/tc0780fpa.cpp @@ -52,8 +52,8 @@ void tc0780fpa_renderer::render_solid_scan(int32_t scanline, const extent_t &ext float z = extent.param[0].start; int color = extent.param[1].start; float dz = extent.param[0].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -75,8 +75,8 @@ void tc0780fpa_renderer::render_shade_scan(int32_t scanline, const extent_t &ext float color = extent.param[1].start; float dz = extent.param[0].dpdx; float dcolor = extent.param[1].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); for (int x = extent.startx; x < extent.stopx; x++) { @@ -104,8 +104,8 @@ void tc0780fpa_renderer::render_texture_scan(int32_t scanline, const extent_t &e float du = extent.param[1].dpdx; float dv = extent.param[2].dpdx; float dcolor = extent.param[3].dpdx; - uint16_t *fb = &m_fb[m_current_fb]->pix16(scanline); - uint16_t *zb = &m_zb->pix16(scanline); + uint16_t *const fb = &m_fb[m_current_fb]->pix(scanline); + uint16_t *const zb = &m_zb->pix(scanline); int tex_wrap_x = extradata.tex_wrap_x; int tex_wrap_y = extradata.tex_wrap_y; int tex_base_x = extradata.tex_base_x; diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp index 063d0f09a12..912b0078101 100644 --- a/src/mame/video/tceptor.cpp +++ b/src/mame/video/tceptor.cpp @@ -485,13 +485,11 @@ void tceptor_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect /* if SPR_MASK_COLOR pen is used, restore pixels from previous bitmap */ if (need_mask) { - int x, y; - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - if (m_palette->pen_indirect(bitmap.pix16(y, x)) == SPR_MASK_COLOR) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + if (m_palette->pen_indirect(bitmap.pix(y, x)) == SPR_MASK_COLOR) // restore pixel - bitmap.pix16(y, x) = m_temp_bitmap.pix16(y, x); + bitmap.pix(y, x) = m_temp_bitmap.pix(y, x); } } diff --git a/src/mame/video/tecmo_mix.cpp b/src/mame/video/tecmo_mix.cpp index abcdbca4017..ea40b7c9550 100644 --- a/src/mame/video/tecmo_mix.cpp +++ b/src/mame/video/tecmo_mix.cpp @@ -72,20 +72,17 @@ void tecmo_mix_device::mix_bitmaps(screen_device &screen, bitmap_rgb32 &bitmap, //int frame = (screen.frame_number()) & 1; // note this game has no tx layer, comments relate to other drivers - int y, x; - const pen_t *paldata = palette.pens(); + pen_t const *const paldata = palette.pens(); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dd = &bitmap.pix32(y); - uint16_t *sd2 = &bitmap_sp->pix16(y); - uint16_t *fg = &bitmap_fg->pix16(y); - uint16_t *bg = &bitmap_bg->pix16(y); - uint16_t *tx = nullptr; - if (bitmap_tx != nullptr) - tx = &bitmap_tx->pix16(y); - - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + uint32_t *const dd = &bitmap.pix(y); + uint16_t *const sd2 = &bitmap_sp->pix(y); + uint16_t *const fg = &bitmap_fg->pix(y); + uint16_t *const bg = &bitmap_bg->pix(y); + uint16_t *const tx = bitmap_tx ? &bitmap_tx->pix(y) : nullptr; + + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { uint16_t sprpixel = (sd2[x]); diff --git a/src/mame/video/tecmosys.cpp b/src/mame/video/tecmosys.cpp index b2ef9b96da4..f51d8749d4d 100644 --- a/src/mame/video/tecmosys.cpp +++ b/src/mame/video/tecmosys.cpp @@ -130,7 +130,7 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext else ressy = ycnt; const u32 srcoffs = address + (ressy * xsize); - u16* dstptr = &m_sprite_bitmap.pix16(drawy); + u16 *const dstptr = &m_sprite_bitmap.pix(drawy); for (int drawx = drawx_base, xcnt = srcx; (drawx <= cliprect.max_x) && (xcnt < xsize); xcnt++, drawx++) { @@ -184,7 +184,7 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext else ressy = ycnt; const u32 srcoffs = address + (ressy * xsize); - u16* dstptr = &m_sprite_bitmap.pix16(drawy >> 8); + u16 *const dstptr = &m_sprite_bitmap.pix(drawy >> 8); for (int drawx = drawx_base, xcnt = srcx; (drawx < scaled_cliprect.max_x) && (xcnt < xsize); xcnt++, drawx += zoomx) { @@ -204,17 +204,14 @@ void tecmosys_state::render_sprites_to_bitmap(const rectangle &cliprect, u16 ext void tecmosys_state::tilemap_copy_to_compose(u16 pri, const rectangle &cliprect) { - int y,x; - u16 *srcptr; - u16 *dstptr; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - srcptr = &m_tmp_tilemap_renderbitmap.pix16(y); - dstptr = &m_tmp_tilemap_composebitmap.pix16(y); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + u16 const *const srcptr = &m_tmp_tilemap_renderbitmap.pix(y); + u16 *const dstptr = &m_tmp_tilemap_composebitmap.pix(y); + for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { if ((srcptr[x]&0xf)!=0x0) - dstptr[x] = (srcptr[x]&0x7ff) | pri; + dstptr[x] = (srcptr[x]&0x7ff) | pri; } } } @@ -226,10 +223,10 @@ void tecmosys_state::do_final_mix(bitmap_rgb32 &bitmap, const rectangle &cliprec for (int y=cliprect.min_y;y<=cliprect.max_y;y++) { - u16 const *const srcptr = &m_tmp_tilemap_composebitmap.pix16(y); - u16 const *const srcptr2 = &m_sprite_bitmap.pix16(y); + u16 const *const srcptr = &m_tmp_tilemap_composebitmap.pix(y); + u16 const *const srcptr2 = &m_sprite_bitmap.pix(y); - u32 *const dstptr = &bitmap.pix32(y); + u32 *const dstptr = &bitmap.pix(y); for (int x=cliprect.min_x;x<=cliprect.max_x;x++) { u16 const pri = srcptr[x] & 0xc000; diff --git a/src/mame/video/thief.cpp b/src/mame/video/thief.cpp index 25fdb7e1e71..1a16e5b6bf4 100644 --- a/src/mame/video/thief.cpp +++ b/src/mame/video/thief.cpp @@ -101,10 +101,8 @@ void thief_state::video_start(){ } uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ - uint8_t *videoram = m_videoram.get(); - uint32_t offs; int flipscreen = m_video_control&1; - const uint8_t *source = videoram; + const uint8_t *source = m_videoram.get(); if (m_tms->screen_reset()) { @@ -115,17 +113,16 @@ uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &b if( m_video_control&4 ) /* visible page */ source += 0x2000*4; - for( offs=0; offs<0x2000; offs++ ){ + for( uint32_t offs=0; offs<0x2000; offs++ ){ int ypos = offs/32; int xpos = (offs%32)*8; int plane0 = source[0x2000*0+offs]; int plane1 = source[0x2000*1+offs]; int plane2 = source[0x2000*2+offs]; int plane3 = source[0x2000*3+offs]; - int bit; if( flipscreen ){ - for( bit=0; bit<8; bit++ ){ - bitmap.pix16(0xff - ypos, 0xff - (xpos+bit)) = + for( int bit=0; bit<8; bit++ ){ + bitmap.pix(0xff - ypos, 0xff - (xpos+bit)) = (((plane0<<bit)&0x80)>>7) | (((plane1<<bit)&0x80)>>6) | (((plane2<<bit)&0x80)>>5) | @@ -133,8 +130,8 @@ uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &b } } else { - for( bit=0; bit<8; bit++ ){ - bitmap.pix16(ypos, xpos+bit) = + for( int bit=0; bit<8; bit++ ){ + bitmap.pix(ypos, xpos+bit) = (((plane0<<bit)&0x80)>>7) | (((plane1<<bit)&0x80)>>6) | (((plane2<<bit)&0x80)>>5) | diff --git a/src/mame/video/thunderj.cpp b/src/mame/video/thunderj.cpp index e5628e9a555..db6dc0fc7ff 100644 --- a/src/mame/video/thunderj.cpp +++ b/src/mame/video/thunderj.cpp @@ -120,9 +120,9 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -184,19 +184,19 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in * +MPX0*!CS1*CS0 * +!CS1*!CS0*APIX0 */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; - int pfm = 0; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) continue; /* determine pf/m signal */ + int pfm = 0; if ((mo[x] & 0xff) == 1) pfm = 1; else if (pf[x] & 8) { - int pfpriority = (pri[x] & 0x80) ? ((pri[x] >> 2) & 3) : (pri[x] & 3); + int const pfpriority = (pri[x] & 0x80) ? ((pri[x] >> 2) & 3) : (pri[x] & 3); if (((pfpriority == 3) && !(mopriority & 1)) || ((pfpriority & 1) && (mopriority == 0)) || ((pfpriority & 2) && !(mopriority & 2))) @@ -218,12 +218,12 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority might mean palette kludges */ if (mopriority & 4) diff --git a/src/mame/video/ti85.cpp b/src/mame/video/ti85.cpp index 65a9697d431..8bdf1283dec 100644 --- a/src/mame/video/ti85.cpp +++ b/src/mame/video/ti85.cpp @@ -145,39 +145,36 @@ void ti85_state::video_start() uint32_t ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { address_space &space = m_maincpu->space(AS_PROGRAM); - int x,y,b; - int brightnes; - int lcdmem; if (!m_LCD_status || !m_timer_interrupt_mask) { - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) - for (b=0; b<8; b++) - bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6]; + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) + for (int b=0; b<8; b++) + bitmap.pix(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6]; return 0; } - lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; + int lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; memcpy (m_frames.get(), m_frames.get()+m_ti_video_memory_size, sizeof (uint8_t) * (m_ti_number_of_frames-1) * m_ti_video_memory_size); - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) *(m_frames.get()+(m_ti_number_of_frames-1)*m_ti_video_memory_size+y*m_ti_screen_x_size+x) = space.read_byte(lcdmem+y*m_ti_screen_x_size+x); - for (y=0; y<m_ti_screen_y_size; y++) - for (x=0; x<m_ti_screen_x_size; x++) - for (b=0; b<8; b++) + for (int y=0; y<m_ti_screen_y_size; y++) + for (int x=0; x<m_ti_screen_x_size; x++) + for (int b=0; b<8; b++) { - brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + int brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + ((*(m_frames.get()+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); - bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes]; + bitmap.pix(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes]; } return 0; } diff --git a/src/mame/video/tia.cpp b/src/mame/video/tia.cpp index d3c939aa5b7..36ee0175fbc 100644 --- a/src/mame/video/tia.cpp +++ b/src/mame/video/tia.cpp @@ -701,9 +701,6 @@ void tia_video_device::setup_pXgfx(void) void tia_video_device::update_bitmap(int next_x, int next_y) { - int x; - int y; - uint8_t linePF[160]; uint8_t lineP0[160]; uint8_t lineP1[160]; @@ -753,16 +750,14 @@ void tia_video_device::update_bitmap(int next_x, int next_y) } } - for (y = prev_y; y <= next_y; y++) + for (int y = prev_y; y <= next_y; y++) { - uint16_t* p; - int x1 = prev_x; int x2 = next_x; int colx1; /* Check if we have crossed a line boundary */ - if ( y != prev_y ) { + if (y != prev_y ) { int redraw_line = 0; HMOVE_started_previous = HMOVE_INACTIVE; @@ -952,19 +947,18 @@ void tia_video_device::update_bitmap(int next_x, int next_y) if (collision_check(lineM0, lineM1, colx1, x2)) CXPPMM |= 0x40; - p = &helper[current_bitmap].pix16(y % screen_height, 34); + uint16_t *p = &helper[current_bitmap].pix(y % screen_height, 34); - for (x = x1; x < x2; x++) + for (int x = x1; x < x2; x++) { p[x] = temp[x]; } if ( x2 == 160 && y % screen_height == (screen_height - 1) ) { - int t_y; - for ( t_y = 0; t_y < buffer.height(); t_y++ ) { - uint16_t* l0 = &helper[current_bitmap].pix16(t_y); - uint16_t* l1 = &helper[1 - current_bitmap].pix16(t_y); - uint32_t* l2 = &buffer.pix32(t_y); + for ( int t_y = 0; t_y < buffer.height(); t_y++ ) { + uint16_t* l0 = &helper[current_bitmap].pix(t_y); + uint16_t* l1 = &helper[1 - current_bitmap].pix(t_y); + uint32_t* l2 = &buffer.pix(t_y); int t_x; for( t_x = 0; t_x < buffer.width(); t_x++ ) { if ( l0[t_x] != l1[t_x] ) { @@ -1321,7 +1315,7 @@ void tia_video_device::HMOVE_w(uint8_t data) } if (curr_y < screen_height) { - memset(&helper[current_bitmap].pix16(curr_y, 34), 0, 16); + memset(&helper[current_bitmap].pix(curr_y, 34), 0, 16); } prev_x = 8; diff --git a/src/mame/video/timex.cpp b/src/mame/video/timex.cpp index e0d811f24d0..24b8c4a4a47 100644 --- a/src/mame/video/timex.cpp +++ b/src/mame/video/timex.cpp @@ -22,7 +22,7 @@ inline void timex_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* Update FLASH status for ts2068. Assumes flash update every 1/2s. */ diff --git a/src/mame/video/tmnt.cpp b/src/mame/video/tmnt.cpp index 64a297f9de4..d4f9f3895b3 100644 --- a/src/mame/video/tmnt.cpp +++ b/src/mame/video/tmnt.cpp @@ -650,7 +650,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[0] >= 0x30 && m_layerpri[1] < 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k052109->tilemap_draw(screen, bitmap, cliprect, m_sorted_layer[1], 0, 2); @@ -658,7 +658,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[1] >= 0x30 && m_layerpri[2] < 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k052109->tilemap_draw(screen, bitmap, cliprect, m_sorted_layer[2], 0, 4); @@ -666,7 +666,7 @@ uint32_t tmnt_state::screen_update_glfgreat(screen_device &screen, bitmap_ind16 if (m_layerpri[2] >= 0x30) { m_k053936->zoom_draw(screen, bitmap, cliprect, m_roz_tilemap, 0, 1, 1); - m_glfgreat_pixel = bitmap.pix16(0x80, 0x105); + m_glfgreat_pixel = bitmap.pix(0x80, 0x105); } m_k053245->sprites_draw(bitmap, cliprect, screen.priority()); diff --git a/src/mame/video/toaplan1.cpp b/src/mame/video/toaplan1.cpp index 369c5bd0486..5fd0be9203e 100644 --- a/src/mame/video/toaplan1.cpp +++ b/src/mame/video/toaplan1.cpp @@ -742,9 +742,9 @@ void toaplan1_state::draw_sprite_custom(screen_device &screen, bitmap_rgb32 &des { /* skip if inner loop doesn't draw anything */ for (int y = sy; y < ey; y++) { - const u8 *source = source_base + (y_index >> 16) * gfx->rowbytes(); - u32 *dest = &dest_bmp.pix32(y); - u8 *pri = &priority_bitmap.pix8(y); + u8 const *const source = source_base + (y_index >> 16) * gfx->rowbytes(); + u32 *const dest = &dest_bmp.pix(y); + u8 *const pri = &priority_bitmap.pix(y); int x_index = x_index_base; for (int x = sx; x < ex; x++) diff --git a/src/mame/video/toaplan2.cpp b/src/mame/video/toaplan2.cpp index de02afcda96..9a542579022 100644 --- a/src/mame/video/toaplan2.cpp +++ b/src/mame/video/toaplan2.cpp @@ -274,8 +274,8 @@ u32 toaplan2_state::screen_update_batsugun(screen_device &screen, bitmap_ind16 & { for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16* src_vdp0 = &bitmap.pix16(y); - const u16* src_vdp1 = &m_secondary_render_bitmap.pix16(y); + u16 *const src_vdp0 = &bitmap.pix(y); + u16 const *const src_vdp1 = &m_secondary_render_bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/toaplan_scu.cpp b/src/mame/video/toaplan_scu.cpp index 84afffe2d0a..a7bb72c6e3b 100644 --- a/src/mame/video/toaplan_scu.cpp +++ b/src/mame/video/toaplan_scu.cpp @@ -93,12 +93,12 @@ void toaplan_scu_device::draw_sprites_to_tempbitmap(const rectangle &cliprect, u void toaplan_scu_device::copy_sprites_from_tempbitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) { - const pen_t *pens = &palette().pen(gfx(0)->colorbase()); + pen_t const *const pens = &palette().pen(gfx(0)->colorbase()); for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - u16 *srcline = &m_temp_spritebitmap.pix16(y); - u32 *dstline = &bitmap.pix32(y); + u16 const *const srcline = &m_temp_spritebitmap.pix(y); + u32 *const dstline = &bitmap.pix(y); for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { diff --git a/src/mame/video/toobin.cpp b/src/mame/video/toobin.cpp index ea0a163b78c..d1fe95c1e7e 100644 --- a/src/mame/video/toobin.cpp +++ b/src/mame/video/toobin.cpp @@ -218,13 +218,13 @@ uint32_t toobin_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); - const pen_t *palette = m_palette->pens(); + pen_t const *const palette = m_palette->pens(); for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { - uint32_t *dest = &bitmap.pix32(y); - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &m_pfbitmap.pix16(y); - uint8_t *pri = &priority_bitmap.pix8(y); + uint32_t *const dest = &bitmap.pix(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t const *const pf = &m_pfbitmap.pix(y); + uint8_t const *const pri = &priority_bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint16_t pix = pf[x]; diff --git a/src/mame/video/triplhnt.cpp b/src/mame/video/triplhnt.cpp index f3775c905d4..0937758003f 100644 --- a/src/mame/video/triplhnt.cpp +++ b/src/mame/video/triplhnt.cpp @@ -88,27 +88,21 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec rect &= cliprect; /* check for collisions and copy sprite */ - + for (int x = rect.left(); x <= rect.right(); x++) { - int x; - int y; - - for (x = rect.left(); x <= rect.right(); x++) + for (int y = rect.top(); y <= rect.bottom(); y++) { - for (y = rect.top(); y <= rect.bottom(); y++) - { - pen_t a = m_helper.pix16(y, x); - pen_t b = bitmap.pix16(y, x); + pen_t const a = m_helper.pix(y, x); + pen_t const b = bitmap.pix(y, x); - if (a == 2 && b == 7) - { - hit_code = j; - hit_line = y; - } - - if (a != 1) - bitmap.pix16(y, x) = a; + if (a == 2 && b == 7) + { + hit_code = j; + hit_line = y; } + + if (a != 1) + bitmap.pix(y, x) = a; } } } diff --git a/src/mame/video/trs80.cpp b/src/mame/video/trs80.cpp index 9ad2452dd26..8fd52de2dda 100644 --- a/src/mame/video/trs80.cpp +++ b/src/mame/video/trs80.cpp @@ -14,10 +14,9 @@ /* 7 or 8-bit video, 32/64 characters per line = trs80, trs80l2, sys80 */ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; - uint8_t cols = BIT(m_mode, 0) ? 32 : 64; - uint8_t skip = BIT(m_mode, 0) ? 2 : 1; + uint16_t sy=0,ma=0; + uint8_t const cols = BIT(m_mode, 0) ? 32 : 64; + uint8_t const skip = BIT(m_mode, 0) ? 2 : 1; if (m_mode != m_size_store) { @@ -25,19 +24,19 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -52,6 +51,7 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b if (BIT(m_mode, 1) & (chr < 32)) chr+=64; // if g,j,p,q,y; lower the descender + uint8_t gfx; if ((chr==0x2c)||(chr==0x3b)||(chr==0x67)||(chr==0x6a)||(chr==0x70)||(chr==0x71)||(chr==0x79)) { if ((ra < 10) && (ra > 1)) @@ -86,10 +86,9 @@ uint32_t trs80_state::screen_update_trs80(screen_device &screen, bitmap_ind16 &b /* 7 or 8-bit video, 64/32 characters per line = ht1080z, ht1080z2, ht108064 */ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; - uint8_t cols = BIT(m_mode, 0) ? 32 : 64; - uint8_t skip = BIT(m_mode, 0) ? 2 : 1; + uint16_t sy=0,ma=0; + uint8_t const cols = BIT(m_mode, 0) ? 32 : 64; + uint8_t const skip = BIT(m_mode, 0) ? 2 : 1; if (m_mode != m_size_store) { @@ -97,19 +96,19 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint8_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -124,7 +123,7 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 if (BIT(m_mode, 1) && (chr < 32)) chr+=64; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<4) | ra ]; + uint8_t gfx = m_p_chargen[(chr<<4) | ra ]; /* Display a scanline of a character (6 pixels) */ *p++ = BIT(gfx, 7); @@ -145,8 +144,7 @@ uint32_t trs80_state::screen_update_ht1080z(screen_device &screen, bitmap_ind16 uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { static const uint16_t rows[] = { 0, 0x200, 0x100, 0x300, 1, 0x201, 0x101, 0x301 }; - uint8_t chr,gfx,gfxbit,bg=7,fg=0; - uint16_t sy=0,ma=0,x,y,ra; + uint16_t sy=0,ma=0; uint8_t cols = BIT(m_lnw_mode, 1) ? 80 : 64; /* Although the OS can select 32-character mode, it is not supported by hardware */ @@ -156,6 +154,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b screen.set_visible_area(0, cols*6-1, 0, 16*12-1); } + uint8_t bg=7,fg=0; if (BIT(m_lnw_mode, 1)) { bg = 0; @@ -165,19 +164,19 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b switch (m_lnw_mode & 0x06) { case 0: // MODE 0 - for (y = 0; y < 16; y++) + for (uint16_t y = 0; y < 16; y++) { - for (ra = 0; ra < 12; ra++) + for (uint16_t ra = 0; ra < 12; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x++) + for (uint16_t x = ma; x < ma + 64; x++) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; if (chr & 0x80) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character (6 pixels) */ *p++ = BIT(chr, gfxbit) ? fg : bg; *p++ = BIT(chr, gfxbit) ? fg : bg; @@ -190,6 +189,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b else { /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[(chr<<1) | rows[ra] ]; else @@ -210,15 +210,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b break; case 0x02: // MODE 1 - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; /* Display 6 pixels in normal region */ *p++ = BIT(gfx, 0) ? fg : bg; *p++ = BIT(gfx, 1) ? fg : bg; @@ -228,9 +228,9 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b *p++ = BIT(gfx, 5) ? fg : bg; } - for (x = 0; x < 0x10; x++) + for (uint16_t x = 0; x < 0x10; x++) { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + uint8_t gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; /* Display 6 pixels in extended region */ *p++ = BIT(gfx, 0) ? fg : bg; *p++ = BIT(gfx, 1) ? fg : bg; @@ -246,15 +246,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b case 0x04: // MODE 2 /* it seems the text video ram can have an effect in this mode, not explained clearly, so not emulated */ - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; /* Display 6 pixels in normal region */ fg = (gfx & 0x38) >> 3; *p++ = fg; @@ -273,15 +273,15 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b /* the manual does not explain at all how colour is determined for the extended area. Further, the background colour is not mentioned anywhere. Black is assumed. */ - for (y = 0; y < 0x400; y+=0x40) + for (uint16_t y = 0; y < 0x400; y+=0x40) { - for (ra = 0; ra < 0x3000; ra+=0x400) + for (uint16_t ra = 0; ra < 0x3000; ra+=0x400) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = 0; x < 0x40; x++) + for (uint16_t x = 0; x < 0x40; x++) { - gfx = m_p_gfxram[ y | x | ra]; + uint8_t gfx = m_p_gfxram[ y | x | ra]; fg = (m_p_videoram[ x | y ] & 0x38) >> 3; /* Display 6 pixels in normal region */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -293,9 +293,9 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b *p++ = BIT(gfx, 5) ? fg : bg; } - for (x = 0; x < 0x10; x++) + for (uint16_t x = 0; x < 0x10; x++) { - gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; + uint8_t gfx = m_p_gfxram[ 0x3000 | x | (ra & 0xc00) | ((ra & 0x3000) >> 8)]; fg = (m_p_gfxram[ 0x3c00 | x | y ] & 0x38) >> 3; /* Display 6 pixels in extended region */ *p++ = BIT(gfx, 0) ? fg : bg; @@ -316,8 +316,7 @@ uint32_t trs80_state::screen_update_lnw80(screen_device &screen, bitmap_ind16 &b /* lores characters are in the character generator. Each character is 8x16. */ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; uint8_t cols = BIT(m_mode, 0) ? 32 : 64; uint8_t skip = BIT(m_mode, 0) ? 2 : 1; @@ -327,18 +326,18 @@ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16 screen.set_visible_area(0, cols*8-1, 0, 16*16-1); } - for (y = 0; y < 16; y++) + for (uint8_t y = 0; y < 16; y++) { - for (ra = 0; ra < 16; ra++) + for (uint8_t ra = 0; ra < 16; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + 64; x+=skip) + for (uint16_t x = ma; x < ma + 64; x+=skip) { - chr = m_p_videoram[x]; + uint8_t chr = m_p_videoram[x]; /* get pattern of pixels for that character scanline */ - gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; + uint8_t gfx = m_p_chargen[(chr<<3) | (ra & 7) | (ra & 8) << 8]; /* Display a scanline of a character (8 pixels) */ *p++ = BIT(gfx, 0); diff --git a/src/mame/video/trs80m3.cpp b/src/mame/video/trs80m3.cpp index 28fc64012dc..4b44cc62534 100644 --- a/src/mame/video/trs80m3.cpp +++ b/src/mame/video/trs80m3.cpp @@ -39,8 +39,7 @@ void trs80m3_state::port_88_w(offs_t offset, uint8_t data) /* 8-bit video, 32/64/40/80 characters per line = trs80m3, trs80m4. */ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t y,ra,chr,gfx,gfxbit; - uint16_t sy=0,ma=0,x; + uint16_t sy=0,ma=0; uint8_t skip=1; uint8_t cols = BIT(m_mode, 2) ? 80 : 64; uint8_t rows = BIT(m_mode, 2) ? 24 : 16; @@ -60,18 +59,19 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 screen.set_visible_area(0, s_cols*8-1, 0, rows*lines-1); } - for (y = 0; y < rows; y++) + for (uint8_t y = 0; y < rows; y++) { - for (ra = 0; ra < lines; ra++) + for (uint8_t ra = 0; ra < lines; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint16_t *p = &bitmap.pix(sy++); - for (x = ma; x < ma + cols; x+=skip) + for (uint16_t x = ma; x < ma + cols; x+=skip) { - chr = m_p_videoram[x+m_start_address]; + uint8_t chr = m_p_videoram[x+m_start_address]; if (((chr & 0xc0) == 0xc0) && (~m_mode & 8)) { + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[((chr&mask)<<3) | ra ]; else @@ -86,10 +86,9 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 *p++ = BIT(gfx, 1); *p++ = BIT(gfx, 0); } - else - if ((chr & 0x80) && (~m_mode & 8)) + else if ((chr & 0x80) && (~m_mode & 8)) { - gfxbit = (ra & 0x0c)>>1; + uint8_t gfxbit = (ra & 0x0c)>>1; /* Display one line of a lores character */ *p++ = BIT(chr, gfxbit); *p++ = BIT(chr, gfxbit); @@ -104,6 +103,7 @@ uint32_t trs80m3_state::screen_update_trs80m3(screen_device &screen, bitmap_ind1 else { /* get pattern of pixels for that character scanline */ + uint8_t gfx; if (ra < 8) gfx = m_p_chargen[((chr&0x7f)<<3) | ra ]; else diff --git a/src/mame/video/truco.cpp b/src/mame/video/truco.cpp index ba885d7c4d6..ac2019b3914 100644 --- a/src/mame/video/truco.cpp +++ b/src/mame/video/truco.cpp @@ -42,7 +42,7 @@ uint32_t truco_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { int const pixel = (videoram[x >> 1] >> ((x & 1) ? 0 : 4)) & 0x0f; - bitmap.pix32(y, x) = m_palette->pen(pixel); + bitmap.pix(y, x) = m_palette->pen(pixel); } videoram += 0x80; diff --git a/src/mame/video/tubep.cpp b/src/mame/video/tubep.cpp index af4b49d0e76..3273086647f 100644 --- a/src/mame/video/tubep.cpp +++ b/src/mame/video/tubep.cpp @@ -572,15 +572,13 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b pen_t pen_base = 32; //change it later - uint32_t v; uint8_t *text_gfx_base = memregion("gfx1")->base(); uint8_t *romBxx = memregion("user1")->base() + 0x2000*m_background_romsel; /* logerror(" update: from DISP=%i y_min=%3i y_max=%3i\n", DISP_, cliprect.min_y, cliprect.max_y+1); */ - for (v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ + for (uint32_t v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ { - uint32_t h; uint32_t sp_data0=0,sp_data1=0,sp_data2=0; // It appears there is a 1 pixel delay when renderer switches from background to sprite/text, @@ -588,7 +586,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b // See the gameplay video on the PCB. https://www.youtube.com/watch?v=xxONzbUOOsw bool prev_text_or_sprite_pixel = true; - for (h = 0*8; h < 32*8; h++) + for (uint32_t h = 0*8; h < 32*8; h++) { bool draw_text_or_sprite_pixel = false; @@ -606,7 +604,7 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b if (text_gfx_data & (0x80 >> (h & 0x07))) { - bitmap.pix16(v, h) = (m_textram[text_offs + 1] & 0x0f) | m_color_A4; + bitmap.pix(v, h) = (m_textram[text_offs + 1] & 0x0f) | m_color_A4; draw_text_or_sprite_pixel = true; } else @@ -652,12 +650,12 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b draw_text_or_sprite_pixel = true; } - bitmap.pix16(v, h) = pen_base + bg_data*64 + romB_data_h; + bitmap.pix(v, h) = pen_base + bg_data*64 + romB_data_h; } // text and sprite drop shadow if (draw_text_or_sprite_pixel && !prev_text_or_sprite_pixel && h > 0) - bitmap.pix16(v, h - 1) = 0x0; + bitmap.pix(v, h - 1) = 0x0; prev_text_or_sprite_pixel = draw_text_or_sprite_pixel; } } @@ -744,7 +742,6 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 { int DISP_ = m_DISP^1; - uint32_t v; uint8_t *text_gfx_base = memregion("gfx1")->base(); uint8_t *rom13D = memregion("user1")->base(); uint8_t *rom11BD = rom13D+0x1000; @@ -754,9 +751,8 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 /* especially read from ROM19C can be done once per 8 pixels*/ /* and the data could be bitswapped beforehand */ - for (v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ + for (uint32_t v = cliprect.min_y; v <= cliprect.max_y; v++) /* only for current scanline */ { - uint32_t h; uint32_t sp_data0=0,sp_data1=0,sp_data2=0; uint8_t pal14h4_pin19; uint8_t pal14h4_pin18; @@ -769,7 +765,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 pal14h4_pin13 = (rom19C[addr] >> ((v&7)^7) ) &1; pal14h4_pin19 = (ram_data>>13) & 1; - for (h = 0*8; h < 32*8; h++) + for (uint32_t h = 0*8; h < 32*8; h++) { offs_t text_offs; uint8_t text_code; @@ -784,7 +780,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 text_gfx_data = text_gfx_base[(text_code << 3) | (v & 0x07)]; if (text_gfx_data & (0x80 >> (h & 0x07))) - bitmap.pix16(v, h) = 0x10 | (m_textram[text_offs + 1] & 0x0f); + bitmap.pix(v, h) = 0x10 | (m_textram[text_offs + 1] & 0x0f); else { uint32_t sp_data; @@ -795,7 +791,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 sp_data = sp_data1; if (sp_data != 0x0f) - bitmap.pix16(v, h) = 0x00 + sp_data; + bitmap.pix(v, h) = 0x00 + sp_data; else { uint32_t bg_data; @@ -848,7 +844,7 @@ uint32_t tubep_state::screen_update_rjammer(screen_device &screen, bitmap_ind16 color_bank = (pal14h4_pin13 & ((bg_data&0x08)>>3) & ((bg_data&0x04)>>2) & (((bg_data&0x02)>>1)^1) & (bg_data&0x01) ) | (pal14h4_pin18 & ((bg_data&0x08)>>3) & ((bg_data&0x04)>>2) & ((bg_data&0x02)>>1) & ((bg_data&0x01)^1) ) | (pal14h4_pin19); - bitmap.pix16(v, h) = 0x20 + color_bank*0x10 + bg_data; + bitmap.pix(v, h) = 0x20 + color_bank*0x10 + bg_data; } } } diff --git a/src/mame/video/tunhunt.cpp b/src/mame/video/tunhunt.cpp index 588f6253274..a5712f2afa1 100644 --- a/src/mame/video/tunhunt.cpp +++ b/src/mame/video/tunhunt.cpp @@ -223,10 +223,10 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl const int color = ((span_data >> 6) & 0x3) ^ 0x3; int count = (span_data & 0x1f) + 1; while (count-- && x < 256) - tmpbitmap.pix16(line, x++) = color; + tmpbitmap.pix(line, x++) = color; } while (x < 256) - tmpbitmap.pix16(line, x++) = 0; + tmpbitmap.pix(line, x++) = 0; } int scaley; @@ -303,7 +303,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect) } } if (x >= cliprect.left() && x <= cliprect.right()) - bitmap.pix16(0xff-y, x) = color; + bitmap.pix(0xff-y, x) = color; } } } diff --git a/src/mame/video/turbo.cpp b/src/mame/video/turbo.cpp index d52f2d9fdfa..723aa15054e 100644 --- a/src/mame/video/turbo.cpp +++ b/src/mame/video/turbo.cpp @@ -352,22 +352,21 @@ uint32_t turbo_state::turbo_get_sprite_bits(uint8_t road, sprite_info *sprinfo) uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr1114 = &m_proms[0x000]; - const uint8_t *pr1115 = &m_proms[0x020]; - const uint8_t *pr1116 = &m_proms[0x040]; - const uint8_t *pr1117 = &m_proms[0x060]; - const uint8_t *pr1118 = &m_proms[0x100]; - const uint8_t *pr1121 = &m_proms[0x600]; - const uint8_t *pr1122 = &m_proms[0x800]; - const uint8_t *pr1123 = &m_proms[0xc00]; - int x, y; + uint8_t const *const pr1114 = &m_proms[0x000]; + uint8_t const *const pr1115 = &m_proms[0x020]; + uint8_t const *const pr1116 = &m_proms[0x040]; + uint8_t const *const pr1117 = &m_proms[0x060]; + uint8_t const *const pr1118 = &m_proms[0x100]; + uint8_t const *const pr1121 = &m_proms[0x600]; + uint8_t const *const pr1122 = &m_proms[0x800]; + uint8_t const *const pr1123 = &m_proms[0xc00]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); - int sel, coch, babit, slipar_acciar, area, offs, areatmp, road = 0; + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); + int road = 0; sprite_info sprinfo; /* compute the Y sum between opa and the current scanline (p. 141) */ @@ -382,25 +381,22 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b turbo_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - int bacol, red, grn, blu, priority, foreraw, forebits, mx, ix; int xx = x / TURBO_X_SCALE; - uint8_t carry; - uint32_t sprbits; - uint16_t he; /* load the bitmask from the sprite position for both halves of the sprites (p. 139) */ - he = m_sprite_position[xx] | (m_sprite_position[xx + 0x100] << 8); + uint16_t he = m_sprite_position[xx] | (m_sprite_position[xx + 0x100] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* compute the X sum between opb and the current column; only the carry matters (p. 141) */ - carry = (xx + m_turbo_opb) >> 8; + uint8_t carry = (xx + m_turbo_opb) >> 8; /* the carry selects which inputs to use (p. 141) */ + int sel, coch; if (carry) { sel = m_turbo_ipb; @@ -413,6 +409,7 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b } /* look up AREA1 and AREA2 (p. 142) */ + int area, offs, areatmp; offs = va | /* A0- A7 = VA0-VA7 */ ((sel & 0x0f) << 8); /* A8-A11 = SEL0-3 */ @@ -447,27 +444,27 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* compute the final area value and look it up in IC18/PR1115 (p. 144) */ /* note: SLIPAR is 0 on the road surface only */ /* ACCIAR is 0 on the road surface and the striped edges only */ - babit = pr1115[area]; - slipar_acciar = babit & 0x30; + int babit = pr1115[area]; + int slipar_acciar = babit & 0x30; if (!road && (slipar_acciar & 0x20)) road = 1; /* also use the coch value to look up color info in IC13/PR1114 and IC21/PR1117 (p. 144) */ offs = (coch & 0x0f) | /* A0-A3: CONT0-3 = COCH0-3 */ ((m_turbo_fbcol & 0x01) << 4); /* A4: COL0 */ - bacol = pr1114[offs] | (pr1117[offs] << 8); + int bacol = pr1114[offs] | (pr1117[offs] << 8); /* at this point, do the character lookup; due to the shift register loading in */ /* the sync PROM, we latch character 0 during pixel 6 and start clocking in pixel */ /* 8, effectively shifting the display by 8; at pixel 0x108, the color latch is */ /* forced clear and isn't touched until the next shift register load */ - foreraw = (xx < 8 || xx >= 0x108) ? 0 : fore[xx - 8]; + int foreraw = (xx < 8 || xx >= 0x108) ? 0 : fore[xx - 8]; /* perform the foreground color table lookup in IC99/PR1118 (p. 137) */ - forebits = pr1118[foreraw]; + int forebits = pr1118[foreraw]; /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { /* iterate over live sprites and update them */ /* the final 32-bit value is: */ @@ -475,18 +472,18 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* CDG0-7 = D8 -D15 */ /* CDR0-7 = D16-D23 */ /* PLB0-7 = D24-D31 */ - sprbits = turbo_get_sprite_bits(road, &sprinfo); + uint32_t sprbits = turbo_get_sprite_bits(road, &sprinfo); /* perform collision detection here via lookup in IC20/PR1116 (p. 144) */ m_turbo_collision |= pr1116[((sprbits >> 24) & 7) | (slipar_acciar >> 1)]; /* look up the sprite priority in IC11/PR1122 (p. 144) */ - priority = ((sprbits & 0xfe000000) >> 25) | /* A0-A6: PLB1-7 */ + int priority = ((sprbits & 0xfe000000) >> 25) | /* A0-A6: PLB1-7 */ ((m_turbo_fbpla & 0x07) << 7); /* A7-A9: PLA0-2 */ priority = pr1122[priority]; /* use that to look up the overall priority in IC12/PR1123 (p. 144) */ - mx = (priority & 7) | /* A0-A2: PR-1122 output, bits 0-2 */ + int mx = (priority & 7) | /* A0-A2: PR-1122 output, bits 0-2 */ ((sprbits & 0x01000000) >> 21) | /* A3: PLB0 */ ((foreraw & 0x80) >> 3) | /* A4: PLBE */ ((forebits & 0x08) << 2) | /* A5: PLBF */ @@ -496,19 +493,19 @@ uint32_t turbo_state::screen_update_turbo(screen_device &screen, bitmap_ind16 &b /* the MX output selects one of 16 inputs; build up a 16-bit pattern to match */ /* these in red, green, and blue (p. 144) */ - red = ((sprbits & 0x0000ff) >> 0) | /* D0- D7: CDR0-CDR7 */ + int red = ((sprbits & 0x0000ff) >> 0) | /* D0- D7: CDR0-CDR7 */ ((forebits & 0x01) << 8) | /* D8: CDRF */ ((bacol & 0x001f) << 9) | /* D9-D13: BAR0-BAR4 */ (1 << 14) | /* D14: 1 */ (0 << 15); /* D15: 0 */ - grn = ((sprbits & 0x00ff00) >> 8) | /* D0- D7: CDG0-CDG7 */ + int grn = ((sprbits & 0x00ff00) >> 8) | /* D0- D7: CDG0-CDG7 */ ((forebits & 0x02) << 7) | /* D8: CDGF */ ((bacol & 0x03e0) << 4) | /* D9-D13: BAG0-BAG4 */ (1 << 14) | /* D14: 1 */ (0 << 15); /* D15: 0 */ - blu = ((sprbits & 0xff0000) >> 16) | /* D0- D7: CDB0-CDB7 */ + int blu = ((sprbits & 0xff0000) >> 16) | /* D0- D7: CDB0-CDB7 */ ((forebits & 0x04) << 6) | /* D8: CDBF */ ((bacol & 0x7c00) >> 1) | /* D9-D13: BAB0-BAB4 */ (1 << 14) | /* D14: 1 */ @@ -703,17 +700,16 @@ uint32_t turbo_state::subroc3d_get_sprite_bits(sprite_info *sprinfo, uint8_t *pl uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr1419 = &m_proms[0x000]; - const uint8_t *pr1620 = &m_proms[0x200]; - const uint8_t *pr1450 = &m_proms[0x500]; - const uint8_t *pr1454 = &m_proms[0x920]; - int x, y; + uint8_t const *const pr1419 = &m_proms[0x000]; + uint8_t const *const pr1620 = &m_proms[0x200]; + uint8_t const *const pr1450 = &m_proms[0x500]; + uint8_t const *const pr1454 = &m_proms[0x920]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); sprite_info sprinfo; /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ @@ -721,47 +717,48 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 subroc3d_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - int offs, finalbits, ix; uint8_t xx = x / TURBO_X_SCALE; - uint8_t foreraw, forebits, mux, cd, plb, mplb; - uint16_t he; - uint32_t sprbits; /* load the bitmask from the sprite position for both halves of the sprites (p. 143) */ - he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); + uint16_t he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* at this point, do the character lookup */ + uint8_t foreraw; if (!m_subroc3d_flip) foreraw = fore[xx]; else foreraw = fore[(pr1454[(xx >> 3) & 0x1f] << 3) | (xx & 0x07)]; /* perform the foreground color table lookup in IC62/PR1620 (p. 141) */ - forebits = pr1620[foreraw]; + uint8_t forebits = pr1620[foreraw]; /* MPLB is set based on the high bit of the raw foreground data, as an OR over the output */ /* of the foreground color PROM */ - mplb = (foreraw & 0x80) || ((forebits & 0x0f) == 0); + uint8_t mplb = (foreraw & 0x80) || ((forebits & 0x0f) == 0); /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { + int offs; + /* iterate over live sprites and update them */ /* the final 32-bit value is: */ /* CDA0-7 = D0 -D7 */ /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); + uint8_t plb; + uint32_t sprbits = subroc3d_get_sprite_bits(&sprinfo, &plb); /* MUX0-3 is selected by PLY0-3 and the sprite enable bits, and is the output */ /* of IC21/PR1450 (p. 141), unless MPLB = 0, in which case the values are grounded (p. 141) */ + uint8_t mux; if (mplb) { offs = (plb ^ 0xff) | /* A0-A7: /PLB0-7 */ @@ -773,9 +770,10 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 /* CD0-3 are selected from the sprite bits and MUX0-2 (p. 141) */ sprbits = (sprbits >> (mux & 0x07)) & 0x01010101; - cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; + uint8_t cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; /* MUX3 selects either CD0-3 or the foreground output (p. 141) */ + int finalbits; if (mux & 0x08) finalbits = cd; else @@ -802,26 +800,23 @@ uint32_t turbo_state::screen_update_subroc3d(screen_device &screen, bitmap_ind16 void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) { - const uint8_t *pr5196 = &m_proms[0x100]; - int sprnum; + uint8_t const *const pr5196 = &m_proms[0x100]; /* initialize the line enable signals to 0 */ info->ve = 0; info->lst = 0; /* compute the sprite information, which was done on the previous scanline during HBLANK */ - for (sprnum = 0; sprnum < 16; sprnum++) + for (int sprnum = 0; sprnum < 16; sprnum++) { - uint8_t *rambase = &m_spriteram[sprnum * 8]; + uint8_t *const rambase = &m_spriteram[sprnum * 8]; int level = sprnum & 7; - uint8_t clo, chi; - uint32_t sum; /* perform the first ALU to see if we are within the scanline */ - sum = y + (rambase[0]/* ^ 0xff*/); - clo = (sum >> 8) & 1; + uint32_t sum = y + (rambase[0]/* ^ 0xff*/); + uint8_t clo = (sum >> 8) & 1; sum += (y << 8) + ((rambase[1]/* ^ 0xff*/) << 8); - chi = (sum >> 16) & 1; + uint8_t chi = (sum >> 16) & 1; /* the AND of the low carry and the inverse of the high carry clocks an enable bit */ /* for this sprite; note that the logic in the Turbo schematics is reversed here */ @@ -830,7 +825,6 @@ void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) int xscale = rambase[2] ^ 0xff; int yscale = rambase[3];// ^ 0xff; uint16_t offset = rambase[6] + (rambase[7] << 8); - int offs; /* mark this entry enabled */ info->ve |= 1 << sprnum; @@ -838,7 +832,7 @@ void turbo_state::buckrog_prepare_sprites(uint8_t y, sprite_info *info) /* look up the low byte of the sum plus the yscale value in */ /* IC50/PR1119 to determine if we write back the sum of the */ /* offset and the rowbytes this scanline (p. 138) */ - offs = (sum & 0xff) | /* A0-A7 = AL0-AL7 */ + int offs = (sum & 0xff) | /* A0-A7 = AL0-AL7 */ ((yscale & 0x08) << 5); /* A8-A9 = /RO11-/RO12 */ /* one of the bits is selected based on the low 7 bits of yscale */ @@ -870,12 +864,11 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb */ static const uint8_t plb_end[16] = { 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,2 }; uint32_t sprdata = 0; - int level; *plb = 0; /* loop over all live levels */ - for (level = 0; level < 8; level++) + for (int level = 0; level < 8; level++) if (sprinfo->lst & (1 << level)) { /* latch the data and advance the offset */ @@ -887,12 +880,11 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb while (sprinfo->frac[level] >= 0x800000) { uint32_t offs = sprinfo->offset[level]; - uint8_t pixdata; /* bit 0 controls which half of the byte to use */ /* bits 1-13 go to address lines */ /* bit 14 selects which of the two ROMs to read from */ - pixdata = m_spriteroms[(level << 15) | ((offs >> 1) & 0x7fff)] >> ((~offs & 1) * 4); + uint8_t pixdata = m_spriteroms[(level << 15) | ((offs >> 1) & 0x7fff)] >> ((~offs & 1) * 4); sprinfo->latched[level] = sprite_expand[pixdata & 0x0f] << level; sprinfo->plb[level] = (plb_end[pixdata & 0x0f] & 1) << level; @@ -920,16 +912,15 @@ uint32_t turbo_state::buckrog_get_sprite_bits(sprite_info *sprinfo, uint8_t *plb uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap_ind16 &fgpixmap = m_fg_tilemap->pixmap(); - const uint8_t *pr5194 = &m_proms[0x000]; - const uint8_t *pr5198 = &m_proms[0x500]; - const uint8_t *pr5199 = &m_proms[0x700]; - int x, y; + uint8_t const *const pr5194 = &m_proms[0x000]; + uint8_t const *const pr5198 = &m_proms[0x500]; + uint8_t const *const pr5199 = &m_proms[0x700]; /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - const uint16_t *fore = &fgpixmap.pix16(y); - uint16_t *dest = &bitmap.pix16(y); + uint16_t const *const fore = &fgpixmap.pix(y); + uint16_t *const dest = &bitmap.pix(y); sprite_info sprinfo; /* compute the sprite information; we use y-1 since this info was computed during HBLANK */ @@ -937,33 +928,30 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 buckrog_prepare_sprites(y, &sprinfo); /* loop over columns */ - for (x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) + for (int x = 0; x <= cliprect.max_x; x += TURBO_X_SCALE) { - uint8_t foreraw, forebits, cd, plb, star, mux; uint8_t xx = x / TURBO_X_SCALE; - uint16_t he; - uint32_t sprbits; - int palbits, offs, ix; + int offs; /* load the bitmask from the sprite position for both halves of the sprites (p. 143) */ - he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); + uint16_t he = m_sprite_position[xx * 2] | (m_sprite_position[xx * 2 + 1] << 8); /* the AND of the line enable and horizontal enable is clocked and held in LST0-7 (p. 143) */ he &= sprinfo.ve; sprinfo.lst |= he | (he >> 8); /* at this point, do the character lookup and the foreground color table lookup in IC93/PR1598 (SH 5/5)*/ - foreraw = fore[(pr5194[((xx >> 3) - 1) & 0x1f] << 3) | (xx & 0x07)]; + uint8_t foreraw = fore[(pr5194[((xx >> 3) - 1) & 0x1f] << 3) | (xx & 0x07)]; offs = ((foreraw & 0x03) << 0) | /* A0-A1: BIT0-1 */ ((foreraw & 0xf8) >> 1) | /* A2-A6: BANK3-7 */ ((m_buckrog_fchg & 0x03) << 7); /* A7-A9: FCHG0-2 */ - forebits = pr5198[offs]; + uint8_t forebits = pr5198[offs]; /* fetch the STAR bit */ - star = m_buckrog_bitmap_ram[y * 256 + xx]; + uint8_t star = m_buckrog_bitmap_ram[y * 256 + xx]; /* now that we have done all the per-5MHz pixel work, mix the sprites at the scale factor */ - for (ix = 0; ix < TURBO_X_SCALE; ix++) + for (int ix = 0; ix < TURBO_X_SCALE; ix++) { /* iterate over live sprites and update them */ /* the final 32-bit value is: */ @@ -971,9 +959,11 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 /* CDB0-7 = D8 -D15 */ /* CDC0-7 = D16-D23 */ /* CDD0-7 = D24-D31 */ - sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); + uint8_t plb; + uint32_t sprbits = buckrog_get_sprite_bits(&sprinfo, &plb); /* the PLB bits go into an LS148 8-to-1 decoder and become MUX0-3 (PROM board SH 2/10) */ + uint8_t mux; if (plb == 0) mux = 8; else @@ -988,11 +978,12 @@ uint32_t turbo_state::screen_update_buckrog(screen_device &screen, bitmap_ind16 /* MUX then selects one of the sprites and selects CD0-3 */ sprbits = (sprbits >> (mux & 0x07)) & 0x01010101; - cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; + uint8_t cd = (sprbits >> (24-3)) | (sprbits >> (16-2)) | (sprbits >> (8-1)) | sprbits; /* this info goes into an LS148 8-to-3 decoder to determine the priorities (SH 5/5) */ /* priority 7 is if bit 0x80 of the foreground color is 0; CHNG = 0 */ + int palbits; if (!(forebits & 0x80)) { palbits = ((forebits & 0x3c) << 2) | diff --git a/src/mame/video/turrett.cpp b/src/mame/video/turrett.cpp index c03e5ec440b..7672daf96c5 100644 --- a/src/mame/video/turrett.cpp +++ b/src/mame/video/turrett.cpp @@ -44,7 +44,7 @@ uint32_t turrett_state::screen_update(screen_device &screen, bitmap_ind16 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; ++y) { const uint16_t *src = &vram[y * X_VISIBLE + cliprect.min_x]; - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); + uint16_t *dest = &bitmap.pix(y, cliprect.min_x); if (m_video_fade != 0) { diff --git a/src/mame/video/tutankhm.cpp b/src/mame/video/tutankhm.cpp index 9487065e945..f3503f5c802 100644 --- a/src/mame/video/tutankhm.cpp +++ b/src/mame/video/tutankhm.cpp @@ -48,7 +48,7 @@ uint32_t tutankhm_state::screen_update_tutankhm_bootleg(screen_device &screen, b for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x / GALAXIAN_XSCALE; x <= cliprect.max_x / GALAXIAN_XSCALE; x++) { @@ -75,9 +75,9 @@ uint32_t tutankhm_state::screen_update_tutankhm_bootleg(screen_device &screen, b if (m_stars_enabled && enab && (shifted & 0x02) == 0 && (star & 0x80) != 0 && x > 63) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } else if (shifted) @@ -101,7 +101,7 @@ uint32_t tutankhm_state::screen_update_tutankhm_scramble(screen_device &screen, for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dst = &bitmap.pix32(y); + uint32_t *const dst = &bitmap.pix(y); for (int x = cliprect.min_x / GALAXIAN_XSCALE; x <= cliprect.max_x / GALAXIAN_XSCALE; x++) { @@ -392,7 +392,7 @@ void tutankhm_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 if (star_offs >= STAR_RNG_PERIOD) star_offs = 0; if (enable_star && (star & 0x80) != 0) - bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f]; /* second RNG clock: two pixels */ star = m_stars[star_offs++]; @@ -400,8 +400,8 @@ void tutankhm_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, uint3 star_offs = 0; if (enable_star && (star & 0x80) != 0) { - bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; - bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f]; + bitmap.pix(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f]; } } } diff --git a/src/mame/video/twin16.cpp b/src/mame/video/twin16.cpp index a85a9e018b0..d64d6824edc 100644 --- a/src/mame/video/twin16.cpp +++ b/src/mame/video/twin16.cpp @@ -274,7 +274,6 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co { int xpos = source[1]; int ypos = source[2]; - int x,y; int pal_base = ((attributes&0xf)+0x10)*16; int height = 16<<((attributes>>6)&0x3); @@ -335,15 +334,15 @@ void twin16_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, co if( ypos>=256 ) ypos -= 65536; /* slow slow slow, but it's ok for now */ - for( y=0; y<height; y++, pen_data += width/4 ) + for( int y=0; y<height; y++, pen_data += width/4 ) { int sy = (flipy)?(ypos+height-1-y):(ypos+y); if( sy>=cliprect.min_y && sy<=cliprect.max_y ) { - uint16_t *dest = &bitmap.pix16(sy); - uint8_t *pdest = &screen.priority().pix8(sy); + uint16_t *const dest = &bitmap.pix(sy); + uint8_t *const pdest = &screen.priority().pix(sy); - for( x=0; x<width; x++ ) + for( int x=0; x<width; x++ ) { int sx = (flipx)?(xpos+width-1-x):(xpos+x); if( sx>=cliprect.min_x && sx<=cliprect.max_x ) diff --git a/src/mame/video/tx0.cpp b/src/mame/video/tx0.cpp index 1e7c5c0a147..a797864d4a0 100644 --- a/src/mame/video/tx0.cpp +++ b/src/mame/video/tx0.cpp @@ -19,7 +19,7 @@ inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } /* @@ -346,13 +346,12 @@ enum void tx0_state::tx0_typewriter_linefeed() { uint8_t buf[typewriter_window_width]; - int y; assert(typewriter_window_width <= m_typewriter_bitmap.width()); assert(typewriter_window_height <= m_typewriter_bitmap.height()); - for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) + for (int y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - std::copy_n(&m_typewriter_bitmap.pix16(y+typewriter_scroll_step, 0), typewriter_window_width, buf); + std::copy_n(&m_typewriter_bitmap.pix(y+typewriter_scroll_step, 0), typewriter_window_width, buf); draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, m_palette->pens()); } diff --git a/src/mame/video/tx1.cpp b/src/mame/video/tx1.cpp index e11b7bb806d..306da618218 100644 --- a/src/mame/video/tx1.cpp +++ b/src/mame/video/tx1.cpp @@ -1123,14 +1123,13 @@ WRITE_LINE_MEMBER(tx1_state::screen_vblank_tx1) void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) { - int x, y; - uint8_t *chr_pal = &m_proms[0x900]; + uint8_t const *const chr_pal = &m_proms[0x900]; int x_offset = screen * 256; - for (y = 0; y < 240; ++y) + for (int y = 0; y < 240; ++y) { - uint16_t *bmp_addr = &bitmap.pix16(y); + uint16_t *bmp_addr = &bitmap.pix(y); uint32_t bmp_offset = y * 768 + x_offset; @@ -1138,7 +1137,7 @@ void tx1_state::tx1_combine_layers(bitmap_ind16 &bitmap, int screen) uint8_t *rod_addr = m_rod_bmp.get() + bmp_offset; uint8_t *obj_addr = m_obj_bmp.get() + bmp_offset; - for (x = 0; x < 256; ++x) + for (int x = 0; x < 256; ++x) { uint8_t out_val; uint32_t char_val = chr_addr[x]; @@ -2918,10 +2917,9 @@ void tx1_state::buggyboy_scolst_w(uint16_t data) void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) { - uint8_t *chr_pal = &m_proms[0x400]; + uint8_t const *const chr_pal = &m_proms[0x400]; uint32_t bmp_stride; uint32_t x_offset; - uint32_t y; if (screen < 0) { @@ -2934,10 +2932,8 @@ void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) x_offset = 256 * screen; } - for (y = 0; y < 240; ++y) + for (uint32_t y = 0; y < 240; ++y) { - uint32_t x; - uint32_t bmp_offset = y * bmp_stride + x_offset; uint8_t *chr_addr = m_chr_bmp.get() + bmp_offset; @@ -2947,9 +2943,9 @@ void tx1_state::bb_combine_layers(bitmap_ind16 &bitmap, int screen) uint32_t sky_en = BIT(m_vregs.sky, 7); uint32_t sky_val = (((m_vregs.sky & 0x7f) + y) >> 2) & 0x3f; - uint16_t *bmp_addr = &bitmap.pix16(y); + uint16_t *bmp_addr = &bitmap.pix(y); - for (x = 0; x < 256; ++x) + for (uint32_t x = 0; x < 256; ++x) { uint32_t out_val; diff --git a/src/mame/video/ultratnk.cpp b/src/mame/video/ultratnk.cpp index b6bd759460c..d5dc308c3d8 100644 --- a/src/mame/video/ultratnk.cpp +++ b/src/mame/video/ultratnk.cpp @@ -122,7 +122,7 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank) for (int y = rect.top(); y <= rect.bottom(); y++) for (int x = rect.left(); x <= rect.right(); x++) - if (m_palette->pen_indirect(m_helper.pix16(y, x)) != BG) + if (m_palette->pen_indirect(m_helper.pix(y, x)) != BG) m_collision[i] = 1; } diff --git a/src/mame/video/usgames.cpp b/src/mame/video/usgames.cpp index b9c65025012..af8721edf66 100644 --- a/src/mame/video/usgames.cpp +++ b/src/mame/video/usgames.cpp @@ -34,7 +34,7 @@ void usgames_state::charram_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW(usgames_state::update_row) { - uint32_t *pix = &bitmap.pix32(y); + uint32_t *pix = &bitmap.pix(y); ra &= 0x07; for (int x = 0; x < x_count; x++) diff --git a/src/mame/video/uv201.cpp b/src/mame/video/uv201.cpp index 4ad0ac9c746..82710b3dcf7 100644 --- a/src/mame/video/uv201.cpp +++ b/src/mame/video/uv201.cpp @@ -81,7 +81,7 @@ ((_y >= cliprect.min_y) && (_y <= cliprect.max_y)) #define DRAW_PIXEL(_scanline, _dot) \ - if (IS_VISIBLE(_scanline)) bitmap.pix32((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; + if (IS_VISIBLE(_scanline)) bitmap.pix((_scanline), HSYNC_WIDTH + HFP_WIDTH + _dot) = m_palette_val[pixel]; diff --git a/src/mame/video/v1050.cpp b/src/mame/video/v1050.cpp index d2f5096562f..b045e93f1c7 100644 --- a/src/mame/video/v1050.cpp +++ b/src/mame/video/v1050.cpp @@ -57,15 +57,13 @@ void v1050_state::videoram_w(offs_t offset, uint8_t data) MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) { - int column, bit; - - for (column = 0; column < x_count; column++) + for (int column = 0; column < x_count; column++) { uint16_t address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column); uint8_t data = m_video_ram[address & V1050_VIDEORAM_MASK]; uint8_t attr = (m_attr & 0xfc) | (m_attr_ram[address] & 0x03); - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; int color = BIT(data, 7); @@ -82,7 +80,7 @@ MC6845_UPDATE_ROW( v1050_state::crtc_update_row ) /* display blank */ if (attr & V1050_ATTR_BLANK) color = 0; - bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); + bitmap.pix(vbp + y, hbp + x) = m_palette->pen(de ? color : 0); data <<= 1; } diff --git a/src/mame/video/vc4000.cpp b/src/mame/video/vc4000.cpp index 5d4c1325266..fa52c41fd20 100644 --- a/src/mame/video/vc4000.cpp +++ b/src/mame/video/vc4000.cpp @@ -382,27 +382,23 @@ static const char led[20][12+1] = void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line) { - static const int digit_to_segment[0x10]={ - 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff - }; + static const int digit_to_segment[0x10]={ 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff }; - int i=line,j; + int i=line; - for (j=0; j<sizeof(led[0])-1; j++) + for (int j=0; j<sizeof(led[0])-1; j++) { if (led[i][j] != ' ' && digit_to_segment[d]&(1<<(led[i][j]-'a')) ) - bitmap.pix16(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; + bitmap.pix(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; } } inline void vc4000_state::vc4000_collision_plot(uint8_t *collision, uint8_t data, uint8_t color, int scale) { - int i,j,m; - - for (j=0,m=0x80; j<8; j++, m>>=1) + for (int j=0, m=0x80; j<8; j++, m>>=1) { if (data&m) - for (i=0; i<scale; i++, collision++) *collision|=color; + for (int i=0; i<scale; i++, collision++) *collision|=color; else collision+=scale; } @@ -576,7 +572,6 @@ inline void vc4000_state::vc4000_draw_grid(uint8_t *collision) INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) { - int x,y,i; uint8_t collision[400]={0}; // better alloca or gcc feature of non constant long automatic arrays const rectangle &visarea = m_screen->visible_area(); assert(ARRAY_LENGTH(collision) >= m_screen->width()); @@ -604,7 +599,7 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) vc4000_draw_grid(collision); /* init object colours */ - for (i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; + for (int i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; /* calculate object colours and OR overlapping object colours */ vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[0]); @@ -612,20 +607,20 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[2]); vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[3]); - for (i=visarea.min_x; i<visarea.max_x; i++) + for (int i=visarea.min_x; i<visarea.max_x; i++) { m_video.sprite_collision|=m_sprite_collision[collision[i]]; m_video.background_collision|=m_background_collision[collision[i]]; /* display final object colours */ if (m_objects[i] < 8) - m_bitmap->pix16(m_video.line, i) = m_objects[i]; + m_bitmap->pix(m_video.line, i) = m_objects[i]; } - y = m_video.reg.d.score_control&1?200:20; + int y = m_video.reg.d.score_control&1?200:20; if ((m_video.line>=y)&&(m_video.line<y+20)) { - x = 60; + int x = 60; vc4000_draw_digit(*m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y); vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); if (m_video.reg.d.score_control&2) x -= 16; diff --git a/src/mame/video/vector06.cpp b/src/mame/video/vector06.cpp index 9acc3d1c823..285583f030a 100644 --- a/src/mame/video/vector06.cpp +++ b/src/mame/video/vector06.cpp @@ -15,36 +15,33 @@ uint32_t vector06_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - uint8_t code1,code2,code3,code4; - uint8_t col; - int y, x, b,draw_y; - uint8_t *ram = m_ram->pointer(); + uint8_t const *const ram = m_ram->pointer(); - u16 width = (m_video_mode) ? 512 : 256; + u16 const width = (m_video_mode) ? 512 : 256; rectangle screen_area(0,width+64-1,0,256+64-1); // fill border color bitmap.fill(m_color_index, screen_area); // draw image - for (x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { // port A of 8255 also used as scroll - draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; - code1 = ram[0x8000 + x*256 + y]; - code2 = ram[0xa000 + x*256 + y]; - code3 = ram[0xc000 + x*256 + y]; - code4 = ram[0xe000 + x*256 + y]; - for (b = 0; b < 8; b++) + int const draw_y = ((255-y-m_keyboard_mask) & 0xff) +32; + uint8_t const code1 = ram[0x8000 + x*256 + y]; + uint8_t const code2 = ram[0xa000 + x*256 + y]; + uint8_t const code3 = ram[0xc000 + x*256 + y]; + uint8_t const code4 = ram[0xe000 + x*256 + y]; + for (int b = 0; b < 8; b++) { - col = BIT(code1, b) * 8 + BIT(code2, b) * 4 + BIT(code3, b)* 2+ BIT(code4, b); + uint8_t const col = BIT(code1, b) * 8 + BIT(code2, b) * 4 + BIT(code3, b)* 2+ BIT(code4, b); if (!m_video_mode) - bitmap.pix16(draw_y, x*8+(7-b)+32) = col; + bitmap.pix(draw_y, x*8+(7-b)+32) = col; else { - bitmap.pix16(draw_y, x*16+(7-b)*2+1+32) = BIT(code2, b) * 2; - bitmap.pix16(draw_y, x*16+(7-b)*2+32) = BIT(code3, b) * 2; + bitmap.pix(draw_y, x*16+(7-b)*2+1+32) = BIT(code2, b) * 2; + bitmap.pix(draw_y, x*16+(7-b)*2+32) = BIT(code3, b) * 2; } } } diff --git a/src/mame/video/vicdual.cpp b/src/mame/video/vicdual.cpp index bbf4c0636cb..a0b0b6a25cd 100644 --- a/src/mame/video/vicdual.cpp +++ b/src/mame/video/vicdual.cpp @@ -38,8 +38,6 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi while (1) { - pen_t pen; - if ((x & 0x07) == 0) { offs_t offs; @@ -55,12 +53,12 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi } /* plot the current pixel */ - pen = (video_data & 0x80) ? rgb_t::white() : rgb_t::black(); - bitmap.pix32(y, x) = pen; + pen_t pen = (video_data & 0x80) ? rgb_t::white() : rgb_t::black(); + bitmap.pix(y, x) = pen; /* next pixel */ - video_data = video_data << 1; - x = x + 1; + video_data <<= 1; + x++; /* end of line? */ if (x == 0) @@ -72,7 +70,7 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi } /* next row */ - y = y + 1; + y++; } } @@ -82,7 +80,7 @@ uint32_t vicdual_state::screen_update_bw(screen_device &screen, bitmap_rgb32 &bi uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t *color_prom = (uint8_t *)m_proms->base(); + uint8_t const *const color_prom = (uint8_t *)m_proms->base(); uint8_t x = 0; uint8_t y = cliprect.min_y; uint8_t video_data = 0; @@ -91,16 +89,13 @@ uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 while (1) { - pen_t pen; - if ((x & 0x07) == 0) { offs_t offs; - uint8_t char_code; /* read the character code */ offs = (y >> 3 << 5) | (x >> 3); - char_code = m_videoram[offs]; + uint8_t char_code = m_videoram[offs]; /* read the appropriate line of the character ram */ offs = (char_code << 3) | (y & 0x07); @@ -116,12 +111,12 @@ uint32_t vicdual_state::screen_update_color(screen_device &screen, bitmap_rgb32 back_pen = choose_pen(x, y, back_pen); /* plot the current pixel */ - pen = (video_data & 0x80) ? fore_pen : back_pen; - bitmap.pix32(y, x) = pen; + pen_t pen = (video_data & 0x80) ? fore_pen : back_pen; + bitmap.pix(y, x) = pen; /* next pixel */ - video_data = video_data << 1; - x = x + 1; + video_data <<= 1; + x++; /* end of line? */ if (x == 0) diff --git a/src/mame/video/victory.cpp b/src/mame/video/victory.cpp index 68545d6016d..c8179b29e18 100644 --- a/src/mame/video/victory.cpp +++ b/src/mame/video/victory.cpp @@ -1095,7 +1095,6 @@ uint32_t victory_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { int bgcollmask = (m_video_control & 4) ? 4 : 7; int count = 0; - int x, y; /* copy the palette from palette RAM */ set_palette(); @@ -1105,15 +1104,15 @@ uint32_t victory_state::screen_update(screen_device &screen, bitmap_ind16 &bitma update_background(); /* blend the bitmaps and do collision detection */ - for (y = 0; y < 256; y++) + for (int y = 0; y < 256; y++) { - uint16_t *scanline = &bitmap.pix16(y); + uint16_t *scanline = &bitmap.pix(y); uint8_t sy = m_scrolly + y; uint8_t *fg = &m_fgbitmap[y * 256]; uint8_t *bg = &m_bgbitmap[sy * 256]; /* do the blending */ - for (x = 0; x < 256; x++) + for (int x = 0; x < 256; x++) { int fpix = *fg++; int bpix = bg[(x + m_scrollx) & 255]; diff --git a/src/mame/video/vindictr.cpp b/src/mame/video/vindictr.cpp index dae56f5d4cd..1cdd69d0ee4 100644 --- a/src/mame/video/vindictr.cpp +++ b/src/mame/video/vindictr.cpp @@ -215,8 +215,8 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -229,7 +229,7 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in MOG3-1 = ~MAT3-1 if MAT6==1 and MSD3==1 */ - int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; + int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; /* upper bit of MO priority signals special rendering and doesn't draw anything */ if (mopriority & 4) @@ -255,8 +255,8 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { diff --git a/src/mame/video/volfied.cpp b/src/mame/video/volfied.cpp index dcee9a9142d..d99365cadcb 100644 --- a/src/mame/video/volfied.cpp +++ b/src/mame/video/volfied.cpp @@ -113,7 +113,7 @@ void volfied_state::refresh_pixel_layer( bitmap_ind16 &bitmap ) else color |= p[x] & 0xf; - bitmap.pix16(y, x - 1) = color; + bitmap.pix(y, x - 1) = color; } p += 512; diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp index f70e2c58b95..3429879e962 100644 --- a/src/mame/video/vtvideo.cpp +++ b/src/mame/video/vtvideo.cpp @@ -595,18 +595,18 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, // Double, 'double_height + double_width', then normal. if (double_width) { - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + (b << 1)) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + (b << 1)) = bit; if (double_height) { - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; - bitmap.pix16(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; + bitmap.pix(1 + y_preset, DOUBLE_x_preset + (b << 1) + 1) = bit; + bitmap.pix(1 + y_preset, DOUBLE_x_preset + (b << 1)) = bit; } } else { - bitmap.pix16(y_preset, x_preset + b) = bit; + bitmap.pix(y_preset, x_preset + b) = bit; } } // for (8 bit) @@ -614,21 +614,21 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, if (double_width) { // double chars: 18 or 20 bits - bitmap.pix16(y_preset, DOUBLE_x_preset + 16) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 17) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 16) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 17) = bit; if (m_columns == 80) { - bitmap.pix16(y_preset, DOUBLE_x_preset + 18) = bit; - bitmap.pix16(y_preset, DOUBLE_x_preset + 19) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 18) = bit; + bitmap.pix(y_preset, DOUBLE_x_preset + 19) = bit; } } else { // normal chars: 9 or 10 bits - bitmap.pix16(y_preset, x_preset + 8) = bit; + bitmap.pix(y_preset, x_preset + 8) = bit; if (m_columns == 80) - bitmap.pix16(y_preset, x_preset + 9) = bit; + bitmap.pix(y_preset, x_preset + 9) = bit; } /* The DEC terminals use a single ROM bitmap font and @@ -652,27 +652,27 @@ void vt100_video_device::display_char(bitmap_ind16 &bitmap, uint8_t code, int x, { if (double_width) { - if (bitmap.pix16(y_preset, DOUBLE_x_preset + b) == fg_intensity) + if (bitmap.pix(y_preset, DOUBLE_x_preset + b) == fg_intensity) { prev_bit = fg_intensity; } else { if (prev_bit == fg_intensity) - bitmap.pix16(y_preset, DOUBLE_x_preset + b) = fg_intensity; + bitmap.pix(y_preset, DOUBLE_x_preset + b) = fg_intensity; prev_bit = back_intensity; } } else { - if (bitmap.pix16(y_preset, x_preset + b) == fg_intensity) + if (bitmap.pix(y_preset, x_preset + b) == fg_intensity) { prev_bit = fg_intensity; } else { if (prev_bit == fg_intensity) - bitmap.pix16(y_preset, x_preset + b) = fg_intensity; + bitmap.pix(y_preset, x_preset + b) = fg_intensity; prev_bit = back_intensity; } } diff --git a/src/mame/video/warpwarp.cpp b/src/mame/video/warpwarp.cpp index 53685316957..d4b05326db0 100644 --- a/src/mame/video/warpwarp.cpp +++ b/src/mame/video/warpwarp.cpp @@ -245,7 +245,7 @@ void warpwarp_state::warpwarp_videoram_w(offs_t offset, uint8_t data) inline void warpwarp_state::plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) { if (cliprect.contains(x, y)) - bitmap.pix16(y, x) = pen; + bitmap.pix(y, x) = pen; } void warpwarp_state::draw_ball(bitmap_ind16 &bitmap, const rectangle &cliprect,pen_t pen) diff --git a/src/mame/video/wecleman.cpp b/src/mame/video/wecleman.cpp index e771a50e8ce..2a7ec37d4cc 100644 --- a/src/mame/video/wecleman.cpp +++ b/src/mame/video/wecleman.cpp @@ -542,29 +542,21 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c }; - const uint8_t *src_ptr; - const pen_t *pal_ptr, *rgb_ptr; - - int scrollx, sy, sx; - int mdy, tdy, i; - - rgb_ptr = m_palette->pens(); + pen_t const *const rgb_ptr = m_palette->pens(); if (priority == 0x02) { // draw sky; each scanline is assumed to be dword aligned - for (sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) + for (int sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) { - uint32_t *dst = &bitmap.pix32(sy+BMP_PAD, BMP_PAD); - uint32_t pix; - uint16_t road; + uint32_t *const dst = &bitmap.pix(sy+BMP_PAD, BMP_PAD); - road = m_roadram[sy]; + uint16_t road = m_roadram[sy]; if ((road>>8) != 0x02) continue; - pix = rgb_ptr[(m_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0]; + uint32_t pix = rgb_ptr[(m_roadram[sy+(YSIZE*2)] & 0xf) + 0x7f0]; - for (sx = 0; sx < DST_WIDTH; sx++) + for (int sx = 0; sx < DST_WIDTH; sx++) dst[sx] = pix; } } @@ -573,23 +565,21 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c // draw road pen_t road_rgb[48]; - for (i=0; i<48; i++) + for (int i=0; i<48; i++) { int color = road_color[i]; road_rgb[i] = color ? rgb_ptr[color] : 0xffffffff; } - for (sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) + for (int sy=cliprect.min_y-BMP_PAD; sy<DST_HEIGHT; sy++) { - uint32_t *dst = &bitmap.pix32(sy+BMP_PAD, BMP_PAD); - uint32_t pix; - uint16_t road; + uint32_t *const dst = &bitmap.pix(sy+BMP_PAD, BMP_PAD); - road = m_roadram[sy]; + uint16_t road = m_roadram[sy]; if ((road>>8) != 0x04) continue; road &= YMASK; - src_ptr = m_gfxdecode->gfx(1)->get_data((road << 3)); + uint8_t const *const src_ptr = m_gfxdecode->gfx(1)->get_data((road << 3)); m_gfxdecode->gfx(1)->get_data((road << 3) + 1); m_gfxdecode->gfx(1)->get_data((road << 3) + 2); m_gfxdecode->gfx(1)->get_data((road << 3) + 3); @@ -597,20 +587,20 @@ void wecleman_state::wecleman_draw_road(bitmap_rgb32 &bitmap, const rectangle &c m_gfxdecode->gfx(1)->get_data((road << 3) + 5); m_gfxdecode->gfx(1)->get_data((road << 3) + 6); m_gfxdecode->gfx(1)->get_data((road << 3) + 7); - mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels(); - tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels(); + int mdy = ((road * MIDCURB_DY) >> 8) * bitmap.rowpixels(); + int tdy = ((road * TOPCURB_DY) >> 8) * bitmap.rowpixels(); - scrollx = m_roadram[sy+YSIZE] + (0x18 - 0xe00); + int scrollx = m_roadram[sy+YSIZE] + (0x18 - 0xe00); - pal_ptr = road_rgb + ((m_roadram[sy+(YSIZE*2)]<<3) & 8); + pen_t const *const pal_ptr = road_rgb + ((m_roadram[sy+(YSIZE*2)]<<3) & 8); - for (sx = 0; sx < DST_WIDTH; sx++, scrollx++) + for (int sx = 0; sx < DST_WIDTH; sx++, scrollx++) { if (scrollx >= 0 && scrollx < XSIZE) { pen_t temp; - pix = src_ptr[scrollx]; + uint32_t pix = src_ptr[scrollx]; dst[sx] = pal_ptr[pix]; temp = pal_ptr[pix + 16]; @@ -643,45 +633,35 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, int tmw_l2, int tmh_l2, // tilemap width and height in log(2) int alpha, int pal_offset ) // alpha(0-3f), # of color codes to shift { - const uint8_t *src_ptr; - uint16_t *tmap_ptr; - uint32_t *dst_base, *dst_ptr; - const pen_t *pal_base, *pal_ptr; - - int tilew, tileh; - int tmskipx, tmskipy, tmscanx, tmmaskx, tmmasky; - int dx, dy; - int i, j, tx, ty; - if (alpha > 0x1f) return; - tilew = gfx->width(); - tileh = gfx->height(); + int const tilew = gfx->width(); + int const tileh = gfx->height(); - tmmaskx = (1<<tmw_l2) - 1; - tmmasky = (1<<tmh_l2) - 1; + int const tmmaskx = (1<<tmw_l2) - 1; + int const tmmasky = (1<<tmh_l2) - 1; scrollx &= ((tilew<<tmw_l2) - 1); scrolly &= ((tileh<<tmh_l2) - 1); - tmskipx = scrollx / tilew; - dx = -(scrollx & (tilew-1)); - tmskipy = scrolly / tileh; - dy = -(scrolly & (tileh-1)); + int tmskipx = scrollx / tilew; + int const dx = -(scrollx & (tilew-1)); + int tmskipy = scrolly / tileh; + int const dy = -(scrolly & (tileh-1)); - dst_base = &bitmap.pix32(y0+dy, x0+dx); + uint32_t *dst_base = &bitmap.pix(y0+dy, x0+dx); - pal_base = m_palette->pens() + pal_offset * gfx->granularity(); + pen_t const *const pal_base = m_palette->pens() + pal_offset * gfx->granularity(); alpha <<= 6; dst_base += 8; - for (i = 0; i < ycount; i++) + for (int i = 0; i < ycount; i++) { - tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2); - tmscanx = tmskipx; + uint16_t const *const tmap_ptr = tm_base + ((tmskipy++ & tmmasky)<<tmw_l2); + int tmscanx = tmskipx; - for (j = 0; j < xcount; j++) + for (int j = 0; j < xcount; j++) { uint16_t tiledata = tmap_ptr[tmscanx++ & tmmaskx]; @@ -691,29 +671,28 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, // Wec Le Mans specific: decodes tile color in EAX uint16_t tile_color = ((tiledata >> 5) & 0x78) + (tiledata >> 12); - src_ptr = gfx->get_data(tile_index); - pal_ptr = pal_base + tile_color * gfx->granularity(); - dst_ptr = dst_base + j * tilew; + uint8_t const *src_ptr = gfx->get_data(tile_index); + pen_t const *const pal_ptr = pal_base + tile_color * gfx->granularity(); + uint32_t *dst_ptr = dst_base + j * tilew; /* alpha case */ if (alpha > 0) { - for (ty = 0; ty < tileh; ty++) + for (int ty = 0; ty < tileh; ty++) { - for (tx = 0; tx < tilew; tx++) + for (int tx = 0; tx < tilew; tx++) { uint8_t srcpix = *src_ptr++; pen_t srcrgb = pal_ptr[srcpix]; uint32_t dstrgb = dst_ptr[tx]; - int sr, sg, sb, dr, dg, db; - sr = (srcrgb >> 3) & 0x1f; - sg = (srcrgb >> 11) & 0x1f; - sb = (srcrgb >> 19) & 0x1f; + int sr = (srcrgb >> 3) & 0x1f; + int sg = (srcrgb >> 11) & 0x1f; + int sb = (srcrgb >> 19) & 0x1f; - dr = (dstrgb >> 3) & 0x1f; - dg = (dstrgb >> 11) & 0x1f; - db = (dstrgb >> 19) & 0x1f; + int dr = (dstrgb >> 3) & 0x1f; + int dg = (dstrgb >> 11) & 0x1f; + int db = (dstrgb >> 19) & 0x1f; dr = (m_t32x32pm[dr - sr + alpha] >> 5) + dr; dg = (m_t32x32pm[dg - sg + alpha] >> 5) + dg; @@ -728,9 +707,9 @@ void wecleman_state::draw_cloud(bitmap_rgb32 &bitmap, /* non-alpha case */ else { - for (ty = 0; ty < tileh; ty++) + for (int ty = 0; ty < tileh; ty++) { - for (tx = 0; tx < tilew; tx++) + for (int tx = 0; tx < tilew; tx++) dst_ptr[tx] = pal_ptr[*src_ptr++]; dst_ptr += bitmap.rowpixels(); } diff --git a/src/mame/video/welltris.cpp b/src/mame/video/welltris.cpp index 3e1c60d8234..f02af708da4 100644 --- a/src/mame/video/welltris.cpp +++ b/src/mame/video/welltris.cpp @@ -85,15 +85,12 @@ void welltris_state::video_start() void welltris_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int pixdata; + for (int y = 0; y < 256; y++) { + for (int x = 0; x < 512 / 2; x++) { + int pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - for (y = 0; y < 256; y++) { - for (x = 0; x < 512 / 2; x++) { - pixdata = m_pixelram[(x & 0xff) + (y & 0xff) * 256]; - - bitmap.pix16(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; - bitmap.pix16(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix(y, (x * 2) + 0) = (pixdata >> 8) + (0x100 * m_pixelpalettebank) + 0x400; + bitmap.pix(y, (x * 2) + 1) = (pixdata & 0xff) + (0x100 * m_pixelpalettebank) + 0x400; } } } diff --git a/src/mame/video/wgp.cpp b/src/mame/video/wgp.cpp index 50d77ff8f8e..f0e7b5c857d 100644 --- a/src/mame/video/wgp.cpp +++ b/src/mame/video/wgp.cpp @@ -453,8 +453,8 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const static inline void bryan2_drawscanline(bitmap_ind16 &bitmap, int x, int y, int length, const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask = 0xff) { - u16 *dsti = &bitmap.pix16(y, x); - u8 *dstp = &priority.pix8(y, x); + u16 *dsti = &bitmap.pix(y, x); + u8 *dstp = &priority.pix(y, x); if (transparent) { @@ -558,8 +558,8 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons x_step += (((0x7f - row_zoom) << 8) & 0xffff); } - u16 *src16 = &srcbitmap.pix16(src_y_index); - u8 *tsrc = &flagsbitmap.pix8(src_y_index); + const u16 *const src16 = &srcbitmap.pix(src_y_index); + const u8 *const tsrc = &flagsbitmap.pix(src_y_index); u16 *dst16 = scanline; if (flags & TILEMAP_DRAW_OPAQUE) diff --git a/src/mame/video/williams.cpp b/src/mame/video/williams.cpp index ec10b269a3e..0ca0c180aad 100644 --- a/src/mame/video/williams.cpp +++ b/src/mame/video/williams.cpp @@ -209,22 +209,21 @@ void williams2_state::video_start() uint32_t williams_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { rgb_t pens[16]; - int x, y; /* precompute the palette */ - for (x = 0; x < 16; x++) + for (int x = 0; x < 16; x++) pens[x] = m_palette->pen_color(m_paletteram[x]); /* loop over rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ - for (x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; dest[x+0] = pens[pix >> 4]; dest[x+1] = pens[pix & 0x0f]; } @@ -249,8 +248,8 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int erase_behind = m_video_control & m_scanline_control[y] & 2; - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* latch a new color0 pen? */ if (m_video_control & m_scanline_control[y] & 1) @@ -259,7 +258,7 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; /* clear behind us if requested */ if (erase_behind) @@ -288,13 +287,13 @@ uint32_t williams2_state::screen_update(screen_device &screen, bitmap_rgb32 &bit /* loop over rows */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; @@ -322,13 +321,13 @@ uint32_t mysticm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma for (int x = 1; x < 16; x++) pens[x] = m_palette->pen_color(color_decode(m_fg_color, 1, y) * 16 + x); - uint8_t *source = &m_videoram[y]; - uint32_t *dest = &bitmap.pix32(y); + uint8_t const *const source = &m_videoram[y]; + uint32_t *const dest = &bitmap.pix(y); /* loop over columns */ for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { - int pix = source[(x/2) * 256]; + int const pix = source[(x/2) * 256]; if (pix & 0xf0) dest[x+0] = pens[pix >> 4]; diff --git a/src/mame/video/wolfpack.cpp b/src/mame/video/wolfpack.cpp index 276f053dca5..ecbaea61e32 100644 --- a/src/mame/video/wolfpack.cpp +++ b/src/mame/video/wolfpack.cpp @@ -163,31 +163,24 @@ void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprec { int count = 0; - int x; - int y; - - - m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, + m_gfxdecode->gfx(3)->transpen(bitmap,cliprect, m_torpedo_pic, 0, 0, 0, 2 * (244 - m_torpedo_h), 224 - m_torpedo_v, 0); - for (y = 16; y < 224 - m_torpedo_v; y++) + for (int y = 16; y < 224 - m_torpedo_v; y++) { - int x1; - int x2; - if (y % 16 == 1) count = (count - 1) & 7; - x1 = 248 - m_torpedo_h - count; - x2 = 248 - m_torpedo_h + count; + int const x1 = 248 - m_torpedo_h - count; + int const x2 = 248 - m_torpedo_h + count; - for (x = 2 * x1; x < 2 * x2; x++) + for (int x = 2 * x1; x < 2 * x2; x++) if (m_LFSR[(m_current_index + 0x300 * y + x) % 0x8000]) - bitmap.pix16(y, x) = 1; + bitmap.pix(y, x) = 1; } } @@ -220,7 +213,7 @@ void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, c { for (int y = cliprect.top(); y <= (std::min)(cliprect.bottom(), 127); y++) { - uint16_t* p = &bitmap.pix16(y); + uint16_t *const p = &bitmap.pix(y); for (int x = cliprect.left(); x <= cliprect.right(); x++) p[x] = palette.pen_indirect(p[x]) | 0x08; @@ -286,7 +279,7 @@ WRITE_LINE_MEMBER(wolfpack_state::screen_vblank) if (y < 0 || y >= m_helper.height()) continue; - if (m_helper.pix16(y, x)) + if (m_helper.pix(y, x)) m_collision = 1; } } diff --git a/src/mame/video/wswan.cpp b/src/mame/video/wswan.cpp index de674a5a738..541e1277f42 100644 --- a/src/mame/video/wswan.cpp +++ b/src/mame/video/wswan.cpp @@ -307,11 +307,11 @@ void wswan_video_device::draw_background() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else { /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } } @@ -320,9 +320,9 @@ void wswan_video_device::draw_background() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -416,10 +416,10 @@ void wswan_video_device::draw_foreground_0() if (col) { // if (m_color_mode) { - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; // } else { // /* Hmmmm, what should we do here... Is this correct?? */ -// m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; +// m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; // } } } @@ -428,9 +428,9 @@ void wswan_video_device::draw_foreground_0() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -525,10 +525,10 @@ void wswan_video_device::draw_foreground_2() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -536,9 +536,9 @@ void wswan_video_device::draw_foreground_2() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -632,10 +632,10 @@ void wswan_video_device::draw_foreground_3() if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -643,9 +643,9 @@ void wswan_video_device::draw_foreground_3() if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } @@ -775,10 +775,10 @@ void wswan_video_device::handle_sprites(int mask) if (col) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else /* Hmmmm, what should we do here... Is this correct?? */ - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; } } else @@ -786,9 +786,9 @@ void wswan_video_device::handle_sprites(int mask) if (col || !(tile_palette & 4)) { if (m_color_mode) - m_bitmap.pix16(m_current_line, x_offset) = m_pal[tile_palette][col]; + m_bitmap.pix(m_current_line, x_offset) = m_pal[tile_palette][col]; else - m_bitmap.pix16(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; + m_bitmap.pix(m_current_line, x_offset) = m_main_palette[m_pal[tile_palette][col]]; } } } diff --git a/src/mame/video/x1.cpp b/src/mame/video/x1.cpp index af20bf5577d..e9946209f01 100644 --- a/src/mame/video/x1.cpp +++ b/src/mame/video/x1.cpp @@ -41,23 +41,23 @@ void x1_state::x1_draw_pixel(bitmap_rgb32 &bitmap, int y, int x, uint16_t pen, u if(width && height) { - bitmap.pix32(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+1+m_xstart) = m_palette->pen(pen); } else if(width) { - bitmap.pix32(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+0+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+1+m_xstart) = m_palette->pen(pen); } else if(height) { - bitmap.pix32(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); - bitmap.pix32(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+0+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+1+m_ystart, x+m_xstart) = m_palette->pen(pen); } else - bitmap.pix32(y+m_ystart, x+m_xstart) = m_palette->pen(pen); + bitmap.pix(y+m_ystart, x+m_xstart) = m_palette->pen(pen); } #define mc6845_h_char_total (m_crtc_vreg[0]) diff --git a/src/mame/video/x68k.cpp b/src/mame/video/x68k.cpp index 170ba8f38da..661a16c55a5 100644 --- a/src/mame/video/x68k.cpp +++ b/src/mame/video/x68k.cpp @@ -51,7 +51,7 @@ rgb_t x68k_state::GGGGGRRRRRBBBBBI(uint32_t raw) inline void x68k_state::plot_pixel(bitmap_rgb32 &bitmap, int x, int y, uint32_t color) { - bitmap.pix32(y, x) = (uint16_t)color; + bitmap.pix(y, x) = (uint16_t)color; } /* bitmap_rgb32* ::x68k_get_gfx_page(int pri,int type) @@ -219,7 +219,7 @@ void x68k_state::draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle r + (((m_tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); // Colour 0 is displayable if the text layer is at the priority level 2 if((m_pcgpalette->pen(colour) & 0xffffff) || ((m_video.reg[1] & 0x0c00) == 0x0800)) - bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); + bitmap.pix(line, pixel) = m_pcgpalette->pen(colour); bit--; if(bit < 0) { @@ -234,17 +234,15 @@ void x68k_state::draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle r bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, uint8_t priority) { int pixel; - int page; uint32_t loc; // location in GVRAM uint32_t lineoffset; uint16_t xscr,yscr; uint16_t colour = 0; int shift; - int scanline; bool blend, ret = false; uint16_t *pal = (uint16_t *)m_gfxpalette->basemem().base(); - for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline + for(int scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline { if(m_crtc->is_1024x1024()) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer { @@ -275,11 +273,11 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui if(colour || (priority == 3)) { if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - bitmap.pix16(scanline, pixel) = colour; - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; } } loc++; @@ -291,7 +289,7 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(m_video.reg[2] & (1 << priority)) { - page = m_video.gfxlayer_pri[priority]; + int page = m_video.gfxlayer_pri[priority]; // adjust for scroll registers switch(m_video.reg[0] & 0x03) { @@ -317,23 +315,23 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(ret) { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + if(blend && bitmap.pix(scanline, pixel)) + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + bitmap.pix(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - m_special.pix16(scanline, pixel) = 0; - bitmap.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; } } - else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix16(scanline, pixel)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix(scanline, pixel)) { - bitmap.pix16(scanline, pixel) = m_special.pix16(scanline, pixel); - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = m_special.pix(scanline, pixel); + m_special.pix(scanline, pixel) = 0; } loc++; loc &= 0x1ff; @@ -363,23 +361,23 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { if(ret) { - if(blend && bitmap.pix16(scanline, pixel)) - bitmap.pix16(scanline, pixel) = ((bitmap.pix16(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; + if(blend && bitmap.pix(scanline, pixel)) + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0x7bde) + ((pal[colour] >> 1) & 0x7bde) + 1; else - bitmap.pix16(scanline, pixel) = (pal[colour] & 0xfffe) + blend; + bitmap.pix(scanline, pixel) = (pal[colour] & 0xfffe) + blend; } else if(((m_video.reg[2] & 0x1800) == 0x1000) && (colour & 1)) - m_special.pix16(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = colour; else { - bitmap.pix16(scanline, pixel) = colour; - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = colour; + m_special.pix(scanline, pixel) = 0; } } - else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix16(scanline, pixel)) + else if(((m_video.reg[2] & 0x1800) == 0x1000) && m_special.pix(scanline, pixel)) { - bitmap.pix16(scanline, pixel) = m_special.pix16(scanline, pixel); - m_special.pix16(scanline, pixel) = 0; + bitmap.pix(scanline, pixel) = m_special.pix(scanline, pixel); + m_special.pix(scanline, pixel) = 0; } loc++; loc &= 0x1ff; @@ -395,7 +393,7 @@ bool x68k_state::draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, ui { colour = m_gvram[lineoffset + loc]; if(colour || (priority == 3)) - bitmap.pix16(scanline, pixel) = colour; + bitmap.pix(scanline, pixel) = colour; loc++; loc &= 0x1ff; } @@ -435,13 +433,13 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) { if((m_video.reg[0] & 0x03) == 3) { - colour = m_gfxbitmap.pix16(scanline, pixel); + colour = m_gfxbitmap.pix(scanline, pixel); if(colour || (m_video.gfx_pri == 2)) - bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI(colour); + bitmap.pix(scanline, pixel) = GGGGGRRRRRBBBBBI(colour); } else if(gfxblend) { - colour = m_gfxbitmap.pix16(scanline, pixel); + colour = m_gfxbitmap.pix(scanline, pixel); if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) blend = true; else @@ -449,14 +447,14 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) if(colour || (m_video.gfx_pri == 2)) { if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0xff7f7f7f) + ((pal555(colour, 6, 11, 1) >> 1) & 0x7f7f7f); else - bitmap.pix32(scanline, pixel) = pal555(colour, 6, 11, 1); + bitmap.pix(scanline, pixel) = pal555(colour, 6, 11, 1); } } else { - colour = m_gfxbitmap.pix16(scanline, pixel) & 0xff; + colour = m_gfxbitmap.pix(scanline, pixel) & 0xff; if(((m_video.reg[2] & 0x1900) == 0x1900) && (m_video.gfx_pri != 2) && (colour & 1)) { blend = true; @@ -467,9 +465,9 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) if((colour && (m_gfxpalette->pen(colour) & 0xffffff)) || (m_video.gfx_pri == 2)) { if(blend) - bitmap.pix32(scanline, pixel) = ((bitmap.pix32(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); + bitmap.pix(scanline, pixel) = ((bitmap.pix(scanline, pixel) >> 1) & 0xff7f7f7f) + ((m_gfxpalette->pen(colour) >> 1) & 0x7f7f7f); else - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); + bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour); } } } @@ -733,9 +731,9 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { - uint8_t colour = m_pcgbitmap.pix16(scanline, pixel) & 0xff; + uint8_t colour = m_pcgbitmap.pix(scanline, pixel) & 0xff; if((colour && (m_pcgpalette->pen(colour) & 0xffffff)) || ((m_video.reg[1] & 0x3000) == 0x2000)) - bitmap.pix32(scanline, pixel) = m_pcgpalette->pen(colour); + bitmap.pix(scanline, pixel) = m_pcgpalette->pen(colour); } } } @@ -757,9 +755,9 @@ uint32_t x68k_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(pixel=m_crtc->hbegin();pixel<=m_crtc->hend();pixel++) { - colour = m_special.pix16(scanline, pixel) & 0xff; + colour = m_special.pix(scanline, pixel) & 0xff; if(colour) - bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour & ~1); + bitmap.pix(scanline, pixel) = m_gfxpalette->pen(colour & ~1); } } } diff --git a/src/mame/video/xavix.cpp b/src/mame/video/xavix.cpp index a276ec4c662..3e5fa11035a 100644 --- a/src/mame/video/xavix.cpp +++ b/src/mame/video/xavix.cpp @@ -754,7 +754,7 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, co if ((col >= cliprect.min_x && col <= cliprect.max_x)) { - uint16_t* zyposptr = &m_zbuffer.pix16(ypos); + uint16_t *const zyposptr = &m_zbuffer.pix(ypos); if (zval >= zyposptr[col]) { @@ -762,7 +762,7 @@ void xavix_state::draw_tile_line(screen_device &screen, bitmap_rgb32 &bitmap, co if ((m_palram_sh[pen] & 0x1f) < 24) // hue values 24-31 are transparent { - uint32_t* yposptr = &bitmap.pix32(ypos); + uint32_t *const yposptr = &bitmap.pix(ypos); yposptr[col] = paldata[pen]; zyposptr[col] = zval; @@ -867,8 +867,8 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, for (int x = 0; x < width; x++) { - uint32_t* yposptr = &bitmap.pix32(y); - uint16_t* zyposptr = &m_zbuffer.pix16(y); + uint32_t *const yposptr = &bitmap.pix(y); + uint16_t *const zyposptr = &m_zbuffer.pix(y); uint8_t dat = 0; for (int i = 0; i < bpp; i++) diff --git a/src/mame/video/xmen.cpp b/src/mame/video/xmen.cpp index 929d5b76cde..913f33100e4 100644 --- a/src/mame/video/xmen.cpp +++ b/src/mame/video/xmen.cpp @@ -106,8 +106,8 @@ uint32_t xmen_state::screen_update_xmen6p_left(screen_device &screen, bitmap_ind { for(int y = 0; y < 32 * 8; y++) { - uint16_t* line_dest = &bitmap.pix16(y); - uint16_t* line_src = &m_screen_left->pix16(y); + uint16_t *const line_dest = &bitmap.pix(y); + uint16_t const *const line_src = &m_screen_left->pix(y); for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; @@ -120,8 +120,8 @@ uint32_t xmen_state::screen_update_xmen6p_right(screen_device &screen, bitmap_in { for(int y = 0; y < 32 * 8; y++) { - uint16_t* line_dest = &bitmap.pix16(y); - uint16_t* line_src = &m_screen_right->pix16(y); + uint16_t *const line_dest = &bitmap.pix(y); + uint16_t const *const line_src = &m_screen_right->pix(y); for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; diff --git a/src/mame/video/xybots.cpp b/src/mame/video/xybots.cpp index a512800da3d..9da142807b9 100644 --- a/src/mame/video/xybots.cpp +++ b/src/mame/video/xybots.cpp @@ -98,8 +98,8 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) for (int y = rect->top(); y <= rect->bottom(); y++) { - uint16_t *mo = &mobitmap.pix16(y); - uint16_t *pf = &bitmap.pix16(y); + uint16_t const *const mo = &mobitmap.pix(y); + uint16_t *const pf = &bitmap.pix(y); for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { @@ -117,9 +117,9 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 else GPC(P3-0) = ~MOCOL3-0 */ - int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) ^ 15; - int pfcolor = (pf[x] >> 4) & 0x0f; - int prien = ((mo[x] & 0x0f) > 1); + int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) ^ 15; + int const pfcolor = (pf[x] >> 4) & 0x0f; + int const prien = ((mo[x] & 0x0f) > 1); if (prien) { diff --git a/src/mame/video/ygv608.cpp b/src/mame/video/ygv608.cpp index a095f703de2..3d7c47724ea 100644 --- a/src/mame/video/ygv608.cpp +++ b/src/mame/video/ygv608.cpp @@ -1221,21 +1221,19 @@ inline void ygv608_device::draw_layer_roz(screen_device &screen, bitmap_ind16 &b void ygv608_device::ygv608_draw_mosaic(bitmap_ind16 &bitmap, const rectangle &cliprect, int n) { - int x, y, mask; - if (n <= 0) { return; } // mask to drop the lowest n-bits - mask = ~((1 << n) - 1); + int const mask = ~((1 << n) - 1); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { - bitmap.pix16(y, x) = bitmap.pix16(y & mask, x & mask); + bitmap.pix(y, x) = bitmap.pix(y & mask, x & mask); } } } diff --git a/src/mame/video/z88.cpp b/src/mame/video/z88.cpp index ce89fb011bb..3619cd33847 100644 --- a/src/mame/video/z88.cpp +++ b/src/mame/video/z88.cpp @@ -15,7 +15,7 @@ inline void z88_state::plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint16_t color) { if (x < Z88_SCREEN_WIDTH) - bitmap.pix16(y, x) = color; + bitmap.pix(y, x) = color; } // convert absolute offset into correct address to get data from diff --git a/src/mame/video/zac2650.cpp b/src/mame/video/zac2650.cpp index 1102d31c7c3..8fdbe48d159 100644 --- a/src/mame/video/zac2650.cpp +++ b/src/mame/video/zac2650.cpp @@ -51,7 +51,6 @@ uint8_t zac2650_state::tinvader_port_0_r() int zac2650_state::SpriteCollision(int first,int second) { int Checksum=0; - int x,y; const rectangle &visarea = m_screen->visible_area(); if((m_s2636_0_ram[first * 0x10 + 10] < 0xf0) && (m_s2636_0_ram[second * 0x10 + 10] < 0xf0)) @@ -70,12 +69,12 @@ int zac2650_state::SpriteCollision(int first,int second) /* Get fingerprint */ - for (x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++) + for (int y = fy; y < fy + m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - Checksum += m_spritebitmap.pix16(y, x); + Checksum += m_spritebitmap.pix(y, x); } } @@ -89,12 +88,12 @@ int zac2650_state::SpriteCollision(int first,int second) /* Remove fingerprint */ - for (x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = fx; x < fx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = fy; y < fy +m_gfxdecode->gfx(expand)->height(); y++) + for (int y = fy; y < fy +m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - Checksum -= m_spritebitmap.pix16(y, x); + Checksum -= m_spritebitmap.pix(y, x); } } @@ -137,7 +136,6 @@ void zac2650_state::video_start() void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - int offs; const rectangle &visarea = m_screen->visible_area(); /* -------------------------------------------------------------- */ @@ -156,7 +154,7 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect // for collision detection checking copybitmap(m_bitmap,bitmap,0,0,0,0,visarea); - for(offs=0;offs<0x50;offs+=0x10) + for(int offs=0;offs<0x50;offs+=0x10) { if((m_s2636_0_ram[offs+10]<0xF0) && (offs!=0x30)) { @@ -164,7 +162,6 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect int expand = ((m_s2636_0_ram[0xc0] & (spriteno*2))!=0) ? 2 : 1; int bx = (m_s2636_0_ram[offs+10] * 4) - 22; int by = (m_s2636_0_ram[offs+12] * 3) + 3; - int x,y; /* Sprite->Background collision detection */ m_gfxdecode->gfx(expand)->transpen(bitmap,cliprect, @@ -173,12 +170,12 @@ void zac2650_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect 0,0, bx,by, 0); - for (x = bx; x < bx + m_gfxdecode->gfx(expand)->width(); x++) + for (int x = bx; x < bx + m_gfxdecode->gfx(expand)->width(); x++) { - for (y = by; y < by +m_gfxdecode->gfx(expand)->height(); y++) + for (int y = by; y < by +m_gfxdecode->gfx(expand)->height(); y++) { if (visarea.contains(x, y)) - if (bitmap.pix16(y, x) != m_bitmap.pix16(y, x)) + if (bitmap.pix(y, x) != m_bitmap.pix(y, x)) { m_CollisionBackground = 0x80; break; diff --git a/src/mame/video/zaxxon.cpp b/src/mame/video/zaxxon.cpp index b85421f90e8..b9985fd4d41 100644 --- a/src/mame/video/zaxxon.cpp +++ b/src/mame/video/zaxxon.cpp @@ -304,7 +304,6 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre int ymask = pixmap.height() - 1; int flipmask = m_flip_screen ? 0xff : 0x00; int flipoffs = m_flip_screen ? 0x38 : 0x40; - int x, y; /* the starting X value is offset by 1 pixel (normal) or 7 pixels */ /* (flipped) due to a delay in the loading */ @@ -314,25 +313,23 @@ void zaxxon_state::draw_background(bitmap_ind16 &bitmap, const rectangle &clipre flipoffs += 7; /* loop over visible rows */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint16_t *dst = &bitmap.pix16(y); - int srcx, srcy, vf; - uint16_t *src; + uint16_t *const dst = &bitmap.pix(y); /* VF = flipped V signals */ - vf = y ^ flipmask; + int vf = y ^ flipmask; /* base of the source row comes from VF plus the scroll value */ /* this is done by the 3 4-bit adders at U56, U74, U75 */ - srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; - src = &pixmap.pix16(srcy & ymask); + int srcy = vf + ((m_bg_position << 1) ^ 0xfff) + 1; + uint16_t const *src = &pixmap.pix(srcy & ymask); /* loop over visible columns */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) { /* start with HF = flipped H signals */ - srcx = x ^ flipmask; + int srcx = x ^ flipmask; if (skew) { /* position within source row is a two-stage addition */ diff --git a/src/mame/video/zx.cpp b/src/mame/video/zx.cpp index d5fd7ef136d..7ce719a7e1c 100644 --- a/src/mame/video/zx.cpp +++ b/src/mame/video/zx.cpp @@ -67,7 +67,7 @@ void zx_state::refresh_w(offs_t offset, uint8_t data) if(m_ula_char_buffer & 0x80) pixels = ~pixels; if(x < 384-8 && y < 311) { - uint16_t *dest = &m_bitmap_render->pix16(y, x); + uint16_t *dest = &m_bitmap_render->pix(y, x); for(int i=0; i<8; i++) *dest++ |= pixels & (0x80 >> i) ? 1 : 0; } diff --git a/src/mame/video/zx8301.cpp b/src/mame/video/zx8301.cpp index 5904091ee2a..3e7e858f1d0 100644 --- a/src/mame/video/zx8301.cpp +++ b/src/mame/video/zx8301.cpp @@ -261,7 +261,7 @@ void zx8301_device::draw_line_mode4(bitmap_rgb32 &bitmap, int y, uint16_t da) int green = BIT(byte_high, 7); int color = (green << 1) | red; - bitmap.pix32(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; + bitmap.pix(y, x++) = PALETTE_ZX8301[ZX8301_COLOR_MODE4[color]]; byte_high <<= 1; byte_low <<= 1; @@ -306,8 +306,8 @@ void zx8301_device::draw_line_mode8(bitmap_rgb32 &bitmap, int y, uint16_t da) flash_color = color; } - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; - bitmap.pix32(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix(y, x++) = PALETTE_ZX8301[color]; + bitmap.pix(y, x++) = PALETTE_ZX8301[color]; byte_high <<= 2; byte_low <<= 2; diff --git a/src/osd/modules/file/posixptty.cpp b/src/osd/modules/file/posixptty.cpp index 5b38acc750a..5ecb37057ad 100644 --- a/src/osd/modules/file/posixptty.cpp +++ b/src/osd/modules/file/posixptty.cpp @@ -19,7 +19,7 @@ #include <unistd.h> #include <cstdlib> -#if defined(__FreeBSD_kernel__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__DragonFly__) #include <termios.h> #include <libutil.h> #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp index 82f70c17672..b8a60aee200 100644 --- a/src/osd/modules/font/font_dwrite.cpp +++ b/src/osd/modules/font/font_dwrite.cpp @@ -146,7 +146,7 @@ HRESULT SaveBitmap2(bitmap_argb32 &bitmap, const WCHAR *filename) uint32_t* pRow = pBitmap.get() + (y * bitmap.width()); for (int x = 0; x < bitmap.width(); x++) { - uint32_t pixel = bitmap.pix32(y, x); + uint32_t pixel = bitmap.pix(y, x); pRow[x] = (pixel == 0xFFFFFFFF) ? rgb_t(0xFF, 0x00, 0x00, 0x00) : rgb_t(0xFF, 0xFF, 0xFF, 0xFF); } } @@ -570,7 +570,7 @@ public: // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &pixels[(y + actbounds.min_y) * bmwidth]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp index a473b71b35a..08c1f076970 100644 --- a/src/osd/modules/font/font_sdl.cpp +++ b/src/osd/modules/font/font_sdl.cpp @@ -174,7 +174,7 @@ bool osd_font_sdl::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_ // copy the rendered character image into it for (int y = 0; y < bitmap.height(); y++) { - std::uint32_t *const dstrow = &bitmap.pix32(y); + std::uint32_t *const dstrow = &bitmap.pix(y); std::uint8_t const *const srcrow = reinterpret_cast<std::uint8_t const *>(drawsurf->pixels) + (y * drawsurf->pitch); for (int x = 0; x < drawsurf->w; x++) diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp index 95f10c0a051..4cb286c9deb 100644 --- a/src/osd/modules/font/font_windows.cpp +++ b/src/osd/modules/font/font_windows.cpp @@ -28,6 +28,7 @@ namespace { + class osd_font_windows : public osd_font { public: @@ -260,7 +261,7 @@ bool osd_font_windows::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, int32_t // copy the bits into it for (int y = 0; y < bitmap.height(); y++) { - uint32_t *dstrow = &bitmap.pix32(y); + uint32_t *dstrow = &bitmap.pix(y); uint8_t *srcrow = &bits[(y + actbounds.min_y) * rowbytes]; for (int x = 0; x < bitmap.width(); x++) { diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 78e3e2f226f..fc653073ecd 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -115,7 +115,7 @@ public: for (int y = 0; y < m_height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &m_frame.pix32(y); + uint32_t *dst = &m_frame.pix(y); for (int x = 0; x < m_width; x++) { @@ -343,7 +343,7 @@ void shaders::render_snapshot(IDirect3DSurface9 *surface) for (int y = 0; y < height; y++) { auto *src = (DWORD *)((BYTE *)rect.pBits + y * rect.Pitch); - uint32_t *dst = &snapshot.pix32(y); + uint32_t *dst = &snapshot.pix(y); for (int x = 0; x < width; x++) { diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 3052d5fcbca..39f11a26d37 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -957,7 +957,7 @@ void renderer_bgfx::update_recording() int i = 0; for (int y = 0; y < m_avi_bitmap.height(); y++) { - uint32_t *dst = &m_avi_bitmap.pix32(y); + uint32_t *dst = &m_avi_bitmap.pix(y); for (int x = 0; x < m_avi_bitmap.width(); x++) { diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index 0444bea3da1..06f2373f5ca 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -507,7 +507,7 @@ public: if (m_info.height == 524/2 || m_info.height == 624/2) { vbi_metadata vbi; - vbi_parse_all(&subbitmap.pix16(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); + vbi_parse_all(&subbitmap.pix(0), subbitmap.rowpixels(), subbitmap.width(), 8, &vbi); vbi_metadata_pack(&m_ldframedata[framenum * VBI_PACKED_BYTES], framenum, &vbi); } @@ -2641,9 +2641,11 @@ static void do_extract_ld(parameters_map ¶ms) report_error(1, "Unable to open file (%s)", output_file_str->second->c_str()); // create the codec configuration - avhuff_decompress_config avconfig; + avhuff_decoder::config avconfig; + bitmap_yuy16 avvideo; std::vector<int16_t> audio_data[16]; uint32_t actsamples; + avconfig.video = &avvideo; avconfig.maxsamples = max_samples_per_frame; avconfig.actsamples = &actsamples; for (int chnum = 0; chnum < ARRAY_LENGTH(audio_data); chnum++) @@ -2659,7 +2661,7 @@ static void do_extract_ld(parameters_map ¶ms) progress(framenum == input_start, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); // set up the fake bitmap for this frame - avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); + avvideo.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); input_chd.codec_configure(CHD_CODEC_AVHUFF, AVHUFF_CODEC_DECOMPRESS_CONFIG, &avconfig); // read the hunk into the buffers diff --git a/src/tools/ldresample.cpp b/src/tools/ldresample.cpp index 57c20f7777c..a7dd165c2f9 100644 --- a/src/tools/ldresample.cpp +++ b/src/tools/ldresample.cpp @@ -237,8 +237,8 @@ static chd_error create_chd(chd_file_compressor &file, const char *filename, chd static bool read_chd(chd_file &file, uint32_t field, movie_info &info, uint32_t soundoffs) { // configure the codec - avhuff_decompress_config avconfig; - avconfig.video.wrap(info.bitmap, info.bitmap.cliprect()); + avhuff_decoder::config avconfig; + avconfig.video = &info.bitmap; avconfig.maxsamples = info.lsound.size(); avconfig.actsamples = &info.samples; avconfig.audio[0] = &info.lsound[soundoffs]; diff --git a/src/tools/ldverify.cpp b/src/tools/ldverify.cpp index deee9afba36..e8df214734c 100644 --- a/src/tools/ldverify.cpp +++ b/src/tools/ldverify.cpp @@ -235,8 +235,10 @@ static int read_chd(void *file, int frame, bitmap_yuy16 &bitmap, int16_t *lsound for (int fieldnum = 0; fieldnum < interlace_factor; fieldnum++) { // make a fake bitmap for this field - avhuff_decompress_config avconfig; - avconfig.video.wrap(&bitmap.pix16(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + bitmap_yuy16 video; + video.wrap(&bitmap.pix(fieldnum), bitmap.width(), bitmap.height() / interlace_factor, bitmap.rowpixels() * interlace_factor); + avhuff_decoder::config avconfig; + avconfig.video = &video; // configure the codec uint32_t numsamples; @@ -320,7 +322,7 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) // parse the VBI data vbi_metadata metadata; - vbi_parse_all(&bitmap.pix16(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); + vbi_parse_all(&bitmap.pix(fieldnum), bitmap.rowpixels() * 2, bitmap.width(), 8, &metadata); // if we have data in both 17 and 18, it should match if (metadata.line17 != 0 && metadata.line18 != 0 && metadata.line17 != metadata.line18) @@ -484,11 +486,11 @@ static void verify_video(video_info &video, int frame, bitmap_yuy16 &bitmap) { for (int x = 16; x < 720 - 16; x++) { - yhisto[bitmap.pix16(y, x) >> 8]++; + yhisto[bitmap.pix(y, x) >> 8]++; if (x % 2 == 0) - cbhisto[bitmap.pix16(y, x) & 0xff]++; + cbhisto[bitmap.pix(y, x) & 0xff]++; else - crhisto[bitmap.pix16(y, x) & 0xff]++; + crhisto[bitmap.pix(y, x) & 0xff]++; } pixels += 720 - 16 - 16; } diff --git a/src/tools/pngcmp.cpp b/src/tools/pngcmp.cpp index eb56d4a7ee7..e490d1c6811 100644 --- a/src/tools/pngcmp.cpp +++ b/src/tools/pngcmp.cpp @@ -76,8 +76,6 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img osd_file::error filerr; png_error pngerr; int error = 100; - bool bitmaps_differ; - int x, y; /* open the source image */ filerr = util::core_file::open(imgfile1, OPEN_FLAG_READ, file); @@ -114,15 +112,17 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img } /* if the sizes are different, we differ; otherwise start off assuming we are the same */ + bool bitmaps_differ; bitmaps_differ = (bitmap2.width() != bitmap1.width() || bitmap2.height() != bitmap1.height()); /* compare scanline by scanline */ - for (y = 0; y < bitmap2.height() && !bitmaps_differ; y++) + for (int y = 0; y < bitmap2.height() && !bitmaps_differ; y++) { - uint32_t *base = &bitmap1.pix32(y); - uint32_t *curr = &bitmap2.pix32(y); + uint32_t const *base = &bitmap1.pix(y); + uint32_t const *curr = &bitmap2.pix(y); /* scan the scanline */ + int x; for (x = 0; x < bitmap2.width(); x++) if (*base++ != *curr++) break; @@ -148,16 +148,16 @@ static int generate_png_diff(const std::string& imgfile1, const std::string& img /* now copy and compare each set of bitmaps */ int curheight = std::max(bitmap1.height(), bitmap2.height()); /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(y); - uint32_t *dst2 = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(y); + uint32_t *dst2 = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp index f45351272a7..5bebc733197 100644 --- a/src/tools/regrep.cpp +++ b/src/tools/regrep.cpp @@ -607,7 +607,6 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT]; summary_file *curfile; std::string title("MAME Regressions"); - std::string tempname; int listnum, bucknum; util::core_file::ptr indexfile; int count = 0, total; @@ -686,7 +685,7 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st *buckettailptr[bucknum] = nullptr; /* output header */ - tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); if (!indexfile) { @@ -721,10 +720,9 @@ static int compare_screenshots(summary_file *curfile) bitmap_argb32 bitmaps[MAX_COMPARES]; int unique[MAX_COMPARES]; int numunique = 0; - int listnum; /* iterate over all files and load their bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->status[listnum] == STATUS_SUCCESS) { std::string fullname; @@ -756,6 +754,7 @@ static int compare_screenshots(summary_file *curfile) } /* now find all the different bitmap types */ + int listnum; for (listnum = 0; listnum < list_count; listnum++) { curfile->matchbitmap[listnum] = 0xff; @@ -774,8 +773,8 @@ static int compare_screenshots(summary_file *curfile) /* compare scanline by scanline */ for (int y = 0; y < this_bitmap.height() && !bitmaps_differ; y++) { - uint32_t *base = &base_bitmap.pix32(y); - uint32_t *curr = &this_bitmap.pix32(y); + uint32_t const *base = &base_bitmap.pix(y); + uint32_t const *curr = &this_bitmap.pix(y); /* scan the scanline */ int x; @@ -831,11 +830,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, bitmap_argb32 bitmaps[MAX_COMPARES]; std::string srcimgname; std::string dstfilename; - std::string tempname; bitmap_argb32 finalbitmap; int width, height, maxwidth; int bitmapcount = 0; - int listnum, bmnum; util::core_file::ptr file; osd_file::error filerr; png_error pngerr; @@ -847,10 +844,10 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, srcimgname = string_format("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); /* open and load all unique bitmaps */ - for (listnum = 0; listnum < list_count; listnum++) + for (int listnum = 0; listnum < list_count; listnum++) if (curfile->matchbitmap[listnum] == listnum) { - tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); + std::string tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); /* open the source image */ filerr = util::core_file::open(tempname, OPEN_FLAG_READ, file); @@ -871,7 +868,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* determine the size of the final bitmap */ height = width = 0; maxwidth = bitmaps[0].width(); - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { int curwidth; @@ -891,24 +888,23 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir, /* now copy and compare each set of bitmaps */ starty = 0; - for (bmnum = 1; bmnum < bitmapcount; bmnum++) + for (int bmnum = 1; bmnum < bitmapcount; bmnum++) { - bitmap_argb32 &bitmap1 = bitmaps[0]; - bitmap_argb32 &bitmap2 = bitmaps[bmnum]; + bitmap_argb32 const &bitmap1 = bitmaps[0]; + bitmap_argb32 const &bitmap2 = bitmaps[bmnum]; int curheight = std::max(bitmap1.height(), bitmap2.height()); - int x, y; /* iterate over rows in these bitmaps */ - for (y = 0; y < curheight; y++) + for (int y = 0; y < curheight; y++) { - uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr; - uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr; - uint32_t *dst1 = &finalbitmap.pix32(starty + y, 0); - uint32_t *dst2 = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE); - uint32_t *dstdiff = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); + uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr; + uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr; + uint32_t *dst1 = &finalbitmap.pix(starty + y, 0); + uint32_t *dst2 = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE); + uint32_t *dstdiff = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE); /* now iterate over columns */ - for (x = 0; x < maxwidth; x++) + for (int x = 0; x < maxwidth; x++) { int pix1 = -1, pix2 = -2; diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp index b5a175c1d96..a7cae6968c0 100644 --- a/src/tools/unidasm.cpp +++ b/src/tools/unidasm.cpp @@ -73,6 +73,7 @@ using util::BIT; #include "cpu/ie15/ie15dasm.h" #include "cpu/jaguar/jagdasm.h" #include "cpu/ks0164/ks0164d.h" +#include "cpu/lc58/lc58d.h" #include "cpu/lc8670/lc8670dsm.h" #include "cpu/lh5801/5801dasm.h" #include "cpu/lr35902/lr35902d.h" @@ -434,6 +435,7 @@ static const dasm_table_entry dasm_table[] = { "jaguargpu", be, 0, []() -> util::disasm_interface * { return new jaguar_disassembler(jaguar_disassembler::variant::GPU); } }, { "konami", be, 0, []() -> util::disasm_interface * { return new konami_disassembler; } }, { "ks0164", be, 0, []() -> util::disasm_interface * { return new ks0164_disassembler; } }, + { "lc58", be, -1, []() -> util::disasm_interface * { return new lc58_disassembler; } }, { "lc8670", be, 0, []() -> util::disasm_interface * { return new lc8670_disassembler; } }, { "lh5801", le, 0, []() -> util::disasm_interface * { return new lh5801_disassembler; } }, { "lr35902", le, 0, []() -> util::disasm_interface * { return new lr35902_disassembler; } }, |