Previous 15994 Revisions Next

r6626 Monday 14th December, 2009 at 09:12:30 UTC by Curt Coder
[C1541] LOAD"$",8
[src/mess/machine]c1541.c cbmserial.c

src/mess/machine/cbmserial.c
r6625r6626
281281      {
282282         if (daisy->line[line] != state)
283283         {
284            logerror("CBM serial bus device '%s' %s %u\n", calling_device->tag, SIGNAL_NAME[line], state);
284            if (LOG) logerror("CBM Serial Bus: '%s' %s %u\n", calling_device->tag, SIGNAL_NAME[line], state);
285285            daisy->line[line] = state;
286286         }
287287         break;
r6625r6626
296296      if (daisy->out_line_func[line]) (daisy->out_line_func[line])(daisy->device, data);
297297   }
298298
299   logerror("SRQ %u ATN %u CLK %u DATA %u RESET %u\n", get_signal(serial_bus_device, SRQ),get_signal(serial_bus_device, ATN),get_signal(serial_bus_device, CLK),get_signal(serial_bus_device, DATA),get_signal(serial_bus_device, RESET));
299   if (LOG) logerror("CBM Serial Bus: SRQ %u ATN %u CLK %u DATA %u RESET %u\n", get_signal(serial_bus_device, SRQ),get_signal(serial_bus_device, ATN),get_signal(serial_bus_device, CLK),get_signal(serial_bus_device, DATA),get_signal(serial_bus_device, RESET));
300300}
301301
302302/***************************************************************************
src/mess/machine/c1541.c
r6625r6626
140140    PARAMETERS
141141***************************************************************************/
142142
143#define LOG 1
143#define LOG
144144
145145#define M6502_TAG      "ucd5"
146146#define M6522_0_TAG      "uab1"
r6625r6626
173173   UINT8 yb;                     /* GCR data byte */
174174   int byte;                     /* byte ready */
175175   int atna;                     /* attention acknowledge */
176   int ds;                        /* data speed */
177   int stp;                     /* stepper motor phase */
176   int ds;                        /* density select */
177   int stp;                     /* stepping motor */
178178   int soe;                     /* s? output enable */
179179   int mode;                     /* mode (0 = write, 1 = read) */
180   int sync;
180181
181182   /* serial bus */
182183   int data_out;                  /* serial bus data output */
r6625r6626
227228
228229   if (c1541->bit_pos == 0x07)
229230   {
230      c1541->yb = c1541->track_buffer[c1541->buffer_pos];
231      UINT8 data = c1541->track_buffer[c1541->buffer_pos];
232
233      if (data != 0xff)
234      {
235         c1541->yb = data;
236         byte = 1;
237      }
238
239      c1541->sync = !(c1541->mode && (data == 0xff));
240
231241      c1541->buffer_pos++;
232242
233243      if (c1541->buffer_pos > c1541->track_len)
r6625r6626
235245         c1541->buffer_pos = 0;
236246      }
237247
248//      logerror("YB %02x pos %u\n", c1541->yb, c1541->buffer_pos-1);
249
238250      c1541->bit_pos = 0;
239
240      byte = 1;
241251   }
242252   else
243253   {
r6625r6626
437447{
438448   /*
439449
440      bit      description
450      bit      signal      description
441451
442      PB0      STP1
443      PB1      STP0
444      PB2      MTR
445      PB3      ACT
446      PB4      WPS input   write protect sensor
447      PB5      DS0
448      PB6      DS1
449      PB7      SYNC input
452      PB0      STP0      stepping motor bit 0
453      PB1      STP1      stepping motor bit 1
454      PB2      MTR         motor ON/OFF
455      PB3      ACT         drive 0 LED
456      PB4      WPS         write protect sense
457      PB5      DS0         density select 0
458      PB6      DS1         density select 1
459      PB7      SYNC      SYNC detect line
450460
451461   */
452462
453463   c1541_t *c1541 = get_safe_token(device->owner);
454464   UINT8 data = 0;
455465
456   /* write protect sensor */
466   /* write protect sense */
457467   data |= (floppy_drive_get_flag_state(c1541->image, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) == FLOPPY_DRIVE_DISK_WRITE_PROTECTED) << 4;
458468
459   /* SYNC detected */
460   data |= !(c1541->mode && (c1541->yb == 0xff)) << 7;
469   /* SYNC detect */
470   //logerror("SYNC %u\n", !(c1541->mode && (c1541->yb == 0xff)));
471   data |= c1541->sync << 7;
461472
462473   return data;
463474}
r6625r6626
466477{
467478   /*
468479
469      bit      description
480      bit      signal      description
470481
471      PB0      STP1
472      PB1      STP0
473      PB2      MTR
474      PB3      ACT
475      PB4      WPS input
476      PB5      DS0
477      PB6      DS1
478      PB7      SYNC input
482      PB0      STP0      stepping motor bit 0
483      PB1      STP1      stepping motor bit 1
484      PB2      MTR         motor ON/OFF
485      PB3      ACT         drive 0 LED
486      PB4      WPS         write protect sense
487      PB5      DS0         density select 0
488      PB6      DS1         density select 1
489      PB7      SYNC      SYNC detect line
479490
480491   */
481492
r6625r6626
517528
518529   /* activity LED */
519530
520   /* data speed */
531   /* density select */
521532   if (c1541->ds != ds)
522533   {
523      timer_adjust_periodic(c1541->bit_timer, attotime_zero, 0, ATTOTIME_IN_HZ(C1541_BITRATE[ds]));
534      //logerror("DS %u\n", ds);
535      timer_adjust_periodic(c1541->bit_timer, attotime_zero, 0, ATTOTIME_IN_HZ(C1541_BITRATE[ds]/4));
524536      c1541->ds = ds;
525537   }
526538}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team