Development of an XTIDE-Compatible IDE

kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

For those willing to help, I have uploaded the source code.

https://github.com/kitune-san/PCXT_MiST ... /ide-test1
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

kitune-san wrote: Thu Nov 03, 2022 12:22 pm Progress report:
I used an AO486 IDE and connected it to the PCXT bus.
When a VHD file is set, universal BIOS returns recognition.
However, after this, it does not work properly.
For some reason, it also recognizes slave that do not exist.

2022-11-03 195926.png
Thank you. Knowing that you will be using the ao486 IDE for the moment I'm going to prepare a test Main to take it into account so you don't have to use ao486 in the menu.

I still don't know why it detects you as master and slave, but here would be the XTIDE source code:

https://www.xtideuniversalbios.org/svn/ ... ios/trunk/
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

kitune-san wrote: Thu Nov 03, 2022 12:55 pm For those willing to help, I have uploaded the source code.

https://github.com/kitune-san/PCXT_MiST ... /ide-test1
Here it is attached, @kitune-san. And this is the commit I will perform when everything is ready:

https://github.com/spark2k06/Main_MiSTe ... 9f83ca592e

Everything related to serdrive will be removed :), you can now revert this commit:

https://github.com/kitune-san/PCXT_MiST ... b06a76f8e7

A note. Right now, if you want to boot by FDD, no HDD must be mounted, otherwise the MiSTer Main itself crashes and you have to reset it.
Attachments
MiSTer_XTIDE_01.zip
(546.1 KiB) Downloaded 231 times
thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: Development of an XTIDE-Compatible IDE

Unread post by thorr »

kitune-san wrote: Thu Nov 03, 2022 12:22 pm Progress report:
I used an AO486 IDE and connected it to the PCXT bus.
When a VHD file is set, universal BIOS returns recognition.
However, after this, it does not work properly.
For some reason, it also recognizes slave that do not exist.
Curious about the method you used to connect the 16-bit bus to the 8-bit bus? Was it derived from the link I provided or from the method XT-IDE uses? This is only a wild guess, but you might have bits or bytes out of order feeding through the bus. From the screenshot, what it detects are not valid characters. Looking at the bits of the characters and trying to rearrange them to see what the ascii text might be could be interesting. It's very cool that you are starting with a known IDE like ao486 to see what happens. I am curious about if you plan to implement XT-IDE hardware down the road. The schematic is available as well as Xilinx Verilog. Just some ideas in case they help.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 195 times

Re: Development of an XTIDE-Compatible IDE

Unread post by Malor »

It probably needs some logic changes to send result data 8 bits at a time. It's likely to assume that it can send 16 bits on the ISA bus, which AFAIK the 8088 can't handle.

I'm not sure if that's a chip or a bus limitation, though. Original ISA slots could only do 8 bits because that's all the pins that existed. The socket was extended to 16 bits when the AT (80286) came out. If the 8088 has enough data lines, you *might* be able to drive a virtual 16-bit ISA slot with one.

I do not expect that to work, however. I think that's probably dead wrong, and that the 8088 can only read 8 bits at a time from ISA.
thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: Development of an XTIDE-Compatible IDE

Unread post by thorr »

Yes, see my post here: viewtopic.php?p=62588#p62588
thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: Development of an XTIDE-Compatible IDE

Unread post by thorr »

kitune-san wrote: Thu Nov 03, 2022 12:55 pm For those willing to help, I have uploaded the source code.

https://github.com/kitune-san/PCXT_MiST ... /ide-test1
I just took a quick look, and noticed this part:
always_ff @(posedge clock, posedge reset)
begin
if (reset)
read_buffer <= 8'hFF;
else if (~ide_io_read_n_delay & latch_high_read_byte)
read_buffer <= ide_data_bus_in[15:8];
else
read_buffer <= read_buffer;
end

It doesn't appear that the read_buffer is previously defined, so the last else line looks suspect to me. It might use the last known value, but what about the first time it happens when there is no value. I am certainly no expert, so take this with a grain of salt. Maybe reset takes care of the first time. I am not sure.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

Thanks for the info. I'll check it.
I have noticed that at least access to the control registers is not proper.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

