1 // license:BSD-3-Clause
2 // copyright-holders:Mike Coates
3 #ifndef MAME_INCLUDES_ZAC2650_H
4 #define MAME_INCLUDES_ZAC2650_H
5 
6 #pragma once
7 
8 #include "machine/s2636.h"
9 #include "emupal.h"
10 #include "screen.h"
11 #include "tilemap.h"
12 
13 class zac2650_state : public driver_device
14 {
15 public:
zac2650_state(const machine_config & mconfig,device_type type,const char * tag)16 	zac2650_state(const machine_config &mconfig, device_type type, const char *tag) :
17 		driver_device(mconfig, type, tag),
18 		m_maincpu(*this, "maincpu"),
19 		m_s2636(*this, "s2636"),
20 		m_gfxdecode(*this, "gfxdecode"),
21 		m_screen(*this, "screen"),
22 		m_palette(*this, "palette"),
23 		m_videoram(*this, "videoram"),
24 		m_s2636_0_ram(*this, "s2636_0_ram")
25 	{ }
26 
27 	void tinvader(machine_config &config);
28 
29 protected:
30 	virtual void video_start() override;
31 
32 private:
33 	/* devices */
34 	required_device<cpu_device> m_maincpu;
35 	required_device<s2636_device> m_s2636;
36 	required_device<gfxdecode_device> m_gfxdecode;
37 	required_device<screen_device> m_screen;
38 	required_device<palette_device> m_palette;
39 
40 	/* memory pointers */
41 	required_shared_ptr<uint8_t> m_videoram;
42 	required_shared_ptr<uint8_t> m_s2636_0_ram;
43 
44 	bitmap_ind16 m_bitmap;
45 	bitmap_ind16 m_spritebitmap;
46 	int m_CollisionBackground;
47 	int m_CollisionSprite;
48 	tilemap_t *m_bg_tilemap;
49 
50 	void tinvader_sound_w(uint8_t data);
51 	void tinvader_videoram_w(offs_t offset, uint8_t data);
52 	uint8_t zac_s2636_r(offs_t offset);
53 	void zac_s2636_w(offs_t offset, uint8_t data);
54 	uint8_t tinvader_port_0_r();
55 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
56 	void zac2650_palette(palette_device &palette) const;
57 	uint32_t screen_update_tinvader(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
58 	int SpriteCollision(int first,int second);
59 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
60 
61 	void main_map(address_map &map);
62 };
63 
64 #endif // MAME_INCLUDES_ZAC2650_H
65