diff options
author | 2019-07-11 16:29:01 +0200 | |
---|---|---|
committer | 2019-07-11 16:29:14 +0200 | |
commit | 0065559bd72e24e2a3ce5a5d04ea04f4fa5c57c6 (patch) | |
tree | 979f5dea52058682f157010ff0b5a8854aaa6908 | |
parent | 93e53f0b21c06f6a6c962c3c4bbed62957a54ef9 (diff) |
-kinst, sbrkout, uknc, univac: Some simple screen ind16 -> rgb32 conversions, nw
-rw-r--r-- | src/mame/drivers/kinst.cpp | 19 | ||||
-rw-r--r-- | src/mame/drivers/sbrkout.cpp | 8 | ||||
-rw-r--r-- | src/mame/drivers/uknc.cpp | 7 | ||||
-rw-r--r-- | src/mame/drivers/univac.cpp | 46 |
4 files changed, 38 insertions, 42 deletions
diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp index aaa86789fed..69b198b2b00 100644 --- a/src/mame/drivers/kinst.cpp +++ b/src/mame/drivers/kinst.cpp @@ -199,7 +199,8 @@ public: m_rombase(*this, "rombase"), m_maincpu(*this, "maincpu"), m_ata(*this, "ata"), - m_dcs(*this, "dcs") + m_dcs(*this, "dcs"), + m_palette(*this, "palette") { } @@ -221,6 +222,7 @@ private: required_device<mips3_device> m_maincpu; required_device<ata_interface_device> m_ata; required_device<dcs_audio_2k_device> m_dcs; + required_device<palette_device> m_palette; uint32_t *m_video_base; const uint8_t *m_control_map; @@ -231,7 +233,7 @@ private: TIMER_IRQ0_STOP }; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(irq0_start); DECLARE_READ32_MEMBER(control_r); DECLARE_WRITE32_MEMBER(control_w); @@ -313,13 +315,15 @@ void kinst_state::machine_reset() * *************************************/ -uint32_t kinst_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t kinst_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { + const pen_t *pen = m_palette->pens(); + /* loop over rows and copy to the destination */ for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { uint32_t *src = &m_video_base[640/4 * y]; - uint16_t *dest = &bitmap.pix16(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); /* loop over columns */ for (int x = cliprect.min_x; x < cliprect.max_x; x += 2) @@ -327,8 +331,8 @@ uint32_t kinst_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, uint32_t data = *src++; /* store two pixels */ - *dest++ = (data >> 0) & 0x7fff; - *dest++ = (data >> 16) & 0x7fff; + *dest++ = pen[(data >> 0) & 0x7fff]; + *dest++ = pen[(data >> 16) & 0x7fff]; } } return 0; @@ -738,9 +742,8 @@ void kinst_state::kinst(machine_config &config) screen.set_size(320, 240); screen.set_visarea(0, 319, 0, 239); screen.set_screen_update(FUNC(kinst_state::screen_update)); - screen.set_palette("palette"); - PALETTE(config, "palette", palette_device::BGR_555); + PALETTE(config, m_palette, palette_device::BGR_555); /* sound hardware */ DCS_AUDIO_2K(config, m_dcs, 0); diff --git a/src/mame/drivers/sbrkout.cpp b/src/mame/drivers/sbrkout.cpp index 77bc57eea4e..80e44e4804c 100644 --- a/src/mame/drivers/sbrkout.cpp +++ b/src/mame/drivers/sbrkout.cpp @@ -79,7 +79,7 @@ private: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - uint32_t screen_update_sbrkout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_sbrkout(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(scanline_callback); TIMER_CALLBACK_MEMBER(pot_trigger_callback); void update_nmi_state(); @@ -369,14 +369,13 @@ WRITE8_MEMBER(sbrkout_state::sbrkout_videoram_w) * *************************************/ -uint32_t sbrkout_state::screen_update_sbrkout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t sbrkout_state::screen_update_sbrkout(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { uint8_t *videoram = m_videoram; - int ball; m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - for (ball = 2; ball >= 0; ball--) + for (int ball = 2; ball >= 0; ball--) { int code = ((videoram[0x380 + 0x18 + ball * 2 + 1] & 0x80) >> 7); int sx = 31 * 8 - videoram[0x380 + 0x10 + ball * 2]; @@ -581,7 +580,6 @@ void sbrkout_state::sbrkout(machine_config &config) SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MAIN_CLOCK/2, 384, 0, 256, 262, 0, 224); m_screen->set_screen_update(FUNC(sbrkout_state::screen_update_sbrkout)); - m_screen->set_palette(m_palette); PALETTE(config, m_palette, palette_device::MONOCHROME); diff --git a/src/mame/drivers/uknc.cpp b/src/mame/drivers/uknc.cpp index 3a5bfaed28d..21319efbf4c 100644 --- a/src/mame/drivers/uknc.cpp +++ b/src/mame/drivers/uknc.cpp @@ -27,7 +27,7 @@ public: private: virtual void machine_reset() override; virtual void video_start() override; - uint32_t screen_update_uknc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device<k1801vm2_device> m_maincpu; void uknc_mem(address_map &map); @@ -62,7 +62,7 @@ void uknc_state::video_start() { } -uint32_t uknc_state::screen_update_uknc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t uknc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return 0; } @@ -84,8 +84,7 @@ void uknc_state::uknc(machine_config &config) screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ screen.set_size(640, 480); screen.set_visarea(0, 640-1, 0, 480-1); - screen.set_screen_update(FUNC(uknc_state::screen_update_uknc)); - screen.set_palette("palette"); + screen.set_screen_update(FUNC(uknc_state::screen_update)); PALETTE(config, "palette", palette_device::MONOCHROME); } diff --git a/src/mame/drivers/univac.cpp b/src/mame/drivers/univac.cpp index a0b33aabd68..80bd1e3e586 100644 --- a/src/mame/drivers/univac.cpp +++ b/src/mame/drivers/univac.cpp @@ -132,6 +132,7 @@ public: , m_sio(*this, "sio") , m_alarm(*this, "alarm") , m_screen(*this, "screen") + , m_palette(*this, "palette") , m_keyboard(*this, "keyboard") , m_printer(*this, "printer") , m_p_chargen(*this, "chargen") @@ -180,7 +181,7 @@ private: DECLARE_WRITE_LINE_MEMBER(loopback_rxcb_w); DECLARE_WRITE_LINE_MEMBER(porte6_w); - u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void io_map(address_map &map); void mem_map(address_map &map); @@ -195,6 +196,7 @@ private: required_device<z80sio_device> m_sio; required_device<speaker_sound_device> m_alarm; required_device<screen_device> m_screen; + required_device<palette_device> m_palette; required_device<uts_keyboard_port_device> m_keyboard; required_device<rs232_port_device> m_printer; @@ -481,7 +483,7 @@ void univac_state::machine_start() save_item(NAME(m_sio_wrdyb)); } -uint32_t univac_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t univac_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { if (!m_display_enable) { @@ -489,29 +491,29 @@ uint32_t univac_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap return 0; } - u8 y,ra,chr; - uint16_t sy=0,x,ma=0,gfx; + const pen_t *pen = m_palette->pens(); + + uint16_t sy=0,ma=0; m_framecnt++; - for (y = 0; y < 25; y++) + for (u8 y = 0; y < 25; y++) { - for (ra = 0; ra < 14; ra++) + for (u8 ra = 0; ra < 14; ra++) { - uint16_t *p = &bitmap.pix16(sy++); + uint32_t *p = &bitmap.pix32(sy++); - for (x = ma; x < ma + 80; x++) + for (uint16_t x = ma; x < ma + 80; x++) { - chr = ram_r(x ^ m_disp_mask); // bit 7 = rv attribute (or dim, depending on control-page setting) + u8 chr = ram_r(x ^ m_disp_mask); // bit 7 = rv attribute (or dim, depending on control-page setting) - gfx = m_p_chargen[((chr & 0x7f)<<4) | ra]; + uint16_t gfx = m_p_chargen[((chr & 0x7f)<<4) | ra]; // chars 1C, 1D, 1F need special handling if ((chr >= 0x1c) && (chr <= 0x1f) && BIT(gfx, 7)) { gfx &= 0x7f; - // They also blink - if (m_framecnt & 16) + if (m_framecnt & 16) // They also blink gfx = 0; } @@ -520,18 +522,13 @@ uint32_t univac_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap gfx = ~gfx; /* Display a scanline of a character */ - *p++ = BIT(gfx, 8); - *p++ = BIT(gfx, 7); - *p++ = BIT(gfx, 6); - *p++ = BIT(gfx, 5); - *p++ = BIT(gfx, 4); - *p++ = BIT(gfx, 3); - *p++ = BIT(gfx, 2); - *p++ = BIT(gfx, 1); - *p++ = BIT(gfx, 0); + for (int bit = 8; bit >= 0; bit--) + { + *p++ = pen[BIT(gfx, bit)]; + } } } - ma+=80; + ma += 80; } return 0; } @@ -588,9 +585,8 @@ void univac_state::uts20(machine_config &config) /* video hardware */ SCREEN(config, m_screen, SCREEN_TYPE_RASTER, rgb_t::green()); m_screen->set_screen_update(FUNC(univac_state::screen_update)); - m_screen->set_palette("palette"); - PALETTE(config, "palette", palette_device::MONOCHROME); - GFXDECODE(config, "gfxdecode", "palette", gfx_uts); + PALETTE(config, m_palette, palette_device::MONOCHROME); + GFXDECODE(config, "gfxdecode", m_palette, gfx_uts); dp835x_device &crtc(DP835X_A(config, "crtc", 19'980'000)); crtc.set_screen("screen"); |