FDD Support Based on ao486 Implementation

User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

I open a new thread as a continuation of the following post, to have it better organised within the section.

viewtopic.php?p=60641#p60641

spark2k06 wrote: Sat Sep 24, 2022 3:29 am
kitune-san wrote: Sat Sep 24, 2022 3:13 am
kitune-san wrote: Fri Sep 23, 2022 1:51 pm

It seems that one of the causes of the FDC controller not working properly was a bug in the 8288.
I will restart the FDC porting process.

Progress report:
When using 8088BIOS, it seems to be able to read/write stably.
However, when using the original PCXT BIOS, an error occurs during disk access. More investigation is needed.

For those who want to try it out I have created an RBF file.
One thing to note is that this test core uses the AO486 profile.

Thank you!

Remember that it is possible to use the Main_MiSTer that I prepared for you when it was ready:

https://github.com/spark2k06/Main_MiSTe ... elease-fdd

I attach it here. In this case, you must rename AO486 to PCXT again, so that you can make use of it, so that all bit associations to the other OSD elements are not lost. And then the OSD menu on which you can base it:

https://github.com/MiSTer-devel/PCXT_Mi ... dd/PCXT.sv

@kitune-san, please, continue your topic in this thread, thank you!

Attachments
MiSTer-Main - PRERELEASE-FDD.zip
(553.74 KiB) Downloaded 330 times
friendly.joe
Posts: 20
Joined: Mon May 25, 2020 5:16 am
Has thanked: 5 times

Re: FDD Support Based on ao486 Implementation

Unread post by friendly.joe »

This is getting VERY interesting. Thank you for your efforts @spark and @kitune-san! :D
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

I have saved the latest work branch below.
https://github.com/kitune-san/PCXT_MiST ... eature-fdd

The status signal used by the joystick is conflicting with the wp signal of the FDC. Therefore I have disabled the joystick.
Attachments
PCXT.zip
(1.17 MiB) Downloaded 285 times
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Sat Sep 24, 2022 5:01 am I have saved the latest work branch below.
https://github.com/kitune-san/PCXT_MiST ... eature-fdd

The status signal used by the joystick is conflicting with the wp signal of the FDC. Therefore I have disabled the joystick.
I have tested it, and indeed, as you say, it only works with the Micro8088 BIOS, and only partially. That is to say, it apparently works fine, but for example during the installation of MS-Dos, although it boots, it does not recognise that the first floppy is inserted.

However, the part that works with a pre-loaded OS from HDD does very well.
Flandango
Core Developer
Posts: 453
Joined: Wed May 26, 2021 9:35 pm
Has thanked: 59 times
Been thanked: 383 times

Re: FDD Support Based on ao486 Implementation

Unread post by Flandango »

When I was playing around with the previous FDD branch, one of things I came across on why Tandy was having issues is that the Tandy bios uses timers a lot during post, especially when it comes to identifying the FDC/FDD but there are times when it does try to write to i/o port 41, the lock_bus_control signal is high on the 8237 and that i/o write is lost and those timers then being off seems to cause the bios to misidentify the Drives and from that point on treats the drive as a hard drive (id 80h).
I don't know if that's the cause but if it means anything to you and it can help possibly identify maybe a timing issue or a dma bus control issue, great...if i'm way off and don't know what I'm talking about (more than likely) then sorry.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

Even when using the original BIOS, drive A can now be read using the DOS installed on drive C (serial).
However, booting from and writing to the FDD fails.
Attachments
PCXT.zip
(1.23 MiB) Downloaded 298 times
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Sun Sep 25, 2022 3:46 pm Even when using the original BIOS, drive A can now be read using the DOS installed on drive C (serial).
However, booting from and writing to the FDD fails.
In addition, I have also checked that it is possible to install MS/Dos from drive A to the HDD, and it works very well... :D from Micro8088.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

I forgot to update the branch.

https://github.com/kitune-san/PCXT_MiST ... eature-fdd

