Previous 199869 Revisions Next

r32474 Tuesday 30th September, 2014 at 19:51:00 UTC by Michael Zapf
(MESS) HDC9234 still WIP, added some more functions and burst mode.(nw)
[src/emu/machine]hdc9234.c hdc9234.h

trunk/src/emu/machine/hdc9234.c
r32473r32474
3434#define TRACE_SETREG 0
3535#define TRACE_SETPTR 0
3636#define TRACE_FORMAT 0
37#define TRACE_READTRACK 0
3738
3839// Common states
3940#define TRACE_READID 0
r32473r32474
5960
6061#define UNRELIABLE_MEDIA 0
6162
62// Not implemented:
63// Poll drives
64// Seek/Read ID
65// Read track
66// Write long (variant of the write operation, selectable by MODE register)
67// Tape operations
63/*
64   === Not implemented ===
65   ECC
66   Write long (see MODE register; only useful with ECC)
67   Tape operations
68   Hard disk operation
6869
69// Untested:
70// Multi-sector read/write
71// Seek complete
72// Read/write sectors physical
70   === Implemented but untested ===
71   Burst mode
72   Restore
73   Poll drives
74   Seek/Read ID
75   Multi-sector read/write
76   Usage of seek complete
77   Read/write sectors physical
78   Read track
79*/
7380
74// TDF
75
7681/*
77    Register names of the HDC. The left part is the set of write registers,
78    while the right part are the read registers.
82    Some registers of the HDC.
7983
8084            +------+------+------+------+------+------+------+------+
8185    DHEAD:  |   0  | Sector size |  0   |   Desired head  (OUTPUT2) |  AT mode
r32473r32474
299303
300304   STEP_ON,
301305   STEP_OFF,
302   RESTORE_CHECK1,
303   RESTORE_CHECK2,
306   RESTORE_CHECK,
307   WAIT_SEEK_COMPLETE,
304308   SEEK_COMPLETE,
305309   HEAD_DELAY,
306310   WAITINDEX0,
307311   WAITINDEX1,
308312   TRACKSTART,
309313   TRACKDONE,
314   POLL1,
315   POLL2,
316   POLL3,
310317
311318   READ_ID = 0x40,
312319   READ_ID1,
313320   READ_ID_STEPON,
314321   READ_ID_STEPOFF,
322   READ_ID_SEEK_COMPLETE,
315323
316324   VERIFY = 0x50,
317325   VERIFY1,
r32473r32474
367375   WRITE_DONE,
368376   WRITE_HEADER_CRC,
369377
378   READ_TRACK,
379   READ_TRACK_ID,
380   READ_TRACK_ID_DONE,
381
370382   NO_DMA_ACK
371383};
372384
r32473r32474
476488
477489int hdc9234_device::current_cylinder()
478490{
491   int abc = 0;
479492   return (m_register_r[CURRENT_CYLINDER] & 0xff) | (m_register_r[CURRENT_HEAD] & 0x70);
480493}
481494
r32473r32474
489502   return m_register_w[COMMAND];
490503}
491504
505bool hdc9234_device::using_floppy()
506{
507   return (m_selected_drive_type == TYPE_FLOPPY5 || m_selected_drive_type == TYPE_FLOPPY8);
508}
509
492510/*
493    Set/clear INT
494
495    Interupts are generated in the following occasions:
496    - when the DONE bit is set to 1 in the ISR and ST_DONE is set to 1
497    - when the READY_CHANGE bit is set to 1 in the ISR and ST_RDYCHNG is set to 1
498    (ready change: 1->0 or 0->1)
511    Delivers the step time (in microseconds) minus the pulse width
499512*/
500void hdc9234_device::set_interrupt(line_state intr)
513int hdc9234_device::step_time()
501514{
502   if (intr == ASSERT_LINE)
503   {
504      // Only if there is not already a pending interrupt
505      if ((m_register_r[INT_STATUS] & ST_INTPEND) == 0)
506      {
507         m_register_r[INT_STATUS] |= ST_INTPEND;
508         m_out_intrq(intr);
509      }
510   }
515   int time = 0;
516   int index = m_register_w[MODE] & MO_STEPRATE;
517   // Get seek time.
518   if (m_selected_drive_type == TYPE_FLOPPY8)
519      time = step_flop8[index] - pulse_flop8;
520
521   else if (m_selected_drive_type == TYPE_FLOPPY5)
522      time = step_flop5[index] - pulse_flop5;
511523   else
512   {
513      // if there is a pending interrupt
514      if ((m_register_r[INT_STATUS] & ST_INTPEND) != 0)
515         m_out_intrq(intr);
516   }
524      time = step_hd[index] - pulse_hd;
525
526   if (fm_mode()) time = time * 2;
527   return time;
517528}
518529
519530/*
520    Assert Command Done status bit, triggering interrupts as needed
531    Delivers the pulse width time (in microseconds)
521532*/
522void hdc9234_device::set_command_done(int flags)
533int hdc9234_device::pulse_width()
523534{
524   set_bits(m_register_r[INT_STATUS], ST_DONE, true);
535   int time = 0;
536   // Get seek time.
537   if (m_selected_drive_type == TYPE_FLOPPY8)
538      time = pulse_flop8;
525539
526   if (flags != -1)
527   {
528      set_bits(m_register_r[INT_STATUS], ST_TERMCOD, false); // clear the previously set flags
529      m_register_r[INT_STATUS] |= flags;
530      if (TRACE_DONE) logerror("%s: command %02x done, flags=%02x\n", tag(), current_command(), flags);
531   }
540   else if (m_selected_drive_type == TYPE_FLOPPY5)
541      time = pulse_flop5;
532542   else
533   {
534      if (TRACE_DONE) logerror("%s: command %02x done\n", tag(), current_command());
535   }
543      time = pulse_hd;
536544
537   // [1], p. 6
538   if (TRACE_INT) logerror("%s: Raise interrupt DONE\n", tag());
539   set_interrupt(ASSERT_LINE);
545   if (fm_mode()) time = time * 2;
546   return time;
547}
540548
541   m_substate = UNDEF;
542   m_executing = false;
549bool hdc9234_device::rapid_steps()
550{
551   return (m_register_w[MODE] & MO_STEPRATE) == 0;
543552}
544553
545554/*
546    Preserve previously set termination code
555    Delivers the sector size
547556*/
548void hdc9234_device::set_command_done()
557int hdc9234_device::calc_sector_size()
549558{
550   set_command_done(-1);
559   return 128 << (m_register_r[CURRENT_SIZE] & 3);
551560}
552561
562// ===========================================================================
563//    Wait handling
564//    We can wait for a given time period or for a line to be set or cleared
565// ===========================================================================
566
553567void hdc9234_device::wait_time(emu_timer *tm, int microsec, int next_substate)
554568{
555569   if (TRACE_DELAY) logerror("%s: Delay by %d microsec\n", tag(), microsec);
r32473r32474
564578   m_substate = param;
565579}
566580
581/*
582    Set the hook for line level handling
583*/
584void hdc9234_device::wait_line(int line, line_state level, int substate, bool stopwrite)
585{
586   m_event_line = line;
587   m_line_level = level;
588   m_state_after_line = substate;
589   m_stopwrite = stopwrite;
590}
591
567592// ==================================================================
568593//     Common subroutines READ ID, VERIFY, DATA TRANSFER
569594//     called by all sector access commands
r32473r32474
578603    (must have saved that value before!)
579604    - steps to that location during OUTPUT2 times
580605*/
581void hdc9234_device::read_id(int& cont, bool implied_seek)
606void hdc9234_device::read_id(int& cont, bool implied_seek, bool wait_seek_complete)
582607{
583608   cont = CONTINUE;
584609
r32473r32474
590615         // Implied seek: Enter the READ_ID subprogram.
591616         if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate READ_ID\n", tag());
592617
593         m_substate = implied_seek? READ_ID1 : VERIFY;
594
595618         // First step: Search the next IDAM, and if found, read the
596619         // ID values into the registers
597         // Depending on the implied seek flag, continue with the read_id,
620
621         // Depending on the implied seek flag, continue with read_id,
598622         // else switch to verify.
623         m_substate = implied_seek? READ_ID1 : VERIFY;
624
599625         m_live_state.bit_count_total = 0;
600626         live_start(SEARCH_IDAM);
601627         cont = WAIT;
r32473r32474
638664         // Any more steps left?
639665         if (m_track_delta == 0)
640666         {
641            m_substate = VERIFY;
642            cont = NEXT;
667            if (wait_seek_complete)
668            {
669               // We have to wait for SEEK COMPLETE
670               wait_line(SEEKCOMP_LINE, ASSERT_LINE, READ_ID_SEEK_COMPLETE, false);
671               cont = WAIT;
672            }
673            else
674            {
675               // We do not wait for SEEK COMPLETE
676               m_substate = VERIFY;
677               cont = NEXT;
678            }
643679            break;
644680         }
645681
r32473r32474
647683         // STEPDIR = 0 -> towards TRK00
648684         set_bits(m_output2, OUT2_STEPDIR, (m_track_delta>0));
649685         set_bits(m_output2, OUT2_STEPPULSE, true);
650         auxbus_out();
651686         wait_time(m_timer, pulse_width(), READ_ID_STEPOFF);
652687         cont = WAIT;
653688         break;
r32473r32474
655690      case READ_ID_STEPOFF:
656691         if (TRACE_READID && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag());
657692         set_bits(m_output2, OUT2_STEPPULSE, false);
658         auxbus_out();
659693         m_track_delta += (m_track_delta<0)? 1 : -1;
660694         // Return to STEP_ON, check whether there are more steps
661695         wait_time(m_timer, step_time(), READ_ID_STEPON);
662696         cont = WAIT;
663697         break;
664698
699      case READ_ID_SEEK_COMPLETE:
700         m_substate = VERIFY;
701         cont = NEXT;
702         break;
703
665704      default:
666705         logerror("%s: unknown substate %d in read_id\n", tag(), m_substate);
667706         cont = ERROR;
r32473r32474
958997
959998/*
960999    RESET
1000    Reset the controller. This has the same effect as asserting the RST* input line.
1001
1002    Command word
1003
1004       7     6     5     4     3     2     1     0
1005    +-----+-----+-----+-----+-----+-----+-----+-----+
1006    |  0  |  0  |  0  |  0  |  0  |  0  |  0  |  0  |
1007    +-----+-----+-----+-----+-----+-----+-----+-----+
1008
9611009*/
9621010void hdc9234_device::reset_controller()
9631011{
9641012   logerror("%s: RESET command\n", tag());
9651013   device_reset();
9661014}
1015
9671016/*
9681017    DESELECT DRIVE
1018    Deselect all drives.
1019
1020    Command word
1021
1022       7     6     5     4     3     2     1     0
1023    +-----+-----+-----+-----+-----+-----+-----+-----+
1024    |  0  |  0  |  0  |  0  |  0  |  0  |  0  |  1  |
1025    +-----+-----+-----+-----+-----+-----+-----+-----+
9691026*/
9701027void hdc9234_device::drive_deselect()
9711028{
9721029   if (TRACE_SELECT) logerror("%s: DESELECT command\n", tag());
9731030   m_selected_drive_number = NODRIVE;
974   auxbus_out();
9751031   set_command_done(TC_SUCCESS);
9761032}
9771033
9781034/*
979    // RESTORE DRIVE
980    // bit 0:
981    // 0 -> command ends after last seek pulse,
982    // 1 -> command ends when the drive asserts the seek complete pin
1035    RESTORE DRIVE
1036    Moves the heads to cylinder 0. If skcom is set, the command terminates
1037    after the SEEK COMPLETE line is set.
1038
1039    Command word
1040
1041       7     6     5     4     3     2     1     0
1042    +-----+-----+-----+-----+-----+-----+-----+-----+
1043    |  0  |  0  |  0  |  0  |  0  |  0  |  1  |skcom|
1044    +-----+-----+-----+-----+-----+-----+-----+-----+
9831045*/
9841046void hdc9234_device::restore_drive()
9851047{
9861048   int cont = CONTINUE;
1049   bool buffered_step = current_command() & 1;
9871050
9881051   // The substate is set to UNDEF when the command is started;
989   // when we return here after a pause, the substate is set to some other value
1052   // when we reenter the command processing after a pause, the substate is set to some other value
9901053   // In wd_fdc this is solved using two methods <command>_start and <command>_continue
1054
9911055   if (m_substate == UNDEF)
9921056   {
9931057      if (TRACE_RESTORE) logerror("%s: RESTORE command %02x\n", tag(), current_command());
9941058      m_seek_count = 0;
995      m_substate = RESTORE_CHECK1;
1059      m_substate = RESTORE_CHECK;
9961060   }
9971061
9981062   while (cont==CONTINUE)
9991063   {
10001064      switch (m_substate)
10011065      {
1002      case RESTORE_CHECK1:
1003         if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: substate RESTORE_CHECK; seek count = %d\n", tag(), m_seek_count);
1004         // If the drive is on track 0 or not ready (no drive), terminate the command
1005         if (on_track00())
1066      case RESTORE_CHECK:
1067         // Track 0 has not been reached yet
1068         if ((m_register_r[DRIVE_STATUS] & HDC_DS_READY)==0)
10061069         {
1007            if (TRACE_RESTORE) logerror("%s: restore command TRK00 reached\n", tag());
1008            if (current_command() & 1)
1070            if (TRACE_RESTORE) logerror("%s: restore command: drive not ready\n", tag());
1071            // Does not look like a success, but this takes into account
1072            // that if a drive is not connected we do not want an error message
1073            cont = SUCCESS;
1074            break;
1075         }
1076
1077         // Are we done?
1078         if (m_seek_count>=4096 || on_track00())
1079         {
1080            if (buffered_step)
10091081            {
1010               // Buffered seek; wait for SEEK_COMPLETE
1082               // When we have buffered steps, the seek limit will be reached
1083               // before TRK00 is asserted. In that case we have to wait for
1084               // SEEK_COMPLETE. We also wait as soon as TRK00 is asserted.
10111085               wait_line(SEEKCOMP_LINE, ASSERT_LINE, SEEK_COMPLETE, false);
10121086               cont = WAIT;
10131087            }
10141088            else
10151089            {
1016               cont = SUCCESS;
1090               // No buffered seek. If the seek limit has been reached
1091               // and TRK00 is not true, we failed. This will be decided below.
1092               m_substate = SEEK_COMPLETE;
10171093            }
1018            break;
10191094         }
1020         m_substate = RESTORE_CHECK2;
1095         else m_substate = STEP_ON;
10211096         break;
10221097
1023      case RESTORE_CHECK2:
1024         // Track 0 has not been reached yet
1025         if ((m_register_r[DRIVE_STATUS] & HDC_DS_READY)==0)
1026         {
1027            if (TRACE_RESTORE) logerror("%s: restore command: drive not ready\n", tag());
1028            // Does not look like a success, but this takes into account
1029            // that if a drive is not connected we do not want an error message
1030            cont = SUCCESS;
1031            break;
1032         }
1098      case STEP_ON:
1099         if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag());
10331100
10341101         // Increase step count
10351102         m_seek_count++;
1036         if (m_seek_count>=4096)
1037         {
1038            if (TRACE_FAIL) logerror("%s: restore command: failed to reach track 00\n", tag());
1039            set_command_done(TC_VRFYERR);
1040            cont = ERROR;
1041            break;
1042         }
10431103
1044         step_on(true, STEP_OFF);
1104         // STEPDIR = 0 -> towards TRK00
1105         set_bits(m_output2, OUT2_STEPDIR, false);
1106
1107         // Raising edge (note that all signals must be inverted before leading them to the drive)
1108         set_bits(m_output2, OUT2_STEPPULSE, true);
1109         wait_time(m_timer, pulse_width(), STEP_OFF);
10451110         cont = WAIT;
10461111         break;
10471112
10481113      case STEP_OFF:
1049         step_off(RESTORE_CHECK1);
1114         if (TRACE_RESTORE && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag());
1115         set_bits(m_output2, OUT2_STEPPULSE, false);
1116         wait_time(m_timer, step_time(), RESTORE_CHECK);
10501117         cont = WAIT;
10511118         break;
10521119
10531120      case SEEK_COMPLETE:
1054         cont = SUCCESS;
1121         // If TRK00 is not set, the drive failed to reach it.
1122         if (!on_track00())
1123         {
1124            if (TRACE_FAIL) logerror("%s: restore command: failed to reach track 00\n", tag());
1125            set_command_done(TC_VRFYERR);
1126            cont = ERROR;
1127         }
1128         else
1129            cont = SUCCESS;
10551130         break;
10561131      }
10571132   }
r32473r32474
10601135
10611136/*
10621137    STEP IN / OUT 1 CYLINDER
1138    Move the heads 1 step towards the center (in) or towards the outermost
1139    track (out).
1140
1141    Command word
1142
1143         7     6     5     4     3     2     1     0
1144      +-----+-----+-----+-----+-----+-----+-----+-----+
1145      |  0  |  0  |  0  |  0  |  0  |  1  | out |skcom|
1146      +-----+-----+-----+-----+-----+-----+-----+-----+
1147
10631148*/
10641149void hdc9234_device::step_drive()
10651150{
r32473r32474
10761161      switch (m_substate)
10771162      {
10781163      case STEP_ON:
1079         step_on((current_command() & 0x02)!=0, STEP_OFF);
1164         if (TRACE_STEP && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag());
1165
1166         // STEPDIR = 0 -> towards TRK00
1167         set_bits(m_output2, OUT2_STEPDIR, (current_command() & 0x02)==0);
1168
1169         // Raising edge (note that all signals must be inverted before leading them to the drive)
1170         set_bits(m_output2, OUT2_STEPPULSE, true);
1171         wait_time(m_timer, pulse_width(), STEP_OFF);
10801172         cont = WAIT;
10811173         break;
1174
10821175      case STEP_OFF:
1083         step_off(DONE);
1176         if (TRACE_STEP && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag());
1177         set_bits(m_output2, OUT2_STEPPULSE, false);
1178         wait_time(m_timer, step_time(), ((current_command() & 0x01)!=0)? WAIT_SEEK_COMPLETE : DONE);
10841179         cont = WAIT;
10851180         break;
1181
1182      case WAIT_SEEK_COMPLETE:
1183         wait_line(SEEKCOMP_LINE, ASSERT_LINE, DONE, false);
1184         cont = WAIT;
1185         break;
1186
10861187      case DONE:
10871188         cont = SUCCESS;
10881189         break;
r32473r32474
11031204
11041205/*
11051206    POLL DRIVES
1106    Not implemented
1207    Repeat
1208     - i = i+1 % 4
1209     - select drive if its bit is set in the command word
1210    until seek_complete is true.
1211
1212    Command word
1213
1214            7     6     5     4     3     2     1     0
1215         +-----+-----+-----+-----+-----+-----+-----+-----+
1216         |  0  |  0  |  0  |  1  | Drv3| Drv2| Drv1| Drv0|
1217         +-----+-----+-----+-----+-----+-----+-----+-----+
1218
1219    This command only sets the select lines but does not process parameters
1220    like head load times or drive types.
11071221*/
11081222void hdc9234_device::poll_drives()
11091223{
1110   logerror("%s: POLL DRIVES command %02x not implemented\n", tag(), current_command());
1111   set_command_done(TC_SUCCESS);
1224   UINT8 drivebit = 0;
1225   if (m_substate == UNDEF)
1226   {
1227      logerror("%s: POLL DRIVES command %02x\n", tag(), current_command());
1228      m_substate = POLL1;
1229      m_selected_drive_number = 0;
1230      // If there is no selection, do not enter the loop
1231      if ((current_command() & 0x0f)==0) m_substate = DONE;
1232   }
1233
1234   int cont = CONTINUE;
1235
1236   while (cont==CONTINUE)
1237   {
1238      switch (m_substate)
1239      {
1240      case POLL1:
1241         drivebit = (1 << m_selected_drive_number) & 0x0f;
1242
1243         if ((current_command() & drivebit) != 0)
1244         {
1245            // Test this drive
1246            m_register_r[CHIP_STATUS] = (m_register_r[CHIP_STATUS] & 0xfc) | m_selected_drive_number;
1247
1248            m_output1 = (drivebit << 4) | (m_register_w[RETRY_COUNT]&0x0f);
1249            if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT1 to %02x\n", tag(), m_output1);
1250            wait_time(m_timer, 1, POLL2);   // Wait for 1 usec
1251            cont = WAIT;
1252         }
1253         else
1254            m_substate = POLL3;
1255
1256         break;
1257
1258      case POLL2:
1259         if ((m_register_r[DRIVE_STATUS] & HDC_DS_SKCOM)!=0)
1260         {
1261            // Seek complete has been set
1262            m_substate = DONE;
1263            // Selected drive is still found in the chip status register
1264         }
1265         else m_substate = POLL3;
1266         break;
1267
1268      case POLL3:
1269         m_selected_drive_number = (m_selected_drive_number + 1) & 0x03;
1270         m_substate = POLL1;
1271         break;
1272
1273      case DONE:
1274         cont = SUCCESS;
1275         break;
1276      }
1277   }
1278
1279   if (cont==SUCCESS) set_command_done(TC_SUCCESS);
11121280}
11131281
11141282/*
11151283    DRIVE SELECT
1284    Selects a drive. With this command, parameters for the drive are also
1285    defined, like the type of drive (Floppy 8" or 5", AT Hard disk, or generic
1286    Hard disk), the drive number, and the head load delay.
11161287
1117    Command word
1288    On the next OUTPUT1 time, the number of the drive (one of four lines)
1289    is set on the higher four bits of the auxiliary bus. Also, the lower
1290    4 bits of the RETRY COUNT register are put on the lower 4 bits of the bus
1291    (user-programmable output, [1] p. 5).
11181292
1293    The HFDC controller board uses the user-programmable output to
1294    select one of four floppy disk drives with Drive set to 00.
1295    Drive codes 01, 10, and 11 remain for three hard disk drives.
1296
1297     Command word
1298
11191299            7     6     5     4     3     2     1     0
11201300         +-----+-----+-----+-----+-----+-----+-----+-----+
11211301         |  0  |  0  |  1  |Delay|    Type   |   Drive   |
11221302         +-----+-----+-----+-----+-----+-----+-----+-----+
1123
1124     [1] p.5: lower 4 bits of RETRY COUNT register (user programmable output) is put on OUTPUT1
1125
1126     The HFDC controller board uses the user programmable output to
1127     select one of four floppy disk drives with Drive set to 00.
1128     Drive codes 01, 10, and 11 remain for three hard disk drives.
11291303*/
11301304
11311305void hdc9234_device::drive_select()
r32473r32474
11621336      m_output1 = (m_selected_drive_number != NODRIVE)? (0x10 << m_selected_drive_number) : 0;
11631337      m_output1 |= (m_register_w[RETRY_COUNT]&0x0f);
11641338      if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT1 to %02x\n", tag(), m_output1);
1165
1166      auxbus_out();
1167
11681339      m_substate = (head_load_delay>0)? HEAD_DELAY : DONE;
11691340   }
11701341
r32473r32474
12081379
12091380/*
12101381    SEEK / READ ID
1211    Not implemented
1382    This command is used to move the head to the desired cylinder.
1383    Depending on the Verify setting, the target sector is sought on the
1384    track, else the command terminates after the step pulses have been issued.
1385
1386    Command word
1387
1388            7     6     5     4     3     2     1     0
1389         +-----+-----+-----+-----+-----+-----+-----+-----+
1390         |  0  |  1  |  0  |  1  |  0  | Step| Seek| Verf|
1391         +-----+-----+-----+-----+-----+-----+-----+-----+
1392
1393    All combinations of flags are legal ([1], p.12).
12121394*/
12131395void hdc9234_device::seek_read_id()
12141396{
1215   logerror("%s: SEEK / READ ID command %02x not implemented\n", tag(), current_command());
1216   set_command_done(TC_SUCCESS);
1397   if (m_substate == UNDEF)
1398   {
1399      // Command init
1400      if (TRACE_READ) logerror("%s: SEEK / READ ID command %02x, CHS=(%d,%d,%d)\n", tag(), current_command(), desired_cylinder(), desired_head(), desired_sector());
1401      m_substate = READ_ID;
1402   }
1403
1404   int cont = NEXT;
1405   bool step_enable = (current_command() & 0x04)==1;
1406   bool wait_seek_comp = ((current_command() & 0x02)==1) || rapid_steps();
1407   bool do_verify = (current_command() & 0x01)==1;
1408
1409   while (cont == NEXT)
1410   {
1411      switch (m_substate & 0xf0)
1412      {
1413      case READ_ID:
1414         read_id(cont, step_enable, wait_seek_comp);
1415         break;
1416      case VERIFY:
1417         if (!do_verify)
1418            cont = SUCCESS;
1419         else
1420            verify(cont, true);
1421         break;
1422      case DATA_TRANSFER:
1423         // No data transfer here. Just exit.
1424         cont = SUCCESS;
1425         break;
1426      default:
1427         logerror("%s: unknown substate %d in seek_read_id\n", tag(), m_substate);
1428         cont = ERROR;
1429      }
1430   }
1431
1432   if (cont==SUCCESS) set_command_done(TC_SUCCESS);
12171433}
12181434
12191435/*
r32473r32474
12291445    Logical:
12301446    For multiple sectors, read the sectors in ascending order of their sector field (sector n, n+1, n+2 ...).
12311447
1232    Command flags
1233       [ 0 ]  [ 1 ]  [ 0 ]  [ 1 ]   [ 1 ] [ Logical ] [ NoImplSeek ] [ Transfer ]
1448    Command word
1449
1450       7     6     5     4     3      2       1       0
1451    +-----+-----+-----+-----+-----+--------+------+------+
1452    |  0  |  1  |  0  |  1  |  1  | Logical|NoSeek| Trans|
1453    +-----+-----+-----+-----+-----+--------+------+------+
1454
12341455*/
12351456void hdc9234_device::read_sectors()
12361457{
r32473r32474
12551476      switch (m_substate & 0xf0)
12561477      {
12571478      case READ_ID:
1258         read_id(cont, implied_seek);
1479         read_id(cont, implied_seek, rapid_steps());
12591480         break;
12601481      case VERIFY:
12611482         verify(cont, logical);  // for physical, only verify the first sector
r32473r32474
12721493
12731494/*
12741495    READ TRACK
1275    Not implemented
1496    Read all ID and data fields as they appear on the track. Command 5A only
1497    transmits the ID fields via DMA, which 5B transmits all ID and data fields.
1498    Note that the specifications do not mention any gaps to be transmitted as
1499    well.
1500
1501    Command word
1502
1503       7     6     5     4     3     2     1      0
1504    +-----+-----+-----+-----+-----+-----+-----+------+
1505    |  0  |  1  |  0  |  1  |  1  |  0  |  1  |  All |
1506    +-----+-----+-----+-----+-----+-----+-----+------+
1507
12761508*/
12771509void hdc9234_device::read_track()
12781510{
1279   logerror("%s: READ TRACK command %02x not implemented\n", tag(), current_command());
1280   set_command_done(TC_SUCCESS);
1511   if (m_substate == UNDEF)
1512   {
1513      if (TRACE_READTRACK) logerror("%s: READ TRACK command %02x, head = %d\n", tag(), current_command(), desired_head());
1514      dma_address_out(m_register_w[DMA23_16], m_register_w[DMA15_8], m_register_w[DMA7_0]);
1515      m_transfer_enabled = (current_command() & 1)!=0;
1516   }
1517
1518   int cont = NEXT;
1519   while (cont == NEXT)
1520   {
1521      switch (m_substate)
1522      {
1523      case WAITINDEX0:
1524         // Do we happen to have an index hole right now?
1525         if ((m_register_r[DRIVE_STATUS] & HDC_DS_INDEX)==0)
1526         {
1527            m_substate = WAITINDEX1;
1528         }
1529         else
1530         {
1531            // Waiting for the index line going down
1532            wait_line(INDEX_LINE, ASSERT_LINE, WAITINDEX1, false);
1533            cont = WAIT;
1534         }
1535         break;
1536      case WAITINDEX1:
1537         // Waiting for the next rising edge
1538         wait_line(INDEX_LINE, ASSERT_LINE, TRACKSTART, false);
1539         cont = WAIT;
1540         break;
1541      case TRACKSTART:
1542         live_start(READ_TRACK);
1543         wait_line(INDEX_LINE, ASSERT_LINE, TRACKDONE, true);
1544         cont = WAIT;
1545         break;
1546      case TRACKDONE:
1547         if (TRACE_READTRACK && TRACE_SUBSTATES) logerror("%s: Track reading done\n", tag());
1548         cont = SUCCESS;
1549         break;
1550      }
1551   }
1552
1553   if (cont==SUCCESS) set_command_done(TC_SUCCESS);
12811554}
12821555
12831556/*
r32473r32474
13301603    7 and 8 must be repeated. If the DESIRED_HEAD register must be updated,
13311604    the complete setup process must be done.
13321605
1333    Command flags
1334    [  0  ] [  1  ] [  1  ] [ NormalData ] [ ReducedWC ] [ PreC2, PreC1, PreC0 ]
1606    Command word
1607
1608       7     6     5     4      3     2     1      0
1609    +-----+-----+-----+------+-----+-----+-----+------+
1610    |  0  |  1  |  1  |Normal|RedWC|  Precompensation |
1611    +-----+-----+-----+------+-----+-----+-----+------+
13351612*/
13361613void hdc9234_device::format_track()
13371614{
r32473r32474
14191696    For multiple sectors, write the sectors in ascending order of their
14201697    sector field (sector n, n+1, n+2 ...).
14211698
1422    Command flags
1423       [  1  ] [ NoImplSeek ] [  Logical  ]  [ NormalData ]  [ ReducedWC ]  [ PreC2, PreC1, PreC0 ]
1699    Command word
14241700
1701       7      6      5      4      3     2     1      0
1702    +-----+------+-------+------+-----+-----+-----+------+
1703    |  1  |NoSeek|Logical|Normal|RedWC|  Precompensation |
1704    +-----+------+-------+------+-----+-----+-----+------+
1705
14251706*/
14261707void hdc9234_device::write_sectors()
14271708{
r32473r32474
14521733      switch (m_substate & 0xf0)
14531734      {
14541735      case READ_ID:
1455         read_id(cont, implied_seek);
1736         read_id(cont, implied_seek, rapid_steps());
14561737         break;
14571738      case VERIFY:
14581739         verify(cont, logical);
r32473r32474
14681749   }
14691750}
14701751
1471void hdc9234_device::reenter_command_processing()
1472{
1473   // Do we have a live run on the track?
1474   if (m_live_state.state != IDLE)
1475   {
1476      // Continue with it
1477      live_run();
1478      if (m_live_state.state != IDLE)  return;
1479   }
1480
1481   // We're here when there is no live_run anymore
1482   // Where were we last time?
1483   // Take care not to restart commands because of the index callback
1484   if (m_executing && m_substate != UNDEF) (this->*m_command)();
1485}
1486
1487// ===========================================================================
1488
14891752/*
1490    Step on / off; used by RESTORE and STEP IN/OUT
1491*/
1492void hdc9234_device::step_on(bool towards00, int next)
1493{
1494   if ((TRACE_RESTORE | TRACE_STEP) && TRACE_SUBSTATES) logerror("%s: substate STEP_ON\n", tag());
1495
1496   // STEPDIR = 0 -> towards TRK00
1497   set_bits(m_output2, OUT2_STEPDIR, !towards00);
1498
1499   // Raising edge (note that all signals must be inverted before leading them to the drive)
1500   set_bits(m_output2, OUT2_STEPPULSE, true);
1501   auxbus_out();
1502   wait_time(m_timer, pulse_width(), next);
1503}
1504
1505void hdc9234_device::step_off(int next)
1506{
1507   if ((TRACE_RESTORE | TRACE_STEP) && TRACE_SUBSTATES) logerror("%s: substate STEP_OFF\n", tag());
1508   set_bits(m_output2, OUT2_STEPPULSE, false);
1509   auxbus_out();
1510   wait_time(m_timer, step_time(), next);
1511}
1512
1513/*
1514    Delivers the step time (in microseconds) minus the pulse width
1515*/
1516int hdc9234_device::step_time()
1517{
1518   int time = 0;
1519   int index = m_register_w[MODE] & MO_STEPRATE;
1520   // Get seek time.
1521   if (m_selected_drive_type == TYPE_FLOPPY8)
1522      time = step_flop8[index] - pulse_flop8;
1523
1524   else if (m_selected_drive_type == TYPE_FLOPPY5)
1525      time = step_flop5[index] - pulse_flop5;
1526   else
1527      time = step_hd[index] - pulse_hd;
1528
1529   if (fm_mode()) time = time * 2;
1530   return time;
1531}
1532
1533/*
1534    Delivers the pulse width time (in microseconds)
1535*/
1536int hdc9234_device::pulse_width()
1537{
1538   int time = 0;
1539   // Get seek time.
1540   if (m_selected_drive_type == TYPE_FLOPPY8)
1541      time = pulse_flop8;
1542
1543   else if (m_selected_drive_type == TYPE_FLOPPY5)
1544      time = pulse_flop5;
1545   else
1546      time = pulse_hd;
1547
1548   if (fm_mode()) time = time * 2;
1549   return time;
1550}
1551
1552/*
1553    Delivers the sector size
1554*/
1555int hdc9234_device::calc_sector_size()
1556{
1557   return 128 << (m_register_r[CURRENT_SIZE] & 3);
1558}
1559
1560/*
15611753===========================================================================
15621754
15631755    Live state machine
r32473r32474
16671859         // We're doing this complicated logerror check to avoid
16681860         // repeated logging in the same state. This can be found for the
16691861         // other live states as well. m_last_live_state is only used to
1670         // control this loggind.
1862         // control this logging.
16711863
16721864         if (TRACE_LIVE && m_last_live_state != SEARCH_IDAM)
16731865         {
r32473r32474
18071999         if(slot > 4)
18082000         {
18092001            // We successfully read the ID fields; let's wait for the machine time to catch up.
1810            // Live run is done here; it is the main state machine's turn again.
18112002            m_live_state.bit_count_total = 0;
1812            wait_for_realtime(IDLE);
2003
2004            if ((current_command() & 0xfe) == 0x5a)
2005               // Continue if we're reading a complete track
2006               wait_for_realtime(READ_TRACK_ID_DONE);
2007            else
2008               // Live run is done here; it is the main state machine's turn again.
2009               wait_for_realtime(IDLE);
18132010            return;
18142011         }
18152012         break;
r32473r32474
19492146         {
19502147            if ((m_live_state.bit_counter & 15)== 1)
19512148            {
1952               set_bits(m_register_r[INT_STATUS], ST_OVRUN, true);
1953               m_out_dmarq(ASSERT_LINE);
2149               // For floppies, request DMA for each byte. For hard disk, get it
2150               // only for the first byte and then keep the bus until the last byte.
2151               if (using_floppy() || m_live_state.bit_counter < 16)
2152               {
2153                  set_bits(m_register_r[INT_STATUS], ST_OVRUN, true);
2154                  m_out_dmarq(ASSERT_LINE);
2155               }
19542156            }
19552157         }
19562158
r32473r32474
19712173            // CRC
19722174            if (slot == calc_sector_size()+1)
19732175            {
1974               if (TRACE_LIVE) logerror("%s: [%s] Sector read completed\n", tag(),tts(m_live_state.time).cstr());
1975               wait_for_realtime(IDLE);
2176               if ((current_command() & 0xfe)==0x5a)
2177               {
2178                  // Reading a track? Continue with next ID.
2179                  wait_for_realtime(READ_TRACK_ID);
2180               }
2181               else
2182               {
2183                  if (TRACE_LIVE) logerror("%s: [%s] Sector read completed\n", tag(),tts(m_live_state.time).cstr());
2184                  wait_for_realtime(IDLE);
2185               }
19762186               return;
19772187            }
19782188         }
r32473r32474
19982208         if (m_transfer_enabled)
19992209         {
20002210            m_register_r[DATA] = m_register_w[DATA] = m_live_state.data_reg;
2001            m_out_dip(ASSERT_LINE);
2211            // See above: For floppy, do it for each byte; for hard disk, only for the first byte,
2212            if (using_floppy() || m_live_state.bit_counter == 16)
2213               m_out_dip(ASSERT_LINE);
2214
20022215            m_out_dma(0, m_register_r[DATA], 0xff);
2003            m_out_dip(CLEAR_LINE);
20042216
2005            m_out_dmarq(CLEAR_LINE);
2217            // And again, for floppies, clear line after writing each byte, for hard disk, only after the last byte
2218            if (using_floppy() || (m_live_state.bit_counter >> 4)==calc_sector_size()-1)
2219            {
2220               m_out_dip(CLEAR_LINE);
2221               m_out_dmarq(CLEAR_LINE);
2222            }
20062223         }
20072224
20082225         m_live_state.state = READ_SECTOR_DATA;
r32473r32474
20782295            }
20792296            else
20802297            {
2081               m_out_dip(ASSERT_LINE);
2298               // For floppies, set this for each byte; for hard disk, set it only at the beginning
2299               if (using_floppy() || m_live_state.byte_counter == calc_sector_size())
2300                  m_out_dip(ASSERT_LINE);
2301
20822302               m_register_r[DATA] = m_register_w[DATA] = m_in_dma(0, 0xff);
2083               m_out_dip(CLEAR_LINE);
2084               m_out_dmarq(CLEAR_LINE);
20852303
2304               if (using_floppy() || m_live_state.byte_counter == 0)
2305               {
2306                  m_out_dip(CLEAR_LINE);
2307                  m_out_dmarq(CLEAR_LINE);
2308               }
2309
20862310               if (m_live_state.byte_counter > 0)
20872311               {
20882312                  m_live_state.byte_counter--;
20892313                  write_on_track(encode(m_register_r[DATA]), 1, WRITE_SECDATA);
2090                  m_out_dmarq(ASSERT_LINE);
2314                  if (using_floppy()) m_out_dmarq(ASSERT_LINE);
20912315               }
20922316               else
20932317               {
r32473r32474
22312455            m_out_dip(ASSERT_LINE);
22322456            m_live_state.byte_counter--;
22332457            UINT8 headbyte = m_in_dma(0, 0xff);
2458
22342459            write_on_track(encode(headbyte), 1, (m_live_state.byte_counter>0)? WRITE_HEADER : WRITE_HEADER_CRC);
2235            m_out_dip(CLEAR_LINE);
2236            m_out_dmarq(CLEAR_LINE);
2460
2461            if (using_floppy() || m_live_state.byte_counter==0)
2462            {
2463               m_out_dip(CLEAR_LINE);
2464               m_out_dmarq(CLEAR_LINE);
2465            }
22372466            // Writing will occur after the break; set the DMARQ again
22382467            if (m_live_state.byte_counter>0)
22392468               m_out_dmarq(ASSERT_LINE);
r32473r32474
22772506         // Write a single byte; when the index hole shows up, the live run will be aborted
22782507         write_on_track(encode(fm_mode()? 0xff : 0x4e), 1, WRITE_GAP4);
22792508         break;
2509// --------------------------------------------------------
22802510
2511      // ==================================================
2512      // Live states for track reading
2513      // ==================================================
2514
2515      // Quite simple. Read the next ID fields, then the sector contents.
2516      // Continue until the next index hole shows up (live_abort).
2517      case READ_TRACK:
2518         if (TRACE_LIVE) logerror("%s: READ_TRACK\n", tag());
2519         m_live_state.state = READ_TRACK_ID;
2520         break;
2521
2522      case READ_TRACK_ID:
2523         m_live_state.state = SEARCH_IDAM;
2524         // Ask for access to bus
2525         set_bits(m_register_r[INT_STATUS], ST_OVRUN, true);
2526         m_out_dmarq(ASSERT_LINE);
2527         break;
2528
2529      case READ_TRACK_ID_DONE:
2530         if ((m_register_r[INT_STATUS] & ST_OVRUN)!=0)
2531         {
2532            if (TRACE_FAIL) logerror("%s: No DMA ACK - buffer overrun\n", tag());
2533            set_bits(m_register_r[INT_STATUS], TC_DATAERR, true);
2534            m_live_state.state = IDLE;
2535            return;
2536         }
2537         if (TRACE_LIVE) logerror("%s: READ_TRACK1\n", tag());
2538
2539         m_out_dip(ASSERT_LINE);
2540
2541         // Write the header via DMA
2542         for (int slot = 0; slot < 6; slot++)
2543            m_out_dma(0, m_register_r[id_field[slot]], 0xff);
2544
2545         m_out_dip(CLEAR_LINE);
2546         m_out_dmarq(CLEAR_LINE);
2547
2548         // Continue with reading the sector data
2549         m_live_state.state = SEARCH_DAM;
2550         break;
2551
22812552//  =================================================================
22822553
22832554      case READ_TRACK_BYTE:
r32473r32474
26402911// ===========================================================================
26412912
26422913/*
2643    This is pretty simple here, compared to wd17xx, because index and ready
2644    callbacks have to be tied to the controller board outside the chip.
2645*/
2646void hdc9234_device::connect_floppy_drive(floppy_image_device* floppy)
2647{
2648   m_floppy = floppy;
2649}
2650
2651/*
26522914    Read a byte of data from the controller
26532915    The address (offset) encodes the C/D* line (command and /data)
26542916*/
r32473r32474
27272989      }
27282990      m_register_w[m_register_pointer] = m_regvalue;
27292991
2730      // Changes to these registers must be output via the auxbus
2731      if (m_register_pointer == DESIRED_HEAD || m_register_pointer == RETRY_COUNT)
2732         auxbus_out();
2733
27342992      // The DMA registers and the sector register for read and
27352993      // write are identical, so in that case we copy the contents
27362994      if (m_register_pointer < DESIRED_HEAD) m_register_r[m_register_pointer] = m_regvalue;
r32473r32474
27733031         logerror("%s: Command %02x not defined\n", tag(), m_register_w[COMMAND]);
27743032      }
27753033   }
3034   auxbus_out();
27763035}
27773036
3037void hdc9234_device::reenter_command_processing()
3038{
3039   // Do we have a live run on the track?
3040   if (m_live_state.state != IDLE)
3041   {
3042      // Continue with it
3043      live_run();
3044      if (m_live_state.state != IDLE)  return;
3045   }
3046
3047   // We're here when there is no live_run anymore
3048   // Where were we last time?
3049   // Take care not to restart commands because of the index callback
3050   if (m_executing && m_substate != UNDEF) (this->*m_command)();
3051   auxbus_out();
3052}
3053
27783054/*
3055    Assert Command Done status bit, triggering interrupts as needed
3056*/
3057void hdc9234_device::set_command_done(int flags)
3058{
3059   // Do another output, then set the flag
3060   auxbus_out();
3061
3062   set_bits(m_register_r[INT_STATUS], ST_DONE, true);
3063
3064   if (flags != -1)
3065   {
3066      set_bits(m_register_r[INT_STATUS], ST_TERMCOD, false); // clear the previously set flags
3067      m_register_r[INT_STATUS] |= flags;
3068      if (TRACE_DONE) logerror("%s: command %02x done, flags=%02x\n", tag(), current_command(), flags);
3069   }
3070   else
3071   {
3072      if (TRACE_DONE) logerror("%s: command %02x done\n", tag(), current_command());
3073   }
3074
3075   // [1], p. 6
3076   if (TRACE_INT) logerror("%s: Raise interrupt DONE\n", tag());
3077   set_interrupt(ASSERT_LINE);
3078
3079   m_substate = UNDEF;
3080   m_executing = false;
3081}
3082
3083/*
3084    Preserve previously set termination code
3085*/
3086void hdc9234_device::set_command_done()
3087{
3088   set_command_done(-1);
3089}
3090
3091/*
27793092    Auxiliary bus operation.
27803093
27813094    The auxbus of the HDC9234 is used to poll the drive status of the cur-
r32473r32474
29243237}
29253238
29263239/*
2927    Set the hook for line level handling
2928*/
2929void hdc9234_device::wait_line(int line, line_state level, int substate, bool stopwrite)
2930{
2931   m_event_line = line;
2932   m_line_level = level;
2933   m_state_after_line = substate;
2934   m_stopwrite = stopwrite;
2935}
2936
2937/*
29383240    Push the output registers over the auxiliary bus. It is expected that
29393241    the PCB contains latches to store the values.
29403242
r32473r32474
29623264*/
29633265void hdc9234_device::auxbus_out()
29643266{
2965   m_out_auxbus((offs_t)HDC_OUTPUT_1, m_output1);
2966
29673267   // prepare output2
29683268   set_bits(m_output2, OUT2_DRVSEL3I, (m_output1 & OUT1_DRVSEL3)==0);
29693269
r32473r32474
29713271   if (m_reduced_write_current) m_output2 |= OUT2_REDWRT;
29723272
29733273   if (TRACE_AUXBUS) logerror("%s: Setting OUTPUT2 to %02x\n", tag(), m_output2);
2974   m_out_auxbus((offs_t)HDC_OUTPUT_2, m_output2);
3274
3275   if (m_output1 != m_output1_old || m_output2 != m_output2_old)
3276   {
3277      // Only propagate changes
3278      m_out_auxbus((offs_t)HDC_OUTPUT_1, m_output1);
3279      m_out_auxbus((offs_t)HDC_OUTPUT_2, m_output2);
3280      m_output1_old = m_output1;
3281      m_output2_old = m_output2;
3282   }
29753283}
29763284
29773285void hdc9234_device::dma_address_out(UINT8 addrub, UINT8 addrhb, UINT8 addrlb)
r32473r32474
29833291}
29843292
29853293/*
2986    This is reached when a timer has expired
3294    Set/clear INT
3295
3296    Interupts are generated in the following occasions:
3297    - when the DONE bit is set to 1 in the ISR and ST_DONE is set to 1
3298    - when the READY_CHANGE bit is set to 1 in the ISR and ST_RDYCHNG is set to 1
3299    (ready change: 1->0 or 0->1)
29873300*/
2988void hdc9234_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
3301void hdc9234_device::set_interrupt(line_state intr)
29893302{
2990   live_sync();
2991
2992   switch (id)
3303   if (intr == ASSERT_LINE)
29933304   {
2994   case GEN_TIMER:
2995      reenter_command_processing();
2996      break;
2997   case COM_TIMER:
2998      process_command();
2999      break;
3000   case LIVE_TIMER:
3001      live_run();
3002      break;
3305      // Only if there is not already a pending interrupt
3306      if ((m_register_r[INT_STATUS] & ST_INTPEND) == 0)
3307      {
3308         m_register_r[INT_STATUS] |= ST_INTPEND;
3309         m_out_intrq(intr);
3310      }
30033311   }
3312   else
3313   {
3314      // if there is a pending interrupt
3315      if ((m_register_r[INT_STATUS] & ST_INTPEND) != 0)
3316         m_out_intrq(intr);
3317   }
30043318}
30053319
30063320/*
r32473r32474
30163330}
30173331
30183332/*
3333    This is pretty simple here, compared to wd17xx, because index and ready
3334    callbacks have to be tied to the controller board outside the chip.
3335*/
3336void hdc9234_device::connect_floppy_drive(floppy_image_device* floppy)
3337{
3338   m_floppy = floppy;
3339}
3340
3341/*
30193342    Clock divider. This input line actually belongs to the data separator which
30203343    is a separate circuit. Maybe we will take it out of this implementation
30213344    at some time and make it a device of its own.
r32473r32474
30273350}
30283351
30293352/*
3353    This is reached when a timer has expired
3354*/
3355void hdc9234_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
3356{
3357   live_sync();
3358
3359   switch (id)
3360   {
3361   case GEN_TIMER:
3362      reenter_command_processing();
3363      break;
3364   case COM_TIMER:
3365      process_command();
3366      break;
3367   case LIVE_TIMER:
3368      live_run();
3369      break;
3370   }
3371}
3372
3373/*
30303374    Reset the controller. Negative logic, but we use ASSERT_LINE.
30313375*/
30323376WRITE_LINE_MEMBER( hdc9234_device::reset )
r32473r32474
30683412   m_multi_sector = false;
30693413   m_output1 = 0;
30703414   m_output2 = 0x80;
3415   m_output1_old = 1;      // force an initial output
3416   m_output2_old = 0x81;
30713417   m_precompensation = 0;
30723418   m_reduced_write_current = false;
30733419   m_regvalue = 0;
trunk/src/emu/machine/hdc9234.h
r32473r32474
135135   floppy_image_device* m_floppy;
136136
137137   // internal register OUTPUT1
138   UINT8 m_output1;
138   UINT8 m_output1, m_output1_old;
139139
140140   // internal register OUTPUT2
141   UINT8 m_output2;
141   UINT8 m_output2, m_output2_old;
142142
143143   // Write the output registers to the latches
144144   void auxbus_out();
r32473r32474
391391   // Are we on track 0?
392392   bool on_track00();
393393
394   // Are we using rapid steps (needed to decide to wait for seek complete)
395   bool rapid_steps();
396
397   // Is the currently selected drive a floppy drive?
398   bool using_floppy();
399
394400   // Common subprograms READ ID, VERIFY, and DATA TRANSFER
395   void read_id(int& cont, bool implied_seek);
401   void read_id(int& cont, bool implied_seek, bool wait_seek_complete);
396402   void verify(int& cont, bool verify_all);
397403   void data_transfer(int& cont);
398404
399   // Activates the step line
400   void step_on(bool towards00, int next);
401
402   // Clears the step line (after the pulse length time)
403   void step_off(int next);
404
405405   // ===================================================
406406   //   Commands
407407   // ===================================================

Previous 199869 Revisions Next


© 1997-2024 The MAME Team