Skip to content

Commit

Permalink
use a handcrafted c-chip rom for Rainbow Islands Extra, pending a rea…
Browse files Browse the repository at this point in the history
…l dump, allows removal of simulation code and general cleanups. (#3338)

also made rainbow islands extra a parent, since it has it's own game code, own c-chip and is generally considered a semi-sequel rather than a bugfix / revision of the original game.

(best I can tell behavior matches the differences between original and extra that were present in the simulation at least, but obviously the real chip could be hiding more secrets)
  • Loading branch information
David Haywood authored and ajrhacker committed Mar 17, 2018
1 parent 87f31c6 commit 13cbded
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 930 deletions.
1 change: 0 additions & 1 deletion scripts/target/mame/arcade.lua
Expand Up @@ -3775,7 +3775,6 @@ files {
MAME_DIR .. "src/mame/video/qix.cpp",
MAME_DIR .. "src/mame/drivers/rbisland.cpp",
MAME_DIR .. "src/mame/includes/rbisland.h",
MAME_DIR .. "src/mame/machine/rbisland.cpp",
MAME_DIR .. "src/mame/video/rbisland.cpp",
MAME_DIR .. "src/mame/drivers/rastan.cpp",
MAME_DIR .. "src/mame/includes/rastan.h",
Expand Down
126 changes: 48 additions & 78 deletions src/mame/drivers/rbisland.cpp
Expand Up @@ -346,7 +346,7 @@ WRITE16_MEMBER(rbisland_state::jumping_sound_w)
MEMORY STRUCTURES
***************************************************************************/

void rbisland_state::rbisland_base_map(address_map &map)
void rbisland_state::rbisland_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x10c000, 0x10ffff).ram(); /* main RAM */
Expand All @@ -359,28 +359,16 @@ void rbisland_state::rbisland_base_map(address_map &map)
map(0x3e0000, 0x3e0001).nopr();
map(0x3e0001, 0x3e0001).w("ciu", FUNC(pc060ha_device::master_port_w));
map(0x3e0003, 0x3e0003).rw("ciu", FUNC(pc060ha_device::master_comm_r), FUNC(pc060ha_device::master_comm_w));
// c-chip goes here
map(0x800000, 0x8007ff).rw(m_cchip, FUNC(taito_cchip_device::mem68_r), FUNC(taito_cchip_device::mem68_w)).umask16(0x00ff);
map(0x800800, 0x800fff).rw(m_cchip, FUNC(taito_cchip_device::asic_r), FUNC(taito_cchip_device::asic68_w)).umask16(0x00ff);
map(0xc00000, 0xc0ffff).rw(m_pc080sn, FUNC(pc080sn_device::word_r), FUNC(pc080sn_device::word_w));
map(0xc20000, 0xc20003).w(m_pc080sn, FUNC(pc080sn_device::yscroll_word_w));
map(0xc40000, 0xc40003).w(m_pc080sn, FUNC(pc080sn_device::xscroll_word_w));
map(0xc50000, 0xc50003).w(m_pc080sn, FUNC(pc080sn_device::ctrl_word_w));
map(0xd00000, 0xd03fff).rw(m_pc090oj, FUNC(pc090oj_device::word_r), FUNC(pc090oj_device::word_w)); /* sprite ram + other stuff */
}

void rbisland_state::rbisland_sim_map(address_map &map)
{
rbisland_base_map(map);
map(0x800000, 0x8007ff).rw(this, FUNC(rbisland_state::rbisland_cchip_ram_r), FUNC(rbisland_state::rbisland_cchip_ram_w));
map(0x800802, 0x800803).rw(this, FUNC(rbisland_state::rbisland_cchip_ctrl_r), FUNC(rbisland_state::rbisland_cchip_ctrl_w));
map(0x800c00, 0x800c01).w(this, FUNC(rbisland_state::rbisland_cchip_bank_w));
}

void rbisland_state::rbisland_emu_map(address_map &map)
{
rbisland_base_map(map);
map(0x800000, 0x8007ff).rw(m_cchip, FUNC(taito_cchip_device::mem68_r), FUNC(taito_cchip_device::mem68_w)).umask16(0x00ff);
map(0x800800, 0x800fff).rw(m_cchip, FUNC(taito_cchip_device::asic_r), FUNC(taito_cchip_device::asic68_w)).umask16(0x00ff);
}

