diff options
Diffstat (limited to 'src/devices/video/epic12.cpp')
-rw-r--r-- | src/devices/video/epic12.cpp | 328 |
1 files changed, 166 insertions, 162 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) { |