diff options
Diffstat (limited to 'src/mame/includes/n8080.h')
-rw-r--r-- | src/mame/includes/n8080.h | 199 |
1 files changed, 126 insertions, 73 deletions
diff --git a/src/mame/includes/n8080.h b/src/mame/includes/n8080.h index 6ab6e33a958..0a944bdfa38 100644 --- a/src/mame/includes/n8080.h +++ b/src/mame/includes/n8080.h @@ -19,49 +19,33 @@ public: n8080_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_n8080_dac(*this, "n8080_dac"), - m_helifire_dac(*this, "helifire_dac"), m_sn(*this, "snsnd"), m_screen(*this, "screen"), m_palette(*this, "palette") { } - void sheriff(machine_config &config); - void sheriff_sound(machine_config &config); - void westgun2(machine_config &config); - void helifire(machine_config &config); - void helifire_sound(machine_config &config); - void spacefev(machine_config &config); - void spacefev_sound(machine_config &config); - protected: virtual void machine_start() override; + virtual void machine_reset() override; -private: + virtual void sound_pins_changed(); + virtual void update_SN76477_status(); + virtual void delayed_sound_1(int data); + virtual void delayed_sound_2(int data); + +//private: /* memory pointers */ required_shared_ptr<uint8_t> m_videoram; - optional_shared_ptr<uint8_t> m_colorram; // for helifire /* video-related */ - emu_timer* m_cannon_timer; - int m_spacefev_red_screen; - int m_spacefev_red_cannon; int m_sheriff_color_mode; int m_sheriff_color_data; - int m_helifire_flash; - uint8_t m_helifire_LSFR[63]; - unsigned m_helifire_mv; - unsigned m_helifire_sc; /* IC56 */ /* sound-related */ - int m_n8080_hardware; emu_timer* m_sound_timer[3]; - int m_helifire_dac_phase; - double m_helifire_dac_volume; - double m_helifire_dac_timing; uint16_t m_prev_sound_pins; uint16_t m_curr_sound_pins; int m_mono_flop[3]; @@ -76,75 +60,144 @@ private: required_device<i8080_cpu_device> m_maincpu; required_device<i8035_device> m_audiocpu; optional_device<dac_bit_interface> m_n8080_dac; - optional_device<dac_8bit_r2r_device> m_helifire_dac; optional_device<sn76477_device> m_sn; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - DECLARE_WRITE8_MEMBER(n8080_shift_bits_w); - DECLARE_WRITE8_MEMBER(n8080_shift_data_w); - DECLARE_READ8_MEMBER(n8080_shift_r); - DECLARE_WRITE8_MEMBER(n8080_video_control_w); - DECLARE_WRITE8_MEMBER(n8080_sound_1_w); - DECLARE_WRITE8_MEMBER(n8080_sound_2_w); - DECLARE_READ8_MEMBER(n8080_8035_p1_r); + void n8080_shift_bits_w(uint8_t data); + void n8080_shift_data_w(uint8_t data); + uint8_t n8080_shift_r(); + void n8080_video_control_w(uint8_t data); + void n8080_sound_1_w(uint8_t data); + void n8080_sound_2_w(uint8_t data); + uint8_t n8080_8035_p1_r(); DECLARE_READ_LINE_MEMBER(n8080_8035_t0_r); DECLARE_READ_LINE_MEMBER(n8080_8035_t1_r); - DECLARE_READ_LINE_MEMBER(helifire_8035_t0_r); - DECLARE_READ_LINE_MEMBER(helifire_8035_t1_r); - DECLARE_READ8_MEMBER(helifire_8035_external_ram_r); - DECLARE_READ8_MEMBER(helifire_8035_p2_r); - DECLARE_WRITE8_MEMBER(n8080_dac_w); - DECLARE_WRITE8_MEMBER(helifire_sound_ctrl_w); + void n8080_dac_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER(n8080_inte_callback); - DECLARE_WRITE8_MEMBER(n8080_status_callback); - DECLARE_MACHINE_RESET(spacefev); - DECLARE_VIDEO_START(spacefev); + void n8080_status_callback(uint8_t data); void n8080_palette(palette_device &palette) const; - DECLARE_MACHINE_RESET(sheriff); - DECLARE_VIDEO_START(sheriff); - DECLARE_MACHINE_RESET(helifire); - DECLARE_VIDEO_START(helifire); - void helifire_palette(palette_device &palette) const; - DECLARE_SOUND_START(spacefev); - DECLARE_SOUND_RESET(spacefev); - DECLARE_SOUND_START(sheriff); - DECLARE_SOUND_RESET(sheriff); - DECLARE_SOUND_START(helifire); - DECLARE_SOUND_RESET(helifire); - DECLARE_MACHINE_START(n8080); - DECLARE_MACHINE_RESET(n8080); - uint32_t screen_update_spacefev(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_sheriff(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_helifire(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_helifire); - TIMER_CALLBACK_MEMBER(spacefev_stop_red_cannon); TIMER_DEVICE_CALLBACK_MEMBER(rst1_tick); TIMER_DEVICE_CALLBACK_MEMBER(rst2_tick); - TIMER_DEVICE_CALLBACK_MEMBER(spacefev_vco_voltage_timer); - TIMER_DEVICE_CALLBACK_MEMBER(helifire_dac_volume_timer); - void spacefev_start_red_cannon( ); - void helifire_next_line( ); - void spacefev_update_SN76477_status(); - void sheriff_update_SN76477_status(); - void update_SN76477_status(); void start_mono_flop( int n, const attotime &expire ); void stop_mono_flop( int n ); TIMER_CALLBACK_MEMBER( stop_mono_flop_callback ); - void spacefev_sound_pins_changed(); - void sheriff_sound_pins_changed(); - void helifire_sound_pins_changed(); - void sound_pins_changed(); - void delayed_sound_1( int data ); TIMER_CALLBACK_MEMBER( delayed_sound_1_callback ); - void delayed_sound_2( int data ); TIMER_CALLBACK_MEMBER( delayed_sound_2_callback ); - void helifire_main_cpu_map(address_map &map); - void helifire_sound_io_map(address_map &map); void main_cpu_map(address_map &map); void main_io_map(address_map &map); void n8080_sound_cpu_map(address_map &map); }; +class spacefev_state : public n8080_state +{ +public: + spacefev_state(const machine_config &mconfig, device_type type, const char *tag) : + n8080_state(mconfig, type, tag) + { } + + void spacefev(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void sound_start() override; + virtual void sound_reset() override; + virtual void video_start() override; + + virtual void sound_pins_changed() override; + virtual void update_SN76477_status() override; + virtual void delayed_sound_1(int data) override; + virtual void delayed_sound_2(int data) override; + +private: + void spacefev_sound(machine_config &config); + + TIMER_DEVICE_CALLBACK_MEMBER(vco_voltage_timer); + + TIMER_CALLBACK_MEMBER(stop_red_cannon); + void start_red_cannon(); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + emu_timer* m_cannon_timer; + int m_red_screen; + int m_red_cannon; +}; + +class sheriff_state : public n8080_state +{ +public: + sheriff_state(const machine_config &mconfig, device_type type, const char *tag) : + n8080_state(mconfig, type, tag) + { } + + void sheriff(machine_config &config); + void westgun2(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void sound_start() override; + virtual void sound_reset() override; + virtual void video_start() override; + + virtual void sound_pins_changed() override; + virtual void update_SN76477_status() override; + +private: + void sheriff_sound(machine_config &config); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +class helifire_state : public n8080_state +{ +public: + helifire_state(const machine_config &mconfig, device_type type, const char *tag) : + n8080_state(mconfig, type, tag), + m_dac(*this, "helifire_dac"), + m_colorram(*this, "colorram") + { } + + void helifire(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void sound_start() override; + virtual void sound_reset() override; + virtual void video_start() override; + + virtual void sound_pins_changed() override; + virtual void delayed_sound_2(int data) override; + +private: + void helifire_sound(machine_config &config); + + TIMER_DEVICE_CALLBACK_MEMBER(dac_volume_timer); + DECLARE_READ_LINE_MEMBER(helifire_8035_t0_r); + DECLARE_READ_LINE_MEMBER(helifire_8035_t1_r); + uint8_t helifire_8035_external_ram_r(); + uint8_t helifire_8035_p2_r(); + void sound_ctrl_w(uint8_t data); + void sound_io_map(address_map &map); + + void helifire_palette(palette_device &palette) const; + void next_line(); + DECLARE_WRITE_LINE_MEMBER(screen_vblank); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_cpu_map(address_map &map); + + required_device<dac_8bit_r2r_device> m_dac; + required_shared_ptr<uint8_t> m_colorram; + + int m_dac_phase; + double m_dac_volume; + double m_dac_timing; + + int m_flash; + uint8_t m_LSFR[63]; + unsigned m_mv; + unsigned m_sc; // IC56 +}; + + #endif // MAME_INCLUDES_N8080_H |