I created an XUB build with MODULE_8BIT_IDE_ADVANCED disabled and changed to Compatibility mode wiring.
With this change, the drive was recognized.
This is an empty VHD file created by Windows, so I have not yet checked it after this.
2022-11-08 211210.png
2022-11-08 211210.png (84.3 KiB) Viewed 14171 times
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

The following is a test branch.
https://github.com/kitune-san/PCXT_MiST ... /ide-test3

This is the RBF file and custom XUB ROM (and Makefile).
IDE-TEST3.zip
(1.29 MiB) Downloaded 226 times
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

Boot doesn't seem to work... Please Help!
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

kitune-san wrote: Tue Nov 08, 2022 1:37 pm Boot doesn't seem to work... Please Help!
Very good progress. Keep in mind that in that mode you may need another I/O port for the HD to boot and work:
20221108_152041-screen.png
20221108_152041-screen.png (204.78 KiB) Viewed 14092 times
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

I attach the version I have shown you (XTIDE r1), generated from the previous one and with the xtidecfg.com tool that I also attach. Also, I have removed the default serial port search from Boot settings, so it starts faster:
20221108_171740-screen.png
20221108_171740-screen.png (180.67 KiB) Viewed 14021 times
20221108_170801-screen.png
20221108_170801-screen.png (210.05 KiB) Viewed 14030 times
20221108_170653-screen.png
20221108_170653-screen.png (193.15 KiB) Viewed 14030 times
20221108_170724-screen.png
20221108_170724-screen.png (220.2 KiB) Viewed 14030 times
20221108_152041-screen.png
20221108_152041-screen.png (204.78 KiB) Viewed 14030 times
20221108_170805-screen.png
20221108_170805-screen.png (213.33 KiB) Viewed 14030 times
It also detects the HD but does not boot, however, you can now see that we have the 308h I/O port available in addition to the 300h.
Attachments
xtidecfg + rom xtide rev 1.zip
(25.39 KiB) Downloaded 244 times
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

It appears that XUB is reading the first 512 bytes.
There may be a problem with drive capacity recognition.
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

kitune-san wrote: Wed Nov 09, 2022 2:01 pm It appears that XUB is reading the first 512 bytes.
There may be a problem with drive capacity recognition.
Apparently, it is necessary to set the SPT (Secter per track) to one of 1 to 63.
The second byte of SPT is ignored.
How do I create a VHD file with SPT = 63?
2022-11-10 221008.png
2022-11-10 221008.png (150.5 KiB) Viewed 13778 times
EDIT:
It may be possible to set the spt to 63 using the sectors argument of ide_img_set().
I will prepare the build environment for Main_MiSTer ....
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

kitune-san wrote: Thu Nov 10, 2022 1:13 pm
EDIT:
It may be possible to set the spt to 63 using the sectors argument of ide_img_set().
I will prepare the build environment for Main_MiSTer ....
If so, I'll try it out later.

On the other hand, I attach the VHD specification document, in case you find it useful:

https://go.microsoft.com/fwlink/p/?linkid=137171
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 195 times

Re: Development of an XTIDE-Compatible IDE

Unread post by Malor »

With the Minimig core, you create a blank file of some size, and then the core appears to choose a geometry for that size, and passes it into the guest OS. You might be able to steal that algorithm. You might also be able to steal it from WinUAE. I think its algorithms are different for SCSI and IDE, as I don't think the images are cross-compatible, so you'll want to focus on the IDE code. The interesting code is likely to be in the RDB (rigid disk block) version of IDE.

edit: AO486 is probably doing the same thing, and stealing code from there might be easier, particularly since it's probably already loaded into your dev environment. However, that controller in general seems to be less complete, so it could potentially be taking shortcuts it maybe shouldn't. But the actual process of exposing the geometry to DOS should be all finished, where the Amiga code won't help at all.
User avatar
pgimeno
Top Contributor
Posts: 710
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 277 times
Been thanked: 226 times

Re: Development of an XTIDE-Compatible IDE

Unread post by pgimeno »

spark2k06 wrote: Thu Nov 10, 2022 1:57 pm On the other hand, I attach the VHD specification document, in case you find it useful:

https://go.microsoft.com/fwlink/p/?linkid=137171
I'm pretty sure that the VHD format that MiSTer uses is a raw disk image and not in VirtualPC VHD image format. As such, there's no data about number of sectors per track, number of heads or number of cylinders; I don't know how MiSTer main handles it but I'd guess it uses the maximum for sectors and heads, namely 63 and 16 respectively.

