Page 2 of 5

Re: Development of an XTIDE-Compatible IDE

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

https://github.com/kitune-san/PCXT_MiST ... /ide-test1

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 03, 2022 2:11 pm
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/

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 03, 2022 4:36 pm
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 03, 2022 5:03 pm
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 03, 2022 8:24 pm
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 03, 2022 8:49 pm
by thorr
Yes, see my post here: viewtopic.php?p=62588#p62588

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 03, 2022 11:47 pm
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 04, 2022 1:59 am
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Tue Nov 08, 2022 12:17 pm
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 10700 times

Re: Development of an XTIDE-Compatible IDE

Posted: Tue Nov 08, 2022 1:13 pm
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 138 times

Re: Development of an XTIDE-Compatible IDE

Posted: Tue Nov 08, 2022 1:37 pm
by kitune-san
Boot doesn't seem to work... Please Help!

Re: Development of an XTIDE-Compatible IDE

Posted: Tue Nov 08, 2022 2:23 pm
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 10621 times

Re: Development of an XTIDE-Compatible IDE

Posted: Tue Nov 08, 2022 4:14 pm
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 10550 times
20221108_170801-screen.png
20221108_170801-screen.png (210.05 KiB) Viewed 10559 times
20221108_170653-screen.png
20221108_170653-screen.png (193.15 KiB) Viewed 10559 times
20221108_170724-screen.png
20221108_170724-screen.png (220.2 KiB) Viewed 10559 times
20221108_152041-screen.png
20221108_152041-screen.png (204.78 KiB) Viewed 10559 times
20221108_170805-screen.png
20221108_170805-screen.png (213.33 KiB) Viewed 10559 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.

Re: Development of an XTIDE-Compatible IDE

Posted: Wed Nov 09, 2022 2:01 pm
by kitune-san
It appears that XUB is reading the first 512 bytes.
There may be a problem with drive capacity recognition.

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 1:13 pm
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 10307 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 ....

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 1:57 pm
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

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 2:57 pm
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 6:40 pm
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 6:43 pm
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 10201 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...

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 7:10 pm
by thorr
This is totally awesome news and progress! Thanks!! Is this using the XTIDE IDE card, or the ao486 IDE card?

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 9:44 pm
by kitune-san
Thank you @spark2k06!

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 9:48 pm
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 10063 times

Re: Development of an XTIDE-Compatible IDE

Posted: Thu Nov 10, 2022 10:24 pm
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!

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 11, 2022 8:00 am
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.

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 11, 2022 8:31 am
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 9904 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.

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 11, 2022 2:11 pm
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?

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 11, 2022 2:27 pm
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 9713 times

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 11, 2022 2:39 pm
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?

Re: Development of an XTIDE-Compatible IDE

Posted: Fri Nov 11, 2022 2:43 pm
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

Re: Development of an XTIDE-Compatible IDE

Posted: Sat Nov 12, 2022 3:13 am
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 9553 times

This is A: dive for comparison:
PCXT_DiskTest_A.png
PCXT_DiskTest_A.png (896.88 KiB) Viewed 9553 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 9553 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 9548 times
I think that might be useful...