PRI(1)                                pce                               PRI(1)

NAME
       pri - convert and modify PCE raw image files


SYNOPSIS
       pri [options] [input-file] [options] [output-file]


DESCRIPTION
       pri(1) is used to modify and convert PCE raw image files.


OPTIONS
       -c, --cylinder cyl1[-cyl2]
              Select a range of cylinders.

       -e, --edit what val
              For  all  selected tracks, set track attribute what to val.  For
              boolean attributes, a value of 0 disables the attribute and  any
              other value enables it.  Recognized attributes are:

              clock  The bit clock rate.

              data   Initialize the track using val.

              readonly
                     Set the read-only attribute for the image.

              size   Set the track size in bits.

              woz-cleaned
                     Set the cleaned attribute for WOZ images.

              woz-track-sync
                     Set the track sync attribute for WOZ images.

       -f, --info
              Print  information  about  the  current  image or the next image
              loaded.

       -h, --head head1[-head2]
              Select a range of heads.

       -i, --input filename
              Load an image from filename.

       -I, --input-format format
              Set the input file format to format.  Valid formats are:

              pbit   The PBIT file format. This has been superseded by PRI.

              pri    The native PCE raw image file format.

              tc     Transcopy dump format. Support for this format is  highly
                     experimental.

              woz    The Applesauce WOZ disk image format.

              moof   The Applesauce MOOF disk image format.

       -l, --list-short
              List  all  tracks  in  the  current  image  or in the next image
              loaded.  Using this options prints one line per track.

       -L, --list-long
              List all tracks in the  current  image  or  in  the  next  image
              loaded.

       -m, --merge filename
              Load  an image from filename and copy all tracks that are not in
              the current image into the current image.

       -M --merge-overwrite filename
              Load an image from filename and copy all tracks into the current
              image. Tracks that exist in both images will be  overwritten  in
              the current image.

       -o, --output filename
              Set the output file name. Before exiting, the current image will
              be written to this file.

       -O, --output-format format
              Set  the  output  file format to format. See the -I option for a
              list of valid formats.

       -p, --operation name [arg...]
              Perform an operation on the current image. Valid operations are:

              comment-add text
                     Add text to the image comment.

              comment-load filename
                     Load the image comment from file filename.

              comment-print
                     Print the current image comment.

              comment-save filename
                     Save the current image comment to filename.

              comment-set text
                     Set the image comment to text.

              decode type filename
                     Decode the image and save it as a  psi  sector  image  to
                     filename.  Valid decode types are:

                     auto   Try  to  decode  each track as ibm-mfm, ibm-fm and
                            mac-gcr.

                     ibm-fm IBM FM

                     mac-gcr
                            Apple Macintosh GCR

                     ibm-mfm
                            IBM MFM

              delete Delete all selected tracks.

              double-step
                     Remove odd numbered tracks.

              double-step-even
                     Remove even numbered tracks.

              event-add type position value
                     Add a new event of type type  at  bit  position  position
                     with  value  value on all selected tracks. The event type
                     can be specified as a numerical value or as a type name.

              event-clear
                     Clear all events of all types from the selected tracks.

              event-del type ( @index1[-index2] | offset1[-offset2] | all)
                     Delete events from the selected tracks. The type  can  be
                     specified as a numerical value, as a type name or as all.
                     The  range specifies a range of event indices as reported
                     by event-list, a range of bit offsets, or all.

              event-list type ( @index1[-index2] | offset1[-offset2] | all)
                     List events from the selected tracks.  The  type  can  be
                     specified as a numerical value, as a type name or as all.
                     The  range specifies a range of event indices, a range of
                     bit offsets, or all.

              encode type filename
                     Load a psi sector image  from  filename  and  encode  it.
                     Valid encode types are:

                     auto   Automatically  determine  the  encoding  for  each
                            track.

                     ibm-fm IBM FM

                     mac-gcr
                            Apple Macintosh GCR

                     ibm-mfm
                            IBM MFM

              half-rate
                     Remove all odd-numbered bits to create a new  track  with
                     half the data rate.

              half-step
                     Duplicate all tracks. This is the reverse of double-step.

              info   Print information about the current image (same as -f).

              mac-align mode
                     Align all selected tracks on Macintosh GCR disks relative
                     to the index.  Possible values for mode are:

                     gap    Align the start of the longest gap between sectors
                            with the index.

                     gap-end
                            Align  the  end of the longest gap between sectors
                            with the index.

                     index  Align the start of the first  sector  on  a  track
                            with the index.

                     sector, sector-end
                            Align the end of the sector before the lowest num-
                            bered sector with the index.

                     sector-id
                            Align the start of the lowest numbered sector with
                            the index.

              mfm-align-am what pos
                     Rotate the track such that the first address mark of type
                     what on the track is at bit position pos. Possible values
                     for what are:

                     all    All address mark types

                     iam    Index address marks

                     idam   ID address marks

                     dam    Data address marks

                     Multiple types can be combined by joining them with a '+'
                     or  a  '-' sign.  For example, the type all-iam specifies
                     all address mark types except index address marks.

              new    Create new tracks.

              rotate cnt
                     Rotate all selected tracks left by cnt bits.  If  cnt  is
                     negative, the track is rotated right.

              rotate-angle angle
                     Rotate  all selected tracks left by angle degrees. If an-
                     gle is negative, the track is rotated right.

              save filename
                     Save all selected tracks to filename. The contents of the
                     tracks are written sequentially to the file.

              weak-clean
                     Clean up the weak bit events on all selected tracks.

              weak-close max
                     If two weak bits are separated  by  up  to  max  non-weak
                     bits, turn all non-weak bits in between into weak bits.

              weak-detect max
                     Detect  weak  bits. All zero bits that are preceded by at
                     least max zero bits are mared as weak.

              weak-expand left right
                     Expand runs of weak bits by adding left weak bits  before
                     every weak bit and right weak bits after every weak bit.

              weak-load filename
                     Load  the weak bit mask of all selected tracks from file-
                     name. The weak bit masks are of  the  same  size  as  the
                     track data.

              weak-open max
                     Remove all runs of up to max weak bits.

              weak-save filename
                     Save  the  weak  bit mask of all selected tracks to file-
                     name. The weak bit masks are of  the  same  size  as  the
                     track data.

              weak-set val
                     Set  bits that are marked as weak to val which can be one
                     of the following:

                     0      Set bits to 0

                     1      Set bits to 1

                     flip   Invert bits

                     random Set bits to a random value

       -r, --data-rate rate
              Set the default data rate. The default is  500000.  If  rate  is
              greater than 1000 it is assumed to be in bits per second, other-
              wise it is assumed to be in kbits per seconds.

       -s, --set parameter value
              Set a parameter value. Recognized parameters are:

              mac-align mode
                     When  decoding  Macintosh  GCR tracks to text, align them
                     using mode. The rotation required for  the  alignment  is
                     recorded  in  the text output and undone when the text is
                     re-encoded, so this alignment is purely for  readability.
                     See  the  -p mac-align operation for a description of the
                     possible values for mode.

              mfm-auto-gap3 boolean
                     Automatically set the GAP3 length. The default is true.

              mfm-clock integer
                     Set the MFM clock rate (this is twice the data rate). The
                     default is 500000, suitable for double density disks.

              mfm-iam boolean
                     If false, skip the index address  mark.  The  default  is
                     false.

              mfm-gap1 integer
                     Set the GAP1 length in bytes. The default is 0.

              mfm-gap3 integer
                     Set the GAP3 length in bytes. The default is 80.

              mfm-gap4a integer
                     Set the GAP4A length in bytes. The default is 96.

              mfm-min-size integer
                     Set the minimal sector size when decoding MFM.

              mfm-nopos integer
                     If  set  to a non-zero value, ignore the PSI sector posi-
                     tions when encoding MFM tracks.

              mfm-track-size integer
                     Set the track size in bits.

              fm-auto-gap3 boolean
                     Automatically set the GAP3 length. The default is true.

              fm-clock integer
                     Set the FM clock rate (this is twice the data rate).  The
                     default is 250000, suitable for single density disks.

              fm-iam boolean
                     If  false,  skip  the  index address mark. The default is
                     false.

              fm-gap1 integer
                     Set the GAP1 length in bytes. The default is 26.

              fm-gap3 integer
                     Set the GAP3 length in bytes. The default is 27.

              fm-gap4a integer
                     Set the GAP4A length in bytes. The default is 40.

              fm-track-size integer
                     Set the track size in bits.

              psi-pos boolean
                     Enable or disable setting the sector position in  decoded
                     PSI files. The default is not to record the position.

              text-align boolean
                     If  true,  bit-align the text output to the first address
                     mark on a track.  The default is true.

       -t, --track c h
              Select tracks. This is the same as using the -c and -h options.

       -v, --verbose
              Enable verbose operation.

       -x, --invert
              Invert the selection.

       -z, --clear
              Clear the selection.

       --help Print usage information.

       --version
              Print version information.


SEE ALSO
       pce-ibmpc(1), pce-macplus(1), pce-img(1), psi(1)


AUTHOR
       Hampa Hug <hampa@hampa.ch>

HH                                2025-04-15                            PRI(1)
