Skip to content
bozimmermanPublic

About

Emutil is a collection of utilities for dealing with files which are in formats most commonly used by Commodore emulators.

Resources

Stars

21 stars

Watchers

2 watching

Forks

Repository files navigation

Emutils V3.0 (C)2006-2024 Bo Zimmerman
Please read the LICENSE file for license information
Please read the NOTICE file for credits information

Emutil is a collection of utilities for dealing with files which are in 
formats most commonly used by Commodore 64 emulators.  

These formats include:

-  *.D64 - 170k image of a normal formatted 5.25" Commodore 1541 disk 
        - 170k image of a C64 or C128 CP/M formatted 5.25" Commodore 1541 disk
-  *.D71 - 340k image of a normal formatted 5.25" Commodore 1571 disk 
        - 340k image of a C128 CP/M formatted 5.25" Commodore 1571 disk
-  *.D81 - 800k image of a normal formatted 3.5" Commodore 1581 disk
        - 800k image of a C128 CP/M formatted 3.5" Commodore 1581 disk
-  *.D80 - 520k image of a normal formatted 5.25" Commodore 8050 disk
        - 520k image of a CPM-86 CP/M formatted 5.25" Commodore 1571 disk
-  *.D82 - 1040k image of a normal formatted 5.25" Commodore 8250 or SFD-1001 disk
        - 1040k image of a CPM-86 CP/M formatted 5.25" Commodore 1571 disk
-  *.DNP - image of a normal formatted CMD (HD or RL) Native Partition, up to 16mb
-  *.DHD - image of raw CMD FD/HD disk image with partition table
-  *.LNX - file archiver image from the LYNX utility
-  *.T64 - Digital tape image / file archive 
-  *.ARC - ARC file archive
-  *.SDA - Self Dissolving ARC file archive
-  *.LBR - Library archive
-  1!name- ZipCode 4-Pack 170k Disk Image files
-  1!!nam- ZipCode 6-Pack 170K Disk Image files

The following utilities exist in this project:

D64Search (java)
----------------
A tool for searching the internal filenames and/or file data inside of common 
Emulator image files (.D64, .D71, D80, .D81, .D82).  This tool will report the 
names ofimage files containing matches, and the names of the internal Commodore 
files which were matched.  Supports recursing directories of image files.  It also
supports  

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/D64Search.jar 
or
java com.planet_ink.emutil.D64Search

USAGE:
  D64Search [options] [path] [expression]
OPTIONS:
  -R recursive search
  -V verbose
  -M show MD5 sum for each matching file
  -C case sensitive
  -F full absolute paths
  -Q suppress parse errors
  -X expr fmt (-Xp=petscii, Xa=ascii, Xh=hex)
  -I search inside files (substring search)
  -D db export of disk info data (-Du[user],
     -Dp[password], -Dc[java class],
     -Ds[service] -Dt[tablename])
     (Columns: string imagepath,
               string filename, int filenum,
               long size, string md5,
               string filetype)


* Expressions include % and ? characters.
* Hex expressions include hex digits, *, and ?.
-----------------------------------------------------------------------------
D64Compare
-----------
A tool for comparing the file contents of two disk images with 
each other, noting files that are in one image but not another,
and any files with different content.  This tool supports CMD
HD subdirectories as well, and will recurse into them. 

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/D64Compare.jar 
or
java com.planet_ink.emutil.D64Compare

USAGE:
  D64Compare [file1] [file2]

-----------------------------------------------------------------------------
D64FileMatcher
--------------

USAGE:
  D64FileMatcher [file/path1] [file/path2]
OPTIONS:
  -R recursive search inside DNP
  -A X approx matching min X% (slower)
  -V verbose
  -P X verbose on disks with X percent matches
  -C use memory cache of all comparison files
  -D X Recursive depth X
  -Q Suppress parsing errors
  -En X exclude files matching mask 'X' in path 'n'
  -N No sorting of source filenames

-----------------------------------------------------------------------------
D64Mod
-----------
A tool for viewing, extracting from, or modifying the contents of an
image file.  

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/D64Mod.jar 
or
java com.planet_ink.emutil.D64Mod

USAGE:
  D64Mod [options] [image file] [action] [action arguments]
ACTIONS:
  SCRATCH [file]/ALL
  EXTRACT (-p) [file]/ALL [target path]
  INSERT (-x) [source path] [file]
  BAM CHECK
  BAM ALLOC (Checks for sectors that need bam alloc)
  BAM FREE (Checks for sectors that need bam free)
  LIST/DIR [PATH]
  LIST/DIR ALL
