summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes_ctrl/rob.h
blob: 05e529f45e200054ff7e30583528bd64d5b28b52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// license:BSD-3-Clause
// copyright-holders:hap
/**********************************************************************

    Nintendo HVC-012 Family Computer Robot / Nintendo NES-012 R.O.B.

**********************************************************************/

#ifndef MAME_BUS_NES_CTRL_ROB
#define MAME_BUS_NES_CTRL_ROB

#pragma once

#include "ctrl.h"
#include "cpu/sm510/sm590.h"
#include "zapper_sensor.h"


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> nes_rob_device

class nes_rob_device : public device_t,
							public device_nes_control_port_interface
{
public:
	// construction/destruction
	nes_rob_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_add_mconfig(machine_config &config) override;
	virtual const tiny_rom_entry *device_rom_region() const override;
	virtual ioport_constructor device_input_ports() const override;

private:
	required_device<sm590_device> m_maincpu;
	required_device<nes_zapper_sensor_device> m_sensor;
	required_ioport m_eye_x;
	required_ioport m_eye_y;
	output_finder<6> m_motor_out;
	output_finder<> m_led_out;

	u8 input_r();
	void output_w(offs_t offset, u8 data);
};

// device type definition
DECLARE_DEVICE_TYPE(NES_ROB, nes_rob_device)

#endif // MAME_BUS_NES_CTRL_ROB