diff --git a/src/mame/drivers/xavix2.cpp b/src/mame/drivers/xavix2.cpp index d815abb12b9..45d1f10c3a0 100644 --- a/src/mame/drivers/xavix2.cpp +++ b/src/mame/drivers/xavix2.cpp @@ -25,7 +25,6 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_screen(*this, "screen") - , m_palette(*this, "palette") { } void xavix2(machine_config &config); @@ -38,16 +37,19 @@ private: required_device m_maincpu; required_device m_screen; - required_device m_palette; u32 m_dma_src; u16 m_dma_dst; u16 m_dma_count; emu_timer *m_dma_timer; + u16 m_port0_ddr, m_port0_data; + u16 m_gpu_adr, m_gpu_descsize_adr, m_gpu_descdata_adr; u32 m_int_active; + u32 m_sd[0x400][0x800]; + std::string m_debug_string; void irq_raise(u32 level); @@ -75,12 +77,17 @@ private: u8 debug_port_r(); u8 debug_port_status_r(); + void port0_ddr_w(u16 data); + u16 port0_ddr_r(); + void port0_w(u16 data); + u16 port0_r(); + void crtc_w(offs_t reg, u16 data); virtual void machine_start() override; virtual void machine_reset() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); void mem(address_map &map); }; @@ -143,7 +150,69 @@ void xavix2_state::gpu_count_w(u16 data) u32 idx = (command >> 58) & 0x3f; u32 descsize = m_maincpu->space(AS_PROGRAM).read_dword(m_gpu_descsize_adr + 4*idx); u16 descdata = m_maincpu->space(AS_PROGRAM).read_word(m_gpu_descdata_adr + 2*idx); - logerror("gpu - data %06x size %08x w=%x ?=%x h=%x ?=%x bpp=%x ?=%x\n", (descdata << 14) | ((command >> 43) & 0x3fe0), descsize, 1+(descsize & 0x3f), (descsize >> 6) & 3, 1 + ((descsize >> 8) & 0x3f), (descsize >> 10) & 0x3ff, 1 + ((descsize >> 24) & 7), descsize >> 27); + + u32 sadr = (descdata << 14) | ((command >> 43) & 0x3fe0); + u32 x = (command >> 0) & 0x7ff; + u32 y = (command >> 11) & 0x3ff; + u32 sx = 1+(descsize & 0xff); + u32 sy = 1 + ((descsize >> 8) & 0xff); + u32 bpp = 1 + ((descsize >> 24) & 7); + logerror("gpu - data %06x size %08x w=%x h=%x ?=%x bpp=%x ?=%x\n", sadr, descsize, sx, sy, (descsize >> 16) & 0xff, bpp, descsize >> 27); + + u32 stride = sx; + + if(x+sx > 0x800) + sx = 0x800 - x; + if(y+sy > 0x400) + sy = 0x400 - y; + + switch(bpp) { + case 2: { + stride = 8*((sx+31)/32); + for(u32 yy=0; yyspace(AS_PROGRAM).read_qword(cadr); + u32 xxl = sx - xx; + if(xxl > 32) + xxl = 32; + for(u32 xxx=0; xxx> (2*xxx)) & 3; + m_sd[y+yy][x+xx+xxx] = 0xff000000 | (0x555555 * c); + } + cadr += 8; + } + sadr += stride; + } + break; + } + + case 3: { + stride = 8*((sx+20)/21); + for(u32 yy=0; yyspace(AS_PROGRAM).read_qword(cadr); + u32 xxl = sx - xx; + if(xxl > 21) + xxl = 21; + for(u32 xxx=0; xxx> (3*xxx)) & 7; + m_sd[y+yy][x+xx+xxx] = 0xff000000 | (0x242424 * c); + } + cadr += 8; + } + sadr += stride; + } + break; + } + + default: + for(u32 yy=0; yyset_refresh_hz(60); m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); m_screen->set_screen_update(FUNC(xavix2_state::screen_update)); - m_screen->set_size(32*8, 32*8); - m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - m_screen->set_palette(m_palette); - - PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 256); + m_screen->set_size(640, 400); + m_screen->set_visarea(0, 639, 0, 399); /* sound hardware */ SPEAKER(config, "lspeaker").front_left();