fix prev commit again + removed unneeded class member names prefixes

This commit is contained in:
Michaël Banaan Ananas 2014-07-30 20:35:53 +00:00
parent 78e76eea17
commit 71caae4932
4 changed files with 163 additions and 177 deletions

View File

@ -13,61 +13,54 @@ epic12_device::epic12_device(const machine_config &mconfig, const char *tag, dev
{
m_is_unsafe = 0;
m_delay_scale = 0;
m_maincpu = 0;
queue = 0;
blitter_request = 0;
epic12_device_blitter_delay_timer = 0;
blitter_busy = 0;
use_ram = 0;
epic12_device_ram16 = 0;
epic12_device_gfx_addr = 0;
epic12_device_gfx_scroll_0_x = 0;
epic12_device_gfx_scroll_0_y = 0;
epic12_device_gfx_scroll_1_x = 0;
epic12_device_gfx_scroll_1_y = 0;
epic12_device_gfx_size = 0;
epic12_device_gfx_addr_shadowcopy = 0;
epic12_device_gfx_scroll_0_x_shadowcopy = 0;
epic12_device_gfx_scroll_0_y_shadowcopy = 0;
epic12_device_gfx_scroll_1_x_shadowcopy = 0;
epic12_device_gfx_scroll_1_y_shadowcopy = 0;
epic12_device_ram16_copy = 0;
m_blitter_request = 0;
m_blitter_delay_timer = 0;
m_blitter_busy = 0;
m_gfx_addr = 0;
m_gfx_scroll_0_x = 0;
m_gfx_scroll_0_y = 0;
m_gfx_scroll_1_x = 0;
m_gfx_scroll_1_y = 0;
m_gfx_addr_shadowcopy = 0;
m_gfx_scroll_0_x_shadowcopy = 0;
m_gfx_scroll_0_y_shadowcopy = 0;
m_gfx_scroll_1_x_shadowcopy = 0;
m_gfx_scroll_1_y_shadowcopy = 0;
epic12_device_blit_delay = 0;
}
TIMER_CALLBACK_MEMBER( epic12_device::epic12_device_blitter_delay_callback )
TIMER_CALLBACK_MEMBER( epic12_device::blitter_delay_callback )
{
blitter_busy = 0;
m_blitter_busy = 0;
}
void epic12_device::device_start()
{
epic12_device_gfx_size = 0x2000 * 0x1000;
epic12_device_bitmaps = auto_bitmap_rgb32_alloc(machine(), 0x2000, 0x1000);
epic12_device_clip = epic12_device_bitmaps->cliprect();
epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
m_gfx_size = 0x2000 * 0x1000;
m_bitmaps = auto_bitmap_rgb32_alloc(machine(), 0x2000, 0x1000);
m_clip = m_bitmaps->cliprect();
m_clip.set(0, 0x2000-1, 0, 0x1000-1);
epic12_device_ram16_copy = auto_alloc_array(machine(), UINT16, m_main_ramsize/2);
m_ram16_copy = auto_alloc_array(machine(), UINT16, m_main_ramsize/2);
epic12_device_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::epic12_device_blitter_delay_callback),this));
epic12_device_blitter_delay_timer->adjust(attotime::never);
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);
}
void epic12_device::device_reset()
{
if (m_is_unsafe)
{
use_ram = epic12_device_ram16;
queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ|WORK_QUEUE_FLAG_MULTI);
m_use_ram = m_ram16;
m_work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ|WORK_QUEUE_FLAG_MULTI);
}
else
{
use_ram = epic12_device_ram16_copy; // slow mode
queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ);
m_use_ram = m_ram16_copy; // slow mode
m_work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ);
}
// cache table to avoid divides in blit code, also pre-clamped
int x,y;
for (y=0;y<0x40;y++)
@ -92,8 +85,7 @@ void epic12_device::device_reset()
}
}
blitter_busy = 0;
m_blitter_busy = 0;
}
// todo, get these into the device class without ruining performance
@ -105,7 +97,7 @@ UINT64 epic12_device_blit_delay;
inline UINT16 epic12_device::READ_NEXT_WORD(offs_t *addr)
{
// UINT16 data = space.read_word(*addr); // going through the memory system is 'more correct' but noticably slower
UINT16 data = use_ram[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
UINT16 data = m_use_ram[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
*addr += 2;
@ -116,8 +108,8 @@ inline UINT16 epic12_device::READ_NEXT_WORD(offs_t *addr)
inline UINT16 epic12_device::COPY_NEXT_WORD(address_space &space, offs_t *addr)
{
// UINT16 data = space.read_word(*addr); // going through the memory system is 'more correct' but noticably slower
UINT16 data = epic12_device_ram16[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)];
epic12_device_ram16_copy[((*addr & m_main_rammask) >> 1) ^ NATIVE_ENDIAN_VALUE_LE_BE(3, 0)] = data;
UINT16 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;
@ -126,7 +118,7 @@ inline UINT16 epic12_device::COPY_NEXT_WORD(address_space &space, offs_t *addr)
}
inline void epic12_device::epic12_device_gfx_upload_shadow_copy(address_space &space, offs_t *addr)
inline void epic12_device::gfx_upload_shadow_copy(address_space &space, offs_t *addr)
{
UINT32 x,y, dimx,dimy;
COPY_NEXT_WORD(space, addr);
@ -148,7 +140,7 @@ inline void epic12_device::epic12_device_gfx_upload_shadow_copy(address_space &s
}
}
inline void epic12_device::epic12_device_gfx_upload(offs_t *addr)
inline void epic12_device::gfx_upload(offs_t *addr)
{
UINT32 x,y, dst_p,dst_x_start,dst_y_start, dimx,dimy;
UINT32 *dst;
@ -175,7 +167,7 @@ inline void epic12_device::epic12_device_gfx_upload(offs_t *addr)
for (y = 0; y < dimy; y++)
{
dst = &epic12_device_bitmaps->pix(dst_y_start + y, 0);
dst = &m_bitmaps->pix(dst_y_start + y, 0);
dst += dst_x_start;
for (x = 0; x < dimx; x++)
@ -191,7 +183,7 @@ inline void epic12_device::epic12_device_gfx_upload(offs_t *addr)
}
}
#define draw_params epic12_device_bitmaps, &epic12_device_clip, &epic12_device_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
#define draw_params m_bitmaps, &m_clip, &m_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
@ -295,7 +287,7 @@ epic12_device_blitfunction epic12_device_f1_ti0_tr0_blit_funcs[] =
inline void epic12_device::epic12_device_gfx_draw_shadow_copy(address_space &space, offs_t *addr)
inline void epic12_device::gfx_draw_shadow_copy(address_space &space, offs_t *addr)
{
COPY_NEXT_WORD(space, addr);
COPY_NEXT_WORD(space, addr);
@ -317,7 +309,7 @@ inline void epic12_device::epic12_device_gfx_draw_shadow_copy(address_space &spa
inline void epic12_device::epic12_device_gfx_draw(offs_t *addr)
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;
@ -533,10 +525,10 @@ inline void epic12_device::epic12_device_gfx_draw(offs_t *addr)
}
void epic12_device::epic12_device_gfx_create_shadow_copy(address_space &space)
void epic12_device::gfx_create_shadow_copy(address_space &space)
{
offs_t addr = epic12_device_gfx_addr & 0x1fffffff;
epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 240-1);
offs_t addr = m_gfx_addr & 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);
while (1)
{
@ -550,19 +542,19 @@ void epic12_device::epic12_device_gfx_create_shadow_copy(address_space &space)
case 0xc000:
if (COPY_NEXT_WORD(space, &addr)) // cliptype
epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 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
epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
m_clip.set(0, 0x2000-1, 0, 0x1000-1);
break;
case 0x2000:
addr -= 2;
epic12_device_gfx_upload_shadow_copy(space, &addr);
gfx_upload_shadow_copy(space, &addr);
break;
case 0x1000:
addr -= 2;
epic12_device_gfx_draw_shadow_copy(space, &addr);
gfx_draw_shadow_copy(space, &addr);
break;
default:
@ -573,10 +565,10 @@ void epic12_device::epic12_device_gfx_create_shadow_copy(address_space &space)
}
void epic12_device::epic12_device_gfx_exec(void)
void epic12_device::gfx_exec(void)
{
offs_t addr = epic12_device_gfx_addr_shadowcopy & 0x1fffffff;
epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 240-1);
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);
// logerror("GFX EXEC: %08X\n", addr);
@ -592,19 +584,19 @@ void epic12_device::epic12_device_gfx_exec(void)
case 0xc000:
if (READ_NEXT_WORD(&addr)) // cliptype
epic12_device_clip.set(epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y_shadowcopy, epic12_device_clip.min_y + 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
epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
m_clip.set(0, 0x2000-1, 0, 0x1000-1);
break;
case 0x2000:
addr -= 2;
epic12_device_gfx_upload(&addr);
gfx_upload(&addr);
break;
case 0x1000:
addr -= 2;
epic12_device_gfx_draw(&addr);
gfx_draw(&addr);
break;
default:
@ -615,10 +607,10 @@ void epic12_device::epic12_device_gfx_exec(void)
}
void epic12_device::epic12_device_gfx_exec_unsafe(void)
void epic12_device::gfx_exec_unsafe(void)
{
offs_t addr = epic12_device_gfx_addr & 0x1fffffff;
epic12_device_clip.set(epic12_device_gfx_scroll_1_x, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y, epic12_device_clip.min_y + 240-1);
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);
// logerror("GFX EXEC: %08X\n", addr);
@ -634,19 +626,19 @@ void epic12_device::epic12_device_gfx_exec_unsafe(void)
case 0xc000:
if (READ_NEXT_WORD(&addr)) // cliptype
epic12_device_clip.set(epic12_device_gfx_scroll_1_x, epic12_device_clip.min_x + 320-1, epic12_device_gfx_scroll_1_y, epic12_device_clip.min_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
epic12_device_clip.set(0, 0x2000-1, 0, 0x1000-1);
m_clip.set(0, 0x2000-1, 0, 0x1000-1);
break;
case 0x2000:
addr -= 2;
epic12_device_gfx_upload(&addr);
gfx_upload(&addr);
break;
case 0x1000:
addr -= 2;
epic12_device_gfx_draw(&addr);
gfx_draw(&addr);
break;
default:
@ -662,7 +654,7 @@ void *epic12_device::blit_request_callback(void *param, int threadid)
{
epic12_device *object = reinterpret_cast<epic12_device *>(param);
object->epic12_device_gfx_exec();
object->gfx_exec();
return NULL;
}
@ -673,19 +665,19 @@ void *epic12_device::blit_request_callback_unsafe(void *param, int threadid)
epic12_device *object = reinterpret_cast<epic12_device *>(param);
epic12_device_blit_delay = 0;
object->epic12_device_gfx_exec_unsafe();
object->gfx_exec_unsafe();
return NULL;
}
READ32_MEMBER( epic12_device::epic12_device_gfx_ready_r )
READ32_MEMBER( epic12_device::gfx_ready_r )
{
return 0x00000010;
}
READ32_MEMBER( epic12_device::epic12_device_gfx_ready_r_unsafe )
READ32_MEMBER( epic12_device::gfx_ready_r_unsafe )
{
if (blitter_busy)
if (m_blitter_busy)
{
m_maincpu->spin_until_time(attotime::from_usec(10));
return 0x00000000;
@ -694,7 +686,7 @@ READ32_MEMBER( epic12_device::epic12_device_gfx_ready_r_unsafe )
return 0x00000010;
}
WRITE32_MEMBER( epic12_device::epic12_device_gfx_exec_w )
WRITE32_MEMBER( epic12_device::gfx_exec_w )
{
if ( ACCESSING_BITS_0_7 )
{
@ -702,38 +694,38 @@ WRITE32_MEMBER( epic12_device::epic12_device_gfx_exec_w )
{
//g_profiler.start(PROFILER_USER1);
// make sure we've not already got a request running
if (blitter_request)
if (m_blitter_request)
{
int result;
do
{
result = osd_work_item_wait(blitter_request, 1000);
result = osd_work_item_wait(m_blitter_request, 1000);
} while (result==0);
osd_work_item_release(blitter_request);
osd_work_item_release(m_blitter_request);
}
epic12_device_blit_delay = 0;
epic12_device_gfx_create_shadow_copy(space); // create a copy of the blit list so we can safely thread it.
gfx_create_shadow_copy(space); // create a copy of the blit list so we can safely thread it.
if (epic12_device_blit_delay)
{
blitter_busy = 1;
epic12_device_blitter_delay_timer->adjust(attotime::from_nsec(epic12_device_blit_delay*8)); // NOT accurate timing (currently ignored anyway)
m_blitter_busy = 1;
m_blitter_delay_timer->adjust(attotime::from_nsec(epic12_device_blit_delay*8)); // NOT accurate timing (currently ignored anyway)
}
epic12_device_gfx_addr_shadowcopy = epic12_device_gfx_addr;
epic12_device_gfx_scroll_0_x_shadowcopy = epic12_device_gfx_scroll_0_x;
epic12_device_gfx_scroll_0_y_shadowcopy = epic12_device_gfx_scroll_0_y;
epic12_device_gfx_scroll_1_x_shadowcopy = epic12_device_gfx_scroll_1_x;
epic12_device_gfx_scroll_1_y_shadowcopy = epic12_device_gfx_scroll_1_y;
blitter_request = osd_work_item_queue(queue, blit_request_callback, (void*)this, 0);
m_gfx_addr_shadowcopy = m_gfx_addr;
m_gfx_scroll_0_x_shadowcopy = m_gfx_scroll_0_x;
m_gfx_scroll_0_y_shadowcopy = m_gfx_scroll_0_y;
m_gfx_scroll_1_x_shadowcopy = m_gfx_scroll_1_x;
m_gfx_scroll_1_y_shadowcopy = m_gfx_scroll_1_y;
m_blitter_request = osd_work_item_queue(m_work_queue, blit_request_callback, (void*)this, 0);
//g_profiler.stop();
}
}
}
WRITE32_MEMBER( epic12_device::epic12_device_gfx_exec_w_unsafe )
WRITE32_MEMBER( epic12_device::gfx_exec_w_unsafe )
{
if ( ACCESSING_BITS_0_7 )
{
@ -741,29 +733,29 @@ WRITE32_MEMBER( epic12_device::epic12_device_gfx_exec_w_unsafe )
{
//g_profiler.start(PROFILER_USER1);
// make sure we've not already got a request running
if (blitter_request)
if (m_blitter_request)
{
int result;
do
{
result = osd_work_item_wait(blitter_request, 1000);
result = osd_work_item_wait(m_blitter_request, 1000);
} while (result==0);
osd_work_item_release(blitter_request);
osd_work_item_release(m_blitter_request);
}
if (epic12_device_blit_delay)
{
blitter_busy = 1;
m_blitter_busy = 1;
int delay = epic12_device_blit_delay*(15 * m_delay_scale / 50);
//printf("delay %d\n", delay);
epic12_device_blitter_delay_timer->adjust(attotime::from_nsec(delay));
m_blitter_delay_timer->adjust(attotime::from_nsec(delay));
}
else
{
blitter_busy = 0;
m_blitter_busy = 0;
}
blitter_request = osd_work_item_queue(queue, blit_request_callback_unsafe, (void*)this, 0);
m_blitter_request = osd_work_item_queue(m_work_queue, blit_request_callback_unsafe, (void*)this, 0);
//g_profiler.stop();
}
}
@ -774,14 +766,14 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect
{
if (!m_is_unsafe)
{
if (blitter_request)
if (m_blitter_request)
{
int result;
do
{
result = osd_work_item_wait(blitter_request, 1000);
result = osd_work_item_wait(m_blitter_request, 1000);
} while (result==0);
osd_work_item_release(blitter_request);
osd_work_item_release(m_blitter_request);
}
}
@ -790,14 +782,14 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect
bitmap.fill(0, cliprect);
scroll_0_x = -epic12_device_gfx_scroll_0_x;
scroll_0_y = -epic12_device_gfx_scroll_0_y;
// scroll_1_x = -epic12_device_gfx_scroll_1_x;
// scroll_1_y = -epic12_device_gfx_scroll_1_y;
scroll_0_x = -m_gfx_scroll_0_x;
scroll_0_y = -m_gfx_scroll_0_y;
// scroll_1_x = -m_gfx_scroll_1_x;
// scroll_1_y = -m_gfx_scroll_1_y;
//printf("SCREEN UPDATE\n %d %d %d %d\n", scroll_0_x, scroll_0_y, scroll_1_x, scroll_1_y);
copyscrollbitmap(bitmap, *epic12_device_bitmaps, 1,&scroll_0_x, 1,&scroll_0_y, cliprect);
copyscrollbitmap(bitmap, *m_bitmaps, 1,&scroll_0_x, 1,&scroll_0_y, cliprect);
}
@ -805,12 +797,12 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect
READ32_MEMBER( epic12_device::epic12_device_blitter_r )
READ32_MEMBER( epic12_device::blitter_r )
{
switch (offset*4)
{
case 0x10:
return epic12_device::epic12_device_gfx_ready_r(space,offset,mem_mask);
return gfx_ready_r(space, offset, mem_mask);
case 0x24:
return 0xffffffff;
@ -822,19 +814,19 @@ READ32_MEMBER( epic12_device::epic12_device_blitter_r )
return space.machine().root_device().ioport(":DSW")->read();
default:
logerror("unknownepic12_device_blitter_r %08x %08x\n", offset*4, mem_mask);
logerror("unknownblitter_r %08x %08x\n", offset*4, mem_mask);
break;
}
return 0;
}
READ32_MEMBER( epic12_device::epic12_device_blitter_r_unsafe )
READ32_MEMBER( epic12_device::blitter_r_unsafe )
{
switch (offset*4)
{
case 0x10:
return epic12_device::epic12_device_gfx_ready_r_unsafe(space,offset,mem_mask);
return gfx_ready_r_unsafe(space, offset, mem_mask);
case 0x24:
return 0xffffffff;
@ -846,7 +838,7 @@ READ32_MEMBER( epic12_device::epic12_device_blitter_r_unsafe )
return space.machine().root_device().ioport(":DSW")->read();
default:
logerror("unknownepic12_device_blitter_r %08x %08x\n", offset*4, mem_mask);
logerror("unknownblitter_r %08x %08x\n", offset*4, mem_mask);
break;
}
@ -854,63 +846,63 @@ READ32_MEMBER( epic12_device::epic12_device_blitter_r_unsafe )
}
WRITE32_MEMBER( epic12_device::epic12_device_blitter_w )
WRITE32_MEMBER( epic12_device::blitter_w )
{
switch (offset*4)
{
case 0x04:
epic12_device_gfx_exec_w(space,offset,data,mem_mask);
gfx_exec_w(space,offset,data,mem_mask);
break;
case 0x08:
COMBINE_DATA(&epic12_device_gfx_addr);
COMBINE_DATA(&m_gfx_addr);
break;
case 0x14:
COMBINE_DATA(&epic12_device_gfx_scroll_0_x);
COMBINE_DATA(&m_gfx_scroll_0_x);
break;
case 0x18:
COMBINE_DATA(&epic12_device_gfx_scroll_0_y);
COMBINE_DATA(&m_gfx_scroll_0_y);
break;
case 0x40:
COMBINE_DATA(&epic12_device_gfx_scroll_1_x);
COMBINE_DATA(&m_gfx_scroll_1_x);
break;
case 0x44:
COMBINE_DATA(&epic12_device_gfx_scroll_1_y);
COMBINE_DATA(&m_gfx_scroll_1_y);
break;
}
}
WRITE32_MEMBER( epic12_device::epic12_device_blitter_w_unsafe )
WRITE32_MEMBER( epic12_device::blitter_w_unsafe )
{
switch (offset*4)
{
case 0x04:
epic12_device_gfx_exec_w_unsafe(space,offset,data,mem_mask);
gfx_exec_w_unsafe(space,offset,data,mem_mask);
break;
case 0x08:
COMBINE_DATA(&epic12_device_gfx_addr);
COMBINE_DATA(&m_gfx_addr);
break;
case 0x14:
COMBINE_DATA(&epic12_device_gfx_scroll_0_x);
COMBINE_DATA(&m_gfx_scroll_0_x);
break;
case 0x18:
COMBINE_DATA(&epic12_device_gfx_scroll_0_y);
COMBINE_DATA(&m_gfx_scroll_0_y);
break;
case 0x40:
COMBINE_DATA(&epic12_device_gfx_scroll_1_x);
COMBINE_DATA(&m_gfx_scroll_1_x);
break;
case 0x44:
COMBINE_DATA(&epic12_device_gfx_scroll_1_y);
COMBINE_DATA(&m_gfx_scroll_1_y);
break;
}
@ -926,25 +918,25 @@ void epic12_device::install_handlers(int addr1, int addr2)
if (m_is_unsafe)
{
printf("using unsafe blit code!\n");
read = read32_delegate(FUNC(epic12_device::epic12_device_blitter_r_unsafe), this);
write = write32_delegate(FUNC(epic12_device::epic12_device_blitter_w_unsafe), this);
read = read32_delegate(FUNC(epic12_device::blitter_r_unsafe), this);
write = write32_delegate(FUNC(epic12_device::blitter_w_unsafe), this);
}
else
{
read = read32_delegate(FUNC(epic12_device::epic12_device_blitter_r), this);
write = write32_delegate(FUNC(epic12_device::epic12_device_blitter_w), this);
read = read32_delegate(FUNC(epic12_device::blitter_r), this);
write = write32_delegate(FUNC(epic12_device::blitter_w), this);
}
space.install_readwrite_handler(addr1, addr2, read , write, U64(0xffffffffffffffff));
}
READ64_MEMBER( epic12_device::epic12_device_fpga_r )
READ64_MEMBER( 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::epic12_device_fpga_w )
WRITE64_MEMBER( epic12_device::fpga_w )
{
if (ACCESSING_BITS_24_31)
{

View File

@ -51,7 +51,10 @@ class epic12_device : public device_t,
public:
epic12_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void set_rambase(UINT16* rambase) { epic12_device_ram16 = rambase; }
void set_rambase(UINT16* 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 READ_NEXT_WORD(offs_t *addr);
@ -62,65 +65,57 @@ public:
dev.m_main_rammask = ramsize-1;
}
static void *blit_request_callback(void *param, int threadid);
DECLARE_READ64_MEMBER( epic12_device_fpga_r );
DECLARE_WRITE64_MEMBER( epic12_device_fpga_w );
DECLARE_READ64_MEMBER( fpga_r );
DECLARE_WRITE64_MEMBER( fpga_w );
void draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT16* epic12_device_ram16;
UINT32 epic12_device_gfx_addr;
UINT32 epic12_device_gfx_scroll_0_x, epic12_device_gfx_scroll_0_y;
UINT32 epic12_device_gfx_scroll_1_x, epic12_device_gfx_scroll_1_y;
UINT16* m_ram16;
UINT32 m_gfx_addr;
UINT32 m_gfx_scroll_0_x, m_gfx_scroll_0_y;
UINT32 m_gfx_scroll_1_x, m_gfx_scroll_1_y;
int m_gfx_size;
bitmap_rgb32 *m_bitmaps;
rectangle m_clip;
int epic12_device_gfx_size;
bitmap_rgb32 *epic12_device_bitmaps;
rectangle epic12_device_clip;
UINT16* use_ram;
UINT16* m_use_ram;
int m_main_ramsize; // type D has double the main ram
int m_main_rammask;
// thread safe mode, with no delays & shadow ram copy
DECLARE_READ32_MEMBER(epic12_device_blitter_r);
DECLARE_WRITE32_MEMBER(epic12_device_blitter_w);
UINT32 epic12_device_gfx_addr_shadowcopy;
UINT32 epic12_device_gfx_scroll_0_x_shadowcopy, epic12_device_gfx_scroll_0_y_shadowcopy;
UINT32 epic12_device_gfx_scroll_1_x_shadowcopy, epic12_device_gfx_scroll_1_y_shadowcopy;
UINT16* epic12_device_ram16_copy;
inline void epic12_device_gfx_upload_shadow_copy(address_space &space, offs_t *addr);
inline void epic12_device_gfx_create_shadow_copy(address_space &space);
inline UINT16 COPY_NEXT_WORD(address_space &space, offs_t *addr);
inline void epic12_device_gfx_draw_shadow_copy(address_space &space, offs_t *addr);
inline void epic12_device_gfx_upload(offs_t *addr);
inline void epic12_device_gfx_draw(offs_t *addr);
void epic12_device_gfx_exec(void);
DECLARE_READ32_MEMBER( epic12_device_gfx_ready_r );
DECLARE_WRITE32_MEMBER( epic12_device_gfx_exec_w );
// for thread unsafe mode with blitter delays, no shadow copy of RAM
DECLARE_READ32_MEMBER(epic12_device_blitter_r_unsafe);
DECLARE_WRITE32_MEMBER(epic12_device_blitter_w_unsafe);
READ32_MEMBER( epic12_device_gfx_ready_r_unsafe );
WRITE32_MEMBER( epic12_device_gfx_exec_w_unsafe );
void epic12_device_gfx_exec_unsafe(void);
static void *blit_request_callback_unsafe(void *param, int threadid);
int m_is_unsafe;
int m_delay_scale;
cpu_device* m_maincpu;
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; }
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 m_gfx_addr_shadowcopy;
UINT32 m_gfx_scroll_0_x_shadowcopy, m_gfx_scroll_0_y_shadowcopy;
UINT32 m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_y_shadowcopy;
UINT16* 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 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 );
// 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 );
void gfx_exec_unsafe(void);
static void *blit_request_callback_unsafe(void *param, int threadid);
#define BLIT_FUNCTION static const void
#define BLIT_PARAMS bitmap_rgb32 *bitmap, const rectangle *clip, UINT32 *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 s_alpha, const UINT8 d_alpha, const clr_t *tint_clr
@ -832,14 +827,14 @@ protected:
virtual void device_start();
virtual void device_reset();
osd_work_queue * queue; /* work queue */
osd_work_item * blitter_request;
osd_work_queue *m_work_queue;
osd_work_item *m_blitter_request;
// blit timing
emu_timer *epic12_device_blitter_delay_timer;
int blitter_busy;
emu_timer *m_blitter_delay_timer;
int m_blitter_busy;
TIMER_CALLBACK_MEMBER( epic12_device_blitter_delay_callback );
TIMER_CALLBACK_MEMBER( blitter_delay_callback );
};

View File

@ -1,5 +1,4 @@
/* blitter function */
const void epic12_device::FUNCNAME(BLIT_PARAMS)
{

View File

@ -349,7 +349,7 @@ static ADDRESS_MAP_START( cv1k_port, AS_IO, 64, cv1k_state )
AM_RANGE(SH3_PORT_E, SH3_PORT_E+7) AM_READ( cv1k_flash_port_e_r )
AM_RANGE(SH3_PORT_F, SH3_PORT_F+7) AM_READ_PORT("PORT_F")
AM_RANGE(SH3_PORT_L, SH3_PORT_L+7) AM_READ_PORT("PORT_L")
AM_RANGE(SH3_PORT_J, SH3_PORT_J+7) AM_DEVREADWRITE( "blitter", epic12_device, epic12_device_fpga_r, epic12_device_fpga_w )
AM_RANGE(SH3_PORT_J, SH3_PORT_J+7) AM_DEVREADWRITE( "blitter", epic12_device, fpga_r, fpga_w )
ADDRESS_MAP_END