/*                       **Protocols**                                   *\
**                                                                       **
** sony: Computer activates DTR (pin 20) on rs-232 port,                 **
** (amiga 7-line handshake)                                              **
** then sends a command and expects ACK back. ASCII digits used for      **
** addresses,etc. Expect ACK back after EACH digit sent. Returns frame#  **
** as ASCII digits. Player is single character oriented.                 **
**                                                                       **
** hitachi: Computer activates CTS (pin5) on rs-232 port and             **
** sends a command and expects JOB END back (command + 80H) usually.     **
** Commands used with enter will echo back enter and then return         **
** JOB END. ASCII digits used for addresses,etc. Returns frame# as       **
** two bytes (hi-lo). Player is string oriented.                         **
**                                                                       **
** pioneer: Computer activates CTS (pin5) of rs-232 port,                **
** (amiga 7-line handshake)                                              **
** then sends a command sequence and expects 'R' and carriage return(CR) **
** back. ASCII digits used for addresses,etc. Returns frame# as ASCII    **
** digits. Player is string oriented and reverse-polish (arg then verb). **
**                                                                       **
** SURPRISE! I don't usually check to see what player returns!           **
** If you want it, ADD it! This is only an example!                      **
\*                                                                       */


/* sony stuff */
#define ACK         '\xA'     /* acknowledge               */
#define NAK         '\xB'    /* command not accepted      */
#define COMPLETION  '\x1'   /* successful search,repeat  */
#define ERROR       '\x2'  /* error condition           */

/* hitachi stuff */
#define GS  '\x1D'   /* format error               */
#define RS  '\x1E'  /* incorrect operation error  */

/* pioneer stuff */
#define E00    "E00"      /* communication error   */
#define E04    "E04"     /* feature not available */
#define SLOW   12       /* slow speed            */
#define NORMAL 60      /* normal speed          */
#define FAST   180    /* fast speed            */
#define SCAN   255   /* Pioneer scan MUTANT!  */

#define NUMCMDS 18     /*   the number of video commands      */
char *VideoCmd[] = {"address","baud","clear","eject","enter","forward",
                    "frame","index","init","play","quit","ready","repeat","reverse",
                    "search","still","vplayer", "illegal" } ;
enum vidcmd        { address, baud, clear, eject, enter, forward,
                     frame, index, init, play, quit, ready, repeat, reverse,
                     search, still, vplayer, illegal } ;

#define NUMSPEEDS 5
char *speedstr[] = {"step","slow","fast","scan","normal"} ;
enum speedcmd {step,slow,fast,scan,normal} ;
#define NUMINDEXS 2
char *indexstr[] = {"off","on"} ;
enum indexcmd {off,on} ;

char *PlayerStr[] = {"sony","hitachi","pioneer","none"} ;
enum vplayers       { sony,  hitachi,  pioneer,  none } ; /* player types */

struct vnodes {
  char  *generic[NUMCMDS]    ;            /* generic commands              */
  char  *forward[NUMSPEEDS]  ;           /* forward commands              */
  char  *reverse[NUMSPEEDS]  ;          /* reverse commands              */
  char  *index[NUMINDEXS]    ;         /* index commands                */
  BOOL  pready               ;        /* player ready? (not used)      */
  BOOL  rp                   ;       /*  reverse polish?              */
  char  *special1            ;      /* player specific special cmd 1 */
  char  *special2            ;     /*   "       "        "      " 2 */
  char  *term                ;    /* string terminator character   */
  int   returnbytes          ;   /* # bytes returned from player  */
  int   statbytes            ;  /* number of status bytes        */
  int   addrbytes            ; /* number of address bytes       */
}  ;

struct vnodes Player[3] = {

/* **SONY** */

/* address   baud    clear     eject      enter   forward   */
{   "`",     "\0",    "V",      "*",      "@",     ":",
/*  frame  index      init       play  quit   ready    repeat  reverse  */
     "U",   "P",      "V'",      ":",  "\0",   "g",     "D",     "J",
/*  search    still   vplayer  illegal       */
     "C",      "O",     "\0",    "\0",
/*   FStep     FSlow     FFast     FScan  FNormal   */
     "+",       "<",      ";",      ">",   ":",
/*   RStep     RSlow     RFast     RScan  RNormal   */
      ",",      "L",      "K",      "N",   "J",
/*  IndexOff   IndexOn   */
     "Q",        "P",
/* pr    rp     s1     s2    term   rb  sb   ab   */
   TRUE,FALSE, "\0",  "\0",  "\0",  1,  5,   5 },       /* END of sony         */

 /* **HITACHI**      clear=mode1 eject=reject init=remote ready=status2  */
/* repeat=memory2 still=pause FScan= "                                  */

/* address   baud    clear     eject      enter   forward   */
{   "k",     "\0",   "n",       "/",      "A",     "%",
/*  frame  index      init       play  quit   ready    repeat  reverse  */
    ":",   "L",       "h",       "%",  "\0",  "j",     ")",    "B",
/*  search    still   vplayer  illegal       */
    "+",      "*",     "\0",    "\0",
/*   FStep     FSlow     FFast     FScan     FNormal   */
     "$",      "#",      "!",      "\x22", "%",
/*   RStep     RSlow     RFast     RScan  RNormal   */
     ")",      "(",      "&",      "'",   "B",
/*  IndexOff   IndexOn   */
     "M",       "L",
/* pr    rp     s1     s2    term   rb  sb   ab    */
   TRUE,FALSE,  "$",   ")",  "\0",  1,  2,   3 },      /* END of hitachi */

/* **PIONEER** */
/* Forward scan and Reverse scan are MUTANT so used multi-speed fwd/rev */
/* address   baud    clear     eject      enter   forward   */
{   "?F",    "\0",   "CL",     "OP",      "\0",    "PL",
/*  frame  index      init       play  quit   ready    repeat  reverse    */
    "FR",  "1DS",  "3AD1VDFR",   "PL", "\0",  "?P",    "\0",   "60SPMR",

/*  search    still   vplayer  illegal       */
    "SE",     "ST",    "\0",    "\0",
/*   FStep     FSlow       FFast       FScan    FNormal      */
     "SF",    "12SPMF",   "180SPMF", "255SPMF",  "PL",
/*   RStep     RSlow       RFast       RScan    RNormal     */
     "SR",    "12SPMR",   "180SPMR", "255SPMR", "60SPMR",
/*  IndexOff   IndexOn   */
    "0DS",      "1DS",
/* pr    rp     s1     s2    term   rb  sb   ab */
   TRUE,TRUE,  "\0",  "\0",  "\r",  2,  4,   6  } } ; /* end of pioneer */

/*  END   */
