Installing ac
The distribution file AppleCommander-version-ac.jar provides a command-line interface to AppleCommander. It is ready to use immediately, but it may be convenient to rename it (e.g. ac.jar) or invoke it from a script, e.g.
GNU bash script (ac.sh):#!/bin/sh java -jar ~/bin/ac.jar "${@}"MS DOS batch file (ac.bat):
@echo off java -jar AppleCommander-1.3.5-ac.jar %*
Using ac
For a quick list of ac options, enter the -h command:
java -jar ac.jar -h CommandLineHelp = AppleCommander command line options [{0}]: -i <imagename> [<imagename>] display information about image(s). -ls <imagename> [<imagename>] list brief directory of image(s). -l <imagename> [<imagename>] list directory of image(s). -ll <imagename> [<imagename>] list detailed directory of image(s). -e <imagename> <filename> export file from image to stdout. -x <imagename> [<directory>] extract all files from image to directory. -g <imagename> <filename> get raw file from image to stdout. -p <imagename> <filename> <type> [[$|0x]<addr>] put stdin in filename on image, using file type and address [0x2000]. -d <imagename> <filename> delete file from image. -k <imagename> <filename> lock file on image. -u <imagename> <filename> unlock file on image. -n <imagename> <volname> change volume name (ProDOS or Pascal). -cc65 <imagename> <filename> <type> put stdin with cc65 header in filename on image, using file type and address from header. -geos <imagename> interpret stdin as a ProDOS GEOS transfer file and place on image. -dos140 <imagename> create a 140K DOS 3.3 image. -pro140 <imagename> <volname> create a 140K ProDOS image. -pro800 <imagename> <volname> create an 800K ProDOS image. -pas140 <imagename> <volname> create a 140K Pascal image. -pas800 <imagename> <volname> create an 800K Pascal image. -convert <filename> <imagename> [<sizeblocks>] uncompress a ShrinkIt or Binary II file; or convert a DiskCopy 4.2 image into a ProDOS disk image.
Examples of some typical command options follow:
The -dos140 command creates an empty 140K DOS 3.3 disk image in DOS sector order; DOS volumes do not have names, and volume number is the default (254). The -pro140 command creates an empty 140K ProDOS disk image, and -pro800 creates an empty 800K image, both in ProDOS sector order. The -pas140 command creates an empty 140K Pascal disk image, and -pas800 creates an empty 800K image, both in Pascal sector order. To be read correctly, DOS order disk image names should end in .dsk or .do, while ProDOS and Pascal order image names should end in .po. The resulting images will not boot, but they can be edited with the traditional utilities. To create a DOS 3.3, Pascal and ProDos image, enter the commands:
java -jar ac.jar -dos140 dos.dsk java -jar ac.jar -pas140 pas.po volume1 java -jar ac.jar -pro140 pro.po volume2
The -i command displays information about a disk image. Multiple image names are permitted. To get information about one or more disks, enter any of the following commands:
java -jar ac.jar -i ricky.2mg java -jar ac.jar -i fred.dsk ethel.po java -jar ac.jar -i mertz/* java -jar ac.jar -i *.po *.dsk
The -ls, -l and -ll commands list the directory of a disk image in short, regular and long format respectively. Muitiple image names are permitted, as suggested above. To see the directory of one or more disk, enter any of the following commands:
java -jar ac.jar -ls misc.dsk java -jar ac.jar -l misc.dsk java -jar ac.jar -ll misc.dsk java -jar ac.jar -ls *.po *.dsk java -jar ac.jar -l Nibble*/*
The -e command lets you examine a file by printing a readable version to standard output. To examine a file named fred on a disk named misc.dsk, enter the command:
java -jar ac.jar -e misc.dsk fred
The export command tries to choose an approriate filter for the chosen file. Filters exist for formats, with a default hexadecimal foramt for binary files. If the file is probably a picture, the export format is PNG. To save the output to a file:
java -jar ac.jar -e misc.dsk lucy.pic > lucy.png
The -g command gets a file in its raw form. To copy a file named fred from misc.dsk to a file named ethel on your file system, enter the command:
java -jar ac.jar -g misc.dsk fred > ethel
Because binary files are difficult to read, you may want to send the output to a program that can show the data in a hexadecimal format other than the one used with the -e option, above:
java -jar ac.jar -g misc.dsk fred | hexdump
The -p command puts data from the standard input stream onto a disk image. Four parameters are used: imagename, filename, type, and address. If the address is omitted and one is required, $2000 is assumed. Suppose ethel is a binary file meant to start at address 2048 ($800 or 0x800). To put the binary file named ethel back into a file named fred with that starting address on the DOS image named misc.dsk:
java -jar ac.jar -p misc.dsk fred B 0x800 < ethel
Alternatively, suppose ethel is a binary starting at 2048 destined for fred on a ProDOS image named p1.po:
java -jar ac.jar -p p1.po fred bin 2048 < ethelThe -cc65 command is like -p, but it assumes the input stream includes a four-byte header, as generated by cc65. Three parameters are required: imagename, filename, and type. The start address is taken from bytes 0-1 of the header. To put the cc65 binary named ethel into a file named fred on the DOS image named misc.dsk:
java -jar ac.jar -cc65 misc.dsk fred B < ethel
As another example, consider the text file named foo.text and the Pascal image named src.po:
java -jar ac.jar -p p2.po foo.text text < foo.text
Valid file types are specific to each operating system:
The -d command deletes a file from an image:
java -jar ac.jar -d misc.dsk fred
To copy a file from one image to another, do something like this:
java -jar ac.jar -g one.dsk fred | java -jar ac.jar -p another.dsk fred bin 2048
The -k and -u commands lock and unlock a file on the given image:
java -jar ac.jar -k misc.dsk fred java -jar ac.jar -u misc.dsk fred
The -n command changes the volume name on an image. Only ProDOS and Pascal images are affected:
java -jar ac.jar -n misc.po name
Here's a more comprehensive example of using AppleCommander for cross-platform development.
It's also possible to invoke the command line functions from within the ant build environment by using AppleCommander's ant interface, documented here.The -geos transfer file format is specified in Apple GEOS CONVERT Format.
Known problems & limitations
To replace an existing file on an image, you must delete it first; ac will create as many duplicate entries as you specify, only one of which will be accessible to the operating system.
Given a ProDOS image, a full pathname may be specified for the -e, -g, -p, -d, -k, -u and -cc65 options. Files can only be put into an existing directory.