Previous 15994 Revisions Next

r5613 Monday 7th September, 2009 at 02:35:43 UTC by Barry Rodewald
[X1] Fixed cassette reading and writing (WAV only).
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5612r5613
537537
538538static UINT8 key_irq_vector;
539539static UINT8 cmt_current_cmd;
540static UINT8 cmt_test;
540541
541542static void cmt_command( running_machine* machine, UINT8 cmd )
542543{
r5612r5613
555556   {
556557      case 0x01:  // Stop
557558         cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
559         cmt_test = 1;
558560         break;
559561      case 0x02:  // Play
560562         cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
561563         break;
564      case 0x0a:  // Record
565         cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
566         break;
562567      default:
563568         logerror("Unimplemented or invalid CMT command (0x%02x)\n",cmd);
564569   }
r5612r5613
608613         logerror("CMT: Command 0xEA received, returning 0x%02x.\n",sub_val[0]);
609614         break;
610615      case 0xeb:  // CMT Tape status
611                  // bit 0 = tape end
616                  // bit 0 = tape end (0=end of tape)
612617               // bit 1 = tape inserted
613               // bit 2 = ???
614         sub_val[0] = 0x02;  // assume a tape is inserted for now
618               // bit 2 = record status (1=OK, 0=write protect?)
619         sub_val[0] = 0x07;  // assume a tape is inserted for now
615620         sub_cmd_length = 1;
616621         logerror("CMT: Command 0xEB received, returning 0x%02x.\n",sub_val[0]);
617622         break;
r5612r5613
11971202   ---- ---x "cmt test" (active low)
11981203   */
11991204   UINT8 dat = 0;
1200   dat = (input_port_read(device->machine, "SYSTEM") & ~0x68) | sub_obf;
1205   dat = (input_port_read(device->machine, "SYSTEM") & ~0x6e) | sub_obf;
12011206
12021207   if((dat & 0x80) == 0)
12031208      dat |= 0x04;  // VSync (todo: proper implementation of vsync)
r5612r5613
12051210   if(cassette_input(devtag_get_device(device->machine,"cass")) > 0.03)
12061211      dat |= 0x02;
12071212
1208   if(cassette_get_state(devtag_get_device(device->machine,"cass")) & CASSETTE_MOTOR_DISABLED)
1209      dat |= 0x02;
1213//   if(cassette_get_state(devtag_get_device(device->machine,"cass")) & CASSETTE_MOTOR_DISABLED)
1214//      dat &= ~0x02;  // is zero if not playing
1215     
1216   if(cmt_test != 0)
1217   {
1218      dat |= 0x01;
1219      cmt_test = 1;
1220   }
12101221
12111222   return dat;
12121223}
r5612r5613
17561767   timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback);
17571768
17581769   cmt_current_cmd = 0;
1770   cmt_test = 0;
17591771   cassette_change_state(devtag_get_device(machine, "cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
17601772}
17611773

Previous 15994 Revisions Next


© 1998-2018 The MESS Team