various: de-unroll loops in pixel drawing routines, drop scanline_callback (#5308)

* isa_pgc: drop the scanline_callback (nw)

* various: de-unroll loops in pixel drawing routines (nw)
This commit is contained in:
shattered 2019-07-06 22:21:19 +03:00 committed by R. Belmont
parent 79892df498
commit ce5a23d49f
9 changed files with 47 additions and 124 deletions

View File

@ -159,10 +159,6 @@ void isa8_pgc_device::device_add_mconfig(machine_config &config)
m_cpu->set_irq_acknowledge_callback(FUNC(isa8_pgc_device::irq_callback));
#endif
timer_device &scantimer(TIMER(config, "scantimer"));
scantimer.configure_periodic(FUNC(isa8_pgc_device::scanline_callback), attotime::from_hz(60*PGC_TOTAL_VERT));
scantimer.set_start_delay(attotime::from_hz(XTAL(50'000'000)/(2*PGC_HORZ_START)));
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(XTAL(50'000'000)/2,
PGC_TOTAL_HORZ, PGC_HORZ_START, PGC_HORZ_START+PGC_DISP_HORZ,
@ -214,15 +210,12 @@ isa8_pgc_device::isa8_pgc_device(const machine_config &mconfig, device_type type
m_cpu(*this, "maincpu"),
m_screen(*this, PGC_SCREEN_NAME),
m_palette(*this, "palette"),
m_commarea(nullptr), m_vram(nullptr), m_eram(nullptr), m_bitmap(nullptr)
m_commarea(nullptr), m_vram(nullptr), m_eram(nullptr)
{
}
void isa8_pgc_device::device_start()
{
int width = PGC_DISP_HORZ;
int height = PGC_DISP_VERT;
if (m_palette != nullptr && !m_palette->started())
throw device_missing_dependencies();
@ -233,9 +226,6 @@ void isa8_pgc_device::device_start()
m_palette->set_pen_color(i, 0, 0, 0);
}
m_bitmap = std::make_unique<bitmap_ind16>(width, height);
m_bitmap->fill(0);
m_vram = std::make_unique<uint8_t[]>(0x78000);
m_eram = std::make_unique<uint8_t[]>(0x8000);
@ -405,32 +395,21 @@ READ8_MEMBER(isa8_pgc_device::init_r)
return 0; // XXX ignored
}
TIMER_DEVICE_CALLBACK_MEMBER(isa8_pgc_device::scanline_callback)
uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint16_t x, y = m_screen->vpos();
uint16_t *p;
uint8_t *v;
// XXX hpos shifts every frame -- fix
if (y == 0) LOGCMD("scanline_cb frame %d x %.4d y %.3d\n",
(int) m_screen->frame_number(), m_screen->hpos(), y);
if (y < PGC_VERT_START) return;
y -= PGC_VERT_START;
if (y >= PGC_DISP_VERT) return;
// XXX address translation happens in hardware
v = &m_vram[y * 1024];
p = &m_bitmap->pix16(y, 0);
for (x = 0; x < PGC_DISP_HORZ; x++)
for (int y = 0; y < PGC_DISP_VERT; y++)
{
*p++ = *v++;
}
}
// XXX address translation happens in hardware
v = &m_vram[y * 1024];
p = &bitmap.pix16(y + PGC_VERT_START, PGC_HORZ_START);
uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
copybitmap(bitmap, *m_bitmap, 0, 0, PGC_HORZ_START, PGC_VERT_START, cliprect);
for (int x = 0; x < PGC_DISP_HORZ; x++)
{
*p++ = *v++;
}
}
return 0;
}

View File

@ -41,8 +41,6 @@ protected:
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
IRQ_CALLBACK_MEMBER(irq_callback);
@ -68,7 +66,6 @@ private:
std::unique_ptr<uint8_t[]> m_eram;
uint8_t m_stateparam[16];
uint8_t m_lut[256 * 3];
std::unique_ptr<bitmap_ind16> m_bitmap;
int m_accel;
};

View File

@ -823,22 +823,10 @@ uint32_t hp1ll3_device::screen_update(screen_device &screen, bitmap_ind16 &bitma
{
uint16_t const gfx = m_videoram[x];
*p++ = BIT(gfx, 15);
*p++ = BIT(gfx, 14);
*p++ = BIT(gfx, 13);
*p++ = BIT(gfx, 12);
*p++ = BIT(gfx, 11);
*p++ = BIT(gfx, 10);
*p++ = BIT(gfx, 9);
*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 i = 15; i >= 0; i--)
{
*p++ = BIT(gfx, i);
}
}
}

