1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Roberto Fresca
3 #ifndef MAME_INCLUDES_SDERBY_H
4 #define MAME_INCLUDES_SDERBY_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 class sderby_state : public driver_device
12 {
13 public:
sderby_state(const machine_config & mconfig,device_type type,const char * tag)14 	sderby_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_videoram(*this, "videoram"),
17 		m_md_videoram(*this, "md_videoram"),
18 		m_fg_videoram(*this, "fg_videoram"),
19 		m_spriteram(*this, "spriteram"),
20 		m_maincpu(*this, "maincpu"),
21 		m_gfxdecode(*this, "gfxdecode"),
22 		m_palette(*this, "palette"),
23 		m_lamps(*this, "lamp%u", 1U)
24 	{ }
25 
26 	void spacewin(machine_config &config);
27 	void sderbya(machine_config &config);
28 	void pmroulet(machine_config &config);
29 	void shinygld(machine_config &config);
30 	void sderby(machine_config &config);
31 	void luckboom(machine_config &config);
32 
33 private:
34 	uint16_t sderby_input_r(offs_t offset);
35 	uint16_t sderbya_input_r(offs_t offset);
36 	uint16_t roulette_input_r(offs_t offset);
37 	uint16_t rprot_r();
38 	void rprot_w(uint16_t data);
39 	void sderby_out_w(uint16_t data);
40 	void scmatto_out_w(uint16_t data);
41 	void roulette_out_w(uint16_t data);
42 	void sderby_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
43 	void sderby_md_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
44 	void sderby_fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
45 	void sderby_scroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
46 	TILE_GET_INFO_MEMBER(get_sderby_tile_info);
47 	TILE_GET_INFO_MEMBER(get_sderby_md_tile_info);
48 	TILE_GET_INFO_MEMBER(get_sderby_fg_tile_info);
49 	uint32_t screen_update_sderby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
50 	uint32_t screen_update_pmroulet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
51 	void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int codeshift);
52 	void luckboom_map(address_map &map);
53 	void roulette_map(address_map &map);
54 	void sderby_map(address_map &map);
55 	void sderbya_map(address_map &map);
56 	void shinygld_map(address_map &map);
57 	void spacewin_map(address_map &map);
58 
machine_start()59 	virtual void machine_start() override { m_lamps.resolve(); }
60 	virtual void video_start() override;
61 
62 	required_shared_ptr<uint16_t> m_videoram;
63 	required_shared_ptr<uint16_t> m_md_videoram;
64 	required_shared_ptr<uint16_t> m_fg_videoram;
65 	required_shared_ptr<uint16_t> m_spriteram;
66 
67 	tilemap_t *m_tilemap;
68 	tilemap_t *m_md_tilemap;
69 	tilemap_t *m_fg_tilemap;
70 
71 	uint16_t m_scroll[6];
72 	required_device<cpu_device> m_maincpu;
73 	required_device<gfxdecode_device> m_gfxdecode;
74 	required_device<palette_device> m_palette;
75 	output_finder<7> m_lamps;
76 };
77 
78 #endif // MAME_INCLUDES_SDERBY_H
79