home *** CD-ROM | disk | FTP | other *** search
/ CBM Funet Archive / cbm-funet-archive-2003.iso / cbm / programming / msdos / xa214f.lzh / xa214f / misc / printcbm.c < prev    next >
C/C++ Source or Header  |  1997-01-03  |  2KB  |  67 lines

  1. /*
  2.     XA65 - 6502 CROSS ASSEMBLER AND UTILITY SUITE
  3.     PRINTCBM - LIST cbm BASIC PROGRAMS
  4.     cOPYRIGHT (c) 1997 aNDR{$e9} fACHAT (A.FACHAT@PHYSIK.TU-CHEMNITZ.DE)
  5.  
  6.     tHIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
  7.     IT UNDER THE TERMS OF THE gnu gENERAL pUBLIC lICENSE AS PUBLISHED BY
  8.     THE fREE sOFTWARE fOUNDATION; EITHER VERSION 2 OF THE lICENSE, OR
  9.     (AT YOUR OPTION) ANY LATER VERSION.
  10.  
  11.     tHIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
  12.     BUT without any warranty; WITHOUT EVEN THE IMPLIED WARRANTY OF
  13.     merchantability OR fitness for a particular purpose.  sEE THE
  14.     gnu gENERAL pUBLIC lICENSE FOR MORE DETAILS.
  15.  
  16.     yOU SHOULD HAVE RECEIVED A COPY OF THE gnu gENERAL pUBLIC lICENSE
  17.     ALONG WITH THIS PROGRAM; IF NOT, WRITE TO THE fREE sOFTWARE
  18.     fOUNDATION, iNC., 675 mASS aVE, cAMBRIDGE, ma 02139, usa.
  19. */
  20.  
  21. #INCLUDE <STDIO.H>
  22.  
  23. CHAR *CMD[]={$7b} "END","FOR","NEXT","DATA","INPUT#","INPUT","DIM","READ",
  24.     "LET","GOTO","RUN","IF","RESTORE","GOSUB","RETURN",
  25.     "REM","STOP","ON","WAIT","LOAD","SAVE","VERIFY","DEF",
  26.     "POKE","PRINT#","PRINT","CONT","LIST","CLR","CMD","SYS",
  27.     "OPEN","CLOSE","GET","NEW","TAB(","TO","FN","SPC(",
  28.     "THEN","NOT","STEP","+","-","*","/","^","AND","OR",
  29.     ">","=","<","SGN","INT","ABS","USR","FRE","POS","SQR",
  30.     "RND","LOG","EXP","COS","SIN","TAN","ATN","PEEK","LEN",
  31.     "STR$","VAL","ASC","CHR$","LEFT$","RIGHT$","MID$","GO"{$7d};
  32.     
  33. INT MAIN(INT ARGC, CHAR *ARGV[]){$7b}
  34. file *FP;
  35. INT A,B,C;
  36. IF(ARGC>1){$7b}
  37. FP=FOPEN(ARGV[1],"RB");
  38. IF(FP){$7b}
  39. B=FGETC(FP);
  40. B=FGETC(FP);
  41. WHILE(B!=eof){$7b}
  42. A=FGETC(FP);
  43. A=A+256*FGETC(FP);
  44. IF(A){$7b}
  45. A=FGETC(FP);
  46. A=A+256*FGETC(FP);
  47. PRINTF("%D ",A);
  48. WHILE((C=FGETC(FP))){$7b}
  49. IF(C==eof)
  50. BREAK;
  51. IF(C>=0X80 && C<0XCC)
  52. PRINTF("%S",CMD[C-0X80]);
  53. ELSE
  54. PRINTF("%C",C);
  55. {$7d}
  56. PRINTF("\N");
  57. {$7d} ELSE
  58. BREAK;
  59. {$7d}
  60. FCLOSE(FP);
  61. {$7d} ELSE 
  62. PRINTF("fILE %S NOT FOUND!\N",ARGV[1]);
  63. {$7d} ELSE 
  64. PRINTF("USAGE: LISTCBM FILE\N");
  65. RETURN(0);
  66. {$7d}
  67.