C2N(1)                                                                  C2N(1)



NAME
       c2n - Commodore C2N tape format encoder and decoder

SYNOPSIS
       c2n [options] file...

DESCRIPTION
       This manual page documents briefly the c2n command.

       c2n  encodes  or decodes Commodore C2N tape recorder pulse streams that
       represent data in formats adopted by 8-bit computers.

       The pulse streams are communicated either via standard input or output,
       or via an external RS-232 device - a tape drive emulator called C2N232.
       On Commodore computers, the streams consist of four  kinds  of  symbols
       that  denote  different  kinds of low-to-high-to-low transitions on the
       read or write signals of the Commodore cassette interface.

       A      A break in the communications, or a pulse with very  long  cycle
              time.

       B      A short pulse, whose cycle time typically ranges from 296 to 424
              microseconds, depending on the computer model.

       C      A medium-length pulse, whose cycle time  typically  ranges  from
              440 to 576 microseconds, depending on the computer model.

       D      A  long pulse, whose cycle time typically ranges from 600 to 744
              microseconds, depending on the computer model.

OPTIONS
       C2N follows the usual Unix command line syntax, with  options  starting
       with a dash (`-').

       --     Stop  processing options.  This is useful if the first file name
              begins with a dash.

       -1     Use the Tangerine ORIC-1 tape format.  The short B pulses repre-
              senting '1' bits are symmetric.  The other J pulses representing
              '0' bits have a one-third duty cycle and are one  third  longer.
              This format is insensitive to the phase of the signal.

       -2     Use the Commodore 264 series tape format, for the models 16, 116
              and plus/4.  The pulse streams slightly differ from  other  Com-
              modores,  and  the  pulses are clearly wider than in other 8-bit
              Commodore systems.

       -c device
              Specify the name of the RS-232 interface connected to the C2N232
              device.  When this option is not specified, c2n will communicate
              the pulse streams via standard input or output.

       -d     Decode pulses to C2N binary format.

       -D     Decode Commodore tape images (.TAP files) from standard input to
              C2N  binary  format.   All  bytes arriving at standard input are
              assumed to be pulse width data.  This option is  interpreted  as
              -d in the presence of the -c option.

       -e     Encode  high-level  tape  format to pulses.  This is the default
              option.

       -E [+|-]rate[b|l|s|u]*[,file]
              Encode high-level tape format to pulse code modulated audio sam-
              ples.  The parameter rate specifies the sample rate in hertz.  A
              negative sample rate means that  the  phase  of  the  sinusoidal
              waves  will  be  inverted.   When  the  parameter  file  is  not
              specified, the data will be written to the standard output.  The
              default  sample  width  is 8 bits.  The modifiers b and l select
              16-bit samples in big-endian or  little-endian  format,  respec-
              tively.  By default, the sample values are signed (in two's com-
              plement notation).  The  modifier  u  selects  unsigned  format.
              Finally,  the  modifier  s overrides the default monaural output
              with binaural (stereo).

       -h     Display a short command-line usage message and exit.

       -p short,medium,long
              Specify pulse widths for the  C2N232  device.   The  unit  is  8
              microseconds.  The default widths (which are distinct for decod-
              ing and encoding) should work with all Commodore computers.  The
              options -1 and -2 imply different defaults.

       -r     Enable  raw  operation.   No  encoding  or decoding of the pulse
              stream takes place.  The file arguments  following  the  options
              given  to  c2n are assumed to be pulse streams consisting of the
              characters A, B, C, and D, as described in the beginning of this
              manual.

       -s begin,intra
              Specify the number of short pulses in the beginning of the first
              tape header block (default:  begin=1500)  and  between  adjacent
              tape  blocks  (default:  intra=5376).  The Commodore KERNAL rou-
              tines use a begin value of over 26000, corresponding  to  around
              ten  seconds.  It appears that 1500 pulses are sufficient in the
              beginning of the stream.  The intra-block gap could  be  reduced
              on  those  Commodore  models that do not blank the screen during
              tape operations nor wait for user interaction after loading  the
              header.   For  the  Tangerine  ORIC-1, the argument begin counts
              bytes, not pulses.

       -t thresold
              Specify the maximum number of errors that are  tolerated  during
              decoding  or  encoding,  before aborting program execution.  The
              default value is 10.

       -v     Enable verbose diagnostic messages from the encoding and  decod-
              ing routines.

BUGS
       The  C2N232  device is not connected to the motor control signal on the
       Commodore cassette interface.  Thus, only partial interlocking  between
       the computer and the cassette drive emulator is possible.

       All  tape operations should be started on the Commodore computer first.
       Once a prompt for starting the tape drive appears, c2n must be  invoked
       with the appropriate parameters.

       On  models  that  disable screen output during tape operations and wait
       for a key press once the tape header has been loaded, the Commodore key
       must  be  pressed quickly, since the C2N232 device does not receive any
       indication that the tape drive motor has been stopped.

       On the Commodore PET, all programs (header type 1)  are  loaded  to  an
       absolute  address,  while on other Commodores, type 1 indicates a relo-
       catable BASIC program.  Header type 3, which  corresponds  to  the  PET
       header type 1 on other Commodores, is ignored by the PET.  When loading
       machine language C2N files to the PET, make sure that the first  header
       byte  is  1.  (cbmconvert uses header type 3 when the least significant
       byte of the start address differs from 1.)

       The program has been tested on a CBM 8032 and on the  PAL  versions  of
       the Commodore VIC-20, Commodore 64, Commodore 128 and plus/4 computers,
       and on a Tangerine ORIC-1.

       Since c2n has not been designed for recovering data from  audio  tapes,
       it  does  not have any intelligent error correction features.  Instead,
       it just reports the detected inconsistencies.

AUTHOR
       The c2n utility and the C2N232  cassette  drive  emulator  device  were
       designed and implemented by Marko Mkel <msmakela@nic.funet.fi>.

SEE ALSO
       cbmconvert(1), cbmlink(1), faucet(1).



                               November 3, 2002                         C2N(1)
