src/mess/drivers/alesis.c
| r15939 | r15940 | |
| 11 | 11 | |
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "cpu/mcs51/mcs51.h" |
| 14 | #include "video/hd44780.h" |
| 15 | #include "rendlay.h" |
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | class alesis_state : public driver_device |
| r15939 | r15940 | |
| 19 | 21 | alesis_state(const machine_config &mconfig, device_type type, const char *tag) |
| 20 | 22 | : driver_device(mconfig, type, tag) { } |
| 21 | 23 | |
| 24 | virtual void palette_init(); |
| 25 | virtual void machine_reset(); |
| 26 | |
| 22 | 27 | DECLARE_DRIVER_INIT(hr16); |
| 28 | DECLARE_WRITE8_MEMBER( kb_matrix_w ); |
| 29 | DECLARE_READ8_MEMBER( kb_r ); |
| 30 | |
| 31 | UINT8 m_kb_matrix; |
| 23 | 32 | }; |
| 24 | 33 | |
| 34 | WRITE8_MEMBER( alesis_state::kb_matrix_w ) |
| 35 | { |
| 36 | m_kb_matrix = data; |
| 37 | } |
| 25 | 38 | |
| 39 | READ8_MEMBER( alesis_state::kb_r ) |
| 40 | { |
| 41 | UINT8 data = 0xff; |
| 42 | |
| 43 | if (!(m_kb_matrix & 0x01)) |
| 44 | data &= ioport("COL1")->read(); |
| 45 | if (!(m_kb_matrix & 0x02)) |
| 46 | data &= ioport("COL2")->read(); |
| 47 | if (!(m_kb_matrix & 0x04)) |
| 48 | data &= ioport("COL3")->read(); |
| 49 | if (!(m_kb_matrix & 0x08)) |
| 50 | data &= ioport("COL4")->read(); |
| 51 | if (!(m_kb_matrix & 0x10)) |
| 52 | data &= ioport("COL5")->read(); |
| 53 | if (!(m_kb_matrix & 0x20)) |
| 54 | data &= ioport("COL6")->read(); |
| 55 | |
| 56 | return data; |
| 57 | } |
| 58 | |
| 59 | |
| 26 | 60 | static ADDRESS_MAP_START(hr16_mem, AS_PROGRAM, 8, alesis_state) |
| 27 | 61 | ADDRESS_MAP_UNMAP_HIGH |
| 28 | 62 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| r15939 | r15940 | |
| 30 | 64 | |
| 31 | 65 | static ADDRESS_MAP_START(hr16_io, AS_IO, 8, alesis_state) |
| 32 | 66 | ADDRESS_MAP_UNMAP_HIGH |
| 67 | AM_RANGE(0x0000, 0x0000) AM_READ(kb_r) |
| 68 | AM_RANGE(0x0006, 0x0006) AM_DEVREADWRITE("hd44780", hd44780_device, control_read, control_write) |
| 69 | AM_RANGE(0x0007, 0x0007) AM_DEVREADWRITE("hd44780", hd44780_device, data_read, data_write) |
| 70 | AM_RANGE(0x0008, 0x0008) AM_WRITE(kb_matrix_w) |
| 33 | 71 | AM_RANGE(0x8000, 0xffff) AM_RAM /* 32Kx8 SRAM */ |
| 34 | 72 | ADDRESS_MAP_END |
| 35 | 73 | |
| r15939 | r15940 | |
| 45 | 83 | |
| 46 | 84 | /* Input ports */ |
| 47 | 85 | static INPUT_PORTS_START( alesis ) |
| 86 | PORT_START("COL1") |
| 87 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("COPY") PORT_CODE(KEYCODE_C) |
| 88 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFFSET") PORT_CODE(KEYCODE_O) |
| 89 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SWING") PORT_CODE(KEYCODE_W) |
| 90 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("QUANT") PORT_CODE(KEYCODE_Q) |
| 91 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LENGTH") PORT_CODE(KEYCODE_L) |
| 92 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PATT") PORT_CODE(KEYCODE_P) |
| 93 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIDI/UTIL") PORT_CODE(KEYCODE_U) |
| 94 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TEMPO") PORT_CODE(KEYCODE_T) |
| 95 | PORT_START("COL2") |
| 96 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("DELETE") PORT_CODE(KEYCODE_BACKSPACE) |
| 97 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INSERT") PORT_CODE(KEYCODE_INSERT) |
| 98 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SONG") PORT_CODE(KEYCODE_S) |
| 99 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) |
| 100 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2) |
| 101 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) |
| 102 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4) |
| 103 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5) |
| 104 | PORT_START("COL3") |
| 105 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ERASE") PORT_CODE(KEYCODE_DEL) |
| 106 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TAPE") PORT_CODE(KEYCODE_Y) |
| 107 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FILL") PORT_CODE(KEYCODE_F) |
| 108 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) |
| 109 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) |
| 110 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8) |
| 111 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) |
| 112 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0) |
| 113 | PORT_START("COL4") |
| 114 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PLAY") PORT_CODE(KEYCODE_ENTER) |
| 115 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("STOP/CONTINUE") PORT_CODE(KEYCODE_END) |
| 116 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RECORD") PORT_CODE(KEYCODE_HOME) |
| 117 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("< -") PORT_CODE(KEYCODE_LEFT) |
| 118 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("> +") PORT_CODE(KEYCODE_RIGHT) |
| 119 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("VOICE") PORT_CODE(KEYCODE_V) |
| 120 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TUNE") PORT_CODE(KEYCODE_H) |
| 121 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MIX") PORT_CODE(KEYCODE_M) |
| 122 | PORT_START("COL5") |
| 123 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 1") PORT_CODE(KEYCODE_F1) |
| 124 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 2") PORT_CODE(KEYCODE_F2) |
| 125 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 3") PORT_CODE(KEYCODE_F3) |
| 126 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("TOM 4") PORT_CODE(KEYCODE_F4) |
| 127 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIDE") PORT_CODE(KEYCODE_F5) |
| 128 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CRASH") PORT_CODE(KEYCODE_F6) |
| 129 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 1") PORT_CODE(KEYCODE_F7) |
| 130 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 2") PORT_CODE(KEYCODE_F8) |
| 131 | PORT_START("COL6") |
| 132 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KICK") PORT_CODE(KEYCODE_1_PAD) |
| 133 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SNARE") PORT_CODE(KEYCODE_2_PAD) |
| 134 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLOSED HAT") PORT_CODE(KEYCODE_3_PAD) |
| 135 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MID HAT") PORT_CODE(KEYCODE_4_PAD) |
| 136 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OPEN HAT") PORT_CODE(KEYCODE_5_PAD) |
| 137 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CLAPS") PORT_CODE(KEYCODE_6_PAD) |
| 138 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 3") PORT_CODE(KEYCODE_7_PAD) |
| 139 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PERC 4") PORT_CODE(KEYCODE_8_PAD) |
| 48 | 140 | INPUT_PORTS_END |
| 49 | 141 | |
| 50 | 142 | |
| 51 | | static MACHINE_RESET(alesis) |
| 143 | void alesis_state::palette_init() |
| 52 | 144 | { |
| 145 | palette_set_color(machine(), 0, MAKE_RGB(138, 146, 148)); |
| 146 | palette_set_color(machine(), 1, MAKE_RGB(92, 83, 88)); |
| 53 | 147 | } |
| 54 | 148 | |
| 55 | | static VIDEO_START( alesis ) |
| 149 | void alesis_state::machine_reset() |
| 56 | 150 | { |
| 151 | m_kb_matrix = 0xff; |
| 57 | 152 | } |
| 58 | 153 | |
| 59 | 154 | static SCREEN_UPDATE_IND16( alesis ) |
| r15939 | r15940 | |
| 61 | 156 | return 0; |
| 62 | 157 | } |
| 63 | 158 | |
| 159 | static const hd44780_interface hr16_display = |
| 160 | { |
| 161 | 2, // number of lines |
| 162 | 16, // chars for line |
| 163 | NULL // custom display layout |
| 164 | }; |
| 165 | |
| 64 | 166 | static MACHINE_CONFIG_START( hr16, alesis_state ) |
| 65 | 167 | /* basic machine hardware */ |
| 66 | 168 | MCFG_CPU_ADD("maincpu",I8031, XTAL_12MHz) |
| 67 | 169 | MCFG_CPU_PROGRAM_MAP(hr16_mem) |
| 68 | 170 | MCFG_CPU_IO_MAP(hr16_io) |
| 69 | 171 | |
| 70 | | MCFG_MACHINE_RESET(alesis) |
| 71 | | |
| 72 | 172 | /* video hardware */ |
| 73 | 173 | MCFG_SCREEN_ADD("screen", RASTER) |
| 74 | 174 | MCFG_SCREEN_REFRESH_RATE(50) |
| 75 | 175 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 76 | | MCFG_SCREEN_SIZE(640, 480) |
| 77 | | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 78 | | MCFG_SCREEN_UPDATE_STATIC(alesis) |
| 176 | MCFG_SCREEN_SIZE(6*16, 9*2) |
| 177 | MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) |
| 178 | MCFG_DEFAULT_LAYOUT(layout_lcd) |
| 179 | MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) |
| 79 | 180 | |
| 80 | 181 | MCFG_PALETTE_LENGTH(2) |
| 81 | | MCFG_PALETTE_INIT(black_and_white) |
| 82 | 182 | |
| 83 | | MCFG_VIDEO_START(alesis) |
| 183 | MCFG_HD44780_ADD("hd44780", hr16_display) |
| 84 | 184 | MACHINE_CONFIG_END |
| 85 | 185 | |
| 86 | 186 | static MACHINE_CONFIG_START( sr16, alesis_state ) |
| r15939 | r15940 | |
| 89 | 189 | MCFG_CPU_PROGRAM_MAP(sr16_mem) |
| 90 | 190 | MCFG_CPU_IO_MAP(sr16_io) |
| 91 | 191 | |
| 92 | | MCFG_MACHINE_RESET(alesis) |
| 93 | | |
| 94 | 192 | /* video hardware */ |
| 95 | 193 | MCFG_SCREEN_ADD("screen", RASTER) |
| 96 | 194 | MCFG_SCREEN_REFRESH_RATE(50) |
| r15939 | r15940 | |
| 100 | 198 | MCFG_SCREEN_UPDATE_STATIC(alesis) |
| 101 | 199 | |
| 102 | 200 | MCFG_PALETTE_LENGTH(2) |
| 103 | | MCFG_PALETTE_INIT(black_and_white) |
| 104 | | |
| 105 | | MCFG_VIDEO_START(alesis) |
| 106 | 201 | MACHINE_CONFIG_END |
| 107 | 202 | |
| 108 | 203 | /* ROM definition */ |
| r15939 | r15940 | |
| 118 | 213 | ROM_REGION( 0x100000, "sounddata", ROMREGION_ERASEFF ) |
| 119 | 214 | ROM_LOAD( "2-27-0003.u15", 0x00000, 0x80000, CRC(82e9b78c) SHA1(89728cb38ae172b5e347a03018617c94a087dce0)) |
| 120 | 215 | ROM_LOAD( "2-27-0004.u16", 0x80000, 0x80000, CRC(8e103536) SHA1(092e1cf649fbef171cfaf91e20707d89998b7a1e)) |
| 216 | |
| 217 | ROM_REGION( 0x0860, "hd44780", ROMREGION_ERASE ) |
| 218 | ROM_LOAD( "44780a00.bin", 0x0000, 0x0860, BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d)) |
| 121 | 219 | ROM_END |
| 122 | 220 | |
| 123 | 221 | ROM_START( hr16b ) |
| r15939 | r15940 | |
| 130 | 228 | ROM_REGION( 0x100000, "sounddata", ROMREGION_ERASEFF ) |
| 131 | 229 | ROM_LOAD( "2-27-0007.u15", 0x00000, 0x80000, CRC(319746db) SHA1(46b32a3ab2fbad67fb4566f607f578a2e9defd63)) |
| 132 | 230 | ROM_LOAD( "2-27-0008.u16", 0x80000, 0x80000, CRC(11ca930e) SHA1(2f57fdd02f9b2146a551370a74cab1fa800145ab)) |
| 231 | |
| 232 | ROM_REGION( 0x0860, "hd44780", ROMREGION_ERASE ) |
| 233 | ROM_LOAD( "44780a00.bin", 0x0000, 0x0860, BAD_DUMP CRC(3a89024c) SHA1(5a87b68422a916d1b37b5be1f7ad0b3fb3af5a8d)) |
| 133 | 234 | ROM_END |
| 134 | 235 | |
| 135 | 236 | ROM_START( sr16 ) |