static INPUT_PORTS_START( oldsplus )
	PORT_INCLUDE ( pgm )

	PORT_MODIFY("Region")	/* Region - supplied by protection device */
	PORT_DIPNAME( 0x000f, 0x0001, DEF_STR( Region ) )
	PORT_DIPSETTING(      0x0001, "China" )
	PORT_DIPSETTING(      0x0002, DEF_STR( Japan ) )
	PORT_DIPSETTING(      0x0003, "Korea" )
	PORT_DIPSETTING(      0x0004, "Hong Kong" )
	PORT_DIPSETTING(      0x0005, DEF_STR( World ) )
	PORT_DIPSETTING(      0x0006, "Taiwan" )
INPUT_PORTS_END


// -----------------------------------------------------------------我是分隔线------------------------------------------------------------------


ROM_START( oldsplus )

	// ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
	// ROM_LOAD( "oldsplus_igs027a.bin", 0x000000, 0x04000, NO_DUMP )

	ROM_REGION( 0x1800000, "ics", 0 ) /* Samples - (8 bit mono 11025Hz) - */					//这里必须把REGION改高，不知为何（可能是新的ICS2115代码有问题），第7关时程序会访问0xCXXXXX处，导致MAME退出
ROM_END

// -----------------------------------------------------------------我是分隔线------------------------------------------------------------------


static void oldsplus_latch_init( running_machine &machine )
{
	pgm_state *state = machine.driver_data<pgm_state>();

	state->m_oldsplus_key = 0;
	state->m_oldsplus_int[0] = 0;
	state->m_oldsplus_int[1] = 0;
	state->m_oldsplus_val = 0;
	memset(state->m_oldsplus_ram, 0, 0x100);
	memset(state->m_oldsplus_regs, 0, 0x100);

	state_save_register_global(machine, state->m_oldsplus_key);
	state_save_register_global(machine, state->m_oldsplus_val);
	state_save_register_global_array(machine, state->m_oldsplus_int);
	state_save_register_global_array(machine, state->m_oldsplus_ram);
	state_save_register_global_array(machine, state->m_oldsplus_regs);
}

static DRIVER_INIT( oldsplus )
{
	pgm_basic_init(machine);
	pgm_oldsplus_decrypt(machine);
	oldsplus_latch_init(machine);

	machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x500000, 0x500003, FUNC(oldsplus_r), FUNC(oldsplus_w));
	machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x4f0000, 0x4fffff, FUNC(oldsplus_protram_r));
}

// -----------------------------------------------------------------我是分隔线------------------------------------------------------------------


GAME( 2004, oldsplus,     pgm,       pgm,     oldsplus,     oldsplus,   ROT0,   "IGS", "Oriental Legend Special Plus / Xi You Shi E Zhuan Super Plus (ver. 205)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) /* need internal rom of IGS027A */
