diff options
Diffstat (limited to 'src/mame/video/decbac06.cpp')
-rw-r--r-- | src/mame/video/decbac06.cpp | 155 |
1 files changed, 55 insertions, 100 deletions
diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp index e89d24f957d..590a569e245 100644 --- a/src/mame/video/decbac06.cpp +++ b/src/mame/video/decbac06.cpp @@ -3,20 +3,20 @@ /* Deco BAC06 tilemap generator: - this a direct relative of the later chip implemented in deco16ic.cpp + this a direct relative of the later chip implemented in deco16ic.c we could implement this as either an 8-bit or a 16-bit chip, for now - I'm using the 16-bit implementation from dec0.cpp + I'm using the 16-bit implementation from dec0.c used by: - actfancr.cpp - dec0.cpp - dec8.cpp (oscar, cobracom, ghostb) - madmotor.cpp - stadhero.cpp - pcktgal.cpp + actfancr.c + dec0.c + dec8.c (oscar, cobracom, ghostb) + madmotor.c + stadhero.c + pcktgal.c - Notes (from dec0.cpp) + Notes (from dec0.c) All games contain three BAC06 background generator chips, usual (software) configuration is 2 chips of 16*16 tiles, 1 of 8*8. @@ -25,7 +25,7 @@ configuration is 2 chips of 16*16 tiles, 1 of 8*8. bank 0: 0: bit 0 (0x1) set = 8*8 tiles, else 16*16 tiles - Bit 1 (0x2) set = row major tile layout, else column major* + Bit 1 (0x2) unknown bit 2 (0x4) set enables rowscroll bit 3 (0x8) set enables colscroll bit 7 (0x80) set in playfield 1 is reverse screen (set via dip-switch) @@ -44,9 +44,6 @@ configuration is 2 chips of 16*16 tiles, 1 of 8*8. The shift register controls the granularity of the scroll offsets (more details given later). - * Bandit is the only game known to use column major tile layout, when in this - mode X scrolling is also inverted, and tile character data is flipped on X. - Playfield priority (Bad Dudes, etc): In the bottommost playfield, pens 8-15 can have priority over the next playfield. In that next playfield, pens 8-15 can have priority over sprites. @@ -63,8 +60,6 @@ Priority word (Midres): Bit 2 Bit 3 set = ... - Note that priority mixing is handled outside of the BAC-06 chip. - */ #include "emu.h" @@ -92,10 +87,10 @@ deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char * , m_gfxdecode(*this, finder_base::DUMMY_TAG) { for (int i = 0; i < 8; i++) - { - m_pf_control_0[i] = 0; - m_pf_control_1[i] = 0; - } + { + m_pf_control_0[i] = 0; + m_pf_control_1[i] = 0; + } } void deco_bac06_device::device_start() @@ -144,46 +139,31 @@ void deco_bac06_device::set_flip_screen(bool flip) TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape0_scan) { - if ((m_pf_control_0[0]&2)==0) - { - int col_mask = num_cols - 1; - return (row & 0xf) + ((col_mask - (col & col_mask)) << 4); - } return (col & 0xf) + ((row & 0xf) << 4) + ((col & 0x1f0) << 4); } TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape1_scan) { - //if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game - // return (row & 0xf) + ((col & 0x1f) << 4) + ((col & 0xf0) << 5); return (col & 0xf) + ((row & 0x1f) << 4) + ((col & 0xf0) << 5); } TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape2_scan) { - //if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game - // return (col & 0xf) + ((row & 0x3f) << 4) + ((row & 0x70) << 6); return (col & 0xf) + ((row & 0x3f) << 4) + ((col & 0x70) << 6); } TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape0_8x8_scan) { - //if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game - // return (col & 0x1f) + ((row & 0x1f) << 5) + ((row & 0x60) << 5); return (col & 0x1f) + ((row & 0x1f) << 5) + ((col & 0x60) << 5); } TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape1_8x8_scan) { - //if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game - // return (row & 0x1f) + ((col & 0x1f) << 5) + ((col & 0x20) << 5) + ((row & 0x20) << 6); return (col & 0x1f) + ((row & 0x1f) << 5) + ((row & 0x20) << 5) + ((col & 0x20) << 6); } TILEMAP_MAPPER_MEMBER(deco_bac06_device::tile_shape2_8x8_scan) { - //if (m_pf_control_0[0]&2) // Needs testing on real hardware, not used by any game - // return (row & 0x1f) + ((col & 0x7f) << 5); return (col & 0x1f) + ((row & 0x7f) << 5); } @@ -192,8 +172,7 @@ TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf8x8_tile_info) if (m_rambank&1) tile_index+=0x1000; int tile=m_pf_data[tile_index]; int colourpri=(tile>>12); - int flags=(m_pf_control_0[0]&2) ? 0 : TILE_FLIPX; - SET_TILE_INFO_MEMBER(m_tile_region_8,tile&0xfff,0,flags); + SET_TILE_INFO_MEMBER(m_tile_region_8,tile&0xfff,0,0); tileinfo.category = colourpri; } @@ -202,8 +181,7 @@ TILE_GET_INFO_MEMBER(deco_bac06_device::get_pf16x16_tile_info) if (m_rambank&1) tile_index+=0x1000; int tile=m_pf_data[tile_index]; int colourpri=(tile>>12); - int flags=(m_pf_control_0[0]&2) ? 0 : TILE_FLIPX; - SET_TILE_INFO_MEMBER(m_tile_region_16,tile&0xfff,0,flags); + SET_TILE_INFO_MEMBER(m_tile_region_16,tile&0xfff,0,0); tileinfo.category = colourpri; } @@ -216,38 +194,40 @@ void deco_bac06_device::create_tilemaps(int region8x8, int region16x16) m_pf8x8_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_8x8_scan),this), 8, 8, 64, 64); m_pf8x8_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf8x8_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_8x8_scan),this), 8, 8, 32,128); + if (m_wide==2) { m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 256, 16); - m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 128, 32); - m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 64, 64); + m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 128, 32); + m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 64, 64); } else if (m_wide==1) { m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 128, 16); - m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 64, 32); - m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 32, 64); + m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 64, 32); + m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this), tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 32, 64); } else { - m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16, 16, 64, 16); - m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16, 16, 32, 32); - m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16, 16, 16, 64); + m_pf16x16_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape0_scan),this), 16,16, 64, 16); + m_pf16x16_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape1_scan),this), 16,16, 32, 32); + m_pf16x16_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(deco_bac06_device::get_pf16x16_tile_info),this),tilemap_mapper_delegate(FUNC(deco_bac06_device::tile_shape2_scan),this), 16,16, 16, 64); } } void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, - const rectangle &cliprect, - tilemap_t *tilemap_ptr, - const uint16_t *rowscroll_ptr, - const uint16_t *colscroll_ptr, - const uint16_t *control0, - const uint16_t *control1, - int flags, - uint16_t penmask, - uint16_t pencondition, - uint16_t colprimask, - uint16_t colpricondition) + const rectangle &cliprect, + tilemap_t *tilemap_ptr, + const uint16_t *rowscroll_ptr, + const uint16_t *colscroll_ptr, + const uint16_t *control0, + const uint16_t *control1, + int flags, + uint16_t penmask, + uint16_t pencondition, + uint16_t colprimask, + uint16_t colpricondition + ) { const bitmap_ind16 &src_bitmap = tilemap_ptr->pixmap(); const bitmap_ind8 &flags_bitmap = tilemap_ptr->flagsmap(); @@ -258,10 +238,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, if (control1) { - if (control0 && (control0[0]&2)==0) // Use of column major mode inverts scroll direction - scrollx = -control1[0] - 0x100; - else - scrollx = control1[0]; + scrollx = control1[0]; scrolly = control1[1]; } @@ -305,8 +282,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, else src_y = scrolly; - for (y=0; y<=cliprect.bottom(); y++) - { + for (y=0; y<=cliprect.bottom(); y++) { if (row_scroll_enabled) src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3]&0xf))&(0x1ff>>(control1[3]&0xf))]; else @@ -315,8 +291,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, if (m_flip_screen) src_x=(src_bitmap.width() - 256) - src_x; - for (x=0; x<=cliprect.right(); x++) - { + for (x=0; x<=cliprect.right(); x++) { if (col_scroll_enabled) column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2]&0xf))&(0x3f>>(control1[2]&0xf))]; @@ -367,6 +342,7 @@ void deco_bac06_device::deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle if (tm) custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition); + } // used for pocket gal bootleg, which doesn't set registers properly and simply expects a fixed size tilemap. @@ -383,27 +359,10 @@ void deco_bac06_device::deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const re WRITE16_MEMBER( deco_bac06_device::pf_control_0_w ) { - int old_register0 = m_pf_control_0[0]; - offset &= 3; COMBINE_DATA(&m_pf_control_0[offset]); - bool dirty_all = false; - if (offset==0) - { - if ((old_register0&2)!=(m_pf_control_0[offset]&2)) - { - // The tilemap has changed from row major to column major or vice versa. - // Must force an update of the mapping. - for (int i = 0; i < 3; i++) - { - m_pf8x8_tilemap[i]->mark_mapping_dirty(); - m_pf16x16_tilemap[i]->mark_mapping_dirty(); - } - dirty_all = true; - } - } if (offset==2) { int newbank = m_pf_control_0[offset]&1; @@ -414,17 +373,13 @@ WRITE16_MEMBER( deco_bac06_device::pf_control_0_w ) if (strcmp(machine().system().name,"stadhero")) printf("tilemap ram bank change to %d\n", newbank&1); - dirty_all = true; m_rambank = newbank&1; - } - } - - if (dirty_all) - { - for (int i = 0; i < 3; i++) - { - m_pf8x8_tilemap[i]->mark_all_dirty(); - m_pf16x16_tilemap[i]->mark_all_dirty(); + m_pf8x8_tilemap[0]->mark_all_dirty(); + m_pf8x8_tilemap[1]->mark_all_dirty(); + m_pf8x8_tilemap[2]->mark_all_dirty(); + m_pf16x16_tilemap[0]->mark_all_dirty(); + m_pf16x16_tilemap[1]->mark_all_dirty(); + m_pf16x16_tilemap[2]->mark_all_dirty(); } } } @@ -446,12 +401,12 @@ WRITE16_MEMBER( deco_bac06_device::pf_data_w ) if (m_rambank&1) offset+=0x1000; COMBINE_DATA(&m_pf_data[offset]); - - for (int i = 0; i < 3; i++) - { - m_pf8x8_tilemap[i]->mark_tile_dirty(offset); - m_pf16x16_tilemap[i]->mark_tile_dirty(offset); - } + m_pf8x8_tilemap[0]->mark_tile_dirty(offset); + m_pf8x8_tilemap[1]->mark_tile_dirty(offset); + m_pf8x8_tilemap[2]->mark_tile_dirty(offset); + m_pf16x16_tilemap[0]->mark_tile_dirty(offset); + m_pf16x16_tilemap[1]->mark_tile_dirty(offset); + m_pf16x16_tilemap[2]->mark_tile_dirty(offset); } READ16_MEMBER( deco_bac06_device::pf_data_r ) @@ -497,7 +452,7 @@ READ16_MEMBER( deco_bac06_device::pf_colscroll_r ) return m_pf_colscroll[offset]; } -/* used by dec8.cpp */ +/* used by dec8.c */ WRITE8_MEMBER( deco_bac06_device::pf_control0_8bit_w ) { if (offset&1) @@ -506,7 +461,7 @@ WRITE8_MEMBER( deco_bac06_device::pf_control0_8bit_w ) pf_control_0_w(space,offset/2,data,0x00ff); } -/* used by dec8.cpp */ +/* used by dec8.c */ READ8_MEMBER( deco_bac06_device::pf_control1_8bit_r ) { if (offset&1) @@ -515,7 +470,7 @@ READ8_MEMBER( deco_bac06_device::pf_control1_8bit_r ) return pf_control_1_r(space,offset/2,0xff00)>>8; } -/* used by dec8.cpp */ +/* used by dec8.c */ WRITE8_MEMBER( deco_bac06_device::pf_control1_8bit_w ) { if (offset<4) // these registers are 16-bit? |