1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 #ifndef MAME_INCLUDES_WWFSSTAR_H
4 #define MAME_INCLUDES_WWFSSTAR_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "machine/timer.h"
10 #include "emupal.h"
11 #include "screen.h"
12 #include "tilemap.h"
13 
14 class wwfsstar_state : public driver_device
15 {
16 public:
wwfsstar_state(const machine_config & mconfig,device_type type,const char * tag)17 	wwfsstar_state(const machine_config &mconfig, device_type type, const char *tag) :
18 		driver_device(mconfig, type, tag),
19 		m_maincpu(*this, "maincpu"),
20 		m_audiocpu(*this, "audiocpu"),
21 		m_gfxdecode(*this, "gfxdecode"),
22 		m_screen(*this, "screen"),
23 		m_palette(*this, "palette"),
24 		m_soundlatch(*this, "soundlatch"),
25 		m_spriteram(*this, "spriteram"),
26 		m_fg0_videoram(*this, "fg0_videoram"),
27 		m_bg0_videoram(*this, "bg0_videoram")
28 	{ }
29 
30 	void wwfsstar(machine_config &config);
31 
32 	DECLARE_READ_LINE_MEMBER(vblank_r);
33 
34 protected:
35 	virtual void video_start() override;
36 
37 private:
38 	required_device<cpu_device> m_maincpu;
39 	required_device<cpu_device> m_audiocpu;
40 	required_device<gfxdecode_device> m_gfxdecode;
41 	required_device<screen_device> m_screen;
42 	required_device<palette_device> m_palette;
43 	required_device<generic_latch_8_device> m_soundlatch;
44 
45 	required_shared_ptr<uint16_t> m_spriteram;
46 	required_shared_ptr<uint16_t> m_fg0_videoram;
47 	required_shared_ptr<uint16_t> m_bg0_videoram;
48 
49 	int m_vblank;
50 	int m_scrollx;
51 	int m_scrolly;
52 	tilemap_t *m_fg0_tilemap;
53 	tilemap_t *m_bg0_tilemap;
54 
55 	void scroll_w(offs_t offset, uint16_t data);
56 	void flipscreen_w(uint16_t data);
57 	void irqack_w(offs_t offset, uint16_t data);
58 	void fg0_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
59 	void bg0_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
60 
61 	TIMER_DEVICE_CALLBACK_MEMBER(scanline);
62 
63 	TILE_GET_INFO_MEMBER(get_fg0_tile_info);
64 	TILEMAP_MAPPER_MEMBER(bg0_scan);
65 	TILE_GET_INFO_MEMBER(get_bg0_tile_info);
66 
67 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
69 
70 	void main_map(address_map &map);
71 	void sound_map(address_map &map);
72 };
73 
74 #endif // MAME_INCLUDES_WWFSSTAR_H
75