summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/maygay1b.h
blob: 142c71ae407dd0a38ff9687bab244c0100cc842a (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// license:BSD-3-Clause
// copyright-holders:David Haywood



#define VERBOSE 0
#define LOG(x)  do { if (VERBOSE) logerror x; } while (0)

#define M1_MASTER_CLOCK (XTAL_8MHz)
#define M1_DUART_CLOCK  (XTAL_3_6864MHz)

#include "cpu/m6809/m6809.h"
#include "machine/i8279.h"

#include "video/awpvid.h"       //Fruit Machines Only
#include "machine/6821pia.h"
#include "machine/mc68681.h"
#include "machine/meters.h"
#include "machine/roc10937.h"   // vfd
#include "machine/steppers.h"   // stepper motor
#include "sound/ay8910.h"
#include "sound/2413intf.h"
#include "sound/okim6376.h"
#include "machine/nvram.h"
#include "sound/upd7759.h"

#include "sound/okim6295.h"

class maygay1b_state : public driver_device
{
public:
	maygay1b_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
		m_maincpu(*this, "maincpu"),
		m_vfd(*this, "vfd"),
		m_ay(*this, "aysnd"),
		m_msm6376(*this, "msm6376"),
		m_upd7759(*this, "upd"),
		m_okim6295(*this, "oki"),
		m_duart68681(*this, "duart68681"),
		m_sw1_port(*this, "SW1"),
		m_sw2_port(*this, "SW2"),
		m_s2_port(*this, "STROBE2"),
		m_s3_port(*this, "STROBE3"),
		m_s4_port(*this, "STROBE4"),
		m_s5_port(*this, "STROBE5"),
		m_s6_port(*this, "STROBE6"),
		m_s7_port(*this, "STROBE7"),
		m_bank1(*this, "bank1"),
		m_reel0(*this, "reel0"),
		m_reel1(*this, "reel1"),
		m_reel2(*this, "reel2"),
		m_reel3(*this, "reel3"),
		m_reel4(*this, "reel4"),
		m_reel5(*this, "reel5"),
		m_meters(*this, "meters"),
		m_oki_region(*this, "msm6376")
	{}

	required_device<cpu_device> m_maincpu;
	optional_device<s16lf01_t> m_vfd;
	required_device<ay8910_device> m_ay;
	optional_device<okim6376_device> m_msm6376;
	optional_device<upd7759_device> m_upd7759;
	optional_device<okim6295_device> m_okim6295;
	required_device<mc68681_device> m_duart68681;
	required_ioport m_sw1_port;
	required_ioport m_sw2_port;
	required_ioport m_s2_port;
	required_ioport m_s3_port;
	required_ioport m_s4_port;
	required_ioport m_s5_port;
	required_ioport m_s6_port;
	required_ioport m_s7_port;
	required_memory_bank m_bank1;
	required_device<stepper_device> m_reel0;
	required_device<stepper_device> m_reel1;
	required_device<stepper_device> m_reel2;
	required_device<stepper_device> m_reel3;
	required_device<stepper_device> m_reel4;
	required_device<stepper_device> m_reel5;
	required_device<meters_device> m_meters;
	optional_region_ptr<UINT8> m_oki_region;

	UINT8 m_lamppos;
	int m_lamp_strobe;
	int m_old_lamp_strobe;
	int m_lamp_strobe2;
	int m_old_lamp_strobe2;
	int m_RAMEN;
	int m_ALARMEN;
	int m_PSUrelay;
	bool m_Vmm;
	int m_WDOG;
	int m_NMIENABLE;
	int m_meter;
	TIMER_DEVICE_CALLBACK_MEMBER( maygay1b_nmitimer_callback );
	UINT8 m_Lamps[256];
	int m_optic_pattern;
	DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
	DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
	DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
	DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
	DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
	DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
	DECLARE_WRITE8_MEMBER(scanlines_w);
	DECLARE_WRITE8_MEMBER(lamp_data_w);
	DECLARE_WRITE8_MEMBER(lamp_data_2_w);
	DECLARE_READ8_MEMBER(kbd_r);
	DECLARE_WRITE8_MEMBER(reel12_w);
	DECLARE_WRITE8_MEMBER(reel34_w);
	DECLARE_WRITE8_MEMBER(reel56_w);
	DECLARE_WRITE8_MEMBER(m1_latch_w);
	DECLARE_WRITE8_MEMBER(latch_ch2_w);
	DECLARE_READ8_MEMBER(latch_st_hi);
	DECLARE_READ8_MEMBER(latch_st_lo);
	DECLARE_WRITE8_MEMBER(m1ab_no_oki_w);
	DECLARE_WRITE8_MEMBER(m1_pia_porta_w);
	DECLARE_WRITE8_MEMBER(m1_pia_portb_w);
	DECLARE_WRITE8_MEMBER(m1_lockout_w);
	DECLARE_WRITE8_MEMBER(m1_meter_w);
	DECLARE_READ8_MEMBER(m1_meter_r);
	DECLARE_READ8_MEMBER(m1_firq_clr_r);
	DECLARE_READ8_MEMBER(m1_firq_trg_r);
	DECLARE_READ8_MEMBER(m1_firq_nec_r);
	DECLARE_READ8_MEMBER(nec_reset_r);
	DECLARE_WRITE8_MEMBER(nec_bank0_w);
	DECLARE_WRITE8_MEMBER(nec_bank1_w);
	DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
	DECLARE_READ8_MEMBER(m1_duart_r);
	DECLARE_DRIVER_INIT(m1);
	DECLARE_DRIVER_INIT(m1common);
	DECLARE_DRIVER_INIT(m1nec);
	virtual void machine_start() override;
	virtual void machine_reset() override;
	void cpu0_firq(int data);
	void cpu0_nmi();
};

MACHINE_CONFIG_EXTERN( maygay_m1 );
MACHINE_CONFIG_EXTERN( maygay_m1_nec );
MACHINE_CONFIG_EXTERN( maygay_m1_no_oki );
MACHINE_CONFIG_EXTERN( maygay_m1_empire );