View File

@ -177,14 +177,10 @@ uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
gfx ^= 255;
/* Display a scanline of a character */
*p++ = BIT(gfx, 7) ? fg : bg;
*p++ = BIT(gfx, 6) ? fg : bg;
*p++ = BIT(gfx, 5) ? fg : bg;
*p++ = BIT(gfx, 4) ? fg : bg;
*p++ = BIT(gfx, 3) ? fg : bg;
*p++ = BIT(gfx, 2) ? fg : bg;
*p++ = BIT(gfx, 1) ? fg : bg;
*p++ = BIT(gfx, 0) ? fg : bg;
for (int i = 7; i >= 0; i--)
{
*p++ = BIT(gfx, i) ? fg : bg;
}
*p++ = bg;
}
}

View File

@ -394,26 +394,16 @@ uint32_t bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
for (x = 0; x < 1024 / 8; x += 2)
{
gfx = m_videoram[(x + 1) | (y << 7)];
*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 i = 7; i >= 0; i--)
{
*p++ = BIT(gfx, i);
}
gfx = m_videoram[x | (y << 7)];
*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 i = 7; i >= 0; i--)
{
*p++ = BIT(gfx, i);
}
}
}
return 0;

View File

@ -351,13 +351,10 @@ uint32_t ksm_state::draw_scanline(uint16_t *p, uint16_t offset, uint8_t scanline
if ((scanline > 7 && blink) || ((chr < (0x20 << 3)) && !blink)) gfx = 0;
*p++ = BIT(gfx, 6) ? fg : bg;
*p++ = BIT(gfx, 5) ? fg : bg;
*p++ = BIT(gfx, 4) ? fg : bg;
*p++ = BIT(gfx, 3) ? fg : bg;
*p++ = BIT(gfx, 2) ? fg : bg;
*p++ = BIT(gfx, 1) ? fg : bg;
*p++ = BIT(gfx, 0) ? fg : bg;
for (int i = 6; i >= 0; i--)
{
*p++ = BIT(gfx, i) ? fg : bg;
}
*p++ = bg;
*p++ = bg;
*p++ = bg;

View File

@ -318,14 +318,10 @@ uint32_t eurocom2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
{
gfx = m_p_videoram[page + x];
*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 i = 7; i >= 0; i--)
{
*p++ = BIT(gfx, i);
}
}
}

View File

@ -256,22 +256,10 @@ uint32_t gridcomp_state::screen_update_generic(screen_device &screen, bitmap_ind
{
gfx = m_videoram[x];
*p++ = BIT(gfx, 15);
*p++ = BIT(gfx, 14);
*p++ = BIT(gfx, 13);
*p++ = BIT(gfx, 12);
*p++ = BIT(gfx, 11);
*p++ = BIT(gfx, 10);
*p++ = BIT(gfx, 9);
*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 i = 15; i >= 0; i--)
{
*p++ = BIT(gfx, i);
}
}
}

View File

@ -762,14 +762,10 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
/* Display a scanline of a character */
*p++ = BIT(gfx, 7) ? fg : bg;
*p++ = BIT(gfx, 6) ? fg : bg;
*p++ = BIT(gfx, 5) ? fg : bg;
*p++ = BIT(gfx, 4) ? fg : bg;
*p++ = BIT(gfx, 3) ? fg : bg;
*p++ = BIT(gfx, 2) ? fg : bg;
*p++ = BIT(gfx, 1) ? fg : bg;
*p++ = BIT(gfx, 0) ? fg : bg;
for (int i = 7; i >= 0; i--)
{
*p++ = BIT(gfx, i) ? fg : bg;
}
}
} else {
// text mode
@ -814,14 +810,10 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
fg = 1;
/* Display a scanline of a character */
*p++ = BIT(gfx, 7) ? fg : bg;
*p++ = BIT(gfx, 6) ? fg : bg;
*p++ = BIT(gfx, 5) ? fg : bg;
*p++ = BIT(gfx, 4) ? fg : bg;
*p++ = BIT(gfx, 3) ? fg : bg;
*p++ = BIT(gfx, 2) ? fg : bg;
*p++ = BIT(gfx, 1) ? fg : bg;
*p++ = BIT(gfx, 0) ? fg : bg;
for (int i = 7; i >= 0; i--)
{
*p++ = BIT(gfx, i) ? fg : bg;
}
}
}
}