Yesterday, in addition to this, I was changing the BIU.
However, it turned out to be incorrect, so I deleted it.
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Mon Sep 26, 2022 1:49 pm I forgot to update the branch.

https://github.com/kitune-san/PCXT_MiST ... eature-fdd

Yesterday, in addition to this, I was changing the BIU.
However, it turned out to be incorrect, so I deleted it.
When you get it working on all the BIOSes we currently use (mainly Tandy 1000 and IBM 5160), make me pull request on the prerelease-fdd branch instead of prerelease, which I will then have to do a job of mixing repositories and coordinate with the Main_MiSTer that sorgelig maintains before bringing it to the main branch and releasing the update for everyone.

Right now, it can be said that the performance of this feature on the micro8088 BIOS is perfect.

Thanks!
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

I have already confirmed the pull request to the prerelease-fdd branch with the current state of your development, and I have taken the opportunity to reactivate joystick support, reusing the appropriate bits in the fdd write management:

https://github.com/MiSTer-devel/PCXT_Mi ... elease-fdd

So, you can continue to evolve the work on this branch, and send pull request to it.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

I remenber the size of FDD used in PCXT is 5.25inch.
Micro8088 BIOS is using 3.5 inch FDD.

Maybe media_* settings are incorrect when using original PCXT bios...
Attachments
2022-09-29 220930.png
2022-09-29 220930.png (81.25 KiB) Viewed 17161 times
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

I've tried 360Kb images in PCXT BIOS and they didn't work either...
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

I can't find a cule....
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Thu Sep 29, 2022 2:42 pm I can't find a cule....
Another hint... with IBM 5160 BIOS it does work with 360Kb floppies, but only at 4.77MHz. In turbo modes it doesn't work, at least it's not possible to write.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

Apparently, media_sectors_per_track=12h does not work correctly in the original BIOS.
Looking at the EOT (End of track) of the FDD command, a non-12h value is output.
Could you try with media_sectors_per_track=09h?
breiztiger
Top Contributor
Posts: 468
Joined: Sun May 24, 2020 7:17 pm
Has thanked: 35 times
Been thanked: 99 times

Re: FDD Support Based on ao486 Implementation

Unread post by breiztiger »

12h is for hd disk no ?
CPC-Power Staff
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Tue Oct 04, 2022 3:39 pm Apparently, media_sectors_per_track=12h does not work correctly in the original BIOS.
Looking at the EOT (End of track) of the FDD command, a non-12h value is output.
Could you try with media_sectors_per_track=09h?
Any reason why it works fine at 4.77Mhz in the original PCXT BIOS? As I said, 360Kb images work, but only at that speed.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

breiztiger wrote: Tue Oct 04, 2022 3:44 pm 12h is for hd disk no ?
I think the often used value of EOT is 12h.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

Please check the value of sectors_per_track.
What does MisTer look at to determine this value? BPB in Fat Filesystem? Image size?
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Tue Oct 04, 2022 4:22 pm Please check the value of sectors_per_track.
What does MisTer look at to determine this value? BPB in Fat Filesystem? Image size?
I can't look at it today, I'll take a look tomorrow and let you know.
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

kitune-san wrote: Tue Oct 04, 2022 4:22 pm Please check the value of sectors_per_track.
What does MisTer look at to determine this value? BPB in Fat Filesystem? Image size?
I had a quick look at it... maybe it's 9?:

sectors_per_track.png
sectors_per_track.png (15.58 KiB) Viewed 16787 times

https://github.com/MiSTer-devel/Main_Mi ... 86/x86.cpp
Take a look at the fdd_set function, that's the key.
Bas
Top Contributor
Posts: 609
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 77 times
Been thanked: 309 times

Re: FDD Support Based on ao486 Implementation

Unread post by Bas »

Sectors per track are fixed values for each type of floppy disk. That switch statement reflects exactly the reality of physical floppies. The FAT filesystem's formatting follows the physical geometry of the medium.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

