1 // license:BSD-3-Clause
2 // copyright-holders:Brad Oliver
3 #ifndef MAME_INCLUDES_MATMANIA_H
4 #define MAME_INCLUDES_MATMANIA_H
5 
6 #pragma once
7 
8 #include "machine/taito68705interface.h"
9 
10 #include "machine/gen_latch.h"
11 #include "emupal.h"
12 #include "screen.h"
13 
14 class matmania_state : public driver_device
15 {
16 public:
matmania_state(const machine_config & mconfig,device_type type,const char * tag)17 	matmania_state(const machine_config &mconfig, device_type type, const char *tag) :
18 		driver_device(mconfig, type, tag),
19 		m_videoram(*this, "videoram"),
20 		m_videoram2(*this, "videoram2"),
21 		m_videoram3(*this, "videoram3"),
22 		m_colorram(*this, "colorram"),
23 		m_colorram2(*this, "colorram2"),
24 		m_colorram3(*this, "colorram3"),
25 		m_scroll(*this, "scroll"),
26 		m_pageselect(*this, "pageselect"),
27 		m_spriteram(*this, "spriteram"),
28 		m_paletteram(*this, "paletteram"),
29 		m_maincpu(*this, "maincpu"),
30 		m_audiocpu(*this, "audiocpu"),
31 		m_mcu(*this, "mcu"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_screen(*this, "screen"),
34 		m_palette(*this, "palette"),
35 		m_soundlatch(*this, "soundlatch")
36 	{ }
37 
38 	void matmania(machine_config &config);
39 	void maniach(machine_config &config);
40 
41 protected:
42 	virtual void video_start() override;
43 
44 private:
45 	/* memory pointers */
46 	required_shared_ptr<uint8_t> m_videoram;
47 	required_shared_ptr<uint8_t> m_videoram2;
48 	required_shared_ptr<uint8_t> m_videoram3;
49 	required_shared_ptr<uint8_t> m_colorram;
50 	required_shared_ptr<uint8_t> m_colorram2;
51 	required_shared_ptr<uint8_t> m_colorram3;
52 	required_shared_ptr<uint8_t> m_scroll;
53 	required_shared_ptr<uint8_t> m_pageselect;
54 	required_shared_ptr<uint8_t> m_spriteram;
55 	required_shared_ptr<uint8_t> m_paletteram;
56 
57 	/* devices */
58 	required_device<cpu_device> m_maincpu;
59 	required_device<cpu_device> m_audiocpu;
60 	optional_device<taito68705_mcu_device> m_mcu;
61 	required_device<gfxdecode_device> m_gfxdecode;
62 	required_device<screen_device> m_screen;
63 	required_device<palette_device> m_palette;
64 	required_device<generic_latch_8_device> m_soundlatch;
65 
66 	/* video-related */
67 	std::unique_ptr<bitmap_ind16> m_tmpbitmap;
68 	std::unique_ptr<bitmap_ind16> m_tmpbitmap2;
69 
70 	uint8_t maniach_mcu_status_r();
71 	void matmania_sh_command_w(uint8_t data);
72 	void maniach_sh_command_w(uint8_t data);
73 	void matmania_paletteram_w(offs_t offset, uint8_t data);
74 	void matmania_palette(palette_device &palette) const;
75 	uint32_t screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
76 	uint32_t screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
77 	void maniach_map(address_map &map);
78 	void maniach_sound_map(address_map &map);
79 	void matmania_map(address_map &map);
80 	void matmania_sound_map(address_map &map);
81 };
82 
83 #endif // MAME_INCLUDES_MATMANIA_H
84