• Please review our updated Terms and Rules here

Help modifying Sergey's floppy controller to be Secondary

nztdm

Experienced Member
Joined
Mar 17, 2018
Messages
180
Location
New Zealand
Hello

I have built many floppy+serial+bootROM boards based on Sergey's schematic: http://www.malinov.com/Home/sergeys-projects/isa-fdc-and-uart

This schematic has the FDC hard wired as primary.
My goal is to modify the schematic to be able to switch to secondary.
Sergey's Multi-floppy BIOS 2.2 supports a secondary controller.

I believe this only requires changing the chip-select circuit to activate the floppy controller IC's chip-select at port 370h, instead of 3F0h.
Should be able to keep the same IRQ6 and DMA2?

Floppy controller used is PC8477BV-1

I can't figure out the puzzle of using the existing two 74LS138 ICs, if it's possible at all.
I think I may have figured it out by adding an identity comparator 74HCT688.

688.jpg

I wired this up, and it seems to work somewhat, but has issues, so there is probably a conflict occurring due to something I missed.
It will work for a few accesses (such as booting from a DOS floppy, or booting from HDD then running some CheckIt floppy read tests), and then both primary and secondary controllers no longer work until a power cycle (reset isn't enough).

Once the failure has occurred:
  • CheckIt can't read the disk.
  • DOS gives "Data error reading drive A"
  • MultiFloppy BIOS gives Error 08 when trying to boot.
  • XT-IDE BIOS (after MultiFloppy BIOS) gives Error 8h when trying to boot from floppy.

I have tried with IRQ 5 instead of 6 for the secondary FDC, with no change.
The 74HCT688 has a 100nF capacitor.

Any ideas? I must be missing something with the identity comparator circuit.
 

Attachments

  • Capture.jpg
    Capture.jpg
    7.5 KB · Views: 6
Last edited:
Secondary floppy controllers are a bit messy, owing to the presence of many on the motherboard of most systems, other than the very early x86-386 systems (and sometimes not even there). Some allow for sharing of DMA2, IRQ6; many don't, which requires that separate IRQ and DMA choices be allowed for the second controller. In any case, if you share IRQ or DMA, you have to disable the *other* (i.e. primary) controller during secondary accesses, and then restore access when you're finished. Also, note that the code in the timer interrupt routine to unload the heads has to be observed, as it simply writes 0 to the primary DCR (i.e. 3F2). The biggest problem is that individual BIOS vendors didn't pay close attention to detail, so that you can't always depend on the contents of low memory FDC status areas.

Even trying to use your own controller in place of the disabled-in-the-BIOS primary by using the primary controller IO,DMA and IRQ can backfire--running NT-based Windows on some P1+ systems, for example, ignores the BIOS settings and re-enables the primary FDC leading to the issue that neither works.

Finally, many P4 and later systems that claim to support ISA bus connections often don't completely support ISA DMA.

For a good implementation of alternate I/O, DMA and IRQ addresses, look at the old Micro Solutions CompatiCard IV drivers.
 
Secondary floppy controllers are a bit messy, owing to the presence of many on the motherboard of most systems, other than the very early x86-386 systems (and sometimes not even there). Some allow for sharing of DMA2, IRQ6; many don't, which requires that separate IRQ and DMA choices be allowed for the second controller. In any case, if you share IRQ or DMA, you have to disable the *other* (i.e. primary) controller during secondary accesses, and then restore access when you're finished. Also, note that the code in the timer interrupt routine to unload the heads has to be observed, as it simply writes 0 to the primary DCR (i.e. 3F2). The biggest problem is that individual BIOS vendors didn't pay close attention to detail, so that you can't always depend on the contents of low memory FDC status areas.

Even trying to use your own controller in place of the disabled-in-the-BIOS primary by using the primary controller IO,DMA and IRQ can backfire--running NT-based Windows on some P1+ systems, for example, ignores the BIOS settings and re-enables the primary FDC leading to the issue that neither works.

Finally, many P4 and later systems that claim to support ISA bus connections often don't completely support ISA DMA.

For a good implementation of alternate I/O, DMA and IRQ addresses, look at the old Micro Solutions CompatiCard IV drivers.

Thanks for your help.

Since IRQ 5 instead of 6 didn't help, I put the IRQs back so both controllers are on 6.
I then rewired the secondary controller to DMA3 instead of DMA2, and it is now working perfectly.

So can we conclude from this you can't have two PC8477BV-1 floppy controllers sharing DMA channel? At least with Sergey's Multi-Floppy BIOS v2.2.
If so, a confirmed working config for two PC8477BV-1 controllers and Multi-Floppy BIOS v2.2, is:
Primary: 3F0, IRQ6, DMA2
Secondary: 370, IRQ6, DMA3

And also, for revised versions of the floppy controller, do you think I should make secondary mode set it to DMA3 only? Or have it jumper selectable for DMA0,1,2,3?
DMA1 is often used for sound cards. DMA0 for DRAM refresh or something?
 
Yes, DMA0 is refresh.

According to the datasheet for the PC8477, the DOR bit 3 controls the DMA enable for the controller. However, you must have the 8477 set to PC AT mode, rather than PS/2 mode. I've run 3 controllers on different I/O port addresses but the same IRQ and DMA. Enable of both IRQ and DMA is controlled by the DOR and there should be no issues with the 8477 sharing resources.

I don't know how the multi-floppy BIOS works, as I generally write my own access routines. I can think of only two good reasons why you should use different IRQ and DMA from another controller. The first is when you have a later system with integrated FDC that simply cannot share IRQ6 DMA2 because it's hard-coded into the hardware. The other is when you want to run more than one controller simultaneously; i.e. transferring data using 2 DMA channels.
 
Yes, DMA0 is refresh.

According to the datasheet for the PC8477, the DOR bit 3 controls the DMA enable for the controller. However, you must have the 8477 set to PC AT mode, rather than PS/2 mode. I've run 3 controllers on different I/O port addresses but the same IRQ and DMA. Enable of both IRQ and DMA is controlled by the DOR and there should be no issues with the 8477 sharing resources.

I don't know how the multi-floppy BIOS works, as I generally write my own access routines. I can think of only two good reasons why you should use different IRQ and DMA from another controller. The first is when you have a later system with integrated FDC that simply cannot share IRQ6 DMA2 because it's hard-coded into the hardware. The other is when you want to run more than one controller simultaneously; i.e. transferring data using 2 DMA channels.

Ahh that makes sense.
So a revision to the Multi-Floppy BIOS is in order, to disable DMA for inactive controllers?
That would be up to Sergey or someone else who knows what they're doing; I don't have that expertise.

It isn't optimal, but I'll probably add jumper headers to the current design for floppy controller resources; they cost nothing but board space. If an update to the floppy BIOS, or a more suitable one comes along, it can be substituted.
I do have some other HD Floppy BIOS's from DTK etc, but they rely on hardware switches and more glue logic to set the drive types.
 
Thanks for your help.

Since IRQ 5 instead of 6 didn't help, I put the IRQs back so both controllers are on 6.
I then rewired the secondary controller to DMA3 instead of DMA2, and it is now working perfectly.

So can we conclude from this you can't have two PC8477BV-1 floppy controllers sharing DMA channel? At least with Sergey's Multi-Floppy BIOS v2.2.
If so, a confirmed working config for two PC8477BV-1 controllers and Multi-Floppy BIOS v2.2, is:
Primary: 3F0, IRQ6, DMA2
Secondary: 370, IRQ6, DMA3

And also, for revised versions of the floppy controller, do you think I should make secondary mode set it to DMA3 only? Or have it jumper selectable for DMA0,1,2,3?
DMA1 is often used for sound cards. DMA0 for DRAM refresh or something?

Can you show in more details how did you do this with your controller ?
 
I understand that the post is about sergey's controller , but as I am unable myself to make modifications (I do not know how to do it) ... I was keep serching ... and it seems that the FDC from "retrobrewcomputers" has switches about IRQ and DMA . So does anybody tried this controller as secondary ?
 

Attachments

  • XT-FDC - jumper configuration - FDC configuration1.jpg
    XT-FDC - jumper configuration - FDC configuration1.jpg
    165.7 KB · Views: 10
Back
Top