summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/alesis.h
blob: 8900d4ebbe9a4a060fb8a16f5ed8c9a7713e7c9d (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// license:BSD-3-Clause
// copyright-holders:Sandro Ronco
/***************************************************************************

    Alesis HR-16 and SR-16 drum machines

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

#ifndef MAME_INCLUDES_ALESIS_H
#define MAME_INCLUDES_ALESIS_H

#pragma once

#include "cpu/mcs51/mcs51.h"
#include "machine/nvram.h"
#include "sound/dac.h"
#include "video/hd44780.h"
#include "imagedev/cassette.h"
#include "rendlay.h"

#define MCFG_ALESIS_DM3AG_ADD(_tag,_clock) \
	MCFG_DEVICE_ADD( _tag, ALESIS_DM3AG, _clock )


// ======================> alesis_dm3ag_device

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

	// device interface
	DECLARE_WRITE8_MEMBER(write);

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
	virtual void device_add_mconfig(machine_config &config) override;

private:
	static const device_timer_id TIMER_DAC_UPDATE = 1;
	required_device<dac_word_interface> m_dac;
	required_region_ptr<int8_t> m_samples;

	emu_timer * m_dac_update_timer;
	bool        m_output_active;
	int         m_count;
	int         m_shift;
	uint32_t      m_cur_sample;
	uint8_t       m_cmd[5];
};


// ======================> alesis_state

class alesis_state : public driver_device
{
public:
	alesis_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_lcdc(*this, "hd44780"),
		m_cassette(*this, "cassette"),
		m_maincpu(*this, "maincpu"),
		m_col1(*this, "COL1"),
		m_col2(*this, "COL2"),
		m_col3(*this, "COL3"),
		m_col4(*this, "COL4"),
		m_col5(*this, "COL5"),
		m_col6(*this, "COL6"),
		m_select(*this, "SELECT"),
		m_digit(*this, "digit%u", 0U),
		m_track_led(*this, "track_led%u", 1U),
		m_patt_led(*this, "patt_led"),
		m_song_led(*this, "song_led"),
		m_play_led(*this, "play_led"),
		m_record_led(*this, "record_led"),
		m_voice_led(*this, "voice_led"),
		m_tune_led(*this, "tune_led"),
		m_mix_led(*this, "mix_led"),
		m_tempo_led(*this, "tempo_led"),
		m_midi_led(*this, "midi_led"),
		m_part_led(*this, "part_led"),
		m_edit_led(*this, "edit_led"),
		m_echo_led(*this, "echo_led"),
		m_loop_led(*this, "loop_led"),
		m_a_next(*this, "a_next"),
		m_b_next(*this, "b_next"),
		m_fill_next(*this, "fill_next"),
		m_user_next(*this, "user_next"),
		m_play(*this, "play"),
		m_record(*this, "record"),
		m_compose(*this, "compose"),
		m_perform(*this, "perform"),
		m_song(*this, "song"),
		m_b(*this, "b"),
		m_a(*this, "a"),
		m_fill(*this, "fill"),
		m_user(*this, "user"),
		m_edited(*this, "edited"),
		m_set(*this, "set"),
		m_drum(*this, "drum"),
		m_press_play(*this, "press_play"),
		m_metronome(*this, "metronome"),
		m_tempo(*this, "tempo"),
		m_page(*this, "page"),
		m_step_edit(*this, "step_edit"),
		m_swing_off(*this, "swing_off"),
		m_swing_62(*this, "swing_62"),
		m_click_l1(*this, "click_l1"),
		m_click_note(*this, "click_note"),
		m_click_l2(*this, "click_l2"),
		m_click_3(*this, "click_3"),
		m_backup(*this, "backup"),
		m_drum_set(*this, "drum_set"),
		m_swing(*this, "swing"),
		m_swing_58(*this, "swing_58"),
		m_click_off(*this, "click_off"),
		m_click(*this, "click"),
		m_quantize_off(*this, "quantize_off"),
		m_quantize_3(*this, "quantize_3"),
		m_midi_setup(*this, "midi_setup"),
		m_record_setup(*this, "record_setup"),
		m_quantize(*this, "quantize"),
		m_swing_54(*this, "swing_54"),
		m_quantize_l1(*this, "quantize_l1"),
		m_quantize_l2(*this, "quantize_l2"),
		m_quantize_l3(*this, "quantize_l3"),
		m_quantize_note(*this, "quantize_note"),
		m_setup(*this, "setup")
	{ }

	void init_hr16();
	void mmt8(machine_config &config);
	void hr16(machine_config &config);
	void sr16(machine_config &config);

protected:
	DECLARE_PALETTE_INIT(alesis);
	virtual void machine_start() override;
	virtual void machine_reset() override;

	void update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t y, uint8_t x, int state);
	DECLARE_WRITE8_MEMBER( led_w );
	DECLARE_WRITE8_MEMBER( mmt8_led_w );
	DECLARE_READ8_MEMBER( mmt8_led_r );
	DECLARE_WRITE8_MEMBER( track_led_w );
	DECLARE_WRITE8_MEMBER( kb_matrix_w );
	DECLARE_READ8_MEMBER( kb_r );
	DECLARE_READ8_MEMBER( p3_r );
	DECLARE_WRITE8_MEMBER( p3_w );
	DECLARE_READ8_MEMBER( mmt8_p3_r );
	DECLARE_WRITE8_MEMBER( mmt8_p3_w );
	DECLARE_WRITE8_MEMBER( sr16_lcd_w );
	HD44780_PIXEL_UPDATE(sr16_pixel_update);

	void hr16_io(address_map &map);
	void hr16_mem(address_map &map);
	void mmt8_io(address_map &map);
	void sr16_io(address_map &map);
	void sr16_mem(address_map &map);

private:
	uint8_t       m_kb_matrix;
	uint8_t       m_leds;
	uint8_t       m_lcd_digits[5];

	required_device<hd44780_device> m_lcdc;
	optional_device<cassette_image_device> m_cassette;
	required_device<cpu_device> m_maincpu;

	required_ioport m_col1;
	required_ioport m_col2;
	required_ioport m_col3;
	required_ioport m_col4;
	required_ioport m_col5;
	required_ioport m_col6;
	optional_ioport m_select;
	output_finder<5> m_digit;
	output_finder<8> m_track_led;
	output_finder<> m_patt_led;
	output_finder<> m_song_led;
	output_finder<> m_play_led;
	output_finder<> m_record_led;
	output_finder<> m_voice_led;
	output_finder<> m_tune_led;
	output_finder<> m_mix_led;
	output_finder<> m_tempo_led;
	output_finder<> m_midi_led;
	output_finder<> m_part_led;
	output_finder<> m_edit_led;
	output_finder<> m_echo_led;
	output_finder<> m_loop_led;
	output_finder<> m_a_next;
	output_finder<> m_b_next;
	output_finder<> m_fill_next;
	output_finder<> m_user_next;
	output_finder<> m_play;
	output_finder<> m_record;
	output_finder<> m_compose;
	output_finder<> m_perform;
	output_finder<> m_song;
	output_finder<> m_b;
	output_finder<> m_a;
	output_finder<> m_fill;
	output_finder<> m_user;
	output_finder<> m_edited;
	output_finder<> m_set;
	output_finder<> m_drum;
	output_finder<> m_press_play;
	output_finder<> m_metronome;
	output_finder<> m_tempo;
	output_finder<> m_page;
	output_finder<> m_step_edit;
	output_finder<> m_swing_off;
	output_finder<> m_swing_62;
	output_finder<> m_click_l1;
	output_finder<> m_click_note;
	output_finder<> m_click_l2;
	output_finder<> m_click_3;
	output_finder<> m_backup;
	output_finder<> m_drum_set;
	output_finder<> m_swing;
	output_finder<> m_swing_58;
	output_finder<> m_click_off;
	output_finder<> m_click;
	output_finder<> m_quantize_off;
	output_finder<> m_quantize_3;
	output_finder<> m_midi_setup;
	output_finder<> m_record_setup;
	output_finder<> m_quantize;
	output_finder<> m_swing_54;
	output_finder<> m_quantize_l1;
	output_finder<> m_quantize_l2;
	output_finder<> m_quantize_l3;
	output_finder<> m_quantize_note;
	output_finder<> m_setup;
};

// device type definition
DECLARE_DEVICE_TYPE(ALESIS_DM3AG, alesis_dm3ag_device)

#endif  // MAME_INCLUDES_ALESIS_H