1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 /*************************************************************************
4 
5     Super Slams
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_SUPRSLAM_H
9 #define MAME_INCLUDES_SUPRSLAM_H
10 
11 #pragma once
12 
13 #include "video/vsystem_spr.h"
14 #include "machine/gen_latch.h"
15 #include "video/k053936.h"
16 #include "tilemap.h"
17 
18 class suprslam_state : public driver_device
19 {
20 public:
suprslam_state(const machine_config & mconfig,device_type type,const char * tag)21 	suprslam_state(const machine_config &mconfig, device_type type, const char *tag) :
22 		driver_device(mconfig, type, tag),
23 		m_screen_videoram(*this, "screen_videoram"),
24 		m_bg_videoram(*this, "bg_videoram"),
25 		m_sp_videoram(*this, "sp_videoram"),
26 		m_spriteram(*this, "spriteram"),
27 		m_screen_vregs(*this, "screen_vregs"),
28 		m_maincpu(*this, "maincpu"),
29 		m_audiocpu(*this, "audiocpu"),
30 		m_k053936(*this, "k053936"),
31 		m_spr(*this, "vsystem_spr"),
32 		m_palette(*this, "palette"),
33 		m_gfxdecode(*this, "gfxdecode"),
34 		m_soundlatch(*this, "soundlatch")
35 	{ }
36 
37 	void suprslam(machine_config &config);
38 
39 protected:
40 	virtual void machine_start() override;
41 	virtual void machine_reset() override;
42 	virtual void video_start() override;
43 
44 private:
45 	/* memory pointers */
46 	required_shared_ptr<uint16_t> m_screen_videoram;
47 	required_shared_ptr<uint16_t> m_bg_videoram;
48 	required_shared_ptr<uint16_t> m_sp_videoram;
49 	required_shared_ptr<uint16_t> m_spriteram;
50 	required_shared_ptr<uint16_t> m_screen_vregs;
51 
52 	/* video-related */
53 	tilemap_t     *m_screen_tilemap;
54 	tilemap_t     *m_bg_tilemap;
55 	uint16_t      m_screen_bank;
56 	uint16_t      m_bg_bank;
57 	uint32_t  suprslam_tile_callback( uint32_t code );
58 	uint8_t       m_spr_ctrl;
59 
60 	/* devices */
61 	required_device<cpu_device> m_maincpu;
62 	required_device<cpu_device> m_audiocpu;
63 	required_device<k053936_device> m_k053936;
64 	required_device<vsystem_spr_device> m_spr;
65 	required_device<palette_device> m_palette;
66 	required_device<gfxdecode_device> m_gfxdecode;
67 	required_device<generic_latch_8_device> m_soundlatch;
68 
69 	void suprslam_sh_bankswitch_w(uint8_t data);
70 	void suprslam_screen_videoram_w(offs_t offset, uint16_t data);
71 	void suprslam_bg_videoram_w(offs_t offset, uint16_t data);
72 	void suprslam_bank_w(uint16_t data);
73 	void spr_ctrl_w(uint8_t data);
74 	TILE_GET_INFO_MEMBER(get_suprslam_tile_info);
75 	TILE_GET_INFO_MEMBER(get_suprslam_bg_tile_info);
76 	uint32_t screen_update_suprslam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
77 
78 	void sound_io_map(address_map &map);
79 	void sound_map(address_map &map);
80 	void suprslam_map(address_map &map);
81 };
82 
83 #endif // MAME_INCLUDES_SUPRSLAM_H
84