diff options
Diffstat (limited to 'src/mame/includes/sms.h')
-rw-r--r-- | src/mame/includes/sms.h | 151 |
1 files changed, 91 insertions, 60 deletions
diff --git a/src/mame/includes/sms.h b/src/mame/includes/sms.h index d40d936d346..8f855d59ccc 100644 --- a/src/mame/includes/sms.h +++ b/src/mame/includes/sms.h @@ -50,14 +50,10 @@ public: m_port_reset(*this, "RESET"), m_port_rapid(*this, "RAPID"), m_port_start(*this, "START"), - m_port_scope(*this, "SEGASCOPE"), - m_port_scope_binocular(*this, "SSCOPE_BINOCULAR"), m_port_persist(*this, "PERSISTENCE"), m_led_pwr(*this, "led_pwr"), m_region_maincpu(*this, "maincpu"), m_mainram(nullptr), - m_left_lcd(*this, "left_lcd"), - m_right_lcd(*this, "right_lcd"), m_is_gamegear(false), m_is_smsj(false), m_is_mark_iii(false), @@ -79,28 +75,16 @@ public: void sms_paln_base(machine_config &config); void sms_br_base(machine_config &config); void sms3_br(machine_config &config); - void sg1000m3(machine_config &config); - void smsj(machine_config &config); - void sms1_paln(machine_config &config); - void sms1_ntsc(machine_config &config); - void gamegear(machine_config &config); - void gamegeaj(machine_config &config); void sms3_paln(machine_config &config); - void sms1_pal(machine_config &config); void sms2_pal(machine_config &config); void sms2_kr(machine_config &config); - void sms1_br(machine_config &config); void sms2_ntsc(machine_config &config); - void sms1_kr(machine_config &config); - - DECLARE_WRITE_LINE_MEMBER(gg_pause_callback); uint32_t screen_update_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); protected: template <typename X> static void screen_sms_pal_raw_params(screen_device &screen, X &&pixelclock); template <typename X> static void screen_sms_ntsc_raw_params(screen_device &screen, X &&pixelclock); - template <typename X> static void screen_gg_raw_params(screen_device &screen, X &&pixelclock); DECLARE_READ8_MEMBER(read_0000); DECLARE_READ8_MEMBER(read_4000); @@ -116,39 +100,18 @@ protected: DECLARE_READ8_MEMBER(sms_count_r); DECLARE_READ8_MEMBER(sms_input_port_dc_r); DECLARE_READ8_MEMBER(sms_input_port_dd_r); - DECLARE_READ8_MEMBER(gg_input_port_00_r); DECLARE_READ8_MEMBER(sg1000m3_peripheral_r); DECLARE_WRITE8_MEMBER(sg1000m3_peripheral_w); - DECLARE_READ8_MEMBER(gg_sio_r); - DECLARE_WRITE8_MEMBER(gg_sio_w); - DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); DECLARE_READ8_MEMBER(smsj_audio_control_r); DECLARE_WRITE8_MEMBER(smsj_audio_control_w); DECLARE_WRITE8_MEMBER(smsj_ym2413_register_port_w); DECLARE_WRITE8_MEMBER(smsj_ym2413_data_port_w); - DECLARE_READ8_MEMBER(sms_sscope_r); - DECLARE_WRITE8_MEMBER(sms_sscope_w); - DECLARE_WRITE_LINE_MEMBER(sms_n_csync_callback); + DECLARE_WRITE_LINE_MEMBER(rapid_n_csync_callback); DECLARE_WRITE_LINE_MEMBER(sms_ctrl1_th_input); DECLARE_WRITE_LINE_MEMBER(sms_ctrl2_th_input); - DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); - - DECLARE_VIDEO_START(gamegear); - DECLARE_VIDEO_RESET(gamegear); - DECLARE_VIDEO_START(sms1); - DECLARE_VIDEO_RESET(sms1); - uint32_t screen_update_sms1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_sms1_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_sms1_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(screen_vblank_sms1); - - void gg_io(address_map &map); void sg1000m3_io(address_map &map); - void sms1_mem(address_map &map); void sms_io(address_map &map); void sms_mem(address_map &map); void smsj_io(address_map &map); @@ -178,8 +141,6 @@ protected: optional_ioport m_port_reset; optional_ioport m_port_rapid; optional_ioport m_port_start; - optional_ioport m_port_scope; - optional_ioport m_port_scope_binocular; optional_ioport m_port_persist; output_finder<> m_led_pwr; @@ -189,22 +150,10 @@ protected: std::unique_ptr<uint8_t[]> m_mainram; uint8_t *m_BIOS; - // for 3D glass binocular hack - optional_device<screen_device> m_left_lcd; - optional_device<screen_device> m_right_lcd; - bitmap_rgb32 m_prevleft_bitmap; - bitmap_rgb32 m_prevright_bitmap; - // for gamegear LCD persistence hack bitmap_rgb32 m_prev_bitmap; bool m_prev_bitmap_copied; - // for gamegear SMS mode scaling - bitmap_rgb32 m_gg_sms_mode_bitmap; - // line_buffer will be used to hold 4 lines of line data as a kind of cache for - // vertical scaling in the gamegear sms compatibility mode. - std::unique_ptr<int[]> m_line_buffer; - // model identifiers bool m_is_gamegear; bool m_is_smsj; @@ -227,8 +176,6 @@ protected: uint8_t m_smsj_audio_control; uint8_t m_port_dc_reg; uint8_t m_port_dd_reg; - uint8_t m_gg_sio[5]; - int m_gg_paused; uint8_t m_ctrl1_th_state; uint8_t m_ctrl2_th_state; @@ -240,10 +187,6 @@ protected: emu_timer *m_lphaser_th_timer; TIMER_CALLBACK_MEMBER(lphaser_th_generate); - // Data needed for SegaScope (3D glasses) - uint8_t m_sscope_state; - uint8_t m_frame_sscope_state; - // Data needed for Rapid button (smsj, sms1kr, sms1krfm) uint16_t m_csync_counter; uint8_t m_rapid_mode; @@ -259,11 +202,57 @@ protected: optional_device<sg1000_expansion_slot_device> m_sgexpslot; }; -class smssdisp_state : public sms_state +class sms1_state : public sms_state { public: - smssdisp_state(const machine_config &mconfig, device_type type, const char *tag) : + sms1_state(const machine_config &mconfig, device_type type, const char *tag) : sms_state(mconfig, type, tag), + m_left_lcd(*this, "left_lcd"), + m_right_lcd(*this, "right_lcd"), + m_port_scope(*this, "SEGASCOPE"), + m_port_scope_binocular(*this, "SSCOPE_BINOCULAR") + { } + + void sms1_paln(machine_config &config); + void sms1_ntsc(machine_config &config); + void sms1_pal(machine_config &config); + void sms1_br(machine_config &config); + void sms1_kr(machine_config &config); + void smsj(machine_config &config); + void sg1000m3(machine_config &config); + +protected: + virtual void video_start() override; + virtual void video_reset() override; + +private: + DECLARE_READ8_MEMBER(sscope_r); + DECLARE_WRITE8_MEMBER(sscope_w); + + DECLARE_WRITE_LINE_MEMBER(sscope_vblank); + uint32_t screen_update_left(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void sms1_mem(address_map &map); + + // for 3D glass binocular hack + required_device<screen_device> m_left_lcd; + required_device<screen_device> m_right_lcd; + required_ioport m_port_scope; + required_ioport m_port_scope_binocular; + bitmap_rgb32 m_prevleft_bitmap; + bitmap_rgb32 m_prevright_bitmap; + + // Data needed for SegaScope (3D glasses) + uint8_t m_sscope_state; + uint8_t m_frame_sscope_state; +}; + +class smssdisp_state : public sms1_state +{ +public: + smssdisp_state(const machine_config &mconfig, device_type type, const char *tag) : + sms1_state(mconfig, type, tag), m_control_cpu(*this, "control"), m_slots(*this, {"slot", "slot2", "slot3", "slot4", "slot5", "slot6", "slot7", "slot8", "slot9", "slot10", "slot11", "slot12", "slot13", "slot14", "slot15", "slot16"}), m_cards(*this, "slot%u", 17U), @@ -296,6 +285,48 @@ private: uint8_t m_store_cart_selection_data; }; +class gamegear_state : public sms_state +{ +public: + gamegear_state(const machine_config &mconfig, device_type type, const char *tag) : + sms_state(mconfig, type, tag) + { } + + void gamegear(machine_config &config); + void gamegeaj(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + virtual void video_reset() override; + +private: + template <typename X> static void screen_gg_raw_params(screen_device &screen, X &&pixelclock); + + DECLARE_READ8_MEMBER(gg_input_port_00_r); + DECLARE_READ8_MEMBER(gg_sio_r); + DECLARE_WRITE8_MEMBER(gg_sio_w); + DECLARE_WRITE8_MEMBER(gg_psg_stereo_w); + + DECLARE_WRITE_LINE_MEMBER(gg_pause_callback); + DECLARE_WRITE_LINE_MEMBER(gg_ext_th_input); + + uint32_t screen_update_gamegear(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void screen_gg_sms_mode_scaling(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void gg_io(address_map &map); + + // for gamegear SMS mode scaling + bitmap_rgb32 m_gg_sms_mode_bitmap; + // line_buffer will be used to hold 4 lines of line data as a kind of cache for + // vertical scaling in the gamegear sms compatibility mode. + std::unique_ptr<int[]> m_line_buffer; + + uint8_t m_gg_sio[5]; + int m_gg_paused; +}; + /*----------- defined in machine/sms.c -----------*/ |