1 // license:BSD-3-Clause
2 // copyright-holders:Mike Balfour
3 /*************************************************************************
4 
5     Atari Canyon Bomber hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CANYON_H
9 #define MAME_INCLUDES_CANYON_H
10 
11 #pragma once
12 
13 #include "machine/74259.h"
14 #include "machine/watchdog.h"
15 #include "sound/discrete.h"
16 #include "emupal.h"
17 #include "tilemap.h"
18 
19 /* Discrete Sound Input Nodes */
20 #define CANYON_MOTOR1_DATA      NODE_01
21 #define CANYON_MOTOR2_DATA      NODE_02
22 #define CANYON_EXPLODE_DATA     NODE_03
23 #define CANYON_WHISTLE1_EN      NODE_04
24 #define CANYON_WHISTLE2_EN      NODE_05
25 #define CANYON_ATTRACT1_EN      NODE_06
26 #define CANYON_ATTRACT2_EN      NODE_07
27 
28 
29 
30 class canyon_state : public driver_device
31 {
32 public:
canyon_state(const machine_config & mconfig,device_type type,const char * tag)33 	canyon_state(const machine_config &mconfig, device_type type, const char *tag) :
34 		driver_device(mconfig, type, tag),
35 		m_videoram(*this, "videoram"),
36 		m_outlatch(*this, "outlatch"),
37 		m_discrete(*this, "discrete"),
38 		m_maincpu(*this, "maincpu"),
39 		m_watchdog(*this, "watchdog"),
40 		m_gfxdecode(*this, "gfxdecode"),
41 		m_palette(*this, "palette")
42 	{ }
43 
44 	void canyon(machine_config &config);
45 
46 protected:
47 	uint8_t canyon_switches_r(offs_t offset);
48 	uint8_t canyon_options_r(offs_t offset);
49 	void output_latch_w(offs_t offset, uint8_t data);
50 	void canyon_videoram_w(offs_t offset, uint8_t data);
51 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
52 	void canyon_palette(palette_device &palette) const;
53 	uint32_t screen_update_canyon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54 	void canyon_motor_w(offs_t offset, uint8_t data);
55 	void canyon_explode_w(uint8_t data);
56 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
57 	void draw_bombs( bitmap_ind16 &bitmap, const rectangle &cliprect );
58 
59 	virtual void video_start() override;
60 	void main_map(address_map &map);
61 
62 private:
63 	/* memory pointers */
64 	required_shared_ptr<uint8_t> m_videoram;
65 
66 	required_device<f9334_device> m_outlatch;
67 	required_device<discrete_sound_device> m_discrete;
68 
69 	/* video-related */
70 	tilemap_t  *m_bg_tilemap;
71 
72 	required_device<cpu_device> m_maincpu;
73 	required_device<watchdog_timer_device> m_watchdog;
74 	required_device<gfxdecode_device> m_gfxdecode;
75 	required_device<palette_device> m_palette;
76 };
77 
78 
79 /*----------- defined in audio/canyon.c -----------*/
80 DISCRETE_SOUND_EXTERN( canyon_discrete );
81 
82 #endif // MAME_INCLUDES_CANYON_H
83