1 // license:BSD-3-Clause 2 // copyright-holders:Sandro Ronco 3 /*************************************************************************** 4 5 Alesis HR-16 and SR-16 drum machines 6 7 ****************************************************************************/ 8 9 #ifndef MAME_INCLUDES_ALESIS_H 10 #define MAME_INCLUDES_ALESIS_H 11 12 #pragma once 13 14 #include "cpu/mcs51/mcs51.h" 15 #include "machine/nvram.h" 16 #include "sound/dac.h" 17 #include "video/hd44780.h" 18 #include "imagedev/cassette.h" 19 #include "emupal.h" 20 21 22 // ======================> alesis_dm3ag_device 23 24 class alesis_dm3ag_device : public device_t 25 { 26 public: 27 // construction/destruction 28 alesis_dm3ag_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 29 30 // device interface 31 void write(uint8_t data); 32 33 protected: 34 // device-level overrides 35 virtual void device_start() override; 36 virtual void device_reset() override; 37 virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; 38 virtual void device_add_mconfig(machine_config &config) override; 39 40 private: 41 static const device_timer_id TIMER_DAC_UPDATE = 1; 42 required_device<dac_word_interface> m_dac; 43 required_region_ptr<int8_t> m_samples; 44 45 emu_timer * m_dac_update_timer; 46 bool m_output_active; 47 int m_count; 48 int m_shift; 49 uint32_t m_cur_sample; 50 uint8_t m_cmd[5]; 51 }; 52 53 54 // ======================> alesis_state 55 56 class alesis_state : public driver_device 57 { 58 public: alesis_state(const machine_config & mconfig,device_type type,const char * tag)59 alesis_state(const machine_config &mconfig, device_type type, const char *tag) : 60 driver_device(mconfig, type, tag), 61 m_lcdc(*this, "hd44780"), 62 m_cassette(*this, "cassette"), 63 m_maincpu(*this, "maincpu"), 64 m_col(*this, "COL%u", 1U), 65 m_select(*this, "SELECT"), 66 m_digit(*this, "digit%u", 0U), 67 m_pattern(*this, "pattern"), 68 m_track_led(*this, "track_led%u", 1U), 69 m_patt_led(*this, "patt_led"), 70 m_song_led(*this, "song_led"), 71 m_play_led(*this, "play_led"), 72 m_record_led(*this, "record_led"), 73 m_voice_led(*this, "voice_led"), 74 m_tune_led(*this, "tune_led"), 75 m_mix_led(*this, "mix_led"), 76 m_tempo_led(*this, "tempo_led"), 77 m_midi_led(*this, "midi_led"), 78 m_part_led(*this, "part_led"), 79 m_edit_led(*this, "edit_led"), 80 m_echo_led(*this, "echo_led"), 81 m_loop_led(*this, "loop_led"), 82 m_a_next(*this, "a_next"), 83 m_b_next(*this, "b_next"), 84 m_fill_next(*this, "fill_next"), 85 m_user_next(*this, "user_next"), 86 m_play(*this, "play"), 87 m_record(*this, "record"), 88 m_compose(*this, "compose"), 89 m_perform(*this, "perform"), 90 m_song(*this, "song"), 91 m_b(*this, "b"), 92 m_a(*this, "a"), 93 m_fill(*this, "fill"), 94 m_user(*this, "user"), 95 m_edited(*this, "edited"), 96 m_set(*this, "set"), 97 m_drum(*this, "drum"), 98 m_press_play(*this, "press_play"), 99 m_metronome(*this, "metronome"), 100 m_tempo(*this, "tempo"), 101 m_page(*this, "page"), 102 m_step_edit(*this, "step_edit"), 103 m_swing_off(*this, "swing_off"), 104 m_swing_62(*this, "swing_62"), 105 m_click_l1(*this, "click_l1"), 106 m_click_note(*this, "click_note"), 107 m_click_l2(*this, "click_l2"), 108 m_click_3(*this, "click_3"), 109 m_backup(*this, "backup"), 110 m_drum_set(*this, "drum_set"), 111 m_swing(*this, "swing"), 112 m_swing_58(*this, "swing_58"), 113 m_click_off(*this, "click_off"), 114 m_click(*this, "click"), 115 m_quantize_off(*this, "quantize_off"), 116 m_quantize_3(*this, "quantize_3"), 117 m_midi_setup(*this, "midi_setup"), 118 m_record_setup(*this, "record_setup"), 119 m_quantize(*this, "quantize"), 120 m_swing_54(*this, "swing_54"), 121 m_quantize_l1(*this, "quantize_l1"), 122 m_quantize_l2(*this, "quantize_l2"), 123 m_quantize_l3(*this, "quantize_l3"), 124 m_quantize_note(*this, "quantize_note"), 125 m_setup(*this, "setup") 126 { } 127 128 void init_hr16(); 129 void mmt8(machine_config &config); 130 void hr16(machine_config &config); 131 void sr16(machine_config &config); 132 133 protected: 134 void alesis_palette(palette_device &palette) const; 135 virtual void machine_start() override; 136 virtual void machine_reset() override; 137 138 void update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t y, uint8_t x, int state); 139 void led_w(uint8_t data); 140 void mmt8_led_w(uint8_t data); 141 uint8_t mmt8_led_r(); 142 void track_led_w(uint8_t data); 143 void kb_matrix_w(uint8_t data); 144 uint8_t kb_r(); 145 uint8_t p3_r(); 146 void p3_w(uint8_t data); 147 uint8_t mmt8_p3_r(); 148 void mmt8_p3_w(uint8_t data); 149 void sr16_lcd_w(uint8_t data); 150 HD44780_PIXEL_UPDATE(sr16_pixel_update); 151 152 void hr16_io(address_map &map); 153 void hr16_mem(address_map &map); 154 void mmt8_io(address_map &map); 155 void sr16_io(address_map &map); 156 void sr16_mem(address_map &map); 157 158 private: 159 uint8_t m_kb_matrix; 160 uint8_t m_leds; 161 uint8_t m_lcd_digits[5]; 162 163 required_device<hd44780_device> m_lcdc; 164 optional_device<cassette_image_device> m_cassette; 165 required_device<mcs51_cpu_device> m_maincpu; 166 167 required_ioport_array<6> m_col; 168 optional_ioport m_select; 169 output_finder<5> m_digit; 170 output_finder<> m_pattern; 171 output_finder<8> m_track_led; 172 output_finder<> m_patt_led; 173 output_finder<> m_song_led; 174 output_finder<> m_play_led; 175 output_finder<> m_record_led; 176 output_finder<> m_voice_led; 177 output_finder<> m_tune_led; 178 output_finder<> m_mix_led; 179 output_finder<> m_tempo_led; 180 output_finder<> m_midi_led; 181 output_finder<> m_part_led; 182 output_finder<> m_edit_led; 183 output_finder<> m_echo_led; 184 output_finder<> m_loop_led; 185 output_finder<> m_a_next; 186 output_finder<> m_b_next; 187 output_finder<> m_fill_next; 188 output_finder<> m_user_next; 189 output_finder<> m_play; 190 output_finder<> m_record; 191 output_finder<> m_compose; 192 output_finder<> m_perform; 193 output_finder<> m_song; 194 output_finder<> m_b; 195 output_finder<> m_a; 196 output_finder<> m_fill; 197 output_finder<> m_user; 198 output_finder<> m_edited; 199 output_finder<> m_set; 200 output_finder<> m_drum; 201 output_finder<> m_press_play; 202 output_finder<> m_metronome; 203 output_finder<> m_tempo; 204 output_finder<> m_page; 205 output_finder<> m_step_edit; 206 output_finder<> m_swing_off; 207 output_finder<> m_swing_62; 208 output_finder<> m_click_l1; 209 output_finder<> m_click_note; 210 output_finder<> m_click_l2; 211 output_finder<> m_click_3; 212 output_finder<> m_backup; 213 output_finder<> m_drum_set; 214 output_finder<> m_swing; 215 output_finder<> m_swing_58; 216 output_finder<> m_click_off; 217 output_finder<> m_click; 218 output_finder<> m_quantize_off; 219 output_finder<> m_quantize_3; 220 output_finder<> m_midi_setup; 221 output_finder<> m_record_setup; 222 output_finder<> m_quantize; 223 output_finder<> m_swing_54; 224 output_finder<> m_quantize_l1; 225 output_finder<> m_quantize_l2; 226 output_finder<> m_quantize_l3; 227 output_finder<> m_quantize_note; 228 output_finder<> m_setup; 229 }; 230 231 // device type definition 232 DECLARE_DEVICE_TYPE(ALESIS_DM3AG, alesis_dm3ag_device) 233 234 #endif // MAME_INCLUDES_ALESIS_H 235