1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail, David Graves
3 #ifndef MAME_INCLUDES_SUPERCHS_H
4 #define MAME_INCLUDES_SUPERCHS_H
5 
6 #pragma once
7 
8 #include "machine/eepromser.h"
9 #include "video/tc0480scp.h"
10 #include "emupal.h"
11 
12 class superchs_state : public driver_device
13 {
14 public:
superchs_state(const machine_config & mconfig,device_type type,const char * tag)15 	superchs_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_ram(*this,"ram"),
18 		m_spriteram(*this,"spriteram"),
19 		m_shared_ram(*this,"shared_ram"),
20 		m_spritemap(*this,"spritemap"),
21 		m_maincpu(*this, "maincpu"),
22 		m_subcpu(*this, "sub"),
23 		m_tc0480scp(*this, "tc0480scp"),
24 		m_eeprom(*this, "eeprom"),
25 		m_gfxdecode(*this, "gfxdecode"),
26 		m_palette(*this, "palette"),
27 		m_volume(*this, "SOUND")
28 	{ }
29 
30 	void superchs(machine_config &config);
31 	void chase3(machine_config &config);
32 	void init_superchs();
33 
34 protected:
35 	virtual void video_start() override;
36 
37 private:
38 	struct schs_tempsprite
39 	{
40 		u8 gfx;
41 		u32 code,color;
42 		bool flipx,flipy;
43 		int x,y;
44 		int zoomx,zoomy;
45 		u32 primask;
46 	};
47 
48 	required_shared_ptr<u32> m_ram;
49 	required_shared_ptr<u32> m_spriteram;
50 	required_shared_ptr<u16> m_shared_ram;
51 	required_region_ptr<u16> m_spritemap;
52 
53 	std::unique_ptr<schs_tempsprite[]> m_spritelist;
54 
55 	u16 shared_ram_r(offs_t offset);
56 	void shared_ram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
57 	void cpua_ctrl_w(offs_t offset, u32 data, u32 mem_mask = ~0);
58 	void coin_word_w(u8 data);
59 	u8 volume_r();
60 	u32 main_cycle_r();
61 	u16 sub_cycle_r();
62 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
63 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const u32 *primasks, int x_offs, int y_offs);
64 	required_device<cpu_device> m_maincpu;
65 	required_device<cpu_device> m_subcpu;
66 	required_device<tc0480scp_device> m_tc0480scp;
67 	required_device<eeprom_serial_93cxx_device> m_eeprom;
68 	required_device<gfxdecode_device> m_gfxdecode;
69 	required_device<palette_device> m_palette;
70 	required_ioport m_volume;
71 	void chase3_cpub_map(address_map &map);
72 	void superchs_cpub_map(address_map &map);
73 	void superchs_map(address_map &map);
74 };
75 
76 #endif // MAME_INCLUDES_SUPERCHS_H
77