1 // license:BSD-3-Clause
2 // copyright-holders:Paul Leaman
3 
4 #include "machine/timer.h"
5 #include "video/bufsprite.h"
6 #include "emupal.h"
7 #include "tilemap.h"
8 
9 class srumbler_state : public driver_device
10 {
11 public:
srumbler_state(const machine_config & mconfig,device_type type,const char * tag)12 	srumbler_state(const machine_config &mconfig, device_type type, const char *tag)
13 		: driver_device(mconfig, type, tag),
14 		m_maincpu(*this,"maincpu"),
15 		m_spriteram(*this,"spriteram"),
16 		m_gfxdecode(*this, "gfxdecode"),
17 		m_palette(*this, "palette"),
18 		m_backgroundram(*this, "backgroundram"),
19 		m_foregroundram(*this, "foregroundram") { }
20 
21 	void srumbler(machine_config &config);
22 
23 private:
24 	required_device<cpu_device> m_maincpu;
25 	required_device<buffered_spriteram8_device> m_spriteram;
26 	required_device<gfxdecode_device> m_gfxdecode;
27 	required_device<palette_device> m_palette;
28 
29 	required_shared_ptr<uint8_t> m_backgroundram;
30 	required_shared_ptr<uint8_t> m_foregroundram;
31 
32 	tilemap_t *m_bg_tilemap;
33 	tilemap_t *m_fg_tilemap;
34 	int m_scroll[4];
35 
36 	void bankswitch_w(uint8_t data);
37 	void foreground_w(offs_t offset, uint8_t data);
38 	void background_w(offs_t offset, uint8_t data);
39 	void _4009_w(uint8_t data);
40 	void scroll_w(offs_t offset, uint8_t data);
41 
42 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
43 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
44 
45 	virtual void machine_start() override;
46 	virtual void video_start() override;
47 
48 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
49 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
50 
51 	TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
52 	void srumbler_map(address_map &map);
53 	void srumbler_sound_map(address_map &map);
54 };
55