diff options
author | Vas Crabb <vas@vastheman.com> | 2021-08-29 23:39:43 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2021-08-29 23:39:43 +1000 |
commit | a10ce5e161db54c98ef8255bf43132f9bc745d9e (patch) | |
tree | b5bbc33149ea920ee1339e34884ec87e5f54d480 /src/mame/includes | |
parent | c833c1e2ed65496c29e1d8370f1de8db422b160d (diff) |
Miscellaneous clean-up.
* play_1.cpp: Use output finders.
* s3.cpp, s4.cpp, s6.cpp, s6a.cpp: Use output finders, reduced tag
lookups.
* taito_z.cpp: Use output finders, split up state class a little.
* util/unzip.cpp: Use std::optional to make code clearer.
* util/ioprocsfilter.cpp: Work around MSVC DevCom-1516410.
Diffstat (limited to 'src/mame/includes')
-rw-r--r-- | src/mame/includes/taito_z.h | 332 |
1 files changed, 240 insertions, 92 deletions
diff --git a/src/mame/includes/taito_z.h b/src/mame/includes/taito_z.h index 6e8dc99f420..3e1b64634fd 100644 --- a/src/mame/includes/taito_z.h +++ b/src/mame/includes/taito_z.h @@ -28,11 +28,8 @@ public: driver_device(mconfig, type, tag), m_spriteram(*this, "spriteram"), m_spritemap(*this, "spritemap"), - m_z80bank(*this, "z80bank"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), - m_eeprom(*this, "eeprom"), m_tc0480scp(*this, "tc0480scp"), m_tc0150rod(*this, "tc0150rod"), m_tc0100scn(*this, "tc0100scn"), @@ -48,10 +45,7 @@ public: m_brake(*this, "BRAKE"), m_steer(*this, "STEER"), m_stickx(*this, "STICKX"), - m_sticky(*this, "STICKY"), - m_io_eepromout(*this, "EEPROMOUT"), - m_lamps(*this, "lamp%u", 0U), - m_shutter_out(*this, "shutter%u", 0U) + m_sticky(*this, "STICKY") { } DECLARE_CUSTOM_INPUT_MEMBER(gas_pedal_r); @@ -59,56 +53,29 @@ public: template <int axis> DECLARE_CUSTOM_INPUT_MEMBER(adstick_r); void bshark_base(machine_config &config); - void sci(machine_config &config); - void spacegun(machine_config &config); - void chasehq(machine_config &config); - void dblaxle(machine_config &config); void bshark(machine_config &config); - void aquajack(machine_config &config); - void nightstr(machine_config &config); - void contcirc(machine_config &config); - void racingb(machine_config &config); void bsharkjjs(machine_config &config); - void enforce(machine_config &config); - - void init_bshark(); protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void device_post_load() override; virtual void machine_start() override; virtual void machine_reset() override; + void screen_config(machine_config &config, int vdisp_start, int vdisp_end); -private: - enum - { - TIMER_TAITOZ_INTERRUPT6, - }; + void cpua_ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0); + void coin_control_w(u8 data); + void pancontrol_w(offs_t offset, u8 data); + + void bshark_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); /* memory pointers */ required_shared_ptr<u16> m_spriteram; required_region_ptr<u16> m_spritemap; - optional_memory_bank m_z80bank; - - /* video-related */ - int m_sci_spriteframe; - int m_road_palbank; - - /* misc */ - u16 m_cpua_ctrl; - s32 m_sci_int6; - s32 m_ioc220_port; - u8 m_eep_latch; - int m_shutter_toggle; - u8 m_shutter_control; - /* devices */ required_device<cpu_device> m_maincpu; - optional_device<cpu_device> m_audiocpu; required_device<cpu_device> m_subcpu; - optional_device<eeprom_serial_93cxx_device> m_eeprom; optional_device<tc0480scp_device> m_tc0480scp; optional_device<tc0150rod_device> m_tc0150rod; optional_device<tc0100scn_device> m_tc0100scn; @@ -125,71 +92,252 @@ private: optional_ioport m_steer; optional_ioport m_stickx; optional_ioport m_sticky; - optional_ioport m_io_eepromout; - output_finder<2> m_lamps; + + /* misc */ + u16 m_cpua_ctrl; + +private: + u32 screen_update_bshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void parse_cpu_control(); + + void bshark_cpub_map(address_map &map); + void bshark_map(address_map &map); + void bsharkjjs_map(address_map &map); +}; + + +class taitoz_z80_sound_state : public taitoz_state +{ +public: + taitoz_z80_sound_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_state(mconfig, type, tag), + m_audiocpu(*this, "audiocpu"), + m_z80bank(*this, "z80bank") + { + } + + void aquajack(machine_config &config); + +protected: + virtual void machine_start() override; + + u16 dblaxle_steer_input_r(offs_t offset); + + u32 screen_update_chasehq(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void z80_sound_map(address_map &map); + + required_device<cpu_device> m_audiocpu; + +private: + u16 aquajack_unknown_r(); + void sound_bankswitch_w(u8 data); + + void chasehq_draw_sprites_16x16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); + void aquajack_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs); + u32 screen_update_aquajack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void aquajack_map(address_map &map); + void aquajack_cpub_map(address_map &map); + + required_memory_bank m_z80bank; +}; + + +class contcirc_state : public taitoz_z80_sound_state +{ +public: + contcirc_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_z80_sound_state(mconfig, type, tag), + m_shutter_out(*this, "shutter%u", 0U) + { + } + + void contcirc(machine_config &config); + void enforce(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + u8 contcirc_input_bypass_r(); + void contcirc_out_w(u8 data); + DECLARE_WRITE_LINE_MEMBER(scope_vblank); + + void contcirc_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); + u32 screen_update_contcirc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void contcirc_map(address_map &map); + void contcirc_cpub_map(address_map &map); + void enforce_map(address_map &map); + void enforce_cpub_map(address_map &map); + output_finder<2> m_shutter_out; - void cpua_ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0); + int m_road_palbank; + int m_shutter_toggle; + u8 m_shutter_control; +}; + + +class chasehq_state : public taitoz_z80_sound_state +{ +public: + chasehq_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_z80_sound_state(mconfig, type, tag), + m_unknown_io(*this, "UNK%u", 1U), + m_lamps(*this, "lamp%u", 0U) + { + } + + void chasehq(machine_config &config); + +protected: + virtual void machine_start() override; + +private: void chasehq_cpua_ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0); - void dblaxle_cpua_ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0); - void spacegun_eeprom_w(u8 data); - u8 contcirc_input_bypass_r(); u8 chasehq_input_bypass_r(); - u16 sci_steer_input_r(offs_t offset); - void spacegun_gun_output_w(u16 data); - u16 dblaxle_steer_input_r(offs_t offset); u16 chasehq_motor_r(offs_t offset); void chasehq_motor_w(offs_t offset, u16 data); - void nightstr_motor_w(offs_t offset, u16 data); - void coin_control_w(u8 data); - u16 aquajack_unknown_r(); - void sound_bankswitch_w(u8 data); - void pancontrol_w(offs_t offset, u8 data); + + void chasehq_map(address_map &map); + void chasehq_cpub_map(address_map &map); + + required_ioport_array<4> m_unknown_io; + output_finder<2> m_lamps; +}; + + +class sci_state : public taitoz_z80_sound_state +{ +public: + sci_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_z80_sound_state(mconfig, type, tag) + { + } + + void sci(machine_config &config); + void racingb(machine_config &config); + +protected: + enum + { + TIMER_TAITOZ_INTERRUPT6, + }; + + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + u16 sci_steer_input_r(offs_t offset); u16 sci_spriteframe_r(); void sci_spriteframe_w(u16 data); - void contcirc_out_w(u8 data); - DECLARE_WRITE_LINE_MEMBER(scope_vblank); - DECLARE_VIDEO_START(taitoz); - DECLARE_MACHINE_START(chasehq); - u32 screen_update_contcirc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_chasehq(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_bshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_sci(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_aquajack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_spacegun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_dblaxle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - u32 screen_update_racingb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(sci_interrupt); - void contcirc_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); - void chasehq_draw_sprites_16x16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); - void bshark_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); + void sci_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); - void aquajack_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs); - void spacegun_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs); - void parse_cpu_control(); + u32 screen_update_sci(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_racingb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void aquajack_cpub_map(address_map &map); - void aquajack_map(address_map &map); - void bshark_cpub_map(address_map &map); - void bshark_map(address_map &map); - void bsharkjjs_map(address_map &map); - void chasehq_map(address_map &map); - void chq_cpub_map(address_map &map); - void contcirc_cpub_map(address_map &map); - void contcirc_map(address_map &map); - void dblaxle_cpub_map(address_map &map); - void dblaxle_map(address_map &map); - void enforce_cpub_map(address_map &map); - void enforce_map(address_map &map); - void nightstr_cpub_map(address_map &map); - void nightstr_map(address_map &map); - void racingb_cpub_map(address_map &map); - void racingb_map(address_map &map); - void sci_cpub_map(address_map &map); void sci_map(address_map &map); - void spacegun_cpub_map(address_map &map); + void sci_cpub_map(address_map &map); + void racingb_map(address_map &map); + void racingb_cpub_map(address_map &map); + + int m_sci_spriteframe; + s32 m_sci_int6; +}; + + +class nightstr_state : public taitoz_z80_sound_state +{ +public: + nightstr_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_z80_sound_state(mconfig, type, tag), + m_motor_dir(*this, "Motor_%u_Direction", 1U), + m_motor_speed(*this, "Motor_%u_Speed", 1U), + m_motor_debug(*this, "motor_debug") + { + } + + void nightstr(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void nightstr_motor_w(offs_t offset, u16 data); + + void nightstr_map(address_map &map); + void nightstr_cpub_map(address_map &map); + + output_finder<3> m_motor_dir; + output_finder<3> m_motor_speed; + output_finder<> m_motor_debug; +}; + + +class spacegun_state : public taitoz_state +{ +public: + spacegun_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_state(mconfig, type, tag), + m_eeprom(*this, "eeprom"), + m_io_eepromout(*this, "EEPROMOUT"), + m_recoil(*this, "Player%u_Gun_Recoil", 1U) + { + } + + void spacegun(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void spacegun_eeprom_w(u8 data); + void spacegun_gun_output_w(u16 data); + + void spacegun_draw_sprites_16x8(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int y_offs); + u32 screen_update_spacegun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void spacegun_map(address_map &map); - void z80_sound_map(address_map &map); + void spacegun_cpub_map(address_map &map); + + required_device<eeprom_serial_93cxx_device> m_eeprom; + required_ioport m_io_eepromout; + output_finder<2> m_recoil; + + u8 m_eep_latch; +}; + + +class dblaxle_state : public taitoz_z80_sound_state +{ +public: + dblaxle_state(const machine_config &mconfig, device_type type, const char *tag) : + taitoz_z80_sound_state(mconfig, type, tag), + m_wheel_vibration(*this, "Wheel_Vibration") + { + } + + void dblaxle(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void dblaxle_cpua_ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0); + + u32 screen_update_dblaxle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void dblaxle_map(address_map &map); + void dblaxle_cpub_map(address_map &map); + + output_finder<> m_wheel_vibration; }; #endif // MAME_INCLUDES_TAITO_Z_H |