4.3 -- Sat Jun 25 00:21:23 PDT 2005 -- Tim Mann * By popular demand, print more stuff at the default verbosity levels. cw2dmk -v2 now prints its version number, and it prints a count of good sectors and errors when a track read with errors is about to be retried. dmk2cw -v1 now prints its version number too. Both can be suppressed by going to the next lower -v level. * Fixed a cw2dmk problem where the RX02 flag would get turned on in the header if we ever saw what looked like an RX02 DAM, even if it was just noise. Now we turn on the flag only if there was a good RX02 sector (valid ID, ID CRC, and data CRC), or the user specified -e3. Also added a count of good sectors in each encoding to the summary. 4.2 -- Sun May 15 21:00:44 PDT 2005 -- Tim Mann * Fixed a couple of places where we could fail to stop the drive when quitting with an error. * Added support to dmk2cw for switching the Catweasel's HD output on or off for tracks greater than 43. This may be useful with 8" drives that want a "track greater than 43" or "write current switch" signal. When building an adapter cable, note that HD is pin 2 on the 34-pin bus and TG43/WCS is pin 2 on the 50-pin bus. * Fixed error checking and message in cw2dmk's side detection. We can't detect whether side 1 is formatted unless we can get a histogram, which requires an index hole. Formerly we'd just incorrectly detect that it wasn't formatted in that case. Also, only detect_kind checks if side 0 is formatted; detect_sides doesn't, so the message "Detected 1 side formatted" was misleading. Changed it to "Detected side 1 not formatted". * Improved write precompensation in dmk2cw. The -o flag now takes two values, so you can make precompensation steadily increase when going from outer (lower-numbered) to inner tracks. The default is still a constant 140ns, but that may change. 4.1 -- Tue Apr 19 22:14:21 PDT 2005 -- Tim Mann * Made cw2dmk print the histogram gathered by detect_kind with -v7. * Tweaked drive/media autodetection to work whenever the disk has an index hole, even if we're not using it for reading because -h0 was given. If there really is no index hole, autodetection will fail and -k will still have to be given explicitly. * Changed testhist (and cw2dmk's detect_kind) to recognize peaks up to 24 samples wide instead of 16. I noticed peaks slightly wider than 16 on some good disks. It would be nice to find a good peak detection algorithm in the literature to replace this one, which I pulled out of the air. * Changed the total "good tracks" count to omit tracks with 0 good sectors even if they also have 0 errors. * Fixed backward address mark detection to work on RX02 disks too. * Changed dmk2cw to fill any tail of the Catweasel's sample memory beyond the end of the DMK buffer with a run-out pattern of alternating 0's and 1's, which looks like 0xff in FM or 0x00 or 0xff in MFM. Formerly we'd leave this tail untouched, which could result in data left in the sample buffer from a previous track being written to the end of the current track, a bad thing. * Switched to using the Catweasel's 2x (14.161 MHz) clock for all disk kinds. Formerly I was using the 1x clock on disks with lower data rates in hopes of being more compatible with early MK1's that need their MACH chip reprogrammed. * Disabled the check for the old CW MK1 memory error. It fires spuriously too often when reading a bulk-erased disk or other such garbage. Hopefully people with early CW MK1's have gotten their MACH chips reprogrammed by now. * Since a long timed read can completely fill catweasel memory (in particular, this is likely on a HD or 8" DD disk read with -h0), I shortened the end mark that catweasel_read puts in the data buffer to two bytes. On MK4, I avoid putting in the mark if memory is already full. On MK1 and MK3 there's no way to tell whether memory is full, so I always put in the mark, but then I skip the first two samples in case the write wrapped and the end mark wound up in the first two bytes of the buffer -- ugh. * catweasel_put_byte and catweasel_get_byte now keep track of how much catweasel memory has been used. Callers now check properly for hitting the end of memory on both reads and writes. * Bugfix: MK1 was not using index-to-index read with index storage as intended. (It was using index-to-index read without index storage.) * Small tweak to dmk2cw: don't recognize 0xfc in the area where a DAM is expected as a possible DAM. This fixed a problem writing my dmk image of l2-631a.dmk back to a real disk. It looks like this image was made with an old version of cw2dmk that left more crud in this region than it should have, so I plan to redo it. * Write 0x22 to iobase+3 to make MK4 give drives back to the onboard controller instead of 0x21. Per a thread on the developer mailing list, this may be needed to ensure the PCI bridge chip doesn't misbehave and cause the card to show an incorrect PCI ID after reboot on systems that do only a soft reset of the PCI bus upon reboot. This command also clears the FPGA. * Changed -v3 to print the sector numbers too. * Changed the default postcomp (-o flag) to 0.5. This seems to help the new decoder deal with FM better, as well as being good for MFM disks written with too little precomp. * The new decoder may not be quite as good at reading FM disks as the old one, because its data separator is always looking for MFM medium-length samples (corresponding to MFM 100 sequences), which can't occur in FM data. Using -e1 will force the data separator to classify all samples as either long (MFM 1000; FM 10) or short (MFM 10; FM 1), never medium. So try -e1 if you have difficulty reading an all-FM disk. * Rewrote cw2dmk's FM/MFM/RX02 decoder, the core of the program. Formerly there were three separate decoders with some flaky heuristics to switch between them. There is now just one decoder that handles all three types of encoding. See decoder.txt for internal documentation. The new decoder is much better than the old one at switching between FM and MFM on tracks with some sectors of each. It's also much smaller and cleaner than the old code. 4.0 -- Tue Apr 5 22:08:59 PDT 2005 -- Tim Mann * Added Catweasel MK4 support. For now, I load the firmware and then pretty much treat it like a MK3. * Added code to take advantage of one new MK4 feature: the ability to multiplex the same set of drives between the Catweasel and the onboard floppy controller. catweasel_init_controller takes over the drives, and catweasel_free_controller gives them back. If cw2dmk or dmk2cw dies uncleanly and fails to give the drives back, simply run it again. Unfortunately, I haven't had good luck with this myself; the onboard controller gets lots of errors reading/writing the drives. Maybe I'm doing something wrong. * I ran into a problem with one disk where the FM autodetector would fire spuriously in an MFM region (deterministically, or almost so) just at the very end of gap2 (the gap between the ID field and the sector data) on certain sectors. I tweaked one of the constants in detect_encoding() to make FM a bit slower to fire, which fixed this case. However, testing another hard case (a HyperZap disk read with -h0), it's clear that there are also times when the FM detector is too *slow* to fire, even with the constant at its old value. The detector is really a rather bad kludge and I'm thinking about rewriting it; see the ToDo file. 3.5a -- Sat Apr 2 17:04:12 PST 2005 -- Tim Mann I forgot to update the version number in version.h when releasing 3.5, so it still read 3.4. This release is identical except that I've updated the version number and have added a dependency on version.h to common.mak. 3.5 -- Mon Mar 28 22:16:00 PST 2005 -- Tim Mann A few simple changes that I've been sitting on for a while. I haven't started work on Catweasel MK4 support yet. * Fixed a bug in autodetecting a Catweasel MK1 that I introduced in cw2dmk 3.3 when moving code around so that all messages could be written to the log file. The bug caused cw2dmk to error out with a spurious "No access to I/O ports" message instead of looking for a MK1 at the default address of 0x320. Giving an explicit -p option still worked, so I didn't notice the bug. * Changed catweasel_detect_drive to turn on the motor while detecting. Chuck Guzis reports that this is needed for some 8" drives. (At least if you happen to drive the 8" DRIVE_SELECT wtih the PC MOTOR_ON signal and the 8" HEAD_LOAD with the PC DRIVE_SELECT. This seems a bit backward to me, but Chuck says it's "usual".) At any rate, turning on the motor ought to do no harm, so it's worthwhile if it helps some users. * There was a fatal bug in dmk2jv3's handling of disks containing more than 2901 total sectors, which necessitates adding a second block of JV3 sector headers. Instead of putting the write protect flag into the last byte of the first block of headers, dmk2jv3 was putting what should have been the first byte of the second block there. Worse, it was leaving this byte out of the second block, ending up shifting the whole block back by 1 byte. Probably no one has hit this bug but me, since 5.25" 80-track disks can't have that many sectors, and most emulators don't support the second block of headers in a JV3 image anyway. I noticed it when working with some 8" disks. * I ran into a disk where some of the FM write splices looked like address marks and caused bogus errors. Added a heuristic that suppresses the FM address mark detection for 32 bit times after each data CRC computation. * There was a bug in cw2dmk's wrapround detection that could erroneously delete the final good sector on a track. If we wrapped around and saw the IDAM of the first sector again just as the track was filling up, dmk_idam() would not put a pointer to this IDAM into the DMK track header, but its caller would still set ibyte=0 to indicate it was decoding a sector ID block. This made us think we had a partially decoded ID block at the end of the track whose IDAM pointer needed to be erased, causing us to erase the IDAM pointer to the final good sector on the track. I fixed this by moving the setting of ibyte=0 up into dmk_idam() so that it happens if and only if an IDAM pointer is placed into the DMK header. 3.4 -- Fri Jun 4 22:47:03 PDT 2004 -- Tim Mann * Bugfix: the -e option to cw2dmk was broken; using it would prevent disks from being read at all. I think this was first broken in 3.2. * Log the version number in cw2dmk and dmk2cw if the verbosity level is set any higher than the default value. 3.3 -- Sun May 30 01:52:37 PDT 2004 -- Tim Mann * jv2dmk and dmk2jv3 now default the output filename to be the same as the input filename but with the extension changed to dmk or dsk as appropriate. * Changed the -v flag to optionally take a two-digit value, with the first digit giving the verbosity level to write to a logfile and the second digit giving the level to go to the screen. Added the -u option to allow specifying the logfile name. * Deleted the -r flag because reading time is always determined automatically now, and it's not useful to let the user mess with it. * Changed the -h1 reading strategy so that we always have hole edges marked in the data stream. On CW MK1, the hardware hole-to-hole read will do this for us, but on MK3 it won't, so instead we manually wait for the index hole and then do a timed read for 110% of the nominal time for a revolution. This should get rid of the wraparound problems on MK3 for good (e.g., reading a 10-sector disk and getting "10 good sectors, 1 error" due to seeing the start of the next sector again). Both kinds of wraparound detection (3rd index edge and 95% of DMK track length) are still active for -h1 even though we should need the latter only for -h0 now. * Added a heuristic where if we are guessing the number of tracks, and we get to track 80 or beyond, and we see a logical track number that is half the physical track number, we stop. This helps if you have a disk that was formatted for 40+ tracks in a 40-track drive, then reformatted for 80 tracks in an 80-track drive. Without the heuristic, you may see a copy of the data from the old tracks beyond 40 on the new tracks beyond 80. * catweasel_seek had code in it to prevent seeking past track #79, so we could never have read disks with more than 80 tracks! I upped the maximum to track #85, allowing for 86 tracks. The normal case will now be (as I had intended) to try to seek to track #80, notice there is no data there, and give up without going farther, so we should not be damaging any drives by trying to go way too far. * Changed cw2dmk's default for -d to try drive 0 first, then drive 1 if drive 0 is not detected. Also, if -d is used to specify a particular drive, only that drive is tried, and failing to detect it gives a warning, not a fatal error. The latter change allows a drive without a working track 0 sensor to be used with cw2dmk. * Changed the "approx()" in dmk2cw to recognize lengths within 4% of nominal instead of 2%, to make sure that the new longer default DMK track lengths are recognized. * Created a ToDo file to hold ideas for future improvements. * Changed catweasel_detect_drive so that even if the drive has no working track 0 sensor, it will always attempt to step out to track 0. I've lost track of who suggested this change. * Bug fix: dmk2jv3 was not checking for false track numbers, which the JV3 format can't handle. Instead, it was silently putting the sectors on the JV3 logical/physical track that matches their *logical* track number. I've now changed it to print a message and put the sectors on the JV3 track that matches their *physical* track number, which should produce a somewhat less useless JV3. * Made the default DMK track lengths in cw2dmk about 2% longer, so that we don't cut off the end of a track that was written in a drive that was running a little too slow. * We now check that the user doesn't set a DMK track length greater than the hard maximum (0x4000) in cw2dmk and jv2dmk. * Restructured cw2dmk message printing to use a common msg() function, in preparation for making it more capable. 3.2 -- Tue Jun 17 22:43:51 PDT 2003 -- Tim Mann Thanks to David Sutherland for trying the new features in version 3.1 and reporting problems reading various strange disks. Many of the changes in 3.2 are inspired by his experiences. * Removed the heuristic added in 3.1 that tries to deal with track wraparound by cutting off sectors that begin beyond the nominal track length for the kind of disk being read. This was bad because the nominal length was hardwired, making it impossible to read disks that have a lot more than the nominal track length -- for example, as Atari 800 disks, which are written in drives that rotate at 288 RPM instead of 300 RPM. It also failed to cut off enough data on disks with a little less than the nominal track length. * Added new heuristics to deal better with wraparound. We base these on the DMK track length, which is settable with the -l flag, so disks written at slow speeds can be read. The new heuristics are: (1) After we've read 95% of the DMK track length, if we see a new sector ID that is the same as the first sector ID on the track, ignore it and cut off. (2) If there is an incomplete sector ID at the end of a track, ignore it instead of counting it as an error. (3) In -h0 -i mode, if we see a second IAM after having read 95% of the track and having seen at least one IDAM, ignore the second IAM and cut off. Heuristic (3) is similar to one that was in 3.1; the others are new. * Made the -r and -h options independent instead of mutually exclusive. Specificially: (1) Removed the feature that a negative -r value starts reading without waiting for the index hole; the -h0 option does this in a more useful way now. (2) If -r is used together with -h0, this now overrides the default readtime of 2 revolutions instead of being forbidden as before. * Added the -r1 and -r2 options to specify 1 or 2 revolutions. Larger values still give a time in ms. * Fixed a possible bug in drive detection. We would have failed to detect a drive that was initially stepped out to track 82 or so and was capable of going to 85. * One more try at taming the RX02 detector. Now it fires only if we see a 0xfd DAM following a sector ID *with a good CRC*. Hopefully this will stop it firing on garbage. If not, the next step is to kill it and require people reading RX02 disks to specify -e3 explicitly. That wouldn't be so bad, really. * Taking a histogram to autodetect whether side 1 is formatted now works in -h0 mode too. * Added a heuristic to detect reading a flippy disk on the wrong side. It works by recognizing what MFM ID address marks and FM data address marks look like when read backward. Some care was needed to prevent it from firing on garbage. * At the start of each track, the FM/MFM encoding detector now uses the encoding of the first good sector from the previous track as its initial guess. Formerly it used the encoding of the end of the previous track. The new heuristic works better on disks where every track has an FM part followed by an MFM part (or vice versa). It should work just as well for the case the old heuristic was meant to handle, where every track except track 0 is MFM but the tracks start so close to the index hole that if the detector is initialized to guess FM, it doesn't correct itself in time. 3.1 -- Sat Jun 7 19:36:15 PDT 2003 -- Tim Mann * Added the -h0 flag to cw2dmk. This will read a disk without using the index hole to decide where to start. It is useful for reading the back side of a disk that was made in a flippy drive, provided that either you have a drive that will deliver data to the controller even if it doesn't see any index pulses, or you cut an extra jacket hole in the disk. Original TRS-80 drives should work, but modern drives won't. Some modern drives may possibly be jumperable to work, but definitely not all. Another use for the -h0 flag would be if you have a strange format where a sector crosses over the index hole location and is cut in half by cw2dmk's normal reading method. * Modified the -i flag of cw2dmk so that it works no matter where the IAM is on the track. Formerly it worked only if the IAM appeared before the first IDAM. Now sectors that come before the IAM will be ignored. The flag is still useful for its old purpose, and it now is also useful in conjuction with the -h0 flag -- if your disks have an IAM at the start of every track, you can align the tracks in the DMK output to start at the right place by using -i. To make gap0 large enough to be in spec, -i96 is recommended, but you can use a smaller value if -i96 cuts off the end of the last sector on the track. Note that using -i will cut off a track prematurely if the IAM appears somewhere in the middle of the track and you haven't arranged to read the track for two revolutions by setting -r or -h0, and it will prevent the track from being read at all if it has no IAM. * Changed cw2dmk to end a track that's longer than the nominal length as soon as we are in a gap. This fixes a problem when reading disks with the Catweasel MK3, where you could get an extra partial copy of the first sector header repeated at the end of the track. This happened because of a change to the way index-hole-to-index-hole reading works between the MK1 and the MK3. * Made the Catweasel MK1 memory error test more reluctant to fire and less verbose. It now fires only on the 16th apparent error. This was needed because the test can detect false errors when reading an unformatted track. * Added error checking to detect confused people misusing the -p flag to cw2dmk and dmk2cw. * Improved some man pages and error messages. 3.0 -- Sat Dec 7 21:46:19 PST 2002 -- Tim Mann * Rewrote catweasl.c to support Catweasel MK3 PCI as well as MK1 ISA. * Added cwpci.c, containing routines to query the PCI bus and detect the MK3, one set for Linux, one for Windows 95 and MS-DOS. * Generalized and altered the -p and -c options of cw2dmk and dmk2cw and clock argument of testhist to mesh well with both cards. * Reversed drive 0 vs. drive 1 numbering with Catweasel MK1 from the way I had it previous releases. It now matches the numbering used by the bundled Catweasel tools. * Made cw2dmk quicker to give up on finding more tracks when it is guessing the number of tracks. The old algorithm had a bug if you tried to read a disk in a 40-track drive; it wouldn't consider stopping at track 40 unless you were double-stepping. * Included the MS-DOS DPMI host cwsdpmi.exe by Charles W. Sandmann in the package instead of requiring users to download it separately. * General code cleanup and reorganization. 2.8 -- Unreleased: checkpoint before adding Catweasel MK3 support. * Added an option to cw2dmk to start reading without waiting for an index hole. This needs more work; see the man page. * Added checking for read error to testhist. * Deleted some unused structures left over from the Linux driver. 2.7b -- Mon Aug 19 21:37:40 PDT 2002 -- Tim Mann * Added some checking to help detect when input supplied to dmk2cw or dmk2jv3 is not a DMK file. * Removed !'s from error messages. Some had them, some didn't, and having them is a very outdated style. 2.7a -- Sun Jun 30 00:15:10 PDT 2002 -- Tim Mann * Fixed some documentation wording errors and did some minor cleanup. 2.7 -- Sat Jun 29 00:03:05 PDT 2002 -- Tim Mann * Wrote jv2dmk and added it to the package. Like dmk2jv3, it is independent of the other tools and does not require Catweasel hardware; it simply converts between two different emulator formats. * Minor tweaks to documentation and messages for the other tools. 2.6 -- Sat Jan 19 13:36:53 PST 2002 -- Tim Mann * Wrote dmk2jv3 and added it to the package. This program is independent of the others and does not require Catweasel hardware; it simply converts between two different emulator formats. * Added -s flag to dmk2cw for safety in dealing with 1-sided drives. 2.5 -- Wed Jan 9 20:12:54 PST 2002 -- Tim Mann The following changes were motivated by a problem reading certain TRS-80 DOSPLUS disks, where track 0 side 0 is FM, track 0 side 1 is unformatted, and the remaining tracs are MFM. The only way to read such a disk with cw2dmk is to specify -s2 and let encoding be autodetected, but the RX02 detector was (still) overeager and would sometimes fire on the garbage read from unformatted track 0 side 1. * Disabled RX02 autodetection on side 1. In order to autodetect RX02, we now have to see an RX02-MFM sector on side 0, track 0 or 1, This seems likely to work perfectly, and if it should fail, you can always use -e3 to force RX02 anyway. * Previously, the RX02 detector was willing to fire if it saw a 0xfd DAM following an ID block with a bad CRC. This made it too prone to fire on unformatted tracks. It now requires a good CRC on the ID block preceding the 0xfd DAM. This change also fixes another bug: when counting good sectors, we had erroneously been including sectors with bad ID CRC but good data CRC. 2.4 -- Wed Aug 29 23:39:52 PDT 2001 -- Tim Mann * Changed my email address. I have left Compaq. * In encoding autodetect mode, the detector now starts each track (including retries) guessing the previously detected encoding. Formerly it always reverted to guessing FM at the start. This will help in reading disks that have an extremely short gap between the first sector header, such as some Newdos disks. 2.3 -- Sat Jul 14 18:01:38 PDT 2001 -- Tim Mann * Disabled looking for drive ready entirely. Evidently some older drives do not provide this signal. 2.2 -- Fri Jul 13 23:23:24 PDT 2001 -- Tim Mann * All catweasel read/write/await-index routines that look for drive ready (=no disk change) now wait 5 seconds for the signal to appear instead of erroring out immediately if it is not present. * Added a 5-second timeout to all catweasel routines that look for the index hole. * Fixed the RX02 autodetector; it would sometime fire when it shouldn't. Also, detecting RX02 sets the current stepping guess to single. 2.1 -- Sat Jun 30 21:31:26 PDT 2001 -- Tim Mann * Added autodetection of RX02 double density to cw2dmk. * Changed cw2dmk to pre-detect address marks so that it can byte-align the data stream earlier. Before this change, the byte written to the DMK file before an FM address mark would often be garbage, as would the byte before and the first byte of a 3-byte MFM premark sequence. Also added a heuristic to byte-align on 4e4e and 0000 sequences in MFM gaps. These changes make the contents of the DMK file cleaner-looking and a bit more amenable to changing with a hex editor. They also remove the need for some cleanup that is done in dmk2cw, but I am leaving the cleanup in so that DMK files made with older versions of cw2dmk can still be written back to disk. 2.0 -- Sat Jun 23 00:48:14 PDT 2001 -- Tim Mann * Initial release of dmk2cw. * Added peak detection to testhist instead of using fixed windows. * Minor tweaks to cw2dmk. 1.6 -- Tue Jun 12 00:17:12 PDT 2001 -- Tim Mann * Changed DMK_MARK_IAM to 0 (see changes for 1.5 below), but left the code in for possible future use. The extra pointer does cause a minor problem with both David Keil's emulator and xtrs -- both of them see it as a bad ID on Read Address commands, though they manage to ignore it otherwise. 1.5 -- Mon Jun 11 11:08:32 PDT 2001 -- Tim Mann * Added -a flag. * Use catweasel_memtest (formerly debugging code) to detect whether a Catweasel is present at the specified address; error out if not there. * Error out if catweasel_init_controller did not detect the specified drive. * If an index address mark is found, we now put a pointer to it in the DMK track header, just as with ID address marks. David Keil told me that this won't confuse his emulator; since the pointer points to an 0xfc instead of an 0xfe, he won't think it's an ID block. You can turn off this behavior by #defining DMK_MARK_IAM to 0 instead of 1 and recompiling. * Added -e3 flag to support DEC RX02 floppies, which use a strange encoding when in double density. * Added missing documentation of -v7 flag. * Added -w flag. 1.4 -- Sun Mar 11 21:45:34 PST 2001 -- Tim Mann * The .txt version of the man page was truncated in 1.3. This was caused by an obnoxious feature in the current Linux nroff -man macros of using '\255' as a hyphen at line breaks, combined with a bug in colcrt (and col) that makes them consider this (or presumably any character with bit 8 set) as EOF. 1.3 -- Wed Oct 11 00:59:14 PDT 2000 -- Tim Mann * Fixed a garble in the Diagnostics section of the man page. * Changed open mode on .dmk from "w" to "wb", which is required for the MS-DOS version. That's why the MS-DOS version produced bad disks before. Thanks to Amardeep S. Chana. 1.2 -- Sat Aug 12 16:08:18 PDT 2000 -- Tim Mann * Corrected read-postcompensation to work even if user selects a non-default Catweasel clock rate. * Tweaked some autodetection constants. * Added "Diagnostics" section to man page. * Added memory error detection. 1.1 -- Tue Jul 4 21:05:58 PDT 2000 -- Tim Mann * Added read-postcompensation (-o flag). * Added verbosity level 7. * Added bit resynchronization heuristic for MFM clock violations, previously only implemented for FM. * Fixed some minor errors in what verbosity level things were printed at. * Moved usage message to stdout so that it can be easily piped into more. * Corrected some minor errors in man page. 1.0 -- Thu Jun 22 02:32:00 PDT 2000 -- Tim Mann * Initial public release.