diff options
Diffstat (limited to 'src/devices')
208 files changed, 2682 insertions, 2783 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) { |