OPTIONS:
  -r Recurse into subdirectories
  -q suppress parsing errors
  -p extract files with .prg/.seq extensions
  -x on INSERT, expand a gz, zip, lnx, or cvt archive and insert
     the files inside it.  The [file] argument is then the target
     directory in the image, and is required.  GEOS cvt files are
     installed as real GEOS files; archive files inside archives
     are expanded too.

-----------------------------------------------------------------------------
CMDHDParser
-----------
A tool for viewing the partition list and extracting or replacing 
existing partitions/disk images in a raw CMD Hard Drive (HD) iso image,
such as might be created with the *NIX "dd" utility.  This is not the
same as a DNP (native partition) image.  A CMD HD image may contain
D64, D81, DNP, and other kinds of images inside it.

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/CMDHDParser.jar 
or
java com.planet_ink.emutil.CMDHDParser

USAGE:
  CMDHDParser LIST [CMDHD_RAWIMAGE]
  CMDHDParser EXTRACT [CMDHD_RAWIMAGE] [EXTRACT_PATH_OR_FILENAME] [CMDHD_PARTITION_NUMBER]
  CMDHDParser EXTRACT [CMDHD_RAWIMAGE] [EXTRACT_PATH] ALL
  CMDHDParser REPLACE [CMDHD_RAWIMAGE] [NEW_PART_IMAGE_FILE] [CMDHD_PARTITION_NUMBER]
  CMDHDParser REPLACE [CMDHD_RAWIMAGE] [NEW_PART_IMAGES_PATH] ALL

-----------------------------------------------------------------------------
D64Duplifind
------------
A tool for comparing two sets of directories full of files, and reporting on non-duplicates.
Although not strictly for Commodore disk images, it does cater to them by restricting itself
to common disk image extensions.  It will also automatically parse gzipped (.gz) and zipped (.zip)
files to find images.

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/D64Duplifind.jar 
or
java -cp ".;commons-compress-1.12.jar" com.planet_ink.emutil.D64Duplifind
or
java -cp ".;commons-compress-1.12.jar" com.planet_ink.emutil.D64Duplifind

USAGE:
  D64Duplifind [options]
OPTIONS:
  -R recursive search
  -V verbose
  -S matches1 matches2 mismatches1 mismatches2
  -1 add to path1
  -2 add to path2

-----------------------------------------------------------------------------
GeoRWriter (java)
-----------------
A tool for reading, editing, and comparing GEOS GeoWrite v2.0/v2.1 .CVT
document files.  GeoWrite documents are up to 61 pages of text, stored in a
VLIR-structured GEOS file; this tool reads .CVT files directly and can list
or extract the text, insert/rewrite/delete lines, copy/move blocks of lines
between pages, search lines with regular expressions, replace text, and diff
two documents page by page.

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/GeoRWriter.jar
or
java com.planet_ink.emutil.GeoRWriter

USAGE:
  GeoRWriter READ [file.cvt] [page]
    - Display all pages or one page of text
  GeoRWriter LIST [file.cvt] [page]
    - Display all pages or one page of text w/ line numbers
  GeoRWriter INSERT [file.cvt] [page] [line] [text]
    - Insert one or more lines of text, rewriting the file.
  GeoRWriter INSERTPAGE [file.cvt] [page]
    - Insert a blank page, rewriting the file.
  GeoRWriter REWRITE [file.cvt] [page] [line] [text]
    - Replace one or more lines of text, rewriting the file.
  GeoRWriter REPLACE [file.cvt] [pattern] [replacement] [page]
    - Replace all regex matches within matched lines.
  GeoRWriter DELETE [file.cvt] [page] [line]-[line]
    - Delete one or more lines of text, rewriting the file.
  GeoRWriter COPY [file.cvt] [page] [line]-[line] [dstpage] [dstline]
    - Copy a block of lines to before a line on any page.
  GeoRWriter MOVE [file.cvt] [page] [line]-[line] [dstpage] [dstline]
    - Move a block of lines to before a line on any page.
  GeoRWriter SEARCH [file.cvt] [pattern] [page]
    - Find lines matching a regex, reporting page:line.
  GeoRWriter COMPARE [file1.cvt] [file2.cvt]
     - Diff two documents page by page (exit 0 if identical, 1 if not).
  GeoRWriter RENAME [file.cvt] [name]
     - Set the document's internal GEOS filename.

-----------------------------------------------------------------------------
GeoMod (java)
-------------
A binary page/record editor for GEOS .CVT files in both VLIR and sequential
formats.  While GeoRWriter works at the text-line level, GeoMod edits the raw
records themselves: it lists all records with their sizes, hex-dumps pages or a
byte range of a page, and performs structural record operations — insert,
delete, rewrite bytes, copy a page, or move a page.  It is also the binary
layer that GeoRWriter builds on for VLIR file management.

Java version requires Java 1.8 or better.