I would like to create images of several sizes (160-720) to check read/write behavior.
However, there is not much time I can allocate to work on PCXT...
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

Finally I am going to give it for good implementation, it can be improved but after doing several tests, it is really usable, these are the conditions of use:

  • In the Tandy 1000 and IBM 5160 BIOS only 360Kb images must be used. It is possible to use previously formatted images of smaller size, as it is not possible to format them from the OS.
  • In the Tandy 1000 and IBM 5160 BIOS only the 4.77MHz and 7.16MHz frequency must be used. A correct operation of the unit at 14.318MHz is not guaranteed as the BIOS throws an error 601 and formatting from the OS is not possible... this would therefore be the only point that can be improved.
  • The Micro8088 BIOS is only guaranteed to be compatible with 1.44Mb and 720Kb images, because this has been fixed in the BIOS. It is possible to use pre-formatted images of smaller size, as no formatting from the OS is possible.

Before releasing this update, I will coordinate with sorgelig to prepare the update of the Main, as the core cannot be updated before.

On the other hand, I attach several pre-formatted floppy images if anyone wants to test them.

You'll check it better when you have more time @kitune-san, but let's let MiSTer users take advantage of the current development, which is more than acceptable. Thank you very much, the work done so far has been excellent.
Attachments
Images.zip
(7.81 KiB) Downloaded 327 times
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: FDD Support Based on ao486 Implementation

Unread post by kitune-san »

I suspect that the reason why the 601 error occurs at 14mhz is the timeout (CX=0) caused by the Loop instruction.
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

I have everything ready for when sorgelig approves the pull request and updates the Main:

https://github.com/MiSTer-devel/Main_MiSTer/pull/700

And this will be the new README regarding HDD/FDD mounting:
README.png
README.png (38.83 KiB) Viewed 16575 times
jordi
Posts: 269
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 108 times
Been thanked: 83 times

Re: FDD Support Based on ao486 Implementation

Unread post by jordi »

We are so lucky of have people with so great skills and patience! kitune-san, spark, Microcorelabs
User avatar
wark91
Core Developer
Posts: 334
Joined: Sun May 24, 2020 8:34 pm
Has thanked: 447 times
Been thanked: 95 times

Re: FDD Support Based on ao486 Implementation

Unread post by wark91 »

I have a question if someday Tandy 1000 SL2 is supported on the core, do you think it could be handle 720Kb or 1.44Mb floppies ?
Thanks
User avatar
spark2k06
Core Developer
Posts: 872
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 963 times

Re: FDD Support Based on ao486 Implementation

Unread post by spark2k06 »

wark91 wrote: Wed Oct 05, 2022 8:09 am I have a question if someday Tandy 1000 SL2 is supported on the core, do you think it could be handle 720Kb or 1.44Mb floppies ?
Thanks
If the Tandy 1000 SL2 supports 720Kb or 1.44Mb floppy disks, if the core were to support it, it would automatically be compatible, yes... as now Micro8088.
User avatar
pgimeno
Top Contributor
Posts: 707
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: FDD Support Based on ao486 Implementation

Unread post by pgimeno »

kitune-san wrote: Wed Oct 05, 2022 6:46 am I suspect that the reason why the 601 error occurs at 14mhz is the timeout (CX=0) caused by the Loop instruction.
That makes full sense. I expected issues of that kind with the frequency switch. It's the same reason some Turbo Pascal programs stopped working on faster machines: they had a loop that they didn't expect to ever finish but it overflowed on fast clocks.

The ZX Spectrum core "cheats" in a way. The tape loading routines are written using cycle counting for timing, therefore when increasing the speed, loading from a real tape would not work. But for the virtual tape, the core speeds up the audio at the same rate as the frequency, so when loading from TAP files you can switch the frequency and the program still loads fine.

I wonder if something similar could be done with the floppy controller: to make the clock depend on the speed setting of the core so that even at 14 MHz there is no timeout.
Post Reply