1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Nicola Salmoria
3 #ifndef MAME_INCLUDES_USGAMES_H
4 #define MAME_INCLUDES_USGAMES_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "video/mc6845.h"
10 
11 class usgames_state : public driver_device
12 {
13 public:
usgames_state(const machine_config & mconfig,device_type type,const char * tag)14 	usgames_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_gfxdecode(*this, "gfxdecode"),
18 		m_videoram(*this, "videoram"),
19 		m_charram(*this, "charram"),
20 		m_leds(*this, "led%u", 0U),
21 		m_palette(*this, "palette")
22 	{ }
23 
24 	void usg32(machine_config &config);
25 	void usg185(machine_config &config);
26 
27 protected:
28 	virtual void machine_start() override;
29 	virtual void video_start() override;
30 
31 private:
32 	required_device<cpu_device> m_maincpu;
33 	required_device<gfxdecode_device> m_gfxdecode;
34 
35 	required_shared_ptr<uint8_t> m_videoram;
36 	required_shared_ptr<uint8_t> m_charram;
37 
38 	output_finder<5> m_leds;
39 	required_device<palette_device> m_palette;
40 
41 	void rombank_w(uint8_t data);
42 	void lamps1_w(uint8_t data);
43 	void lamps2_w(uint8_t data);
44 	void charram_w(offs_t offset, uint8_t data);
45 
46 	void usgames_palette(palette_device &palette) const;
47 
48 	void usg185_map(address_map &map);
49 	void usgames_map(address_map &map);
50 	MC6845_UPDATE_ROW(update_row);
51 };
52 
53 #endif // MAME_INCLUDES_USGAMES_H
54