To execute from the command line (and get further help):
java -jar bin/GeoMod.jar
or
java com.planet_ink.emutil.GeoMod

USAGE:
  GeoMod READ [file.cvt] [page/record] [offset] [count]
    - Hex dump of page or region (digits only)
    page=0 or 'h' = GEOS header block, omit page = implicit page 1
  GeoMod LISTPAGES [file.cvt]
    - List all records/pagination with sizes
  GeoMod INSERTPAGE [file.cvt] [page]
    - Insert blank record at position (VLIR files only)
  GeoMod DELETEPAGE [file.cvt] <page/record>
    - Delete record from file
  GeoMod REWRITE [file.cvt] <page> <offset> <hexbytes>
    - Replace bytes in page starting at offset
    hexbytes: space-separated or contiguous hex digits, e.g. 'ff 0a' or 'ffa2'
  GeoMod COPYPAGE [file.cvt] <srcpage> <dstpage>
    - Copy page to branch position (VLIR files only)
  GeoMod MOVEPAGE [file.cvt] <srcpage> <dstpage>
    - Move page to branch position (VLIR files only)
  GeoMod RENAME [file.cvt] <newname>
    - Set the GEOS filename in the directory entry

-----------------------------------------------------------------------------
GeoAsmConv (java)
-----------------
Converts GEOS GeoProgrammer assembly source stored inside GeoWrite v2.0/v2.1
.CVT documents (such as the geoModules/geoCBMTerm sources) to cc65/ca65 .s
syntax.  It rewrites GEOS directives (.psect/.ramsect/.zsect/.eqin/.noglbl/
Pass1 guards, .macro arg lists) to ca65 equivalents, normalizes equates, and
adds notes instead of silent re-definitions.  Text decoding mirrors the real
GeoWrite reader (the geoProjects MODgeoRx GEORCCHT tables): control and
"do not use" codes are dropped and only genuinely rendered bytes become text.

Document artifacts are reported as warnings rather than silently fixed:
bare fragment symbols, empty equates, duplicated equate lines (page-overlap),
and unbalanced .macro/.endmacro blocks (duplicated page content).

To convert a single document:
java -jar bin/GeoAsmConv.jar [source.cvt] [output.s] [--srcdir dir]...

To build a complete GEOS application, use link mode.  It reads a linker
manifest (.lnk.cvt), resolves and converts every module and resource it names
(searching the manifest directory, any --srcdir, and the project obj/
directory), and writes a complete build tree: per-record .s modules, an
inc/<name>.inc shim generated from whatever definitions doc the sources
.include (named after that doc, not hardcoded), a linker config, the GEOS
header (assembled via grc65), and a Makefile that drives ca65 and ld65.

java -jar bin/GeoAsmConv.jar --lnk [manifest.lnk.cvt] [--srcdir dir]...
    [--outdir dir] [--overlaysize bytes] [--cfg file]
make -C [outdir]

--srcdir names a directory searched for the .include'd source docs and module
sources; it is repeatable, and the GEOS_SRCDIR environment variable supplies
defaults as a path-separator-delimited list.  --outdir defaults to "build"
beside the manifest; --overlaysize (decimal or 0x-hex) overrides the manifest
overlay segment size; --cfg selects the cc65 linker config (otherwise
CC65_CFG, then geos-cbm.cfg under CC65_HOME or the cc65 target path).  The
result is reproducible with only GeoAsmConv and cc65 (ca65/ld65/grc65): the
included definitions doc needs no hand-porting.

-----------------------------------------------------------------------------
Emutil.prg (Commodore BASIC/ML)
-------------------------------
A disk image archiver for Commodore 64, 128, VIC-20, Plus/4, CBM-II, and CBM/PET
computers with 16k or more.  It supports all known Commodore disk drives, of all 
capacities.  It also supports all CMD HD and RL Native partitions.

EMUTIL creates and dissolves single and multiple archive images.  The images
may be RLE compressed or uncompressed.  A single uncompressed archive image
of a 1541 disk is equivalent to a .D64 file, so it will handle those just
fine, though it is intended to cover disk drives unsupported by other
programs, such as the CBM 8050/8250 and CMD Native drives.

The program is a collaborative effort by Bo Zimmerman and Andre Fachat.  After 
building the source in CBM Prg Studio, you'll need to "fix" the binary by
changing the start address to $0401 for PETs, and then loading it and
re-saving it, to get all the line link addresses fixed.  Next, you'll need
to fix the CBM-II BANK command in line 3450 with a hex editor.  Change the
bytes in that line from $FE $02 to $20 $DC.

About

Emutil is a collection of utilities for dealing with files which are in formats most commonly used by Commodore emulators.

Resources

Stars

21 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages