diff options
Diffstat (limited to 'src/devices/video/zeus2.cpp')
-rw-r--r-- | src/devices/video/zeus2.cpp | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 99cb29aa8b2..475f4d2ae63 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -7,6 +7,10 @@ **************************************************************************/ #include "emu.h" #include "zeus2.h" +#include "screen.h" + +#include <algorithm> + #define LOG_REGS 1 // Setting ALWAYS_LOG_FIFO will always log the fifo versus having to hold 'L' @@ -16,7 +20,7 @@ * Constructor *************************************/ zeus2_renderer::zeus2_renderer(zeus2_device *state) - : poly_manager<float, zeus2_poly_extra_data, 4, 10000>(state->machine()) + : poly_manager<float, zeus2_poly_extra_data, 4>(state->machine()) , m_state(state) { } @@ -45,16 +49,13 @@ TIMER_CALLBACK_MEMBER(zeus2_device::display_irq_off) // vblank_period = screen().frame_period(); //vblank_timer->adjust(vblank_period); vblank_timer->adjust(screen().time_until_vblank_start()); - //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq), this)); } TIMER_CALLBACK_MEMBER(zeus2_device::display_irq) { m_vblank(ASSERT_LINE); /* set a timer for the next off state */ - //machine().scheduler().timer_set(screen().time_until_pos(0), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); - machine().scheduler().timer_set(screen().time_until_vblank_end(), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); - //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this)); + vblank_off_timer->adjust(screen().time_until_vblank_end()); } TIMER_CALLBACK_MEMBER(zeus2_device::int_timer_callback) @@ -78,15 +79,12 @@ void zeus2_device::device_start() /* initialize polygon engine */ poly = std::make_unique<zeus2_renderer>(this); - m_vblank.resolve_safe(); - m_irq.resolve_safe(); - /* we need to cleanup on exit */ //machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&zeus2_device::exit_handler2, this)); - int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::int_timer_callback), this)); - - vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::display_irq), this)); + int_timer = timer_alloc(FUNC(zeus2_device::int_timer_callback), this); + vblank_timer = timer_alloc(FUNC(zeus2_device::display_irq), this); + vblank_off_timer = timer_alloc(FUNC(zeus2_device::display_irq_off), this); //printf("%s\n", machine().system().name); // Set system type @@ -236,10 +234,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap for (y = cliprect.min_y; y <= cliprect.max_y; y++) { uint32_t *colorptr = &m_frameColor[frame_addr_from_xy(0, y, false)]; - uint32_t *dest = &bitmap.pix32(y); - for (x = cliprect.min_x; x <= cliprect.max_x; x++) { - dest[x] = colorptr[x]; - } + std::copy(colorptr + cliprect.min_x, colorptr + cliprect.max_x + 1, &bitmap.pix(y, cliprect.min_x)); } } @@ -265,7 +260,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap int xoffs = screen.visible_area().min_x; for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - uint32_t *dest = &bitmap.pix32(y); + uint32_t *const dest = &bitmap.pix(y); for (x = cliprect.min_x; x <= cliprect.max_x; x++) { if (1) { @@ -291,7 +286,7 @@ uint32_t zeus2_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap * *************************************/ -READ32_MEMBER( zeus2_device::zeus2_r ) +uint32_t zeus2_device::zeus2_r(offs_t offset) { int logit = (offset != 0x00 && offset != 0x01 && offset != 0x18 && offset != 0x19 && offset != 0x48 && offset != 0x49 @@ -364,7 +359,7 @@ READ32_MEMBER( zeus2_device::zeus2_r ) * *************************************/ -WRITE32_MEMBER( zeus2_device::zeus2_w ) +void zeus2_device::zeus2_w(offs_t offset, uint32_t data) { int logit = (offset != 0x08 && offset != 0x18 && offset != 0x19 && (offset != 0x20 || data != 0) && @@ -1205,6 +1200,7 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) return true; } // Drop through to 0x05 command + [[fallthrough]]; /* 0x05: write 32-bit value to low registers */ case 0x05: if (numwords < 2) @@ -1221,7 +1217,7 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) return false; zeus_trans[3] = convert_float(data[1]); dataoffs = 1; - + [[fallthrough]]; /* 0x07: set matrix and point (crusnexo) */ case 0x07: if (numwords < 13) @@ -1293,6 +1289,7 @@ bool zeus2_device::zeus2_fifo_process(const uint32_t *data, int numwords) } break; } + [[fallthrough]]; // 0x1b: thegrid // 0x1c: crusnexo (4 words) case 0x1b: @@ -1470,17 +1467,16 @@ void zeus2_device::zeus2_draw_model(uint32_t baseaddr, uint16_t count, int logit case 0x00: // crusnexo if (logit && curoffs == count) logerror(" end cmd 00\n"); + [[fallthrough]]; case 0x21: /* thegrid */ case 0x22: /* crusnexo */ - { // Sets 0x68 (uv float offset) and texture line and mode // In reality this sets internal registers that are used in the // zeus2 microcode to set these registers m_zeusbase[0x68] = (databuffer[0] >> 16) & 0xff; texdata = databuffer[1]; if (logit) - logerror(" (0x68)=%02X texMode=%08X\n", m_zeusbase[0x68], texdata); - } + logerror(" (0x68)=%02X texMode=%08X\n", m_zeusbase[0x68], texdata); break; case 0x31: /* thegrid */ @@ -1775,7 +1771,7 @@ void zeus2_renderer::zeus2_draw_quad(const uint32_t *databuffer, uint32_t texdat return; } - zeus2_poly_extra_data& extra = this->object_data_alloc(); + zeus2_poly_extra_data& extra = this->object_data().next(); extra.ucode_src = m_state->m_curUCodeSrc; extra.tex_src = m_state->zeus_texbase; @@ -1785,8 +1781,7 @@ void zeus2_renderer::zeus2_draw_quad(const uint32_t *databuffer, uint32_t texdat extra.transcolor = (texmode & 0x180) ? 0 : 0x100; extra.texbase = WAVERAM_BLOCK0_EXT(m_state->zeus_texbase); extra.depth_min_enable = true;// (m_state->m_renderRegs[0x14] & 0x008000); - extra.zbuf_min = int32_t((m_state->m_renderRegs[0x15]) << 8) >> 8; - //extra.zbuf_min = m_state->m_renderRegs[0x15]; + extra.zbuf_min = util::sext(m_state->m_renderRegs[0x15], 24); extra.depth_test_enable = !(m_state->m_renderRegs[0x14] & 0x000020); //extra.depth_test_enable &= !(m_state->m_renderRegs[0x14] & 0x008000); extra.depth_write_enable = !(m_state->m_renderRegs[0x14] & 0x001000); @@ -1826,8 +1821,8 @@ void zeus2_renderer::zeus2_draw_quad(const uint32_t *databuffer, uint32_t texdat } //if (numverts == 3) - // render_triangle(m_state->zeus_cliprect, render_delegate(&zeus2_renderer::render_poly_8bit, this), 4, vert[0], vert[1], vert[2]); - render_polygon<4>(m_state->zeus_cliprect, render_delegate(&zeus2_renderer::render_poly_8bit, this), 4, vert); + // render_triangle<4>(m_state->zeus_cliprect, render_delegate(&zeus2_renderer::render_poly_8bit, this), vert[0], vert[1], vert[2]); + render_polygon<4, 4>(m_state->zeus_cliprect, render_delegate(&zeus2_renderer::render_poly_8bit, this), vert); } @@ -2071,7 +2066,7 @@ void zeus2_device::check_tex(uint32_t &texmode, float &zObj, float &zMat, float infoStr += tex_info(); tex_map.insert(std::pair<uint32_t, std::string>(zeus_texbase, infoStr)); - osd_printf_info("%s\n", infoStr.c_str()); + osd_printf_info("%s\n", infoStr); } } |