1 // license:BSD-3-Clause
2 // copyright-holders:Allard van der Bas
3 #ifndef MAME_INCLUDES_VASTAR_H
4 #define MAME_INCLUDES_VASTAR_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 class vastar_common_state : public driver_device
12 {
13 public:
vastar_common_state(const machine_config & mconfig,device_type type,const char * tag)14 	vastar_common_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_subcpu(*this, "sub"),
18 		m_sharedram(*this, "sharedram")
19 	{ }
20 
21 	void common(machine_config &config);
22 
23 	INTERRUPT_GEN_MEMBER(vblank_irq);
24 
25 protected:
26 	virtual void machine_start() override;
27 
28 	required_device<cpu_device> m_maincpu;
29 	required_device<cpu_device> m_subcpu;
30 
31 	required_shared_ptr<uint8_t> m_sharedram;
32 
33 	uint8_t m_nmi_mask;
34 
35 	DECLARE_WRITE_LINE_MEMBER(nmi_mask_w);
36 
37 	void cpu2_map(address_map &map);
38 	void cpu2_port_map(address_map &map);
39 	void main_port_map(address_map &map);
40 };
41 
42 class vastar_state : public vastar_common_state
43 {
44 public:
vastar_state(const machine_config & mconfig,device_type type,const char * tag)45 	vastar_state(const machine_config &mconfig, device_type type, const char *tag) :
46 		vastar_common_state(mconfig, type, tag),
47 		m_gfxdecode(*this, "gfxdecode"),
48 		m_palette(*this, "palette"),
49 		m_bg1videoram(*this, "bg1videoram"),
50 		m_bg2videoram(*this, "bg2videoram"),
51 		m_fgvideoram(*this, "fgvideoram"),
52 		m_sprite_priority(*this, "sprite_priority")
53 	{ }
54 
55 	void vastar(machine_config &config);
56 
57 protected:
58 	virtual void machine_reset() override;
59 	virtual void video_start() override;
60 
61 private:
62 	required_device<gfxdecode_device> m_gfxdecode;
63 	required_device<palette_device> m_palette;
64 
65 	required_shared_ptr<uint8_t> m_bg1videoram;
66 	required_shared_ptr<uint8_t> m_bg2videoram;
67 	required_shared_ptr<uint8_t> m_fgvideoram;
68 	required_shared_ptr<uint8_t> m_sprite_priority;
69 
70 	// these are pointers into m_fgvideoram
71 	uint8_t* m_bg1_scroll;
72 	uint8_t* m_bg2_scroll;
73 	uint8_t* m_spriteram1;
74 	uint8_t* m_spriteram2;
75 	uint8_t* m_spriteram3;
76 
77 	tilemap_t *m_fg_tilemap;
78 	tilemap_t *m_bg1_tilemap;
79 	tilemap_t *m_bg2_tilemap;
80 
81 	DECLARE_WRITE_LINE_MEMBER(flip_screen_w);
82 	void fgvideoram_w(offs_t offset, uint8_t data);
83 	void bg1videoram_w(offs_t offset, uint8_t data);
84 	void bg2videoram_w(offs_t offset, uint8_t data);
85 
86 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
87 	TILE_GET_INFO_MEMBER(get_bg1_tile_info);
88 	TILE_GET_INFO_MEMBER(get_bg2_tile_info);
89 
90 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
91 	void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
92 
93 	void main_map(address_map &map);
94 };
95 
96 class dogfightp_state : public vastar_common_state
97 {
98 public:
dogfightp_state(const machine_config & mconfig,device_type type,const char * tag)99 	dogfightp_state(const machine_config &mconfig, device_type type, const char *tag) :
100 		vastar_common_state(mconfig, type, tag)
101 	{ }
102 
103 	void dogfightp(machine_config &config);
104 
105 private:
106 	void dogfightp_main_map(address_map &map);
107 };
108 
109 #endif // MAME_INCLUDES_VASTAR_H
110