PGTS High and Mighty Blog
Thread: Tips/Tricks For Programming etc
|There is no dark side in the moon --- Really! Matter of fact it's all dark!|
Back To The Floppy - Another Blast From The Past
Chronogical Blog Entries:
Date: Mon, 28 Apr 2008 12:46:41 +1000
Recently, I resumed working on MIDI programs. There were a number of things I had forgotten. For instance floppy disks (there's still quite a few musical devices that use them). In the past, I used PCalien to read (and write) Atari disks. I purchased a copy of this software last century, and I used to run it on a DR DOS machine. Later when I switched to Linux and BSD, I used to run PCalien in a freedos compatibility box (running on a Linux machine). But in the last decade, I have found that Linux has all the utilities required for reading Atari floppies.
I am sure of this because I can actually see the data that I copied in the past. But I did it quite a while ago on an older version of the Linux operating system. So, when I tried to copy some Atari disks onto my Gutsy Gibbon Ubuntu workstation I had forgotten how to do it.
I have two types of 720K devices. An Atari and a Roland Soundbrush that reads and writes Atari-formatted and MSDOS formatted. Because of problems with reliability. I used to write to Atari-formatted disks only on the Atari and I wrote MSDOS formatted disks on a machine that formatted MSDOS disks for the Soundbrush.
Every time I return to this problem things have changed slightly. Nevertheless, I find myself going back over the same familiar ground. So this time, I thought I'd write it down.
In order to get things going on the Ubuntu workstation, I checked the devices defined in the devices folder (/dev/) and found that the names of the various raw devices were missing.
On Ubuntu there is a script called MAKEFLOPPIES. I seem to recall that this script can be found on most Unix systems. If you have a system that does not have it (or an equivalent), you might be able to perform some of the actions manually (after reading the man pages for mknod). On my workstation MAKEFLOPPIES performed the following operations:
# output from the MAKEFLOPPIES script: rm -f /dev/fd0 # Creating "/dev/fd0", ID=0, Type=4 (1.44M) mknod /dev/fd0 b 2 0 mknod /dev/fd0u360 b 2 12 mknod /dev/fd0u720 b 2 16 mknod /dev/fd0u1440 b 2 28 mknod /dev/fd0u1680 b 2 44 mknod /dev/fd0u820 b 2 52 mknod /dev/fd0u1722 b 2 60 mknod /dev/fd0u830 b 2 68 mknod /dev/fd0u1743 b 2 76 mknod /dev/fd0u1040 b 2 84 mknod /dev/fd0u1120 b 2 88 mknod /dev/fd0u1760 b 2 96 mknod /dev/fd0u1920 b 2 100 mknod /dev/fd0u1840 b 2 116 mknod /dev/fd0u800 b 2 120 mknod /dev/fd0u1600 b 2 124
Which is more or less standard for an Intel/Linux box with a single 1440K drive. Obviously it's better to let MAKEFLOPPIES examine your hardware and existing configuration and make all the decision about what commands to run. And if you are wondering "Where and when does the MAKEFLOPPIES script usually run?". Well, I would expect it be run when the initial install is done (if the floppy drive was present) -- But it seems to depend on how and when the OS and the floppy drive etc was installed. Sometimes it doesn't happen. Which is why it might be necessary to invoke the MAKEFLOPPIES script from the command line.
After the raw devices had been created, I could mount a write-protected Atari disk with this command:
mount -t msdos /dev/fd0u720 /mnt/fd
I got a warning about being read-only. Strictly speaking there is a difference between Atari and MSDOS disks. However if you are reading from the disk (use the Unix cp command), this does not matter. I would not recommended writing to an Atari disk mounted in this manner. In the past, I found I might get strange errors when I mixed writes from the two different systems (Atari and Intel Linux). I would keep a disk formatted on the Linux machine for writing, and I would only read it on the Atari.
BTW: Don't forget to umount the floppy when you are finished! Those of you who have gotten used to mtools, might have forgotten about unmounting floppies. I did say that it was a blast from the past!
In order to do a low level format on 1.44M floppy (rather than use the format function on the Yamaha Clavinova) I used the following:
# setup floppy for formatting - probably not necessary, # but I had been "fiddling" with the setup setfdprm -p /dev/fd0 1440/1440 fdformat /dev/fd0
Getting The C Compiler Working:
And after trying to use perl with MIDI, I eventually relented. I know perl is an exceptional scripting language, and it can do just about anything. But when you want to get down amongst the bits and bytes of the MIDI specification, and get the job done quickly, C is the obvious language to use. Here were a couple of things I had to revise about using C on Ubuntu:
- Trying to compile a C program? And there are missing libraries e.g.
sys/time.h sys/select.h. In Ubuntu use:
sudo apt-get install build-essential
On a Mac you need to install the C programs from the release disk.
- Can't find the man pages for the various C functions? In Ubuntu use:
sudo apt-get install manpages-dev