From 74c5b5fa9b02996f611948fedc9030ac851f9b02 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Fri, 26 Sep 2014 02:26:12 +0000 Subject: [PATCH] Gundam Wing: Endless Duel updates: [Peter Ferrie] * added additional shared memory block * added protection handlers * corrected reset vector * worked around bad startup Game now boots but doesn't coin up. --- src/mame/drivers/snesb.c | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/mame/drivers/snesb.c b/src/mame/drivers/snesb.c index f9f29747a53..44eb283df16 100644 --- a/src/mame/drivers/snesb.c +++ b/src/mame/drivers/snesb.c @@ -155,11 +155,17 @@ public: INT8 *m_shared_ram; UINT8 m_cnt; + INT8 *m_shared_ram2; DECLARE_READ8_MEMBER(sharedram_r); DECLARE_WRITE8_MEMBER(sharedram_w); DECLARE_READ8_MEMBER(sb2b_75bd37_r); DECLARE_READ8_MEMBER(sb2b_6a6xxx_r); DECLARE_READ8_MEMBER(sb2b_7xxx_r); + DECLARE_READ8_MEMBER(endless_580xxx_r); + DECLARE_READ8_MEMBER(endless_624b7f_r); + DECLARE_READ8_MEMBER(endless_800b_r); + DECLARE_READ8_MEMBER(sharedram2_r); + DECLARE_WRITE8_MEMBER(sharedram2_w); DECLARE_READ8_MEMBER(snesb_dsw1_r); DECLARE_READ8_MEMBER(snesb_dsw2_r); DECLARE_READ8_MEMBER(snesb_coin_r); @@ -217,6 +223,50 @@ READ8_MEMBER(snesb_state::sb2b_7xxx_r) } +/* Endless Duel */ +READ8_MEMBER(snesb_state::endless_580xxx_r) +{ + /* protection checks */ + switch(offset) + { + case 0x2bc: return 0xb4; + case 0x36a: return 0x8a; + case 0x7c1: return 0xd9; + case 0x956: return 0xa5; + case 0xe83: return 0x6b; + } + + logerror("Unknown protection read read %x @ %x\n",offset, space.device().safe_pc()); + + return 0; +} + +READ8_MEMBER(snesb_state::endless_624b7f_r) +{ + /* protection check */ + return ++m_cnt; +} + +READ8_MEMBER(snesb_state::endless_800b_r) +{ + if (!offset) + { + return 0x50; + } + + return 0xe8; +} + +READ8_MEMBER(snesb_state::sharedram2_r) +{ + return m_shared_ram2[offset]; +} + +WRITE8_MEMBER(snesb_state::sharedram2_w) +{ + m_shared_ram2[offset]=data; +} + /* Generic read handlers for Dip Switches and coins inputs */ READ8_MEMBER(snesb_state::snesb_dsw1_r) { @@ -892,6 +942,22 @@ DRIVER_INIT_MEMBER(snesb_state,endless) } } + /* boot vector */ + dst[0x7ffc] = 0x00; + dst[0x7ffd] = 0x80; + + /* protection checks */ + m_maincpu->space(AS_PROGRAM).install_read_handler(0x580000, 0x580fff, read8_delegate(FUNC(snesb_state::endless_580xxx_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x624b7f, 0x624b7f, read8_delegate(FUNC(snesb_state::endless_624b7f_r),this)); + + /* work around missing content */ + m_maincpu->space(AS_PROGRAM).install_read_handler(0x800b, 0x800c, read8_delegate(FUNC(snesb_state::endless_800b_r),this)); + + m_shared_ram = auto_alloc_array(machine(), INT8, 0x22); + m_shared_ram2 = auto_alloc_array(machine(), INT8, 0x22); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x781000, 0x781021, read8_delegate(FUNC(snesb_state::sharedram_r),this), write8_delegate(FUNC(snesb_state::sharedram_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x781200, 0x781221, read8_delegate(FUNC(snesb_state::sharedram2_r),this), write8_delegate(FUNC(snesb_state::sharedram2_w),this)); + DRIVER_INIT_CALL(snes); }