1 // license:BSD-3-Clause
2 // copyright-holders:Paul Leaman, Curt Coder
3 #ifndef MAME_INCLUDES_SIDEARMS_H
4 #define MAME_INCLUDES_SIDEARMS_H
5 
6 #pragma once
7 
8 #include "video/bufsprite.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class sidearms_state : public driver_device
13 {
14 public:
sidearms_state(const machine_config & mconfig,device_type type,const char * tag)15 	sidearms_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_maincpu(*this, "maincpu"),
18 		m_audiocpu(*this, "audiocpu"),
19 		m_gfxdecode(*this, "gfxdecode"),
20 		m_palette(*this, "palette"),
21 		m_spriteram(*this, "spriteram") ,
22 		m_bg_scrollx(*this, "bg_scrollx"),
23 		m_bg_scrolly(*this, "bg_scrolly"),
24 		m_videoram(*this, "videoram"),
25 		m_colorram(*this, "colorram"),
26 		m_ports(*this, { { "SYSTEM", "P1", "P2", "DSW0", "DSW1" } })
27 	{
28 	}
29 
30 	void sidearms(machine_config &config);
31 	void turtship(machine_config &config);
32 	void whizz(machine_config &config);
33 
34 	void init_dyger();
35 	void init_sidearms();
36 	void init_whizz();
37 	void init_turtship();
38 
39 private:
40 	required_device<cpu_device> m_maincpu;
41 	required_device<cpu_device> m_audiocpu;
42 	required_device<gfxdecode_device> m_gfxdecode;
43 	required_device<palette_device> m_palette;
44 	required_device<buffered_spriteram8_device> m_spriteram;
45 
46 	required_shared_ptr<uint8_t> m_bg_scrollx;
47 	required_shared_ptr<uint8_t> m_bg_scrolly;
48 	required_shared_ptr<uint8_t> m_videoram;
49 	required_shared_ptr<uint8_t> m_colorram;
50 
51 	optional_ioport_array<5> m_ports;
52 
53 	int m_gameid;
54 
55 	uint8_t *m_tilerom;
56 	tilemap_t *m_bg_tilemap;
57 	tilemap_t *m_fg_tilemap;
58 
59 	int m_bgon;
60 	int m_objon;
61 	int m_staron;
62 	int m_charon;
63 	int m_flipon;
64 
65 	uint32_t m_hflop_74a_n;
66 	uint32_t m_hcount_191;
67 	uint32_t m_vcount_191;
68 	uint32_t m_latch_374;
69 
70 	void bankswitch_w(uint8_t data);
71 	void videoram_w(offs_t offset, uint8_t data);
72 	void colorram_w(offs_t offset, uint8_t data);
73 	void c804_w(uint8_t data);
74 	void gfxctrl_w(uint8_t data);
75 	void star_scrollx_w(uint8_t data);
76 	void star_scrolly_w(uint8_t data);
77 
78 	uint8_t turtship_ports_r(offs_t offset);
79 
80 	void whizz_bankswitch_w(uint8_t data);
81 
82 	virtual void machine_start() override;
83 	virtual void video_start() override;
84 
85 	TILE_GET_INFO_MEMBER(get_sidearms_bg_tile_info);
86 	TILE_GET_INFO_MEMBER(get_philko_bg_tile_info);
87 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
88 	TILEMAP_MAPPER_MEMBER(tilemap_scan);
89 
90 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
91 	void draw_sprites_region(bitmap_ind16 &bitmap, const rectangle &cliprect, int start_offset, int end_offset );
92 	void draw_starfield( bitmap_ind16 &bitmap );
93 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
94 
95 	void sidearms_map(address_map &map);
96 	void sidearms_sound_map(address_map &map);
97 	void turtship_map(address_map &map);
98 	void whizz_io_map(address_map &map);
99 	void whizz_map(address_map &map);
100 	void whizz_sound_map(address_map &map);
101 };
102 
103 #endif // MAME_INCLUDES_SIDEARMS_H
104