Previous 199869 Revisions Next

r23654 Wednesday 12th June, 2013 at 18:16:53 UTC by smf
moved block_count to the device, renamed some ide commands to make them closer to the spec & also use the block count for triggering the first irq on read/write multiple (nw)
[src/emu/machine]idectrl.c idectrl.h idehd.c idehd.h

trunk/src/emu/machine/idehd.c
r23653r23654
262262   save_item(NAME(user_password_enable));
263263
264264   save_item(NAME(gnetreadlock));
265   save_item(NAME(block_count));
265266}
266267
267268//-------------------------------------------------
trunk/src/emu/machine/idehd.h
r23653r23654
3434   UINT8           adapter_control;
3535   UINT8           precomp_offset;
3636   UINT16          sector_count;
37   UINT16          block_count;
3738
3839   UINT8           master_password_enable;
3940   UINT8           user_password_enable;
trunk/src/emu/machine/idectrl.c
r23653r23654
5757#define IDE_BANK2_CONFIG_REGISTER           8
5858#define IDE_BANK2_CONFIG_DATA               0xc
5959
60#define IDE_COMMAND_READ_MULTIPLE           0x20
61#define IDE_COMMAND_READ_MULTIPLE_NORETRY   0x21
62#define IDE_COMMAND_WRITE_MULTIPLE          0x30
63#define IDE_COMMAND_WRITE_MULTIPLE_NORETRY  0x31
60#define IDE_COMMAND_READ_SECTORS            0x20
61#define IDE_COMMAND_READ_SECTORS_NORETRY    0x21
62#define IDE_COMMAND_WRITE_SECTORS           0x30
63#define IDE_COMMAND_WRITE_SECTORS_NORETRY   0x31
6464#define IDE_COMMAND_DIAGNOSTIC              0x90
6565#define IDE_COMMAND_SET_CONFIG              0x91
66#define IDE_COMMAND_READ_MULTIPLE_BLOCK     0xc4
67#define IDE_COMMAND_WRITE_MULTIPLE_BLOCK    0xc5
66#define IDE_COMMAND_READ_MULTIPLE           0xc4
67#define IDE_COMMAND_WRITE_MULTIPLE          0xc5
6868#define IDE_COMMAND_SET_BLOCK_COUNT         0xc6
6969#define IDE_COMMAND_READ_DMA                0xc8
7070#define IDE_COMMAND_WRITE_DMA               0xca
r23653r23654
7272#define IDE_COMMAND_SET_FEATURES            0xef
7373#define IDE_COMMAND_SECURITY_UNLOCK         0xf2
7474#define IDE_COMMAND_UNKNOWN_F9              0xf9
75#define IDE_COMMAND_VERIFY_MULTIPLE         0x40
76#define IDE_COMMAND_VERIFY_NORETRY          0x41
75#define IDE_COMMAND_VERIFY_SECTORS          0x40
76#define IDE_COMMAND_VERIFY_SECTORS_NORETRY  0x41
7777#define IDE_COMMAND_ATAPI_IDENTIFY          0xa1
7878#define IDE_COMMAND_RECALIBRATE             0x10
7979#define IDE_COMMAND_SEEK                    0x70
r23653r23654
336336         sectors_until_int--;
337337      if (sectors_until_int == 0 || dev->sector_count == 1)
338338      {
339         sectors_until_int = ((command == IDE_COMMAND_READ_MULTIPLE_BLOCK) ? block_count : 1);
339         sectors_until_int = ((command == IDE_COMMAND_READ_MULTIPLE) ? dev->block_count : 1);
340340         set_irq(ASSERT_LINE);
341341      }
342342
r23653r23654
369369   status |= IDE_STATUS_BUSY;
370370
371371   /* just set a timer */
372   if (command == IDE_COMMAND_READ_MULTIPLE_BLOCK)
372   if (command == IDE_COMMAND_READ_MULTIPLE)
373373   {
374374      int new_lba = dev->lba_address();
375375      attotime seek_time;
r23653r23654
392392   /* mark ourselves busy */
393393   status |= IDE_STATUS_BUSY;
394394
395   if (command == IDE_COMMAND_READ_MULTIPLE_BLOCK)
395   if (command == IDE_COMMAND_READ_MULTIPLE)
396396   {
397397      if (sectors_until_int != 1)
398398         /* make ready now */
r23653r23654
425425   status &= ~IDE_STATUS_BUFFER_READY;
426426   status |= IDE_STATUS_BUSY;
427427
428   if (command == IDE_COMMAND_WRITE_MULTIPLE_BLOCK)
428   if (command == IDE_COMMAND_WRITE_MULTIPLE)
429429   {
430430      if (sectors_until_int != 1)
431431      {
r23653r23654
543543      /* signal an interrupt */
544544      if (--sectors_until_int == 0 || dev->sector_count == 1)
545545      {
546         sectors_until_int = ((command == IDE_COMMAND_WRITE_MULTIPLE_BLOCK) ? block_count : 1);
546         sectors_until_int = ((command == IDE_COMMAND_WRITE_MULTIPLE) ? dev->block_count : 1);
547547         set_irq(ASSERT_LINE);
548548      }
549549
r23653r23654
591591   command = _command;
592592   switch (command)
593593   {
594      case IDE_COMMAND_READ_MULTIPLE:
595      case IDE_COMMAND_READ_MULTIPLE_NORETRY:
594      case IDE_COMMAND_READ_SECTORS:
595      case IDE_COMMAND_READ_SECTORS_NORETRY:
596596         LOGPRINT(("IDE Read multiple: C=%d H=%d S=%d LBA=%d count=%d\n",
597597            dev->cur_cylinder, dev->cur_head, dev->cur_sector, dev->lba_address(), dev->sector_count));
598598
r23653r23654
606606         read_first_sector();
607607         break;
608608
609      case IDE_COMMAND_READ_MULTIPLE_BLOCK:
609      case IDE_COMMAND_READ_MULTIPLE:
610610         LOGPRINT(("IDE Read multiple block: C=%d H=%d S=%d LBA=%d count=%d\n",
611611            dev->cur_cylinder, dev->cur_head, dev->cur_sector, dev->lba_address(), dev->sector_count));
612612
613613         /* reset the buffer */
614614         dev->buffer_offset = 0;
615         sectors_until_int = 1;
615         sectors_until_int = dev->block_count;
616616         dma_active = 0;
617617         verify_only = 0;
618618
r23653r23654
620620         read_first_sector();
621621         break;
622622
623      case IDE_COMMAND_VERIFY_MULTIPLE:
624      case IDE_COMMAND_VERIFY_NORETRY:
623      case IDE_COMMAND_VERIFY_SECTORS:
624      case IDE_COMMAND_VERIFY_SECTORS_NORETRY:
625625         LOGPRINT(("IDE Read verify multiple with/without retries: C=%d H=%d S=%d LBA=%d count=%d\n",
626626            dev->cur_cylinder, dev->cur_head, dev->cur_sector, dev->lba_address(), dev->sector_count));
627627
r23653r23654
649649         read_first_sector();
650650         break;
651651
652      case IDE_COMMAND_WRITE_MULTIPLE:
653      case IDE_COMMAND_WRITE_MULTIPLE_NORETRY:
652      case IDE_COMMAND_WRITE_SECTORS:
653      case IDE_COMMAND_WRITE_SECTORS_NORETRY:
654654         LOGPRINT(("IDE Write multiple: C=%d H=%d S=%d LBA=%d count=%d\n",
655655            dev->cur_cylinder, dev->cur_head, dev->cur_sector, dev->lba_address(), dev->sector_count));
656656
r23653r23654
663663         status |= IDE_STATUS_BUFFER_READY;
664664         break;
665665
666      case IDE_COMMAND_WRITE_MULTIPLE_BLOCK:
666      case IDE_COMMAND_WRITE_MULTIPLE:
667667         LOGPRINT(("IDE Write multiple block: C=%d H=%d S=%d LBA=%d count=%d\n",
668668            dev->cur_cylinder, dev->cur_head, dev->cur_sector, dev->lba_address(), dev->sector_count));
669669
670670         /* reset the buffer */
671671         dev->buffer_offset = 0;
672         sectors_until_int = 1;
672         sectors_until_int = dev->block_count;
673673         dma_active = 0;
674674
675675         /* mark the buffer ready */
r23653r23654
780780      case IDE_COMMAND_SET_BLOCK_COUNT:
781781         LOGPRINT(("IDE Set block count (%02X)\n", dev->sector_count));
782782
783         block_count = dev->sector_count;
783         dev->block_count = dev->sector_count;
784784         // judge dredd wants 'drive ready' on this command
785785         status |= IDE_STATUS_DRIVE_READY;
786786
r23653r23654
12741274   error(0),
12751275   command(0),
12761276   interrupt_pending(0),
1277   block_count(0),
12781277   sectors_until_int(0),
12791278   verify_only(0),
12801279   config_unknown(0),
r23653r23654
12921291   error(0),
12931292   command(0),
12941293   interrupt_pending(0),
1295   block_count(0),
12961294   sectors_until_int(0),
12971295   verify_only(0),
12981296   config_unknown(0),
r23653r23654
13241322   save_item(NAME(command));
13251323   save_item(NAME(interrupt_pending));
13261324
1327   save_item(NAME(block_count));
13281325   save_item(NAME(sectors_until_int));
13291326
13301327   save_item(NAME(dma_active));
trunk/src/emu/machine/idectrl.h
r23653r23654
132132   UINT8           dma_active;
133133   UINT8           interrupt_pending;
134134
135   UINT16          block_count;
136135   UINT16          sectors_until_int;
137136   UINT8           verify_only;
138137

Previous 199869 Revisions Next


© 1997-2024 The MAME Team