MPU4: Starting spliting up some of the more intimidating mpu4 sets, ready to be sorted and properly versioned. Note this adds a bit over 1k new sets, all from existing data - From Haze (nw)
Kaneko 'hitbox' handling is now a device - From Haze (nw)
This commit is contained in:
parent
2369bd1a61
commit
ba024efeff
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -4297,6 +4297,7 @@ src/mame/machine/jvs13551.c svneol=native#text/plain
|
|||||||
src/mame/machine/jvs13551.h svneol=native#text/plain
|
src/mame/machine/jvs13551.h svneol=native#text/plain
|
||||||
src/mame/machine/kabuki.c svneol=native#text/plain
|
src/mame/machine/kabuki.c svneol=native#text/plain
|
||||||
src/mame/machine/kaneko16.c svneol=native#text/plain
|
src/mame/machine/kaneko16.c svneol=native#text/plain
|
||||||
|
src/mame/machine/kaneko_hit.c svneol=native#text/plain
|
||||||
src/mame/machine/kanekotb.h svneol=native#text/plain
|
src/mame/machine/kanekotb.h svneol=native#text/plain
|
||||||
src/mame/machine/konami1.c svneol=native#text/plain
|
src/mame/machine/konami1.c svneol=native#text/plain
|
||||||
src/mame/machine/konami1.h svneol=native#text/plain
|
src/mame/machine/konami1.h svneol=native#text/plain
|
||||||
|
@ -151,7 +151,7 @@ the layer is misplaced however, different scroll regs?
|
|||||||
#include "cpu/m68000/m68000.h"
|
#include "cpu/m68000/m68000.h"
|
||||||
#include "includes/kaneko16.h"
|
#include "includes/kaneko16.h"
|
||||||
#include "sound/okim6295.h"
|
#include "sound/okim6295.h"
|
||||||
|
#include "machine/kaneko_hit.h"
|
||||||
|
|
||||||
class expro02_state : public kaneko16_state
|
class expro02_state : public kaneko16_state
|
||||||
{
|
{
|
||||||
@ -444,7 +444,7 @@ static ADDRESS_MAP_START( galsnew_map, AS_PROGRAM, 16, expro02_state )
|
|||||||
|
|
||||||
AM_RANGE(0xd80000, 0xd80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_1_tilebank_w) /* ??? */
|
AM_RANGE(0xd80000, 0xd80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_1_tilebank_w) /* ??? */
|
||||||
|
|
||||||
AM_RANGE(0xe00000, 0xe00015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) /* CALC1 MCU interaction (simulated) */
|
AM_RANGE(0xe00000, 0xe00015) AM_DEVREADWRITE("calc1_mcu", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
|
||||||
|
|
||||||
AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_0_tilebank_w) /* ??? */
|
AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_0_tilebank_w) /* ??? */
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
@ -469,7 +469,6 @@ static ADDRESS_MAP_START( fantasia_map, AS_PROGRAM, 16, expro02_state )
|
|||||||
AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP /* ??? */
|
AM_RANGE(0xa00000, 0xa00001) AM_WRITENOP /* ??? */
|
||||||
AM_RANGE(0xc80000, 0xc8ffff) AM_RAM
|
AM_RANGE(0xc80000, 0xc8ffff) AM_RAM
|
||||||
AM_RANGE(0xd80000, 0xd80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_1_tilebank_w) /* ??? */
|
AM_RANGE(0xd80000, 0xd80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_1_tilebank_w) /* ??? */
|
||||||
//AM_RANGE(0xe00000, 0xe00015) AM_READWRITE_LEGACY(galpanib_calc_r,galpanib_calc_w) /* CALC1 MCU interaction (simulated) */
|
|
||||||
AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_0_tilebank_w) /* ??? */
|
AM_RANGE(0xe80000, 0xe80001) AM_DEVWRITE("view2_0",kaneko_view2_tilemap_device,galsnew_vram_0_tilebank_w) /* ??? */
|
||||||
AM_RANGE(0xf00000, 0xf00001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
|
AM_RANGE(0xf00000, 0xf00001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
@ -555,6 +554,8 @@ static MACHINE_CONFIG_START( galsnew, expro02_state )
|
|||||||
kaneko16_sprite_device::set_priorities(*device, 8,8,8,8); // above all (not verified)
|
kaneko16_sprite_device::set_priorities(*device, 8,8,8,8); // above all (not verified)
|
||||||
kaneko16_sprite_device::set_offsets(*device, 0, -0x40);
|
kaneko16_sprite_device::set_offsets(*device, 0, -0x40);
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("calc1_mcu", KANEKO_HIT, 0)
|
||||||
|
kaneko_hit_device::set_type(*device, 0);
|
||||||
|
|
||||||
|
|
||||||
MCFG_VIDEO_START(galsnew)
|
MCFG_VIDEO_START(galsnew)
|
||||||
|
@ -22,7 +22,6 @@ TODO:
|
|||||||
- There is a vector for IRQ4. The function does nothing in galpanic but is
|
- There is a vector for IRQ4. The function does nothing in galpanic but is
|
||||||
more complicated in the Comad ones. However I'm not triggering it, and
|
more complicated in the Comad ones. However I'm not triggering it, and
|
||||||
they seems to work anyway...
|
they seems to work anyway...
|
||||||
- Four unknown ROMs in fantasia. The game seems to work fine without them.
|
|
||||||
- There was a ROM in the newfant set, obj2_14.rom, which was identical to
|
- There was a ROM in the newfant set, obj2_14.rom, which was identical to
|
||||||
Terminator 2's t2.107. I can only assume this was a mistake of the dumper.
|
Terminator 2's t2.107. I can only assume this was a mistake of the dumper.
|
||||||
- lots of unknown reads and writes, also in galpanic but particularly in
|
- lots of unknown reads and writes, also in galpanic but particularly in
|
||||||
@ -51,7 +50,6 @@ For this version of Gals Panic see the expro02.c driver
|
|||||||
|
|
||||||
Stephh's additional notes :
|
Stephh's additional notes :
|
||||||
|
|
||||||
- The games might not work correctly if sound is disabled.
|
|
||||||
- There seems to exist 3 versions of 'galpanic' (Japan, US and World),
|
- There seems to exist 3 versions of 'galpanic' (Japan, US and World),
|
||||||
and we seem to have a World version according to the coinage.
|
and we seem to have a World version according to the coinage.
|
||||||
Version is stored at 0x03ffff.b :
|
Version is stored at 0x03ffff.b :
|
||||||
@ -80,7 +78,7 @@ Stephh's additional notes :
|
|||||||
* In this version, there is a "Coin Mode" Dip Switch, but no
|
* In this version, there is a "Coin Mode" Dip Switch, but no
|
||||||
"Character Test" Dip Switch.
|
"Character Test" Dip Switch.
|
||||||
* Area 0xe00000-0xe00014 is a "calculator" area. I've tried to
|
* Area 0xe00000-0xe00014 is a "calculator" area. I've tried to
|
||||||
simulate it (see 'galpanib_calc*' handlers) by comparing the code
|
simulate it (see machine/kaneko_hit.c) by comparing the code
|
||||||
with the other set. I don't know if there are some other unmapped
|
with the other set. I don't know if there are some other unmapped
|
||||||
reads, but the game seems to run fine with what I've done.
|
reads, but the game seems to run fine with what I've done.
|
||||||
* When you press the "Tilt" button, the game enters in an endless
|
* When you press the "Tilt" button, the game enters in an endless
|
||||||
@ -122,6 +120,7 @@ The current set of Super Model is an example of type C
|
|||||||
#include "includes/kaneko16.h"
|
#include "includes/kaneko16.h"
|
||||||
#include "sound/okim6295.h"
|
#include "sound/okim6295.h"
|
||||||
#include "video/kan_pand.h"
|
#include "video/kan_pand.h"
|
||||||
|
#include "machine/kaneko_hit.h"
|
||||||
#include "includes/galpanic.h"
|
#include "includes/galpanic.h"
|
||||||
#include "includes/galpnipt.h"
|
#include "includes/galpnipt.h"
|
||||||
|
|
||||||
@ -189,19 +188,6 @@ WRITE16_MEMBER(galpanic_state::galpanica_6295_bankswitch_w)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNUSED_FUNCTION
|
|
||||||
WRITE16_MEMBER(galpanic_state::galpanica_misc_w)
|
|
||||||
{
|
|
||||||
device_t *pandora = machine.device("pandora");
|
|
||||||
|
|
||||||
if (ACCESSING_BITS_0_7)
|
|
||||||
{
|
|
||||||
pandora_set_clear_bitmap(pandora, data & 0x0004);
|
|
||||||
}
|
|
||||||
|
|
||||||
// other bits unknown !
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WRITE16_MEMBER(galpanic_state::galpanic_coin_w)
|
WRITE16_MEMBER(galpanic_state::galpanic_coin_w)
|
||||||
{
|
{
|
||||||
@ -241,7 +227,7 @@ static ADDRESS_MAP_START( galpanic_map, AS_PROGRAM, 16, galpanic_state )
|
|||||||
AM_RANGE(0xb00000, 0xb00001) AM_WRITENOP /* ??? */
|
AM_RANGE(0xb00000, 0xb00001) AM_WRITENOP /* ??? */
|
||||||
AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP /* ??? */
|
AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP /* ??? */
|
||||||
AM_RANGE(0xd00000, 0xd00001) AM_WRITENOP /* ??? */
|
AM_RANGE(0xd00000, 0xd00001) AM_WRITENOP /* ??? */
|
||||||
AM_RANGE(0xe00000, 0xe00015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) /* CALC1 MCU interaction (simulated) */
|
AM_RANGE(0xe00000, 0xe00015) AM_DEVREADWRITE("calc1_mcu", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
READ16_MEMBER(galpanic_state::comad_timer_r)
|
READ16_MEMBER(galpanic_state::comad_timer_r)
|
||||||
@ -589,6 +575,12 @@ static MACHINE_CONFIG_START( galpanic, galpanic_state )
|
|||||||
|
|
||||||
MCFG_KANEKO_PANDORA_ADD("pandora", galpanic_pandora_config)
|
MCFG_KANEKO_PANDORA_ADD("pandora", galpanic_pandora_config)
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("calc1_mcu", KANEKO_HIT, 0)
|
||||||
|
kaneko_hit_device::set_type(*device, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MCFG_PALETTE_INIT(galpanic)
|
MCFG_PALETTE_INIT(galpanic)
|
||||||
MCFG_VIDEO_START(galpanic)
|
MCFG_VIDEO_START(galpanic)
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ Dip locations verified from manual for:
|
|||||||
#include "sound/2203intf.h"
|
#include "sound/2203intf.h"
|
||||||
#include "sound/2151intf.h"
|
#include "sound/2151intf.h"
|
||||||
#include "sound/okim6295.h"
|
#include "sound/okim6295.h"
|
||||||
|
#include "machine/kaneko_hit.h"
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -451,7 +452,7 @@ static ADDRESS_MAP_START( bloodwar, AS_PROGRAM, 16, kaneko16_state )
|
|||||||
AM_RANGE(0x700000, 0x70001f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
|
AM_RANGE(0x700000, 0x70001f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
|
||||||
AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
|
AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
|
||||||
AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
|
AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
|
||||||
AM_RANGE(0x900000, 0x900039) AM_READWRITE(bloodwar_calc_r, bloodwar_calc_w)
|
AM_RANGE(0x900000, 0x900039) AM_DEVREADWRITE("kan_hit", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
|
||||||
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
|
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
|
||||||
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
|
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
|
||||||
AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")
|
AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")
|
||||||
@ -509,7 +510,7 @@ static ADDRESS_MAP_START( bonkadv, AS_PROGRAM, 16, kaneko16_state )
|
|||||||
AM_RANGE(0x700000, 0x70001f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
|
AM_RANGE(0x700000, 0x70001f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
|
||||||
AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
|
AM_RANGE(0x800000, 0x800001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
|
||||||
AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
|
AM_RANGE(0x880000, 0x880001) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
|
||||||
AM_RANGE(0x900000, 0x900015) AM_READWRITE(galpanib_calc_r,galpanib_calc_w)
|
AM_RANGE(0x900000, 0x900015) AM_DEVREADWRITE("kan_hit", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
|
||||||
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
|
AM_RANGE(0xa00000, 0xa00001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
|
||||||
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
|
AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")
|
||||||
AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")
|
AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")
|
||||||
@ -754,7 +755,7 @@ static ADDRESS_MAP_START( shogwarr, AS_PROGRAM, 16, kaneko16_state )
|
|||||||
AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w )
|
AM_RANGE(0x600000, 0x603fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w )
|
||||||
AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w)
|
AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w)
|
||||||
AM_RANGE(0x900000, 0x90001f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
|
AM_RANGE(0x900000, 0x90001f) AM_DEVREADWRITE("kan_spr", kaneko16_sprite_device, kaneko16_sprites_regs_r, kaneko16_sprites_regs_w)
|
||||||
AM_RANGE(0xa00000, 0xa0007f) AM_READWRITE(bloodwar_calc_r, bloodwar_calc_w)
|
AM_RANGE(0xa00000, 0xa0007f) AM_DEVREADWRITE("kan_hit", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
|
||||||
AM_RANGE(0xa80000, 0xa80001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
|
AM_RANGE(0xa80000, 0xa80001) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w) // Watchdog
|
||||||
AM_RANGE(0xb80000, 0xb80001) AM_READ_PORT("P1")
|
AM_RANGE(0xb80000, 0xb80001) AM_READ_PORT("P1")
|
||||||
AM_RANGE(0xb80002, 0xb80003) AM_READ_PORT("P2")
|
AM_RANGE(0xb80002, 0xb80003) AM_READ_PORT("P2")
|
||||||
@ -1955,6 +1956,10 @@ static MACHINE_CONFIG_DERIVED( bloodwar, gtmr )
|
|||||||
MCFG_DEVICE_MODIFY("kan_spr")
|
MCFG_DEVICE_MODIFY("kan_spr")
|
||||||
kaneko16_sprite_device::set_priorities(*device, 2 /* never used? */ ,3 /* character selection / vs. portraits */ ,5 /* winning portrait*/ ,7 /* ? */);
|
kaneko16_sprite_device::set_priorities(*device, 2 /* never used? */ ,3 /* character selection / vs. portraits */ ,5 /* winning portrait*/ ,7 /* ? */);
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("kan_hit", KANEKO_HIT, 0)
|
||||||
|
kaneko_hit_device::set_type(*device, 1);
|
||||||
|
|
||||||
|
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -1982,6 +1987,10 @@ static MACHINE_CONFIG_DERIVED( bonkadv, gtmr )
|
|||||||
|
|
||||||
MCFG_DEVICE_MODIFY("kan_spr")
|
MCFG_DEVICE_MODIFY("kan_spr")
|
||||||
kaneko16_sprite_device::set_priorities(*device, 2 /* never used? */ ,3 /* volcano lava on level 2 */ ,5 /* in-game player */ ,7 /* demostration text */);
|
kaneko16_sprite_device::set_priorities(*device, 2 /* never used? */ ,3 /* volcano lava on level 2 */ ,5 /* in-game player */ ,7 /* demostration text */);
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("kan_hit", KANEKO_HIT, 0)
|
||||||
|
kaneko_hit_device::set_type(*device, 0);
|
||||||
|
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -2148,6 +2157,10 @@ static MACHINE_CONFIG_START( shogwarr, kaneko16_state )
|
|||||||
kaneko16_sprite_device::set_offsets(*device, 0xa00, -0x40);
|
kaneko16_sprite_device::set_offsets(*device, 0xa00, -0x40);
|
||||||
kaneko16_sprite_device::set_fliptype(*device, 1);
|
kaneko16_sprite_device::set_fliptype(*device, 1);
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("kan_hit", KANEKO_HIT, 0)
|
||||||
|
kaneko_hit_device::set_type(*device, 1);
|
||||||
|
|
||||||
|
|
||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
|
||||||
@ -2181,6 +2194,9 @@ static MACHINE_CONFIG_DERIVED( brapboys, shogwarr )
|
|||||||
MCFG_SOUND_MODIFY("oki2")
|
MCFG_SOUND_MODIFY("oki2")
|
||||||
MCFG_DEVICE_ADDRESS_MAP(AS_0, brapboys_oki2_map)
|
MCFG_DEVICE_ADDRESS_MAP(AS_0, brapboys_oki2_map)
|
||||||
|
|
||||||
|
MCFG_DEVICE_MODIFY("kan_hit")
|
||||||
|
kaneko_hit_device::set_type(*device, 2);
|
||||||
|
|
||||||
MCFG_DEVICE_REMOVE("eeprom")
|
MCFG_DEVICE_REMOVE("eeprom")
|
||||||
MCFG_EEPROM_93C46_ADD("eeprom")
|
MCFG_EEPROM_93C46_ADD("eeprom")
|
||||||
MCFG_EEPROM_DATA(brapboys_default_eeprom, 128)
|
MCFG_EEPROM_DATA(brapboys_default_eeprom, 128)
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -110,6 +110,52 @@ public:
|
|||||||
DECLARE_READ8_MEMBER( pio5_r2 ) { return m_z80pio_5->read(space, 2); }
|
DECLARE_READ8_MEMBER( pio5_r2 ) { return m_z80pio_5->read(space, 2); }
|
||||||
DECLARE_READ8_MEMBER( pio5_r3 ) { return m_z80pio_5->read(space, 3); }
|
DECLARE_READ8_MEMBER( pio5_r3 ) { return m_z80pio_5->read(space, 3); }
|
||||||
|
|
||||||
|
/* PIO 1 */
|
||||||
|
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_1_m_out_int_w) { /* logerror("pio_1_m_out_int_w %02x\n", state); */ }
|
||||||
|
DECLARE_READ8_MEMBER(pio_1_m_in_pa_r) { logerror("pio_1_m_in_pa_r (INPUT MATRIX)\n"); return space.machine().rand(); }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_1_m_out_pa_w) { logerror("pio_1_m_out_pa_w %02x\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_1_m_out_ardy_w) { logerror("pio_1_m_out_ardy_w %02x\n", state); }
|
||||||
|
DECLARE_READ8_MEMBER(pio_1_m_in_pb_r) { logerror("pio_1_m_in_pb_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_1_m_out_pb_w) { logerror("pio_1_m_out_pb_w %02x (REELS)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_1_m_out_brdy_w) { logerror("pio_1_m_out_brdy_w %02x\n", state); }
|
||||||
|
|
||||||
|
/* PIO 2 */
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_2_m_out_int_w) { /* logerror("pio_2_m_out_int_w %02x\n", state); */ }
|
||||||
|
DECLARE_READ8_MEMBER(pio_2_m_in_pa_r) { logerror("pio_2_m_in_pa_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_2_m_out_pa_w) { logerror("pio_2_m_out_pa_w %02x\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_2_m_out_ardy_w) { logerror("pio_2_m_out_ardy_w %02x\n", state); }
|
||||||
|
DECLARE_READ8_MEMBER(pio_2_m_in_pb_r) { logerror("pio_2_m_in_pb_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_2_m_out_pb_w) { logerror("pio_2_m_out_pb_w %02x (ALPHA)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_2_m_out_brdy_w) { logerror("pio_2_m_out_brdy_w %02x\n", state); }
|
||||||
|
|
||||||
|
/* PIO 3 */
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_3_m_out_int_w) { /* logerror("pio_3_m_out_int_w %02x\n", state); */ }
|
||||||
|
DECLARE_READ8_MEMBER(pio_3_m_in_pa_r) { logerror("pio_3_m_in_pa_r (REEL OPTICS)\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_3_m_out_pa_w) { logerror("pio_3_m_out_pa_w %02x (STROBE)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_3_m_out_ardy_w) { logerror("pio_3_m_out_ardy_w %02x\n", state); }
|
||||||
|
DECLARE_READ8_MEMBER(pio_3_m_in_pb_r) { logerror("pio_3_m_in_pb_r (COIN INPUT)\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_3_m_out_pb_w) { logerror("pio_3_m_out_pb_w %02x\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_3_m_out_brdy_w) { logerror("pio_3_m_out_brdy_w %02x\n", state); }
|
||||||
|
|
||||||
|
/* PIO 4 */
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_4_m_out_int_w) { /* logerror("pio_4_m_out_int_w %02x\n", state); */ }
|
||||||
|
DECLARE_READ8_MEMBER(pio_4_m_in_pa_r) { logerror("pio_4_m_in_pa_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_4_m_out_pa_w) { logerror("pio_4_m_out_pa_w %02x (TRIAC)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_4_m_out_ardy_w) { logerror("pio_4_m_out_ardy_w %02x\n", state); }
|
||||||
|
DECLARE_READ8_MEMBER(pio_4_m_in_pb_r) { logerror("pio_4_m_in_pb_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_4_m_out_pb_w) { logerror("pio_4_m_out_pb_w %02x (7SEG)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_4_m_out_brdy_w) { logerror("pio_4_m_out_brdy_w %02x\n", state); }
|
||||||
|
|
||||||
|
/* PIO 5 */
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_5_m_out_int_w) { /* logerror("pio_5_m_out_int_w %02x\n", state); */ }
|
||||||
|
DECLARE_READ8_MEMBER(pio_5_m_in_pa_r) { logerror("pio_5_m_in_pa_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_5_m_out_pa_w) { logerror("pio_5_m_out_pa_w %02x (LAMPS0)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_5_m_out_ardy_w) { logerror("pio_5_m_out_ardy_w %02x\n", state); }
|
||||||
|
DECLARE_READ8_MEMBER(pio_5_m_in_pb_r) { logerror("pio_5_m_in_pb_r\n"); return 0x00; }
|
||||||
|
DECLARE_WRITE8_MEMBER(pio_5_m_out_pb_w) { logerror("pio_5_m_out_pb_w %02x (LAMPS1)\n", data); }
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pio_5_m_out_brdy_w) { logerror("pio_5_m_out_brdy_w %02x\n", state); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// devices
|
// devices
|
||||||
@ -193,59 +239,61 @@ ADDRESS_MAP_END
|
|||||||
static INPUT_PORTS_START( proconn )
|
static INPUT_PORTS_START( proconn )
|
||||||
INPUT_PORTS_END
|
INPUT_PORTS_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Z80PIO_INTERFACE( pio_interface_1 )
|
static Z80PIO_INTERFACE( pio_interface_1 )
|
||||||
{
|
{
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_1_m_out_int_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_1_m_in_pa_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_1_m_out_pa_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_1_m_out_ardy_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_1_m_in_pb_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_1_m_out_pb_w),
|
||||||
DEVCB_NULL
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_1_m_out_brdy_w),
|
||||||
};
|
};
|
||||||
|
|
||||||
static Z80PIO_INTERFACE( pio_interface_2 )
|
static Z80PIO_INTERFACE( pio_interface_2 )
|
||||||
{
|
{
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_2_m_out_int_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_2_m_in_pa_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_2_m_out_pa_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_2_m_out_ardy_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_2_m_in_pb_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_2_m_out_pb_w),
|
||||||
DEVCB_NULL
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_2_m_out_brdy_w),
|
||||||
};
|
};
|
||||||
|
|
||||||
static Z80PIO_INTERFACE( pio_interface_3 )
|
static Z80PIO_INTERFACE( pio_interface_3 )
|
||||||
{
|
{
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_3_m_out_int_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_3_m_in_pa_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_3_m_out_pa_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_3_m_out_ardy_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_3_m_in_pb_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_3_m_out_pb_w),
|
||||||
DEVCB_NULL
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_3_m_out_brdy_w),
|
||||||
};
|
};
|
||||||
|
|
||||||
static Z80PIO_INTERFACE( pio_interface_4 )
|
static Z80PIO_INTERFACE( pio_interface_4 )
|
||||||
{
|
{
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_4_m_out_int_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_4_m_in_pa_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_4_m_out_pa_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_4_m_out_ardy_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_4_m_in_pb_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_4_m_out_pb_w),
|
||||||
DEVCB_NULL
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_4_m_out_brdy_w),
|
||||||
};
|
};
|
||||||
|
|
||||||
static Z80PIO_INTERFACE( pio_interface_5 )
|
static Z80PIO_INTERFACE( pio_interface_5 )
|
||||||
{
|
{
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_5_m_out_int_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_5_m_in_pa_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_5_m_out_pa_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_5_m_out_ardy_w),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_5_m_in_pb_r),
|
||||||
DEVCB_NULL,
|
DEVCB_DRIVER_MEMBER(proconn_state,pio_5_m_out_pb_w),
|
||||||
DEVCB_NULL
|
DEVCB_DRIVER_LINE_MEMBER(proconn_state,pio_5_m_out_brdy_w),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -265,6 +313,8 @@ static WRITE8_DEVICE_HANDLER( serial_transmit )
|
|||||||
// if (offset == 0)
|
// if (offset == 0)
|
||||||
// state->m_vfd->write_char( data );
|
// state->m_vfd->write_char( data );
|
||||||
|
|
||||||
|
// should probably be in the pios above
|
||||||
|
|
||||||
for (int i=0; i<8;i++)
|
for (int i=0; i<8;i++)
|
||||||
{
|
{
|
||||||
state->m_vfd->shift_data( (data & (1<<i))?0:1 );
|
state->m_vfd->shift_data( (data & (1<<i))?0:1 );
|
||||||
|
@ -78,7 +78,7 @@ Is there another alt program rom set labeled 9 & 10?
|
|||||||
#include "sound/2151intf.h"
|
#include "sound/2151intf.h"
|
||||||
#include "sound/okim6295.h"
|
#include "sound/okim6295.h"
|
||||||
#include "video/kan_pand.h"
|
#include "video/kan_pand.h"
|
||||||
|
#include "machine/kaneko_hit.h"
|
||||||
|
|
||||||
class sandscrp_state : public kaneko16_state
|
class sandscrp_state : public kaneko16_state
|
||||||
{
|
{
|
||||||
@ -258,7 +258,7 @@ static ADDRESS_MAP_START( sandscrp, AS_PROGRAM, 16, sandscrp_state )
|
|||||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(sandscrp_irq_cause_w) // IRQ Ack
|
AM_RANGE(0x100000, 0x100001) AM_WRITE(sandscrp_irq_cause_w) // IRQ Ack
|
||||||
|
|
||||||
AM_RANGE(0x700000, 0x70ffff) AM_RAM // RAM
|
AM_RANGE(0x700000, 0x70ffff) AM_RAM // RAM
|
||||||
AM_RANGE(0x200000, 0x20001f) AM_READWRITE(galpanib_calc_r,galpanib_calc_w) // Protection
|
AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("calc1_mcu", kaneko_hit_device, kaneko_hit_r,kaneko_hit_w)
|
||||||
AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w)
|
AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_regs_r, kaneko_tmap_regs_w)
|
||||||
AM_RANGE(0x400000, 0x403fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w )
|
AM_RANGE(0x400000, 0x403fff) AM_DEVREADWRITE("view2_0", kaneko_view2_tilemap_device, kaneko_tmap_vram_r, kaneko_tmap_vram_w )
|
||||||
AM_RANGE(0x500000, 0x501fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w ) // sprites
|
AM_RANGE(0x500000, 0x501fff) AM_DEVREADWRITE_LEGACY("pandora", pandora_spriteram_LSB_r, pandora_spriteram_LSB_w ) // sprites
|
||||||
@ -520,6 +520,8 @@ static MACHINE_CONFIG_START( sandscrp, sandscrp_state )
|
|||||||
kaneko_view2_tilemap_device::set_gfx_region(*device, 1);
|
kaneko_view2_tilemap_device::set_gfx_region(*device, 1);
|
||||||
kaneko_view2_tilemap_device::set_offset(*device, 0x5b, 0, 256, 224);
|
kaneko_view2_tilemap_device::set_offset(*device, 0x5b, 0, 256, 224);
|
||||||
|
|
||||||
|
MCFG_DEVICE_ADD("calc1_mcu", KANEKO_HIT, 0)
|
||||||
|
kaneko_hit_device::set_type(*device, 0);
|
||||||
|
|
||||||
MCFG_KANEKO_PANDORA_ADD("pandora", sandscrp_pandora_config)
|
MCFG_KANEKO_PANDORA_ADD("pandora", sandscrp_pandora_config)
|
||||||
|
|
||||||
|
@ -13,36 +13,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
UINT16 x1p, y1p, x1s, y1s;
|
|
||||||
UINT16 x2p, y2p, x2s, y2s;
|
|
||||||
|
|
||||||
INT16 x12, y12, x21, y21;
|
|
||||||
|
|
||||||
UINT16 mult_a, mult_b;
|
|
||||||
} calc1_hit_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int x1p, y1p, z1p, x1s, y1s, z1s;
|
|
||||||
int x2p, y2p, z2p, x2s, y2s, z2s;
|
|
||||||
|
|
||||||
int x1po, y1po, z1po, x1so, y1so, z1so;
|
|
||||||
int x2po, y2po, z2po, x2so, y2so, z2so;
|
|
||||||
|
|
||||||
int x12, y12, z12, x21, y21, z21;
|
|
||||||
|
|
||||||
int x_coll, y_coll, z_coll;
|
|
||||||
|
|
||||||
int x1tox2, y1toy2, z1toz2;
|
|
||||||
|
|
||||||
UINT16 mult_a, mult_b;
|
|
||||||
|
|
||||||
UINT16 flags;
|
|
||||||
UINT16 mode;
|
|
||||||
} calc3_hit_t;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int mcu_status;
|
int mcu_status;
|
||||||
@ -90,8 +60,6 @@ public:
|
|||||||
|
|
||||||
UINT8 m_nvram_save[128];
|
UINT8 m_nvram_save[128];
|
||||||
|
|
||||||
calc1_hit_t m_hit;
|
|
||||||
calc3_hit_t m_hit3;
|
|
||||||
calc3_t m_calc3;
|
calc3_t m_calc3;
|
||||||
void (*m_toybox_mcu_run)(running_machine &machine);
|
void (*m_toybox_mcu_run)(running_machine &machine);
|
||||||
UINT16 m_toybox_mcu_com[4];
|
UINT16 m_toybox_mcu_com[4];
|
||||||
|
@ -18,475 +18,14 @@ Currently none of the MCUs' internal roms are dumped so simulation is used
|
|||||||
#include "kanekotb.h" // TOYBOX MCU trojaning results
|
#include "kanekotb.h" // TOYBOX MCU trojaning results
|
||||||
#include "machine/eeprom.h"
|
#include "machine/eeprom.h"
|
||||||
|
|
||||||
|
|
||||||
#define CALC3_VERBOSE_OUTPUT 0
|
#define CALC3_VERBOSE_OUTPUT 0
|
||||||
|
|
||||||
#define MCU_RESPONSE(d) memcpy(&state->m_mcu_ram[mcu_offset], d, sizeof(d))
|
#define MCU_RESPONSE(d) memcpy(&state->m_mcu_ram[mcu_offset], d, sizeof(d))
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
Gals Panic (set 2)
|
|
||||||
Gals Panic (set 3)
|
|
||||||
Sand Scorpion
|
|
||||||
Bonk's Adventure
|
|
||||||
Blood Warrior
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
- see notes about this "calculator" implementation in drivers\galpanic.c
|
|
||||||
- bonkadv only uses Random Number, XY Overlap Collision bit and register '0x02'
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
READ16_MEMBER(kaneko16_state::galpanib_calc_r)/* Simulation of the CALC1 MCU */
|
|
||||||
{
|
|
||||||
calc1_hit_t &hit = m_hit;
|
|
||||||
UINT16 data = 0;
|
|
||||||
|
|
||||||
switch (offset)
|
|
||||||
{
|
|
||||||
case 0x00/2: // watchdog
|
|
||||||
return watchdog_reset_r(space,0);
|
|
||||||
|
|
||||||
case 0x02/2: // unknown (yet!), used by *MANY* games !!!
|
|
||||||
//popmessage("unknown collision reg");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x04/2: // similar to the hit detection from SuperNova, but much simpler
|
|
||||||
|
|
||||||
// X Absolute Collision
|
|
||||||
if (hit.x1p > hit.x2p) data |= 0x0200;
|
|
||||||
else if (hit.x1p == hit.x2p) data |= 0x0400;
|
|
||||||
else if (hit.x1p < hit.x2p) data |= 0x0800;
|
|
||||||
|
|
||||||
// Y Absolute Collision
|
|
||||||
if (hit.y1p > hit.y2p) data |= 0x2000;
|
|
||||||
else if (hit.y1p == hit.y2p) data |= 0x4000;
|
|
||||||
else if (hit.y1p < hit.y2p) data |= 0x8000;
|
|
||||||
|
|
||||||
// XY Overlap Collision
|
|
||||||
hit.x12 = (hit.x1p) - (hit.x2p + hit.x2s);
|
|
||||||
hit.y12 = (hit.y1p) - (hit.y2p + hit.y2s);
|
|
||||||
hit.x21 = (hit.x1p + hit.x1s) - (hit.x2p);
|
|
||||||
hit.y21 = (hit.y1p + hit.y1s) - (hit.y2p);
|
|
||||||
|
|
||||||
if ((hit.x12 < 0) && (hit.y12 < 0) &&
|
|
||||||
(hit.x21 >= 0) && (hit.y21 >= 0))
|
|
||||||
data |= 0x0001;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
|
|
||||||
case 0x10/2:
|
|
||||||
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) >> 16);
|
|
||||||
case 0x12/2:
|
|
||||||
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) & 0xffff);
|
|
||||||
|
|
||||||
case 0x14/2:
|
|
||||||
return (machine().rand() & 0xffff);
|
|
||||||
|
|
||||||
default:
|
|
||||||
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(kaneko16_state::galpanib_calc_w)
|
|
||||||
{
|
|
||||||
calc1_hit_t &hit = m_hit;
|
|
||||||
|
|
||||||
switch (offset)
|
|
||||||
{
|
|
||||||
// p is position, s is size
|
|
||||||
case 0x00/2: hit.x1p = data; break;
|
|
||||||
case 0x02/2: hit.x1s = data; break;
|
|
||||||
case 0x04/2: hit.y1p = data; break;
|
|
||||||
case 0x06/2: hit.y1s = data; break;
|
|
||||||
case 0x08/2: hit.x2p = data; break;
|
|
||||||
case 0x0a/2: hit.x2s = data; break;
|
|
||||||
case 0x0c/2: hit.y2p = data; break;
|
|
||||||
case 0x0e/2: hit.y2s = data; break;
|
|
||||||
case 0x10/2: hit.mult_a = data; break;
|
|
||||||
case 0x12/2: hit.mult_b = data; break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(kaneko16_state::bloodwar_calc_w)
|
|
||||||
{
|
|
||||||
calc1_hit_t &hit = m_hit;
|
|
||||||
int isbrap = ( !strcmp(machine().system().name,"brapboysj") || !strcmp(machine().system().name,"brapboysu") || !strcmp(machine().system().name,"brapboys"));
|
|
||||||
|
|
||||||
/* our implementation is incomplete, b.rap boys requires some modifications */
|
|
||||||
if (isbrap)
|
|
||||||
{
|
|
||||||
shogwarr_calc_w(space,offset,data,mem_mask);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (offset)
|
|
||||||
{
|
|
||||||
// p is position, s is size
|
|
||||||
case 0x20/2: hit.x1p = data; break;
|
|
||||||
case 0x22/2: hit.x1s = data; break;
|
|
||||||
case 0x24/2: hit.y1p = data; break;
|
|
||||||
case 0x26/2: hit.y1s = data; break;
|
|
||||||
|
|
||||||
case 0x2c/2: hit.x2p = data; break;
|
|
||||||
case 0x2e/2: hit.x2s = data; break;
|
|
||||||
case 0x30/2: hit.y2p = data; break;
|
|
||||||
case 0x32/2: hit.y2s = data; break;
|
|
||||||
|
|
||||||
// this register is set to zero before any computation,
|
|
||||||
// but it has no effect on inputs or result registers
|
|
||||||
case 0x38/2: break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
collision detection: absolute "distance", negative if no overlap
|
|
||||||
[one inside other] | [ normal overlap ] | [ no overlap ]
|
|
||||||
rect1 <--------------> | <-----------> | <--->
|
|
||||||
rect2 <-----> | <-----------> | <--->
|
|
||||||
result <----------> | <--------> | <---->
|
|
||||||
*/
|
|
||||||
|
|
||||||
static INT16 calc_compute_x(calc1_hit_t &hit)
|
|
||||||
{
|
|
||||||
INT16 x_coll;
|
|
||||||
|
|
||||||
// X distance
|
|
||||||
if ((hit.x2p >= hit.x1p) && (hit.x2p < (hit.x1p + hit.x1s))) // x2p inside x1
|
|
||||||
x_coll = (hit.x1s - (hit.x2p - hit.x1p));
|
|
||||||
else if ((hit.x1p >= hit.x2p) && (hit.x1p < (hit.x2p + hit.x2s))) // x1p inside x2
|
|
||||||
x_coll = (hit.x2s - (hit.x1p - hit.x2p));
|
|
||||||
else // normal/no overlap
|
|
||||||
x_coll = ((hit.x1s + hit.x2s)/2) - abs((hit.x1p + hit.x1s/2) - (hit.x2p + hit.x2s/2));
|
|
||||||
|
|
||||||
return x_coll;
|
|
||||||
}
|
|
||||||
|
|
||||||
static INT16 calc_compute_y(calc1_hit_t &hit)
|
|
||||||
{
|
|
||||||
INT16 y_coll;
|
|
||||||
|
|
||||||
// Y distance
|
|
||||||
if ((hit.y2p >= hit.y1p) && (hit.y2p < (hit.y1p + hit.y1s))) // y2p inside y1
|
|
||||||
y_coll = (hit.y1s - (hit.y2p - hit.y1p));
|
|
||||||
else if ((hit.y1p >= hit.y2p) && (hit.y1p < (hit.y2p + hit.y2s))) // y1p inside y2
|
|
||||||
y_coll = (hit.y2s - (hit.y1p - hit.y2p));
|
|
||||||
else // normal/no overlap
|
|
||||||
y_coll = ((hit.y1s + hit.y2s)/2) - abs((hit.y1p + hit.y1s/2) - (hit.y2p + hit.y2s/2));
|
|
||||||
|
|
||||||
return y_coll;
|
|
||||||
}
|
|
||||||
|
|
||||||
READ16_MEMBER(kaneko16_state::bloodwar_calc_r)
|
|
||||||
{
|
|
||||||
calc1_hit_t &hit = m_hit;
|
|
||||||
UINT16 data = 0;
|
|
||||||
INT16 x_coll, y_coll;
|
|
||||||
|
|
||||||
/* our implementation is incomplete, b.rap boys requires some modifications */
|
|
||||||
int isbrap = ( !strcmp(machine().system().name,"brapboysj") || !strcmp(machine().system().name,"brapboysu") || !strcmp(machine().system().name,"brapboys"));
|
|
||||||
|
|
||||||
if (isbrap)
|
|
||||||
{
|
|
||||||
return shogwarr_calc_r(space,offset,mem_mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
x_coll = calc_compute_x(hit);
|
|
||||||
y_coll = calc_compute_y(hit);
|
|
||||||
|
|
||||||
switch (offset)
|
|
||||||
{
|
|
||||||
case 0x00/2: // X distance
|
|
||||||
return x_coll;
|
|
||||||
|
|
||||||
case 0x02/2: // Y distance
|
|
||||||
return y_coll;
|
|
||||||
|
|
||||||
case 0x04/2: // similar to the hit detection from SuperNova, but much simpler
|
|
||||||
|
|
||||||
// 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2
|
|
||||||
if (hit.y1p > hit.y2p) data |= 0x2000;
|
|
||||||
else if (hit.y1p == hit.y2p) data |= 0x4000;
|
|
||||||
else if (hit.y1p < hit.y2p) data |= 0x8000;
|
|
||||||
if (y_coll<0) data |= 0x1000;
|
|
||||||
|
|
||||||
// 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2
|
|
||||||
if (hit.x1p > hit.x2p) data |= 0x0200;
|
|
||||||
else if (hit.x1p == hit.x2p) data |= 0x0400;
|
|
||||||
else if (hit.x1p < hit.x2p) data |= 0x0800;
|
|
||||||
if (x_coll<0) data |= 0x0100;
|
|
||||||
|
|
||||||
// 2nd nibble: always set to 4
|
|
||||||
data |= 0x0040;
|
|
||||||
|
|
||||||
// 1st nibble: XY Overlap Collision -> possible values = 0,2,4,f
|
|
||||||
if (x_coll>=0) data |= 0x0004;
|
|
||||||
if (y_coll>=0) data |= 0x0002;
|
|
||||||
if ((x_coll>=0)&&(y_coll>=0)) data |= 0x000F;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
|
|
||||||
case 0x14/2:
|
|
||||||
return (machine().rand() & 0xffff);
|
|
||||||
|
|
||||||
case 0x20/2: return hit.x1p;
|
|
||||||
case 0x22/2: return hit.x1s;
|
|
||||||
case 0x24/2: return hit.y1p;
|
|
||||||
case 0x26/2: return hit.y1s;
|
|
||||||
|
|
||||||
case 0x2c/2: return hit.x2p;
|
|
||||||
case 0x2e/2: return hit.x2s;
|
|
||||||
case 0x30/2: return hit.y2p;
|
|
||||||
case 0x32/2: return hit.y2s;
|
|
||||||
|
|
||||||
default:
|
|
||||||
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
B Rap Boys
|
|
||||||
Shogun Warriors
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//calculate simple intersection of two segments
|
|
||||||
|
|
||||||
static int shogwarr_calc_compute(int x1, int w1, int x2, int w2)
|
|
||||||
{
|
|
||||||
int dist;
|
|
||||||
|
|
||||||
if(x2>=x1 && x2+w2<=(x1+w1))
|
|
||||||
{
|
|
||||||
//x2 inside x1
|
|
||||||
dist=w2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(x1>=x2 && x1+w1<=(x2+w2))
|
|
||||||
{
|
|
||||||
//x1 inside x2
|
|
||||||
dist=w1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(x2<x1)
|
|
||||||
{
|
|
||||||
//swap
|
|
||||||
int tmp=x1;
|
|
||||||
x1=x2;
|
|
||||||
x2=tmp;
|
|
||||||
tmp=w1;
|
|
||||||
w1=w2;
|
|
||||||
w2=tmp;
|
|
||||||
}
|
|
||||||
dist=x1+w1-x2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dist;
|
|
||||||
}
|
|
||||||
|
|
||||||
//calc segment coordinates
|
|
||||||
|
|
||||||
static void shogwarr_calc_org(int mode, int x0, int s0, int* x1, int* s1)
|
|
||||||
{
|
|
||||||
switch(mode)
|
|
||||||
{
|
|
||||||
case 0: *x1=x0; *s1=s0; break;
|
|
||||||
case 1: *x1=x0-s0/2; *s1=s0; break;
|
|
||||||
case 2: *x1=x0-s0; *s1=s0; break;
|
|
||||||
case 3: *x1=x0-s0; *s1=2*s0; break;
|
|
||||||
}
|
|
||||||
//x1 is the left most coord, s1 = width
|
|
||||||
}
|
|
||||||
|
|
||||||
static void shogwarr_recalc_collisions(calc3_hit_t &hit3)
|
|
||||||
{
|
|
||||||
//calculate positions and sizes
|
|
||||||
|
|
||||||
int mode=hit3.mode;
|
|
||||||
|
|
||||||
hit3.flags=0;
|
|
||||||
|
|
||||||
shogwarr_calc_org((mode>>0)&3, hit3.x1po, hit3.x1so, &hit3.x1p, &hit3.x1s);
|
|
||||||
shogwarr_calc_org((mode>>2)&3, hit3.y1po, hit3.y1so, &hit3.y1p, &hit3.y1s);
|
|
||||||
shogwarr_calc_org((mode>>4)&3, hit3.z1po, hit3.z1so, &hit3.z1p, &hit3.z1s);
|
|
||||||
|
|
||||||
shogwarr_calc_org((mode>>8)&3, hit3.x2po, hit3.x2so, &hit3.x2p, &hit3.x2s);
|
|
||||||
shogwarr_calc_org((mode>>10)&3, hit3.y2po, hit3.y2so, &hit3.y2p, &hit3.y2s);
|
|
||||||
shogwarr_calc_org((mode>>12)&3, hit3.z2po, hit3.z2so, &hit3.z2p, &hit3.z2s);
|
|
||||||
|
|
||||||
|
|
||||||
hit3.x1tox2=abs(hit3.x2po-hit3.x1po);
|
|
||||||
hit3.y1toy2=abs(hit3.y2po-hit3.y1po);
|
|
||||||
hit3.z1toz2=abs(hit3.z2po-hit3.z1po);
|
|
||||||
|
|
||||||
|
|
||||||
hit3.x_coll = shogwarr_calc_compute(hit3.x1p, hit3.x1s, hit3.x2p, hit3.x2s);
|
|
||||||
hit3.y_coll = shogwarr_calc_compute(hit3.y1p, hit3.y1s, hit3.y2p, hit3.y2s);
|
|
||||||
hit3.z_coll = shogwarr_calc_compute(hit3.z1p, hit3.z1s, hit3.z2p, hit3.z2s);
|
|
||||||
|
|
||||||
|
|
||||||
// 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2
|
|
||||||
if (hit3.y1p > hit3.y2p) hit3.flags |= 0x2000;
|
|
||||||
else if (hit3.y1p == hit3.y2p) hit3.flags |= 0x4000;
|
|
||||||
else if (hit3.y1p < hit3.y2p) hit3.flags |= 0x8000;
|
|
||||||
if (hit3.y_coll<0) hit3.flags |= 0x1000;
|
|
||||||
|
|
||||||
// 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2
|
|
||||||
if (hit3.x1p > hit3.x2p) hit3.flags |= 0x0200;
|
|
||||||
else if (hit3.x1p == hit3.x2p) hit3.flags |= 0x0400;
|
|
||||||
else if (hit3.x1p < hit3.x2p) hit3.flags |= 0x0800;
|
|
||||||
if (hit3.x_coll<0) hit3.flags |= 0x0100;
|
|
||||||
|
|
||||||
// 2nd nibble: Z Absolute Collision -> possible values = 9,8,4,3,2
|
|
||||||
if (hit3.z1p > hit3.z2p) hit3.flags |= 0x0020;
|
|
||||||
else if (hit3.z1p == hit3.z2p) hit3.flags |= 0x0040;
|
|
||||||
else if (hit3.z1p < hit3.z2p) hit3.flags |= 0x0080;
|
|
||||||
if (hit3.z_coll<0) hit3.flags |= 0x0010;
|
|
||||||
|
|
||||||
// 1st nibble: XYZ Overlap Collision
|
|
||||||
if ((hit3.x_coll>=0)&&(hit3.y_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0008;
|
|
||||||
if ((hit3.x_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0004;
|
|
||||||
if ((hit3.y_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0002;
|
|
||||||
if ((hit3.x_coll>=0)&&(hit3.y_coll>=0)) hit3.flags |= 0x0001;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WRITE16_MEMBER(kaneko16_state::shogwarr_calc_w)
|
|
||||||
{
|
|
||||||
calc3_hit_t &hit3 = m_hit3;
|
|
||||||
int idx=offset*4;
|
|
||||||
switch (idx)
|
|
||||||
{
|
|
||||||
// p is position, s is size
|
|
||||||
case 0x00:
|
|
||||||
case 0x28:
|
|
||||||
|
|
||||||
hit3.x1po = data; break;
|
|
||||||
|
|
||||||
case 0x04:
|
|
||||||
case 0x2c:
|
|
||||||
hit3.x1so = data; break;
|
|
||||||
|
|
||||||
case 0x08:
|
|
||||||
case 0x30:
|
|
||||||
hit3.y1po = data; break;
|
|
||||||
|
|
||||||
case 0x0c:
|
|
||||||
case 0x34:
|
|
||||||
hit3.y1so = data; break;
|
|
||||||
|
|
||||||
case 0x10:
|
|
||||||
case 0x58:
|
|
||||||
hit3.x2po = data; break;
|
|
||||||
|
|
||||||
case 0x14:
|
|
||||||
case 0x5c:
|
|
||||||
hit3.x2so = data; break;
|
|
||||||
|
|
||||||
case 0x18:
|
|
||||||
case 0x60:
|
|
||||||
hit3.y2po = data; break;
|
|
||||||
|
|
||||||
case 0x1c:
|
|
||||||
case 0x64:
|
|
||||||
hit3.y2so = data; break;
|
|
||||||
|
|
||||||
case 0x38:
|
|
||||||
case 0x50:
|
|
||||||
hit3.z1po = data; break;
|
|
||||||
case 0x3c:
|
|
||||||
case 0x54:
|
|
||||||
hit3.z1so = data; break;
|
|
||||||
|
|
||||||
case 0x20:
|
|
||||||
case 0x68:
|
|
||||||
hit3.z2po = data; break;
|
|
||||||
|
|
||||||
case 0x24:
|
|
||||||
case 0x6c:
|
|
||||||
hit3.z2so = data; break;
|
|
||||||
|
|
||||||
case 0x70:
|
|
||||||
hit3.mode=data;break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",cpu_get_pc(&space.device()),offset<<1, idx, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
shogwarr_recalc_collisions(hit3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
READ16_MEMBER(kaneko16_state::shogwarr_calc_r)
|
|
||||||
{
|
|
||||||
calc3_hit_t &hit3 = m_hit3;
|
|
||||||
int idx=offset*4;
|
|
||||||
|
|
||||||
switch (idx)
|
|
||||||
{
|
|
||||||
case 0x00: // X distance
|
|
||||||
case 0x10:
|
|
||||||
return hit3.x_coll;
|
|
||||||
|
|
||||||
case 0x04: // Y distance
|
|
||||||
case 0x14:
|
|
||||||
return hit3.y_coll;
|
|
||||||
|
|
||||||
case 0x18: // Z distance
|
|
||||||
return hit3.z_coll;
|
|
||||||
|
|
||||||
case 0x08:
|
|
||||||
case 0x1c:
|
|
||||||
|
|
||||||
return hit3.flags;
|
|
||||||
|
|
||||||
case 0x28:
|
|
||||||
return (machine().rand() & 0xffff);
|
|
||||||
|
|
||||||
case 0x40: return hit3.x1po;
|
|
||||||
case 0x44: return hit3.x1so;
|
|
||||||
case 0x48: return hit3.y1po;
|
|
||||||
case 0x4c: return hit3.y1so;
|
|
||||||
case 0x50: return hit3.z1po;
|
|
||||||
case 0x54: return hit3.z1so;
|
|
||||||
|
|
||||||
case 0x58: return hit3.x2po;
|
|
||||||
case 0x5c: return hit3.x2so;
|
|
||||||
case 0x60: return hit3.y2po;
|
|
||||||
case 0x64: return hit3.y2so;
|
|
||||||
case 0x68: return hit3.z2po;
|
|
||||||
case 0x6c: return hit3.z2so;
|
|
||||||
|
|
||||||
case 0x80: return hit3.x1tox2;
|
|
||||||
case 0x84: return hit3.y1toy2;
|
|
||||||
case 0x88: return hit3.z1toz2;
|
|
||||||
|
|
||||||
default:
|
|
||||||
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",cpu_get_pc(&space.device()),offset<<1, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
CALC3 MCU:
|
CALC3 MCU:
|
||||||
|
|
||||||
Shogun Warriors
|
Shogun Warriors / Fujiyama Buster
|
||||||
Fujiyama Buster
|
|
||||||
B.Rap Boys
|
B.Rap Boys
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
|
525
src/mame/machine/kaneko_hit.c
Normal file
525
src/mame/machine/kaneko_hit.c
Normal file
@ -0,0 +1,525 @@
|
|||||||
|
/* Kaneko 'Calc' hitbox collision / protection
|
||||||
|
|
||||||
|
It is thought that this is done by the 'CALC1' 'TOYBOX' and 'CALC3' protection chips found on the various boards
|
||||||
|
however we have 3 implementations, and they don't quite pair up with the chips at the moment, this might be
|
||||||
|
because our implementations are wrong / incomplete, or in some cases the newer chips are backwards compatible.
|
||||||
|
|
||||||
|
galpanica - CALC1 - type 0
|
||||||
|
sandscrp - CALC1 - type 0 ( only uses Random Number? )
|
||||||
|
bonkadv - TOYBOX - type 0 ( only uses Random Number, XY Overlap Collision bit and register '0x02' )
|
||||||
|
bloodwar - TOYBOX - type 1
|
||||||
|
type2 - CALC3 - type 1
|
||||||
|
brapboys - CALC3 - type 2
|
||||||
|
|
||||||
|
note: type2 won't work with our brapboys implementation despite them being the same PCB and same MCU, this
|
||||||
|
suggests that at least one of the implementations is wrong
|
||||||
|
|
||||||
|
suprnova.c also has a similar device, the implementation hasn't been fully compared
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "kaneko_hit.h"
|
||||||
|
|
||||||
|
const device_type KANEKO_HIT = &device_creator<kaneko_hit_device>;
|
||||||
|
|
||||||
|
kaneko_hit_device::kaneko_hit_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||||
|
: device_t(mconfig, KANEKO_HIT, "kaneko_hit_device", tag, owner, clock)
|
||||||
|
{
|
||||||
|
m_hittype = -1;
|
||||||
|
memset(&m_hit, 0, sizeof m_hit);
|
||||||
|
memset(&m_hit3, 0, sizeof m_hit3);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void kaneko_hit_device::set_type(device_t &device, int hittype)
|
||||||
|
{
|
||||||
|
kaneko_hit_device &dev = downcast<kaneko_hit_device &>(device);
|
||||||
|
dev.m_hittype = hittype;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void kaneko_hit_device::device_start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void kaneko_hit_device::device_reset()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
READ16_MEMBER(kaneko_hit_device::kaneko_hit_r)
|
||||||
|
{
|
||||||
|
switch (m_hittype)
|
||||||
|
{
|
||||||
|
case 0: return kaneko_hit_type0_r(space,offset,mem_mask);
|
||||||
|
case 1: return kaneko_hit_type1_r(space,offset,mem_mask);
|
||||||
|
case 2: return kaneko_hit_type2_r(space,offset,mem_mask);
|
||||||
|
|
||||||
|
default:
|
||||||
|
fatalerror("kaneko_hit_r called, but m_hittype not set\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_w)
|
||||||
|
{
|
||||||
|
switch (m_hittype)
|
||||||
|
{
|
||||||
|
case 0: kaneko_hit_type0_w(space,offset,data, mem_mask); break;
|
||||||
|
case 1: kaneko_hit_type1_w(space,offset,data, mem_mask); break;
|
||||||
|
case 2: kaneko_hit_type2_w(space,offset,data, mem_mask); break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fatalerror("kaneko_hit_r called, but m_hittype not set\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
TYPE 0
|
||||||
|
galpanica
|
||||||
|
sandscrp
|
||||||
|
bonkadv
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
READ16_MEMBER(kaneko_hit_device::kaneko_hit_type0_r)
|
||||||
|
{
|
||||||
|
calc1_hit_t &hit = m_hit;
|
||||||
|
UINT16 data = 0;
|
||||||
|
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
case 0x00/2: // watchdog
|
||||||
|
machine().watchdog_reset();
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case 0x02/2: // unknown (yet!), used by *MANY* games !!!
|
||||||
|
//popmessage("unknown collision reg");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x04/2: // similar to the hit detection from SuperNova, but much simpler
|
||||||
|
|
||||||
|
// X Absolute Collision
|
||||||
|
if (hit.x1p > hit.x2p) data |= 0x0200;
|
||||||
|
else if (hit.x1p == hit.x2p) data |= 0x0400;
|
||||||
|
else if (hit.x1p < hit.x2p) data |= 0x0800;
|
||||||
|
|
||||||
|
// Y Absolute Collision
|
||||||
|
if (hit.y1p > hit.y2p) data |= 0x2000;
|
||||||
|
else if (hit.y1p == hit.y2p) data |= 0x4000;
|
||||||
|
else if (hit.y1p < hit.y2p) data |= 0x8000;
|
||||||
|
|
||||||
|
// XY Overlap Collision
|
||||||
|
hit.x12 = (hit.x1p) - (hit.x2p + hit.x2s);
|
||||||
|
hit.y12 = (hit.y1p) - (hit.y2p + hit.y2s);
|
||||||
|
hit.x21 = (hit.x1p + hit.x1s) - (hit.x2p);
|
||||||
|
hit.y21 = (hit.y1p + hit.y1s) - (hit.y2p);
|
||||||
|
|
||||||
|
if ((hit.x12 < 0) && (hit.y12 < 0) &&
|
||||||
|
(hit.x21 >= 0) && (hit.y21 >= 0))
|
||||||
|
data |= 0x0001;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
case 0x10/2:
|
||||||
|
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) >> 16);
|
||||||
|
case 0x12/2:
|
||||||
|
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) & 0xffff);
|
||||||
|
|
||||||
|
case 0x14/2:
|
||||||
|
return (machine().rand() & 0xffff);
|
||||||
|
|
||||||
|
default:
|
||||||
|
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_type0_w)
|
||||||
|
{
|
||||||
|
calc1_hit_t &hit = m_hit;
|
||||||
|
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
// p is position, s is size
|
||||||
|
case 0x00/2: hit.x1p = data; break;
|
||||||
|
case 0x02/2: hit.x1s = data; break;
|
||||||
|
case 0x04/2: hit.y1p = data; break;
|
||||||
|
case 0x06/2: hit.y1s = data; break;
|
||||||
|
case 0x08/2: hit.x2p = data; break;
|
||||||
|
case 0x0a/2: hit.x2s = data; break;
|
||||||
|
case 0x0c/2: hit.y2p = data; break;
|
||||||
|
case 0x0e/2: hit.y2s = data; break;
|
||||||
|
case 0x10/2: hit.mult_a = data; break;
|
||||||
|
case 0x12/2: hit.mult_b = data; break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
TYPE 1
|
||||||
|
shogwarr
|
||||||
|
bloorwar
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
READ16_MEMBER(kaneko_hit_device::kaneko_hit_type1_r)
|
||||||
|
{
|
||||||
|
calc1_hit_t &hit = m_hit;
|
||||||
|
UINT16 data = 0;
|
||||||
|
INT16 x_coll, y_coll;
|
||||||
|
|
||||||
|
|
||||||
|
x_coll = calc_compute_x(hit);
|
||||||
|
y_coll = calc_compute_y(hit);
|
||||||
|
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
case 0x00/2: // X distance
|
||||||
|
return x_coll;
|
||||||
|
|
||||||
|
case 0x02/2: // Y distance
|
||||||
|
return y_coll;
|
||||||
|
|
||||||
|
case 0x04/2: // similar to the hit detection from SuperNova, but much simpler
|
||||||
|
|
||||||
|
// 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2
|
||||||
|
if (hit.y1p > hit.y2p) data |= 0x2000;
|
||||||
|
else if (hit.y1p == hit.y2p) data |= 0x4000;
|
||||||
|
else if (hit.y1p < hit.y2p) data |= 0x8000;
|
||||||
|
if (y_coll<0) data |= 0x1000;
|
||||||
|
|
||||||
|
// 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2
|
||||||
|
if (hit.x1p > hit.x2p) data |= 0x0200;
|
||||||
|
else if (hit.x1p == hit.x2p) data |= 0x0400;
|
||||||
|
else if (hit.x1p < hit.x2p) data |= 0x0800;
|
||||||
|
if (x_coll<0) data |= 0x0100;
|
||||||
|
|
||||||
|
// 2nd nibble: always set to 4
|
||||||
|
data |= 0x0040;
|
||||||
|
|
||||||
|
// 1st nibble: XY Overlap Collision -> possible values = 0,2,4,f
|
||||||
|
if (x_coll>=0) data |= 0x0004;
|
||||||
|
if (y_coll>=0) data |= 0x0002;
|
||||||
|
if ((x_coll>=0)&&(y_coll>=0)) data |= 0x000F;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
case 0x14/2:
|
||||||
|
return (machine().rand() & 0xffff);
|
||||||
|
|
||||||
|
case 0x20/2: return hit.x1p;
|
||||||
|
case 0x22/2: return hit.x1s;
|
||||||
|
case 0x24/2: return hit.y1p;
|
||||||
|
case 0x26/2: return hit.y1s;
|
||||||
|
|
||||||
|
case 0x2c/2: return hit.x2p;
|
||||||
|
case 0x2e/2: return hit.x2s;
|
||||||
|
case 0x30/2: return hit.y2p;
|
||||||
|
case 0x32/2: return hit.y2s;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_type1_w)
|
||||||
|
{
|
||||||
|
calc1_hit_t &hit = m_hit;
|
||||||
|
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
// p is position, s is size
|
||||||
|
case 0x20/2: hit.x1p = data; break;
|
||||||
|
case 0x22/2: hit.x1s = data; break;
|
||||||
|
case 0x24/2: hit.y1p = data; break;
|
||||||
|
case 0x26/2: hit.y1s = data; break;
|
||||||
|
|
||||||
|
case 0x2c/2: hit.x2p = data; break;
|
||||||
|
case 0x2e/2: hit.x2s = data; break;
|
||||||
|
case 0x30/2: hit.y2p = data; break;
|
||||||
|
case 0x32/2: hit.y2s = data; break;
|
||||||
|
|
||||||
|
// this register is set to zero before any computation,
|
||||||
|
// but it has no effect on inputs or result registers
|
||||||
|
case 0x38/2: break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x\n",cpu_get_pc(&space.device()),offset<<1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
collision detection: absolute "distance", negative if no overlap
|
||||||
|
[one inside other] | [ normal overlap ] | [ no overlap ]
|
||||||
|
rect1 <--------------> | <-----------> | <--->
|
||||||
|
rect2 <-----> | <-----------> | <--->
|
||||||
|
result <----------> | <--------> | <---->
|
||||||
|
*/
|
||||||
|
|
||||||
|
INT16 kaneko_hit_device::calc_compute_x(calc1_hit_t &hit)
|
||||||
|
{
|
||||||
|
INT16 x_coll;
|
||||||
|
|
||||||
|
// X distance
|
||||||
|
if ((hit.x2p >= hit.x1p) && (hit.x2p < (hit.x1p + hit.x1s))) // x2p inside x1
|
||||||
|
x_coll = (hit.x1s - (hit.x2p - hit.x1p));
|
||||||
|
else if ((hit.x1p >= hit.x2p) && (hit.x1p < (hit.x2p + hit.x2s))) // x1p inside x2
|
||||||
|
x_coll = (hit.x2s - (hit.x1p - hit.x2p));
|
||||||
|
else // normal/no overlap
|
||||||
|
x_coll = ((hit.x1s + hit.x2s)/2) - abs((hit.x1p + hit.x1s/2) - (hit.x2p + hit.x2s/2));
|
||||||
|
|
||||||
|
return x_coll;
|
||||||
|
}
|
||||||
|
|
||||||
|
INT16 kaneko_hit_device::calc_compute_y(calc1_hit_t &hit)
|
||||||
|
{
|
||||||
|
INT16 y_coll;
|
||||||
|
|
||||||
|
// Y distance
|
||||||
|
if ((hit.y2p >= hit.y1p) && (hit.y2p < (hit.y1p + hit.y1s))) // y2p inside y1
|
||||||
|
y_coll = (hit.y1s - (hit.y2p - hit.y1p));
|
||||||
|
else if ((hit.y1p >= hit.y2p) && (hit.y1p < (hit.y2p + hit.y2s))) // y1p inside y2
|
||||||
|
y_coll = (hit.y2s - (hit.y1p - hit.y2p));
|
||||||
|
else // normal/no overlap
|
||||||
|
y_coll = ((hit.y1s + hit.y2s)/2) - abs((hit.y1p + hit.y1s/2) - (hit.y2p + hit.y2s/2));
|
||||||
|
|
||||||
|
return y_coll;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
TYPE 2
|
||||||
|
brapboys
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
WRITE16_MEMBER(kaneko_hit_device::kaneko_hit_type2_w)
|
||||||
|
{
|
||||||
|
calc3_hit_t &hit3 = m_hit3;
|
||||||
|
int idx=offset*4;
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
// p is position, s is size
|
||||||
|
case 0x00:
|
||||||
|
case 0x28:
|
||||||
|
|
||||||
|
hit3.x1po = data; break;
|
||||||
|
|
||||||
|
case 0x04:
|
||||||
|
case 0x2c:
|
||||||
|
hit3.x1so = data; break;
|
||||||
|
|
||||||
|
case 0x08:
|
||||||
|
case 0x30:
|
||||||
|
hit3.y1po = data; break;
|
||||||
|
|
||||||
|
case 0x0c:
|
||||||
|
case 0x34:
|
||||||
|
hit3.y1so = data; break;
|
||||||
|
|
||||||
|
case 0x10:
|
||||||
|
case 0x58:
|
||||||
|
hit3.x2po = data; break;
|
||||||
|
|
||||||
|
case 0x14:
|
||||||
|
case 0x5c:
|
||||||
|
hit3.x2so = data; break;
|
||||||
|
|
||||||
|
case 0x18:
|
||||||
|
case 0x60:
|
||||||
|
hit3.y2po = data; break;
|
||||||
|
|
||||||
|
case 0x1c:
|
||||||
|
case 0x64:
|
||||||
|
hit3.y2so = data; break;
|
||||||
|
|
||||||
|
case 0x38:
|
||||||
|
case 0x50:
|
||||||
|
hit3.z1po = data; break;
|
||||||
|
case 0x3c:
|
||||||
|
case 0x54:
|
||||||
|
hit3.z1so = data; break;
|
||||||
|
|
||||||
|
case 0x20:
|
||||||
|
case 0x68:
|
||||||
|
hit3.z2po = data; break;
|
||||||
|
|
||||||
|
case 0x24:
|
||||||
|
case 0x6c:
|
||||||
|
hit3.z2so = data; break;
|
||||||
|
|
||||||
|
case 0x70:
|
||||||
|
hit3.mode=data;break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logerror("CPU #0 PC %06x: warning - write unmapped hit address %06x [ %06x] = %06x\n",cpu_get_pc(&space.device()),offset<<1, idx, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
type2_recalc_collisions(hit3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
READ16_MEMBER(kaneko_hit_device::kaneko_hit_type2_r)
|
||||||
|
{
|
||||||
|
calc3_hit_t &hit3 = m_hit3;
|
||||||
|
int idx=offset*4;
|
||||||
|
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0x00: // X distance
|
||||||
|
case 0x10:
|
||||||
|
return hit3.x_coll;
|
||||||
|
|
||||||
|
case 0x04: // Y distance
|
||||||
|
case 0x14:
|
||||||
|
return hit3.y_coll;
|
||||||
|
|
||||||
|
case 0x18: // Z distance
|
||||||
|
return hit3.z_coll;
|
||||||
|
|
||||||
|
case 0x08:
|
||||||
|
case 0x1c:
|
||||||
|
|
||||||
|
return hit3.flags;
|
||||||
|
|
||||||
|
case 0x28:
|
||||||
|
return (machine().rand() & 0xffff);
|
||||||
|
|
||||||
|
case 0x40: return hit3.x1po;
|
||||||
|
case 0x44: return hit3.x1so;
|
||||||
|
case 0x48: return hit3.y1po;
|
||||||
|
case 0x4c: return hit3.y1so;
|
||||||
|
case 0x50: return hit3.z1po;
|
||||||
|
case 0x54: return hit3.z1so;
|
||||||
|
|
||||||
|
case 0x58: return hit3.x2po;
|
||||||
|
case 0x5c: return hit3.x2so;
|
||||||
|
case 0x60: return hit3.y2po;
|
||||||
|
case 0x64: return hit3.y2so;
|
||||||
|
case 0x68: return hit3.z2po;
|
||||||
|
case 0x6c: return hit3.z2so;
|
||||||
|
|
||||||
|
case 0x80: return hit3.x1tox2;
|
||||||
|
case 0x84: return hit3.y1toy2;
|
||||||
|
case 0x88: return hit3.z1toz2;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logerror("CPU #0 PC %06x: warning - read unmapped calc address %06x [ %06x]\n",cpu_get_pc(&space.device()),offset<<1, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calculate simple intersection of two segments
|
||||||
|
|
||||||
|
int kaneko_hit_device::type2_calc_compute(int x1, int w1, int x2, int w2)
|
||||||
|
{
|
||||||
|
int dist;
|
||||||
|
|
||||||
|
if(x2>=x1 && x2+w2<=(x1+w1))
|
||||||
|
{
|
||||||
|
//x2 inside x1
|
||||||
|
dist=w2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(x1>=x2 && x1+w1<=(x2+w2))
|
||||||
|
{
|
||||||
|
//x1 inside x2
|
||||||
|
dist=w1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(x2<x1)
|
||||||
|
{
|
||||||
|
//swap
|
||||||
|
int tmp=x1;
|
||||||
|
x1=x2;
|
||||||
|
x2=tmp;
|
||||||
|
tmp=w1;
|
||||||
|
w1=w2;
|
||||||
|
w2=tmp;
|
||||||
|
}
|
||||||
|
dist=x1+w1-x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dist;
|
||||||
|
}
|
||||||
|
|
||||||
|
//calc segment coordinates
|
||||||
|
|
||||||
|
void kaneko_hit_device::type2_calc_org(int mode, int x0, int s0, int* x1, int* s1)
|
||||||
|
{
|
||||||
|
switch(mode)
|
||||||
|
{
|
||||||
|
case 0: *x1=x0; *s1=s0; break;
|
||||||
|
case 1: *x1=x0-s0/2; *s1=s0; break;
|
||||||
|
case 2: *x1=x0-s0; *s1=s0; break;
|
||||||
|
case 3: *x1=x0-s0; *s1=2*s0; break;
|
||||||
|
}
|
||||||
|
//x1 is the left most coord, s1 = width
|
||||||
|
}
|
||||||
|
|
||||||
|
void kaneko_hit_device::type2_recalc_collisions(calc3_hit_t &hit3)
|
||||||
|
{
|
||||||
|
//calculate positions and sizes
|
||||||
|
|
||||||
|
int mode=hit3.mode;
|
||||||
|
|
||||||
|
hit3.flags=0;
|
||||||
|
|
||||||
|
type2_calc_org((mode>>0)&3, hit3.x1po, hit3.x1so, &hit3.x1p, &hit3.x1s);
|
||||||
|
type2_calc_org((mode>>2)&3, hit3.y1po, hit3.y1so, &hit3.y1p, &hit3.y1s);
|
||||||
|
type2_calc_org((mode>>4)&3, hit3.z1po, hit3.z1so, &hit3.z1p, &hit3.z1s);
|
||||||
|
|
||||||
|
type2_calc_org((mode>>8)&3, hit3.x2po, hit3.x2so, &hit3.x2p, &hit3.x2s);
|
||||||
|
type2_calc_org((mode>>10)&3, hit3.y2po, hit3.y2so, &hit3.y2p, &hit3.y2s);
|
||||||
|
type2_calc_org((mode>>12)&3, hit3.z2po, hit3.z2so, &hit3.z2p, &hit3.z2s);
|
||||||
|
|
||||||
|
|
||||||
|
hit3.x1tox2=abs(hit3.x2po-hit3.x1po);
|
||||||
|
hit3.y1toy2=abs(hit3.y2po-hit3.y1po);
|
||||||
|
hit3.z1toz2=abs(hit3.z2po-hit3.z1po);
|
||||||
|
|
||||||
|
|
||||||
|
hit3.x_coll = type2_calc_compute(hit3.x1p, hit3.x1s, hit3.x2p, hit3.x2s);
|
||||||
|
hit3.y_coll = type2_calc_compute(hit3.y1p, hit3.y1s, hit3.y2p, hit3.y2s);
|
||||||
|
hit3.z_coll = type2_calc_compute(hit3.z1p, hit3.z1s, hit3.z2p, hit3.z2s);
|
||||||
|
|
||||||
|
|
||||||
|
// 4th nibble: Y Absolute Collision -> possible values = 9,8,4,3,2
|
||||||
|
if (hit3.y1p > hit3.y2p) hit3.flags |= 0x2000;
|
||||||
|
else if (hit3.y1p == hit3.y2p) hit3.flags |= 0x4000;
|
||||||
|
else if (hit3.y1p < hit3.y2p) hit3.flags |= 0x8000;
|
||||||
|
if (hit3.y_coll<0) hit3.flags |= 0x1000;
|
||||||
|
|
||||||
|
// 3rd nibble: X Absolute Collision -> possible values = 9,8,4,3,2
|
||||||
|
if (hit3.x1p > hit3.x2p) hit3.flags |= 0x0200;
|
||||||
|
else if (hit3.x1p == hit3.x2p) hit3.flags |= 0x0400;
|
||||||
|
else if (hit3.x1p < hit3.x2p) hit3.flags |= 0x0800;
|
||||||
|
if (hit3.x_coll<0) hit3.flags |= 0x0100;
|
||||||
|
|
||||||
|
// 2nd nibble: Z Absolute Collision -> possible values = 9,8,4,3,2
|
||||||
|
if (hit3.z1p > hit3.z2p) hit3.flags |= 0x0020;
|
||||||
|
else if (hit3.z1p == hit3.z2p) hit3.flags |= 0x0040;
|
||||||
|
else if (hit3.z1p < hit3.z2p) hit3.flags |= 0x0080;
|
||||||
|
if (hit3.z_coll<0) hit3.flags |= 0x0010;
|
||||||
|
|
||||||
|
// 1st nibble: XYZ Overlap Collision
|
||||||
|
if ((hit3.x_coll>=0)&&(hit3.y_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0008;
|
||||||
|
if ((hit3.x_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0004;
|
||||||
|
if ((hit3.y_coll>=0)&&(hit3.z_coll>=0)) hit3.flags |= 0x0002;
|
||||||
|
if ((hit3.x_coll>=0)&&(hit3.y_coll>=0)) hit3.flags |= 0x0001;
|
||||||
|
}
|
||||||
|
|
1138
src/mame/mame.lst
1138
src/mame/mame.lst
File diff suppressed because it is too large
Load Diff
@ -848,6 +848,7 @@ $(MAMEOBJ)/kaneko.a: \
|
|||||||
$(DRIVERS)/kaneko16.o $(MACHINE)/kaneko16.o $(VIDEO)/kaneko16.o \
|
$(DRIVERS)/kaneko16.o $(MACHINE)/kaneko16.o $(VIDEO)/kaneko16.o \
|
||||||
$(VIDEO)/kaneko_tmap.o \
|
$(VIDEO)/kaneko_tmap.o \
|
||||||
$(VIDEO)/kaneko_spr.o \
|
$(VIDEO)/kaneko_spr.o \
|
||||||
|
$(MACHINE)/kaneko_hit.o \
|
||||||
$(DRIVERS)/sandscrp.o \
|
$(DRIVERS)/sandscrp.o \
|
||||||
$(DRIVERS)/suprnova.o $(VIDEO)/suprnova.o \
|
$(DRIVERS)/suprnova.o $(VIDEO)/suprnova.o \
|
||||||
$(VIDEO)/sknsspr.o \
|
$(VIDEO)/sknsspr.o \
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/* Kaneko Sprites */
|
/* Kaneko Sprites */
|
||||||
|
|
||||||
/* berlwall, blazeon etc. */
|
/* berlwall, blazeon etc. */
|
||||||
|
Loading…
Reference in New Issue
Block a user