summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author David Haywood <mamehaze@gmail.com>2018-10-12 02:27:19 +0100
committer R. Belmont <rb6502@users.noreply.github.com>2018-10-11 21:27:19 -0400
commitd1009b850741d6a55a076a03d67f3d7b682f6628 (patch)
treecdc9c0e8eba5cf440ba06109dbd9292db898b038
parent28b2a04ee3fc2ac1865b20d6c93659efc450fb2d (diff)
XaviX - improvements to eka_xx sets, has_wamg needs DMA regs readback (but still crashes before showing anything) (#4123)
* eka_xx sets require the bios to be mapped, not replaced (nw) * some cleanups (nw) * order buttons as per how the system names them (nw) * looking at priorities (not quite right yet) * better? (nw) * gave bass fishing some inputs (nw) * this isn't very logical.. (nw) * better transparency handling (nw) * cleanup (nw) * help card night (nw) * support 'arena control' used by Slap Fight Tiger when starting a game (nw) * safeguard (nw) * (nw) * naming changes (nw) * naming changes (nw)
-rw-r--r--src/mame/drivers/xavix.cpp120
-rw-r--r--src/mame/includes/xavix.h66
-rw-r--r--src/mame/machine/xavix.cpp184
-rw-r--r--src/mame/video/xavix.cpp150
4 files changed, 312 insertions, 208 deletions
diff --git a/src/mame/drivers/xavix.cpp b/src/mame/drivers/xavix.cpp
index dcc66f2ed47..f035da53173 100644
--- a/src/mame/drivers/xavix.cpp
+++ b/src/mame/drivers/xavix.cpp
@@ -296,8 +296,7 @@ void xavix_state::xavix_map(address_map &map)
void xavix_state::xavix_lowbus_map(address_map &map)
{
- map(0x0000, 0x01ff).ram();
- map(0x0200, 0x3fff).ram().share("mainram");
+ map(0x0000, 0x3fff).ram().share("mainram");
// Memory Emulator / Text Array
map(0x4000, 0x4fff).rw(FUNC(xavix_state::xavix_memoryemu_txarray_r), FUNC(xavix_state::xavix_memoryemu_txarray_w));
@@ -326,21 +325,21 @@ void xavix_state::xavix_lowbus_map(address_map &map)
map(0x6fe1, 0x6fe2).w(FUNC(xavix_state::spritefragment_dma_params_1_w));
map(0x6fe5, 0x6fe6).w(FUNC(xavix_state::spritefragment_dma_params_2_w));
- // Arena Registers
+ // Arena Registers (controls visible window + more?)
map(0x6fe8, 0x6fe8).rw(FUNC(xavix_state::arena_start_r), FUNC(xavix_state::arena_start_w)); // r/w tested
map(0x6fe9, 0x6fe9).rw(FUNC(xavix_state::arena_end_r), FUNC(xavix_state::arena_end_w)); // r/w tested
- map(0x6fea, 0x6fea).w(FUNC(xavix_state::arena_control_w));
+ map(0x6fea, 0x6fea).rw(FUNC(xavix_state::arena_control_r), FUNC(xavix_state::arena_control_w));
// Colour Mixing / Enabling Registers
- map(0x6ff0, 0x6ff0).ram().share("colmix_sh"); // a single colour (for effects or bgpen?)
+ map(0x6ff0, 0x6ff0).ram().share("colmix_sh"); // a single colour (for effects?) not bgpen
map(0x6ff1, 0x6ff1).ram().share("colmix_l");
map(0x6ff2, 0x6ff2).w(FUNC(xavix_state::colmix_6ff2_w)); // set to 07 after clearing above things in interrupt 0
// Display Control Register / Status Flags
map(0x6ff8, 0x6ff8).rw(FUNC(xavix_state::dispctrl_6ff8_r), FUNC(xavix_state::dispctrl_6ff8_w)); // always seems to be a read/store or read/modify/store
map(0x6ff9, 0x6ff9).r(FUNC(xavix_state::pal_ntsc_r));
- map(0x6ffa, 0x6ffa).w(FUNC(xavix_state::dispctrl_6ffa_w));
- map(0x6ffb, 0x6ffb).w(FUNC(xavix_state::dispctrl_6ffb_w)); // increases / decreases when you jump in snowboard, maybe raster irq pos or part of a clipping window?
+ map(0x6ffa, 0x6ffa).w(FUNC(xavix_state::dispctrl_posirq_x_w));
+ map(0x6ffb, 0x6ffb).w(FUNC(xavix_state::dispctrl_posirq_y_w)); // increases / decreases when you jump in snowboard (snowboard, used to blank ground)
// Lightgun / pen 1 control
// map(0x6ffc, 0x6fff)
@@ -351,7 +350,7 @@ void xavix_state::xavix_lowbus_map(address_map &map)
// Sound Control
map(0x75f0, 0x75f0).rw(FUNC(xavix_state::sound_75f0_r), FUNC(xavix_state::sound_75f0_w)); // r/w tested read/written 8 times in a row
map(0x75f1, 0x75f1).rw(FUNC(xavix_state::sound_75f1_r), FUNC(xavix_state::sound_75f1_w)); // r/w tested read/written 8 times in a row
- map(0x75f3, 0x75f3).ram();
+ map(0x75f2, 0x75f3).ram();
map(0x75f4, 0x75f4).r(FUNC(xavix_state::sound_75f4_r)); // related to 75f0 (read after writing there - rad_mtrk)
map(0x75f5, 0x75f5).r(FUNC(xavix_state::sound_75f5_r)); // related to 75f1 (read after writing there - rad_mtrk)
// taitons1 after 75f7/75f8
@@ -379,20 +378,16 @@ void xavix_state::xavix_lowbus_map(address_map &map)
map(0x7902, 0x7902).w(FUNC(xavix_state::extintrf_7902_w));
// DMA Controller
- map(0x7980, 0x7980).rw(FUNC(xavix_state::rom_dmatrg_r), FUNC(xavix_state::rom_dmatrg_w));
- map(0x7981, 0x7981).w(FUNC(xavix_state::rom_dmasrc_lo_w)); // DMA source
- map(0x7982, 0x7982).w(FUNC(xavix_state::rom_dmasrc_md_w));
- map(0x7983, 0x7983).w(FUNC(xavix_state::rom_dmasrc_hi_w));
- map(0x7984, 0x7984).w(FUNC(xavix_state::rom_dmadst_lo_w)); // DMA dest
- map(0x7985, 0x7985).w(FUNC(xavix_state::rom_dmadst_hi_w));
- map(0x7986, 0x7986).w(FUNC(xavix_state::rom_dmalen_lo_w)); // DMA length
- map(0x7987, 0x7987).w(FUNC(xavix_state::rom_dmalen_hi_w));
+ map(0x7980, 0x7980).rw(FUNC(xavix_state::rom_dmastat_r), FUNC(xavix_state::rom_dmatrg_w));
+ map(0x7981, 0x7983).ram().w(FUNC(xavix_state::rom_dmasrc_w)).share("rom_dma_src");
+ map(0x7984, 0x7985).ram().w(FUNC(xavix_state::rom_dmadst_w)).share("rom_dma_dst");
+ map(0x7986, 0x7987).ram().w(FUNC(xavix_state::rom_dmalen_w)).share("rom_dma_len");
// IO Ports
map(0x7a00, 0x7a00).rw(FUNC(xavix_state::io_0_r),FUNC(xavix_state::io_0_w));
- map(0x7a01, 0x7a01).rw(FUNC(xavix_state::io_1_r),FUNC(xavix_state::io_1_w)); // startup (taitons1)
- map(0x7a02, 0x7a02).rw(FUNC(xavix_state::io_2_r),FUNC(xavix_state::io_2_w)); // startup, gets set to 20, 7a00 is then also written with 20
- map(0x7a03, 0x7a03).rw(FUNC(xavix_state::io_3_r),FUNC(xavix_state::io_3_w)); // startup (gets set to 84 which is the same as the bits checked on 7a01, possible port direction register?)
+ map(0x7a01, 0x7a01).rw(FUNC(xavix_state::io_1_r),FUNC(xavix_state::io_1_w));
+ map(0x7a02, 0x7a02).rw(FUNC(xavix_state::io_2_r),FUNC(xavix_state::io_2_w));
+ map(0x7a03, 0x7a03).rw(FUNC(xavix_state::io_3_r),FUNC(xavix_state::io_3_w));
// Interrupt control registers
map(0x7a80, 0x7a80).w(FUNC(xavix_state::xavix_7a80_w)); // still IO? ADC related?
@@ -405,7 +400,7 @@ void xavix_state::xavix_lowbus_map(address_map &map)
// ADC registers
map(0x7b80, 0x7b80).rw(FUNC(xavix_state::adc_7b80_r), FUNC(xavix_state::adc_7b80_w)); // rad_snow (not often)
- map(0x7b81, 0x7b81).w(FUNC(xavix_state::adc_7b81_w)); // written (often, m_trck, analog related?)
+ map(0x7b81, 0x7b81).rw(FUNC(xavix_state::adc_7b81_r), FUNC(xavix_state::adc_7b81_w)); // written (often, m_trck, analog related?)
// Sleep control
//map(7b82, 7b83)
@@ -419,16 +414,17 @@ void xavix_state::xavix_lowbus_map(address_map &map)
// map(0x7ff0, 0x7ff1)
// Multiply / Divide registers
- map(0x7ff2, 0x7ff4).w(FUNC(xavix_state::mult_param_w));
+ map(0x7ff2, 0x7ff4).rw(FUNC(xavix_state::mult_param_r), FUNC(xavix_state::mult_param_w));
map(0x7ff5, 0x7ff6).rw(FUNC(xavix_state::mult_r), FUNC(xavix_state::mult_w));
// CPU Vector registers
- map(0x7ff9, 0x7ff9).w(FUNC(xavix_state::vector_enable_w)); // interrupt related, but probalby not a simple 'enable' otherwise interrupts happen before we're ready for them.
- map(0x7ffa, 0x7ffa).w(FUNC(xavix_state::irq_vector0_lo_w)); // an IRQ vector (nmi?)
- map(0x7ffb, 0x7ffb).w(FUNC(xavix_state::irq_vector0_hi_w));
+ map(0x7ff9, 0x7ff9).w(FUNC(xavix_state::vector_enable_w)); // enables / disables the custom vectors
+ map(0x7ffa, 0x7ffa).w(FUNC(xavix_state::nmi_vector_lo_w)); // an IRQ vector (nmi?)
+ map(0x7ffb, 0x7ffb).w(FUNC(xavix_state::nmi_vector_hi_w));
map(0x7ffc, 0x7ffc).rw(FUNC(xavix_state::irq_source_r), FUNC(xavix_state::irq_source_w));
- map(0x7ffe, 0x7ffe).w(FUNC(xavix_state::irq_vector1_lo_w)); // an IRQ vector (irq?)
- map(0x7fff, 0x7fff).w(FUNC(xavix_state::irq_vector1_hi_w));
+ // map(0x7ffd, 0x7ffd) some of the Nostalgia games read here, why?
+ map(0x7ffe, 0x7ffe).w(FUNC(xavix_state::irq_vector_lo_w)); // an IRQ vector (irq?)
+ map(0x7fff, 0x7fff).w(FUNC(xavix_state::irq_vector_hi_w));
}
static INPUT_PORTS_START( xavix )
@@ -488,12 +484,14 @@ static INPUT_PORTS_START( xavix )
PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_CUSTOM )
INPUT_PORTS_END
+/*
static INPUT_PORTS_START( xavixp )
PORT_INCLUDE(xavix)
PORT_MODIFY("REGION") // PAL/NTSC flag
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_CUSTOM )
INPUT_PORTS_END
+*/
/* Test mode lists the following
@@ -576,6 +574,22 @@ static INPUT_PORTS_START( rad_boxp )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_CUSTOM )
INPUT_PORTS_END
+static INPUT_PORTS_START( rad_bass )
+ PORT_INCLUDE(xavix)
+
+ PORT_MODIFY("IN0")
+ PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 )
+ PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
+ PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
+INPUT_PORTS_END
+
+static INPUT_PORTS_START( rad_bassp )
+ PORT_INCLUDE(rad_bass)
+
+ PORT_MODIFY("REGION") // PAL/NTSC flag
+ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_CUSTOM )
+INPUT_PORTS_END
+
static INPUT_PORTS_START( rad_snow )
PORT_INCLUDE(xavix)
@@ -598,15 +612,20 @@ INPUT_PORTS_END
static INPUT_PORTS_START( namcons2 )
PORT_INCLUDE(xavix)
- PORT_MODIFY("IN0")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // Fire1?
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // Fire2?
- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) // Pause / Add Coins
- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
+ PORT_MODIFY("IN0") // mappings based on Dragon Buster button list, inputs don't seem to work properly in some games, probably because bad EEPROM support means all buttons are mapped to the same thing?
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) // Fire4
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) // Fire3
+ PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // not a button? (but can be used to pass prompts?)
+ PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) // Pause / Add Coins, marked 'Credit' (but not a coin slot)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
+
+ PORT_MODIFY("IN1")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // Fire2
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // Fire1
+
INPUT_PORTS_END
// to access hidden test mode reset while holding Button1 and Button2 (works every other reset)
@@ -699,7 +718,7 @@ MACHINE_CONFIG_START(xavix_state::xavix)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_UPDATE_DRIVER(xavix_state, screen_update)
MCFG_SCREEN_SIZE(32*8, 32*8)
- MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 0*8, 28*8-1)
+ MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_xavix)
@@ -848,30 +867,35 @@ ROM_START( rad_rh )
ROM_END
/*
- There's more code in here than in the 'eka_strt' set, but all it seems to do is display an 'insert cartridge' message,
- however eka_strt also seems a complete program in it's own right, it's unclear if it can see any of the data from this
- ROM.
-
- (TODO: turn the cartridges into a software list once the mapping is properly understood)
+ The e-kara cartridges require the BIOS rom to map into 2nd external bus space as they fetch palette data from
+ it etc.
*/
+#define EKARA_BASE_ROM \
+ ROM_LOAD( "ekara.bin", 0x600000, 0x100000, CRC(9b27c4a2) SHA1(d75dda7434933135d2f7e353840a9384e9a0d586) )
+
+
ROM_START( eka_base )
- ROM_REGION( 0x100000, "bios", ROMREGION_ERASE00 )
- ROM_LOAD( "ekara.bin", 0x000000, 0x100000, CRC(9b27c4a2) SHA1(d75dda7434933135d2f7e353840a9384e9a0d586) )
+ ROM_REGION( 0x800000, "bios", ROMREGION_ERASE00 )
+ EKARA_BASE_ROM
+ ROM_RELOAD(0x000000, 0x100000)
ROM_END
ROM_START( eka_strt )
- ROM_REGION( 0x080000, "bios", ROMREGION_ERASE00 )
+ ROM_REGION( 0x800000, "bios", ROMREGION_ERASE00 )
+ EKARA_BASE_ROM
ROM_LOAD( "ekarastartcart.bin", 0x000000, 0x080000, CRC(8c12c0c2) SHA1(8cc1b098894af25a4bfccada884125b66f5fe8b2) )
ROM_END
ROM_START( eka_vol1 )
- ROM_REGION( 0x100000, "bios", ROMREGION_ERASE00 )
+ ROM_REGION( 0x800000, "bios", ROMREGION_ERASE00 )
+ EKARA_BASE_ROM
ROM_LOAD( "ekaravol1.bin", 0x000000, 0x100000, CRC(29df4aea) SHA1(b95835aaf8630b61b47e5da0968cd4a1dd3bc517) )
ROM_END
ROM_START( eka_vol2 )
- ROM_REGION( 0x100000, "bios", ROMREGION_ERASE00 )
+ ROM_REGION( 0x800000, "bios", ROMREGION_ERASE00 )
+ EKARA_BASE_ROM
ROM_LOAD( "ekaravol2.bin", 0x000000, 0x100000, CRC(6c66772e) SHA1(e1e719df1e51caaafd9b3af187059334f7abbba3) )
ROM_END
@@ -903,8 +927,8 @@ CONS( 200?, rad_crdnp, rad_crdn, 0, xavixp, rad_crdnp,xavix_state, init_xavix
CONS( 2002, rad_bb2, 0, 0, xavix, rad_bb2, xavix_state, init_xavix, "Radica / SSD Company LTD", "Play TV Baseball 2", MACHINE_IS_SKELETON ) // contains string "Radica RBB2 V1.0"
-CONS( 2001, rad_bass, 0, 0, xavix, xavix, xavix_state, init_xavix, "Radica / SSD Company LTD", "Play TV Bass Fishin' (NTSC)", MACHINE_IS_SKELETON)
-CONS( 2001, rad_bassp, rad_bass, 0, xavixp, xavixp, xavix_state, init_xavix, "Radica / SSD Company LTD", "ConnecTV Bass Fishin' (PAL)", MACHINE_IS_SKELETON)
+CONS( 2001, rad_bass, 0, 0, xavix, rad_bass, xavix_state, init_xavix, "Radica / SSD Company LTD", "Play TV Bass Fishin' (NTSC)", MACHINE_IS_SKELETON)
+CONS( 2001, rad_bassp, rad_bass, 0, xavixp, rad_bassp,xavix_state, init_xavix, "Radica / SSD Company LTD", "ConnecTV Bass Fishin' (PAL)", MACHINE_IS_SKELETON)
// there is another 'Snowboarder' with a white coloured board, it appears to be a newer game closer to 'SSX Snowboarder' but without the SSX license.
CONS( 2001, rad_snow, 0, 0, xavix, rad_snow, xavix_state, init_xavix, "Radica / SSD Company LTD", "Play TV Snowboarder (Blue) (NTSC)", MACHINE_IS_SKELETON)
@@ -920,13 +944,13 @@ CONS( 200?, epo_efdx, 0, 0, xavix, xavix, xavix_state, init_xavix
CONS( 200?, has_wamg, 0, 0, xavix, xavix, xavix_state, init_xavix, "Hasbro / Milton Bradley / SSD Company LTD", "TV Wild Adventure Mini Golf", MACHINE_IS_SKELETON)
-CONS( 200?, eka_base, 0, 0, xavix, xavix, xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara (US?)", MACHINE_IS_SKELETON)
+CONS( 200?, eka_base, 0, 0, xavix, xavix, xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara (US?)", MACHINE_IS_SKELETON|MACHINE_IS_BIOS_ROOT)
-CONS( 200?, eka_strt, 0, 0, xavix, xavix, xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara Starter (US?)", MACHINE_IS_SKELETON)
+CONS( 200?, eka_strt, eka_base, 0, xavix, xavix, xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara Starter (US?)", MACHINE_IS_SKELETON)
-CONS( 200?, eka_vol1, 0, 0, xavix, xavix, xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara Volume 1 (US?)", MACHINE_IS_SKELETON) // insert calls it 'HIT MIX Vol 1'
+CONS( 200?, eka_vol1, eka_base, 0, xavix, xavix, xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara Volume 1 (US?)", MACHINE_IS_SKELETON) // insert calls it 'HIT MIX Vol 1'
-CONS( 200?, eka_vol2, 0, 0, xavix, xavix , xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara Volume 2 (US?)", MACHINE_IS_SKELETON) // insert calls it 'HIT MIX Vol 2'
+CONS( 200?, eka_vol2, eka_base, 0, xavix, xavix , xavix_state, init_xavix, "Takara / Hasbro / SSD Company LTD", "e-kara Volume 2 (US?)", MACHINE_IS_SKELETON) // insert calls it 'HIT MIX Vol 2'
/* The 'XaviXPORT' isn't a real console, more of a TV adapter, all the actual hardware (CPU including video hw, sound hw) is in the cartridges and controllers
and can vary between games, see notes at top of driver.
diff --git a/src/mame/includes/xavix.h b/src/mame/includes/xavix.h
index 30dcc588696..d3c361a0038 100644
--- a/src/mame/includes/xavix.h
+++ b/src/mame/includes/xavix.h
@@ -18,8 +18,12 @@ public:
xavix_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
+ m_screen(*this, "screen"),
m_mainram(*this, "mainram"),
m_fragment_sprite(*this, "fragment_sprite"),
+ m_rom_dma_src(*this,"rom_dma_src"),
+ m_rom_dma_dst(*this,"rom_dma_dst"),
+ m_rom_dma_len(*this,"rom_dma_len"),
m_palram_sh(*this, "palram_sh"),
m_palram_l(*this, "palram_l"),
m_colmix_sh(*this, "colmix_sh"),
@@ -68,19 +72,18 @@ private:
DECLARE_WRITE8_MEMBER(adc_7b00_w);
DECLARE_READ8_MEMBER(adc_7b80_r);
DECLARE_WRITE8_MEMBER(adc_7b80_w);
+ DECLARE_READ8_MEMBER(adc_7b81_r);
DECLARE_WRITE8_MEMBER(adc_7b81_w);
DECLARE_WRITE8_MEMBER(slotreg_7810_w);
DECLARE_WRITE8_MEMBER(rom_dmatrg_w);
- DECLARE_WRITE8_MEMBER(rom_dmasrc_lo_w);
- DECLARE_WRITE8_MEMBER(rom_dmasrc_md_w);
- DECLARE_WRITE8_MEMBER(rom_dmasrc_hi_w);
- DECLARE_WRITE8_MEMBER(rom_dmadst_lo_w);
- DECLARE_WRITE8_MEMBER(rom_dmadst_hi_w);
- DECLARE_WRITE8_MEMBER(rom_dmalen_lo_w);
- DECLARE_WRITE8_MEMBER(rom_dmalen_hi_w);
- DECLARE_READ8_MEMBER(rom_dmatrg_r);
+
+ DECLARE_WRITE8_MEMBER(rom_dmasrc_w);
+
+ DECLARE_WRITE8_MEMBER(rom_dmadst_w);
+ DECLARE_WRITE8_MEMBER(rom_dmalen_w);
+ DECLARE_READ8_MEMBER(rom_dmastat_r);
DECLARE_WRITE8_MEMBER(spritefragment_dma_params_1_w);
DECLARE_WRITE8_MEMBER(spritefragment_dma_params_2_w);
@@ -98,10 +101,10 @@ private:
DECLARE_WRITE8_MEMBER(io_3_w);
DECLARE_WRITE8_MEMBER(vector_enable_w);
- DECLARE_WRITE8_MEMBER(irq_vector0_lo_w);
- DECLARE_WRITE8_MEMBER(irq_vector0_hi_w);
- DECLARE_WRITE8_MEMBER(irq_vector1_lo_w);
- DECLARE_WRITE8_MEMBER(irq_vector1_hi_w);
+ DECLARE_WRITE8_MEMBER(nmi_vector_lo_w);
+ DECLARE_WRITE8_MEMBER(nmi_vector_hi_w);
+ DECLARE_WRITE8_MEMBER(irq_vector_lo_w);
+ DECLARE_WRITE8_MEMBER(irq_vector_hi_w);
DECLARE_READ8_MEMBER(irq_source_r);
DECLARE_WRITE8_MEMBER(irq_source_w);
@@ -110,6 +113,7 @@ private:
DECLARE_WRITE8_MEMBER(arena_start_w);
DECLARE_READ8_MEMBER(arena_end_r);
DECLARE_WRITE8_MEMBER(arena_end_w);
+ DECLARE_READ8_MEMBER(arena_control_r);
DECLARE_WRITE8_MEMBER(arena_control_w);
DECLARE_READ8_MEMBER(colmix_6ff0_r);
@@ -121,8 +125,8 @@ private:
DECLARE_READ8_MEMBER(dispctrl_6ff8_r);
DECLARE_WRITE8_MEMBER(dispctrl_6ff8_w);
- DECLARE_WRITE8_MEMBER(dispctrl_6ffa_w);
- DECLARE_WRITE8_MEMBER(dispctrl_6ffb_w);
+ DECLARE_WRITE8_MEMBER(dispctrl_posirq_x_w);
+ DECLARE_WRITE8_MEMBER(dispctrl_posirq_y_w);
DECLARE_READ8_MEMBER(sound_75f0_r);
DECLARE_WRITE8_MEMBER(sound_75f0_w);
@@ -175,25 +179,17 @@ private:
DECLARE_READ8_MEMBER(mult_r);
DECLARE_WRITE8_MEMBER(mult_w);
+ DECLARE_READ8_MEMBER(mult_param_r);
DECLARE_WRITE8_MEMBER(mult_param_w);
required_device<cpu_device> m_maincpu;
-
- uint8_t m_rom_dmasrc_lo_data;
- uint8_t m_rom_dmasrc_md_data;
- uint8_t m_rom_dmasrc_hi_data;
-
- uint8_t m_rom_dmadst_lo_data;
- uint8_t m_rom_dmadst_hi_data;
-
- uint8_t m_rom_dmalen_lo_data;
- uint8_t m_rom_dmalen_hi_data;
-
+ required_device<screen_device> m_screen;
+
uint8_t m_vectorenable;
- uint8_t m_irq_vector0_lo_data;
- uint8_t m_irq_vector0_hi_data;
- uint8_t m_irq_vector1_lo_data;
- uint8_t m_irq_vector1_hi_data;
+ uint8_t m_nmi_vector_lo_data;
+ uint8_t m_nmi_vector_hi_data;
+ uint8_t m_irq_vector_lo_data;
+ uint8_t m_irq_vector_hi_data;
uint8_t m_multparams[3];
uint8_t m_multresults[2];
@@ -204,8 +200,9 @@ private:
uint8_t m_tmap1_regs[8];
uint8_t m_tmap2_regs[8];
- uint8_t m_arena_start;
- uint8_t m_arena_end;
+ int m_arena_start;
+ int m_arena_end;
+ uint8_t m_arena_control;
uint8_t m_6ff0;
uint8_t m_6ff8;
@@ -217,8 +214,10 @@ private:
int16_t get_vectors(int which, int half);
required_shared_ptr<uint8_t> m_mainram;
-
required_shared_ptr<uint8_t> m_fragment_sprite;
+ required_shared_ptr<uint8_t> m_rom_dma_src;
+ required_shared_ptr<uint8_t> m_rom_dma_dst;
+ required_shared_ptr<uint8_t> m_rom_dma_len;
required_shared_ptr<uint8_t> m_palram_sh;
required_shared_ptr<uint8_t> m_palram_l;
@@ -238,9 +237,10 @@ private:
void handle_palette(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
double hue2rgb(double p, double q, double t);
- void draw_tile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int opaque);
+ void draw_tile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int zval);
void draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ bitmap_ind16 m_zbuffer;
uint8_t m_spritereg;
diff --git a/src/mame/machine/xavix.cpp b/src/mame/machine/xavix.cpp
index f0c3b370362..89ba1683440 100644
--- a/src/mame/machine/xavix.cpp
+++ b/src/mame/machine/xavix.cpp
@@ -4,25 +4,40 @@
#include "emu.h"
#include "includes/xavix.h"
-// general DMA fro ROM, not Video DMA
+// general DMA to/from entire main map (not dedicated sprite DMA)
WRITE8_MEMBER(xavix_state::rom_dmatrg_w)
{
if (data & 0x01) // namcons2 writes 0x81, most of the time things write 0x01
{
logerror("%s: rom_dmatrg_w (do DMA?) %02x\n", machine().describe_context(), data);
- uint32_t source = (m_rom_dmasrc_hi_data << 16) | (m_rom_dmasrc_md_data << 8) | m_rom_dmasrc_lo_data;
- uint16_t dest = (m_rom_dmadst_hi_data << 8) | m_rom_dmadst_lo_data;
- uint16_t len = (m_rom_dmalen_hi_data << 8) | m_rom_dmalen_lo_data;
+ uint32_t source = (m_rom_dma_src[2] << 16) | (m_rom_dma_src[1] << 8) | m_rom_dma_src[0];
+ uint16_t dest = (m_rom_dma_dst[1] << 8) | m_rom_dma_dst[0];
+ uint16_t len = (m_rom_dma_len[1] << 8) | m_rom_dma_len[0];
- source &= m_rgnlen - 1;
logerror(" (possible DMA op SRC %08x DST %04x LEN %04x)\n", source, dest, len);
address_space& destspace = m_maincpu->space(AS_PROGRAM);
for (int i = 0; i < len; i++)
{
- uint8_t dat = m_rgn[(source + i) & (m_rgnlen - 1)];
+ uint32_t m_tmpaddress = source+i;
+
+ // many games explicitly want to access with the high bank bit set, so probably the same logic as when grabbing tile data
+ // we have to be careful here or we get the zero page memory read, hence not just using read8 on the whole space
+ // this again probably indicates there is 'data space' where those don't appear
+ uint8_t dat = 0;
+ // if bank is > 0x80, or address is >0x8000 it's a plain ROM read
+ if ((m_tmpaddress >= 0x80000) || (m_tmpaddress & 0x8000))
+ {
+ dat= m_rgn[m_tmpaddress & (m_rgnlen - 1)];
+ }
+ else
+ {
+ address_space& mainspace = m_maincpu->space(AS_PROGRAM);
+ dat = m_lowbus->read8(mainspace, m_tmpaddress & 0x7fff);
+ }
+
destspace.write_byte(dest + i, dat);
}
}
@@ -32,57 +47,30 @@ WRITE8_MEMBER(xavix_state::rom_dmatrg_w)
}
}
-WRITE8_MEMBER(xavix_state::rom_dmasrc_lo_w)
-{
- logerror("%s: rom_dmasrc_lo_w %02x\n", machine().describe_context(), data);
- m_rom_dmasrc_lo_data = data;
-}
-WRITE8_MEMBER(xavix_state::rom_dmasrc_md_w)
+WRITE8_MEMBER(xavix_state::rom_dmasrc_w)
{
- logerror("%s: rom_dmasrc_md_w %02x\n", machine().describe_context(), data);
- m_rom_dmasrc_md_data = data;
+ // has_wamg expects to be able to read back the source to modify it (need to check if it expects it to change after an operation)
+ logerror("%s: rom_dmasrc_w (%02x) %02x\n", machine().describe_context(), offset, data);
+ m_rom_dma_src[offset] = data;
}
-WRITE8_MEMBER(xavix_state::rom_dmasrc_hi_w)
+WRITE8_MEMBER(xavix_state::rom_dmadst_w)
{
- logerror("%s: rom_dmasrc_hi_w %02x\n", machine().describe_context(), data);
- m_rom_dmasrc_hi_data = data;
- // this would mean Taito Nostalgia relies on mirroring tho, as it has the high bits set... so could just be wrong
- logerror(" (DMA ROM source of %02x%02x%02x)\n", m_rom_dmasrc_hi_data, m_rom_dmasrc_md_data, m_rom_dmasrc_lo_data);
+ logerror("%s: rom_dmadst_w (%02x) %02x\n", machine().describe_context(), offset, data);
+ m_rom_dma_dst[offset] = data;
}
-WRITE8_MEMBER(xavix_state::rom_dmadst_lo_w)
+WRITE8_MEMBER(xavix_state::rom_dmalen_w)
{
- logerror("%s: rom_dmadst_lo_w %02x\n", machine().describe_context(), data);
- m_rom_dmadst_lo_data = data;
+ logerror("%s: rom_dmalen_w (%02x) %02x\n", machine().describe_context(), offset, data);
+ m_rom_dma_len[offset] = data;
}
-WRITE8_MEMBER(xavix_state::rom_dmadst_hi_w)
-{
- logerror("%s: rom_dmadst_hi_w %02x\n", machine().describe_context(), data);
- m_rom_dmadst_hi_data = data;
-
- logerror(" (DMA dest of %02x%02x)\n", m_rom_dmadst_hi_data, m_rom_dmadst_lo_data);
-}
-
-WRITE8_MEMBER(xavix_state::rom_dmalen_lo_w)
-{
- logerror("%s: rom_dmalen_lo_w %02x\n", machine().describe_context(), data);
- m_rom_dmalen_lo_data = data;
-}
-WRITE8_MEMBER(xavix_state::rom_dmalen_hi_w)
+READ8_MEMBER(xavix_state::rom_dmastat_r)
{
- logerror("%s: rom_dmalen_hi_w %02x\n", machine().describe_context(), data);
- m_rom_dmalen_hi_data = data;
-
- logerror(" (DMA len of %02x%02x)\n", m_rom_dmalen_hi_data, m_rom_dmalen_lo_data);
-}
-
-READ8_MEMBER(xavix_state::rom_dmatrg_r)
-{
- logerror("%s: rom_dmatrg_r (operation status?)\n", machine().describe_context());
+ logerror("%s: rom_dmastat_r (operation status?)\n", machine().describe_context());
return 0x00;
}
@@ -94,28 +82,28 @@ WRITE8_MEMBER(xavix_state::vector_enable_w)
m_vectorenable = data;
}
-WRITE8_MEMBER(xavix_state::irq_vector0_lo_w)
+WRITE8_MEMBER(xavix_state::nmi_vector_lo_w)
{
- logerror("%s: irq_vector0_lo_w %02x\n", machine().describe_context(), data);
- m_irq_vector0_lo_data = data;
+ logerror("%s: nmi_vector_lo_w %02x\n", machine().describe_context(), data);
+ m_nmi_vector_lo_data = data;
}
-WRITE8_MEMBER(xavix_state::irq_vector0_hi_w)
+WRITE8_MEMBER(xavix_state::nmi_vector_hi_w)
{
- logerror("%s: irq_vector0_hi_w %02x\n", machine().describe_context(), data);
- m_irq_vector0_hi_data = data;
+ logerror("%s: nmi_vector_hi_w %02x\n", machine().describe_context(), data);
+ m_nmi_vector_hi_data = data;
}
-WRITE8_MEMBER(xavix_state::irq_vector1_lo_w)
+WRITE8_MEMBER(xavix_state::irq_vector_lo_w)
{
- logerror("%s: irq_vector1_lo_w %02x\n", machine().describe_context(), data);
- m_irq_vector1_lo_data = data;
+ logerror("%s: irq_vector_lo_w %02x\n", machine().describe_context(), data);
+ m_irq_vector_lo_data = data;
}
-WRITE8_MEMBER(xavix_state::irq_vector1_hi_w)
+WRITE8_MEMBER(xavix_state::irq_vector_hi_w)
{
- logerror("%s: irq_vector1_hi_w %02x\n", machine().describe_context(), data);
- m_irq_vector1_hi_data = data;
+ logerror("%s: irq_vector_hi_w %02x\n", machine().describe_context(), data);
+ m_irq_vector_hi_data = data;
}
@@ -160,6 +148,12 @@ WRITE8_MEMBER(xavix_state::adc_7b81_w)
logerror("%s: adc_7b81_w %02x\n", machine().describe_context(), data);
}
+READ8_MEMBER(xavix_state::adc_7b81_r)
+{
+ return machine().rand();
+}
+
+
WRITE8_MEMBER(xavix_state::slotreg_7810_w)
{
@@ -200,14 +194,14 @@ WRITE8_MEMBER(xavix_state::dispctrl_6ff8_w)
logerror("%s: dispctrl_6ff8_w %02x\n", machine().describe_context(), data);
}
-WRITE8_MEMBER(xavix_state::dispctrl_6ffa_w)
+WRITE8_MEMBER(xavix_state::dispctrl_posirq_x_w)
{
- logerror("%s: dispctrl_6ffa_w %02x\n", machine().describe_context(), data);
+ logerror("%s: dispctrl_posirq_x_w %02x\n", machine().describe_context(), data);
}
-WRITE8_MEMBER(xavix_state::dispctrl_6ffb_w)
+WRITE8_MEMBER(xavix_state::dispctrl_posirq_y_w)
{
- logerror("%s: dispctrl_6ffb_w %02x\n", machine().describe_context(), data);
+ logerror("%s: dispctrl_posirq_y_w %02x\n", machine().describe_context(), data);
}
READ8_MEMBER(xavix_state::io_0_r)
@@ -229,14 +223,15 @@ READ8_MEMBER(xavix_state::io_1_r)
return m_in1->read();
}
+// has_wamg crashes on boot if these return high, either it's a button causing the game to eventually crash, or an invalid input (inputs are ACTIVE HIGH so returning 0x00 is safer
READ8_MEMBER(xavix_state::io_2_r)
{
- return 0xff;
+ return 0x00;
}
READ8_MEMBER(xavix_state::io_3_r)
{
- return 0xff;
+ return 0x00;
}
@@ -268,7 +263,7 @@ READ8_MEMBER(xavix_state::arena_start_r)
WRITE8_MEMBER(xavix_state::arena_start_w)
{
- //logerror("%s: arena_start_w %02x\n", machine().describe_context(), data);
+ logerror("%s: arena_start_w %02x\n", machine().describe_context(), data);
m_arena_start = data; // expected to return data written
}
@@ -280,13 +275,19 @@ READ8_MEMBER(xavix_state::arena_end_r)
WRITE8_MEMBER(xavix_state::arena_end_w)
{
- //logerror("%s: arena_end_w %02x\n", machine().describe_context(), data);
+ logerror("%s: arena_end_w %02x\n", machine().describe_context(), data);
m_arena_end = data; // expected to return data written
}
+READ8_MEMBER(xavix_state::arena_control_r)
+{
+ return m_arena_control;
+}
+
WRITE8_MEMBER(xavix_state::arena_control_w)
{
- //logerror("%s: arena_control_w %02x\n", machine().describe_context(), data);
+ logerror("%s: arena_control_w %02x\n", machine().describe_context(), data);
+ m_arena_control = data;
}
@@ -326,6 +327,11 @@ WRITE8_MEMBER(xavix_state::mult_w)
m_multresults[offset] = data;
}
+READ8_MEMBER(xavix_state::mult_param_r)
+{
+ return m_multparams[offset];
+}
+
WRITE8_MEMBER(xavix_state::mult_param_w)
{
COMBINE_DATA(&m_multparams[offset]);
@@ -408,24 +414,28 @@ void xavix_state::machine_start()
void xavix_state::machine_reset()
{
- m_rom_dmasrc_lo_data = 0;
- m_rom_dmasrc_md_data = 0;
- m_rom_dmasrc_hi_data = 0;
+ m_rom_dma_src[0] = 0;
+ m_rom_dma_src[1] = 0;
+ m_rom_dma_src[2] = 0;
- m_rom_dmadst_lo_data = 0;
- m_rom_dmadst_hi_data = 0;
+ m_rom_dma_dst[0] = 0;
+ m_rom_dma_dst[1] = 0;
- m_rom_dmalen_lo_data = 0;
- m_rom_dmalen_hi_data = 0;
+ m_rom_dma_len[0] = 0;
+ m_rom_dma_len[1] = 0;
m_vectorenable = 0;
- m_irq_vector0_lo_data = 0;
- m_irq_vector0_hi_data = 0;
- m_irq_vector1_lo_data = 0;
- m_irq_vector1_hi_data = 0;
+ m_nmi_vector_lo_data = 0;
+ m_nmi_vector_hi_data = 0;
+ m_irq_vector_lo_data = 0;
+ m_irq_vector_hi_data = 0;
m_6ff8 = 0;
+ m_arena_control = 0;
+ m_arena_start = 0;
+ m_arena_end = 0;
+
m_spritereg = 0;
m_soundregs[0] = 0;
@@ -461,6 +471,18 @@ void xavix_state::machine_reset()
m_txarray[i] = 0x00;
}
+ for (int i = 0; i < 0x800; i++)
+ {
+ // taito nostalgia 1 never initializes the ram at 0x6400 but there's no condition on using it at present?
+ m_fragment_sprite[i] = 0x00;
+ }
+
+ for (int i = 0; i < 0x4000; i++)
+ {
+ // card night expects RAM to be initialized to 0xff or it will show the pause menu over the startup graphics?!
+ m_mainram[i] = 0xff;
+ }
+
m_lowbus->set_bank(0);
}
@@ -475,16 +497,16 @@ int16_t xavix_state::get_vectors(int which, int half)
if (which == 0) // irq?
{
if (half == 0)
- return m_irq_vector0_hi_data;
+ return m_nmi_vector_hi_data;
else
- return m_irq_vector0_lo_data;
+ return m_nmi_vector_lo_data;
}
else
{
if (half == 0)
- return m_irq_vector1_hi_data;
+ return m_irq_vector_hi_data;
else
- return m_irq_vector1_lo_data;
+ return m_irq_vector_lo_data;
}
}
diff --git a/src/mame/video/xavix.cpp b/src/mame/video/xavix.cpp
index 3ecc0a4fc8e..f246100e249 100644
--- a/src/mame/video/xavix.cpp
+++ b/src/mame/video/xavix.cpp
@@ -57,6 +57,7 @@ inline int xavix_state::get_current_address_byte()
void xavix_state::video_start()
{
+ m_screen->register_screen_bitmap(m_zbuffer);
}
@@ -134,17 +135,13 @@ void xavix_state::handle_palette(screen_device &screen, bitmap_ind16 &bitmap, co
void xavix_state::draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which)
{
uint8_t* tileregs;
- int opaque = 0;
-
if (which == 0)
{
tileregs = m_tmap1_regs;
- opaque = 1;
}
else
{
tileregs = m_tmap2_regs;
- opaque = 0;
}
// bail if tilemap is disabled
@@ -221,16 +218,13 @@ void xavix_state::draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, cons
// there's a tilemap register to specify base in main ram, although in the monster truck test mode it points to an unmapped region
// and expected a fixed layout, we handle that in the memory map at the moment
- int count;
-
- count = 0;// ;
+ int count = 0;
for (int y = 0; y < ydimension; y++)
{
for (int x = 0; x < xdimension; x++)
{
address_space& mainspace = m_maincpu->space(AS_PROGRAM);
- int bpp, pal, scrolly, scrollx;
int tile = 0;
// the register being 0 probably isn't the condition here
@@ -245,11 +239,12 @@ void xavix_state::draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, cons
tile |= mainspace.read_byte((tileregs[0x2] << 8) + count) << 16;
- bpp = (tileregs[0x3] & 0x0e) >> 1;
+ int bpp = (tileregs[0x3] & 0x0e) >> 1;
bpp++;
- pal = (tileregs[0x6] & 0xf0) >> 4;
- scrolly = tileregs[0x5];
- scrollx = tileregs[0x4];
+ int pal = (tileregs[0x6] & 0xf0) >> 4;
+ int zval = (tileregs[0x6] & 0x0f) >> 0;
+ int scrolly = tileregs[0x5];
+ int scrollx = tileregs[0x4];
int basereg;
int flipx = 0;
@@ -302,7 +297,7 @@ void xavix_state::draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, cons
uint8_t extraattr = mainspace.read_byte((tileregs[0x2] << 8) + count);
// make use of the extraattr stuff?
pal = (extraattr & 0xf0)>>4;
- // low bits are priority?
+ zval = (extraattr & 0x0f) >> 0;
}
}
else
@@ -398,10 +393,10 @@ void xavix_state::draw_tilemap(screen_device &screen, bitmap_ind16 &bitmap, cons
if (test == 1) pal = machine().rand() & 0xf;
- draw_tile(screen, bitmap, cliprect, tile, bpp, (x * xtilesize) + scrollx, ((y * ytilesize) - 16) - scrolly, ytilesize, xtilesize, flipx, flipy, pal, opaque);
- draw_tile(screen, bitmap, cliprect, tile, bpp, (x * xtilesize) + scrollx, (((y * ytilesize) - 16) - scrolly) + 256, ytilesize, xtilesize, flipx, flipy, pal, opaque); // wrap-y
- draw_tile(screen, bitmap, cliprect, tile, bpp, ((x * xtilesize) + scrollx) - 256, ((y * ytilesize) - 16) - scrolly, ytilesize, xtilesize, flipx, flipy, pal, opaque); // wrap-x
- draw_tile(screen, bitmap, cliprect, tile, bpp, ((x * xtilesize) + scrollx) - 256, (((y * ytilesize) - 16) - scrolly) + 256, ytilesize, xtilesize, flipx, flipy, pal, opaque); // wrap-y and x
+ draw_tile(screen, bitmap, cliprect, tile, bpp, (x * xtilesize) + scrollx, ((y * ytilesize) - 16) - scrolly, ytilesize, xtilesize, flipx, flipy, pal, zval);
+ draw_tile(screen, bitmap, cliprect, tile, bpp, (x * xtilesize) + scrollx, (((y * ytilesize) - 16) - scrolly) + 256, ytilesize, xtilesize, flipx, flipy, pal, zval); // wrap-y
+ draw_tile(screen, bitmap, cliprect, tile, bpp, ((x * xtilesize) + scrollx) - 256, ((y * ytilesize) - 16) - scrolly, ytilesize, xtilesize, flipx, flipy, pal, zval); // wrap-x
+ draw_tile(screen, bitmap, cliprect, tile, bpp, ((x * xtilesize) + scrollx) - 256, (((y * ytilesize) - 16) - scrolly) + 256, ytilesize, xtilesize, flipx, flipy, pal, zval); // wrap-y and x
count++;
}
@@ -443,7 +438,7 @@ void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons
uint8_t* spr_attr1 = m_fragment_sprite + 0x100;
uint8_t* spr_ypos = m_fragment_sprite + 0x200;
uint8_t* spr_xpos = m_fragment_sprite + 0x300;
- // + 0x400
+ uint8_t* spr_xposh = m_fragment_sprite + 0x400;
uint8_t* spr_addr_lo = m_fragment_sprite + 0x500;
uint8_t* spr_addr_md = m_fragment_sprite + 0x600;
uint8_t* spr_addr_hi = m_fragment_sprite + 0x700;
@@ -453,16 +448,30 @@ void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons
pppp bbb- p = palette, b = bpp
attribute 1 bits
- ---- ss-f s = size, f = flipx
+ zzzz ssFf s = size, F = flipy f = flipx
*/
int ypos = spr_ypos[i];
int xpos = spr_xpos[i];
- int tile = (spr_addr_hi[i] << 16) | (spr_addr_md[i] << 8) | spr_addr_lo[i];
+ int tile = 0;
+
+ // high 8-bits only used in 24-bit mode
+ if (((m_spritereg & 0x7f) == 0x04) || ((m_spritereg & 0x7f) == 0x15))
+ tile |= (spr_addr_hi[i] << 16);
+
+ // mid 8-bits used in everything except 8-bit mode
+ if ((m_spritereg & 0x7f) != 0x00)
+ tile |= (spr_addr_md[i] << 8);
+
+ // low 8-bits always read
+ tile |= spr_addr_lo[i];
+
int attr0 = spr_attr0[i];
int attr1 = spr_attr1[i];
int pal = (attr0 & 0xf0) >> 4;
+
+ int zval = (attr1 & 0xf0) >> 4;
int flipx = (attr1 & 0x01);
int flipy = (attr1 & 0x02);
@@ -529,11 +538,34 @@ void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons
this makes the calculation a bit more annoying in terms of knowing when to apply offsets, when to wrap etc.
this is likely still incorrect
- I think there is also an additional x bit
- */
+ Use of additional x-bit is very confusing rad_snow, taitons1 (ingame) etc. clearly need to use it
+ but the taitons1 xavix logo doesn't even initialize the RAM for it and behavior conflicts with ingame?
+ maybe only works with certain tile sizes?
+
+ some code even suggests this should be bit 0 of attr0, but it never gets set there
+
+ there must be a register somewhere (or a side-effect of another mode) that enables / disables this
+ behavior, as we need to make use of xposh for the left side in cases that need it, but that
+ completely breaks the games that never set it at all (monster truck, xavix logo on taitons1)
+
+ */
+
+ int xposh = spr_xposh[i]&1;
+
+ if (xpos & 0x80) // left side of center
+ {
+ xpos &=0x7f;
+ xpos = -0x80+xpos;
+ }
+ else // right side of center
+ {
+ xpos &= 0x7f;
- xpos -= 136;
- xpos &= 0xff;
+ if (xposh)
+ xpos += 0x80;
+ }
+
+ xpos += 128 - 8;
ypos ^= 0xff;
@@ -554,10 +586,8 @@ void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons
bpp = (attr0 & 0x0e) >> 1;
bpp += 1;
- draw_tile(screen, bitmap, cliprect, tile, bpp, xpos + xpos_adjust, ypos - ypos_adjust, drawheight, drawwidth, flipx, flipy, pal, 0);
- draw_tile(screen, bitmap, cliprect, tile, bpp, xpos + xpos_adjust - 256, ypos - ypos_adjust, drawheight, drawwidth, flipx, flipy, pal, 0); // wrap-x
- draw_tile(screen, bitmap, cliprect, tile, bpp, xpos + xpos_adjust, ypos - 256 - ypos_adjust, drawheight, drawwidth, flipx, flipy, pal, 0); // wrap-y
- draw_tile(screen, bitmap, cliprect, tile, bpp, xpos + xpos_adjust - 256, ypos - 256 - ypos_adjust, drawheight, drawwidth, flipx, flipy, pal, 0); // wrap-x,y
+ draw_tile(screen, bitmap, cliprect, tile, bpp, xpos + xpos_adjust, ypos - ypos_adjust, drawheight, drawwidth, flipx, flipy, pal, zval);
+ draw_tile(screen, bitmap, cliprect, tile, bpp, xpos + xpos_adjust, ypos - 256 - ypos_adjust, drawheight, drawwidth, flipx, flipy, pal, zval); // wrap-y
/*
if ((spr_ypos[i] != 0x81) && (spr_ypos[i] != 0x80) && (spr_ypos[i] != 0x00))
@@ -568,7 +598,7 @@ void xavix_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, cons
}
}
-void xavix_state::draw_tile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int opaque)
+void xavix_state::draw_tile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int tile, int bpp, int xpos, int ypos, int drawheight, int drawwidth, int flipx, int flipy, int pal, int zval)
{
// set the address here so we can increment in bits in the draw function
set_data_address(tile, 0);
@@ -608,19 +638,20 @@ void xavix_state::draw_tile(screen_device &screen, bitmap_ind16 &bitmap, const r
if ((row >= cliprect.min_y && row <= cliprect.max_y) && (col >= cliprect.min_x && col <= cliprect.max_x))
{
- uint16_t* rowptr;
+ uint16_t* rowptr = &bitmap.pix16(row);
+ uint16_t* zrowptr = &m_zbuffer.pix16(row);
- rowptr = &bitmap.pix16(row);
- if (opaque)
- {
- rowptr[col] = (dat + (pal << 4)) & 0xff;
- }
- else
+ if (zval >= zrowptr[col])
{
- if (dat)
- rowptr[col] = (dat + (pal << 4)) & 0xff;
- }
+ int pen = (dat + (pal << 4)) & 0xff;
+
+ if ((m_palram_sh[pen] & 0x1f) < 24) // hue values 24-31 are transparent
+ {
+ rowptr[col] = pen;
+ zrowptr[col] = zval;
+ }
+ }
}
}
}
@@ -630,14 +661,41 @@ uint32_t xavix_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
{
handle_palette(screen, bitmap, cliprect);
- // monster truck, taito nostalgia 1, madden and more look worse with black pen, baseball 2 hidden test mode looks worse with forced pen 0
- // probably depends on transparency etc.
- //bitmap.fill(m_palette->black_pen(), cliprect);
- bitmap.fill(0, cliprect);
+ // not sure what you end up with if you fall through all layers as transparent, so far no issues noticed
+ bitmap.fill(m_palette->black_pen(), cliprect);
+ m_zbuffer.fill(0,cliprect);
+
+ rectangle clip = cliprect;
+
+ clip.min_y = cliprect.min_y;
+ clip.max_y = cliprect.max_y;
+ clip.min_x = cliprect.min_x;
+ clip.max_x = cliprect.max_x;
+
+ if (m_arena_control & 0x01)
+ {
+ // some games enable it with both regs as 00, which causes a problem
+ if (m_arena_start > m_arena_end)
+ {
+ // controls the clipping area (for all layers?) used for effect at start of Slap Fight and to add black borders in other cases
+ // based on Slap Fight Tiger lives display (and reference videos) this is slightly offset as all gfx must display
+ // other games don't correct the offset so will display a tiny bit of extra space at times?
+ // (there is some tilemap draw-in on Monster Truck)
+ clip.max_x = m_arena_start + 1;
+ clip.min_x = m_arena_end - 2;
+
+ if (clip.min_x < cliprect.min_x)
+ clip.min_x = cliprect.min_x;
+
+ if (clip.max_x > cliprect.max_x)
+ clip.max_x = cliprect.max_x;
+ }
+ }
+ bitmap.fill(0, clip);
- draw_tilemap(screen,bitmap,cliprect,0);
- draw_sprites(screen,bitmap,cliprect);
- draw_tilemap(screen,bitmap,cliprect,1);
+ draw_tilemap(screen,bitmap,clip,1);
+ draw_tilemap(screen,bitmap,clip,0);
+ draw_sprites(screen,bitmap,clip);
//popmessage("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", m_soundregs[0],m_soundregs[1],m_soundregs[2],m_soundregs[3],m_soundregs[4],m_soundregs[5],m_soundregs[6],m_soundregs[7],m_soundregs[8],m_soundregs[9],m_soundregs[10],m_soundregs[11],m_soundregs[12],m_soundregs[13],m_soundregs[14],m_soundregs[15]);