diff options
| author | 2021-09-21 19:51:09 +0200 | |
|---|---|---|
| committer | 2021-09-21 19:52:25 +0200 | |
| commit | a0289bfd4c041a780440e1d1e0055b531069dd50 (patch) | |
| tree | da98fffa2ead0b691d6335b2b4cd94221c3a3418 /src | |
| parent | 6c7cd1f5c6ff513e53861923f3680521870f347d (diff) | |
wndrplnt: Decapped and dumped MCU [Alex, Brian A. Troha, TeamEurope]
- Also remove simulation, clean ups
Diffstat (limited to 'src')
| -rw-r--r-- | src/mame/drivers/karnov.cpp | 256 | ||||
| -rw-r--r-- | src/mame/includes/karnov.h | 16 |
2 files changed, 17 insertions, 255 deletions
diff --git a/src/mame/drivers/karnov.cpp b/src/mame/drivers/karnov.cpp index 3191309173d..b3b06321078 100644 --- a/src/mame/drivers/karnov.cpp +++ b/src/mame/drivers/karnov.cpp @@ -199,119 +199,6 @@ void karnov_state::mcubl_p1_w(uint8_t data) m_mcu_p1 = data; } -// mcu simulation below - -void karnov_state::wndrplnt_mcu_w( uint16_t data ) -{ - /* The last command hasn't been ACK'd (probably a conflict with coin command) */ - if (m_i8751_needs_ack) - { - m_i8751_command_queue = data; - return; - } - - m_i8751_return=0; - - if (data == 0x100) m_i8751_return = 0x67a; - if (data == 0x200) m_i8751_return = 0x214; - if (data == 0x300) m_i8751_return = 0x17; /* Copyright text on title screen */ -// if (data == 0x300) m_i8751_return = 0x1; /* (USA) Copyright text on title screen */ - - /* The game writes many values in the 0x600 range, but only a specific mask - matters for the return value */ - if ((data & 0x600) == 0x600) - { - switch (data & 0x18) - { - case 0x00: m_i8751_return = 0x4d53; break; - case 0x08: m_i8751_return = 0x4b54; break; - case 0x10: m_i8751_return = 0x5453; break; - case 0x18: m_i8751_return = 0x5341; break; - } - } -// else logerror("%s - Unknown Write %02x intel\n", machine().describe_context(), data); - - /* These are 68k function call addresses - different address for each power-up */ - if (data == 0x400) m_i8751_return = 0x594; - if (data == 0x401) m_i8751_return = 0x5ea; - if (data == 0x402) m_i8751_return = 0x628; - if (data == 0x403) m_i8751_return = 0x66c; - if (data == 0x404) m_i8751_return = 0x6a4; - if (data == 0x405) m_i8751_return = 0x6a4; - if (data == 0x406) m_i8751_return = 0x6a4; - - /* This is 68k program code which is executed every frame */ - if (data == 0x50c) m_i8751_return = 0x13fc; - if (data == 0x50b) m_i8751_return = 0x00ff; - if (data == 0x50a) m_i8751_return = 0x0006; - if (data == 0x509) m_i8751_return = 0x0000; - if (data == 0x508) m_i8751_return = 0x4a39; - if (data == 0x507) m_i8751_return = 0x0006; - if (data == 0x506) m_i8751_return = 0x0000; - if (data == 0x505) m_i8751_return = 0x66f8; - if (data == 0x504) m_i8751_return = 0x4a39; - if (data == 0x503) m_i8751_return = 0x000c; - if (data == 0x502) m_i8751_return = 0x0003; - if (data == 0x501) m_i8751_return = 0x6bf8; - if (data == 0x500) m_i8751_return = 0x4e75; - - m_maincpu->set_input_line(6, HOLD_LINE); /* Signal main cpu task is complete */ - m_i8751_needs_ack = 1; -} - - -/************************************* - * - * Memory handlers - * - *************************************/ - -void karnov_state::wndrplnt_mcu_ack_w(u16 data) -{ - m_maincpu->set_input_line(6, CLEAR_LINE); - - if (m_i8751_needs_ack) - { - /* If a command and coin insert happen at once, then the i8751 will queue the coin command until the previous command is ACK'd */ - if (m_i8751_coin_pending) - { - m_i8751_return = m_i8751_coin_pending; - m_maincpu->set_input_line(6, HOLD_LINE); - m_i8751_coin_pending = 0; - } - else if (m_i8751_command_queue) - { - /* Pending control command - just write it back as SECREQ */ - m_i8751_needs_ack = 0; - wndrplnt_mcu_w(m_i8751_command_queue); - m_i8751_command_queue = 0; - } - else - { - m_i8751_needs_ack = 0; - } - } -} - -u16 karnov_state::wndrplnt_mcu_r() -{ - return m_i8751_return; -} - -void karnov_state::wndrplnt_mcu_reset_w(u16 data) -{ - logerror("Reset i8751\n"); - m_i8751_needs_ack = 0; - m_i8751_coin_pending = 0; - m_i8751_command_queue = 0; - m_i8751_return = 0; -} - -void karnov_state::vint_ack_w(u16 data) -{ - m_maincpu->set_input_line(7, CLEAR_LINE); -} - /************************************* * @@ -335,7 +222,7 @@ void karnov_state::karnov_map(address_map &map) map(0x0c0004, 0x0c0005).portr("DSW").w(m_spriteram, FUNC(buffered_spriteram16_device::write)); map(0x0c0006, 0x0c0007).rw(FUNC(karnov_state::mcu_r), FUNC(karnov_state::mcu_w)); map(0x0c0008, 0x0c000b).writeonly().share("scroll"); - map(0x0c000e, 0x0c000f).nopr().w(FUNC(karnov_state::vint_ack_w)); + map(0x0c000e, 0x0c000f).nopr().lw16([this](u16 data) { m_maincpu->set_input_line(7, CLEAR_LINE); }, "vint_ack_w"); } void karnov_state::karnovjbl_map(address_map &map) @@ -345,14 +232,6 @@ void karnov_state::karnovjbl_map(address_map &map) map(0x0c0006, 0x0c0007).lr16(NAME([]() { return 0x56a; })).lw16(NAME([this](u16 data) { m_maincpu->set_input_line(6, HOLD_LINE); })); } -void karnov_state::wndrplnt_map(address_map &map) -{ - karnov_map(map); - map(0x0c0000, 0x0c0001).portr("P1_P2").w(FUNC(karnov_state::wndrplnt_mcu_ack_w)); - map(0x0c0006, 0x0c0007).rw(FUNC(karnov_state::wndrplnt_mcu_r), FUNC(karnov_state::wndrplnt_mcu_w)); - map(0x0c000c, 0x0c000d).w(FUNC(karnov_state::wndrplnt_mcu_reset_w)); -} - void karnov_state::base_sound_map(address_map &map) { map(0x0000, 0x05ff).ram(); @@ -409,18 +288,18 @@ static INPUT_PORTS_START( common ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") + + PORT_START("COIN") + PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<0>) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<1>) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<2>) INPUT_PORTS_END /* verified from M68000 code */ static INPUT_PORTS_START( karnov ) PORT_INCLUDE( common ) - PORT_START("COIN") - PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<0>) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<1>) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<2>) - PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x0000, DEF_STR( 2C_1C ) ) @@ -467,6 +346,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( karnovjbl ) PORT_INCLUDE(karnov) + // no interrupt on coin input here PORT_MODIFY("COIN") PORT_BIT(0x1f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_COIN1) @@ -482,11 +362,6 @@ static INPUT_PORTS_START( wndrplnt ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) /* BUTTON3 */ PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) /* BUTTON3 PORT_COCKTAIL */ - PORT_START("COIN") /* Dummy input for i8751 */ - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) - PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x0000, DEF_STR( 2C_1C ) ) @@ -531,12 +406,6 @@ INPUT_PORTS_END static INPUT_PORTS_START( chelnov ) PORT_INCLUDE( common ) - PORT_START("COIN") - PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<0>) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<1>) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<2>) - PORT_START("DSW") PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) ) @@ -654,60 +523,12 @@ GFXDECODE_END /************************************* * - * Interrupt generator - * - *************************************/ - -WRITE_LINE_MEMBER(karnov_state::wndrplnt_mcusim_vbint_w) -{ - if (!state) - return; - - uint8_t port = ioport("COIN")->read(); - - /* Coin input to the i8751 generates an interrupt to the main cpu */ - if (port == 0) - m_latch = 1; - - if (port != 0 && m_latch) - { - if (m_i8751_needs_ack) - { - /* i8751 is busy - queue the command */ - m_i8751_coin_pending = port | 0x8000; - } - else - { - m_i8751_return = port | 0x8000; - m_maincpu->set_input_line(6, ASSERT_LINE); - m_i8751_needs_ack = 1; - } - - m_latch = 0; - } - - m_maincpu->set_input_line(7, ASSERT_LINE); -} - -void karnov_state::vbint_w(int state) -{ - m_maincpu->set_input_line(7, ASSERT_LINE); -} - - -/************************************* - * * Machine driver * *************************************/ void karnov_state::machine_start() { - save_item(NAME(m_i8751_return)); - save_item(NAME(m_i8751_needs_ack)); - save_item(NAME(m_i8751_coin_pending)); - save_item(NAME(m_i8751_command_queue)); - save_item(NAME(m_latch)); save_item(NAME(m_mcu_p0)); save_item(NAME(m_mcu_p1)); save_item(NAME(m_mcu_p2)); @@ -720,12 +541,6 @@ void karnov_state::machine_reset() { memset(m_ram, 0, 0x4000 / 2); /* Chelnov likes ram clear on reset.. */ - m_i8751_return = 0; - m_i8751_needs_ack = 0; - m_i8751_coin_pending = 0; - m_i8751_command_queue = 0; -// m_latch = 0; - m_scroll[0] = 0; m_scroll[1] = 0; } @@ -763,7 +578,7 @@ void karnov_state::karnov(machine_config &config) m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1); m_screen->set_screen_update(FUNC(karnov_state::screen_update)); m_screen->set_palette(m_palette); - m_screen->screen_vblank().set(FUNC(karnov_state::vbint_w)); + m_screen->screen_vblank().set_inputline(m_maincpu, 7, ASSERT_LINE); GFXDECODE(config, m_gfxdecode, m_palette, gfx_karnov); DECO_RMC3(config, m_palette, 0, 1024); // xxxxBBBBGGGGRRRR with custom weighting @@ -809,6 +624,13 @@ void karnov_state::karnovjbl(machine_config &config) ym2.add_route(ALL_OUTPUTS, "mono", 1.0); } +void karnov_state::wndrplnt(machine_config &config) +{ + karnov(config); + + MCFG_VIDEO_START_OVERRIDE(karnov_state, wndrplnt) +} + void karnov_state::chelnovjbl(machine_config &config) { karnov(config); @@ -824,50 +646,6 @@ void karnov_state::chelnovjbl(machine_config &config) m_mcu->port_in_cb<3>().set_ioport("COIN"); } -void karnov_state::wndrplnt(machine_config &config) -{ - /* basic machine hardware */ - M68000(config, m_maincpu, 20_MHz_XTAL/2); /* 10 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &karnov_state::wndrplnt_map); - - M6502(config, m_audiocpu, 12_MHz_XTAL/8); /* Accurate */ - m_audiocpu->set_addrmap(AS_PROGRAM, &karnov_state::karnov_sound_map); - - /* video hardware */ - BUFFERED_SPRITERAM16(config, m_spriteram); - - screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ - screen.set_size(32*8, 32*8); - screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); - screen.set_screen_update(FUNC(karnov_state::screen_update)); - screen.set_palette(m_palette); - screen.screen_vblank().set(FUNC(karnov_state::wndrplnt_mcusim_vbint_w)); - - GFXDECODE(config, m_gfxdecode, m_palette, gfx_karnov); - DECO_RMC3(config, m_palette, 0, 1024); // xxxxBBBBGGGGRRRR with custom weighting - m_palette->set_prom_region("proms"); - m_palette->set_init("palette", FUNC(deco_rmc3_device::palette_init_proms)); - - DECO_KARNOVSPRITES(config, m_spritegen, 0); - - MCFG_VIDEO_START_OVERRIDE(karnov_state,wndrplnt) - - /* sound hardware */ - SPEAKER(config, "mono").front_center(); - - GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); - - ym2203_device &ym1(YM2203(config, "ym1", 12_MHz_XTAL/8)); // 1.5 MHz - ym1.add_route(ALL_OUTPUTS, "mono", 0.25); - - ym3526_device &ym2(YM3526(config, "ym2", 12_MHz_XTAL/4)); // 3 MHz - ym2.irq_handler().set_inputline(m_audiocpu, M6502_IRQ_LINE); - ym2.add_route(ALL_OUTPUTS, "mono", 1.0); -} - /************************************* * @@ -1050,7 +828,7 @@ ROM_START( wndrplnt ) ROM_LOAD( "ea05.f3", 0x8000, 0x8000, CRC(8dbb6231) SHA1(342faa020448ce916e820b3df18d44191983f7a6) ) ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 microcontroller */ - ROM_LOAD( "wndrplnt_i8751.k14", 0x0000, 0x1000, NO_DUMP ) + ROM_LOAD( "ea.k14", 0x0000, 0x1000, CRC(b481f6a9) SHA1(e2c4376662fc7b209cd6a2f4e9a85807c8af2548) ) ROM_REGION( 0x08000, "gfx1", 0 ) ROM_LOAD( "ea00.c5", 0x00000, 0x08000, CRC(9f3cac4c) SHA1(af8a275ff531029dbada3c820c9f660fef383100) ) /* Characters */ diff --git a/src/mame/includes/karnov.h b/src/mame/includes/karnov.h index 25c24beaee9..0c22dce94dc 100644 --- a/src/mame/includes/karnov.h +++ b/src/mame/includes/karnov.h @@ -53,19 +53,6 @@ public: tilemap_t *m_bg_tilemap; tilemap_t *m_fix_tilemap; - /* misc */ - uint16_t m_i8751_return; - uint16_t m_i8751_needs_ack; - uint16_t m_i8751_coin_pending; - uint16_t m_i8751_command_queue; - int m_latch; - - u16 wndrplnt_mcu_r(); - void wndrplnt_mcu_w(u16 data); - void wndrplnt_mcu_ack_w(u16 data); - void wndrplnt_mcu_reset_w(u16 data); - - void vint_ack_w(u16 data); void videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); void playfield_w(offs_t offset, u16 data, u16 mem_mask = ~0); TILE_GET_INFO_MEMBER(get_bg_tile_info); @@ -73,8 +60,6 @@ public: DECLARE_VIDEO_START(karnov); DECLARE_VIDEO_START(wndrplnt); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(wndrplnt_mcusim_vbint_w); - void vbint_w(int state); void chelnovjbl(machine_config &config); void karnov(machine_config &config); @@ -86,7 +71,6 @@ public: void chelnovjbl_mcu_io_map(address_map &map); void karnov_map(address_map &map); void karnovjbl_map(address_map &map); - void wndrplnt_map(address_map &map); void karnov_sound_map(address_map &map); void karnovjbl_sound_map(address_map &map); |
