1 // license:BSD-3-Clause
2 // copyright-holders:Dan Boris
3 /*************************************************************************
4 
5     Hitme hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_HITME_H
9 #define MAME_INCLUDES_HITME_H
10 
11 #pragma once
12 
13 #include "sound/discrete.h"
14 #include "screen.h"
15 #include "tilemap.h"
16 
17 /* Discrete Sound Input Nodes */
18 #define HITME_DOWNCOUNT_VAL      NODE_01
19 #define HITME_OUT0               NODE_02
20 #define HITME_ENABLE_VAL         NODE_03
21 #define HITME_OUT1               NODE_04
22 
23 class hitme_state : public driver_device
24 {
25 public:
hitme_state(const machine_config & mconfig,device_type type,const char * tag)26 	hitme_state(const machine_config &mconfig, device_type type, const char *tag) :
27 		driver_device(mconfig, type, tag),
28 		m_videoram(*this, "videoram"),
29 		m_maincpu(*this, "maincpu"),
30 		m_discrete(*this, "discrete"),
31 		m_gfxdecode(*this, "gfxdecode"),
32 		m_screen(*this, "screen")
33 	{ }
34 
35 	void hitme(machine_config &config);
36 	void barricad(machine_config &config);
37 
38 private:
39 	/* memory pointers */
40 	required_shared_ptr<uint8_t> m_videoram;
41 
42 	/* video-related */
43 	tilemap_t  *m_tilemap;
44 
45 	/* misc */
46 	attotime m_timeout_time;
47 	void hitme_vidram_w(offs_t offset, uint8_t data);
48 	uint8_t hitme_port_0_r();
49 	uint8_t hitme_port_1_r();
50 	uint8_t hitme_port_2_r();
51 	uint8_t hitme_port_3_r();
52 	void output_port_0_w(uint8_t data);
53 	void output_port_1_w(uint8_t data);
54 	TILE_GET_INFO_MEMBER(get_hitme_tile_info);
55 	virtual void machine_start() override;
56 	virtual void machine_reset() override;
57 	virtual void video_start() override;
58 	DECLARE_VIDEO_START(barricad);
59 	uint32_t screen_update_hitme(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
60 	uint32_t screen_update_barricad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
61 	uint8_t read_port_and_t0( int port );
62 	uint8_t read_port_and_t0_and_hblank( int port );
63 	required_device<cpu_device> m_maincpu;
64 	required_device<discrete_device> m_discrete;
65 	required_device<gfxdecode_device> m_gfxdecode;
66 	required_device<screen_device> m_screen;
67 	void hitme_map(address_map &map);
68 	void hitme_portmap(address_map &map);
69 };
70 
71 
72 /*----------- defined in audio/hitme.c -----------*/
73 DISCRETE_SOUND_EXTERN( hitme_discrete );
74 
75 #endif // MAME_INCLUDES_HITME_H
76