To answer kitune-san's question, to create such image you just need to create a file with a multiple of 512*63*16 bytes, so a multiple of 516096 bytes.
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

kitune-san wrote: Thu Nov 10, 2022 1:13 pm
EDIT:
It may be possible to set the spt to 63 using the sectors argument of ide_img_set().
I will prepare the build environment for Main_MiSTer ....
It works perfectly!

20221110_193619-screen.png
20221110_193619-screen.png (81.97 KiB) Viewed 13672 times
I have prepared a test MiSTer_Main, forcing CHS to the following values: 940, 6, 17

I attach an empty HDD image with those parameters... just prepare it with FDISK and format it.

I will have to check MiSTer_Main so that it detects these parameters correctly and does not exceed the value 63 for SPT.

I can't try any more today, but here it is, so you can try it out...
Attachments
MiSTer.zip
(546.06 KiB) Downloaded 228 times
hdd.zip
(46.81 KiB) Downloaded 244 times
thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: Development of an XTIDE-Compatible IDE

Unread post by thorr »

This is totally awesome news and progress! Thanks!! Is this using the XTIDE IDE card, or the ao486 IDE card?
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

Thank you @spark2k06!
kitune-san
Top Contributor
Posts: 401
Joined: Wed May 18, 2022 11:20 am
Has thanked: 127 times
Been thanked: 412 times

Re: Development of an XTIDE-Compatible IDE

Unread post by kitune-san »

thorr wrote: Thu Nov 10, 2022 7:10 pm This is totally awesome news and progress! Thanks!! Is this using the XTIDE IDE card, or the ao486 IDE card?
The module (XT2IDE.sv) is created with reference to the XTIDE card, and the ao486 IDE module(IDE.sv) is connected.

This is a simple diagram. There are actually several glue codes.
Mister_XT_IDE.png
Mister_XT_IDE.png (15.94 KiB) Viewed 13534 times
thorr
Top Contributor
Posts: 1311
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 634 times
Been thanked: 308 times

Re: Development of an XTIDE-Compatible IDE

Unread post by thorr »

Very cool! Thanks for the helpful diagram. I am very much looking forward to watching the future progress of this including the next release. The ao486 IDE module is not perfect in ao486 because some operating systems don't play nice with it (OS/2, NT, etc.), but it seems fine in DOS. In the case of PCXT, it will probably be just fine. It would be very cool if someday after PCXT is finished you could find the fixes to the remaining issues with the IDE controller in ao486 so it would work out of the box with the other operating systems, and maybe PCXT would benefit in some way as well. Thanks again!
jordi
Posts: 282
Joined: Thu Jun 11, 2020 10:11 am
Has thanked: 112 times
Been thanked: 87 times

Re: Development of an XTIDE-Compatible IDE

Unread post by jordi »

thorr wrote: Thu Nov 10, 2022 10:24 pm Very cool! Thanks for the helpful diagram. I am very much looking forward to watching the future progress of this including the next release. The ao486 IDE module is not perfect in ao486 because some operating systems don't play nice with it (OS/2, NT, etc.), but it seems fine in DOS. In the case of PCXT, it will probably be just fine. It would be very cool if someday after PCXT is finished you could find the fixes to the remaining issues with the IDE controller in ao486 so it would work out of the box with the other operating systems, and maybe PCXT would benefit in some way as well. Thanks again!
Xt ide might hide such errors as it is an interface controller, I guess.
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

I have updated Main_MiSTer with the implementation of the CHS detection already used previously in serdrive, and borrowed from the 86Box/PCem code. This implementation will also benefit ao486, although it does not really need it:

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

As you can see, I have already taken the opportunity to send a pull request to sorgelig. For the time being, I will not send an update of the PCXT core for everyone, as long as Main_MiSTer has not been released. However, I attach both MiSTer_Main with IDE support and a prerelease of the core so you can enjoy it:

https://github.com/MiSTer-devel/PCXT_Mi ... prerelease

I recommend using 86Box or PCEm to create the HD images for use in the PCXT core, as this ensures correct CHS values:

Create_VHD_86Box.png
Create_VHD_86Box.png (18.78 KiB) Viewed 13375 times

Otherwise, the head and sector values of 16 and 63 respectively will be used, and thereafter the cylinders will be calculated automatically. In this case, the size of the VHD must not exceed 8063Mb, because it would only be compatible with ao486.

