1 // license:BSD-3-Clause
2 // copyright-holders:Mike Balfour
3 #ifndef MAME_INCLUDES_RUNAWAY_H
4 #define MAME_INCLUDES_RUNAWAY_H
5 
6 #pragma once
7 
8 #include "machine/er2055.h"
9 #include "emupal.h"
10 #include "screen.h"
11 #include "tilemap.h"
12 
13 class runaway_state : public driver_device
14 {
15 public:
runaway_state(const machine_config & mconfig,device_type type,const char * tag)16 	runaway_state(const machine_config &mconfig, device_type type, const char *tag)
17 		: driver_device(mconfig, type, tag)
18 		, m_video_ram(*this, "video_ram")
19 		, m_sprite_ram(*this, "sprite_ram")
20 		, m_maincpu(*this, "maincpu")
21 		, m_earom(*this, "earom")
22 		, m_gfxdecode(*this, "gfxdecode")
23 		, m_screen(*this, "screen")
24 		, m_palette(*this, "palette")
25 	{ }
26 
27 	void qwak(machine_config &config);
28 	void runaway(machine_config &config);
29 
30 private:
31 	uint8_t runaway_input_r(offs_t offset);
32 	void runaway_irq_ack_w(uint8_t data);
33 	uint8_t earom_read();
34 	void earom_write(offs_t offset, uint8_t data);
35 	void earom_control_w(uint8_t data);
36 	void runaway_paletteram_w(offs_t offset, uint8_t data);
37 	void runaway_video_ram_w(offs_t offset, uint8_t data);
38 	DECLARE_WRITE_LINE_MEMBER(tile_bank_w);
39 	uint8_t runaway_pot_r(offs_t offset);
40 	TILE_GET_INFO_MEMBER(runaway_get_tile_info);
41 	TILE_GET_INFO_MEMBER(qwak_get_tile_info);
42 	DECLARE_VIDEO_START(qwak);
43 	uint32_t screen_update_runaway(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44 	uint32_t screen_update_qwak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
45 	TIMER_CALLBACK_MEMBER(interrupt_callback);
46 	void runaway_map(address_map &map);
47 	void qwak_map(address_map &map);
48 
49 	virtual void machine_start() override;
50 	virtual void machine_reset() override;
51 	virtual void video_start() override;
52 
53 	emu_timer *m_interrupt_timer;
54 	required_shared_ptr<uint8_t> m_video_ram;
55 	required_shared_ptr<uint8_t> m_sprite_ram;
56 	tilemap_t *m_bg_tilemap;
57 	int m_tile_bank;
58 	required_device<cpu_device> m_maincpu;
59 	optional_device<er2055_device> m_earom;
60 	required_device<gfxdecode_device> m_gfxdecode;
61 	required_device<screen_device> m_screen;
62 	required_device<palette_device> m_palette;
63 };
64 
65 #endif // MAME_INCLUDES_RUNAWAY_H
66