1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /*************************************************************************
4 
5     Atari Food Fight hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_FOODF_H
9 #define MAME_INCLUDES_FOODF_H
10 
11 #pragma once
12 
13 #include "machine/timer.h"
14 #include "machine/x2212.h"
15 #include "emupal.h"
16 #include "screen.h"
17 #include "tilemap.h"
18 
19 class foodf_state : public driver_device
20 {
21 public:
foodf_state(const machine_config & mconfig,device_type type,const char * tag)22 	foodf_state(const machine_config &mconfig, device_type type, const char *tag) :
23 		driver_device(mconfig, type, tag),
24 		m_maincpu(*this, "maincpu"),
25 		m_nvram(*this, "nvram"),
26 		m_screen(*this, "screen"),
27 		m_palette(*this, "palette"),
28 		m_paletteram(*this, "paletteram"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_playfield_tilemap(*this, "playfield"),
31 		m_scan_timer(*this, "scan_timer"),
32 		m_spriteram(*this, "spriteram"),
33 		m_leds(*this, "led%u", 0U)
34 	{ }
35 
36 	void foodf(machine_config &config);
37 
38 private:
39 	virtual void machine_start() override;
40 	virtual void machine_reset() override;
41 	virtual void video_start() override;
42 	void update_interrupts();
43 	void nvram_recall_w(uint16_t data);
44 	void digital_w(uint8_t data);
45 	void foodf_paletteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
46 	void foodf_set_flip(int flip);
47 	uint8_t pot_r(offs_t offset);
48 	TILE_GET_INFO_MEMBER(get_playfield_tile_info);
49 	uint32_t screen_update_foodf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
50 	TIMER_DEVICE_CALLBACK_MEMBER(scanline_update_timer);
51 	DECLARE_WRITE_LINE_MEMBER(video_int_write_line);
52 
53 	void main_map(address_map &map);
54 
55 	bool m_scanline_int_state;
56 	bool m_video_int_state;
57 
58 	required_device<cpu_device> m_maincpu;
59 	required_device<x2212_device> m_nvram;
60 	required_device<screen_device> m_screen;
61 	required_device<palette_device> m_palette;
62 	required_shared_ptr<uint16_t> m_paletteram;
63 	required_device<gfxdecode_device> m_gfxdecode;
64 	required_device<tilemap_device> m_playfield_tilemap;
65 	required_device<timer_device> m_scan_timer;
66 
67 	double          m_rweights[3];
68 	double          m_gweights[3];
69 	double          m_bweights[2];
70 	uint8_t           m_playfield_flip;
71 
72 	required_shared_ptr<uint16_t> m_spriteram;
73 	output_finder<2> m_leds;
74 };
75 
76 #endif // MAME_INCLUDES_FOODF_H
77