From 2e0fa37046886ddc3b00f25f7af612823e08ab3a Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 8 Aug 2023 22:28:59 +0200 Subject: volfied: small reorg with source code blocks, mlanding: zerofill class variables --- src/mame/taito/ksayakyu.cpp | 5 +- src/mame/taito/lkage.cpp | 12 ++-- src/mame/taito/mlanding.cpp | 39 ++++++------ src/mame/taito/volfied.cpp | 149 ++++++++++++++++++++++---------------------- 4 files changed, 103 insertions(+), 102 deletions(-) diff --git a/src/mame/taito/ksayakyu.cpp b/src/mame/taito/ksayakyu.cpp index de2f2cea0f5..ef337c24397 100644 --- a/src/mame/taito/ksayakyu.cpp +++ b/src/mame/taito/ksayakyu.cpp @@ -373,9 +373,9 @@ static INPUT_PORTS_START( ksayakyu ) PORT_DIPSETTING( 0x08, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_DIPNAME( 0x040, 0x00, "Continue" ) + PORT_DIPNAME( 0x40, 0x00, "Continue" ) PORT_DIPSETTING( 0x00, "7th inning" ) - PORT_DIPSETTING( 0x040, "1st inning" ) + PORT_DIPSETTING( 0x40, "1st inning" ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) INPUT_PORTS_END @@ -469,7 +469,6 @@ void ksayakyu_state::ksayakyu(machine_config &config) config.set_maximum_quantum(attotime::from_hz(60000)); - // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); diff --git a/src/mame/taito/lkage.cpp b/src/mame/taito/lkage.cpp index 66bbc5e38b3..7f2a1e94246 100644 --- a/src/mame/taito/lkage.cpp +++ b/src/mame/taito/lkage.cpp @@ -270,12 +270,12 @@ void lkage_state::machine_reset() Video hardware -------------------------------------------------------------------------------- - lkage_scroll[0x00]: text layer horizontal scroll - lkage_scroll[0x01]: text layer vertical scroll - lkage_scroll[0x02]: foreground layer horizontal scroll - lkage_scroll[0x03]: foreground layer vertical scroll - lkage_scroll[0x04]: background layer horizontal scroll - lkage_scroll[0x05]: background layer vertical scroll + m_scroll[0x00]: text layer horizontal scroll + m_scroll[0x01]: text layer vertical scroll + m_scroll[0x02]: foreground layer horizontal scroll + m_scroll[0x03]: foreground layer vertical scroll + m_scroll[0x04]: background layer horizontal scroll + m_scroll[0x05]: background layer vertical scroll m_vreg: 04 7d f3 : title screen 101 diff --git a/src/mame/taito/mlanding.cpp b/src/mame/taito/mlanding.cpp index 971cc7d0525..a9786b0f10c 100644 --- a/src/mame/taito/mlanding.cpp +++ b/src/mame/taito/mlanding.cpp @@ -103,8 +103,6 @@ protected: virtual void machine_start() override; virtual void machine_reset() override; - TIMER_CALLBACK_MEMBER(dma_complete); - private: static constexpr u32 c_dma_bank_words = 0x2000; @@ -117,13 +115,13 @@ private: required_device_array m_msm; required_device m_ctc; - required_memory_bank m_dma_bank; + required_memory_bank m_dma_bank; required_region_ptr_array m_msm_rom; required_shared_ptr m_g_ram; required_shared_ptr m_cha_ram; required_shared_ptr m_dot_ram; - required_shared_ptr m_power_ram; + required_shared_ptr m_power_ram; required_device m_palette; @@ -132,17 +130,18 @@ private: required_ioport_array<2> m_io_limit; std::unique_ptr m_dma_ram; - u8 m_dma_cpu_bank; - u8 m_dma_busy; - u16 m_dsp_hold_signal; - emu_timer *m_dma_done_timer; + u8 m_dma_cpu_bank = 0; + u8 m_dma_busy = 0; + u16 m_dsp_hold_signal = 0; + emu_timer *m_dma_done_timer = nullptr; - u32 m_msm_pos[2]; - u8 m_msm_reset[2]; - u8 m_msm_nibble[2]; - u8 m_msm2_vck; - u8 m_msm2_vck2; + u32 m_msm_pos[2] = { }; + u8 m_msm_reset[2] = { }; + u8 m_msm_nibble[2] = { }; + u8 m_msm2_vck = 0; + u8 m_msm2_vck2 = 0; + TIMER_CALLBACK_MEMBER(dma_complete); void dma_start_w(u16 data = 0); void dma_stop_w(u16 data = 0); void output_w(u16 data); @@ -195,7 +194,7 @@ private: void mlanding_state::machine_start() { // Allocate two DMA RAM banks - m_dma_ram = std::make_unique(c_dma_bank_words * 2); + m_dma_ram = make_unique_clear(c_dma_bank_words * 2); m_dma_bank->configure_entries(0, 2, m_dma_ram.get(), c_dma_bank_words * 2); // Register state for saving @@ -785,6 +784,8 @@ void mlanding_state::dsp_map_data(address_map &map) map(0x0400, 0x1fff).ram().share(m_dot_ram); } + + /************************************* * * Audio CPU memory handlers @@ -928,6 +929,8 @@ static INPUT_PORTS_START( mlandingj ) PORT_DIPSETTING( 0x00, DEF_STR( English ) ) INPUT_PORTS_END + + /************************************* * * Machine driver @@ -936,7 +939,7 @@ INPUT_PORTS_END void mlanding_state::mlanding(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware M68000(config, m_maincpu, 16_MHz_XTAL / 2); // TS68000CP8 m_maincpu->set_addrmap(AS_PROGRAM, &mlanding_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(mlanding_state::irq6_line_hold)); @@ -969,7 +972,7 @@ void mlanding_state::mlanding(machine_config &config) TAITOIO_YOKE(config, m_yoke, 0); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(16_MHz_XTAL, 640, 0, 512, 462, 0, 400); // Estimated screen.set_screen_update(FUNC(mlanding_state::screen_update)); @@ -977,7 +980,7 @@ void mlanding_state::mlanding(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 32768); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ym2151_device &ymsnd(YM2151(config, "ymsnd", 16_MHz_XTAL / 4)); @@ -1073,5 +1076,5 @@ ROM_END * *************************************/ -GAME( 1987, mlanding, 0, mlanding, mlanding, mlanding_state, empty_init, ROT0, "Taito America Corporation", "Midnight Landing (Germany)", MACHINE_SUPPORTS_SAVE ) // Japanese or German selectable via dip-switch. Copyright changes accordingly. +GAME( 1987, mlanding, 0, mlanding, mlanding, mlanding_state, empty_init, ROT0, "Taito America Corporation", "Midnight Landing (Germany)", MACHINE_SUPPORTS_SAVE ) // Japanese or German selectable via dip-switch. Copyright changes accordingly. GAME( 1987, mlandingj, mlanding, mlanding, mlandingj, mlanding_state, empty_init, ROT0, "Taito Corporation", "Midnight Landing (Japan)", MACHINE_SUPPORTS_SAVE ) // Japanese or English selectable via dip-switch. Copyright changes accordingly. diff --git a/src/mame/taito/volfied.cpp b/src/mame/taito/volfied.cpp index 9a897e106f2..9f86b5cc753 100644 --- a/src/mame/taito/volfied.cpp +++ b/src/mame/taito/volfied.cpp @@ -117,10 +117,8 @@ private: }; -// video - /****************************************************** - INITIALISATION AND CLEAN-UP + INITIALISATION ******************************************************/ void volfied_state::video_start() @@ -134,46 +132,7 @@ void volfied_state::video_start() /******************************************************* - READ AND WRITE HANDLERS -*******************************************************/ - -void volfied_state::video_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - mem_mask &= m_video_mask; - - COMBINE_DATA(&m_video_ram[offset]); -} - -void volfied_state::video_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_video_ctrl); -} - -uint16_t volfied_state::video_ctrl_r() -{ - /* Could this be some kind of hardware collision detection? If bit 6 is - set the game will check for collisions with the large enemy, whereas - bit 5 does the same for small enemies. Bit 7 is also used although - its purpose is unclear. This register is usually read during a VBI - and stored in work RAM for later use. */ - - return 0x60; -} - -void volfied_state::video_mask_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_video_mask); -} - -void volfied_state::colpri_cb(uint32_t &sprite_colbank, uint32_t &pri_mask, uint16_t sprite_ctrl) -{ - sprite_colbank = 0x100 | ((sprite_ctrl & 0x3c) << 2); - pri_mask = 0; // sprites over everything -} - - -/******************************************************* - SCREEN REFRESH + SCREEN REFRESH *******************************************************/ void volfied_state::refresh_pixel_layer(bitmap_ind16 &bitmap) @@ -237,17 +196,74 @@ uint32_t volfied_state::screen_update(screen_device &screen, bitmap_ind16 &bitma } -// machine +/******************************************************* + READ AND WRITE HANDLERS +*******************************************************/ + +void volfied_state::video_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + mem_mask &= m_video_mask; + + COMBINE_DATA(&m_video_ram[offset]); +} + +void volfied_state::video_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_video_ctrl); +} + +uint16_t volfied_state::video_ctrl_r() +{ + /* Could this be some kind of hardware collision detection? If bit 6 is + set the game will check for collisions with the large enemy, whereas + bit 5 does the same for small enemies. Bit 7 is also used although + its purpose is unclear. This register is usually read during a VBI + and stored in work RAM for later use. */ + + return 0x60; +} + +void volfied_state::video_mask_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_video_mask); +} + +void volfied_state::colpri_cb(uint32_t &sprite_colbank, uint32_t &pri_mask, uint16_t sprite_ctrl) +{ + sprite_colbank = 0x100 | ((sprite_ctrl & 0x3c) << 2); + pri_mask = 0; // sprites over everything +} + +void volfied_state::counters_w(uint8_t data) +{ + 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); +} + +INTERRUPT_GEN_MEMBER(volfied_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(volfied_state::cchip_irq_clear_cb) +{ + m_cchip->ext_interrupt(CLEAR_LINE); +} + /*********************************************************** - MEMORY STRUCTURES + MEMORY STRUCTURES ***********************************************************/ void volfied_state::main_map(address_map &map) { - map(0x000000, 0x03ffff).rom(); // program - map(0x080000, 0x0fffff).rom(); // tiles - map(0x100000, 0x103fff).ram(); // main + map(0x000000, 0x03ffff).rom(); // program + map(0x080000, 0x0fffff).rom(); // tiles + map(0x100000, 0x103fff).ram(); // main map(0x200000, 0x203fff).rw(m_pc090oj, FUNC(pc090oj_device::word_r), FUNC(pc090oj_device::word_w)); map(0x400000, 0x47ffff).ram().w(FUNC(volfied_state::video_ram_w)).share(m_video_ram); map(0x500000, 0x503fff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); @@ -267,12 +283,12 @@ void volfied_state::z80_map(address_map &map) map(0x8800, 0x8800).w("ciu", FUNC(pc060ha_device::slave_port_w)); map(0x8801, 0x8801).rw("ciu", FUNC(pc060ha_device::slave_comm_r), FUNC(pc060ha_device::slave_comm_w)); map(0x9000, 0x9001).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); - map(0x9800, 0x9800).nopw(); // ? + map(0x9800, 0x9800).nopw(); // ? } /*********************************************************** - INPUT PORTS + INPUT PORTS ***********************************************************/ static INPUT_PORTS_START( volfied ) @@ -364,30 +380,9 @@ INPUT_PORTS_END /*********************************************************** - MACHINE DRIVERS + MACHINE CONFIGS ***********************************************************/ -void volfied_state::counters_w(uint8_t data) -{ - 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); -} - -INTERRUPT_GEN_MEMBER(volfied_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(volfied_state::cchip_irq_clear_cb) -{ - m_cchip->ext_interrupt(CLEAR_LINE); -} - - void volfied_state::volfied(machine_config &config) { // Define clocks based on actual OSC on the PCB @@ -396,11 +391,11 @@ void volfied_state::volfied(machine_config &config) static constexpr XTAL SOUND_CPU_CLOCK = (32_MHz_XTAL / 8); // 4 MHz clock for Z80 sound CPU // basic machine hardware - M68000(config, m_maincpu, CPU_CLOCK); // 8MHz + M68000(config, m_maincpu, CPU_CLOCK); // 8MHz m_maincpu->set_addrmap(AS_PROGRAM, &volfied_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(volfied_state::interrupt)); - Z80(config, m_audiocpu, SOUND_CPU_CLOCK); // 4MHz sound CPU, required to run the game + Z80(config, m_audiocpu, SOUND_CPU_CLOCK); // 4MHz sound CPU, required to run the game m_audiocpu->set_addrmap(AS_PROGRAM, &volfied_state::z80_map); TAITO_CCHIP(config, m_cchip, 20_MHz_XTAL / 2); // 20MHz OSC next to C-Chip @@ -448,7 +443,7 @@ void volfied_state::volfied(machine_config &config) /*************************************************************************** - DRIVERS + ROM DEFINITIONS ***************************************************************************/ ROM_START( volfied ) @@ -646,6 +641,10 @@ ROM_END } // anonymous namespace +/*************************************************************************** + DRIVERS +***************************************************************************/ + GAME( 1989, volfied, 0, volfied, volfied, volfied_state, empty_init, ROT270, "Taito Corporation Japan", "Volfied (World, revision 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, volfiedu, volfied, volfied, volfiedu, volfied_state, empty_init, ROT270, "Taito America Corporation", "Volfied (US, revision 1)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, volfiedj, volfied, volfied, volfiedj, volfied_state, empty_init, ROT270, "Taito Corporation", "Volfied (Japan, revision 1)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3