In this prerelease I have also taken the opportunity to include the latest development of the Tandy 640x200x4 mode:

viewtopic.php?t=5642

I have also moved the mouse port to COM1, and removed the COM2 port for the time being.

I attach again the XTIDE BIOS that supports it, and that has the automatic detection of disk drives on the serial port disabled, to speed up the boot.
Attachments
ide_xt.zip
(7.87 KiB) Downloaded 271 times
PCXT-PRERELEASE.zip
(1.23 MiB) Downloaded 273 times
MiSTer-PRERELEASE.zip
(546.64 KiB) Downloaded 237 times
User avatar
Newsdee
Top Contributor
Posts: 873
Joined: Mon May 25, 2020 1:07 am
Has thanked: 104 times
Been thanked: 239 times

Re: Development of an XTIDE-Compatible IDE

Unread post by Newsdee »

spark2k06 wrote: Fri Nov 11, 2022 8:31 am I recommend using 86Box or PCEm to create the HD images for use in the PCXT core, as this ensures correct CHS values:
How about adding a blank pre-formatted HD image to the repo (maybe 20 or 40MB) without any data,
so users can easily load a floppy and install their own OS?
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

Newsdee wrote: Fri Nov 11, 2022 2:11 pm
spark2k06 wrote: Fri Nov 11, 2022 8:31 am I recommend using 86Box or PCEm to create the HD images for use in the PCXT core, as this ensures correct CHS values:
How about adding a blank pre-formatted HD image to the repo (maybe 20 or 40MB) without any data,
so users can easily load a floppy and install their own OS?
We already have a disk image with freedos, and a quickstart for beginners ;)

Image.png
Image.png (16.58 KiB) Viewed 13184 times
bbond007
Top Contributor
Posts: 531
Joined: Tue May 26, 2020 5:06 am
Has thanked: 87 times
Been thanked: 211 times

Re: Development of an XTIDE-Compatible IDE

Unread post by bbond007 »

spark2k06 wrote: Fri Nov 11, 2022 8:31 am I have also moved the mouse port to COM1, and removed the COM2 port for the time being.
Do you think you could make COM2 connected to /dev/ttyS1 so that it would work with the TCP modem?
User avatar
spark2k06
Core Developer
Posts: 876
Joined: Sat Jun 06, 2020 9:05 am
Has thanked: 409 times
Been thanked: 969 times

Re: Development of an XTIDE-Compatible IDE

Unread post by spark2k06 »

bbond007 wrote: Fri Nov 11, 2022 2:39 pm
spark2k06 wrote: Fri Nov 11, 2022 8:31 am I have also moved the mouse port to COM1, and removed the COM2 port for the time being.
Do you think you could make COM2 connected to /dev/ttyS1 so that it would work with the TCP modem?
It could be valued, write it down as a suggestion so that I don't forget it:

https://github.com/MiSTer-devel/PCXT_MiSTer/issues
bbond007
Top Contributor
Posts: 531
Joined: Tue May 26, 2020 5:06 am
Has thanked: 87 times
Been thanked: 211 times

Re: Development of an XTIDE-Compatible IDE

Unread post by bbond007 »

Ok, got the new IDE to work :)

and I used this benchmark --> https://github.com/foone/DiskTest

MS-DOS Disk performance tester, by James Pearce. I compiled it in Turbo Pascal 7.0 (with patches) with 8087 emulation.

This is "Before" with serial set to 460K:
PCXT_DiskTest_C.png
PCXT_DiskTest_C.png (897.98 KiB) Viewed 13024 times

This is A: dive for comparison:
PCXT_DiskTest_A.png
PCXT_DiskTest_A.png (896.88 KiB) Viewed 13024 times

Now this is "After" at 14mhz - I should mention its slower at 4.77 and 7.1 Mhz, but still much better than "before"...
PCXT_DiskTest_C_NewIDE.png
PCXT_DiskTest_C_NewIDE.png (897.84 KiB) Viewed 13024 times
I think this is a huge step for PCXT. Much thanks to spark2k06!

I'm creating a floppy disk .IMG with several benchmarks appropriate for an XT class machine:
PCXTBench.png
PCXTBench.png (895.92 KiB) Viewed 13019 times
I think that might be useful...
Post Reply