1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /*************************************************************************
4 
5     The Game Room Lethal Justice hardware
6 
7 **************************************************************************/
8 #ifndef MAME_INCLUDES_LETHALJ_H
9 #define MAME_INCLUDES_LETHALJ_H
10 
11 #pragma once
12 
13 #include "cpu/tms34010/tms34010.h"
14 #include "machine/ticket.h"
15 #include "screen.h"
16 
17 
18 class lethalj_state : public driver_device
19 {
20 public:
21 	enum
22 	{
23 		TIMER_GEN_EXT1_INT
24 	};
25 
lethalj_state(const machine_config & mconfig,device_type type,const char * tag)26 	lethalj_state(const machine_config &mconfig, device_type type, const char *tag) :
27 		driver_device(mconfig, type, tag),
28 		m_maincpu(*this, "maincpu"),
29 		m_screen(*this, "screen"),
30 		m_ticket(*this, "ticket"),
31 		m_blitter_base(*this, "gfx"),
32 		m_paddle(*this, "PADDLE"),
33 		m_light0_x(*this, "LIGHT0_X"),
34 		m_light0_y(*this, "LIGHT0_Y"),
35 		m_light1_x(*this, "LIGHT1_X"),
36 		m_light1_y(*this, "LIGHT1_Y"),
37 		m_lamps(*this, "lamp%u", 0U)
38 	{ }
39 
40 	void lethalj(machine_config &config);
41 	void gameroom(machine_config &config);
42 
43 	void init_cfarm();
44 	void init_ripribit();
45 	void init_cclownz();
46 
47 	DECLARE_CUSTOM_INPUT_MEMBER(cclownz_paddle);
48 
49 private:
50 	void ripribit_control_w(uint16_t data);
51 	void cfarm_control_w(uint16_t data);
52 	void cclownz_control_w(uint16_t data);
53 	uint16_t lethalj_gun_r(offs_t offset);
54 	void blitter_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
55 	void do_blit();
56 	inline void get_crosshair_xy(int player, int *x, int *y);
57 	TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update);
58 
59 	void lethalj_map(address_map &map);
60 
machine_start()61 	virtual void machine_start() override { m_lamps.resolve(); }
62 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
63 	virtual void video_start() override;
64 
65 	required_device<tms34010_device> m_maincpu;
66 	required_device<screen_device> m_screen;
67 	required_device<ticket_dispenser_device> m_ticket;
68 
69 	required_region_ptr<uint16_t> m_blitter_base;
70 
71 	optional_ioport m_paddle;
72 	optional_ioport m_light0_x;
73 	optional_ioport m_light0_y;
74 	optional_ioport m_light1_x;
75 	optional_ioport m_light1_y;
76 	output_finder<3> m_lamps;
77 
78 	emu_timer *m_gen_ext1_int_timer;
79 	uint16_t m_blitter_data[8];
80 	std::unique_ptr<uint16_t[]> m_screenram;
81 	uint8_t m_vispage;
82 	int m_blitter_rows;
83 	uint16_t m_gunx;
84 	uint16_t m_guny;
85 	uint8_t m_blank_palette;
86 };
87 
88 #endif // MAME_INCLUDES_LETHALJ_H
89