summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cam900 <dbtlrchl@naver.com>2019-06-05 19:07:25 +0900
committer cam900 <dbtlrchl@naver.com>2019-06-05 19:07:25 +0900
commit435494509540cfc19d42a108581486e64baff107 (patch)
treed238264b36cb62e5ba77f7b790b5e076581f21dc
parent444f79cabb5a3efbc92b4b45e6051da405526340 (diff)
epic12.cpp : Updates
Implement debug VRAM viewer, Reduce unnecessary lines, Simplify handlers, Fix spacings, Remove hardcoded tags, Unnecessary pointers, Use shorter / correct type values
-rw-r--r--src/devices/video/epic12.cpp328
-rw-r--r--src/devices/video/epic12.h110
-rw-r--r--src/devices/video/epic12in.hxx53
-rw-r--r--src/devices/video/epic12pixel.hxx6
-rw-r--r--src/mame/drivers/cv1k.cpp3
5 files changed, 254 insertions, 246 deletions
diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp
index 9d3d4de0ae3..f4e9a70d352 100644
--- a/src/devices/video/epic12.cpp
+++ b/src/devices/video/epic12.cpp
@@ -4,15 +4,17 @@
#include "emu.h"
#include "epic12.h"
-
+#include "screen.h"
DEFINE_DEVICE_TYPE(EPIC12, epic12_device, "epic12", "EPIC12 Blitter")
-epic12_device::epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+epic12_device::epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, EPIC12, tag, owner, clock)
, device_video_interface(mconfig, *this)
, m_ram16(nullptr), m_gfx_size(0), m_bitmaps(nullptr), m_use_ram(nullptr)
- , m_main_ramsize(0), m_main_rammask(0), m_maincpu(nullptr), m_ram16_copy(nullptr), m_work_queue(nullptr)
+ , m_main_ramsize(0), m_main_rammask(0), m_ram16_copy(nullptr), m_work_queue(nullptr)
+ , m_maincpu(*this, finder_base::DUMMY_TAG)
+ , m_port_r_cb(*this)
{
m_is_unsafe = 0;
m_delay_scale = 0;
@@ -32,7 +34,7 @@ epic12_device::epic12_device(const machine_config &mconfig, const char *tag, dev
blit_delay = 0;
}
-TIMER_CALLBACK_MEMBER( epic12_device::blitter_delay_callback )
+TIMER_CALLBACK_MEMBER(epic12_device::blitter_delay_callback)
{
m_blitter_busy = 0;
}
@@ -40,12 +42,21 @@ TIMER_CALLBACK_MEMBER( epic12_device::blitter_delay_callback )
void epic12_device::device_start()
{
+ m_port_r_cb.resolve_safe(0);
+
m_gfx_size = 0x2000 * 0x1000;
- m_bitmaps = std::make_unique<bitmap_rgb32>( 0x2000, 0x1000);
+ m_bitmaps = std::make_unique<bitmap_rgb32>(0x2000, 0x1000);
m_clip = m_bitmaps->cliprect();
- m_clip.set(0, 0x2000-1, 0, 0x1000-1);
+ m_clip.set(0, 0x2000 - 1, 0, 0x1000 - 1);
+
+#ifdef DEBUG_VRAM_VIEWER
+ m_debug_vram_view_en = false;
+ m_prev_screen_width = m_curr_screen_width = screen().width();
+ m_prev_screen_height = m_curr_screen_height = screen().height();
+ m_prev_screen_visarea = m_curr_screen_visarea = screen().visible_area();
+#endif
- m_ram16_copy = std::make_unique<uint16_t[]>(m_main_ramsize/2);
+ m_ram16_copy = std::make_unique<u16[]>(m_main_ramsize / 2);
m_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::blitter_delay_callback),this));
m_blitter_delay_timer->adjust(attotime::never);
@@ -79,26 +90,21 @@ void epic12_device::device_reset()
}
// cache table to avoid divides in blit code, also pre-clamped
- int x,y;
- for (y=0;y<0x40;y++)
+ for (int y = 0; y < 0x40; y++)
{
- for (x=0;x<0x20;x++)
+ for (int x = 0; x < 0x20; x++)
{
- colrtable[x][y] = (x*y) / 0x1f;
- if (colrtable[x][y]>0x1f) colrtable[x][y] = 0x1f;
-
- colrtable_rev[x^0x1f][y] = (x*y) / 0x1f;
- if (colrtable_rev[x^0x1f][y]>0x1f) colrtable_rev[x^0x1f][y] = 0x1f;
+ colrtable[x][y] = std::min((x * y) / 0x1f, 0x1f);
+ colrtable_rev[x ^ 0x1f][y] = std::min((x * y) / 0x1f, 0x1f);
}
}
// preclamped add table
- for (y=0;y<0x20;y++)
+ for (int y = 0; y < 0x20; y++)
{
- for (x=0;x<0x20;x++)
+ for (int x = 0; x < 0x20; x++)
{
- colrtable_add[x][y] = (x+y);
- if (colrtable_add[x][y]>0x1f) colrtable_add[x][y] = 0x1f;
+ colrtable_add[x][y] = std::min((x + y), 0x1f);
}
}
@@ -106,15 +112,15 @@ void epic12_device::device_reset()
}
// todo, get these into the device class without ruining performance
-uint8_t epic12_device::colrtable[0x20][0x40];
-uint8_t epic12_device::colrtable_rev[0x20][0x40];
-uint8_t epic12_device::colrtable_add[0x20][0x20];
-uint64_t epic12_device::blit_delay;
+u8 epic12_device::colrtable[0x20][0x40];
+u8 epic12_device::colrtable_rev[0x20][0x40];
+u8 epic12_device::colrtable_add[0x20][0x20];
+u64 epic12_device::blit_delay;
-inline uint16_t epic12_device::READ_NEXT_WORD(offs_t *addr)
+inline u16 epic12_device::READ_NEXT_WORD(offs_t *addr)
{
-// uint16_t data = space.read_word(*addr); // going through the memory system is 'more correct' but noticeably slower
- uint16_t data = m_use_ram[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
+// u16 data = space.read_word(*addr); // going through the memory system is 'more correct' but noticeably slower
+ const u16 data = m_use_ram[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
*addr += 2;
@@ -122,10 +128,10 @@ inline uint16_t epic12_device::READ_NEXT_WORD(offs_t *addr)
return data;
}
-inline uint16_t epic12_device::COPY_NEXT_WORD(address_space &space, offs_t *addr)
+inline u16 epic12_device::COPY_NEXT_WORD(address_space &space, offs_t *addr)
{
-// uint16_t data = space.read_word(*addr); // going through the memory system is 'more correct' but noticeably slower
- uint16_t data = m_ram16[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
+// u16 data = space.read_word(*addr); // going through the memory system is 'more correct' but noticeably slower
+ const u16 data = m_ram16[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
m_ram16_copy[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)] = data;
*addr += 2;
@@ -137,7 +143,6 @@ inline uint16_t epic12_device::COPY_NEXT_WORD(address_space &space, offs_t *addr
inline void epic12_device::gfx_upload_shadow_copy(address_space &space, offs_t *addr)
{
- uint32_t x,y, dimx,dimy;
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
@@ -145,12 +150,12 @@ inline void epic12_device::gfx_upload_shadow_copy(address_space &space, offs_t *
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
- dimx = (COPY_NEXT_WORD(space, addr) & 0x1fff) + 1;
- dimy = (COPY_NEXT_WORD(space, addr) & 0x0fff) + 1;
+ const u32 dimx = (COPY_NEXT_WORD(space, addr) & 0x1fff) + 1;
+ const u32 dimy = (COPY_NEXT_WORD(space, addr) & 0x0fff) + 1;
- for (y = 0; y < dimy; y++)
+ for (u32 y = 0; y < dimy; y++)
{
- for (x = 0; x < dimx; x++)
+ for (u32 x = 0; x < dimx; x++)
{
COPY_NEXT_WORD(space, addr);
}
@@ -159,9 +164,6 @@ inline void epic12_device::gfx_upload_shadow_copy(address_space &space, offs_t *
inline void epic12_device::gfx_upload(offs_t *addr)
{
- uint32_t x,y, dst_p,dst_x_start,dst_y_start, dimx,dimy;
- uint32_t *dst;
-
// 0x20000000
READ_NEXT_WORD(addr);
READ_NEXT_WORD(addr);
@@ -170,32 +172,30 @@ inline void epic12_device::gfx_upload(offs_t *addr)
READ_NEXT_WORD(addr);
READ_NEXT_WORD(addr);
- dst_x_start = READ_NEXT_WORD(addr);
- dst_y_start = READ_NEXT_WORD(addr);
+ u32 dst_x_start = READ_NEXT_WORD(addr);
+ u32 dst_y_start = READ_NEXT_WORD(addr);
- dst_p = 0;
+ u32 dst_p = 0;
dst_x_start &= 0x1fff;
dst_y_start &= 0x0fff;
- dimx = (READ_NEXT_WORD(addr) & 0x1fff) + 1;
- dimy = (READ_NEXT_WORD(addr) & 0x0fff) + 1;
+ const u32 dimx = (READ_NEXT_WORD(addr) & 0x1fff) + 1;
+ const u32 dimy = (READ_NEXT_WORD(addr) & 0x0fff) + 1;
logerror("GFX COPY: DST %02X,%02X,%03X DIM %02X,%03X\n", dst_p,dst_x_start,dst_y_start, dimx,dimy);
- for (y = 0; y < dimy; y++)
+ for (u32 y = 0; y < dimy; y++)
{
- dst = &m_bitmaps->pix(dst_y_start + y, 0);
+ u32 *dst = &m_bitmaps->pix(dst_y_start + y, 0);
dst += dst_x_start;
- for (x = 0; x < dimx; x++)
+ for (u32 x = 0; x < dimx; x++)
{
- uint16_t pendat = READ_NEXT_WORD(addr);
+ const u16 pendat = READ_NEXT_WORD(addr);
// real hw would upload the gfxword directly, but our VRAM is 32-bit, so convert it.
//dst[dst_x_start + x] = pendat;
- *dst++ = ((pendat&0x8000)<<14) | ((pendat&0x7c00)<<9) | ((pendat&0x03e0)<<6) | ((pendat&0x001f)<<3); // --t- ---- rrrr r--- gggg g--- bbbb b--- format
- //dst[dst_x_start + x] = ((pendat&0x8000)<<14) | ((pendat&0x7c00)<<6) | ((pendat&0x03e0)<<3) | ((pendat&0x001f)<<0); // --t- ---- ---r rrrr ---g gggg ---b bbbb format
-
-
+ *dst++ = ((pendat & 0x8000) << 14) | ((pendat & 0x7c00) << 9) | ((pendat & 0x03e0) << 6) | ((pendat & 0x001f) << 3); // --t- ---- rrrr r--- gggg g--- bbbb b--- format
+ //dst[dst_x_start + x] = ((pendat & 0x8000) << 14) | ((pendat & 0x7c00) << 6) | ((pendat & 0x03e0) << 3) | ((pendat & 0x001f) << 0); // --t- ---- ---r rrrr ---g gggg ---b bbbb format
}
}
}
@@ -203,7 +203,6 @@ inline void epic12_device::gfx_upload(offs_t *addr)
#define draw_params m_bitmaps.get(), &m_clip, &m_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
-
const epic12_device::blitfunction epic12_device::f0_ti1_tr1_blit_funcs[64] =
{
epic12_device::draw_sprite_f0_ti1_tr1_s0_d0, epic12_device::draw_sprite_f0_ti1_tr1_s1_d0, epic12_device::draw_sprite_f0_ti1_tr1_s2_d0, epic12_device::draw_sprite_f0_ti1_tr1_s3_d0, epic12_device::draw_sprite_f0_ti1_tr1_s4_d0, epic12_device::draw_sprite_f0_ti1_tr1_s5_d0, epic12_device::draw_sprite_f0_ti1_tr1_s6_d0, epic12_device::draw_sprite_f0_ti1_tr1_s7_d0,
@@ -253,7 +252,6 @@ const epic12_device::blitfunction epic12_device::f1_ti1_tr0_blit_funcs[64] =
};
-
const epic12_device::blitfunction epic12_device::f0_ti0_tr1_blit_funcs[64] =
{
epic12_device::draw_sprite_f0_ti0_tr1_s0_d0, epic12_device::draw_sprite_f0_ti0_tr1_s1_d0, epic12_device::draw_sprite_f0_ti0_tr1_s2_d0, epic12_device::draw_sprite_f0_ti0_tr1_s3_d0, epic12_device::draw_sprite_f0_ti0_tr1_s4_d0, epic12_device::draw_sprite_f0_ti0_tr1_s5_d0, epic12_device::draw_sprite_f0_ti0_tr1_s6_d0, epic12_device::draw_sprite_f0_ti0_tr1_s7_d0,
@@ -303,46 +301,39 @@ const epic12_device::blitfunction epic12_device::f1_ti0_tr0_blit_funcs[64] =
};
-
inline void epic12_device::gfx_draw_shadow_copy(address_space &space, offs_t *addr)
{
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
- COPY_NEXT_WORD(space, addr); // uint16_t dst_x_start = COPY_NEXT_WORD(space, addr);
- COPY_NEXT_WORD(space, addr); // uint16_t dst_y_start = COPY_NEXT_WORD(space, addr);
- uint16_t w = COPY_NEXT_WORD(space, addr);
- uint16_t h = COPY_NEXT_WORD(space, addr);
+ COPY_NEXT_WORD(space, addr); // const u16 dst_x_start = COPY_NEXT_WORD(space, addr);
+ COPY_NEXT_WORD(space, addr); // const u16 dst_y_start = COPY_NEXT_WORD(space, addr);
+ const u16 w = COPY_NEXT_WORD(space, addr);
+ const u16 h = COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
-
-
// todo, calcualte clipping.
- blit_delay += w*h;
-
+ blit_delay += w * h;
}
-
inline void epic12_device::gfx_draw(offs_t *addr)
{
- int x,y, dimx,dimy, flipx,flipy;//, src_p;
- int trans,blend, s_mode, d_mode;
clr_t tint_clr;
- int tinted = 0;
-
- uint16_t attr = READ_NEXT_WORD(addr);
- uint16_t alpha = READ_NEXT_WORD(addr);
- uint16_t src_x = READ_NEXT_WORD(addr);
- uint16_t src_y = READ_NEXT_WORD(addr);
- uint16_t dst_x_start = READ_NEXT_WORD(addr);
- uint16_t dst_y_start = READ_NEXT_WORD(addr);
- uint16_t w = READ_NEXT_WORD(addr);
- uint16_t h = READ_NEXT_WORD(addr);
- uint16_t tint_r = READ_NEXT_WORD(addr);
- uint16_t tint_gb = READ_NEXT_WORD(addr);
+ bool tinted = false;
+
+ const u16 attr = READ_NEXT_WORD(addr);
+ const u16 alpha = READ_NEXT_WORD(addr);
+ u16 src_x = READ_NEXT_WORD(addr);
+ u16 src_y = READ_NEXT_WORD(addr);
+ const u16 dst_x_start = READ_NEXT_WORD(addr);
+ const u16 dst_y_start = READ_NEXT_WORD(addr);
+ const u16 w = READ_NEXT_WORD(addr);
+ const u16 h = READ_NEXT_WORD(addr);
+ const u16 tint_r = READ_NEXT_WORD(addr);
+ const u16 tint_gb = READ_NEXT_WORD(addr);
// 0: +alpha
// 1: +source
@@ -353,49 +344,47 @@ inline void epic12_device::gfx_draw(offs_t *addr)
// 6: -dest
// 7: *
- d_mode = attr & 0x0007;
- s_mode = (attr & 0x0070) >> 4;
+ const u8 d_mode = attr & 0x0007;
+ const u8 s_mode = (attr & 0x0070) >> 4;
- trans = attr & 0x0100;
- blend = attr & 0x0200;
+ const bool trans = attr & 0x0100;
+ bool blend = attr & 0x0200;
- flipy = attr & 0x0400;
- flipx = attr & 0x0800;
+ const bool flipy = attr & 0x0400;
+ const bool flipx = attr & 0x0800;
- const uint8_t d_alpha = ((alpha & 0x00ff) )>>3;
- const uint8_t s_alpha = ((alpha & 0xff00) >> 8 )>>3;
+ const u8 d_alpha = ((alpha & 0x00ff) ) >> 3;
+ const u8 s_alpha = ((alpha & 0xff00) >> 8) >> 3;
-// src_p = 0;
- src_x = src_x & 0x1fff;
- src_y = src_y & 0x0fff;
+// int src_p = 0;
+ src_x = src_x & 0x1fff;
+ src_y = src_y & 0x0fff;
- x = (dst_x_start & 0x7fff) - (dst_x_start & 0x8000);
- y = (dst_y_start & 0x7fff) - (dst_y_start & 0x8000);
+ const int x = (dst_x_start & 0x7fff) - (dst_x_start & 0x8000);
+ const int y = (dst_y_start & 0x7fff) - (dst_y_start & 0x8000);
- dimx = (w & 0x1fff) + 1;
- dimy = (h & 0x0fff) + 1;
+ const int dimx = (w & 0x1fff) + 1;
+ const int dimy = (h & 0x0fff) + 1;
// convert parameters to clr
-
- tint_to_clr(tint_r & 0x00ff, (tint_gb >> 8) & 0xff, tint_gb & 0xff, &tint_clr);
+ tint_to_clr(tint_r & 0x00ff, (tint_gb >> 8) & 0xff, tint_gb & 0xff, &tint_clr);
/* interestingly this gets set to 0x20 for 'normal' not 0x1f */
- if (tint_clr.r!=0x20)
- tinted = 1;
+ if (tint_clr.r != 0x20)
+ tinted = true;
- if (tint_clr.g!=0x20)
- tinted = 1;
-
- if (tint_clr.b!=0x20)
- tinted = 1;
+ if (tint_clr.g != 0x20)
+ tinted = true;
+ if (tint_clr.b != 0x20)
+ tinted = true;
// surprisingly frequent, need to verify if it produces a worthwhile speedup tho.
- if ((s_mode==0 && s_alpha==0x1f) && (d_mode==4 && d_alpha==0x1f))
- blend = 0;
+ if ((s_mode == 0 && s_alpha == 0x1f) && (d_mode == 4 && d_alpha == 0x1f))
+ blend = false;
if (tinted)
{
@@ -409,7 +398,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f0_ti1_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti1_tr1_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
else
@@ -420,7 +409,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f0_ti1_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti1_tr0_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
}
@@ -434,7 +423,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f1_ti1_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti1_tr1_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
else
@@ -445,14 +434,14 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f1_ti1_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti1_tr0_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
}
}
else
{
- if (blend==0 && tinted==0)
+ if (blend == 0 && tinted == 0)
{
if (!flipx)
{
@@ -481,8 +470,6 @@ inline void epic12_device::gfx_draw(offs_t *addr)
return;
}
-
-
//printf("smode %d dmode %d\n", s_mode, d_mode);
if (!flipx)
@@ -495,7 +482,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f0_ti0_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti0_tr1_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
else
@@ -506,7 +493,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f0_ti0_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f0_ti0_tr0_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
}
@@ -520,7 +507,7 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f1_ti0_tr1_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti0_tr1_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
else
@@ -531,14 +518,12 @@ inline void epic12_device::gfx_draw(offs_t *addr)
}
else
{
- f1_ti0_tr0_blit_funcs[s_mode | (d_mode<<3)](draw_params);
+ f1_ti0_tr0_blit_funcs[s_mode | (d_mode << 3)](draw_params);
}
}
}
}
-
-
}
@@ -549,9 +534,9 @@ void epic12_device::gfx_create_shadow_copy(address_space &space)
while (1)
{
- uint16_t data = COPY_NEXT_WORD(space, &addr);
+ const u16 data = COPY_NEXT_WORD(space, &addr);
- switch( data & 0xf000 )
+ switch (data & 0xf000)
{
case 0x0000:
case 0xf000:
@@ -559,9 +544,9 @@ void epic12_device::gfx_create_shadow_copy(address_space &space)
case 0xc000:
if (COPY_NEXT_WORD(space, &addr)) // cliptype
- m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
+ m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320 - 1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240 - 1);
else
- m_clip.set(0, 0x2000-1, 0, 0x1000-1);
+ m_clip.set(0, 0x2000 - 1, 0, 0x1000 - 1);
break;
case 0x2000:
@@ -585,15 +570,15 @@ void epic12_device::gfx_create_shadow_copy(address_space &space)
void epic12_device::gfx_exec(void)
{
offs_t addr = m_gfx_addr_shadowcopy & 0x1fffffff;
- m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
+ m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320 - 1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240 - 1);
// logerror("GFX EXEC: %08X\n", addr);
while (1)
{
- uint16_t data = READ_NEXT_WORD(&addr);
+ const u16 data = READ_NEXT_WORD(&addr);
- switch( data & 0xf000 )
+ switch (data & 0xf000)
{
case 0x0000:
case 0xf000:
@@ -601,9 +586,9 @@ void epic12_device::gfx_exec(void)
case 0xc000:
if (READ_NEXT_WORD(&addr)) // cliptype
- m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320-1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240-1);
+ m_clip.set(m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_x_shadowcopy + 320 - 1, m_gfx_scroll_1_y_shadowcopy, m_gfx_scroll_1_y_shadowcopy + 240 - 1);
else
- m_clip.set(0, 0x2000-1, 0, 0x1000-1);
+ m_clip.set(0, 0x2000 - 1, 0, 0x1000 - 1);
break;
case 0x2000:
@@ -627,15 +612,15 @@ void epic12_device::gfx_exec(void)
void epic12_device::gfx_exec_unsafe(void)
{
offs_t addr = m_gfx_addr & 0x1fffffff;
- m_clip.set(m_gfx_scroll_1_x, m_gfx_scroll_1_x + 320-1, m_gfx_scroll_1_y, m_gfx_scroll_1_y + 240-1);
+ m_clip.set(m_gfx_scroll_1_x, m_gfx_scroll_1_x + 320 - 1, m_gfx_scroll_1_y, m_gfx_scroll_1_y + 240 - 1);
// logerror("GFX EXEC: %08X\n", addr);
while (1)
{
- uint16_t data = READ_NEXT_WORD(&addr);
+ const u16 data = READ_NEXT_WORD(&addr);
- switch( data & 0xf000 )
+ switch (data & 0xf000)
{
case 0x0000:
case 0xf000:
@@ -643,9 +628,9 @@ void epic12_device::gfx_exec_unsafe(void)
case 0xc000:
if (READ_NEXT_WORD(&addr)) // cliptype
- m_clip.set(m_gfx_scroll_1_x, m_gfx_scroll_1_x + 320-1, m_gfx_scroll_1_y, m_gfx_scroll_1_y + 240-1);
+ m_clip.set(m_gfx_scroll_1_x, m_gfx_scroll_1_x + 320 - 1, m_gfx_scroll_1_y, m_gfx_scroll_1_y + 240 - 1);
else
- m_clip.set(0, 0x2000-1, 0, 0x1000-1);
+ m_clip.set(0, 0x2000 - 1, 0, 0x1000 - 1);
break;
case 0x2000:
@@ -666,7 +651,6 @@ void epic12_device::gfx_exec_unsafe(void)
}
-
void *epic12_device::blit_request_callback(void *param, int threadid)
{
epic12_device *object = reinterpret_cast<epic12_device *>(param);
@@ -676,7 +660,6 @@ void *epic12_device::blit_request_callback(void *param, int threadid)
}
-
void *epic12_device::blit_request_callback_unsafe(void *param, int threadid)
{
epic12_device *object = reinterpret_cast<epic12_device *>(param);
@@ -687,12 +670,12 @@ void *epic12_device::blit_request_callback_unsafe(void *param, int threadid)
}
-READ32_MEMBER( epic12_device::gfx_ready_r )
+u32 epic12_device::gfx_ready_r()
{
return 0x00000010;
}
-READ32_MEMBER( epic12_device::gfx_ready_r_unsafe )
+u32 epic12_device::gfx_ready_r_unsafe()
{
if (m_blitter_busy)
{
@@ -703,9 +686,9 @@ READ32_MEMBER( epic12_device::gfx_ready_r_unsafe )
return 0x00000010;
}
-WRITE32_MEMBER( epic12_device::gfx_exec_w )
+WRITE32_MEMBER(epic12_device::gfx_exec_w)
{
- if ( ACCESSING_BITS_0_7 )
+ if (ACCESSING_BITS_0_7)
{
if (data & 1)
{
@@ -717,7 +700,7 @@ WRITE32_MEMBER( epic12_device::gfx_exec_w )
do
{
result = osd_work_item_wait(m_blitter_request, 1000);
- } while (result==0);
+ } while (result == 0);
osd_work_item_release(m_blitter_request);
}
@@ -742,9 +725,9 @@ WRITE32_MEMBER( epic12_device::gfx_exec_w )
}
-WRITE32_MEMBER( epic12_device::gfx_exec_w_unsafe )
+void epic12_device::gfx_exec_w_unsafe(offs_t offset, u32 data, u32 mem_mask)
{
- if ( ACCESSING_BITS_0_7 )
+ if (ACCESSING_BITS_0_7)
{
if (data & 1)
{
@@ -756,7 +739,7 @@ WRITE32_MEMBER( epic12_device::gfx_exec_w_unsafe )
do
{
result = osd_work_item_wait(m_blitter_request, 1000);
- } while (result==0);
+ } while (result == 0);
osd_work_item_release(m_blitter_request);
}
@@ -779,7 +762,7 @@ WRITE32_MEMBER( epic12_device::gfx_exec_w_unsafe )
}
-void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect )
+void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
if (!m_is_unsafe)
{
@@ -789,7 +772,7 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect
do
{
result = osd_work_item_wait(m_blitter_request, 1000);
- } while (result==0);
+ } while (result == 0);
osd_work_item_release(m_blitter_request);
}
}
@@ -799,6 +782,26 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect
bitmap.fill(0, cliprect);
+#ifdef DEBUG_VRAM_VIEWER
+ int curr_width = m_curr_screen_width;
+ int curr_height = m_curr_screen_height;
+ rectangle curr_visarea = m_curr_screen_visarea;
+
+ if (machine().input().code_pressed_once(KEYCODE_T)) m_debug_vram_view_en = !m_debug_vram_view_en;
+ if (m_debug_vram_view_en)
+ {
+ curr_width = 8192;
+ curr_height = 4096;
+ curr_visarea.set(0, curr_width - 1, 0, curr_height - 1);
+ }
+ if ((m_prev_screen_height != curr_height) || (m_prev_screen_width != curr_width))
+ {
+ screen().configure(curr_width, curr_height, curr_visarea, screen().refresh_attoseconds());
+ m_prev_screen_height = curr_height;
+ m_prev_screen_width = curr_width;
+ }
+#endif
+
scroll_0_x = -m_gfx_scroll_0_x;
scroll_0_y = -m_gfx_scroll_0_y;
// scroll_1_x = -m_gfx_scroll_1_x;
@@ -806,20 +809,21 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect
//printf("SCREEN UPDATE\n %d %d %d %d\n", scroll_0_x, scroll_0_y, scroll_1_x, scroll_1_y);
- copyscrollbitmap(bitmap, *m_bitmaps, 1,&scroll_0_x, 1,&scroll_0_y, cliprect);
+#ifdef DEBUG_VRAM_VIEWER
+ if (m_debug_vram_view_en)
+ copybitmap(bitmap, *m_bitmaps, 0, 0, 0, 0, cliprect);
+ else
+#endif
+ copyscrollbitmap(bitmap, *m_bitmaps, 1, &scroll_0_x, 1, &scroll_0_y, cliprect);
}
-
-
-
-
-READ32_MEMBER( epic12_device::blitter_r )
+READ32_MEMBER(epic12_device::blitter_r)
{
- switch (offset*4)
+ switch (offset * 4)
{
case 0x10:
- return gfx_ready_r(space, offset, mem_mask);
+ return gfx_ready_r();
case 0x24:
return 0xffffffff;
@@ -828,7 +832,7 @@ READ32_MEMBER( epic12_device::blitter_r )
return 0xffffffff;
case 0x50:
- return machine().root_device().ioport(":DSW")->read();
+ return m_port_r_cb();
default:
logerror("unknownblitter_r %08x %08x\n", offset*4, mem_mask);
@@ -838,12 +842,12 @@ READ32_MEMBER( epic12_device::blitter_r )
return 0;
}
-READ32_MEMBER( epic12_device::blitter_r_unsafe )
+READ32_MEMBER(epic12_device::blitter_r_unsafe)
{
- switch (offset*4)
+ switch (offset * 4)
{
case 0x10:
- return gfx_ready_r_unsafe(space, offset, mem_mask);
+ return gfx_ready_r_unsafe();
case 0x24:
return 0xffffffff;
@@ -852,7 +856,7 @@ READ32_MEMBER( epic12_device::blitter_r_unsafe )
return 0xffffffff;
case 0x50:
- return machine().root_device().ioport(":DSW")->read();
+ return m_port_r_cb();
default:
logerror("unknownblitter_r %08x %08x\n", offset*4, mem_mask);
@@ -863,12 +867,12 @@ READ32_MEMBER( epic12_device::blitter_r_unsafe )
}
-WRITE32_MEMBER( epic12_device::blitter_w )
+WRITE32_MEMBER(epic12_device::blitter_w)
{
- switch (offset*4)
+ switch (offset * 4)
{
case 0x04:
- gfx_exec_w(space,offset,data,mem_mask);
+ gfx_exec_w(space, offset, data, mem_mask);
break;
case 0x08:
@@ -894,12 +898,12 @@ WRITE32_MEMBER( epic12_device::blitter_w )
}
}
-WRITE32_MEMBER( epic12_device::blitter_w_unsafe )
+WRITE32_MEMBER(epic12_device::blitter_w_unsafe)
{
- switch (offset*4)
+ switch (offset * 4)
{
case 0x04:
- gfx_exec_w_unsafe(space,offset,data,mem_mask);
+ gfx_exec_w_unsafe(offset, data, mem_mask);
break;
case 0x08:
@@ -947,13 +951,13 @@ void epic12_device::install_handlers(int addr1, int addr2)
space.install_readwrite_handler(addr1, addr2, read , write, 0xffffffffffffffffU);
}
-READ64_MEMBER( epic12_device::fpga_r )
+u64 epic12_device::fpga_r()
{
return 0xff;
}
// todo, store what's written here and checksum it, different microcode probably leads to slightly different blitter timings
-WRITE64_MEMBER( epic12_device::fpga_w )
+void epic12_device::fpga_w(offs_t offset, u64 data, u64 mem_mask)
{
if (ACCESSING_BITS_24_31)
{
diff --git a/src/devices/video/epic12.h b/src/devices/video/epic12.h
index 287dc08ebb3..4f2ea09e571 100644
--- a/src/devices/video/epic12.h
+++ b/src/devices/video/epic12.h
@@ -6,73 +6,74 @@
#pragma once
+#define DEBUG_VRAM_VIEWER 0 // VRAM viewer for debug
class epic12_device : public device_t, public device_video_interface
{
public:
- epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
- void set_rambase(uint16_t* rambase) { m_ram16 = rambase; }
+ template <typename T> void set_cpu(T &&maintag) { m_maincpu.set_tag(std::forward<T>(maintag)); }
+ auto port_r_callback() { return m_port_r_cb.bind(); }
+ void set_rambase(u16* rambase) { m_ram16 = rambase; }
void set_delay_scale(int delay_scale) { m_delay_scale = delay_scale; }
void set_is_unsafe(int is_unsafe) { m_is_unsafe = is_unsafe; }
- void set_cpu_device(cpu_device* maincpu) { m_maincpu = maincpu; }
- inline uint16_t READ_NEXT_WORD(offs_t *addr);
+ inline u16 READ_NEXT_WORD(offs_t *addr);
- void set_mainramsize(int ramsize)
+ void set_mainramsize(size_t ramsize)
{
m_main_ramsize = ramsize;
- m_main_rammask = ramsize-1;
+ m_main_rammask = ramsize - 1;
}
static void *blit_request_callback(void *param, int threadid);
- DECLARE_READ64_MEMBER( fpga_r );
- DECLARE_WRITE64_MEMBER( fpga_w );
+ u64 fpga_r();
+ void fpga_w(offs_t offset, u64 data, u64 mem_mask = ~0);
void draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect);
- uint16_t* m_ram16;
- uint32_t m_gfx_addr;
- uint32_t m_gfx_scroll_0_x, m_gfx_scroll_0_y;
- uint32_t m_gfx_scroll_1_x, m_gfx_scroll_1_y;
+ u16* m_ram16;
+ u32 m_gfx_addr;
+ u32 m_gfx_scroll_0_x, m_gfx_scroll_0_y;
+ u32 m_gfx_scroll_1_x, m_gfx_scroll_1_y;
int m_gfx_size;
std::unique_ptr<bitmap_rgb32> m_bitmaps;
rectangle m_clip;
- uint16_t* m_use_ram;
- int m_main_ramsize; // type D has double the main ram
- int m_main_rammask;
+ u16* m_use_ram;
+ size_t m_main_ramsize; // type D has double the main ram
+ size_t m_main_rammask;
int m_is_unsafe;
int m_delay_scale;
- cpu_device* m_maincpu;
void install_handlers(int addr1, int addr2);
// thread safe mode, with no delays & shadow ram copy
DECLARE_READ32_MEMBER(blitter_r);
DECLARE_WRITE32_MEMBER(blitter_w);
- uint32_t m_gfx_addr_shadowcopy;
- uint32_t m_gfx_scroll_0_x_shadowcopy, m_gfx_scroll_0_y_shadowcopy;
- uint32_t m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_y_shadowcopy;
- std::unique_ptr<uint16_t[]> m_ram16_copy;
+ u32 m_gfx_addr_shadowcopy;
+ u32 m_gfx_scroll_0_x_shadowcopy, m_gfx_scroll_0_y_shadowcopy;
+ u32 m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_y_shadowcopy;
+ std::unique_ptr<u16[]> m_ram16_copy;
inline void gfx_upload_shadow_copy(address_space &space, offs_t *addr);
inline void gfx_create_shadow_copy(address_space &space);
- inline uint16_t COPY_NEXT_WORD(address_space &space, offs_t *addr);
+ inline u16 COPY_NEXT_WORD(address_space &space, offs_t *addr);
inline void gfx_draw_shadow_copy(address_space &space, offs_t *addr);
inline void gfx_upload(offs_t *addr);
inline void gfx_draw(offs_t *addr);
void gfx_exec(void);
- DECLARE_READ32_MEMBER( gfx_ready_r );
- DECLARE_WRITE32_MEMBER( gfx_exec_w );
+ u32 gfx_ready_r();
+ DECLARE_WRITE32_MEMBER(gfx_exec_w);
// for thread unsafe mode with blitter delays, no shadow copy of RAM
DECLARE_READ32_MEMBER(blitter_r_unsafe);
DECLARE_WRITE32_MEMBER(blitter_w_unsafe);
- READ32_MEMBER( gfx_ready_r_unsafe );
- WRITE32_MEMBER( gfx_exec_w_unsafe );
+ u32 gfx_ready_r_unsafe();
+ void gfx_exec_w_unsafe(offs_t offset, u32 data, u32 mem_mask = ~0);
void gfx_exec_unsafe(void);
static void *blit_request_callback_unsafe(void *param, int threadid);
@@ -80,7 +81,7 @@ protected:
struct clr_t
{
// clr_t to r5g5b5
- uint32_t to_pen() const
+ u32 to_pen() const
{
// --t- ---- rrrr r--- gggg g--- bbbb b--- format
return (r << (16 + 3)) | (g << (8 + 3)) | (b << 3);
@@ -90,7 +91,7 @@ protected:
}
- void add_with_clr_mul_fixed(const clr_t &clr0, uint8_t mulfixed_val, const clr_t &mulfixed_clr0)
+ void add_with_clr_mul_fixed(const clr_t &clr0, u8 mulfixed_val, const clr_t &mulfixed_clr0)
{
r = colrtable_add[clr0.r][colrtable[mulfixed_clr0.r][mulfixed_val]];
g = colrtable_add[clr0.g][colrtable[mulfixed_clr0.g][mulfixed_val]];
@@ -111,7 +112,7 @@ protected:
b = colrtable_add[clr0.r][colrtable[clr1.b][clr1.b]];
}
- void add_with_clr_mul_fixed_rev(const clr_t &clr0, uint8_t val, const clr_t &clr1)
+ void add_with_clr_mul_fixed_rev(const clr_t &clr0, u8 val, const clr_t &clr1)
{
r = colrtable_add[clr0.r][colrtable_rev[val][clr1.r]];
g = colrtable_add[clr0.g][colrtable_rev[val][clr1.g]];
@@ -189,14 +190,14 @@ protected:
b = colrtable_rev[clr2.b][clr1.b];
}
- void mul_fixed(uint8_t val, const clr_t &clr0)
+ void mul_fixed(u8 val, const clr_t &clr0)
{
r = colrtable[val][clr0.r];
g = colrtable[val][clr0.g];
b = colrtable[val][clr0.b];
}
- void mul_fixed_rev(uint8_t val, const clr_t &clr0)
+ void mul_fixed_rev(u8 val, const clr_t &clr0)
{
r = colrtable_rev[val][clr0.r];
g = colrtable_rev[val][clr0.g];
@@ -211,34 +212,34 @@ protected:
}
- uint8_t b, g, r, t;
+ u8 b, g, r, t;
};
union colour_t
{
clr_t trgb;
- uint32_t u32;
+ u32 u32;
};
typedef void (*blitfunction)(
bitmap_rgb32 *,
const rectangle *,
- uint32_t *gfx,
+ u32 *gfx,
int src_x,
int src_y,
const int dst_x_start,
const int dst_y_start,
int dimx,
int dimy,
- const int flipy,
- const uint8_t s_alpha,
- const uint8_t d_alpha,
+ const bool flipy,
+ const u8 s_alpha,
+ const u8 d_alpha,
//int tint,
const clr_t *);
#define BLIT_FUNCTION static void
-#define BLIT_PARAMS bitmap_rgb32 *bitmap, const rectangle *clip, uint32_t *gfx, int src_x, int src_y, const int dst_x_start, const int dst_y_start, int dimx, int dimy, const int flipy, const uint8_t s_alpha, const uint8_t d_alpha, const clr_t *tint_clr
+#define BLIT_PARAMS bitmap_rgb32 *bitmap, const rectangle *clip, u32 *gfx, int src_x, int src_y, const int dst_x_start, const int dst_y_start, int dimx, int dimy, const bool flipy, const u8 s_alpha, const u8 d_alpha, const clr_t *tint_clr
BLIT_FUNCTION draw_sprite_f0_ti0_plain(BLIT_PARAMS);
BLIT_FUNCTION draw_sprite_f0_ti0_tr1_s0_d0(BLIT_PARAMS);
@@ -773,9 +774,7 @@ protected:
BLIT_FUNCTION draw_sprite_f1_ti0_tr1_simple(BLIT_PARAMS);
BLIT_FUNCTION draw_sprite_f1_ti0_tr0_simple(BLIT_PARAMS);
-
-
- static inline void pen_to_clr(uint32_t pen, clr_t *clr)
+ static inline void pen_to_clr(u32 pen, clr_t *clr)
{
// --t- ---- rrrr r--- gggg g--- bbbb b--- format
clr->r = (pen >> (16+3));// & 0x1f;
@@ -789,17 +788,14 @@ protected:
};
-
// convert separate r,g,b biases (0..80..ff) to clr_t (-1f..0..1f)
- void tint_to_clr(uint8_t r, uint8_t g, uint8_t b, clr_t *clr)
+ void tint_to_clr(u8 r, u8 g, u8 b, clr_t *clr)
{
clr->r = r>>2;
clr->g = g>>2;
clr->b = b>>2;
};
-
-
// (1|s|d) * s_factor * s + (1|s|d) * d_factor * d
// 0: +alpha
// 1: +source
@@ -810,11 +806,10 @@ protected:
// 6: -dest
// 7: *
-
virtual void device_start() override;
virtual void device_reset() override;
- TIMER_CALLBACK_MEMBER( blitter_delay_callback );
+ TIMER_CALLBACK_MEMBER(blitter_delay_callback);
osd_work_queue *m_work_queue;
osd_work_item *m_blitter_request;
@@ -823,10 +818,21 @@ protected:
emu_timer *m_blitter_delay_timer;
int m_blitter_busy;
- static uint8_t colrtable[0x20][0x40];
- static uint8_t colrtable_rev[0x20][0x40];
- static uint8_t colrtable_add[0x20][0x20];
- static uint64_t blit_delay;
+ // debug vram viewer
+#ifdef DEBUG_VRAM_VIEWER
+ bool m_debug_vram_view_en;
+ int m_prev_screen_width;
+ int m_prev_screen_height;
+ rectangle m_prev_screen_visarea;
+ int m_curr_screen_width;
+ int m_curr_screen_height;
+ rectangle m_curr_screen_visarea;
+#endif
+
+ static u8 colrtable[0x20][0x40];
+ static u8 colrtable_rev[0x20][0x40];
+ static u8 colrtable_add[0x20][0x20];
+ static u64 blit_delay;
static const blitfunction f0_ti1_tr1_blit_funcs[64];
static const blitfunction f0_ti1_tr0_blit_funcs[64];
@@ -836,6 +842,10 @@ protected:
static const blitfunction f0_ti0_tr0_blit_funcs[64];
static const blitfunction f1_ti0_tr1_blit_funcs[64];
static const blitfunction f1_ti0_tr0_blit_funcs[64];
+
+ // internal states
+ required_device<cpu_device> m_maincpu;
+ devcb_read32 m_port_r_cb;
};
diff --git a/src/devices/video/epic12in.hxx b/src/devices/video/epic12in.hxx
index a74249f986e..c43e24cf480 100644
--- a/src/devices/video/epic12in.hxx
+++ b/src/devices/video/epic12in.hxx
@@ -4,8 +4,7 @@
void epic12_device::FUNCNAME(BLIT_PARAMS)
{
- uint32_t* gfx2;
- int y, yf;
+ int yf;
#if REALLY_SIMPLE == 0
colour_t s_clr;
@@ -30,27 +29,26 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
colour_t clr0;
#endif
-
#endif
#if REALLY_SIMPLE == 1
#if TRANSPARENT == 1
- uint32_t pen;
+ u32 pen;
#endif
#else
- uint32_t pen;
+ u32 pen;
#endif
- uint32_t *bmp;
+ u32 *bmp;
#if FLIPX == 1
src_x += (dimx-1);
#endif
- if (flipy) { yf = -1; src_y += (dimy-1); }
- else { yf = +1; }
+ if (flipy) { yf = -1; src_y += (dimy-1); }
+ else { yf = +1; }
int starty = 0;
- const int dst_y_end = dst_y_start+dimy;
+ const int dst_y_end = dst_y_start + dimy;
if (dst_y_start < clip->min_y)
starty = clip->min_y - dst_y_start;
@@ -61,13 +59,13 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
// check things are safe to draw (note, if the source would wrap round an edge of the 0x2000*0x1000 vram we don't draw.. not sure what the hw does anyway)
// ddpdfk triggers this on boss explosions so it needs fixing
#if FLIPX == 1
- if ((src_x &0x1fff) < ((src_x-(dimx-1))&0x1fff))
+ if ((src_x & 0x1fff) < ((src_x-(dimx-1)) & 0x1fff))
{
// popmessage("sprite gets clipped off src_x %04x dimx %04x\n", src_x, dimx);
return;
}
#else
- if ((src_x &0x1fff) > ((src_x+(dimx-1))&0x1fff))
+ if ((src_x & 0x1fff) > ((src_x+(dimx-1)) & 0x1fff))
{
// popmessage("sprite gets clipped off src_x %04x dimx %04x\n", src_x, dimx);
return;
@@ -75,7 +73,7 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
#endif
int startx = 0;
- const int dst_x_end = dst_x_start+dimx;
+ const int dst_x_end = dst_x_start + dimx;
if (dst_x_start < clip->min_x)
startx = clip->min_x - dst_x_start;
@@ -86,7 +84,7 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
// wrong/unsafe slowdown sim
if (dimy > starty && dimx > startx)
{
- blit_delay += (dimy - starty)*(dimx - startx);
+ blit_delay += (dimy - starty) * (dimx - startx);
//printf("delay is now %d\n", blit_delay);
}
@@ -94,48 +92,45 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
#if BLENDED == 1
#if _SMODE == 0
#if _DMODE == 0
- const uint8_t* salpha_table = colrtable[s_alpha];
- const uint8_t* dalpha_table = colrtable[d_alpha];
+ const u8* salpha_table = colrtable[s_alpha];
+ const u8* dalpha_table = colrtable[d_alpha];
#endif
#if _DMODE == 5
- const uint8_t* salpha_table = colrtable[s_alpha];
+ const u8* salpha_table = colrtable[s_alpha];
#endif
#if _DMODE == 1
- const uint8_t* salpha_table = colrtable[s_alpha];
+ const u8* salpha_table = colrtable[s_alpha];
#endif
#endif
#if _SMODE == 2
#if _DMODE == 0
-
- const uint8_t* dalpha_table = colrtable[d_alpha];
+ const u8* dalpha_table = colrtable[d_alpha];
#endif
#endif
#endif
-
-
- for (y = starty; y < dimy; y++)
+ for (int y = starty; y < dimy; y++)
{
bmp = &bitmap->pix(dst_y_start + y, dst_x_start+startx);
- const int ysrc_index = ((src_y + yf * y) & 0x0fff) * 0x2000;
- gfx2 = gfx + ysrc_index;
+ const int ysrc_index = ((src_y + yf * y) & 0x0fff) * 0x2000;
+ u32* gfx2 = gfx + ysrc_index;
#if FLIPX == 1
- gfx2 += (src_x-startx);
+ gfx2 += (src_x - startx);
#else
- gfx2 += (src_x+startx);
+ gfx2 += (src_x + startx);
#endif
#if 1
- const uint32_t* end = bmp+(dimx-startx);
+ const u32* end = bmp + (dimx - startx);
#else
// maybe we can do some SSE type optimizations on larger blocks? right now this just results in more code and slower compiling tho.
const int width = dimx-startx;
- const uint32_t* end = bmp+(width);
+ const u32* end = bmp+(width);
if (width<0) return;
@@ -155,7 +150,7 @@ void epic12_device::FUNCNAME(BLIT_PARAMS)
bigblocks--;
}
#endif
- while (bmp<end)
+ while (bmp < end)
{
#include "epic12pixel.hxx"
}
diff --git a/src/devices/video/epic12pixel.hxx b/src/devices/video/epic12pixel.hxx
index f324e629b97..1cf0c71ceb5 100644
--- a/src/devices/video/epic12pixel.hxx
+++ b/src/devices/video/epic12pixel.hxx
@@ -53,7 +53,6 @@
#if _SMODE == 0
//g_profiler.start(PROFILER_USER7);
-
#if _DMODE == 0
//g_profiler.start(PROFILER_USER1);
// this is used extensively in the games (ingame, futari title screens etc.)
@@ -180,12 +179,11 @@
#endif
#endif
-
#endif
// write result
- *bmp = s_clr.trgb.to_pen()|(pen&0x20000000);
- //*bmp = (s_clr.u32<<3)|(pen&0x20000000); // using the union is actually significantly slower than our to_pen function!
+ *bmp = s_clr.trgb.to_pen() | (pen & 0x20000000);
+ //*bmp = (s_clr.u32 << 3)|(pen & 0x20000000); // using the union is actually significantly slower than our to_pen function!
#endif // END NOT REALLY SIMPLE
diff --git a/src/mame/drivers/cv1k.cpp b/src/mame/drivers/cv1k.cpp
index 6bcc9041821..e7d197a60b4 100644
--- a/src/mame/drivers/cv1k.cpp
+++ b/src/mame/drivers/cv1k.cpp
@@ -451,7 +451,6 @@ INPUT_PORTS_END
void cv1k_state::machine_reset()
{
m_blitter->set_rambase (reinterpret_cast<uint16_t *>(m_ram.target()));
- m_blitter->set_cpu_device (m_maincpu);
m_blitter->set_is_unsafe(machine().root_device().ioport(":BLITCFG")->read());
m_blitter->install_handlers( 0x18000000, 0x18000057 );
m_blitter->reset();
@@ -492,6 +491,8 @@ void cv1k_state::cv1k(machine_config &config)
YMZ770(config, "ymz770", 16.384_MHz_XTAL).add_route(1, "mono", 1.0); // only Right output used, Left is not connected
EPIC12(config, m_blitter, 0);
+ m_blitter->set_cpu(m_maincpu);
+ m_blitter->port_r_callback().set_ioport("DSW");
m_blitter->set_mainramsize(0x800000);
}