[Coco] MAME FDC Issue that can cause corruption

David Ladd davidwladd at gmail.com
Wed Aug 2 01:06:38 EDT 2017


Barry,

I have been going through some of the posts and other stuff and it looks
like all of the systems that used the legacy Western Digital chips were
updated to a **cough** more accurate Western Digital code and the legacy
stuff was removed entirely.  This looks like it was done right at version
0.163

So this technically effects more systems than just the CoCo if they are
using this same Western Digital FDC code base.

Scotty(Star Trek):  "The more they overthink the plumbing, the easier it is
to stop up the drain."


+-----------------------------------------------------------------------+
| David Ladd a.k.a. PacoOtaktay a.k.a. Drencor                          |
| YouTube: http://www.youtube.com/user/PacoOtaktay                      |
| YouTube Gaming Live: https://gaming.youtube.com/user/PacoOtaktay/live |
| Websites: http://dwladd.com     &     http://www.theterrorzone.com    |
| G+:  https://plus.google.com/113262444659438038657                    |
| G+:  https://plus.google.com/+DavidLaddPacoOtaktay                    |
|                                                                       |
| Do you have your CoCo 3 yet?                                          |
+-----------------------------------------------------------------------+


On Tue, Aug 1, 2017 at 9:00 PM, Barry Nelson <barry.nelson at amobiledevice.com
> wrote:

> I think it might have to with these changes…
>
> 85  src/emu/bus/coco/coco_fdc.c
>  @@ -291,16 +298,17 @@ void coco_fdc_device::dskreg_w(UINT8 data)
>         else if (data & 0x40)
>                 drive = 3;
>
> -       legacy_floppy_image_device *floppy[4];
> +       floppy_image_device *floppy[4];
>
> -       floppy[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
> -       floppy[1] = subdevice<legacy_floppy_image_device>(FLOPPY_1);
> -       floppy[2] = subdevice<legacy_floppy_image_device>(FLOPPY_2);
> -       floppy[3] = subdevice<legacy_floppy_image_device>(FLOPPY_3);
> +       floppy[0] = subdevice<floppy_connector>(WD_TAG
> ":0")->get_device();
> +       floppy[1] = subdevice<floppy_connector>(WD_TAG
> ":1")->get_device();
> +       floppy[2] = subdevice<floppy_connector>(WD_TAG
> ":2")->get_device();
> +       floppy[3] = subdevice<floppy_connector>(WD_TAG
> ":3")->get_device();
>
>         for (int i = 0; i < 4; i++)
>         {
> -               floppy[i]->floppy_mon_w(i == drive ? CLEAR_LINE :
> ASSERT_LINE);
> +               if (floppy[i])
> +                       floppy[i]->mon_w(i == drive ? CLEAR_LINE :
> ASSERT_LINE);
>         }
>
>         head = ((data & 0x40) && (drive != 3)) ? 1 : 0;
>  @@ -309,8 +317,11 @@ void coco_fdc_device::dskreg_w(UINT8 data)
>
>         update_lines();
>
> -       m_wd17xx->set_drive(drive);
> -       m_wd17xx->set_side(head);
> +       m_wd17xx->set_floppy(floppy[drive]);
> +
> +       if (floppy[drive])
> +               floppy[drive]->ss_w(head);
> +
>         m_wd17xx->dden_w(!BIT(m_dskreg, 5));
>  }
>
>  @@ -379,7 +390,7 @@ WRITE8_MEMBER(coco_fdc_device::write)
>                         dskreg_w(data);
>                         break;
>                 case 8:
> -                       m_wd17xx->command_w(space, 0, data);
> +                       m_wd17xx->cmd_w(space, 0, data);
>                         break;
>                 case 9:
>                         m_wd17xx->track_w(space, 0, data);
>  @@ -388,6 +399,7 @@ WRITE8_MEMBER(coco_fdc_device::write)
>                         m_wd17xx->sector_w(space, 0, data);
>                         break;
>                 case 11:
> +                       //printf("data w %02x\n", data);
>                         m_wd17xx->data_w(space, 0, data);
>                         break;
>         };
>  @@ -413,10 +425,12 @@ WRITE8_MEMBER(coco_fdc_device::write)
>  //**********************************************************
> ****************
>
>  static MACHINE_CONFIG_FRAGMENT(dragon_fdc)
> -       MCFG_DEVICE_ADD(WD2797_TAG, WD2797, 0)
> -       MCFG_WD17XX_DEFAULT_DRIVE4_TAGS
> +       MCFG_WD2797_ADD(WD2797_TAG, XTAL_1MHz)
>
> -       MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(coco_floppy_interface)
> +       MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":0", coco_fdc_floppies, "qd",
> coco_fdc_device::floppy_formats)
> +       MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":1", coco_fdc_floppies, "qd",
> coco_fdc_device::floppy_formats)
> +       MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":2", coco_fdc_floppies, "",
> coco_fdc_device::floppy_formats)
> +       MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG ":3", coco_fdc_floppies, "",
> coco_fdc_device::floppy_formats)
>  MACHINE_CONFIG_END
>
>
>  @@ -511,10 +525,20 @@ void dragon_fdc_device::dskreg_w(UINT8 data)
>                         data);
>         }
>
> -       if (data & 0x04)
> -               m_wd2797->set_drive(data & 0x03);
> +       floppy_image_device *floppy = NULL;
> +
> +       switch (data & 0x03)
> +       {
> +       case 0: floppy = subdevice<floppy_connector>(WD2797_TAG
> ":0")->get_device(); break;
> +       case 1: floppy = subdevice<floppy_connector>(WD2797_TAG
> ":1")->get_device(); break;
> +       case 2: floppy = subdevice<floppy_connector>(WD2797_TAG
> ":2")->get_device(); break;
> +       case 3: floppy = subdevice<floppy_connector>(WD2797_TAG
> ":3")->get_device(); break;
> +       }
> +
> +       m_wd2797->set_floppy(floppy);
>
>         m_wd2797->dden_w(BIT(data, 3));
> +
>         m_dskreg = data;
>  }
>
>  @@ -556,12 +580,7 @@ WRITE8_MEMBER(dragon_fdc_device::write)
>         switch(offset & 0xEF)
>         {
>                 case 0:
> -                       m_wd2797->command_w(space, 0, data);
> -
> -                       /* disk head is encoded in the command byte */
> -                       /* Only for type 3 & 4 commands */
> -                       if (data & 0x80)
> -                               m_wd2797->set_side((data & 0x02) ? 1 : 0);
> +                       m_wd2797->cmd_w(space, 0, data);
>                         break;
>                 case 1:
>                         m_wd2797->track_w(space, 0, data);
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list