Drivewire for dummies
Drivewire for Dummies - by Robert Hermanek (originally posted on the CoCo mailing list)
NOTE: This is only about HDB-DOS - see DriveWire for more general information.
Drivewire for Dummies - Part 1
Background: Once upon a time, if you were lucky you had a color computer with a disk controller. (If not, you were biting your nails hoping your cassettes loaded.) If you had a disk system, then you could have up to 4 drives, and they were labelled drives 0 through 3, and you selected which disk drive you wanted to use with the drive command:
Each of these four physical 5 1/4 floppies would store approximately 160k of data. Back in the day, this was pretty huge. Although disks were more reliable and much faster than cassette, disk failures or directory crashes were still quite common.
After the floppy era, hard drives started making an appearance. Harddrives are orders of magnitude larger (megs vs. kilobytes) however for usage in disk extended basic on a color computer, these larger devices would still have to be presented as "virtual floppies" of 160k each, so that a massive rewrite of DECB (disk extended color basic) would not be necessary, and also to avoid incompatibilities with old software.
HDB-DOS appeared on the scene eventually in order to facilitate connecting to a hard drive from DECB and getting access to your new space in friendly 160k virtual disks.
Next, some very clever folks (insert list of all the geniuses involved here) came up with "DriveWire." For the coco, it still comes down to be connected to some large "device." But in fact all read/write disk requests are redirected out the rs-232 port, and a server application on the far side (on a modern PC) will respond to the request and send data back to the coco. The coco sees this data as the response of a sector read (for example) from a floppy disk, just like back in the day when it was connected to actual coco disk drives via a disk controller.
For drivewire to work then, there are four things you need:
- a coco running HDB-DOS
- a cable connecting rs-232 to serial port on PC
- a drivewire server application running on the PC
- a disk image mounted and ready in the drivewire server app.
Now a little discussion of disk images, and people can correct me if I'm wrong.
Once, disk images (files with a DSK extension) were just a handy way of storing the data on a 35 track standard coco disk, so again about a 160k file. This file simply contains each track, each sector, in order, and the 256 bytes that make up each sector.
For the purpose of drivewire however, these DSK images started being placed in collections, since we didn't want to just work with one virtual floppy, but many virtual floppies.
Going back to the coco running HDB-DOS, there are now two commands for selecting which drive you want to access:
This is the same command I mentioned above, and it will choose which virtual disk you want to use on the currently selected device. Now for original coco's running a disk controller, there was no talk of what device you wanted to access--you were accessing your disk controller, and if you were lucky you had more than one drive connected to it. You could then say DRIVE 0 or DRIVE 3 to access your disks.
When connecting to scsi devices came about, a new command was added:
Yes, looks the same except for the # symbol. This command selects which device you want to access. For example, if you had a scsi controller connected to your coco, with 2 physical harddrives attached, each of these harddrives would contain their own collections of virtual floppy disks. So all of the following are possible:
DRIVE #0 DRIVE 0 - first virtual disk on device 0 DRIVE 1 - next virutal disk on device 0 (etc)
DRIVE #1 DRIVE 0 - first virtual disk on device 1 DRIVE 1 - next virtual disk on device 1
Now we get our sites back on drivewire, and here is what we come up with:
1) When you use the DRIVE #n command, you are selecting the "device," but for drivewire this simply means which source file (collection) of virtual floppies you wish to use. This collection is a single file (like a single physical harddrive back in the day) that contains, one after another, virtual floppy disk images.
2) When you use the DRIVE n command, you are choosing which virtual floppy on the currently selected collection you wish to use.
3) The real bonus: Back in the day with physical devices, you were limited to how many devices and disks you had by what you really had--in drivewire there is no limit other than the device and disk #'s have to be a byte value. That means you can select any device # 0 - 255 (DW4 server), and any drive # 0 to 255 on each device. 256 X 256 = 65,536 virtual disks that can be accessed by a coco connected to a drivewire server. That's a whole bunch of space!
So a final summary is:
- Get HDB-DOS running on coco, get server running on PC, get connected with a cable. (we'll get the specifics of the cable soon)
- In the server application, choose as many disk collections (that will be seen as "devices" in HDB-DOS) mounted as you would like.
- Select your current collection from the coco using the DRIVE #n command, and then choose your current virtual floppy disk using the DRIVE n command.
Drivewire for Dummies - Part 2 - The Cable
Dragon Adapter Dragon_32/64_Drivewire_Adapter
CoCo Drivewire Cable http://www.mediafire.com/?c91gj67kw7q6yzu (CoCo DriveWire Serial Cable pin-out diagrams)
Drivewire for Dummies - Part 3 - Chicken and Egg
All the previous explanation assumes that you have HDB-DOS running on your coco. So how do you get it running on your coco?
1) If you have a disk system, you can get or create a physical disk that contains the HDB-DOS program. This includes a loader that basically gets HDB-DOS into RAM, then pulls the rug out from under DECB and replaces it with HDB-DOS. From then on you are accessing virtual disks through your rs-232 port instead of real disks through your controller cartridge.
There have been .DSK images posted here, that if restored to a physical floppy, would give you a nice HDB-DOS loader disk. However if you do not have drivewire already running, it can be pretty difficult to get the .DSK copied to a real floppy. There are PC utilities that can do this, assuming you have properly configured floppy drives on your PC (I've never gotten this to work myself.) Your best bet might be to have someone you know help you out and mail you a disk. Otherwise, does anyone know if you can still get a HDB-DOS disk from cloud9tech? That would be a valuable service I think...
2) You can load HDB-DOS loader from cassette. Now, you don't have to use an actual tape -- if you have a .WAV file on your PC that contains all the screeching and wailing we all know and love from our younger days, you can get the audio out on your PC connected to the audio in on your coco, then hit play on your .WAV file and "load" it into your coco. Or, you could play the .WAV onto an actual tape recorder if you wanted to load from a physical cassette. I feel like someone recently successfully loaded HDB-DOS using a .WAV file, if so, please reply directly to me with your audio file if you are willing--I'd like to test it myself, keep it on hand, and possibly help other drivewire newbies in the future...
3) You can burn an eprom with hdb-dos and place it in a cartridge so that it loads on boot. This is by far the most elegant, but also the most technically challenging. How to burn and install ROM images is a subject all its own, and I'm afraid I do not know enough about it. Again, cloud9tech will help you out, they did me!
Drivewire for Dummies - Part 4 - DRIVE #n vs. DRIVE n
When it comes to daily usage, the most initially confusing thing about DriveWire I think is all this talk of "devices" versus "disks," and sometimes other terms are used. I'm not really sure what the best approach is to clarify this, but I'll take a shot at it...
First, it is unfortunate perhaps that we did not choose a different file extension for files that are collections of images, as opposed to a single image. If you have a .DSK file that contains a single image, this is what you will have (in terms of DECB):
35 tracks X 18 sectors X 256 bytes per sector = 161,280 bytes, or approximately a 160k file.
For the purposes of DriveWire, however, when you mount a .DSK file as DRIVE #0 for example (in the slot for device 0), this .DSK file is actually a collection of images, and as I mentioned before, perhaps we should have chosen a different file extension such as ".DEV" for "device" or "DWD" for drivewire disks (or something.) Regardless, this file is simple, and is just virtual disk images lined up one after another. The server application figures out what offset is necessary to find the right data.
An example: Let's say you mount file "MyUtils.DSK" in slot 0 on DriveWire server, and "MyGames.DSK" in slot 1 on DriveWire server. Then the following HDB-DOS commands on your CoCo will perform these functions:
DRIVE #0 -- selects MyUtils.DSK
DRIVE 0 -- will access first 160k disk, data starting at byte 1 through byte 161,280.
DRIVE 1 -- will access second disk, data starting at byte 161,281 through byte 322,560
DRIVE 2 -- will access third disk, data starting at byte 322,561 through byte 483,840
To access your games...
DRIVE #1 -- selects MyGames.DSK
Now, the DRIVE 0 command mentioned above will not give you access to the first disk on your Utils collection, but instead the first disk in your Games collection.
In the new Drivewire4 server application, it sounds like all these mappings can be changed as needed, but for this discussion I'm just assuming that DRIVE 0 through DRIVE 255 on the coco are mapped in the same order into a corresponding file on the server side.
This is basically all you need to know about DriveWire to access data from your PC... When I have a little more time, I'll try to list the commands for some of the more common things people do with Drivewire.