src/mess/machine/isa_gus.c
| r14418 | r14419 | |
| 46 | 46 | { |
| 47 | 47 | case 0: |
| 48 | 48 | return m_adlib_status; |
| 49 | | break; |
| 49 | case 1: |
| 50 | return m_adlib_data; |
| 50 | 51 | } |
| 51 | 52 | return retVal; |
| 52 | 53 | } |
| r14418 | r14419 | |
| 59 | 60 | m_adlib_cmd = data; |
| 60 | 61 | break; |
| 61 | 62 | case 1: |
| 62 | | switch(m_adlib_cmd) |
| 63 | if(m_adlib_cmd == 0x04 && !(m_timer_ctrl & 0x01)) |
| 63 | 64 | { |
| 64 | | case 0x04: |
| 65 | 65 | if(data & 0x80) |
| 66 | 66 | { |
| 67 | 67 | m_timer1_irq_func(0); |
| r14418 | r14419 | |
| 94 | 94 | logerror("GUS: Timer enable - %02x\n",data); |
| 95 | 95 | } |
| 96 | 96 | m_adlib_timer_cmd = data; |
| 97 | | break; |
| 98 | | default: |
| 99 | | logerror("GUS: Invalid Adlib register write %02x\n",m_adlib_cmd); |
| 100 | 97 | } |
| 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 | } |
| 101 | 109 | break; |
| 102 | 110 | } |
| 103 | 111 | } |
| r14418 | r14419 | |
| 405 | 413 | if(offset == 0) |
| 406 | 414 | return m_current_voice; |
| 407 | 415 | else |
| 408 | | return m_current_reg; |
| 416 | return m_current_reg | 0xc0; |
| 409 | 417 | } |
| 410 | 418 | |
| 411 | 419 | WRITE8_MEMBER(gf1_device::global_reg_select_w) |
| r14418 | r14419 | |
| 950 | 958 | logerror("GUS: DMA channels set: DMA%i, DMA%i\n",m_dma_channel1,m_dma_channel2); |
| 951 | 959 | } |
| 952 | 960 | } |
| 961 | else |
| 962 | { |
| 963 | m_adlib_status = data; |
| 964 | logerror("GUS: Adlib status set to %02x\n",data); |
| 965 | } |
| 953 | 966 | } |
| 954 | 967 | |
| 955 | 968 | /* port 0x2X0 - Mix control register |
| r14418 | r14419 | |
| 1081 | 1094 | // MCFG_ACIA6850_ADD("midi",gus_midi_interface) |
| 1082 | 1095 | MACHINE_CONFIG_END |
| 1083 | 1096 | |
| 1097 | static 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) |
| 1110 | INPUT_PORTS_END |
| 1111 | |
| 1084 | 1112 | //------------------------------------------------- |
| 1085 | 1113 | // machine_config_additions - device-specific |
| 1086 | 1114 | // machine configurations |
| r14418 | r14419 | |
| 1091 | 1119 | return MACHINE_CONFIG_NAME( gus_config ); |
| 1092 | 1120 | } |
| 1093 | 1121 | |
| 1122 | ioport_constructor isa16_gus_device::device_input_ports() const |
| 1123 | { |
| 1124 | return INPUT_PORTS_NAME( gus_joy ); |
| 1125 | } |
| 1094 | 1126 | |
| 1127 | |
| 1095 | 1128 | isa16_gus_device::isa16_gus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1096 | 1129 | : device_t(mconfig, ISA16_GUS, "Ultrasound", tag, owner, clock), |
| 1097 | 1130 | device_isa16_card_interface( mconfig, *this ) |
| r14418 | r14419 | |
| 1103 | 1136 | m_gf1 = subdevice<gf1_device>("gf1"); |
| 1104 | 1137 | //m_midi = subdevice<acia6850_device>("midi"); |
| 1105 | 1138 | 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) ); |
| 1106 | 1140 | 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) ); |
| 1108 | 1142 | 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) ); |
| 1109 | 1143 | } |
| 1110 | 1144 | |
| r14418 | r14419 | |
| 1163 | 1197 | case 0x0a: |
| 1164 | 1198 | case 0x0b: |
| 1165 | 1199 | m_gf1->adlib_cmd_w(space,offset-10,data); |
| 1200 | break; |
| 1166 | 1201 | default: |
| 1167 | 1202 | logerror("GUS: Invalid or unimplemented register write %02x of port 0x2X%01x\n",data,offset); |
| 1168 | 1203 | } |
| r14418 | r14419 | |
| 1229 | 1264 | m_gf1->adlib_w(space,offset,data); |
| 1230 | 1265 | } |
| 1231 | 1266 | |
| 1267 | READ8_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 | |
| 1290 | WRITE8_MEMBER(isa16_gus_device::joy_w) |
| 1291 | { |
| 1292 | m_joy_time = machine().time(); |
| 1293 | } |
| 1294 | |
| 1232 | 1295 | WRITE_LINE_MEMBER(isa16_gus_device::wavetable_irq) |
| 1233 | 1296 | { |
| 1234 | 1297 | if(state) |
src/mess/machine/isa_gus.h
| r14418 | r14419 | |
| 194 | 194 | UINT8 m_adlib_timer1_enable; |
| 195 | 195 | UINT8 m_adlib_timer2_enable; |
| 196 | 196 | UINT8 m_adlib_status; |
| 197 | UINT8 m_adlib_data; |
| 197 | 198 | UINT8 m_voice_irq_fifo[32]; |
| 198 | 199 | UINT8 m_voice_irq_ptr; |
| 199 | 200 | UINT8 m_voice_irq_current; |
| r14418 | r14419 | |
| 222 | 223 | DECLARE_WRITE8_MEMBER(synth_w); |
| 223 | 224 | DECLARE_READ8_MEMBER(adlib_r); |
| 224 | 225 | DECLARE_WRITE8_MEMBER(adlib_w); |
| 226 | DECLARE_READ8_MEMBER(joy_r); |
| 227 | DECLARE_WRITE8_MEMBER(joy_w); |
| 225 | 228 | DECLARE_WRITE_LINE_MEMBER(midi_irq); |
| 226 | 229 | DECLARE_WRITE_LINE_MEMBER(wavetable_irq); |
| 227 | 230 | DECLARE_WRITE_LINE_MEMBER(volumeramp_irq); |
| r14418 | r14419 | |
| 237 | 240 | |
| 238 | 241 | // optional information overrides |
| 239 | 242 | virtual machine_config_constructor device_mconfig_additions() const; |
| 243 | virtual ioport_constructor device_input_ports() const; |
| 240 | 244 | protected: |
| 241 | 245 | // device-level overrides |
| 242 | 246 | virtual void device_start(); |
| r14418 | r14419 | |
| 248 | 252 | acia6850_device* m_midi; |
| 249 | 253 | |
| 250 | 254 | UINT8 m_irq_status; |
| 255 | attotime m_joy_time; |
| 251 | 256 | }; |
| 252 | 257 | |
| 253 | 258 | // device type definition |