FDC discussion
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
FDC discussion
Discussion moved from viewtopic.php?f=2&t=344.
Attached first patch for separating out FDD emulation, and providing support for motor speed control. Not been tested thoroughly, but seems to work for all the main cases using .IMG format (.FDI still needs updating). Battler, you should be able to implement the 3-mode / drive control line stuff on top of this, let me know if there are any issues.
Attached first patch for separating out FDD emulation, and providing support for motor speed control. Not been tested thoroughly, but seems to work for all the main cases using .IMG format (.FDI still needs updating). Battler, you should be able to implement the 3-mode / drive control line stuff on top of this, let me know if there are any issues.
- Attachments
-
- fdc fdd abstraction.patch
- (19.95 KiB) Downloaded 374 times
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
Added function to swap drives.
Battler, how are you getting on with this?
Battler, how are you getting on with this?
- Attachments
-
- fdc fdd abstraction v2.patch
- (23.5 KiB) Downloaded 376 times
Re: FDC discussion
Downloaded the latest mainline PCem source code now, will now get the patch too and apply it, then start the work.
Re: FDC discussion
I can't apply the v2 patch cleanly to the latest PCem code, possibly because of FDC fixes that were made in the mean time.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
See attached.
- Attachments
-
- fdc fdd abstraction v2 (rebased to rev 401).patch
- (23.47 KiB) Downloaded 343 times
Re: FDC discussion
I have a slight problem with data rate 1. On normal drives, this means 300 kbps, but on type 1 3-mode 3.5" drives, it means 500 kbps @ 360 rpm (while data rate 0 becomes specifically 500 kbps @ 300 rpm). However currently, PCem gives me no way to specify bit rate or bitcell period per drive, but only globally, which makes it a bit awkward since the two drives can be of different types.
Edit: And I also made the drives aware of the data rate since real drives would be, as the information is passed on the DRATE pins.
Edit: And I also made the drives aware of the data rate since real drives would be, as the information is passed on the DRATE pins.
Re: FDC discussion
Just wanted to say I'm still waiting for some input on this, I can't continue until then.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
As I understand it, the implementation should probably look like this :
- Provide the DRATE pins to fdd.c. This should be used for calculating fdd_getrpm() for 3-mode drives.
- In fdc.c, select the bit rate based on the drive type (which I believe is programmed into the SuperIO control registers? At least on the FDC37c669 datasheet I'm looking at). You will probably need to modify fdc_update_rate() to take the current drive number, and call it when the drive select changes.
- Provide the DRATE pins to fdd.c. This should be used for calculating fdd_getrpm() for 3-mode drives.
- In fdc.c, select the bit rate based on the drive type (which I believe is programmed into the SuperIO control registers? At least on the FDC37c669 datasheet I'm looking at). You will probably need to modify fdc_update_rate() to take the current drive number, and call it when the drive select changes.
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
Added generic sector-based image handling, this should make it easier to support formats with non-standard layouts.
- Attachments
-
- fdc fdd abstraction v3.patch
- (45.76 KiB) Downloaded 345 times
Re: FDC discussion
The patch is attacted. It includes all my floppy work, but I also replaced the emulation of the FDC37C665 Super I/O chip with mine as I tried to add the floppy-related things into it, and I quite didn't like the idea of every single register being processed regardless of which you write to. The floppy parts have both 3-Mode support (the RPM, DENSEL, etc. stuff) and XDF images working.
- Attachments
-
- pcem_floppy.patch
- (43.94 KiB) Downloaded 363 times
Re: FDC discussion
New patch attached, this time made with hg diff.
- Attachments
-
- pcem_floppy.patch
- (67.21 KiB) Downloaded 347 times
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
Can you also attach fdd.* and disc_sector.*? They are missing from the second patch.
Re: FDC discussion
Yes, they are attached.
- Attachments
-
- fdd.c
- (4.54 KiB) Downloaded 359 times
-
- disc_sector.h
- (627 Bytes) Downloaded 355 times
-
- disc_sector.c
- (12.74 KiB) Downloaded 348 times
Re: FDC discussion
Another post for fdd.h because I can't attach more than 3 files in a single post.
- Attachments
-
- fdd.h
- (279 Bytes) Downloaded 347 times
Re: FDC discussion
A .RAR file with patch v2 is attached. Archive includes patch file, as well as disc_sector.* and fdd.*. This patch removes the fdd_rate_compare stuff that was unneeded, adds the floppy density "hole", reduces the two 3-Mode types to one, introduces the usage of the type variable of fdd rather than drive_types[] in disc.c, makes changing drive type in settings require a hard reset, and makes the READ and WRITE commands check for the N (sector size code) part of sector ID too, and fail if it mismatches. The FDD-FDC rate compare that was unneeded, was replaced with a "drive can read this medium" based on the density "hole" and drive type flag.
- Attachments
-
- pcem_floppy_v2.rar
- (16.95 KiB) Downloaded 356 times
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
Attached v3 patch. This patch has the following changes :
- Revert to the pre-existing fdc37c665 code.
- Formatting fixes
- Fixes to 'read track' command
- Added gap between sectors to disc_sector.c
- Bit of generic cleanup
- Revert to the pre-existing fdc37c665 code.
- Formatting fixes
- Fixes to 'read track' command
- Added gap between sectors to disc_sector.c
- Bit of generic cleanup
- Attachments
-
- pcem_floppy_v3.patch
- (91.58 KiB) Downloaded 353 times
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
Committed in rev 413.
Re: FDC discussion
Wonder if PCem will one day support some of the other Disk Image formats that are available today. IE
FDI: Formatted Disk Image
td0: Teledisk
imd: ImageDisk
FDI: Formatted Disk Image
td0: Teledisk
imd: ImageDisk
- SarahWalker
- Site Admin
- Posts: 2054
- Joined: Thu 24 Apr, 2014 4:18 pm
Re: FDC discussion
FDI is supported in v10...
Re: FDC discussion
I can try to write some code for reading TD0. :p
Re: FDC discussion
Going to upload a floppy fix patch soon. Among other things, it's going to fix a pretty bad bug I accidentally left in, namely the sector size for non-XDF floppies is obtained from the wrong IMG array entry.