dm ls
If you know what 'ls' from the unix world is you'll find comfort with some of the command line options available in dm (try 'dm --help'). dm will try to process all 'loose' arguments on the command line as a potential disk/archive image or directory. Order or mixture with other command options does not matter.
Features
- recursively process file system sub-directories
- recursively process within Commodore disk images and archive containers
- support for input/output redirection
- choice of output: canonical "$" style, columns, or delimited
- control over column output/order
- produces an accurate rendition of non-standard file types (based on the 1541, 1581)
- sensible output for cp437 or Unicode
- use with our font, C64 Pro Mono, for a genuine PETSCII shell experience
- support for Unicode filenames and Windows 'long' paths.
Screenshots
dm will present as good an output as possible in a default cmd shell... some PETSCII characters map sensibly and color is an option; shown left is the appearance of a d64 listed on Windows XP in the default CMD shell.
It's a little smoother if you switch to a TrueType font. But some TrueType fonts, like Lucida Console used to the left, don't have all the applicable characters that we can map to from PETSCII and show fallback characters... other TrueType fonts have a fuller set of glyphs like PragmataPro on the right; shown here are listings on Windows 8 in the default CMD shell.
Of course the best way for hardcore c64 freaks to look at their directories is made possible with our C64 Pro Mono font; behold, the true majesty of load"$",8 as it is brought to you by dm in a Windows 7 CMD shell.
dm works similarly on Linux and macOS; again with the use of C64 Pro Mono, dm's ls output inside a MATE terminal running on Linux and an iTerm2 terminal running on macOS yield a real looking PETSCII directory.
Directory Traversal
Recursion, or directory traversal if you prefer, is possible in two ways: recursion through the OS file system (using "-R/--recurse") and recursion through disk/archive contents (using "-D/--deep"). The latter is referred to in the program as a deep listing and when selected dm will traverse the contents inside the actual CBM container - archives, sub-directories and partitions - as deep as possible (e.g. an arc inside a lnx inside a zip-4 inside a 1581 subdir).
Display modes
dm supports three display modes:
Canonical
The default mode is called canonical because the output is arranged in the same layout as what an actual c64 produces from a standard listing produced by load"$",8 followed by list. However, this display mode does not try to reproduce the effect of control characters in filenames that could change the listing into different colors, clear the screen, and so on. Instead those characters are represented in the listing filenames as reverse mode PETSCII. The overall intent is that this listing follows the standard directory layout while giving the viewer filenames that make any use of unusual characters obvious.
Columns
Column mode produces output in regular columns sized to accommodate the largest value in each field. Column mode is invoked by using the "-f/--fields" command line option, followed by which fields to display. The columns are ordered the same as the list of fields. There is a shortcut command line option, "-l/--long", that includes a set of common fields; for example the following two commands produce the same column output shown below:
dm sx64-demo.d64 -C -l
dm sx64-demo.d64 -C -f blocks,bytes,index,ts,addr,name,stl
Delimited
Delimited output produces a compact listing of fields separated by a user-defined delimiter. Fields are specified using the same "-f/--fields" option as for columns, but with the additional option "-d/--delim" and a string argument that is used as the delimiter. Note also that "-l/--long" can also be used as a short cut for specifying a default set of fields.
The following two commands:
dm sx64-demo.d64 -d ", " -l
dm sx64-demo.d64 -d ", " -f blocks,bytes,index,ts,addr,name,stl
Both produce output like this:
16, 4043, 0, 17.0, $0801, "HOW TO USE", PRG
7, 1660, 1, 17.7, $0801, "HOW PART TWO", PRG
1, 63, 2, 19.0, $0401, "DOS WEDGE", PRG
4, 860, 3, 19.1, $cc00, "DOS 5.1", PRG
11, 2544, 4, 19.3, $0401, "COPY/ALL", PRG
9, 2034, 5, 19.9, $0401, "PRINTER TEST", PRG
4, 1009, 6, 16.0, $0401, "DISK ADDR CHANGE", PRG
4, 865, 7, 16.1, $0401, "DIR", PRG
Output Fields
Shown below are the possible output fields when outputting as a column form or as a delimited form. Note that the argument for '-f/--fields' must be a comma-separated list, with no spaces! 'dm --help' will also show you the possible valid field names.
Field | Output |
---|---|
blocks | The block count as stored in the CBMDOS file entry (which may not necessarily represent the true block size). |
bytes | The actual size in bytes of the file. |
index | The 0-based index of the file entry within the CBM directory. |
ts | The starting track and sector of the file; e.g. 17.0 would be shown for a file that starts at track 17, sector 0. |
addr | The load address of the file, if it is a PRG. |
name | The filename. |
stl | A field that combines the splat, type and lock fields into a compact display equivalent to how those elements are shown in a real (load"$",8) listing. |
splat | An asterisk if the file entry is marked as a "splat"; otherwise blank. |
type | The file type, which is usually a three letter abbreviation but which can show other characters for non-standard file type values. |
lock | A less-than symbol if the file entry is marked as locked; otherwise blank. |
chain | A compact representation of the file's track.sector chain. |
file | the OS filename of the disk image or archive container that the file entry is found on. |
xxh32 | A 32bit hash (xxHash/XXH32) of the file. |
xxh3 | A 64bit hash (xxHash/XXH3) of the file. |
Examples
List the contents of oldstuff.lbr and disk.d64 using the long column output, with color.
dm oldstuff.lbr -lC disk.d64
Pipe an uncompressed disk image into dm for listing, using the lower/upper character mode instead of the default upper/graphics:
xz -d mule.d64.xz | dm -c lower
List the contents of every recognized disk image and container starting with the current working directory (all files and recursing into all subdirectories):
dm -R .
Deep list the contents of the .d4m image using color, outputting three columns in the given field order - this will include the contents of all partitions and any archiver containers discovered therein:
dm -dC disk.d4m -f bytes,name,index
List only the files that conform to the standard "Koala" graphics file naming scheme using CBM $elector syntax:
dm koala.d64:{cm1}*