cbmconvert 2.0.5
cbmconvert 2.0.5
- extract and convert different Commodore binary archivesCopyright © 1993-1999 Marko Mäkelä
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
There are many archiving programs for the Commodore 64, all of
which are incompatible with archiving programs on other systems. This
cbmconvert
utility tries to address this problem. It
extracts files from most known file formats and writes them to several
different formats, including some formats used by some Commodore 64
emulators.
This release of cbmconvert
does not contain LHARC
support any more, since 1541 disk images (either plain or ZipCoded)
and Lynx archives are much easier to handle. If you need LHARC
support, get the older release, cbmconvert 1.1.
All code has been cleaned up. The file type management in
cbmconvert 2.0.5
is very flexible, and it is very easy to
add file types later. Currently cbmconvert reads the following file
types: Arkive, Lynx, ARC64/128, PC64, disk images (1541, 1571, 1581,
both native and C128 CP/M format), and raw files. Conversions between
1541 disk images and ZipCoded files can be made with the two supplied
utilities disk2zip
and zip2disk
.
Compile cbmconvert
by entering make unix.
If you do not have GNU C compiler (gcc) installed on your
system, you will need to edit the Makefile
.
The compilation should leave you with three executables:
cbmconvert
, zip2disk
and
disk2zip
. Install these to your binaries directory, and
you are ready to go. Ask your system administrator and/or a local
guru if you do not know where to install the binaries. Or just use
them from the current directory.
There is a make file for AmigaDOS in smakefile (written by Pasi Ojala), but it is not up to date, and I don't remember for which compiler it is. You could use GNU C as well.
You can compile cbmconvert for MS-DOS with DJGPP by using the supplied Makefile. The required patches were friendly supplied by Wolfgang Moser.
16-bit compilers will probably have trouble with cbmconvert. For
instance, the standard file I/O library in Borland C uses signed
16-bit integers for size_t
, which is not enough.
cbmconvert
Starting with version 2.0.0, cbmconvert
consists of
three programs:
Since version 2.0, cbmconvert has independent file reader and writer modules that are controlled through a main program. There is only a command-line interface, but adding an interactive user interface should be easy (any volunteers?).
cbmconvert reads all files in all input files you specify on the command line and writes them in the format you specify. If you want to copy only some files from a set of archive files to an archive file or disk image, you will have to extract all the files to a single-file format such as the PC64 format, and to copy the wanted individual files to the output archive with another invocation of cbmconvert.
You can get a list of cbmconvert options by invoking the program without any arguments. cbmconvert supports following file formats:
Since cbmconvert has been written exclusively with Commodore file
names in mind, the support for CP/M disk images is a bit clumsy. You
may want to rename the files after extracting them from the disks.
For instance, if you have downloaded the CP/M disk images from
http://www.funet.fi/pub/cbm/demodisks/c128/, you can use the following
commands in bash
to extract the files from the disk
images:
gunzip *.d64.gz for i in *.d64; do mkdir ${i%.d64}; cd ${i%.d64}; cbmconvert -c ../$i; cd ..; done for i in */*.prg; do mv $i "`echo ${i%.prg}|tr A-Z a-z`"; done
CP/M does not store the exact length of the files anywhere. That
is why many CP/M programs create files whose length is a multiple of
128 bytes. Text files in CP/M commonly use ^Z as an end-of-file
delimiter, and many programs fill the extra bytes in the last 128-byte
block of the file with this character. The CP/M routines in
cbmconvert does so as well, and it removes the padding when reading
the files. So, you could use cbmconvert to remove the padding. But
you may prefer the following bash
command (requires Perl
5):
for i in *; do perl -i -e 'undef $/; $_=<>; while(/\032$/){chop} print' "$i"; done
GEOS files on disk images will be handled transparently by converting them to and from the Convert format on the fly. All unused areas in the Convert file will be zeroed out, and all possible integrity checks will be made in both conversions. If the file is interpreted to be in GEOS or Convert format, and it fails in any integrity check, it will be treated as a native Commodore file.
You should note that Convert does not provide much safety for the file. For sequential files, the original file length is not stored anywhere. For VLIR files, it is, but even then there are no checksums.
As a speciality, all GEOS files have a file information block. The contents of this block can be viewed with the simple Perl script cvtinfo.pl that reads files in Convert format. It was just a quick hack; feel free to make it more robust.
The GEOS routines have been tested with twelve 1541 disk images and with several megabytes of *.cvt files, and they are believed to be error free now. There were problems with the VLIR sector format; Mr. Boyce's reverse engineered information about it was incorrect, or at least inadequate.
The conversion may lose some file name or attribute information. In some cases, the filenames will be converted from PETSCII to ASCII or vice versa, and some PETSCII or ASCII specific characters will be lost in the conversions. Non-standard directory information available in some formats will be lost as well.
Lynx, Arkive and ARC allow duplicate filenames. But
cbmconvert
detects them and refuses to write multiple
files with identical names to archives or to disk images. These
duplicates are often used as directory separators, to separate groups
of filenames. If you really need such separators, use 1-block-long PRG
or SEQ files with different names. For example, the first separator
can be a string of 16 dashes, the second one can be 15 dashes, and so
on.
Arkive also works on illegal file types that cannot be created without directly modifying the directory blocks. Such files will be converted to a supported file type. Files with unknown types on disk images will be skipped.
Handling the errors on disk images could be more robust. Not all (typically BAM-related) errors on CBM DOS disk images are detected. For erroneous 1541 disk images that do not work with the new cbmconvert, you may want to try the disk2files program of the previous release.
This program converts a standard 35-track, 683-block 1541 disk image to ZipCode format. Because the ZipCode format stores the disk identifier, this conversion adds information. You can use the -i option to specify the disk identifier.
ZipCoded archives consist of four files prefixed with a number from 1 to 4, and a exclamation point. To extract an archive having the files "1!disk", "2!disk", "3!disk" and "4!disk", command "zip2disk disk". You may then delete the original files with "rm [1-4]\!disk" or similar. But note that some software (demos and copy-protected software) may rely on the disk identifier, which will not be stored in the 1541 disk image file.
Support for ZipCode SixPacks ("1!!disk", "2!!disk", ..., "6!!disk") could be added easily, but this format is used mainly for really custom 1541 disks with abnormal low-level format, for which there doesn't exist any commonly agreed representation format.
Most of the cbmconvert package was written by Marko Mäkelä. The original version appeared in 1993, and a complete rewrite was started in 1997 and finished in 1998.
The zip2disk module was originally programmed by Paul David Doherty. The ISO 9660 compliant filename truncation algorithm was taken from the T64TOP00 utility created by Wolfgang Lorenz as a part of his now discontinued PC64 emulator.
Support for 1581 CBM DOS disk images was programmed by Pasi Ojala.
The ARC/SDA dissolving code was originally written by Chris Smeets.
The necessary information for supporting GEOS was provided by Joe Forster/STA, Doug Cotton, Alexander Boyce (author of the unofficial GEOS Programmer's Reference Guide) and by the anonymous author of the file "convertfrmt.txt".
You can download the latest source code distribution of cbmconvert from http://www.funet.fi/pub/cbm/crossplatform/converters/unix/.
You can find a 32-bit MS-DOS binary distribution of cbmconvert at http://www.funet.fi/pub/cbm/crossplatform/converters/msdos/. It may be out of date; if you want to have the current version, compile it from the sources yourself, and do not forget to write the author that you could upload the binary somewhere.