src/mess/machine/isa_sblaster.c
| r14068 | r14069 | |
| 3 | 3 | ISA 8 bit Creative Labs Sound Blaster Sound Card |
| 4 | 4 | |
| 5 | 5 | TODO: |
| 6 | | - fix DAC - DSP type is a MCS-51 family, it has an internal ROM that needs decapping; |
| 7 | | - joystick port; |
| 6 | - implement DAC |
| 7 | - DSP type is a MCS-51 family, it has an internal ROM that needs decapping; |
| 8 | 8 | - implement jumpers DIP-SWs; |
| 9 | 9 | |
| 10 | 10 | ***************************************************************************/ |
| r14068 | r14069 | |
| 35 | 35 | */ |
| 36 | 36 | #define ym3812_StdClock XTAL_3_579545MHz |
| 37 | 37 | |
| 38 | static INPUT_PORTS_START( sblaster ) |
| 39 | PORT_START("pc_joy") |
| 40 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) // x/y ad stick to digital converters |
| 41 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("SB: Joystick Button 1") |
| 42 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("SB: Joystick Button 2") |
| 43 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("SB: Joystick Button 3") |
| 44 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("SB: Joystick Button 4") |
| 45 | |
| 46 | PORT_START("pc_joy_1") |
| 47 | PORT_BIT(0xff,0x80,IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_LEFT) PORT_CODE_INC(KEYCODE_RIGHT) PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH) PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH) |
| 48 | |
| 49 | PORT_START("pc_joy_2") |
| 50 | PORT_BIT(0xff,0x80,IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(1) PORT_MINMAX(1,0xff) PORT_CODE_DEC(KEYCODE_UP) PORT_CODE_INC(KEYCODE_DOWN) PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH) PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH) |
| 51 | INPUT_PORTS_END |
| 52 | |
| 53 | ioport_constructor sb8_device::device_input_ports() const |
| 54 | { |
| 55 | return INPUT_PORTS_NAME( sblaster ); |
| 56 | } |
| 57 | |
| 38 | 58 | static const int m_cmd_fifo_length[256] = |
| 39 | 59 | { |
| 40 | 60 | /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ |
| r14068 | r14069 | |
| 372 | 392 | process_fifo(m_dsp.fifo[0]); |
| 373 | 393 | } |
| 374 | 394 | |
| 395 | |
| 396 | READ8_MEMBER ( sb8_device::joy_port_r ) |
| 397 | { |
| 398 | UINT8 data = 0; |
| 399 | int delta; |
| 400 | attotime new_time = machine().time(); |
| 401 | |
| 402 | { |
| 403 | data = input_port_read(this, "pc_joy") | 0x0f; |
| 404 | |
| 405 | { |
| 406 | delta = ((new_time - m_joy_time) * 256 * 1000).seconds; |
| 407 | |
| 408 | if (input_port_read(this, "pc_joy_1") < delta) data &= ~0x01; |
| 409 | if (input_port_read(this, "pc_joy_2") < delta) data &= ~0x02; |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | return data; |
| 414 | } |
| 415 | |
| 416 | |
| 417 | |
| 418 | WRITE8_MEMBER ( sb8_device::joy_port_w ) |
| 419 | { |
| 420 | m_joy_time = machine().time(); |
| 421 | } |
| 422 | |
| 423 | |
| 375 | 424 | //************************************************************************** |
| 376 | 425 | // GLOBAL VARIABLES |
| 377 | 426 | //************************************************************************** |
| r14068 | r14069 | |
| 425 | 474 | |
| 426 | 475 | void sb8_device::device_start() |
| 427 | 476 | { |
| 477 | m_isa->install_device( 0x0200, 0x0207, 0, 0, read8_delegate(FUNC(sb8_device::joy_port_r), this), write8_delegate(FUNC(sb8_device::joy_port_w), this)); |
| 428 | 478 | m_isa->install_device( 0x0226, 0x0227, 0, 0, read8_delegate(FUNC(sb8_device::dsp_reset_r), this), write8_delegate(FUNC(sb8_device::dsp_reset_w), this)); |
| 429 | 479 | m_isa->install_device(subdevice("ym3812"), 0x0228, 0x0229, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) ); |
| 430 | 480 | m_isa->install_device( 0x022a, 0x022b, 0, 0, read8_delegate(FUNC(sb8_device::dsp_data_r), this), write8_delegate(FUNC(sb8_device::dsp_data_w), this) ); |