void rbisland_state::jumping_map(address_map &map)
{
Expand Down Expand Up @@ -534,17 +522,10 @@ static INPUT_PORTS_START( rbisland )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // 0x08 and 0x80 are swapped due to read through ADC
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
INPUT_PORTS_END

static INPUT_PORTS_START( rbisland_emu )
PORT_INCLUDE(rbisland)

PORT_MODIFY("80000D")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
INPUT_PORTS_END

Expand Down Expand Up @@ -652,16 +633,45 @@ void rbisland_state::machine_start()
{
}

MACHINE_CONFIG_START(rbisland_state::rbisland_base)
INTERRUPT_GEN_MEMBER(rbisland_state::interrupt)
{
m_maincpu->set_input_line(4, HOLD_LINE);
m_cchip->ext_interrupt(ASSERT_LINE);
m_cchip_irq_clear->adjust(attotime::zero);
}

TIMER_DEVICE_CALLBACK_MEMBER(rbisland_state::cchip_irq_clear_cb)
{
m_cchip->ext_interrupt(CLEAR_LINE);
}

WRITE8_MEMBER(rbisland_state::counters_w)
{
machine().bookkeeping().coin_lockout_w(1, data & 0x80);
machine().bookkeeping().coin_lockout_w(0, data & 0x40);
machine().bookkeeping().coin_counter_w(1, data & 0x20);
machine().bookkeeping().coin_counter_w(0, data & 0x10);
}

MACHINE_CONFIG_START(rbisland_state::rbisland)

/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, XTAL(16'000'000)/2) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(rbisland_sim_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", rbisland_state, irq4_line_hold)
MCFG_CPU_PROGRAM_MAP(rbisland_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", rbisland_state, interrupt)

MCFG_CPU_ADD("audiocpu", Z80, XTAL(16'000'000)/4) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(rbisland_sound_map)

MCFG_TAITO_CCHIP_ADD("cchip", XTAL(12'000'000)) /* 12MHz OSC next to C-Chip */
MCFG_CCHIP_IN_PORTA_CB(IOPORT("800007"))
MCFG_CCHIP_IN_PORTB_CB(IOPORT("800009"))
MCFG_CCHIP_IN_PORTC_CB(IOPORT("80000B"))
MCFG_CCHIP_IN_PORTAD_CB(IOPORT("80000D"))
MCFG_CCHIP_OUT_PORTB_CB(WRITE8(rbisland_state, couters_w))

MCFG_TIMER_DRIVER_ADD("cchip_irq_clear", rbisland_state, cchip_irq_clear_cb)

MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* 10 CPU slices per frame - enough for the sound CPU to read all commands */

/* video hardware */
Expand Down Expand Up @@ -699,45 +709,6 @@ MACHINE_CONFIG_START(rbisland_state::rbisland_base)
MCFG_PC060HA_SLAVE_CPU("audiocpu")
MACHINE_CONFIG_END

INTERRUPT_GEN_MEMBER(rbisland_state::interrupt)
{
m_maincpu->set_input_line(4, HOLD_LINE);
m_cchip->ext_interrupt(ASSERT_LINE);
m_cchip_irq_clear->adjust(attotime::zero);
}

TIMER_DEVICE_CALLBACK_MEMBER(rbisland_state::cchip_irq_clear_cb)
{
m_cchip->ext_interrupt(CLEAR_LINE);
}

WRITE8_MEMBER(rbisland_state::counters_w)
{
machine().bookkeeping().coin_lockout_w(1, data & 0x80);
machine().bookkeeping().coin_lockout_w(0, data & 0x40);
machine().bookkeeping().coin_counter_w(1, data & 0x20);
machine().bookkeeping().coin_counter_w(0, data & 0x10);
}

MACHINE_CONFIG_START(rbisland_state::rbisland_emu)
rbisland_base(config);

MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(rbisland_emu_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", rbisland_state, interrupt)

MCFG_TAITO_CCHIP_ADD("cchip", XTAL(12'000'000)) /* 12MHz OSC next to C-Chip */
MCFG_CCHIP_IN_PORTA_CB(IOPORT("800007"))
MCFG_CCHIP_IN_PORTB_CB(IOPORT("800009"))
MCFG_CCHIP_IN_PORTC_CB(IOPORT("80000B"))
MCFG_CCHIP_IN_PORTAD_CB(IOPORT("80000D"))
MCFG_CCHIP_OUT_PORTB_CB(WRITE8(rbisland_state, counters_w))

MCFG_TIMER_DRIVER_ADD("cchip_irq_clear", rbisland_state, cchip_irq_clear_cb)
MACHINE_CONFIG_END




/* Jumping: The PCB has 2 Xtals, 18.432MHz and 24MHz */
MACHINE_CONFIG_START(rbisland_state::jumping)
Expand Down Expand Up @@ -855,7 +826,12 @@ ROM_START( rbislande )
ROM_LOAD16_BYTE( "b22-04.24", 0x40001, 0x20000, CRC(91625e7f) SHA1(765afd973d9b82bb496b04beca284bf2769d6e6f) )

ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_b39-05.53", 0x0000, 0x2000, NO_DUMP )
/* This is handcrafted using data changes from the old simulation code and a lookup table to swizzle the world numbers
There are calls at 01BF / 01E1 that also read the world number, but appear to expect it to not get swizzled so
these have not been patched. This should match the old simulation, but will possibly not 100% match hardware
behavior and is definitely not the structure the real ROM would have, so is marked as BAD_DUMP.
*/
ROM_LOAD( "fake_cchip_b39-05.53", 0x0000, 0x2000, BAD_DUMP CRC(935d805a) SHA1(e8b68be266db11542763fade49e53f46463f9462) )

ROM_REGION( 0x1c000, "audiocpu", 0 )
ROM_LOAD( "b22-14.43", 0x00000, 0x4000, CRC(113c1a5b) SHA1(effa2adf54a6be78b2d4baf3a47529342fb0d895) )
Expand Down Expand Up @@ -1017,25 +993,19 @@ DRIVER_INIT_MEMBER(rbisland_state,rbisland)
membank("bank1")->configure_entries(0, 4, &ROM[0xc000], 0x4000);
}

DRIVER_INIT_MEMBER(rbisland_state,rbislande)
{
DRIVER_INIT_CALL(rbisland);
rbisland_cchip_init(1);
}

DRIVER_INIT_MEMBER(rbisland_state,jumping)
{
m_jumping_latch = 0;
save_item(NAME(m_jumping_latch));
}


GAME( 1987, rbisland, 0, rbisland_emu, rbisland_emu, rbisland_state, rbisland, ROT0, "Taito Corporation", "Rainbow Islands (new version)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, rbislando, rbisland, rbisland_emu, rbisland_emu, rbisland_state, rbisland, ROT0, "Taito Corporation", "Rainbow Islands (old version)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, rbisland, 0, rbisland, rbisland, rbisland_state, rbisland, ROT0, "Taito Corporation", "Rainbow Islands (new version)", MACHINE_SUPPORTS_SAVE )
GAME( 1987, rbislando, rbisland, rbisland, rbisland, rbisland_state, rbisland, ROT0, "Taito Corporation", "Rainbow Islands (old version)", MACHINE_SUPPORTS_SAVE )

GAME( 1989, jumping, rbisland, jumping, jumping, rbisland_state, jumping, ROT0, "bootleg", "Jumping (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, jumpinga, rbisland, jumping, jumping, rbisland_state, jumping, ROT0, "bootleg (Seyutu)", "Jumping (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, jumpingi, rbisland, jumpingi, jumping, rbisland_state, jumping, ROT0, "bootleg (Seyutu)", "Jumping (set 3, Imnoe PCB)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, jumping, rbisland, jumping, jumping, rbisland_state, jumping, ROT0, "bootleg", "Jumping (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, jumpinga, rbisland, jumping, jumping, rbisland_state, jumping, ROT0, "bootleg (Seyutu)", "Jumping (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1988, jumpingi, rbisland, jumpingi, jumping, rbisland_state, jumping, ROT0, "bootleg (Seyutu)", "Jumping (set 3, Imnoe PCB)", MACHINE_SUPPORTS_SAVE )

GAME( 1988, rbislande, rbisland, rbisland_base, rbisland, rbisland_state, rbislande, ROT0, "Taito Corporation", "Rainbow Islands - Extra Version", MACHINE_SUPPORTS_SAVE )
GAME( 1988, rbislande, 0, rbisland, rbisland, rbisland_state, rbisland, ROT0, "Taito Corporation", "Rainbow Islands - Extra Version", MACHINE_SUPPORTS_SAVE )

18 changes: 2 additions & 16 deletions src/mame/includes/rbisland.h
Expand Up @@ -46,7 +46,6 @@ class rbisland_state : public driver_device
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(counters_w);
DECLARE_DRIVER_INIT(jumping);
DECLARE_DRIVER_INIT(rbislande);
DECLARE_DRIVER_INIT(rbisland);
virtual void machine_start() override;
DECLARE_VIDEO_START(jumping);
Expand All @@ -57,14 +56,11 @@ class rbisland_state : public driver_device
TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb);

void jumping(machine_config &config);
void rbisland_base(machine_config &config);
void rbisland_emu(machine_config &config);
void rbisland(machine_config &config);
void jumpingi(machine_config &config);
void jumping_map(address_map &map);
void jumping_sound_map(address_map &map);
void rbisland_base_map(address_map &map);
void rbisland_emu_map(address_map &map);
void rbisland_sim_map(address_map &map);
void rbisland_map(address_map &map);
void rbisland_sound_map(address_map &map);

private:
Expand All @@ -78,16 +74,6 @@ class rbisland_state : public driver_device
/* misc */
uint8_t m_jumping_latch;

/* c-chip simulation */
std::unique_ptr<uint8_t[]> m_CRAM[8];
int m_extra_version;
uint8_t m_current_bank;
emu_timer *m_cchip_timer;
void request_round_data( );
void request_world_data( );
void request_goalin_data( );
void rbisland_cchip_init( int version );

/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
Expand Down

0 comments on commit 13cbded

Please sign in to comment.