1 // license:BSD-3-Clause
2 // copyright-holders:Manuel Abadia, Mike Coates, Nicola Salmoria, Miguel Angel Horna
3 #ifndef MAME_INCLUDES_WRALLY_H
4 #define MAME_INCLUDES_WRALLY_H
5 
6 #pragma once
7 
8 #include "machine/74259.h"
9 #include "video/gaelco_wrally_sprites.h"
10 #include "emupal.h"
11 #include "tilemap.h"
12 
13 class wrally_state : public driver_device
14 {
15 public:
wrally_state(const machine_config & mconfig,device_type type,const char * tag)16 	wrally_state(const machine_config &mconfig, device_type type, const char *tag) :
17 		driver_device(mconfig, type, tag),
18 		m_maincpu(*this, "maincpu"),
19 		m_outlatch(*this, "outlatch"),
20 		m_gfxdecode(*this, "gfxdecode"),
21 		m_palette(*this, "palette"),
22 		m_sprites(*this, "sprites"),
23 		m_okibank(*this, "okibank"),
24 		m_videoram(*this, "videoram"),
25 		m_vregs(*this, "vregs"),
26 		m_spriteram(*this, "spriteram"),
27 		m_shareram(*this, "shareram"),
28 		m_tilemap{ nullptr, nullptr }
29 	{
30 	}
31 
32 	void wrally(machine_config &config);
33 
34 private:
35 	uint8_t shareram_r(offs_t offset);
36 	void shareram_w(offs_t offset, uint8_t data);
37 	void vram_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
38 	DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
39 	void okim6295_bankswitch_w(uint8_t data);
40 	DECLARE_WRITE_LINE_MEMBER(coin1_counter_w);
41 	DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
42 	DECLARE_WRITE_LINE_MEMBER(coin1_lockout_w);
43 	DECLARE_WRITE_LINE_MEMBER(coin2_lockout_w);
44 
45 	template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
46 
47 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48 
49 	virtual void machine_start() override;
50 	virtual void video_start() override;
51 	void mcu_hostmem_map(address_map &map);
52 	void oki_map(address_map &map);
53 	void wrally_map(address_map &map);
54 
55 	required_device<cpu_device> m_maincpu;
56 	required_device<ls259_device> m_outlatch;
57 	required_device<gfxdecode_device> m_gfxdecode;
58 	required_device<palette_device> m_palette;
59 	required_device<gaelco_wrally_sprites_device> m_sprites;
60 	required_memory_bank m_okibank;
61 
62 	required_shared_ptr<uint16_t> m_videoram;
63 	required_shared_ptr<uint16_t> m_vregs;
64 	required_shared_ptr<uint16_t> m_spriteram;
65 	required_shared_ptr<uint16_t> m_shareram;
66 
67 	tilemap_t *m_tilemap[2];
68 };
69 
70 #endif // MAME_INCLUDES_WRALLY_H
71