1 // license:BSD-3-Clause
2 // copyright-holders:Stefan Jokisch
3 /*************************************************************************
4 
5     Atari Pool Shark hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_POOLSHRK_H
9 #define MAME_INCLUDES_POOLSHRK_H
10 
11 #pragma once
12 
13 #include "machine/watchdog.h"
14 #include "sound/discrete.h"
15 #include "emupal.h"
16 #include "tilemap.h"
17 
18 /* Discrete Sound Input Nodes */
19 
20 class poolshrk_state : public driver_device
21 {
22 public:
poolshrk_state(const machine_config & mconfig,device_type type,const char * tag)23 	poolshrk_state(const machine_config &mconfig, device_type type, const char *tag) :
24 		driver_device(mconfig, type, tag),
25 		m_maincpu(*this, "maincpu"),
26 		m_watchdog(*this, "watchdog"),
27 		m_gfxdecode(*this, "gfxdecode"),
28 		m_palette(*this, "palette"),
29 		m_discrete(*this, "discrete"),
30 		m_playfield_ram(*this, "playfield_ram"),
31 		m_hpos_ram(*this, "hpos_ram"),
32 		m_vpos_ram(*this, "vpos_ram"),
33 		m_leds(*this, "led%u", 0U)
34 	{ }
35 
36 	void poolshrk(machine_config &config);
37 
38 	void init_poolshrk();
39 
40 private:
41 	void da_latch_w(uint8_t data);
42 	void led_w(offs_t offset, uint8_t data);
43 	void watchdog_w(offs_t offset, uint8_t data);
44 	uint8_t input_r(offs_t offset);
45 	uint8_t irq_reset_r();
46 	void scratch_sound_w(offs_t offset, uint8_t data);
47 	void score_sound_w(uint8_t data);
48 	void click_sound_w(uint8_t data);
49 	void bump_sound_w(offs_t offset, uint8_t data);
50 
51 	TILE_GET_INFO_MEMBER(get_tile_info);
52 
53 	void poolshrk_palette(palette_device &palette) const;
54 
55 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
56 	virtual void video_start() override;
57 	void poolshrk_cpu_map(address_map &map);
machine_start()58 	virtual void machine_start() override { m_leds.resolve(); }
59 
60 	required_device<cpu_device> m_maincpu;
61 	required_device<watchdog_timer_device> m_watchdog;
62 	required_device<gfxdecode_device> m_gfxdecode;
63 	required_device<palette_device> m_palette;
64 	required_device<discrete_device> m_discrete;
65 
66 	required_shared_ptr<uint8_t> m_playfield_ram;
67 	required_shared_ptr<uint8_t> m_hpos_ram;
68 	required_shared_ptr<uint8_t> m_vpos_ram;
69 	output_finder<2> m_leds;
70 
71 	tilemap_t* m_bg_tilemap;
72 	int m_da_latch;
73 };
74 
75 
76 /*----------- defined in audio/poolshrk.c -----------*/
77 DISCRETE_SOUND_EXTERN( poolshrk_discrete );
78 
79 #endif // MAME_INCLUDES_POOLSHRK_H
80