summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-05-24 09:02:08 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-05-24 09:02:08 -0400
commit6c42709c107fe5f0bc74efd426ec7ae2e55560dc (patch)
treef6c1efb8c4d5e114cc4ae3925cc42eac06a7d4dc
parent54d079ab49042249aa1aa4b906f435ecbed41308 (diff)
amiga: Convert screen update routine to RGB32 (nw)
-rw-r--r--src/mame/drivers/amiga.cpp8
-rw-r--r--src/mame/drivers/cubo.cpp1
-rw-r--r--src/mame/includes/amiga.h7
-rw-r--r--src/mame/machine/amiga.cpp7
-rw-r--r--src/mame/video/amiga.cpp35
-rw-r--r--src/mame/video/amigaaga.cpp5
6 files changed, 22 insertions, 41 deletions
diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp
index 766785098e9..d19165cd21c 100644
--- a/src/mame/drivers/amiga.cpp
+++ b/src/mame/drivers/amiga.cpp
@@ -1982,7 +1982,6 @@ void a1200_state::a1200(machine_config &config)
ADDRESS_MAP_BANK(config, "overlay").set_map(&amiga_state::overlay_2mb_map32).set_options(ENDIANNESS_BIG, 32, 22, 0x200000);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
config.device_remove("palette");
@@ -2019,7 +2018,6 @@ void a1200_state::a1200n(machine_config &config)
config.device_remove("screen");
ntsc_video(config);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
m_paula->set_clock(amiga_state::CLK_C1_NTSC);
m_cia_0->set_clock(amiga_state::CLK_E_NTSC);
m_cia_1->set_clock(amiga_state::CLK_E_NTSC);
@@ -2043,7 +2041,6 @@ void a4000_state::a4000(machine_config &config)
ADDRESS_MAP_BANK(config, "overlay").set_map(&amiga_state::overlay_2mb_map32).set_options(ENDIANNESS_BIG, 32, 22, 0x200000);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
config.device_remove("palette");
@@ -2070,7 +2067,6 @@ void a4000_state::a4000n(machine_config &config)
config.device_remove("screen");
ntsc_video(config);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
m_paula->set_clock(amiga_state::CLK_C1_NTSC);
m_cia_0->set_clock(amiga_state::CLK_E_NTSC);
m_cia_1->set_clock(amiga_state::CLK_E_NTSC);
@@ -2094,7 +2090,6 @@ void a4000_state::a400030n(machine_config &config)
config.device_remove("screen");
ntsc_video(config);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
m_paula->set_clock(amiga_state::CLK_C1_NTSC);
m_cia_0->set_clock(amiga_state::CLK_E_NTSC);
m_cia_1->set_clock(amiga_state::CLK_E_NTSC);
@@ -2123,7 +2118,6 @@ void cd32_state::cd32(machine_config &config)
akiko.sda_w_callback().set("i2cmem", FUNC(i2cmem_device::write_sda));
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
config.device_remove("palette");
@@ -2148,7 +2142,6 @@ void cd32_state::cd32n(machine_config &config)
config.device_remove("screen");
ntsc_video(config);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
m_paula->set_clock(amiga_state::CLK_C1_NTSC);
m_cia_0->set_clock(amiga_state::CLK_E_NTSC);
m_cia_1->set_clock(amiga_state::CLK_E_NTSC);
@@ -2173,7 +2166,6 @@ void a4000_state::a4000tn(machine_config &config)
config.device_remove("screen");
ntsc_video(config);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
m_paula->set_clock(amiga_state::CLK_C1_NTSC);
m_cia_0->set_clock(amiga_state::CLK_E_NTSC);
m_cia_1->set_clock(amiga_state::CLK_E_NTSC);
diff --git a/src/mame/drivers/cubo.cpp b/src/mame/drivers/cubo.cpp
index 4d2df329d95..3ccd4f22fc2 100644
--- a/src/mame/drivers/cubo.cpp
+++ b/src/mame/drivers/cubo.cpp
@@ -1051,7 +1051,6 @@ void cubo_state::cubo(machine_config &config)
// video hardware
pal_video(config);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga_aga));
- m_screen->set_palette(finder_base::DUMMY_TAG);
MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga_aga)
diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h
index 72b6d0f56e4..971c30fd287 100644
--- a/src/mame/includes/amiga.h
+++ b/src/mame/includes/amiga.h
@@ -418,7 +418,7 @@ public:
DECLARE_VIDEO_START( amiga_aga );
void amiga_palette(palette_device &palette) const;
- uint32_t screen_update_amiga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_amiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_amiga_aga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void update_screenmode();
@@ -630,7 +630,7 @@ private:
void fetch_bitplane_data(int plane);
int update_ham(int newpix);
void update_display_window();
- void render_scanline(bitmap_ind16 &bitmap, int scanline);
+ void render_scanline(bitmap_rgb32 &bitmap, int scanline);
// AGA video helpers
void aga_palette_write(int color_reg, uint16_t data);
@@ -699,8 +699,7 @@ private:
bool m_diwhigh_valid;
bool m_previous_lof;
- bitmap_ind16 m_flickerfixer;
- bitmap_ind32 m_flickerfixer32;
+ bitmap_rgb32 m_flickerfixer;
uint16_t m_rx_shift;
uint16_t m_tx_shift;
diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp
index f03f2a3374a..70ed2ff292c 100644
--- a/src/mame/machine/amiga.cpp
+++ b/src/mame/machine/amiga.cpp
@@ -298,16 +298,11 @@ TIMER_CALLBACK_MEMBER( amiga_state::scanline_callback )
// render up to this scanline
if (!m_screen->update_partial(scanline))
{
+ bitmap_rgb32 dummy_bitmap;
if (IS_AGA())
- {
- bitmap_rgb32 dummy_bitmap;
aga_render_scanline(dummy_bitmap, scanline);
- }
else
- {
- bitmap_ind16 dummy_bitmap;
render_scanline(dummy_bitmap, scanline);
- }
}
// clock tod (if we actually render this scanline)
diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp
index d6ad936aee3..abd16693a13 100644
--- a/src/mame/video/amiga.cpp
+++ b/src/mame/video/amiga.cpp
@@ -665,7 +665,7 @@ void amiga_state::update_display_window()
*
*************************************/
-void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
+void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline)
{
uint16_t save_color0 = CUSTOM_REG(REG_COLOR00);
int ddf_start_pixel = 0, ddf_stop_pixel = 0;
@@ -673,7 +673,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
int pf1pri = 0, pf2pri = 0;
int planes = 0;
- uint16_t *dst = nullptr;
+ uint32_t *dst = nullptr;
int ebitoffs = 0, obitoffs = 0;
int ecolmask = 0, ocolmask = 0;
int edelay = 0, odelay = 0;
@@ -705,7 +705,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
if ((scanline & 1) ^ lof)
{
// lof matches? then render this scanline
- dst = &bitmap.pix16(scanline);
+ dst = &bitmap.pix32(scanline);
}
else
{
@@ -715,7 +715,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
// otherwise just render the contents of the previous frame's scanline
int shift = (m_previous_lof == lof) ? 1 : 0;
- memcpy(&bitmap.pix16(scanline), &m_flickerfixer.pix16(scanline - shift), amiga_state::SCREEN_WIDTH * 2);
+ std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline));
return;
}
}
@@ -780,7 +780,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
/* clear the target pixels to the background color as a starting point */
if (dst != nullptr)
dst[x*2+0] =
- dst[x*2+1] = CUSTOM_REG(REG_COLOR00);
+ dst[x*2+1] = m_palette->pen(CUSTOM_REG(REG_COLOR00));
/* if we hit the first fetch pixel, reset the counters and latch the delays */
if (x == ddf_start_pixel)
@@ -937,14 +937,14 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
if (sprpix && pf1pri > pri)
{
dst[x*2+0] =
- dst[x*2+1] = CUSTOM_REG(REG_COLOR00 + pix);
+ dst[x*2+1] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + pix));
}
/* playfield has priority */
else
{
dst[x*2+0] =
- dst[x*2+1] = pfpix0;
+ dst[x*2+1] = m_palette->pen(pfpix0);
}
}
@@ -964,9 +964,9 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
/* write out the left pixel */
if (pix)
- dst[x*2+0] = CUSTOM_REG(REG_COLOR00 + pix);
+ dst[x*2+0] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + pix));
else
- dst[x*2+0] = CUSTOM_REG(REG_COLOR00 + m_separate_bitplanes[(CUSTOM_REG(REG_BPLCON2) >> 6) & 1][pfpix0]);
+ dst[x*2+0] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + m_separate_bitplanes[(CUSTOM_REG(REG_BPLCON2) >> 6) & 1][pfpix0]));
/* mask out the sprite if it doesn't have priority */
pix = sprpix & 0x1f;
@@ -980,9 +980,9 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
/* write out the right pixel */
if (pix)
- dst[x*2+1] = CUSTOM_REG(REG_COLOR00 + pix);
+ dst[x*2+1] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + pix));
else
- dst[x*2+1] = CUSTOM_REG(REG_COLOR00 + m_separate_bitplanes[(CUSTOM_REG(REG_BPLCON2) >> 6) & 1][pfpix1]);
+ dst[x*2+1] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + m_separate_bitplanes[(CUSTOM_REG(REG_BPLCON2) >> 6) & 1][pfpix1]));
}
/* single playfield mode */
@@ -995,14 +995,14 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
if (sprpix && pf1pri > pri)
{
dst[x*2+0] =
- dst[x*2+1] = CUSTOM_REG(REG_COLOR00 + pix);
+ dst[x*2+1] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + pix));
}
/* playfield has priority */
else
{
- dst[x*2+0] = CUSTOM_REG(REG_COLOR00 + pfpix0);
- dst[x*2+1] = CUSTOM_REG(REG_COLOR00 + pfpix1);
+ dst[x*2+0] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + pfpix0));
+ dst[x*2+1] = m_palette->pen(CUSTOM_REG(REG_COLOR00 + pfpix1));
}
}
}
@@ -1026,7 +1026,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
// save
if (dst != nullptr)
- memcpy(&m_flickerfixer.pix16(save_scanline), dst, amiga_state::SCREEN_WIDTH * 2);
+ std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline));
#if GUESS_COPPER_OFFSET
if (m_screen->frame_number() % 64 == 0 && scanline == 0)
@@ -1047,8 +1047,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
*
*************************************/
-/* TODO: alg.c requires that this uses RGB32 */
-uint32_t amiga_state::screen_update_amiga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t amiga_state::screen_update_amiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
// sometimes the core tells us to render a bunch of lines to keep up (resolution change, for example)
// this causes trouble for us since it can happen at any time
@@ -1104,7 +1103,6 @@ void amiga_state::pal_video(machine_config &config)
amiga_state::SCREEN_HEIGHT_PAL, amiga_state::VBLANK_PAL, amiga_state::SCREEN_HEIGHT_PAL
);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga));
- m_screen->set_palette(m_palette);
}
void amiga_state::ntsc_video(machine_config &config)
@@ -1117,5 +1115,4 @@ void amiga_state::ntsc_video(machine_config &config)
amiga_state::SCREEN_HEIGHT_NTSC, amiga_state::VBLANK_NTSC, amiga_state::SCREEN_HEIGHT_NTSC
);
m_screen->set_screen_update(FUNC(amiga_state::screen_update_amiga));
- m_screen->set_palette(m_palette);
}
diff --git a/src/mame/video/amigaaga.cpp b/src/mame/video/amigaaga.cpp
index 987cbdeb4ad..46a5d092623 100644
--- a/src/mame/video/amigaaga.cpp
+++ b/src/mame/video/amigaaga.cpp
@@ -81,7 +81,6 @@ VIDEO_START_MEMBER(amiga_state,amiga_aga)
VIDEO_START_CALL_MEMBER( amiga );
m_aga_diwhigh_written = 0;
- m_screen->register_screen_bitmap(m_flickerfixer32);
}
@@ -486,7 +485,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
// otherwise just render the contents of the previous frame's scanline
int shift = (m_previous_lof == lof) ? 1 : 0;
- memcpy(&bitmap.pix32(scanline), &m_flickerfixer32.pix32(scanline - shift), amiga_state::SCREEN_WIDTH * 4);
+ std::copy_n(&m_flickerfixer.pix32(scanline - shift), amiga_state::SCREEN_WIDTH, &bitmap.pix32(scanline));
return;
}
}
@@ -830,7 +829,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
// save
if (dst != nullptr)
- memcpy(&m_flickerfixer32.pix32(save_scanline), dst, amiga_state::SCREEN_WIDTH * 4);
+ std::copy_n(dst, amiga_state::SCREEN_WIDTH, &m_flickerfixer.pix32(save_scanline));
#if GUESS_COPPER_OFFSET
if (m_screen->frame_number() % 64 == 0 && scanline == 0)