tnzs.c - use bankdev

This commit is contained in:
David Haywood 2014-10-20 11:03:35 +00:00
parent 784f5b3f8b
commit 0e5fbe4a1c
3 changed files with 79 additions and 70 deletions

View File

@ -744,7 +744,7 @@ WRITE8_MEMBER(tnzs_state::kabukiz_sample_w)
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_READWRITE( tnzs_ramrom_bank_r, tnzs_ramrom_bank_w ) /* ROM + RAM */
AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8)
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8)
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodehigh_r8, spritecodehigh_w8)
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1")
@ -760,7 +760,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cpu0_type2, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_READWRITE( tnzs_ramrom_bank_r, tnzs_ramrom_bank_w ) /* ROM + RAM */
AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8)
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8)
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodehigh_r8, spritecodehigh_w8)
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1")
@ -772,6 +772,7 @@ static ADDRESS_MAP_START( cpu0_type2, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0xf800, 0xfbff) AM_WRITENOP
ADDRESS_MAP_END
static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("subbank")
@ -863,7 +864,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( jpopnics_main_map, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_READWRITE( tnzs_ramrom_bank_r, tnzs_ramrom_bank_w )
AM_RANGE(0x8000, 0xbfff) AM_DEVICE("mainbank", address_map_bank_device, amap8)
AM_RANGE(0xc000, 0xcfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8)
AM_RANGE(0xd000, 0xdfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodehigh_r8, spritecodehigh_w8)
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") /* WORK RAM (shared by the 2 z80's) */
@ -897,6 +898,20 @@ static ADDRESS_MAP_START( jpopnics_sub_map, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r)
ADDRESS_MAP_END
/* RAM/ROM bank that maps at 0x8000-0xbfff on maincpu */
static ADDRESS_MAP_START( mainbank_map, AS_PROGRAM, 8, tnzs_state )
AM_RANGE(0x00000, 0x07fff) AM_RAM // instead of the first two banks of ROM being repeated redundantly the hardware maps RAM here
AM_RANGE(0x08000, 0x1ffff) AM_ROM AM_REGION(":maincpu", 0x8000)
ADDRESS_MAP_END
MACHINE_CONFIG_FRAGMENT( tnzs_mainbank )
MCFG_DEVICE_ADD("mainbank", ADDRESS_MAP_BANK, 0)
MCFG_DEVICE_PROGRAM_MAP(mainbank_map)
MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE)
MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(17)
MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000)
MACHINE_CONFIG_END
#define COMMON_IN2\
PORT_START("IN2")\
@ -1542,6 +1557,8 @@ static MACHINE_CONFIG_START( arknoid2, tnzs_state )
MCFG_CPU_PROGRAM_MAP(sub_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs)
@ -1588,6 +1605,8 @@ static MACHINE_CONFIG_START( drtoppel, tnzs_state )
MCFG_CPU_PROGRAM_MAP(sub_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs)
@ -1636,6 +1655,8 @@ static MACHINE_CONFIG_START( tnzs, tnzs_state )
MCFG_CPU_ADD("mcu", I8742, 12000000/2) /* 400KHz ??? - Main board Crystal is 12MHz */
MCFG_CPU_IO_MAP(i8742_io_map)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs)
@ -1680,6 +1701,8 @@ static MACHINE_CONFIG_START( insectx, tnzs_state )
MCFG_CPU_PROGRAM_MAP(sub_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs)
@ -1724,6 +1747,8 @@ static MACHINE_CONFIG_START( kageki, tnzs_state )
MCFG_CPU_PROGRAM_MAP(kageki_sub_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs)
@ -1780,6 +1805,8 @@ static MACHINE_CONFIG_START( tnzsb, tnzs_state )
MCFG_CPU_PROGRAM_MAP(tnzsb_cpu2_map)
MCFG_CPU_IO_MAP(tnzsb_io_map)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs)
@ -1844,9 +1871,11 @@ static MACHINE_CONFIG_START( jpopnics, tnzs_state )
MCFG_CPU_PROGRAM_MAP(jpopnics_sub_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", tnzs_state, irq0_line_hold)
MCFG_FRAGMENT_ADD(tnzs_mainbank)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_MACHINE_START_OVERRIDE(tnzs_state,jpopnics)
MCFG_MACHINE_START_OVERRIDE(tnzs_state,tnzs_common)
MCFG_MACHINE_RESET_OVERRIDE(tnzs_state,jpopnics)
MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0)
@ -2631,30 +2660,39 @@ ROM_END
// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS
GAME( 1987, plumppop, 0, drtoppel, plumppop, tnzs_state, plumpop, ROT0, "Taito Corporation", "Plump Pop (Japan)", 0 )
GAME( 1987, extrmatn, 0, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation Japan", "Extermination (World)", 0 )
GAME( 1987, extrmatnu, extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito (World Games license)", "Extermination (US)", 0 )
GAME( 1987, extrmatnj, extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", 0 )
GAME( 1987, arknoid2, 0, arknoid2, arknoid2, tnzs_state, arknoid2, ROT270, "Taito Corporation Japan", "Arkanoid - Revenge of DOH (World)", 0 )
GAME( 1987, arknoid2u, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito America Corporation (Romstar license)", "Arkanoid - Revenge of DOH (US)", 0 )
GAME( 1987, arknoid2j, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito Corporation", "Arkanoid - Revenge of DOH (Japan)", 0 )
GAME( 1987, arknoid2b, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "bootleg", "Arkanoid - Revenge of DOH (Japan bootleg)", 0 )
GAME( 1987, drtoppel, 0, drtoppel, drtoppel, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation Japan", "Dr. Toppel's Adventure (World)", 0 ) /* Possible region hack */
GAME( 1987, drtoppelu, drtoppel, drtoppel, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito America Corporation", "Dr. Toppel's Adventure (US)", 0 ) /* Possible region hack */
GAME( 1987, drtoppelj, drtoppel, drtoppel, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation", "Dr. Toppel's Tankentai (Japan)", 0 )
GAME( 1988, kageki, 0, kageki, kageki, tnzs_state, kageki, ROT90, "Kaneko / Taito America Corporation (Romstar license)", "Kageki (US)", 0 )
GAME( 1988, kagekij, kageki, kageki, kagekij, tnzs_state, kageki, ROT90, "Kaneko / Taito Corporation", "Kageki (Japan)", 0 )
GAME( 1992, kagekih, kageki, kageki, kageki, tnzs_state, kageki, ROT90, "hack", "Kageki (hack)", 0 ) // date is hacked at least, might also be a Japan set hacked to show english
GAME( 1988, chukatai, 0, tnzs, chukatai, tnzs_state, chukatai, ROT0, "Taito Corporation Japan", "Chuka Taisen (World)", 0 ) /* Possible region hack */
GAME( 1988, chukataiu, chukatai, tnzs, chukatau, tnzs_state, chukatai, ROT0, "Taito America Corporation", "Chuka Taisen (US)", 0 ) /* Possible region hack */
GAME( 1988, chukataij, chukatai, tnzs, chukatau, tnzs_state, chukatai, ROT0, "Taito Corporation", "Chuka Taisen (Japan)", 0 )
GAME( 1988, tnzs, 0, tnzsb, tnzs, tnzs_state, tnzsb, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", 0 )
GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, tnzs_state, tnzsb, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", 0 )
GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, tnzs_state, tnzs, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", 0 )
GAME( 1988, tnzso, tnzs, tnzs, tnzsop, tnzs_state, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, old version) (older PCB)", 0 )
GAME( 1988, tnzsop, tnzs, tnzs, tnzsop, tnzs_state, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype?) (older PCB)", 0 )
GAME( 1988, kabukiz, 0, kabukiz, kabukiz, tnzs_state, kabukiz, ROT0, "Kaneko / Taito Corporation Japan", "Kabuki-Z (World)", 0 )
GAME( 1988, kabukizj, kabukiz, kabukiz, kabukizj, tnzs_state, kabukiz, ROT0, "Kaneko / Taito Corporation", "Kabuki-Z (Japan)", 0 )
GAME( 1989, insectx, 0, insectx, insectx, tnzs_state, insectx, ROT0, "Taito Corporation Japan", "Insector X (World)", 0 )
GAME( 1989, insectxj, insectx, insectx, insectxj, tnzs_state, insectx, ROT0, "Taito Corporation", "Insector X (Japan)", 0 )
GAME( 1992, jpopnics, 0, jpopnics, jpopnics, driver_device, 0, ROT0, "bootleg (Nics)", "Jumping Pop (Nics, Korean bootleg of Plump Pop)", GAME_IMPERFECT_GRAPHICS )
GAME( 1987, plumppop, 0, drtoppel, plumppop, tnzs_state, plumpop, ROT0, "Taito Corporation", "Plump Pop (Japan)", 0 )
GAME( 1992, jpopnics, 0, jpopnics, jpopnics, driver_device, 0, ROT0, "Nics", "Jumping Pop (Nics, Korean hack of Plump Pop)", GAME_IMPERFECT_GRAPHICS )
GAME( 1987, extrmatn, 0, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation Japan", "Extermination (World)", 0 )
GAME( 1987, extrmatnu, extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito (World Games license)", "Extermination (US)", 0 )
GAME( 1987, extrmatnj, extrmatn, arknoid2, extrmatn, tnzs_state, extrmatn, ROT270, "Taito Corporation", "Extermination (Japan)", 0 )
GAME( 1987, arknoid2, 0, arknoid2, arknoid2, tnzs_state, arknoid2, ROT270, "Taito Corporation Japan", "Arkanoid - Revenge of DOH (World)", 0 )
GAME( 1987, arknoid2u, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito America Corporation (Romstar license)", "Arkanoid - Revenge of DOH (US)", 0 )
GAME( 1987, arknoid2j, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "Taito Corporation", "Arkanoid - Revenge of DOH (Japan)", 0 )
GAME( 1987, arknoid2b, arknoid2, arknoid2, arknid2u, tnzs_state, arknoid2, ROT270, "bootleg", "Arkanoid - Revenge of DOH (Japan bootleg)", 0 )
GAME( 1987, drtoppel, 0, drtoppel, drtoppel, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation Japan", "Dr. Toppel's Adventure (World)", 0 ) /* Possible region hack */
GAME( 1987, drtoppelu, drtoppel, drtoppel, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito America Corporation", "Dr. Toppel's Adventure (US)", 0 ) /* Possible region hack */
GAME( 1987, drtoppelj, drtoppel, drtoppel, drtopplu, tnzs_state, drtoppel, ROT90, "Kaneko / Taito Corporation", "Dr. Toppel's Tankentai (Japan)", 0 )
GAME( 1988, kageki, 0, kageki, kageki, tnzs_state, kageki, ROT90, "Kaneko / Taito America Corporation (Romstar license)", "Kageki (US)", 0 )
GAME( 1988, kagekij, kageki, kageki, kagekij, tnzs_state, kageki, ROT90, "Kaneko / Taito Corporation", "Kageki (Japan)", 0 )
GAME( 1992, kagekih, kageki, kageki, kageki, tnzs_state, kageki, ROT90, "hack", "Kageki (hack)", 0 ) // date is hacked at least, might also be a Japan set hacked to show english
GAME( 1988, chukatai, 0, tnzs, chukatai, tnzs_state, chukatai, ROT0, "Taito Corporation Japan", "Chuka Taisen (World)", 0 ) /* Possible region hack */
GAME( 1988, chukataiu, chukatai, tnzs, chukatau, tnzs_state, chukatai, ROT0, "Taito America Corporation", "Chuka Taisen (US)", 0 ) /* Possible region hack */
GAME( 1988, chukataij, chukatai, tnzs, chukatau, tnzs_state, chukatai, ROT0, "Taito Corporation", "Chuka Taisen (Japan)", 0 )
GAME( 1988, tnzs, 0, tnzsb, tnzs, tnzs_state, tnzsb, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, new version) (newer PCB)", 0 )
GAME( 1988, tnzsj, tnzs, tnzsb, tnzsj, tnzs_state, tnzsb, ROT0, "Taito Corporation", "The NewZealand Story (Japan, new version) (newer PCB)", 0 )
GAME( 1988, tnzsjo, tnzs, tnzs, tnzsjo, tnzs_state, tnzs, ROT0, "Taito Corporation", "The NewZealand Story (Japan, old version) (older PCB)", 0 )
GAME( 1988, tnzso, tnzs, tnzs, tnzsop, tnzs_state, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, old version) (older PCB)", 0 )
GAME( 1988, tnzsop, tnzs, tnzs, tnzsop, tnzs_state, tnzs, ROT0, "Taito Corporation Japan", "The NewZealand Story (World, prototype?) (older PCB)", 0 )
GAME( 1988, kabukiz, 0, kabukiz, kabukiz, tnzs_state, kabukiz, ROT0, "Kaneko / Taito Corporation Japan", "Kabuki-Z (World)", 0 )
GAME( 1988, kabukizj, kabukiz, kabukiz, kabukizj, tnzs_state, kabukiz, ROT0, "Kaneko / Taito Corporation", "Kabuki-Z (Japan)", 0 )
GAME( 1989, insectx, 0, insectx, insectx, tnzs_state, insectx, ROT0, "Taito Corporation Japan", "Insector X (World)", 0 )
GAME( 1989, insectxj, insectx, insectx, insectxj, tnzs_state, insectx, ROT0, "Taito Corporation", "Insector X (Japan)", 0 )

View File

@ -2,6 +2,7 @@
#include "sound/samples.h"
#include "video/seta001.h"
#include "cpu/mcs48/mcs48.h"
#include "machine/bankdev.h"
#define MAX_SAMPLES 0x2f /* max samples */
@ -31,7 +32,9 @@ public:
m_seta001(*this, "spritegen"),
m_dac(*this, "dac"),
m_samples(*this, "samples"),
m_palette(*this, "palette") { }
m_palette(*this, "palette"),
m_mainbank(*this, "mainbank")
{ }
/* video-related */
int m_screenflip;
@ -54,10 +57,8 @@ public:
UINT8 m_mcu_coins_a;
UINT8 m_mcu_coins_b;
UINT8 m_mcu_credits;
int m_bank1;
int m_bank2;
UINT8* m_bankedram;
UINT8* m_ROM;
/* devices */
@ -86,9 +87,6 @@ public:
DECLARE_WRITE8_MEMBER(kabukiz_sound_bank_w);
DECLARE_WRITE8_MEMBER(kabukiz_sample_w);
DECLARE_READ8_MEMBER(tnzs_ramrom_bank_r);
DECLARE_WRITE8_MEMBER(tnzs_ramrom_bank_w);
SAMPLES_START_CB_MEMBER(kageki_init_samples);
DECLARE_DRIVER_INIT(arknoid2);
@ -104,7 +102,7 @@ public:
DECLARE_MACHINE_START(tnzs);
DECLARE_MACHINE_RESET(tnzs);
DECLARE_PALETTE_INIT(arknoid2);
DECLARE_MACHINE_START(jpopnics);
DECLARE_MACHINE_START(tnzs_common);
DECLARE_MACHINE_RESET(jpopnics);
UINT32 screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_tnzs(screen_device &screen, bool state);
@ -119,4 +117,5 @@ public:
optional_device<dac_device> m_dac;
optional_device<samples_device> m_samples;
required_device<palette_device> m_palette;
required_device<address_map_bank_device> m_mainbank;
};

View File

@ -16,31 +16,6 @@
#include "cpu/mcs48/mcs48.h"
#include "includes/tnzs.h"
READ8_MEMBER(tnzs_state::tnzs_ramrom_bank_r)
{
// the first 2 banks would correspond to the fixed section of ROM, since this is
// a waste of time the hardware maps 2 banks of RAM there instead.
if (m_bank1<2)
{
return m_bankedram[m_bank1 * 0x4000 + offset];
}
else
{
return m_ROM[m_bank1 * 0x4000 + offset];
}
}
WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bank_w)
{
if (m_bank1<2)
{
m_bankedram[m_bank1 * 0x4000 + offset] = data;
}
else
{
// illegal write to ROM
}
}
READ8_MEMBER(tnzs_state::mcu_tnzs_r)
@ -668,21 +643,18 @@ void tnzs_state::tnzs_postload()
}
MACHINE_START_MEMBER(tnzs_state,jpopnics)
MACHINE_START_MEMBER(tnzs_state,tnzs_common)
{
UINT8 *SUB = memregion("sub")->base();
m_ROM = memregion("maincpu")->base();
m_bankedram = auto_alloc_array(machine(), UINT8, 0x8000); // 2 banks of 0x4000
membank("subbank")->configure_entries(0, 4, &SUB[0x08000], 0x2000);
membank("subbank")->set_entry(m_bank2);
m_bank1 = 2;
m_bank2 = 0;
m_mainbank->set_bank(2);
save_pointer(NAME(m_bankedram), 0x8000);
save_item(NAME(m_screenflip));
save_item(NAME(m_bank1));
save_item(NAME(m_bank2));
machine().save().register_postload(save_prepost_delegate(FUNC(tnzs_state::tnzs_postload), this));
@ -690,7 +662,7 @@ MACHINE_START_MEMBER(tnzs_state,jpopnics)
MACHINE_START_MEMBER(tnzs_state,tnzs)
{
MACHINE_START_CALL_MEMBER( jpopnics );
MACHINE_START_CALL_MEMBER( tnzs_common );
save_item(NAME(m_kageki_csport_sel));
save_item(NAME(m_input_select));
@ -719,7 +691,7 @@ WRITE8_MEMBER(tnzs_state::tnzs_ramrom_bankswitch_w)
m_subcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
/* bits 0-2 select RAM/ROM bank */
m_bank1 = data & 0x07;
m_mainbank->set_bank(data & 0x07);
}
WRITE8_MEMBER(tnzs_state::tnzs_bankswitch1_w)