Previous 15994 Revisions Next

r14069 Monday 16th January, 2012 at 22:19:59 UTC by Angelo Salese
Added game port to Sound Blaster
[src/mess/machine]isa_sblaster.c isa_sblaster.h

src/mess/machine/isa_sblaster.c
r14068r14069
33  ISA 8 bit Creative Labs Sound Blaster Sound Card
44
55  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;
88  - implement jumpers DIP-SWs;
99
1010***************************************************************************/
r14068r14069
3535*/
3636#define ym3812_StdClock XTAL_3_579545MHz
3737
38static 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)
51INPUT_PORTS_END
52
53ioport_constructor sb8_device::device_input_ports() const
54{
55   return INPUT_PORTS_NAME( sblaster );
56}
57
3858static const int m_cmd_fifo_length[256] =
3959{
4060/*   0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F        */
r14068r14069
372392   process_fifo(m_dsp.fifo[0]);
373393}
374394
395
396READ8_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
418WRITE8_MEMBER ( sb8_device::joy_port_w )
419{
420   m_joy_time = machine().time();
421}
422
423
375424//**************************************************************************
376425//  GLOBAL VARIABLES
377426//**************************************************************************
r14068r14069
425474
426475void sb8_device::device_start()
427476{
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));
428478   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));
429479   m_isa->install_device(subdevice("ym3812"),    0x0228, 0x0229, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
430480   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) );
src/mess/machine/isa_sblaster.h
r14068r14069
5050        DECLARE_READ8_MEMBER(dsp_wbuf_status_r);
5151        DECLARE_WRITE8_MEMBER(dsp_rbuf_status_w);
5252        DECLARE_WRITE8_MEMBER(dsp_cmd_w);
53        DECLARE_READ8_MEMBER(joy_port_r);
54        DECLARE_WRITE8_MEMBER(joy_port_w);
55      virtual ioport_constructor device_input_ports() const;
5356
5457protected:
5558        // device-level overrides
r14068r14069
6265
6366        struct sb8_dsp_state m_dsp;
6467        UINT8 m_dack_out;
68        attotime m_joy_time;
6569
6670private:
6771        emu_timer *m_timer;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team