trunk/src/mess/drivers/rmt32.c
| r19650 | r19651 | |
| 207 | 207 | DECLARE_READ8_MEMBER(lcd_ctrl_r);
|
| 208 | 208 | DECLARE_WRITE8_MEMBER(lcd_ctrl_w);
|
| 209 | 209 | DECLARE_WRITE8_MEMBER(lcd_data_w);
|
| 210 | DECLARE_READ16_MEMBER(port0_r);
|
| 210 | 211 | |
| 211 | 212 | TIMER_DEVICE_CALLBACK_MEMBER(midi_timer_cb);
|
| 213 | TIMER_DEVICE_CALLBACK_MEMBER(samples_timer_cb);
|
| 212 | 214 | |
| 213 | 215 | private:
|
| 214 | 216 | UINT8 lcd_data_buffer[256];
|
| 215 | 217 | int lcd_data_buffer_pos;
|
| 216 | 218 | UINT8 midi;
|
| 217 | 219 | int midi_pos;
|
| 220 | UINT8 port0;
|
| 218 | 221 | };
|
| 219 | 222 | |
| 220 | 223 | mt32_state::mt32_state(const machine_config &mconfig, device_type type, const char *tag) :
|
| r19650 | r19651 | |
| 253 | 256 | {
|
| 254 | 257 | midi_timer->adjust(attotime::from_hz(1));
|
| 255 | 258 | midi_pos = 0;
|
| 259 | port0 = 0;
|
| 256 | 260 | }
|
| 257 | 261 | |
| 258 | 262 | WRITE8_MEMBER(mt32_state::lcd_ctrl_w)
|
| r19650 | r19651 | |
| 286 | 290 | |
| 287 | 291 | TIMER_DEVICE_CALLBACK_MEMBER(mt32_state::midi_timer_cb)
|
| 288 | 292 | {
|
| 289 | | const static UINT8 midi_data[3] = { 0x91, 0x40, 0x40 };
|
| 293 | const static UINT8 midi_data[3] = { 0x91, 0x40, 0x7f };
|
| 290 | 294 | midi = midi_data[midi_pos++];
|
| 291 | 295 | logerror("midi_in %02x\n", midi);
|
| 292 | 296 | cpu->serial_w(midi);
|
| r19650 | r19651 | |
| 294 | 298 | midi_timer->adjust(attotime::from_hz(1250));
|
| 295 | 299 | }
|
| 296 | 300 | |
| 301 | READ16_MEMBER(mt32_state::port0_r)
|
| 302 | {
|
| 303 | return port0;
|
| 304 | }
|
| 305 | |
| 306 | TIMER_DEVICE_CALLBACK_MEMBER(mt32_state::samples_timer_cb)
|
| 307 | {
|
| 308 | port0 ^= 0x10;
|
| 309 | }
|
| 310 | |
| 297 | 311 | WRITE8_MEMBER(mt32_state::so_w)
|
| 298 | 312 | {
|
| 299 | 313 | // bit 0 = led
|
| r19650 | r19651 | |
| 326 | 340 | static ADDRESS_MAP_START( mt32_io, AS_IO, 16, mt32_state )
|
| 327 | 341 | AM_RANGE(i8x9x_device::A7, i8x9x_device::A7) AM_READ_PORT("A7")
|
| 328 | 342 | AM_RANGE(i8x9x_device::SERIAL, i8x9x_device::SERIAL) AM_WRITE(midi_w)
|
| 343 | AM_RANGE(i8x9x_device::P0, i8x9x_device::P0) AM_READ(port0_r)
|
| 329 | 344 | ADDRESS_MAP_END
|
| 330 | 345 | |
| 331 | 346 | static MACHINE_CONFIG_START( mt32, mt32_state )
|
| r19650 | r19651 | |
| 347 | 362 | MCFG_SED1200D0A_ADD( "lcd" )
|
| 348 | 363 | |
| 349 | 364 | MCFG_TIMER_DRIVER_ADD( "midi_timer", mt32_state, midi_timer_cb )
|
| 365 | |
| 366 | MCFG_TIMER_DRIVER_ADD_PERIODIC( "samples_timer", mt32_state, samples_timer_cb, attotime::from_hz(32000*2) )
|
| 350 | 367 | MACHINE_CONFIG_END
|
| 351 | 368 | |
| 352 | 369 | ROM_START( mt32 )
|