From 1f6b3f1e28096b491a4801c043d0cf7258739e8a Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 22 Mar 2020 21:11:58 +0900 Subject: cave.cpp : Log unimplement videoregs, Add notes Fix sprite position handling related to videoregs Fix tilemap offsets in ppsatan --- src/mame/drivers/cave.cpp | 251 +++++++++++++++++++++++++-------------------- src/mame/includes/cave.h | 9 ++ src/mame/video/cave.cpp | 12 +-- src/mame/video/tmap038.cpp | 4 + src/mame/video/tmap038.h | 9 +- 5 files changed, 165 insertions(+), 120 deletions(-) diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp index a7c79374c02..5d3b883e903 100644 --- a/src/mame/drivers/cave.cpp +++ b/src/mame/drivers/cave.cpp @@ -55,6 +55,10 @@ To Do: - Tilemap scrolling issue in ppsatan right screen when flipped left screen at some scenes +- Most of videoreg functions aren't implemented + +- Measure video timings + Stephh's notes (based on the games M68000 code and some tests) : 1) 'gaia' @@ -131,7 +135,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cave_state::vblank_start) update_irq_state(); get_sprite_info(0); m_agallet_vblank_irq = 1; - m_vblank_end_timer->adjust(attotime::from_usec(2000)); + m_vblank_end_timer->adjust(attotime::from_usec(2000)); // 2000us : vblank time } TIMER_DEVICE_CALLBACK_MEMBER(cave_state::vblank_start_left) { @@ -145,6 +149,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cave_state::vblank_start_right) /* Called once/frame to generate the VBLANK interrupt */ INTERRUPT_GEN_MEMBER(cave_state::interrupt) { + // 17376us : frame time m_int_timer->adjust(attotime::from_usec(17376 - m_time_vblank_irq)); } INTERRUPT_GEN_MEMBER(cave_state::interrupt_ppsatan) @@ -211,6 +216,30 @@ u16 cave_state::irq_cause_r(offs_t offset) return result; } +template +void cave_state::videoregs_w(offs_t offset, u16 data, u16 mem_mask) +{ + COMBINE_DATA(&m_videoregs[Chip][offset]); + offset <<= 1; + // offset 0x04 and 0x06 is offset related? + // offset 0x0a is position mode toggle in bit 13-12 (seperated for X and Y?), other bits used but unknown + // offset 0x68 or 0x78 is commonly watchdog or DMA command? + // offset 0x6c or 0x7c is encryption key or CRTC or something else? + // offset 0x6e is commonly communication when sound CPU exists + // other registers unknown + if (offset != 0x00 && + offset != 0x02 && + offset != 0x04 && + offset != 0x06 && + offset != 0x08 && + offset != 0x0a && + offset != 0x68 && + offset != 0x6e && + offset != 0x78) + logerror("%s: Unknown videoregs #%02X writtten %04X = %04X & %04X\n", + machine().describe_context(), Chip, offset, data, mem_mask); +} + /*************************************************************************** @@ -280,7 +309,7 @@ u16 cave_state::soundlatch_ack_r() } else { - logerror("CPU #1 - PC %04X: Sound Buffer 2 Underflow Error\n", m_maincpu->pc()); + logerror("%s: Sound Buffer 2 Underflow Error\n", machine().describe_context()); return 0xff; } } @@ -296,11 +325,10 @@ void cave_state::soundlatch_ack_w(u8 data) m_soundbuf_empty = false; } else - logerror("CPU #2 - PC %04X: Sound Buffer 2 Overflow Error\n", m_audiocpu->pc()); + logerror("%s: Sound Buffer 2 Overflow Error\n", machine().describe_context()); } - /*************************************************************************** @@ -442,7 +470,7 @@ void cave_state::dfeveron_map(address_map &map) map(0x708000, 0x708fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette map(0x710000, 0x710bff).readonly(); // ? map(0x710c00, 0x710fff).ram(); // ? - map(0x800000, 0x80007f).writeonly().share("videoregs.0"); // Video Regs + map(0x800000, 0x80007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x800000, 0x800007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x900000, 0x900005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0xa00000, 0xa00005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control @@ -465,7 +493,7 @@ void cave_state::ddonpach_map(address_map &map) map(0x500000, 0x507fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 map(0x600000, 0x607fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 map(0x700000, 0x703fff).mirror(0x00c000).m(m_tilemap[2], FUNC(tilemap038_device::vram_8x8_map)); // Layer 2 - map(0x800000, 0x80007f).writeonly().share("videoregs.0"); // Video Regs + map(0x800000, 0x80007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x800000, 0x800007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x900000, 0x900005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0xa00000, 0xa00005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control @@ -496,23 +524,23 @@ u16 cave_state::donpachi_videoregs_r(offs_t offset) void cave_state::donpachi_map(address_map &map) { - map(0x000000, 0x07ffff).rom(); // ROM - map(0x100000, 0x10ffff).ram(); // RAM - map(0x200000, 0x207fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 - map(0x300000, 0x307fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 - map(0x400000, 0x403fff).mirror(0x004000).m(m_tilemap[2], FUNC(tilemap038_device::vram_8x8_map)); // Layer 2 - map(0x500000, 0x50ffff).ram().share("spriteram.0"); // Sprites - map(0x600000, 0x600005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control - map(0x700000, 0x700005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control - map(0x800000, 0x800005).rw(m_tilemap[2], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 2 Control - map(0x900000, 0x90007f).ram().r(FUNC(cave_state::donpachi_videoregs_r)).share("videoregs.0"); // Video Regs - map(0xa08000, 0xa08fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette - map(0xb00000, 0xb00003).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); // M6295 - map(0xb00010, 0xb00013).rw("oki2", FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); // - map(0xb00020, 0xb0002f).w("nmk112", FUNC(nmk112_device::okibank_w)).umask16(0x00ff); // - map(0xc00000, 0xc00001).portr("IN0"); // Inputs - map(0xc00002, 0xc00003).portr("IN1"); // Inputs + EEPROM - map(0xd00000, 0xd00000).w(FUNC(cave_state::eeprom_w)); // EEPROM + map(0x000000, 0x07ffff).rom(); // ROM + map(0x100000, 0x10ffff).ram(); // RAM + map(0x200000, 0x207fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 + map(0x300000, 0x307fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 + map(0x400000, 0x403fff).mirror(0x004000).m(m_tilemap[2], FUNC(tilemap038_device::vram_8x8_map)); // Layer 2 + map(0x500000, 0x50ffff).ram().share("spriteram.0"); // Sprites + map(0x600000, 0x600005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control + map(0x700000, 0x700005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control + map(0x800000, 0x800005).rw(m_tilemap[2], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 2 Control + map(0x900000, 0x90007f).rw(FUNC(cave_state::donpachi_videoregs_r), FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs + map(0xa08000, 0xa08fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette + map(0xb00000, 0xb00003).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); // M6295 #0 + map(0xb00010, 0xb00013).rw("oki2", FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); // M6295 #1 + map(0xb00020, 0xb0002f).w("nmk112", FUNC(nmk112_device::okibank_w)).umask16(0x00ff); // Samples bank + map(0xc00000, 0xc00001).portr("IN0"); // Inputs + map(0xc00002, 0xc00003).portr("IN1"); // Inputs + EEPROM + map(0xd00000, 0xd00000).w(FUNC(cave_state::eeprom_w)); // EEPROM } @@ -529,7 +557,7 @@ void cave_state::esprade_map(address_map &map) map(0x500000, 0x507fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 map(0x600000, 0x607fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 map(0x700000, 0x707fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer 2 - map(0x800000, 0x80007f).writeonly().share("videoregs.0"); // Video Regs + map(0x800000, 0x80007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x800000, 0x800007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x900000, 0x900005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0xa00000, 0xa00005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control @@ -557,7 +585,7 @@ void cave_state::gaia_map(address_map &map) map(0x608000, 0x60ffff).ram(); // More Layer 1, Tested but not used? map(0x700000, 0x707fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer 2 map(0x708000, 0x70ffff).ram(); // More Layer 2, Tested but not used? - map(0x800000, 0x80007f).writeonly().share("videoregs.0"); // Video Regs + map(0x800000, 0x80007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x800000, 0x800007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x900000, 0x900005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0xa00000, 0xa00005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control @@ -579,7 +607,7 @@ void cave_state::guwange_map(address_map &map) { map(0x000000, 0x0fffff).rom(); // ROM map(0x200000, 0x20ffff).ram(); // RAM - map(0x300000, 0x30007f).writeonly().share("videoregs.0"); // Video Regs + map(0x300000, 0x30007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x300000, 0x300007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x400000, 0x40ffff).ram().share("spriteram.0"); // Sprites map(0x500000, 0x507fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 @@ -610,7 +638,7 @@ void cave_state::hotdogst_map(address_map &map) map(0x880000, 0x887fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 map(0x900000, 0x907fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 map(0x980000, 0x987fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer 2 - map(0xa80000, 0xa8007f).writeonly().share("videoregs.0"); // Video Regs + map(0xa80000, 0xa8007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0xa80000, 0xa80007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause // map(0xa8006e, 0xa8006f).r(FUNC(cave_state::soundlatch_ack_r)); // From Sound CPU map(0xa8006e, 0xa8006f).w(FUNC(cave_state::sound_cmd_w)); // To Sound CPU @@ -696,7 +724,7 @@ void cave_state::korokoro_map(address_map &map) map(0x100000, 0x107fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_writeonly_map)); // Layer 0 map(0x140000, 0x140005).w(m_tilemap[0], FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0x180000, 0x187fff).writeonly().share("spriteram.0"); // Sprites - map(0x1c0000, 0x1c007f).writeonly().share("videoregs.0"); // Video Regs + map(0x1c0000, 0x1c007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x1c0000, 0x1c0007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x200000, 0x207fff).writeonly().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette // map(0x240000, 0x240003).r("ymz", FUNC(ymz280b_device::read)).umask16(0x00ff); // YMZ280 @@ -722,7 +750,7 @@ void cave_state::crusherm_map(address_map &map) map(0x280008, 0x280009).w(FUNC(cave_state::korokoro_leds_w)); // Leds map(0x28000a, 0x28000b).w(FUNC(cave_state::korokoro_eeprom_w)); // EEPROM map(0x28000c, 0x28000d).nopw(); // 0 (watchdog?) - map(0x300000, 0x30007f).writeonly().share("videoregs.0"); // Video Regs + map(0x300000, 0x30007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x300000, 0x300007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x340000, 0x34ffff).ram(); // RAM } @@ -736,7 +764,7 @@ void cave_state::mazinger_map(address_map &map) map(0x000000, 0x07ffff).rom(); // ROM map(0x100000, 0x10ffff).ram(); // RAM map(0x200000, 0x20ffff).ram().share("spriteram.0"); // Sprites - map(0x300000, 0x30007f).writeonly().share("videoregs.0"); // Video Regs + map(0x300000, 0x30007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x300000, 0x300007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x300068, 0x300069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog map(0x30006e, 0x30006f).rw(FUNC(cave_state::soundlatch_ack_r), FUNC(cave_state::sound_cmd_w)); // From Sound CPU @@ -769,10 +797,10 @@ void cave_state::metmqstr_map(address_map &map) map(0x908000, 0x90ffff).ram(); // map(0x980000, 0x987fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 map(0x988000, 0x98ffff).ram(); // - map(0xa80000, 0xa8007f).writeonly().share("videoregs.0"); // Video Regs + map(0xa80000, 0xa8007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0xa80000, 0xa80007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0xa80068, 0xa80069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog? - map(0xa8006c, 0xa8006d).r(FUNC(cave_state::soundflags_ack_r)).nopw(); // Communication + map(0xa8006c, 0xa8006d).r(FUNC(cave_state::soundflags_ack_r))/*.nopw()*/; // Communication map(0xa8006e, 0xa8006f).rw(FUNC(cave_state::soundlatch_ack_r), FUNC(cave_state::sound_cmd_w)); // From Sound CPU map(0xb00000, 0xb00005).rw(m_tilemap[2], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 2 Control map(0xb80000, 0xb80005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control @@ -781,6 +809,8 @@ void cave_state::metmqstr_map(address_map &map) map(0xc80002, 0xc80003).portr("IN1"); // Inputs + EEPROM map(0xd00000, 0xd00000).w(FUNC(cave_state::metmqstr_eeprom_w)); // EEPROM map(0xf00000, 0xf0ffff).ram().share("spriteram.0"); // Sprites + // 0xf00000-0xf07fff Sprite RAM + // 0xf08000-0xf0ffff Work RAM } @@ -859,44 +889,44 @@ void cave_state::ppsatan_out_w(offs_t offset, u16 data, u16 mem_mask) void cave_state::ppsatan_map(address_map &map) { - map(0x000000, 0x03ffff).rom(); // ROM - map(0x040000, 0x04ffff).ram(); // RAM + map(0x000000, 0x03ffff).rom(); // ROM + map(0x040000, 0x04ffff).ram(); // RAM // Left Screen (Player 2) - map(0x080000, 0x080005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer Control - map(0x100000, 0x107fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer -// map(0x180000, 0x1803ff).ram() // Palette (Tilemaps) -// map(0x187800, 0x188fff).ram().w(m_palette[1], FUNC(palette_device::write16)).share("palette.1"); // Palette (Sprites) - map(0x180000, 0x188fff).ram().w(m_palette[1], FUNC(palette_device::write16)).share("palette.1"); // Palette - map(0x1c0000, 0x1c7fff).ram().share("spriteram.1"); // Sprites - map(0x200000, 0x200001).portr("SYSTEM"); // DSW + (unused) EEPROM - map(0x200000, 0x200001).w(FUNC(cave_state::ppsatan_out_w)); // Outputs + OKI banking - map(0x200002, 0x200003).rw(FUNC(cave_state::ppsatan_touch_r<1>), FUNC(cave_state::ppsatan_eeprom_w)); // Touch Screen + (unused) EEPROM - map(0x200004, 0x200005).rw(FUNC(cave_state::ppsatan_touch_r<0>), FUNC(cave_state::ppsatan_io_mux_w)); // Touch Screen - map(0x200006, 0x200007).nopw(); // Lev. 2 IRQ Ack? - map(0x2c0000, 0x2c007f).writeonly().share("videoregs.1"); // Video Regs - map(0x2c0000, 0x2c0007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause - map(0x2c0068, 0x2c0069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog - - map(0x300001, 0x300001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 + map(0x080000, 0x080005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer Control + map(0x100000, 0x107fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer +// map(0x180000, 0x1803ff).ram() // Palette (Tilemaps) +// map(0x187800, 0x188fff).ram().w(m_palette[1], FUNC(palette_device::write16)).share("palette.1"); // Palette (Sprites) + map(0x180000, 0x188fff).ram().w(m_palette[1], FUNC(palette_device::write16)).share("palette.1"); // Palette + map(0x1c0000, 0x1c7fff).ram().share("spriteram.1"); // Sprites + map(0x200000, 0x200001).portr("SYSTEM"); // DSW + (unused) EEPROM + map(0x200000, 0x200001).w(FUNC(cave_state::ppsatan_out_w)); // Outputs + OKI banking + map(0x200002, 0x200003).rw(FUNC(cave_state::ppsatan_touch_r<1>), FUNC(cave_state::ppsatan_eeprom_w)); // Touch Screen + (unused) EEPROM + map(0x200004, 0x200005).rw(FUNC(cave_state::ppsatan_touch_r<0>), FUNC(cave_state::ppsatan_io_mux_w)); // Touch Screen + map(0x200006, 0x200007).nopw(); // Lev. 2 IRQ Ack? + map(0x2c0000, 0x2c007f).w(FUNC(cave_state::videoregs_w<1>)).share("videoregs.1"); // Video Regs + map(0x2c0000, 0x2c0007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause + map(0x2c0068, 0x2c0069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog + + map(0x300001, 0x300001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 // Right Screen (Player 1) - map(0x480000, 0x480005).rw(m_tilemap[2], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer Control - map(0x500000, 0x507fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer -// map(0x580000, 0x5803ff).ram() // Palette (Tilemaps) -// map(0x587800, 0x588fff).ram().w(m_palette[2], FUNC(palette_device::write16)).share("palette.2"); // Palette (Sprites) - map(0x580000, 0x588fff).ram().w(m_palette[2], FUNC(palette_device::write16)).share("palette.2"); // Palette - map(0x5c0000, 0x5c7fff).ram().share("spriteram.2"); // Sprites - map(0x6c0000, 0x6c007f).writeonly().share("videoregs.2"); // Video Regs + map(0x480000, 0x480005).rw(m_tilemap[2], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer Control + map(0x500000, 0x507fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer +// map(0x580000, 0x5803ff).ram() // Palette (Tilemaps) +// map(0x587800, 0x588fff).ram().w(m_palette[2], FUNC(palette_device::write16)).share("palette.2"); // Palette (Sprites) + map(0x580000, 0x588fff).ram().w(m_palette[2], FUNC(palette_device::write16)).share("palette.2"); // Palette + map(0x5c0000, 0x5c7fff).ram().share("spriteram.2"); // Sprites + map(0x6c0000, 0x6c007f).w(FUNC(cave_state::videoregs_w<2>)).share("videoregs.2"); // Video Regs // Top Screen - map(0x880000, 0x880005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer Control - map(0x900000, 0x907fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer -// map(0x980000, 0x9803ff).ram(); // Palette (Tilemaps) -// map(0x987800, 0x988fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette (Sprites) - map(0x980000, 0x988fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette - map(0x9c0000, 0x9c7fff).ram().share("spriteram.0"); // Sprites - map(0xac0000, 0xac007f).writeonly().share("videoregs.0"); // Video Regs + map(0x880000, 0x880005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer Control + map(0x900000, 0x907fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer +// map(0x980000, 0x9803ff).ram(); // Palette (Tilemaps) +// map(0x987800, 0x988fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette (Sprites) + map(0x980000, 0x988fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette + map(0x9c0000, 0x9c7fff).ram().share("spriteram.0"); // Sprites + map(0xac0000, 0xac007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs } @@ -928,27 +958,27 @@ void cave_state::pwrinst2_vctrl_w(offs_t offset, u16 data, u16 mem_mask) void cave_state::pwrinst2_map(address_map &map) { - map(0x000000, 0x1fffff).rom(); // ROM - map(0x400000, 0x40ffff).ram(); // RAM - map(0x500000, 0x500001).portr("IN0"); // Inputs - map(0x500002, 0x500003).portr("IN1"); // - map(0x600000, 0x6fffff).rom().region("user1", 0); // extra data ROM space - map(0x700000, 0x700000).w(FUNC(cave_state::eeprom_w)); // EEPROM - map(0x800000, 0x807fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer 2 - map(0x880000, 0x887fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 - map(0x900000, 0x907fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 - map(0x980000, 0x983fff).mirror(0x004000).m(m_tilemap[3], FUNC(tilemap038_device::vram_8x8_map)); // Layer 3 - map(0xa00000, 0xa0ffff).ram().share("spriteram.0"); // Sprites - map(0xa10000, 0xa1ffff).ram(); // Sprites? - map(0xa80000, 0xa8007f).ram().r(FUNC(cave_state::donpachi_videoregs_r)).share("videoregs.0"); // Video Regs - map(0xb00000, 0xb00005).r(m_tilemap[2], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<2>)); // Layer 2 Control - map(0xb80000, 0xb80005).r(m_tilemap[0], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<0>)); // Layer 0 Control - map(0xc00000, 0xc00005).r(m_tilemap[1], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<1>)); // Layer 1 Control - map(0xc80000, 0xc80005).r(m_tilemap[3], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<3>)); // Layer 3 Control - map(0xd80000, 0xd80001).r(FUNC(cave_state::soundlatch_ack_r)); // ? From Sound CPU - map(0xe00000, 0xe00001).w(FUNC(cave_state::sound_cmd_w)); // To Sound CPU - map(0xe80000, 0xe80001).r(FUNC(cave_state::pwrinst2_eeprom_r)); // EEPROM - map(0xf00000, 0xf04fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette + map(0x000000, 0x1fffff).rom(); // ROM + map(0x400000, 0x40ffff).ram(); // RAM + map(0x500000, 0x500001).portr("IN0"); // Inputs + map(0x500002, 0x500003).portr("IN1"); // + map(0x600000, 0x6fffff).rom().region("user1", 0); // extra data ROM space + map(0x700000, 0x700000).w(FUNC(cave_state::eeprom_w)); // EEPROM + map(0x800000, 0x807fff).m(m_tilemap[2], FUNC(tilemap038_device::vram_map)); // Layer 2 + map(0x880000, 0x887fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 + map(0x900000, 0x907fff).m(m_tilemap[1], FUNC(tilemap038_device::vram_map)); // Layer 1 + map(0x980000, 0x983fff).mirror(0x004000).m(m_tilemap[3], FUNC(tilemap038_device::vram_8x8_map)); // Layer 3 + map(0xa00000, 0xa0ffff).ram().share("spriteram.0"); // Sprites + map(0xa10000, 0xa1ffff).ram(); // Sprites? + map(0xa80000, 0xa8007f).rw(FUNC(cave_state::donpachi_videoregs_r), FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs + map(0xb00000, 0xb00005).r(m_tilemap[2], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<2>)); // Layer 2 Control + map(0xb80000, 0xb80005).r(m_tilemap[0], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<0>)); // Layer 0 Control + map(0xc00000, 0xc00005).r(m_tilemap[1], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<1>)); // Layer 1 Control + map(0xc80000, 0xc80005).r(m_tilemap[3], FUNC(tilemap038_device::vregs_r)).w(FUNC(cave_state::pwrinst2_vctrl_w<3>)); // Layer 3 Control + map(0xd80000, 0xd80001).r(FUNC(cave_state::soundlatch_ack_r)); // ? From Sound CPU + map(0xe00000, 0xe00001).w(FUNC(cave_state::sound_cmd_w)); // To Sound CPU + map(0xe80000, 0xe80001).r(FUNC(cave_state::pwrinst2_eeprom_r)); // EEPROM + map(0xf00000, 0xf04fff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette } @@ -984,7 +1014,7 @@ void cave_state::sailormn_map(address_map &map) map(0xa00000, 0xa00005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0xa80000, 0xa80005).rw(m_tilemap[1], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 1 Control map(0xb00000, 0xb00005).rw(m_tilemap[2], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 2 Control - map(0xb80000, 0xb8007f).writeonly().share("videoregs.0"); // Video Regs + map(0xb80000, 0xb8007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0xb80000, 0xb80007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause (bit 2 tested!) map(0xb8006c, 0xb8006d).r(FUNC(cave_state::soundflags_ack_r)); // Communication map(0xb8006e, 0xb8006f).r(FUNC(cave_state::soundlatch_ack_r)); // From Sound CPU @@ -1006,7 +1036,7 @@ void cave_state::tekkencw_map(address_map &map) map(0x400002, 0x400003).portr("IN1"); // Inputs map(0x500000, 0x500005).w(m_tilemap[0], FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0x600000, 0x60ffff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette - map(0x700000, 0x70007f).writeonly().share("videoregs.0"); // Video Regs + map(0x700000, 0x70007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x700000, 0x700007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x700068, 0x700069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog map(0x800001, 0x800001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 @@ -1029,7 +1059,7 @@ void cave_state::tekkenbs_map(address_map &map) map(0x500000, 0x500005).w(m_tilemap[0], FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0x600000, 0x600001).portr("IN0"); // Inputs + EEPROM + Hopper map(0x600002, 0x600003).portr("IN1"); // Inputs - map(0x700000, 0x70007f).writeonly().share("videoregs.0"); // Video Regs + map(0x700000, 0x70007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x700000, 0x700007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x700068, 0x700069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog map(0x800001, 0x800001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 @@ -1087,7 +1117,7 @@ void cave_state::tjumpman_map(address_map &map) map(0x500000, 0x50ffff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette map(0x600000, 0x600001).portr("IN0"); // Inputs + EEPROM + Hopper map(0x600002, 0x600003).portr("IN1"); // Inputs - map(0x700000, 0x70007f).writeonly().share("videoregs.0"); // Video Regs + map(0x700000, 0x70007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x700000, 0x700007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x700068, 0x700069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog map(0x800001, 0x800001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 @@ -1119,7 +1149,7 @@ void cave_state::pacslot_map(address_map &map) map(0x100000, 0x10ffff).ram().share("nvram"); // RAM (battery) map(0x200000, 0x20ffff).ram().share("spriteram.0"); // Sprites map(0x300000, 0x307fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 - map(0x400000, 0x40007f).writeonly().share("videoregs.0"); // Video Regs + map(0x400000, 0x40007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x400000, 0x400007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x400068, 0x400069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog map(0x500000, 0x500005).w(m_tilemap[0], FUNC(tilemap038_device::vregs_w)); // Layer 0 Control @@ -1148,7 +1178,7 @@ void cave_state::paceight_map(address_map &map) map(0x500000, 0x500001).portr("IN0"); // Inputs + EEPROM + Hopper map(0x500002, 0x500003).portr("IN1"); // Inputs map(0x600000, 0x600005).w(m_tilemap[0], FUNC(tilemap038_device::vregs_w)); // Layer 0 Control - map(0x700000, 0x70007f).writeonly().share("videoregs.0"); // Video Regs + map(0x700000, 0x70007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x700000, 0x700007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x700068, 0x700069).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); // Watchdog map(0x800001, 0x800001).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 @@ -1167,7 +1197,7 @@ void cave_state::uopoko_map(address_map &map) map(0x300000, 0x300003).rw("ymz", FUNC(ymz280b_device::read), FUNC(ymz280b_device::write)).umask16(0x00ff); // YMZ280 map(0x400000, 0x40ffff).ram().share("spriteram.0"); // Sprites map(0x500000, 0x507fff).m(m_tilemap[0], FUNC(tilemap038_device::vram_map)); // Layer 0 - map(0x600000, 0x60007f).writeonly().share("videoregs.0"); // Video Regs + map(0x600000, 0x60007f).w(FUNC(cave_state::videoregs_w<0>)).share("videoregs.0"); // Video Regs map(0x600000, 0x600007).r(FUNC(cave_state::irq_cause_r)); // IRQ Cause map(0x700000, 0x700005).rw(m_tilemap[0], FUNC(tilemap038_device::vregs_r), FUNC(tilemap038_device::vregs_w)); // Layer 0 Control map(0x800000, 0x80ffff).ram().w(m_palette[0], FUNC(palette_device::write16)).share("palette.0"); // Palette @@ -1190,7 +1220,7 @@ template void cave_state::z80_rombank_w(u8 data) { if (data & ~Mask) - logerror("CPU #1 - PC %04X: Bank %02X\n", m_audiocpu->pc(), data); + logerror("%s: Bank %02X\n", machine().describe_context(), data); m_z80bank->set_entry(data & Mask); } @@ -1243,8 +1273,8 @@ void cave_state::hotdogst_sound_portmap(address_map &map) map.global_mask(0xff); map(0x00, 0x00).w(FUNC(cave_state::z80_rombank_w<0x0f>)); // ROM bank map(0x30, 0x30).r(FUNC(cave_state::soundlatch_lo_r)); // From Main CPU - map(0x40, 0x40).r(FUNC(cave_state::soundlatch_hi_r)); // - map(0x50, 0x51).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); // + map(0x40, 0x40).r(FUNC(cave_state::soundlatch_hi_r)); // "" + map(0x50, 0x51).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); // YM2203 map(0x60, 0x60).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 map(0x70, 0x70).w(FUNC(cave_state::oki1_bank_w<0x3>)); // Samples bank } @@ -1292,7 +1322,7 @@ void cave_state::metmqstr_sound_portmap(address_map &map) map(0x00, 0x00).w(FUNC(cave_state::z80_rombank_w<0x0f>)); // Rom Bank map(0x20, 0x20).r(FUNC(cave_state::soundflags_r)); // Communication map(0x30, 0x30).r(FUNC(cave_state::soundlatch_lo_r)); // From Main CPU - map(0x40, 0x40).r(FUNC(cave_state::soundlatch_hi_r)); // + map(0x40, 0x40).r(FUNC(cave_state::soundlatch_hi_r)); // "" map(0x50, 0x51).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); // YM2151 map(0x60, 0x60).w("oki1", FUNC(okim6295_device::write)); // M6295 #0 map(0x70, 0x70).w(FUNC(cave_state::oki1_bank_w<0x7>)); // Samples Bank #0 @@ -1315,14 +1345,14 @@ void cave_state::pwrinst2_sound_map(address_map &map) void cave_state::pwrinst2_sound_portmap(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 - map(0x08, 0x08).rw("oki2", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // + map(0x00, 0x00).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 #0 + map(0x08, 0x08).rw("oki2", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 #1 map(0x10, 0x17).w("nmk112", FUNC(nmk112_device::okibank_w)); // Samples bank - map(0x40, 0x41).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); // + map(0x40, 0x41).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); // YM2203 map(0x50, 0x50).w(FUNC(cave_state::soundlatch_ack_w)); // To Main CPU // map(0x51, 0x51).nopw(); // ?? volume map(0x60, 0x60).r(FUNC(cave_state::soundlatch_hi_r)); // From Main CPU - map(0x70, 0x70).r(FUNC(cave_state::soundlatch_lo_r)); // + map(0x70, 0x70).r(FUNC(cave_state::soundlatch_lo_r)); // "" map(0x80, 0x80).w(FUNC(cave_state::z80_rombank_w<0x07>)); // ROM bank } @@ -1345,7 +1375,7 @@ void cave_state::sailormn_sound_portmap(address_map &map) map(0x10, 0x10).w(FUNC(cave_state::soundlatch_ack_w)); // To Main CPU map(0x20, 0x20).r(FUNC(cave_state::soundflags_r)); // Communication map(0x30, 0x30).r(FUNC(cave_state::soundlatch_lo_r)); // From Main CPU - map(0x40, 0x40).r(FUNC(cave_state::soundlatch_hi_r)); // + map(0x40, 0x40).r(FUNC(cave_state::soundlatch_hi_r)); // "" map(0x50, 0x51).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); // YM2151 map(0x60, 0x60).rw("oki1", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 #0 map(0x70, 0x70).w(FUNC(cave_state::oki1_bank_w<0xf>)); // Samples Bank #0 @@ -2386,13 +2416,17 @@ void cave_state::ppsatan(machine_config &config) GFXDECODE(config, m_gfxdecode[1], m_palette[1], gfx_ppsatan_1); GFXDECODE(config, m_gfxdecode[2], m_palette[2], gfx_ppsatan_2); + m_tilemap[0]->set_xoffs(2, 0); + TMAP038(config, m_tilemap[1]); m_tilemap[1]->set_gfxdecode_tag(m_gfxdecode[1]); m_tilemap[1]->set_gfx(0); + m_tilemap[1]->set_xoffs(1, 0); TMAP038(config, m_tilemap[2]); m_tilemap[2]->set_gfxdecode_tag(m_gfxdecode[2]); m_tilemap[2]->set_gfx(0); + m_tilemap[2]->set_xoffs(0, -57); m_palette[0]->set_entries(0x9000/2); PALETTE(config, m_palette[1], palette_device::BLACK).set_format(palette_device::xGRB_555, 0x9000/2); @@ -4820,7 +4854,7 @@ void cave_state::sailormn_unpack_tiles(int chip) void cave_state::init_cave() { - m_spritetype[0] = 0; // Normal sprites + m_spritetype[0] = TYPE_ZOOM; // Normal sprites m_kludge = 0; m_time_vblank_irq = 100; @@ -4876,7 +4910,7 @@ void cave_state::init_ddonpach() init_cave(); ddp_unpack_sprites(0); - m_spritetype[0] = 1; // "different" sprites (no zooming?) + m_spritetype[0] = TYPE_NOZOOM; // "different" sprites (no zooming?) m_time_vblank_irq = 90; /* 4bpp but Only first 16 colors are used in palette index for Layer 0, 1. */ @@ -4889,7 +4923,7 @@ void cave_state::init_donpachi() init_cave(); ddp_unpack_sprites(0); - m_spritetype[0] = 1; // "different" sprites (no zooming?) + m_spritetype[0] = TYPE_NOZOOM; // "different" sprites (no zooming?) m_time_vblank_irq = 90; } @@ -4915,7 +4949,6 @@ void cave_state::init_gaia() /* No EEPROM */ unpack_sprites(0); - m_spritetype[0] = 2; // Normal sprites with different position handling m_time_vblank_irq = 2000; /**/ } @@ -4935,7 +4968,6 @@ void cave_state::init_hotdogst() init_oki_bank(0); unpack_sprites(0); - m_spritetype[0] = 2; // Normal sprites with different position handling m_time_vblank_irq = 2000; /**/ } @@ -4958,7 +4990,6 @@ void cave_state::init_mazinger() } unpack_sprites(0); - m_spritetype[0] = 2; // Normal sprites with different position handling m_kludge = 3; m_time_vblank_irq = 2100; } @@ -4972,7 +5003,6 @@ void cave_state::init_metmqstr() init_oki_bank(1); unpack_sprites(0); - m_spritetype[0] = 2; // Normal sprites with different position handling m_kludge = 3; m_time_vblank_irq = 17376; } @@ -4985,7 +5015,6 @@ void cave_state::init_ppsatan() unpack_sprites(1); unpack_sprites(2); - m_spritetype[0] = 2; m_time_vblank_irq = 2000; /**/ m_ppsatan_io_mux = 0; @@ -5015,7 +5044,7 @@ void cave_state::init_pwrinst2j() } unpack_sprites(0); - m_spritetype[0] = 3; + m_spritetype[0] = TYPE_NOZOOM | TYPE_ISPWRINST2; m_kludge = 4; m_time_vblank_irq = 2000; /**/ } @@ -5057,7 +5086,6 @@ void cave_state::init_sailormn() sailormn_unpack_tiles(2); unpack_sprites(0); - m_spritetype[0] = 2; // Normal sprites with different position handling m_kludge = 1; m_time_vblank_irq = 2000; @@ -5070,7 +5098,6 @@ void cave_state::init_tjumpman() init_cave(); unpack_sprites(0); - m_spritetype[0] = 2; // Normal sprites with different position handling m_kludge = 3; m_time_vblank_irq = 17376; diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h index d509a5aa203..d90b2767f6b 100644 --- a/src/mame/includes/cave.h +++ b/src/mame/includes/cave.h @@ -100,6 +100,14 @@ protected: virtual void device_post_load() override; private: + + enum + { + TYPE_ZOOM = 0, + TYPE_NOZOOM = 1, + TYPE_ISPWRINST2 = 2 + }; + void (cave_state::*m_get_sprite_info)(int chip); void (cave_state::*m_sprite_draw)(int chip, int priority); @@ -116,6 +124,7 @@ private: void soundlatch_ack_w(u8 data); void gaia_coin_w(u8 data); u16 donpachi_videoregs_r(offs_t offset); + template void videoregs_w(offs_t offset, u16 data, u16 mem_mask); void korokoro_leds_w(offs_t offset, u16 data, u16 mem_mask); template void pwrinst2_vctrl_w(offs_t offset, u16 data, u16 mem_mask); u16 sailormn_input0_r(); diff --git a/src/mame/video/cave.cpp b/src/mame/video/cave.cpp index d43266a74ca..198134ed84f 100644 --- a/src/mame/video/cave.cpp +++ b/src/mame/video/cave.cpp @@ -217,12 +217,12 @@ void cave_state::get_sprite_info_cave(int chip) int x, y; int total_width_f, total_height_f; - if (m_spritetype[0] == 2) /* Hot Dog Storm */ + if ((m_videoregs[chip][5] & 0x3000) == 0) // if bit 12/13 is 0 (or seperated per X and Y?) { x = (source[0] & 0x3ff) << 8; y = (source[1] & 0x3ff) << 8; } - else /* all others */ + else { x = source[0] << 2; y = source[1] << 2; @@ -275,7 +275,7 @@ void cave_state::get_sprite_info_cave(int chip) sprite->ycount0 = sprite->zoomy_re - 1; } - if (m_spritetype[0] == 2) + if ((m_videoregs[chip][5] & 0x3000) == 0) { x >>= 8; y >>= 8; @@ -343,7 +343,7 @@ void cave_state::get_sprite_info_donpachi(int chip) u32 code = source[1] + ((attr & 3) << 16); int x = source[2] & 0x3ff; - if (m_spritetype[0] == 3) /* pwrinst2 */ + if (m_spritetype[0] & TYPE_ISPWRINST2) /* pwrinst2 */ y = (source[3] + 1) & 0x3ff; else y = source[3] & 0x3ff; @@ -367,7 +367,7 @@ void cave_state::get_sprite_info_donpachi(int chip) int flipx = attr & 0x0008; int flipy = attr & 0x0004; - if (m_spritetype[0] == 3) /* pwrinst2 */ + if (m_spritetype[0] & TYPE_ISPWRINST2) /* pwrinst2 */ { sprite->priority = ((attr & 0x0010) >> 4) + 2; sprite->base_pen = m_sprite_base_pal + ((((attr & 0x3f00) >> 8) + ((attr & 0x0020) << 1)) * m_sprite_granularity); @@ -398,7 +398,7 @@ void cave_state::get_sprite_info_donpachi(int chip) void cave_state::sprite_init() { - if (m_spritetype[0] == 0 || m_spritetype[0] == 2) // most of the games + if ((m_spritetype[0] & TYPE_NOZOOM) == 0) // most of the games { m_get_sprite_info = &cave_state::get_sprite_info_cave; m_spritetype[1] = CAVE_SPRITETYPE_ZOOM; diff --git a/src/mame/video/tmap038.cpp b/src/mame/video/tmap038.cpp index 4725d38ce35..d12e5c2d9d1 100644 --- a/src/mame/video/tmap038.cpp +++ b/src/mame/video/tmap038.cpp @@ -138,6 +138,10 @@ tilemap038_device::tilemap038_device(const machine_config &mconfig, const char * , m_gfxdecode(*this, finder_base::DUMMY_TAG) , m_gfxno(0) , m_038_cb(*this) + , m_xoffs(0) + , m_flipped_xoffs(0) + , m_yoffs(0) + , m_flipped_yoffs(0) { } diff --git a/src/mame/video/tmap038.h b/src/mame/video/tmap038.h index 3a0773c24cf..28076199641 100644 --- a/src/mame/video/tmap038.h +++ b/src/mame/video/tmap038.h @@ -23,6 +23,8 @@ public: template void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward(tag)); } template void set_tile_callback(T &&... args) { m_038_cb.set(std::forward(args)...); } void set_gfx(u16 no) { m_gfxno = no; } + void set_xoffs(int xoffs, int flipped_xoffs) { m_xoffs = xoffs; m_flipped_xoffs = flipped_xoffs; } + void set_yoffs(int yoffs, int flipped_yoffs) { m_yoffs = yoffs; m_flipped_yoffs = flipped_yoffs; } // call to do the rendering etc. template @@ -71,12 +73,12 @@ public: // vregs bool flipx() const { return BIT(~m_vregs[0], 15); } bool rowscroll_en() const { return BIT(m_vregs[0], 14) && (m_lineram != nullptr); } - u16 scrollx() const { return m_vregs[0] & 0x1ff; } + int scrollx() const { return (m_vregs[0] & 0x1ff) + (flipx() ? m_flipped_xoffs : m_xoffs); } bool flipy() const { return BIT(~m_vregs[1], 15); } bool rowselect_en() const { return BIT(m_vregs[1], 14) && (m_lineram != nullptr); } bool tiledim() const { return m_tiledim; } - u16 scrolly() const { return m_vregs[1] & 0x1ff; } + int scrolly() const { return (m_vregs[1] & 0x1ff) + (flipy() ? m_flipped_yoffs : m_yoffs); } bool enable() const { return BIT(~m_vregs[2], 4); } u16 external() const { return m_vregs[2] & 0xf; } @@ -101,6 +103,9 @@ private: tmap038_cb_delegate m_038_cb; tilemap_t* m_tmap; + + int m_xoffs, m_flipped_xoffs; + int m_yoffs, m_flipped_yoffs; }; -- cgit v1.2.3