home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff345.lzh / X2X / x2x_3.c < prev    next >
C/C++ Source or Header  |  1990-04-16  |  20KB  |  812 lines

  1. /*SCCS header -          %W%   %G%                                     */
  2. /************************************************************************ 
  3. *                                                                       * 
  4. *                      Filename:        x2x_3.c                         *      
  5. *                       Version:        0.0                             * 
  6. *                       Author :        Gary Duncan                     * 
  7. *                    24 Inkster St                   *
  8. *                    Kambah ACT 2902                 *
  9. *                    Australia                       *
  10. *                                                                       * 
  11. *-----------------------------------------------------------------------* 
  12. * Modification record 
  13. * ------------------- 
  14. * Date         By whom             Change 
  15. * ----         -------             ------ 
  16. * 12 Apr 89     GMD                AMIGA'd
  17. *------------------------------------------------------------------------ 
  18.  
  19.  
  20. *------------------------------------------------------------------------------ 
  21. * Contents 
  22. * ------- 
  23. *+ 
  24. *+              dos_fname       gens output file name if under DOS 
  25. *+              func1           exitsif Func 1 key hit ( DOS only ) 
  26. *+              get_rstart      looks for DLL record start 
  27. *+              sol_params      solicits for input params 
  28. *+              com_params      processes command line parameters              
  29. *+              open_ifile      opens input file 
  30. *+              open_ofile      opens output file  
  31. *+              gen_csum        builds and writes checksum record 
  32. *+              date            reformats SCCS vers / date  
  33. *+              usage           error message - 
  34. *+  
  35. ******************************************************************************/ 
  36.  
  37. #include "x2x_amiga.h"
  38. #include "x2x_data.c"
  39.  
  40.  
  41. /*************************************************************************** 
  42.  
  43.  
  44.   Function :            dos_fname     
  45.  
  46.  
  47.   Purpose  :           cater for limited file name length etc in MS_DOS 
  48.                        ( PC application ) 
  49.  
  50.   Entry    : 
  51.  
  52.  
  53.   Returns  :     TRUE -  
  54.  
  55.                  FALSE-  
  56.  
  57. ***************************************************************************/ 
  58.  
  59.  
  60.  
  61. int dos_fname () 
  62.  
  63.  
  64.  
  65. #ifdef AMIGA 
  66.  
  67.  
  68. int j = 0 ; 
  69. int k = 0 ; 
  70. uchar ch ; 
  71.  
  72. while ( ch = ofile[j]) 
  73.   { 
  74.      if ( ch == '.' ) 
  75.         break ; 
  76.  
  77.      ++j ; 
  78.   } 
  79.  
  80.  ofile [j] = '\0' ; 
  81.  strcat ( ofile , sfx[opftype] ) ;   /* append suffix */ 
  82.  
  83.  if ( strcmp ( ofile , ifile ) )      /* ensure difference */ 
  84.      return ;                       /* some , exit */ 
  85.  
  86.  /*-- in file name ...XYZ.EXT , start replacing from X <- with & until 
  87.   *      uniqueness , or exhaustion 
  88.   */ 
  89.  
  90.  while ( --j ) 
  91.      { 
  92.         ofile [j] = '&' ;     /* god , this is tedious.... */        
  93.  
  94.         if ( strcmp ( ofile , ifile ) )      /* ensure difference */ 
  95.           return ;                       /* some , exit */ 
  96.  
  97.      } 
  98.  
  99.   fprintf ( stderr , "Too many &s in input file name !\n" ) ; 
  100.   exit( 1 ) ; 
  101.  
  102.  
  103. #endif  
  104.  
  105. #if 0
  106.  
  107. /*************************************************************************** 
  108.  
  109.  
  110.   Function :      func1 
  111.  
  112.   Purpose  :      looks for Func1 from  keyboard 
  113.  
  114.   Entry    : 
  115.  
  116.   Returns  :     TRUE -  found it 
  117.  
  118.                  FALSE- 
  119.  
  120.  
  121.  
  122. ****************************************************************************/ 
  123.  
  124.  
  125. int  func1 () 
  126.  
  127.  
  128.  
  129. #ifdef AMIGA 
  130.  
  131. uchar ch ; 
  132.  
  133.    if ( scr_poll () != -1 ) 
  134.      { 
  135.       ch = scr_getc () ; 
  136.        
  137.       if ( ch == (0x3B | 0x80 ) ) 
  138.          return ( TRUE ) ;           /* found it */ 
  139.      } 
  140.  
  141. #endif 
  142.  
  143.    return (FALSE ) ; 
  144. #endif
  145.  
  146. /*************************************************************************** 
  147.  
  148.  
  149.   Function :       get_rstart     
  150.  
  151.  
  152.   Purpose  :       search for DLL record start given header char 
  153.  
  154.   Entry    :       header chara ( : / % S Q ) 
  155.  
  156.  
  157.   Returns  :      if found , exits from program otherwise 
  158.  
  159.                  
  160.  
  161. ***************************************************************************/ 
  162.  
  163.  
  164. int get_rstart ( ich ) 
  165.  
  166. uchar ich ; 
  167.  
  168.  int j = 0 ; 
  169.  int cch = 0 ; 
  170.  
  171.       while ( ich != cch )               /* search for record start  */ 
  172.     { 
  173.           if (  ( cch=Ichar() ) == -1 )  /* get chara from input file */ 
  174.             { 
  175.                 fprintf ( stderr , "Unexpected EOF on input file" ) ; 
  176.                 exit (1) ; 
  177.         } 
  178.            if ( j++ > 100 )   /* nominal length of  search */ 
  179.             { 
  180.                 fprintf ( stderr ,  
  181.             "Can't find a record header chara ( %c ) in 100 chara search!\n" , 
  182.                    ich  ) ; 
  183.                 exit (1) ; 
  184.         } 
  185.  
  186.     } 
  187.  
  188. /*************************************************************************** 
  189.  
  190.  
  191.   Function :       sol_params 
  192.  
  193.  
  194.   Purpose  :       solicits user for parameters 
  195.  
  196.   Entry    :        
  197.  
  198.  
  199.   Returns  :       
  200.  
  201.                  
  202.  
  203. ***************************************************************************/ 
  204.  
  205.  
  206.  
  207. int  sol_params ()  
  208.  
  209.  
  210. int  kk ; 
  211.  
  212.  
  213.  /*------------------ get input DLL file ---------------------------*/ 
  214.  
  215.    printf("Input file name ? " ); 
  216.    gets ( ifile ) ; 
  217.  
  218.    open_ifile ( ifile )  ;            /* open file - determine type */ 
  219.  
  220.  /*------------------ get output DLL file type ---------------------------*/ 
  221.  
  222.  kk = 0 ; 
  223.  while ( !kk ) 
  224.    { 
  225.      printf ( 
  226.        "\nOutput file type ( I, M1, M2, M3, T, Tx  ) ?  " )  ; 
  227.      gets ( kbuf ) ; 
  228.       
  229.      switch ( kk = kbuf[0] )           /* announce input file type */ 
  230.        { 
  231.         case 'i' :                 /* INTEL */ 
  232.         case 'I' :                 /* INTEL */ 
  233.                  opftype = 0 ; 
  234.                  break ; 
  235.         case 'm' :                 /* MOTOROLAs */ 
  236.         case 'M' :                 /* MOTOROLAs */ 
  237.                  opftype = 0 ; 
  238.                  switch ( kbuf[1] - '0' ) 
  239.           { 
  240.           case 3 :  ++opftype ; 
  241.                   case 2 :  ++opftype ; 
  242.                   case 1 :  ++opftype ; 
  243.                      xoMaddr = opftype +1 ;  /* addr len */  
  244.                      break ; 
  245.           default : 
  246.                       kk = 0 ;              /* force error */                  
  247.           } 
  248.                  break ; 
  249.  
  250.     case 't' : 
  251.         case 'T' :                 /* TEKTRONIX */ 
  252.                   
  253.                  ( kbuf[1] == 'x' ) ? (opftype = 5) : (opftype = 4 ) ; 
  254.  
  255.                  break ; 
  256.  
  257.         default : 
  258.                      kk = 0 ;      /* error - loop */ 
  259.  
  260.         }  
  261.    } 
  262.  
  263.  /*----------------- create o/p file -------------------------*/ 
  264.  
  265.   open_ofile ( ifile ) ; 
  266.  
  267. /*------------ now solicit record data length --------------------------*/ 
  268.  
  269.  while (1) 
  270.    {   
  271.       reclen = 0 ; 
  272.       printf (   
  273.        "\nRecord data length ( Max = 255 , default = 16 bytes) ?  " ) ; 
  274.       gets ( opbuf ) ; 
  275.       if ( !strlen (opbuf) )      /* RET means default  */ 
  276.       { 
  277.              reclen = 16 ; 
  278.              break ; 
  279.       } 
  280.       kk = sscanf ( opbuf , "%d" , &reclen  ) ; 
  281.        
  282.       if ( (reclen > 0)  && (reclen < 256 ) ) 
  283.         break ; 
  284.     } 
  285.  
  286.    /*----- adjust reclen if MOTOROLA and overflow ---------------------------*/ 
  287.  
  288.    if ( (xoMaddr + reclen) > 255 )    /* 1 byte length only ! */ 
  289.      { 
  290.        reclen = 255 - xoMaddr ;      /* adjust */ 
  291.        fprintf ( stderr , 
  292.         "Rec length overflow , data length adjusted to %d \n" , reclen ) ; 
  293.      } 
  294.  
  295.  
  296. /*************************************************************************** 
  297.  
  298.  
  299.   Function :       open_ifile 
  300.  
  301.  
  302.   Purpose  :       opens input file , announces type 
  303.  
  304.   Entry    :        
  305.  
  306.  
  307.   Returns  :      file ptr 
  308.  
  309.                  
  310.  
  311. ***************************************************************************/ 
  312.  
  313. int open_ifile ( ptr ) 
  314.  
  315. char *ptr ; 
  316.  
  317.  
  318.  
  319.    if(( iffp = open( ptr , O_RDONLY)) < 0)    /* source file */ 
  320.     { 
  321.         fprintf(stderr,"Error: unable to open '%s'\n",  ifile); 
  322.         exit(1); 
  323.     } 
  324.  
  325.  /*---------------- validate file type -------------------------------*/ 
  326.  
  327.  ipftype = get_rtype (  ) ;    /* get DLL file type */ 
  328.  
  329.  switch ( ipftype )           /* announce input file type */ 
  330.    { 
  331.    case 0 :                 /* INTEL */ 
  332.    case 1 :                 /* MOTOROLAs  */ 
  333.    case 2 : 
  334.    case 3 : 
  335.    case 4 :                 /* TEKTRONIX */ 
  336.    case 5 :                 /* TEKTRONIX - extended  */ 
  337.        break ; 
  338.  
  339.    default : 
  340.               fprintf ( stderr , "Unknown input file type\n" ); 
  341.               exit (1) ; 
  342.    }  
  343.  
  344.   printf (  "\nInput file type is :  %s" , iipftype[ ipftype ] ) ; 
  345.  
  346.  } 
  347.  
  348. /*************************************************************************** 
  349.  
  350.  
  351.   Function :           com_params        
  352.  
  353.  
  354.   Purpose  :           scans command line for invocation parameters 
  355.                        - does things with them 
  356.  
  357.   Entry    :        
  358.  
  359.  
  360.   Returns  :           mode type ( 2 or 3 )       
  361.  
  362.                  
  363.  
  364. ***************************************************************************/ 
  365.  
  366. int com_params ( count , ptr ) 
  367. int count ; 
  368. char **ptr ; 
  369.  
  370.  
  371. char *argptr ; 
  372. char *iptr ; 
  373. int ch ; 
  374. int mode = 2 ; 
  375.  
  376. while ( --count )                   /* scan the input params , if any */ 
  377.   { 
  378.    argptr = *++ptr ; 
  379.    if ( *argptr++ == '-' ) 
  380.      { 
  381.       switch ( *argptr++ )           /* look for the param */ 
  382.        { 
  383.        case 'I' : 
  384.        case 'i' :                  /*  Input file name */ 
  385.  
  386.             open_ifile ( iptr = argptr ) ;   /* open it */ 
  387.             break ; 
  388.  
  389.        case 'D' :                  /* dots ?? */ 
  390.        case 'd' :     
  391.  
  392.             pdots = 1;             /* no */ 
  393.             break ; 
  394.  
  395.        case 'O' : 
  396.        case 'o' :                 /* Output file type */ 
  397.        
  398.            switch ( *argptr++ ) 
  399.          { 
  400.              case 'i' : 
  401.          case 'I' :           /* INTEL  */ 
  402.                 opftype = 0 ;               
  403.                 break ; 
  404.  
  405.          case 'm' : 
  406.          case 'M' :           /* MOTOROLA */ 
  407.                 ch = *argptr - '0' ; 
  408.                 opftype = 0 ; 
  409.                 switch (ch) 
  410.                   { 
  411.           case 3 :   ++opftype ; 
  412.           case 2 :   ++opftype ; 
  413.           case 1 :   ++opftype ; 
  414.                        xoMaddr = opftype + 1; 
  415.                        break ; 
  416.               default : 
  417.                        usage () ; 
  418.                        exit (1) ; 
  419.  
  420.           } 
  421.                 break ; 
  422.                  
  423.          case 'T' :           /* TEKTRONIX  */ 
  424.                 opftype = 4 ;               
  425.                 break ; 
  426.  
  427.          case 't' :           /* TEKTRONIX - extended  */ 
  428.                 opftype = 5 ;               
  429.                 break ; 
  430.                
  431.              } 
  432.            break ; 
  433.  
  434.        case 'S' : 
  435.        case 's' :                 /*  record length */ 
  436.          reclen = atoi ( argptr ) ;     
  437.          if ( !reclen || (reclen > 255) ) 
  438.        { 
  439.               usage () ; 
  440.               exit (1) ; 
  441.        } 
  442.          break ;  
  443.  
  444.        case 'C' :             /* Checksum generation */ 
  445.        case 'c' : 
  446.  
  447.          opftype = 0 ;        /* set o/p file type = INTEL */ 
  448.          if ( xmode == 3 )        
  449.                   /* ensure INTEL file if mode 3 ( checksum gen ) */ 
  450.            { 
  451.              if ( ipftype != 0 ) 
  452.                { 
  453.                  fprintf ( stderr , "File must be INTEL format!\n" ) ; 
  454.                  exit (1) ; 
  455.            } 
  456.            } 
  457.          if ( !(mallocptr = malloc ( (long)(64*1024) ))  )    /* get a K64 byte array */ 
  458.             { 
  459.               fprintf ( stderr , "Malloc fail!\n" ) ; 
  460.               exit (1) ; 
  461.             } 
  462.          for ( aa=0 ; aa < 64*1024L ; ++aa )    /* init with FFs */ 
  463.             { 
  464.               *(mallocptr+aa) = 0xFF ; 
  465.             } 
  466.          mode = 3 ;                /* set mode type */ 
  467.          break ; 
  468.        
  469.       case 'R' :                    /* checksum mode - optional ROM size */ 
  470.       case 'r' : 
  471.          romsize = atoi ( argptr ) ; 
  472.          switch ( romsize )    /* yes , validate ROM size */ 
  473.       { 
  474.            case 2 : 
  475.        case 4 : 
  476.         case 8 : 
  477.        case 16 : 
  478.        case 32: 
  479.        case 64: 
  480.               break ;               /* valid sizes s*/ 
  481.       default : 
  482.               fprintf ( stderr , "Invalid ROM size !\n" ) ; 
  483.               exit (1) ; 
  484.       } 
  485.         break ; 
  486.  
  487.       case 'P' :                    
  488.       case 'p' : 
  489.                                  /* checksum mode - dump printable charas 
  490.                                     to "temp.x2x" ; used for getting EMU 
  491.                                     screen dumps in manual preparation */ 
  492.         xpflag = TRUE ; 
  493.         if(( tffp= open( "temp.x2x" ,  
  494.                   O_RDWR | O_CREAT | O_TRUNC , 0666)) < 0 )     
  495.            { 
  496.              fprintf(stderr,"Error: unable to open temp.x2x\n" ); 
  497.              exit(1); 
  498.            } 
  499.         break ; 
  500.  
  501.       default :               /* Invalid para */ 
  502.           { 
  503.            usage () ; 
  504.            exit (1) ; 
  505.           }   
  506.     } 
  507.     } 
  508.   else                    /* no "-" sign , error */ 
  509.    { 
  510.      usage (); 
  511.      exit (1) ; 
  512.    } 
  513.  } 
  514.  
  515.  
  516.  /*--------  verify params ---------------------*/ 
  517.  
  518.  if ( (!iffp) || (opftype == -1 ) )   /* ensure enough params */ 
  519.    { 
  520.      usage () ; 
  521.      exit (1) ; 
  522.    } 
  523.  open_ofile ( iptr ) ;              /* open output file */ 
  524.  
  525.  if ( mode == 3 )       /* checksum mode ? */ 
  526.     { 
  527.       return ( mode ) ; 
  528.     } 
  529.  
  530.    /*----- adjust reclen if MOTOROLA and overflow ---------------------------*/ 
  531.  
  532.    if ( (xoMaddr + reclen) > 255 )    /* 1 byte length only ! */ 
  533.        reclen = 255 - xoMaddr ;      /* adjust */ 
  534.  
  535.  
  536.   return ( mode ) ;   
  537.  
  538. /*************************************************************************** 
  539.  
  540.  
  541.   Function :            open_ofile        
  542.  
  543.  
  544.   Purpose  :            gens o/p file name and opens same 
  545.  
  546.   Entry    :        
  547.  
  548.  
  549.   Returns  :       
  550.  
  551.                  
  552.  
  553. ***************************************************************************/ 
  554.  
  555. int open_ofile ( iptr ) 
  556.  
  557. char *iptr ; 
  558.  
  559.  
  560.   strcpy ( ofile , iptr ) ;        /* create a o/p file */  
  561.  
  562. /*---------------- muck around if using stone-age MS_DOS on PC ------*/ 
  563.  
  564. #ifdef AMIGA 
  565.     dos_fname () ; /* MS_DOS :chara file-names, only one '.' allowed , yuk ..*/ 
  566. #else 
  567.   strcat ( ofile , sfx[opftype] ) ;   /* append suffix */ 
  568. #endif    
  569.  
  570.   if(( offp= open( ofile , O_RDWR | O_CREAT | O_TRUNC , 0666)) < 0 )     
  571.     { 
  572.         fprintf(stderr,"Error: unable to open '%s'\n" , ofile ); 
  573.         exit(1); 
  574.     } 
  575.  
  576.   printf (  "\nOutput file is :  %s  ( %s )\n" ,  
  577.                                ofile ,iipftype[opftype] ) ;  
  578.  
  579.  
  580. /*************************************************************************** 
  581.  
  582.  
  583.   Function :           gen_csum 
  584.  
  585.  
  586.   Purpose  :           builds and writes checksum record to disc 
  587.                  
  588.  
  589.   Entry    :           
  590.  
  591.  
  592.   Returns  :           
  593.                                
  594.  
  595.  
  596. ****************************************************************************/ 
  597.  
  598.  
  599. int gen_csum ()  
  600.  
  601.  
  602. int j , k  ; 
  603. int addr = (long)romsize*1024 -2 ; 
  604.             
  605.  
  606.   /*------------ now calc ROM checksum ----------------------------*/ 
  607.  
  608.   for ( j=0 , csum=0 ; j < addr  ; j +=2 ) 
  609.     { 
  610.        csum += *(uchar *)(mallocptr + j) ; 
  611.        csum += ((int)*(uchar *)(mallocptr + j + 1)) << 8 ; 
  612.     } 
  613.  
  614.   /* ----------- now calc record checksum -----------------------*/ 
  615.  
  616.   k = 2 + (addr&0xFF) + (addr>>8) + (csum&0xFF) + (csum>>8) ; 
  617.   k = -k ; 
  618.  
  619.   /*------------- now build record ------------------------------*/ 
  620.  
  621.     opbuf[0] = ':' ; 
  622.     opbuf[1] = '0' ; 
  623.     opbuf[2] = '2' ;    /* length */ 
  624.      
  625.  
  626.    j = convc2 ( addr >> 8 ) ;           /* load addr - hi */ 
  627.    opbuf [IRADDR] = j >> 8 ; 
  628.    opbuf [IRADDR+1] = j & 0xFF ; 
  629.  
  630.    j = convc2 ( addr ) ;                /* load addr - lo */ 
  631.    opbuf [IRADDR+2] = j >> 8 ; 
  632.    opbuf [IRADDR+3] = j & 0xFF ; 
  633.  
  634.    j = convc2 ( csum  ) ;               /* ROM checksum  - lo */ 
  635.    opbuf [IRDATA] = j >> 8 ; 
  636.    opbuf [IRDATA+1] = j & 0xFF ; 
  637.  
  638.    j = convc2 ( csum >> 8 ) ;           /* ROM checksum -  hi */ 
  639.    opbuf [IRDATA+2] = j >> 8 ; 
  640.    opbuf [IRDATA+3] = j & 0xFF ; 
  641.  
  642.    j = convc2 ( k ) ;                /* record checksum  */ 
  643.    opbuf [IRDATA+4] = j >> 8 ; 
  644.    opbuf [IRDATA+5] = j & 0xFF ; 
  645.  
  646.    opbuf [xdllen=IRDATA+6] = '\n' ;        /* append RETURN  to  record */ 
  647.  
  648.   /*--------------now write record to disc ----------------------------------*/ 
  649.  
  650.     ++datarecs ; 
  651.     ++oprecs ; 
  652.     totchars += 2 ;                  /* update total data chara count */ 
  653.  
  654.     rite_rec ( offp , opbuf , ++xdllen ) ;   /* write it */ 
  655.  
  656.  
  657.  
  658. /*************************************************************************** 
  659.  
  660.   Function :       date  
  661.  
  662.   Purpose  :       plants SCCS Vers #/build date in banner 
  663.  
  664.   Entry    :       ptr to start of vers/date in banner 
  665.  
  666.   Exit conditions:  ptr to rehacked string  
  667.  
  668.  
  669.  
  670. ****************************************************************************/ 
  671.  
  672. char *date ( optr ) 
  673.  
  674. char *optr ;                   /* ptr to date line */ 
  675.  
  676.  
  677. static char month[] = "JanFebMarAprMayJunJulAugSepOctNovDec" ; 
  678.  
  679. /*                     0123456789012345678901234                       */ 
  680. static char copy[]  = "[ V x.x   -   dd mmm yy ]" ;      /* build, copy out*/ 
  681.  
  682. int j , k  ; 
  683. char ch ; 
  684. char *iptr ; 
  685.  
  686.  
  687. /*---------------------------------------------------------------------------*/ 
  688.  
  689.    iptr = &sccs_id[0] ; 
  690.    while ( *iptr++ == ' ' ) ;    /* look for start of SCCS vers. # */ 
  691.    --iptr   ; 
  692.       
  693.    /*----------- copy Vers # to build buffer---------------------------*/ 
  694.  
  695.    j = 4 ;                           /* start of Vers in build buffer */ 
  696.    while ( (ch = *iptr++) != ' ' )    
  697.         copy[j++] = ch ; 
  698.  
  699.    /*---------------- get Months, convert and put in buffer-------------*/ 
  700.  
  701.    while ( (ch = *iptr++) == ' ' ) ;  /* look for start of months */ 
  702.    --iptr ; 
  703.  
  704.    j = 0 ; 
  705.    while ( (ch = *iptr++) != '/' )    /* 1 or 2 charas   */ 
  706.      { 
  707.          j = 10*j + (ch - '0') ;          /* yes */ 
  708.      } 
  709.  
  710.    j = 3 * (j-1) ;                     /* index to start of "mmm" charas */ 
  711.  
  712.    for ( k=0 ; k < 3 ; ++k , ++j ) 
  713.       copy [17+k] = month[j] ;         /* copy 3 charas to buffer */ 
  714.  
  715.    /*---------------- get days, and put in buffer-----------------------*/ 
  716.  
  717.    copy[15] = *iptr++ ;                    /* days - 1 */ 
  718.    if ( (ch = *iptr++) != '/' ) 
  719.       { 
  720.          copy[14] = copy[15] ;         /* shuffle up */ 
  721.          copy[15] = ch ;                /* days 2 - if there */ 
  722.        } 
  723.     ++iptr; 
  724.  
  725.    /*---------------- get years,  and put in buffer-----------------------*/ 
  726.  
  727.    copy[21] = *iptr++ ;                    
  728.    copy[22] = *iptr++ ;                    
  729.  
  730.    return ( copy ) ;    /* return with ptr to string */ 
  731.     
  732.  
  733. /*************************************************************************** 
  734.  
  735.  
  736.   Function :           usage 
  737.  
  738.  
  739.   Purpose  :          prints calling params for "emu" 
  740.                  
  741.  
  742.   Entry    :           
  743.  
  744.  
  745.   Returns  :           
  746.                                
  747.  
  748.  
  749. ****************************************************************************/ 
  750.  
  751.  
  752. int usage () 
  753.  
  754. static char *rats[] = { 
  755. "\n", 
  756. "Usage 1 & 2 :\n", 
  757. "-----------\n", 
  758. " Converts a given ASCII-hex file in Down-Line Load (DLL) format to another\n", 
  759. " or the same  DLL format . \n", 
  760. " ( Note that record checksums are not verified in the source file - this\n", 
  761. "   means that a record  can be altered and the file regenerated without the\n", 
  762. "   tedium of having to recalculate the checksum ).\n", 
  763. "\n", 
  764. "usage <1> : x2x   ( parameters are solicited )", 
  765. "\n", 
  766. "usage <2> : x2x -Ifilename -Otype [-Sxxx] \n",
  767. "\n", 
  768. "     (O)utput file types  : \n" , 
  769. "                       I  = Intel\n", 
  770. "                       M1 = Motorola S1\n", 
  771. "                       M2 = Motorola S2\n", 
  772. "                       M3 = Motorola S3\n", 
  773. "                       T  = Tektronix\n", 
  774. "                       t  = Tektronix-extended\n", 
  775. "     xxx = record data length ( 1-255 , def=16 )\n" ,  
  776. "\n", 
  777. "" 
  778. } ; 
  779.  
  780. int j = 0 ; 
  781. char *ptr ; 
  782.  
  783.  
  784.   while ( *(ptr = rats[j++])  ) 
  785.     printf ( "%s", ptr ) ; 
  786.  
  787.