Previous 15994 Revisions Next

r4658 Sunday 10th May, 2009 at 06:38:05 UTC by Robbbert
wd1171 - tidy up code layout and revert change made earlier today while i have a think about it.
[src/mess/machine]kay_kbd.c wd17xx.c

src/mess/machine/kay_kbd.c
r4657r4658
44 *
55 *   Kaypro II Serial Keyboard
66 *
7 *   Most of this is copied from kaypro.c,
7 *   Most of this is copied from the old kaypro.c,
88 *   rather than re-inventing the wheel.
99 *
1010 *   Juergen Buchmueller, July 1998
r4657r4658
1212 *
1313 *   Converted to a serial device (as far as MESS will allow)
1414 *   by Robbbert, April 2009.
15
16   NOTE: THIS IS A WIP, IT DOESN'T DO ANYTHING AT THIS TIME !!
1715 *
1816 ******************************************************************************/
1917
r4657r4658
397395#endif
398396
399397/******************************************************
400 *   kaypro_conin_w
401398 *   stuff character into the keyboard buffer
402399 *   releases CPU if it was waiting for a key
403400 *   sounds bell if buffer would overflow
src/mess/machine/wd17xx.c
r4657r4658
11841184
11851185               w->status |= STA_2_BUSY;
11861186               w->busy_count = 0;
1187            } else {
1187            }
1188            else
1189            {
11881190               wd17xx_complete_command(device, DELAY_DATADONE);
11891191
11901192               if (VERBOSE)
11911193                  logerror("wd17xx_data_r(): multi data read completed\n");
11921194            }
1193         } else {
1194            /* Delay the INTRQ 3 byte times becuase we need to read two CRC bytes and
1195         }
1196         else
1197         {
1198            /* Delay the INTRQ 3 byte times because we need to read two CRC bytes and
11951199               compare them with a calculated CRC */
11961200            wd17xx_complete_command(device, DELAY_DATADONE);
11971201
r4657r4658
12511255
12521256      w->busy_count = 0;
12531257      w->command_type = TYPE_IV;
1254        return;
1258      return;
12551259   }
12561260
12571261   if (data & 0x80)
r4657r4658
13191323         wd17xx_clear_data_request(device);
13201324
13211325         if (!floppy_drive_get_flag_state(wd17xx_current_image(device), FLOPPY_DRIVE_READY))
1322            {
1326         {
13231327            wd17xx_complete_command(device, DELAY_NOTREADY);
1324            }
1325            else
1326            {
1328         }
1329         else
1330         {
13271331
1328                /* drive write protected? */
1329                if (floppy_drive_get_flag_state(wd17xx_current_image(device),FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1330                {
1331                    /* yes */
1332                    w->status |= STA_2_WRITE_PRO;
1333                    /* quit command */
1334                    wd17xx_complete_command(device, DELAY_ERROR);
1335                }
1336                else
1337                {
1338                    w->command = data & ~FDC_MASK_TYPE_III;
1339                    w->data_offset = 0;
1340                    w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD;
1341                    wd17xx_set_data_request(device);
1342
1343                    w->status |= STA_2_BUSY;
1344                    w->busy_count = 0;
1345                }
1346            }
1347            return;
1332            /* drive write protected? */
1333            if (floppy_drive_get_flag_state(wd17xx_current_image(device),FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
1334            {
1335            /* yes */
1336               w->status |= STA_2_WRITE_PRO;
1337            /* quit command */
1338               wd17xx_complete_command(device, DELAY_ERROR);
1339            }
1340            else
1341            {
1342            w->command = data & ~FDC_MASK_TYPE_III;
1343            w->data_offset = 0;
1344            w->data_count = (w->density) ? TRKSIZE_DD : TRKSIZE_SD;
1345            wd17xx_set_data_request(device);
1346            w->status |= STA_2_BUSY;
1347            w->busy_count = 0;
1348            }
1349         }
1350         return;
13481351      }
13491352
13501353      if ((data & ~FDC_MASK_TYPE_III) == FDC_READ_DAM)
r4657r4658
13581361
13591362         if (floppy_drive_get_flag_state(wd17xx_current_image(device), FLOPPY_DRIVE_READY))
13601363            wd17xx_read_id(device);
1361
1364         else
13621365         wd17xx_complete_command(device, DELAY_NOTREADY);
13631366
13641367         return;
r4657r4658
14001403         w->direction = 1;
14011404      }
14021405      else if (w->track_reg > w->data)
1403        {
1406      {
14041407         if (VERBOSE)
14051408            logerror("direction: -1\n");
14061409
r4657r4658
14641467         logerror("wd17xx_command_w $%02X STEP_IN\n", data);
14651468
14661469      w->command_type = TYPE_I;
1467        w->direction = +1;
1470      w->direction = +1;
14681471      /* simulate seek time busy signal */
14691472      w->busy_count = 0;   //((data & FDC_STEP_RATE) + 1);
14701473
r4657r4658
14851488         logerror("wd17xx_command_w $%02X STEP_OUT\n", data);
14861489
14871490      w->command_type = TYPE_I;
1488        w->direction = -1;
1491      w->direction = -1;
14891492      /* simulate seek time busy signal */
14901493      w->busy_count = 0;   //((data & FDC_STEP_RATE) + 1);
14911494

Previous 15994 Revisions Next


© 1998-2018 The MESS Team