diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mame/drivers/xmen.cpp | 35 | ||||
-rw-r--r-- | src/mame/includes/xmen.h | 22 | ||||
-rw-r--r-- | src/mame/video/xmen.cpp | 83 |
3 files changed, 49 insertions, 91 deletions
diff --git a/src/mame/drivers/xmen.cpp b/src/mame/drivers/xmen.cpp index 73d549da487..a886ff9bb40 100644 --- a/src/mame/drivers/xmen.cpp +++ b/src/mame/drivers/xmen.cpp @@ -8,13 +8,19 @@ driver by Nicola Salmoria notes: -the way the double screen works in xmen6p is not fully understood +The way the double screen works in xmen6p is not fully understood. -the board only has one of each gfx chip, the only additional chip not found +One of the screens probably has a buffer to delay it by 1 frame. If you +hardcode buffering to the right screen, the intro is synced correctly, +but in-game is not. Buffer the left screen and then in-game is correct, +but the intro is not. + +The board only has one of each gfx chip, the only additional chip not found on the 2/4p board is 053253. This chip is also on Run n Gun which is -likewise a 2 screen game +likewise a 2 screen game. ***************************************************************************/ + #include "emu.h" #include "includes/xmen.h" #include "includes/konamipt.h" @@ -46,8 +52,10 @@ void xmen_state::eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask) /* bit 2 is data */ /* bit 3 is clock (active high) */ /* bit 4 is cs (active low) */ - /* bit 5 is enabled in IRQ3, disabled in IRQ5 (sprite DMA start?) */ ioport("EEPROMOUT")->write(data, 0xff); + + /* bit 5 is enabled in IRQ3, disabled in IRQ5 (sprite DMA start?) */ + /* bit 7 used in xmen6p to select other tilemap bank (see halfway level 5) */ m_xmen6p_tilemap_select = BIT(data, 7); } if (ACCESSING_BITS_8_15) @@ -57,7 +65,7 @@ void xmen_state::eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask) /* bit 9 = enable char ROM reading through the video RAM */ /* bit 10 = sound irq, but with some kind of hold */ m_k052109->set_rmrd_line((data & 0x0200) ? ASSERT_LINE : CLEAR_LINE); - if(data & 0x4) { + if(data & 0x400) { logerror("tick!\n"); m_audiocpu->set_input_line(0, HOLD_LINE); } @@ -115,9 +123,9 @@ void xmen_state::_6p_main_map(address_map &map) { map(0x000000, 0x03ffff).rom(); map(0x080000, 0x0fffff).rom(); - map(0x100000, 0x100fff).ram().share("spriteramleft"); /* sprites (screen 1) */ + map(0x100000, 0x100fff).ram().share("spriteram0"); // left screen map(0x101000, 0x101fff).ram(); - map(0x102000, 0x102fff).ram().share("spriteramright"); /* sprites (screen 2) */ + map(0x102000, 0x102fff).ram().share("spriteram1"); // right screen map(0x103000, 0x103fff).ram(); /* 6p - a buffer? */ map(0x104000, 0x104fff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); map(0x108000, 0x108001).w(FUNC(xmen_state::eeprom_w)); @@ -131,7 +139,7 @@ void xmen_state::_6p_main_map(address_map &map) map(0x10a00c, 0x10a00d).r(m_k053246, FUNC(k053247_device::k053246_r)); /* sprites */ map(0x110000, 0x113fff).ram(); /* main RAM */ /* map(0x18c000, 0x197fff).w("k052109", FUNC(k052109_device:write)).umask16(0x00ff).share("tilemapleft"); */ - map(0x18c000, 0x197fff).ram().share("tilemapleft"); /* left tilemap (p1,p2,p3 counters) */ + map(0x18c000, 0x197fff).ram().share("tilemap0"); // left screen map(0x18fa00, 0x18fa01).w(FUNC(xmen_state::xmen_18fa00_w)); /* map(0x1ac000, 0x1af7ff).readonly(); @@ -143,7 +151,7 @@ void xmen_state::_6p_main_map(address_map &map) map(0x1b4000, 0x1b77ff).readonly(); map(0x1b4000, 0x1b77ff).writeonly(); */ - map(0x1ac000, 0x1b7fff).ram().share("tilemapright"); /* right tilemap */ + map(0x1ac000, 0x1b7fff).ram().share("tilemap1"); // right screen /* what are the regions below buffers? (used by hw or software?) */ /* @@ -153,7 +161,7 @@ void xmen_state::_6p_main_map(address_map &map) map(0x1d0000, 0x1d37ff).readonly(); map(0x1d0000, 0x1d37ff).writeonly(); */ - map(0x1cc000, 0x1d7fff).ram().share("tilemapleftalt"); /* tilemap ? */ + map(0x1cc000, 0x1d7fff).ram().share("tilemap2"); // left screen /* whats the stuff below, buffers? */ /* @@ -164,7 +172,7 @@ void xmen_state::_6p_main_map(address_map &map) map(0x1f4000, 0x1f77ff).readonly(); map(0x1f4000, 0x1f77ff).writeonly(); */ - map(0x1ec000, 0x1f7fff).ram().share("tilemaprightalt"); /* tilemap ? */ + map(0x1ec000, 0x1f7fff).ram().share("tilemap3"); // right screen } @@ -276,9 +284,7 @@ void xmen_state::machine_start() void xmen_state::machine_reset() { - int i; - - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { m_layerpri[i] = 0; m_layer_colorbase[i] = 0; @@ -297,7 +303,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(xmen_state::xmen_scanline) if(scanline == 0) // sprite DMA irq? m_maincpu->set_input_line(5, HOLD_LINE); - } void xmen_state::xmen(machine_config &config) diff --git a/src/mame/includes/xmen.h b/src/mame/includes/xmen.h index 9e24945920a..3bdc2a2c671 100644 --- a/src/mame/includes/xmen.h +++ b/src/mame/includes/xmen.h @@ -20,12 +20,8 @@ class xmen_state : public driver_device public: xmen_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_xmen6p_spriteramleft(*this, "spriteramleft"), - m_xmen6p_spriteramright(*this, "spriteramright"), - m_xmen6p_tilemapleft(*this, "tilemapleft"), - m_xmen6p_tilemapright(*this, "tilemapright"), - m_xmen6p_tilemapleftalt(*this, "tilemapleftalt"), - m_xmen6p_tilemaprightalt(*this, "tilemaprightalt"), + m_xmen6p_spriteram(*this, "spriteram%u", 0), + m_xmen6p_tilemap(*this, "tilemap%u", 0), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_k054539(*this, "k054539"), @@ -51,17 +47,13 @@ private: /* for xmen6p */ std::unique_ptr<bitmap_ind16> m_screen_right; std::unique_ptr<bitmap_ind16> m_screen_left; - optional_shared_ptr<uint16_t> m_xmen6p_spriteramleft; - optional_shared_ptr<uint16_t> m_xmen6p_spriteramright; - optional_shared_ptr<uint16_t> m_xmen6p_tilemapleft; - optional_shared_ptr<uint16_t> m_xmen6p_tilemapright; - optional_shared_ptr<uint16_t> m_xmen6p_tilemapleftalt; - optional_shared_ptr<uint16_t> m_xmen6p_tilemaprightalt; - uint16_t * m_k053247_ram; + optional_shared_ptr_array<uint16_t, 2> m_xmen6p_spriteram; + optional_shared_ptr_array<uint16_t, 4> m_xmen6p_tilemap; + uint16_t * m_k053247_ram; + bool m_xmen6p_tilemap_select; /* misc */ - uint8_t m_vblank_irq_mask; - bool m_xmen6p_tilemap_select; + uint8_t m_vblank_irq_mask; /* devices */ required_device<cpu_device> m_maincpu; diff --git a/src/mame/video/xmen.cpp b/src/mame/video/xmen.cpp index d33555e2730..63fcc8c640d 100644 --- a/src/mame/video/xmen.cpp +++ b/src/mame/video/xmen.cpp @@ -95,7 +95,7 @@ uint32_t xmen_state::screen_update_xmen(screen_device &screen, bitmap_ind16 &bit m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2); m_k052109->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4); -/* this isn't supported anymore and it is unsure if still needed; keeping here for reference + /* this isn't supported anymore and it is unsure if still needed; keeping here for reference pdrawgfx_shadow_lowpri = 1; fix shadows of boulders in front of feet */ m_k053246->k053247_sprites_draw( bitmap, cliprect); return 0; @@ -104,14 +104,12 @@ uint32_t xmen_state::screen_update_xmen(screen_device &screen, bitmap_ind16 &bit uint32_t xmen_state::screen_update_xmen6p_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for(y = 0; y < 32 * 8; y++) + for(int y = 0; y < 32 * 8; y++) { uint16_t* line_dest = &bitmap.pix16(y); uint16_t* line_src = &m_screen_left->pix16(y); - for (x = 12 * 8; x < 52 * 8; x++) + for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; } @@ -120,14 +118,12 @@ uint32_t xmen_state::screen_update_xmen6p_left(screen_device &screen, bitmap_ind uint32_t xmen_state::screen_update_xmen6p_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - - for(y = 0; y < 32 * 8; y++) + for(int y = 0; y < 32 * 8; y++) { uint16_t* line_dest = &bitmap.pix16(y); uint16_t* line_src = &m_screen_right->pix16(y); - for (x = 12 * 8; x < 52 * 8; x++) + for (int x = 12 * 8; x < 52 * 8; x++) line_dest[x] = line_src[x]; } @@ -143,63 +139,28 @@ WRITE_LINE_MEMBER(xmen_state::screen_vblank_xmen6p) int layer[3], bg_colorbase; bitmap_ind16 * renderbitmap; rectangle cliprect; - int offset; - - // const rectangle *visarea = m_screen->visible_area(); - // cliprect = *visarea; + // const rectangle *visarea = m_screen->visible_area(); + // cliprect = *visarea; cliprect.set(0, 64 * 8 - 1, 2 * 8, 30 * 8 - 1); + int index = m_screen->frame_number() & 1; + renderbitmap = index ? m_screen_right.get() : m_screen_left.get(); - if (m_screen->frame_number() & 0x01) - { - /* copy the desired spritelist to the chip */ - memcpy(m_k053247_ram, m_xmen6p_spriteramright, 0x1000); - - /* we write the entire content of the tileram to the chip to ensure - everything gets marked as dirty and the desired tilemap is rendered - this is not very efficient! - */ - for (offset = 0; offset < (0xc000 / 2); offset++) - { - if (offset != 0x1c80 && offset != 0x1e80) - { - if (m_xmen6p_tilemap_select) - m_k052109->write(offset, m_xmen6p_tilemaprightalt[offset] & 0x00ff); - else - m_k052109->write(offset, m_xmen6p_tilemapright[offset] & 0x00ff); - } - } - - renderbitmap = m_screen_right.get(); - } - else + /* copy the desired spritelist to the chip */ + memcpy(m_k053247_ram, m_xmen6p_spriteram[index], 0x1000); + + /* we write the entire content of the tileram to the chip to ensure + everything gets marked as dirty and the desired tilemap is rendered + this is not very efficient! + */ + index += m_xmen6p_tilemap_select ? 2 : 0; + for (int offset = 0; offset < (0xc000 / 2); offset++) { - /* copy the desired spritelist to the chip */ - memcpy(m_k053247_ram, m_xmen6p_spriteramleft, 0x1000); - - /* we write the entire content of the tileram to the chip to ensure - everything gets marked as dirty and the desired tilemap is rendered - - this is not very efficient! - */ - for (offset = 0; offset < (0xc000 / 2); offset++) - { - { - if (m_xmen6p_tilemap_select) - { - if (offset != 0x1c80 && offset != 0x1e80) - m_k052109->write(offset, m_xmen6p_tilemapleftalt[offset] & 0x00ff); - } - else - m_k052109->write(offset, m_xmen6p_tilemapleft[offset] & 0x00ff); - } - } - - renderbitmap = m_screen_left.get(); + if (index == 0 || (offset != 0x1c80 && offset != 0x1e80)) + m_k052109->write(offset, m_xmen6p_tilemap[index][offset] & 0x00ff); } - bg_colorbase = m_k053251->get_palette_index(k053251_device::CI4); m_sprite_colorbase = m_k053251->get_palette_index(k053251_device::CI1); m_layer_colorbase[0] = m_k053251->get_palette_index(k053251_device::CI3); @@ -224,8 +185,8 @@ WRITE_LINE_MEMBER(xmen_state::screen_vblank_xmen6p) m_k052109->tilemap_draw(*m_screen, *renderbitmap, cliprect, layer[1], 0, 2); m_k052109->tilemap_draw(*m_screen, *renderbitmap, cliprect, layer[2], 0, 4); - /* this isn't supported anymore and it is unsure if still needed; keeping here for reference + /* this isn't supported anymore and it is unsure if still needed; keeping here for reference pdrawgfx_shadow_lowpri = 1; fix shadows of boulders in front of feet */ - m_k053246->k053247_sprites_draw( *renderbitmap, cliprect); + m_k053246->k053247_sprites_draw(*renderbitmap, cliprect); } } |