1 // license:BSD-3-Clause
2 // copyright-holders:Mike Balfour
3 /*************************************************************************
4 
5     Atari Skydiver hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_SKYDIVER_H
9 #define MAME_INCLUDES_SKYDIVER_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 SKYDIVER_RANGE_DATA     NODE_01
21 #define SKYDIVER_NOTE_DATA      NODE_02
22 #define SKYDIVER_RANGE3_EN      NODE_03
23 #define SKYDIVER_NOISE_DATA     NODE_04
24 #define SKYDIVER_NOISE_RST      NODE_05
25 #define SKYDIVER_WHISTLE1_EN    NODE_06
26 #define SKYDIVER_WHISTLE2_EN    NODE_07
27 #define SKYDIVER_OCT1_EN        NODE_08
28 #define SKYDIVER_OCT2_EN        NODE_09
29 #define SKYDIVER_SOUND_EN       NODE_10
30 
31 
32 class skydiver_state : public driver_device
33 {
34 public:
skydiver_state(const machine_config & mconfig,device_type type,const char * tag)35 	skydiver_state(const machine_config &mconfig, device_type type, const char *tag) :
36 		driver_device(mconfig, type, tag),
37 		m_maincpu(*this, "maincpu"),
38 		m_watchdog(*this, "watchdog"),
39 		m_latch3(*this, "latch3"),
40 		m_discrete(*this, "discrete"),
41 		m_gfxdecode(*this, "gfxdecode"),
42 		m_palette(*this, "palette"),
43 		m_videoram(*this, "videoram"),
44 		m_leds(*this, "led%u", 0U),
45 		m_lamp_s(*this, "lamps"),
46 		m_lamp_k(*this, "lampk"),
47 		m_lamp_y(*this, "lampy"),
48 		m_lamp_d(*this, "lampd"),
49 		m_lamp_i(*this, "lampi"),
50 		m_lamp_v(*this, "lampv"),
51 		m_lamp_e(*this, "lampe"),
52 		m_lamp_r(*this, "lampr")
53 	{ }
54 
55 	void skydiver(machine_config &config);
56 
57 private:
58 	DECLARE_WRITE_LINE_MEMBER(nmion_w);
59 	void videoram_w(offs_t offset, uint8_t data);
60 	uint8_t wram_r(offs_t offset);
61 	void wram_w(offs_t offset, uint8_t data);
62 	DECLARE_WRITE_LINE_MEMBER(width_w);
63 	DECLARE_WRITE_LINE_MEMBER(coin_lockout_w);
64 	DECLARE_WRITE_LINE_MEMBER(start_lamp_1_w);
65 	DECLARE_WRITE_LINE_MEMBER(start_lamp_2_w);
66 	DECLARE_WRITE_LINE_MEMBER(lamp_s_w);
67 	DECLARE_WRITE_LINE_MEMBER(lamp_k_w);
68 	DECLARE_WRITE_LINE_MEMBER(lamp_y_w);
69 	DECLARE_WRITE_LINE_MEMBER(lamp_d_w);
70 	DECLARE_WRITE_LINE_MEMBER(lamp_i_w);
71 	DECLARE_WRITE_LINE_MEMBER(lamp_v_w);
72 	DECLARE_WRITE_LINE_MEMBER(lamp_e_w);
73 	DECLARE_WRITE_LINE_MEMBER(lamp_r_w);
74 	void latch3_watchdog_w(offs_t offset, uint8_t data);
75 
76 	TILE_GET_INFO_MEMBER(get_tile_info);
77 
78 	virtual void machine_reset() override;
79 	virtual void video_start() override;
80 	void skydiver_palette(palette_device &palette) const;
81 
82 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
83 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
84 
85 	INTERRUPT_GEN_MEMBER(interrupt);
86 	void skydiver_map(address_map &map);
87 
88 	required_device<cpu_device> m_maincpu;
89 	required_device<watchdog_timer_device> m_watchdog;
90 	required_device<f9334_device> m_latch3;
91 	required_device<discrete_device> m_discrete;
92 	required_device<gfxdecode_device> m_gfxdecode;
93 	required_device<palette_device> m_palette;
94 
95 	required_shared_ptr<uint8_t> m_videoram;
96 
97 	output_finder<2> m_leds;
98 	output_finder<> m_lamp_s;
99 	output_finder<> m_lamp_k;
100 	output_finder<> m_lamp_y;
101 	output_finder<> m_lamp_d;
102 	output_finder<> m_lamp_i;
103 	output_finder<> m_lamp_v;
104 	output_finder<> m_lamp_e;
105 	output_finder<> m_lamp_r;
106 	int m_nmion;
107 	tilemap_t *m_bg_tilemap;
108 	int m_width;
109 };
110 
111 /*----------- defined in audio/skydiver.c -----------*/
112 DISCRETE_SOUND_EXTERN( skydiver_discrete );
113 
114 #endif // MAME_INCLUDES_SKYDIVER_H
115