1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari
3 #ifndef MAME_INCLUDES_SUPRLOCO_H
4 #define MAME_INCLUDES_SUPRLOCO_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 class suprloco_state : public driver_device
12 {
13 public:
suprloco_state(const machine_config & mconfig,device_type type,const char * tag)14 	suprloco_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_audiocpu(*this, "audiocpu"),
18 		m_gfxdecode(*this, "gfxdecode"),
19 		m_spriteram(*this, "spriteram"),
20 		m_videoram(*this, "videoram"),
21 		m_scrollram(*this, "scrollram"),
22 		m_decrypted_opcodes(*this, "decrypted_opcodes")
23 	{ }
24 
25 	void suprloco(machine_config &config);
26 
27 	void init_suprloco();
28 
29 private:
30 	required_device<cpu_device> m_maincpu;
31 	required_device<cpu_device> m_audiocpu;
32 	required_device<gfxdecode_device> m_gfxdecode;
33 
34 	required_shared_ptr<uint8_t> m_spriteram;
35 	required_shared_ptr<uint8_t> m_videoram;
36 	required_shared_ptr<uint8_t> m_scrollram;
37 	required_shared_ptr<uint8_t> m_decrypted_opcodes;
38 
39 	tilemap_t *m_bg_tilemap;
40 	int m_control;
41 
42 	void videoram_w(offs_t offset, uint8_t data);
43 	void scrollram_w(offs_t offset, uint8_t data);
44 	void control_w(uint8_t data);
45 
46 	TILE_GET_INFO_MEMBER(get_tile_info);
47 
48 	virtual void video_start() override;
49 	void suprloco_palette(palette_device &palette) const;
50 
51 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
52 	inline void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip);
53 	void draw_sprite(bitmap_ind16 &bitmap,const rectangle &cliprect,int spr_number);
54 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
55 	void decrypted_opcodes_map(address_map &map);
56 	void main_map(address_map &map);
57 	void sound_map(address_map &map);
58 };
59 
60 #endif // MAME_INCLUDES_SUPRLOCO_H
61