diff options
author | Angelo Salese <angelosa@users.noreply.github.com> | 2013-11-03 22:43:42 +0000 |
---|---|---|
committer | Angelo Salese <angelosa@users.noreply.github.com> | 2013-11-03 22:43:42 +0000 |
commit | e05327df993d6aa6771c20342d5f9e4932f79312 (patch) | |
tree | 892fa68d20454430aabef7c7f563af351bda3fd1 | |
parent | fe5ac3c0fdb5b8247b1b5eaf9949acbfe8a4373e (diff) |
Added video banking, fixes Great Guns ranking screen
-rw-r--r-- | src/emu/video/mb_vcu.c | 140 | ||||
-rw-r--r-- | src/emu/video/mb_vcu.h | 2 | ||||
-rw-r--r-- | src/mame/drivers/mazerbla.c | 15 |
3 files changed, 144 insertions, 13 deletions
diff --git a/src/emu/video/mb_vcu.c b/src/emu/video/mb_vcu.c index 6d82ba29bbb..6d56050035b 100644 --- a/src/emu/video/mb_vcu.c +++ b/src/emu/video/mb_vcu.c @@ -19,7 +19,7 @@ Device for Mazer Blazer/Great Guns custom Video Controller Unit const device_type MB_VCU = &device_creator<mb_vcu_device>; static ADDRESS_MAP_START( mb_vcu_vram, AS_0, 8, mb_vcu_device ) - AM_RANGE(0x00000,0x1ffff) AM_RAM // enough for a 256x256x4 x 2 pages of framebuffer (TODO: doubled for simplicity) + AM_RANGE(0x00000,0x7ffff) AM_RAM // enough for a 256x256x4 x 2 pages of framebuffer with 4 layers (TODO: doubled for simplicity) ADDRESS_MAP_END //------------------------------------------------- @@ -66,7 +66,7 @@ mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, dev : device_t(mconfig, MB_VCU, "Mazer Blazer custom VCU", tag, owner, clock, "mb_vcu", __FILE__), device_memory_interface(mconfig, *this), device_video_interface(mconfig, *this), - m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram)) + m_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram)) { } @@ -133,6 +133,11 @@ void mb_vcu_device::device_start() void mb_vcu_device::device_reset() { m_status = 1; + + for(int i=0;i<0x80000;i++) + { + write_byte(i,0x0f); + } } @@ -191,6 +196,10 @@ READ8_MEMBER( mb_vcu_device::load_gfx ) int dstx,dsty; UINT8 dot; int bits = 0; + UINT8 pen; + UINT8 cur_layer; + + cur_layer = 0;//(m_mode & 0x3) << 16; switch(m_mode >> 2) { @@ -207,8 +216,8 @@ READ8_MEMBER( mb_vcu_device::load_gfx ) dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (4-(bits & 7)); dot&= 0xf; - write_byte(dstx|dsty<<8, dot); - + //if(dot != 0xf) + write_byte(dstx|dsty<<8|cur_layer<<16|m_vbank<<18, dot); } bits += 4; } @@ -228,7 +237,9 @@ READ8_MEMBER( mb_vcu_device::load_gfx ) dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (7-(bits & 7)); dot&= 1; - write_byte(dstx|dsty<<8, dot ? (m_color1 >> 4) : (m_color1 & 0xf)); + pen = dot ? (m_color1 >> 4) : (m_color1 & 0xf); + //if(pen != 0xf) + write_byte(dstx|dsty<<8|cur_layer|m_vbank<<18, pen); } bits++; } @@ -250,18 +261,22 @@ READ8_MEMBER( mb_vcu_device::load_gfx ) switch(dot) { case 0: - write_byte(dstx|dsty<<8, m_color1 & 0xf); + pen = m_color1 & 0xf; break; case 1: - write_byte(dstx|dsty<<8, m_color1 >> 4); + pen = m_color1 >> 4; break; case 2: - write_byte(dstx|dsty<<8, m_color2 & 0xf); + pen = m_color2 & 0xf; break; case 3: - write_byte(dstx|dsty<<8, m_color2 >> 4); + pen = m_color2 >> 4; break; } + + //if(pen != 0xf) + write_byte(dstx|dsty<<8|cur_layer|m_vbank<<18, pen); + } bits+=2; @@ -279,7 +294,11 @@ READ8_MEMBER( mb_vcu_device::load_gfx ) READ8_MEMBER( mb_vcu_device::load_set_clr ) { - if(0) + int xi,yi; + int dstx,dsty; +// UINT8 dot; + int bits = 0; + if(m_mode == 0x13 || m_mode == 0x03) { printf("[0] %02x ",m_ram[m_param_offset_latch]); printf("X: %04x ",m_xpos); @@ -289,11 +308,52 @@ READ8_MEMBER( mb_vcu_device::load_set_clr ) printf("M :%02x ",m_mode); printf("XS:%02x ",m_pix_xsize); printf("YS:%02x ",m_pix_ysize); + printf("VB:%02x ",m_vbank); printf("\n"); } switch(m_mode) { + case 0x13: + case 0x03: + for (yi = 0; yi < m_pix_ysize; yi++) + { + for (xi = 0; xi < m_pix_xsize; xi++) + { + dstx = (m_xpos + xi); + dsty = (m_ypos + yi); + + if(dstx < 256 && dsty < 256) + { + #if 0 + dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (6-(bits & 7)); + dot&= 3; + + switch(dot) + { + case 0: + write_byte(dstx|dsty<<8, m_color1 & 0xf); + break; + case 1: + write_byte(dstx|dsty<<8, m_color1 >> 4); + break; + case 2: + write_byte(dstx|dsty<<8, m_color2 & 0xf); + break; + case 3: + write_byte(dstx|dsty<<8, m_color2 >> 4); + break; + } + #endif + + //write_byte(dstx|dsty<<8, m_mode >> 4); + } + + bits+=2; + } + } + break; + case 0x07: switch(m_ypos) { @@ -366,6 +426,7 @@ READ8_MEMBER( mb_vcu_device::status_r ) WRITE8_MEMBER( mb_vcu_device::vbank_w ) { + m_vbank = (data & 0x40) >> 6; } //------------------------------------------------- @@ -383,7 +444,7 @@ UINT32 mb_vcu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, { for(x=0;x<256;x++) { - dot = read_byte((x >> 0)|(y<<8)); + dot = read_byte((x >> 0)|(y<<8)|0<<16|(m_vbank ^ 1)<<18); //if(dot != 0xf) { dot|= m_vregs[1] << 4; @@ -393,5 +454,62 @@ UINT32 mb_vcu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, } } + #if 0 + for(y=0;y<256;y++) + { + for(x=0;x<256;x++) + { + dot = read_byte((x >> 0)|(y<<8)|3<<16); + + if(dot != 0xf) + { + dot|= m_vregs[1] << 4; + + bitmap.pix32(y,x) = machine().pens[dot]; + } + } + } + + for(y=0;y<256;y++) + { + for(x=0;x<256;x++) + { + dot = read_byte((x >> 0)|(y<<8)|0<<16); + + if(dot != 0xf) + { + dot|= m_vregs[1] << 4; + + bitmap.pix32(y,x) = machine().pens[dot]; + } + } + } + + for(y=0;y<256;y++) + { + for(x=0;x<256;x++) + { + dot = read_byte((x >> 0)|(y<<8)|1<<16); + + if(dot != 0xf) + { + dot|= m_vregs[1] << 4; + + bitmap.pix32(y,x) = machine().pens[dot]; + } + } + } + #endif + return 0; } + +void mb_vcu_device::screen_eof(void) +{ + for(int i=0;i<0x10000;i++) + { + //write_byte(i|0x00000|m_vbank<<18,0x0f); + //write_byte(i|0x10000|m_vbank<<18,0x0f); + //write_byte(i|0x30000|m_vbank<<18,0x0f); + } +} diff --git a/src/emu/video/mb_vcu.h b/src/emu/video/mb_vcu.h index 07e359a6174..b17290f032e 100644 --- a/src/emu/video/mb_vcu.h +++ b/src/emu/video/mb_vcu.h @@ -55,6 +55,7 @@ public: DECLARE_WRITE8_MEMBER( vbank_w ); UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void screen_eof(void); protected: // device-level overrides @@ -79,6 +80,7 @@ private: UINT16 m_pix_xsize, m_pix_ysize; UINT8 m_vregs[4]; UINT8 m_bk_color; + UINT8 m_vbank; double m_weights_r[2]; double m_weights_g[3]; diff --git a/src/mame/drivers/mazerbla.c b/src/mame/drivers/mazerbla.c index 676ecd7bb65..61cd591ee98 100644 --- a/src/mame/drivers/mazerbla.c +++ b/src/mame/drivers/mazerbla.c @@ -223,6 +223,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_mazerbla(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void screen_eof(screen_device &screen, bool state); INTERRUPT_GEN_MEMBER(sound_interrupt); TIMER_CALLBACK_MEMBER(deferred_ls670_0_w); TIMER_CALLBACK_MEMBER(deferred_ls670_1_w); @@ -291,6 +292,15 @@ UINT32 mazerbla_state::screen_update_mazerbla(screen_device &screen, bitmap_rgb3 return 0; } +void mazerbla_state::screen_eof(screen_device &screen, bool state) +{ + if (state) + { + m_vcu->screen_eof(); + } +} + + /* reference */ #if 0 WRITE8_MEMBER(mazerbla_state::cfb_backgnd_color_w) @@ -1154,8 +1164,8 @@ static INPUT_PORTS_START( mazerbla ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("BUTTONS") /* Strobe 5: coin1&2, start1&2, fire */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) @@ -1527,6 +1537,7 @@ static MACHINE_CONFIG_START( greatgun, mazerbla_state ) MCFG_SCREEN_SIZE(40*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE_DRIVER(mazerbla_state, screen_update_mazerbla) + MCFG_SCREEN_VBLANK_DRIVER(mazerbla_state, screen_eof) MCFG_PALETTE_LENGTH(256+1) |