Previous 15994 Revisions Next

r14419 Saturday 11th February, 2012 at 02:11:29 UTC by Barry Rodewald
isa_gus: Added game port, and fixed reading of the register select port, so that Jazz Jackrabbit will run with the GUS enabled. (no whatsnew)
[src/mess/machine]isa_gus.c isa_gus.h

src/mess/machine/isa_gus.c
r14418r14419
4646   {
4747      case 0:
4848         return m_adlib_status;
49         break;
49      case 1:
50         return m_adlib_data;
5051   }
5152   return retVal;
5253}
r14418r14419
5960         m_adlib_cmd = data;
6061         break;
6162      case 1:
62         switch(m_adlib_cmd)
63         if(m_adlib_cmd == 0x04 && !(m_timer_ctrl & 0x01))
6364         {
64         case 0x04:
6565            if(data & 0x80)
6666            {
6767               m_timer1_irq_func(0);
r14418r14419
9494               logerror("GUS: Timer enable - %02x\n",data);
9595            }
9696            m_adlib_timer_cmd = data;
97            break;
98         default:
99            logerror("GUS: Invalid Adlib register write %02x\n",m_adlib_cmd);
10097         }
98         else
99         {
100            m_adlib_data = data;
101            if(m_timer_ctrl & 0x02)
102            {
103               m_irq_source |= 0x10;
104               //m_adlib_status |= 0x01;
105               m_timer1_irq_func(1);
106               logerror("GUS: 2X9 Timer triggered!\n");
107            }
108         }
101109         break;
102110   }
103111}
r14418r14419
405413   if(offset == 0)
406414      return m_current_voice;
407415   else
408      return m_current_reg;
416      return m_current_reg | 0xc0;
409417}
410418
411419WRITE8_MEMBER(gf1_device::global_reg_select_w)
r14418r14419
950958         logerror("GUS: DMA channels set: DMA%i, DMA%i\n",m_dma_channel1,m_dma_channel2);
951959      }
952960   }
961   else
962   {
963      m_adlib_status = data;
964      logerror("GUS: Adlib status set to %02x\n",data);
965   }
953966}
954967
955968/* port 0x2X0 - Mix control register
r14418r14419
10811094//   MCFG_ACIA6850_ADD("midi",gus_midi_interface)
10821095MACHINE_CONFIG_END
10831096
1097static INPUT_PORTS_START( gus_joy )
1098   PORT_START("gus_joy")
1099   PORT_BIT( 0x0f, IP_ACTIVE_LOW,    IPT_UNUSED ) // x/y ad stick to digital converters
1100   PORT_BIT( 0x10, IP_ACTIVE_LOW,   IPT_BUTTON1) PORT_NAME("GUS Joystick Button 1")
1101   PORT_BIT( 0x20, IP_ACTIVE_LOW,   IPT_BUTTON2) PORT_NAME("GUS Joystick Button 2")
1102   PORT_BIT( 0x40, IP_ACTIVE_LOW,   IPT_BUTTON3) PORT_NAME("GUS Joystick Button 3")
1103   PORT_BIT( 0x80, IP_ACTIVE_LOW,   IPT_BUTTON4) PORT_NAME("GUS Joystick Button 4")
1104
1105   PORT_START("gus_joy_1")
1106   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)
1107
1108   PORT_START("gus_joy_2")
1109   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)
1110INPUT_PORTS_END
1111
10841112//-------------------------------------------------
10851113//  machine_config_additions - device-specific
10861114//  machine configurations
r14418r14419
10911119   return MACHINE_CONFIG_NAME( gus_config );
10921120}
10931121
1122ioport_constructor isa16_gus_device::device_input_ports() const
1123{
1124   return INPUT_PORTS_NAME( gus_joy );
1125}
10941126
1127
10951128isa16_gus_device::isa16_gus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
10961129      : device_t(mconfig, ISA16_GUS, "Ultrasound", tag, owner, clock),
10971130        device_isa16_card_interface( mconfig, *this )
r14418r14419
11031136   m_gf1 = subdevice<gf1_device>("gf1");
11041137   //m_midi = subdevice<acia6850_device>("midi");
11051138   set_isa_device();
1139   m_isa->install_device(0x0200, 0x0201, 0, 0, read8_delegate(FUNC(isa16_gus_device::joy_r),this), write8_delegate(FUNC(isa16_gus_device::joy_w),this) );
11061140   m_isa->install_device(0x0220, 0x022f, 0, 0, read8_delegate(FUNC(isa16_gus_device::board_r),this), write8_delegate(FUNC(isa16_gus_device::board_w),this) );
1107   m_isa->install_device(0x0320, 0x032f, 0, 0, read8_delegate(FUNC(isa16_gus_device::synth_r),this), write8_delegate(FUNC(isa16_gus_device::synth_w),this) );
1141   m_isa->install_device(0x0320, 0x0327, 0, 0, read8_delegate(FUNC(isa16_gus_device::synth_r),this), write8_delegate(FUNC(isa16_gus_device::synth_w),this) );
11081142   m_isa->install_device(0x0388, 0x0389, 0, 0, read8_delegate(FUNC(isa16_gus_device::adlib_r),this), write8_delegate(FUNC(isa16_gus_device::adlib_w),this) );
11091143}
11101144
r14418r14419
11631197   case 0x0a:
11641198   case 0x0b:
11651199      m_gf1->adlib_cmd_w(space,offset-10,data);
1200      break;
11661201   default:
11671202      logerror("GUS: Invalid or unimplemented register write %02x of port 0x2X%01x\n",data,offset);
11681203   }
r14418r14419
12291264   m_gf1->adlib_w(space,offset,data);
12301265}
12311266
1267READ8_MEMBER(isa16_gus_device::joy_r)
1268{
1269   if(offset == 1)
1270   {
1271      UINT8 data = 0;
1272      int delta;
1273      attotime new_time = machine().time();
1274
1275      {
1276         data = input_port_read(*this, "gus_joy") | 0x0f;
1277
1278         {
1279            delta = ((new_time - m_joy_time) * 256 * 1000).seconds;
1280
1281            if (input_port_read(*this, "gus_joy_1") < delta) data &= ~0x01;
1282            if (input_port_read(*this, "gus_joy_2") < delta) data &= ~0x02;
1283         }
1284      }
1285      return data;
1286   }
1287   return 0xff;
1288}
1289
1290WRITE8_MEMBER(isa16_gus_device::joy_w)
1291{
1292   m_joy_time = machine().time();
1293}
1294
12321295WRITE_LINE_MEMBER(isa16_gus_device::wavetable_irq)
12331296{
12341297   if(state)
src/mess/machine/isa_gus.h
r14418r14419
194194        UINT8 m_adlib_timer1_enable;
195195        UINT8 m_adlib_timer2_enable;
196196        UINT8 m_adlib_status;
197        UINT8 m_adlib_data;
197198        UINT8 m_voice_irq_fifo[32];
198199        UINT8 m_voice_irq_ptr;
199200        UINT8 m_voice_irq_current;
r14418r14419
222223      DECLARE_WRITE8_MEMBER(synth_w);
223224      DECLARE_READ8_MEMBER(adlib_r);
224225      DECLARE_WRITE8_MEMBER(adlib_w);
226        DECLARE_READ8_MEMBER(joy_r);
227        DECLARE_WRITE8_MEMBER(joy_w);
225228        DECLARE_WRITE_LINE_MEMBER(midi_irq);
226229        DECLARE_WRITE_LINE_MEMBER(wavetable_irq);
227230        DECLARE_WRITE_LINE_MEMBER(volumeramp_irq);
r14418r14419
237240
238241        // optional information overrides
239242      virtual machine_config_constructor device_mconfig_additions() const;
243      virtual ioport_constructor device_input_ports() const;
240244protected:
241245        // device-level overrides
242246        virtual void device_start();
r14418r14419
248252        acia6850_device* m_midi;
249253
250254        UINT8 m_irq_status;
255        attotime m_joy_time;
251256};
252257
253258// device type definition

Previous 15994 Revisions Next


© 1998-2018 The MESS Team