-
How does it work?
05/22/2021 at 19:52 • 0 commentsConnect the circuit to the ProFile, and also to a host computer via USB. (The host computer powers the Teensy, and you'll need a serial terminal (or the Arduino/Teensyduino app's serial interface) to tell it what to do. Make sure there's an SD card in the Teensy and it's formatted with a FAT filesystem of some sort.
Power up the ProFile and let it complete its self-check. This can take a few minutes before the "Ready" light is on solid, but once it is, you're ready to go.
The serial interface is really primitive; I didn't need it to do much. It waits for a few simple characters to see what to do:
Character Action t Test reading one block. Just reads; doesn't try to save it. r Read the drive's metadata and writes it to the SD card in a file named "metadata.dat" R Send a Reset signal to the ProFile f Flush data written to the SD card. (Not actually necessary; just for paranoia's sake.) c Copy the whole hard drive to files on the SD card. The copy action will read the metadata and write it to "metadata.dat"; then it reads the drive's contents one block at a time and writes it to the file "profile10.img". (It will honor whatever the drive says its capacity is, so if it's a ProFile 5MB it should properly read just the 5 MB, but it still calls the file "profile10".)
There's a weird thing about the block size of a ProFile hard drive, though. The blocks aren't a power-of-2 size... they're 532 bytes. Specifically, that's 512 bytes of data plus 20 bytes of "tag" metadata (which the Apple3 uses; I'm not sure if the Apple 2 series cares about it at all). If the ProFile reports that its block size is 532 bytes then the copy action will also create "profile10.tag" which contains all of the tag data.
I deliberately cut this in to 2 different files so the resulting "profile10.img" can be used in an Apple emulator, which expects the data. And I also preserved the tag data in case some future need arises to write it back to another actual ProFile.
The whole operation is very verbose; I haven't bothered taking out the debugging code. The numbers in brackets that appear while the copy is happening refer to points in the data exchange that I annotated while building this, so I can tell what part of the protocol they're on. Want to see it doing its thing? (Bonus: you can hear the ProFile hard drive running. Boy that thing is loud.)