home *** CD-ROM | disk | FTP | other *** search
- From: jac@yoko.rutgers.edu (Jonathan A. Chandross)
- Newsgroups: comp.sources.apple2
- Subject: v001SRC029: BinSCII for Unix
- Message-ID: <May.1.17.10.24.1991.22822@yoko.rutgers.edu>
- Date: 1 May 91 21:10:26 GMT
- Approved: jac@paul.rutgers.edu
-
-
- Submitted-by: Neil Parker (parker@corona.uoregon.edu)
- Posting-number: Volume 1, Source:29
- Archive-name: archive/unix/binscii/bsc
- Architecture: UNIX
- Version-number: 1.00
-
- bsc is a program which creates BinSCII files on UNIX systems.
-
- Enjoy.
-
- =Read.Me
- -
- -Bsc
- -Version 1.00
- -
- -Bsc is a program which creates BinSCII files on UNIX systems.
- -
- -
- -COMPILING
- ----------
- -
- -To compile:
- -
- - cc -o bsc bsc.c
- -
- -Bsc was written and tested on a BSD-based UNIX system. If you have a
- -System V-based UNIX, you might try compiling with the command
- -
- - cc -DSYSTEMV -o bsc bsc.c
- -
- -However, I don't really know whether or not this will work, since I
- -don't have access to a true System V UNIX system. You may be on your
- -own here.
- -
- -After you compile bsc, feel free to rename it to whatever you want--it's
- -smart enough to figure out its own name.
- -
- -EXECUTING
- ----------
- -
- -To run bsc, use:
- -
- - bsc [<options>] <filename>
- -
- -The following options are available:
- -
- - -t type Sets the ProDOS filetype stored in the BinSCII
- - header to "type". The type may be specified in
- - any of several ways:
- - Type Meaning
- - ---- -----------
- - LLL 3-letter abbreviation
- - dd decimal
- - 0xdd hexadecimal
- - $dd hexadecimal
- - 0dd octal
- - Note that a 3-letter abbreviation must be specified
- - in lowercase, and that if you use a hex number in
- - $dd format you will have to quote or escape the $
- - to protect it from the shell. If no "-t" option is
- - present, the filetype will default to 6 (BIN). (See
- - the file "pftypes.h" for a complete list of recognized
- - 3-letter ProDOS filetype abbreviations.)
- -
- - -a auxtype Sets the stored ProDOS auxiliary filetype to
- - "auxtype". The auxiliary type may specified in
- - any of the following forms:
- - Syntax Base
- - ------ -----------
- - dd decimal
- - $dd hexadecimal
- - 0xdd hexadecimal
- - 0dd octal
- - If no "-a" options is present, the auxiliary
- - filetype will default to 0.
- -
- - -m mode Sets the stored ProDOS access mode to "mode" The
- - mode may be one or more of the following:
- - Mode Meaning
- - ---- ---------
- - d destroy
- - n rename
- - b backup-needed
- - i invisible
- - w write
- - r read
- - If no "-m" option is present, the access mode
- - defaults to "dnwr", which corresponds to an
- - "unlocked" ProDOS file. To create a "locked"
- - file, use "-m r".
- -
- - -s num Sets the number of BinSCII segments per output file
- - to "num". As above, the number may be specified in
- - decimal, hex, or octal. If no "-s" option is present,
- - or if "num" is 0, then all BinSCII segments will be
- - written to a single output file. To cause each
- - segment to go into its own output file (like the
- - Apple II BINSCII program), use "-s 1". See below
- - for an explanation of output files.
- -
- - -h Print a short summary of bsc's options on the
- - standard output.
- -
- -These options, if present, may appear in any order, provided that they
- -appear before the filename. Spaces may appear between an option letter
- -and its value, but are not necessary.
- -
- -The filename is the name of the UNIX file to be BinSCII'd. The stored
- -ProDOS filename will be taken from the UNIX name, with lowercase letters
- -converted to uppercase and with invalid characters replaced with the
- -letter "X". The ProDOS name will be truncated to 15 letters if the UNIX
- -name is longer than that.
- -
- -The stored ProDOS creation and modification times will be taken from the
- -UNIX input file.
- -
- -The output of bsc is a set of one or more files, each containing one or
- -more BinSCII segments. By default, all BinSCII segments are written to
- -a single output file, which has the same name as the input file with a
- -".0" appended to the end. If the "-s" option is given on the command
- -line with a value greater than zero, then the number of segments per
- -output file will be limited to the specified value, and if more than one
- -output file is needed, the second file will have ".1" appended to the
- -name, the third will have ".2" appended, and so forth. For example, if
- -"foo" is a large UNIX file, the command "bsc -s3 foo" will create files
- -"foo.0", "foo.1", "foo.2", etc., each containing 3 BinSCII segments.
- -
- -WARNING: IF A FILE WITH THE SAME NAME AS A BSC OUTPUT FILE ALREADY
- -EXISTS, THE PRE-EXISTING FILE WILL BE SILENTLY OVERWRITTEN BY THE BSC
- -OUTPUT FILE. Before typing "bsc foo", it is probably a good idea to
- -make sure you don't already have an important data file called "foo.0".
- -
- -Bsc will refuse to BinSCII a file larger than 16777216 bytes (16 meg),
- -since that is the maximum size of a ProDOS file.
- -
- -An example: Suppose a UNIX file called "picture" contains a standard
- -Apple IIGS super-hires screen image. The command
- -
- - bsc -tpic picture
- -
- -will create the file "picture.0" in a format suitable for downloading to
- -an Apple II and un-BinSCIIing, or for posting to comp.binaries.apple2.
- -When un-BinSCII'd on an Apple II, it will automatically be converted to
- -a PIC ($C1) file.
- -
- -INFORMATION
- ------------
- -
- -This program is freeware. It comes with no warranty of any kind--in
- -particular, I cannot guarantee that it is free of bugs. Use it at your
- -own risk.
- -
- -When the inevitable bugs DO appear, send e-mail to one of the addresses
- -below. I welcome bug reports, comments, complaints, and suggestions for
- -improvement.
- -
- -Thanks to Marcel J. E. Mol, whose sciibin program was a valuable source
- -of technical information on BinSCII.
- -
- - - Neil Parker
- - parker@corona.uoregon.edu
- - nparker@cie.uoregon.edu
- - parkern@jacobs.cs.orst.edu
- -
- =bsc.c
- -/*
- - * Program: bsc.c
- - * Version: 1.0
- - * Author: Neil Parker
- - * Date: 14 Mar 1991
- - * Files: bsc.c (source code)
- - * crc.h (CRC generation routine)
- - * pftypes.h (ProDOS file types)
- - * Purpose: Create BinSCII files on UNIX
- - *
- - * This program is freeware. It comes with no warranty whatsoever; use
- - * at your own risk.
- - */
- -#include <stdio.h>
- -#ifdef SYSTEMV
- -#include <string.h>
- -#define rindex strrchr
- -#else
- -#include <strings.h>
- -#endif
- -#include <sys/types.h>
- -#include <sys/stat.h>
- -#include <time.h>
- -#include <ctype.h>
- -#include "crc.h"
- -#include "pftypes.h"
- -
- -unsigned int getnumber(),getftype();
- -
- -unsigned char inbuf[49], /* buffer for reading from input */
- - header[28]; /* buffer for BinSCII header */
- -
- -char outbuf[65], /* buffer for coded output lines */
- - binsciifile[256], /* buffer for ProDOS filename in header */
- - *infile, /* name of input file */
- - outfile[256], /* name of current output file */
- - *filestart="FiLeStArTfIlEsTaRt", /* BinSCII intro marker */
- - *alphabet= /* code alphabet */
- - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()",
- - *progname; /* program name, for error messages */
- -
- -unsigned int crc, /* running CRC counter */
- - processed, /* number of bytes already processed */
- - remaining, /* number of bytes yet to be processed */
- - auxtype=0, /* ProDOS aux type (default=0) */
- - access=0xc3, /* ProDOS access mode (default=dnwr) */
- - filetype=6, /* ProDOS file type (default=bin) */
- - storagetype, /* ProDOS file storage type */
- - blocks, /* number of blocks in ProDOS file */
- - seqno, /* output file sequence number */
- - segsplit=0; /* output segment split count (default=0) */
- - segno; /* output segment number */
- -
- -long filesize, /* input file size */
- - segmentlen; /* count of bytes remaining in current segment */
- -
- -FILE *fi, /* input file pointer */
- - *fo; /* current output file pointer */
- -
- -main(argc,argv)
- -int argc;
- -char **argv;
- -{
- - char *c;
- - unsigned char *uc;
- - unsigned int numread;
- - long lastbyte;
- - struct stat statbuf;
- - struct tm *timebuf;
- -
- -/* get program so we can print it in usage() and help() */
- -
- - if((progname=rindex(*argv,'/'))==NULL)
- - progname= *argv;
- - else
- - progname++;
- -
- -/* get and interpret command-line arguments */
- -
- - if(argc<2)
- - usage();
- -
- - while(argc-- >1) {
- - argv++;
- - if(**argv=='-') {
- - switch(argv[0][1]) {
- -
- - case 'h': /* help */
- - help(); /* doesn't return */
- -
- - case 't': /* type */
- - c= *argv+2;
- - if(*c=='\0') {
- - argv++;
- - argc--;
- - if(argc<1)
- - usage();
- - c= *argv;
- - }
- - filetype=getftype(c);
- - break;
- -
- - case 'a': /* auxtype */
- - c= *argv+2;
- - if(*c=='\0') {
- - argv++;
- - argc--;
- - if(argc<1)
- - usage();
- - c= *argv;
- - }
- - auxtype=getnumber(c);
- - break;
- -
- - case 's': /* segments/file */
- - c= *argv+2;
- - if(*c=='\0') {
- - argv++;
- - argc--;
- - if(argc<1)
- - usage();
- - c= *argv;
- - }
- - segsplit=getnumber(c);
- - segsplit=segsplit==0?32767:segsplit;
- - break;
- -
- - case 'm': /* access mode */
- - c= *argv+2;
- - if(*c=='\0') {
- - argv++;
- - argc--;
- - if(argc<1)
- - usage();
- - c= *argv;
- - }
- - access=0;
- - while(*c!='\0') {
- - switch(*c) {
- - case 'd':
- - access|=0x80;
- - break;
- - case 'n':
- - access|=0x40;
- - break;
- - case 'b':
- - access|=0x20;
- - break;
- - case 'i':
- - access|=0x04;
- - break;
- - case 'w':
- - access|=0x02;
- - break;
- - case 'r':
- - access|=0x01;
- - break;
- - default:
- - usage();
- - }
- - c++;
- - }
- - break;
- -
- - default:
- - usage();
- -
- - } /* END switch(argv[0][1]) */
- - } else { /* **argv!='-' */
- -
- - infile= *argv;
- - if(argc>1) /* filename must be last arg */
- - usage();
- -
- - } /* END if(**argv=='-') */
- -
- - } /* END while(argc-->1) */
- -
- -/* Convert UNIX pathname into valid ProDOS file name */
- -
- - if((c=rindex(infile,'/'))==NULL) /* delete leading path components */
- - c=infile;
- - else
- - c++;
- -
- - strcpy(&binsciifile[1],c);
- - c=binsciifile+1;
- -
- - if(!isalpha(*c)) /* initial invalid char -> 'X' */
- - *c='X';
- - for(;*c!='\0';c++)
- - if(isalnum(*c)||*c=='.') {
- - if(islower(*c)) /* upshift lowercase */
- - *c=toupper(*c);
- - } else /* invalid char -> 'X' */
- - *c='X';
- -
- - c=binsciifile+1;
- - if(*c=='\0') {
- - fprintf(stderr,"empty ProDOS file name\n");
- - exit(1);
- - }
- - c[15]='\0'; /* truncate name at 15 chars */
- - binsciifile[0]=alphabet[strlen(c)-1]; /* encode name length */
- - strcat(c," "); /* 16 spaces */
- - c[15]='\0'; /* pad with spaces, and truncate to 15 again */
- -
- -/* Make sure input file exists, and get its size and dates */
- -
- - if(stat(infile,&statbuf)<0) {
- - perror("getting input file status");
- - exit(1);
- - }
- -
- - filesize=statbuf.st_size;
- - lastbyte=filesize-1;
- - if(filesize>16777216L) { /* ProDOS can't handle files >16Mb */
- - fprintf(stderr,"Input file too big for ProDOS\n");
- - exit(1);
- - }
- -
- - if(filesize>131072L) {
- - storagetype=3; /* tree */
- - blocks=3+lastbyte/131072+lastbyte/512;
- - } else if(filesize>512L) {
- - storagetype=2; /* sapling */
- - blocks=2+lastbyte/512;
- - } else {
- - storagetype=1; /* seedling */
- - blocks=1;
- - }
- -
- -/* Get file times into BinSCII header */
- -
- - timebuf=localtime(&statbuf.st_ctime);
- - timebuf->tm_mon+=1; /* UNIX month is 0-11, ProDOS is 1-12 */
- - header[13]=timebuf->tm_mday|(timebuf->tm_mon<<5); /* create date */
- - header[14]=(timebuf->tm_mon>>3)|(timebuf->tm_year<<1);
- - header[15]=timebuf->tm_min; /* create time */
- - header[16]=timebuf->tm_hour;
- -
- - timebuf=localtime(&statbuf.st_mtime);
- - timebuf->tm_mon+=1;
- - header[17]=timebuf->tm_mday|(timebuf->tm_mon<<5); /* mod date */
- - header[18]=(timebuf->tm_mon>>3)|(timebuf->tm_year<<1);
- - header[19]=timebuf->tm_min; /* mod time */
- - header[20]=timebuf->tm_hour;
- -
- -/* Fill out remaining constant portion of header */
- -
- - header[0]=filesize&0xff;
- - header[1]=(filesize>>8)&0xff;
- - header[2]=(filesize>>16)&0xff;
- -
- - header[6]=access;
- -
- - header[7]=filetype;
- -
- - header[8]=auxtype&0xff;
- - header[9]=(auxtype>>8)&0xff;
- -
- - header[10]=storagetype;
- -
- - header[11]=blocks&0xff;
- - header[12]=(blocks>>8)&0xff;
- -
- - header[26]=0;
- -
- -/* open input file; initialize counters */
- -
- - if((fi=fopen(infile,"r"))==NULL) {
- - perror("opening input file");
- - exit(1);
- - }
- -
- - processed=0;
- - remaining=filesize;
- - segno=0;
- - seqno=0;
- -
- - while(remaining>0) { /* loop until nothing left to process */
- -
- - segmentlen=remaining>0x3000?0x3000:remaining;
- - /* max segment size is 0x3000 */
- -
- -/* see if new output file should be created--if so, form name and create
- - it */
- -
- - if(segno==0) {
- - sprintf(outfile,"%s.%d",infile,seqno++);
- - if((fo=fopen(outfile,"w"))==NULL) {
- - sprintf(outbuf,
- - "opening output file %s",outfile);
- - perror(outbuf);
- - exit(1);
- - }
- - }
- -
- -/* write headers to new file */
- -
- - fprintf(fo,"%s\n",filestart);
- - fprintf(fo,"%s\n",alphabet);
- - fprintf(fo,"%s",binsciifile);
- -
- -/* set up variable part of header */
- -
- - header[3]=processed&0xff; /* start addr of this seg */
- - header[4]=(processed>>8)&0xff;
- - header[5]=(processed>>16)&0xff;
- -
- - header[21]=segmentlen&0xff; /* length of this seg */
- - header[22]=(segmentlen>>8)&0xff;
- - header[23]=(segmentlen>>16)&0xff;
- -
- -/* compute header CRC */
- -
- - crc=0;
- - for(uc=header;uc!=header+24;uc++)
- - crc=updcrc(*uc,crc);
- -
- - header[24]=crc&0xff;
- - header[25]=(crc>>8)&0xff;
- -
- -/* code header and send it on its way */
- -
- - encode(header,outbuf,27);
- - fprintf(fo,"%s\n",outbuf);
- -
- -/* start working on segment data */
- -
- - crc=0;
- - while(segmentlen>0) { /* loop until end of seg */
- -
- - bzero(inbuf,48); /* zero buffer in case there's
- - not enough data to fill it */
- -
- -/* get 48 bytes (or less if at end) from file */
- -
- - if((int)(numread=fread(inbuf,1,48,fi))<0) {
- - perror("reading input file");
- - exit(0);
- - }
- -
- -/* update CRC for this line */
- -
- - for(uc=inbuf;uc!=inbuf+48;uc++)
- - crc=updcrc(*uc,crc);
- -
- -/* code the line and send it on its way */
- -
- - encode(inbuf,outbuf,48);
- - fprintf(fo,"%s\n",outbuf);
- -
- - segmentlen-=numread;
- - remaining-=numread;
- - processed+=numread;
- - } /* END while(segmentlen>0) */
- -
- -/* end of segment--code and write the CRC */
- -
- - inbuf[0]=crc&0xff;
- - inbuf[1]=(crc>>8)&0xff;
- - inbuf[2]=0;
- -
- - encode(inbuf,outbuf,3);
- - fprintf(fo,"%s\n",outbuf);
- -
- -/* if end of output file, close it and prepare for next output file */
- -
- - if(++segno==segsplit) {
- - segno=0;
- - fclose(fo);
- - }
- -
- - } /* END while(remaining>0) */
- -
- -/* all done--close and exit */
- -
- - if(segno!=0)
- - fclose(fo);
- - fclose(fi);
- - exit(0);
- -}
- -
- -/* subroutine to encode a line of data */
- -
- -encode(input,output,length)
- -unsigned char *input;
- -char *output;
- -int length;
- -{
- - int i;
- - char *o;
- -
- - o=output;
- - for(i=0;i<length;i+=3) {
- - *o++ =alphabet[input[i+2]&0x3f];
- - *o++ =alphabet[((input[i+2]>>6)|(input[i+1]<<2))&0x3f];
- - *o++ =alphabet[((input[i+1]>>4)|(input[i]<<4))&0x3f];
- - *o++ =alphabet[input[i]>>2];
- - }
- - *o='\0';
- -}
- -
- -/* subroutine to get a file type from the command line */
- -
- -unsigned int getftype(c)
- -char *c;
- -{
- - int i;
- - unsigned int retcode;
- -
- - for(i=0;i<FTYPESIZE;i++) /* loop over file types */
- - if(!strcmp(c,filetypes[i].name)) {
- - retcode=filetypes[i].code;
- - return retcode&0xff;
- - }
- - return getnumber(c)&0xff; /* if not found, try to parse a number */
- -}
- -
- -/* subroutine to get a decimal, hex, or octal number from command line */
- -
- -unsigned int getnumber(c)
- -char *c;
- -{
- - unsigned int i;
- -
- - if(*c=='$') { /* $nn -> hex */
- - sscanf(c+1,"%x",&i);
- - return i;
- - }
- - if(!isdigit(*c))
- - usage();
- - if(*c=='0')
- - if(c[1]=='x'||c[1]=='X')
- - sscanf(c+2,"%x",&i); /* 0xnn or 0Xnn -> hex */
- - else
- - sscanf(c,"%o",&i); /* 0nn -> octal */
- - else
- - sscanf(c,"%d",&i); /* nn -> decimal */
- - return i;
- -}
- -
- -usage()
- -{
- - fprintf(stderr,
- - "usage: %s [-t <type>] [-a <aux>] [-m <mode>] [-s <num>] <file>\n",
- - progname);
- - fprintf(stderr," %s -h (for help)\n",progname);
- - exit(1);
- -}
- -
- -help()
- -{
- - printf("Usage: %s [<args>] <file>\n",progname);
- - printf("args: -t <type> = set ProDOS file type to <type>\n");
- - printf(" -a <aux> = set ProDOS aux type to <aux>\n");
- - printf(" -m <mode> = set ProDOS access mode--<mode> may be any\n");
- - printf(" combination of d, n, b, i, w, or r\n");
- - printf(" -s <num> = set number of segs/output file to <num>\n");
- - printf(" -h = print this help message\n");
- - exit(0);
- -}
- =crc.h
- -/*
- - * updcrc macro derived from article Copyright (C) 1986 Stephen Satchell.
- - * NOTE: First srgument must be in range 0 to 255.
- - * Second argument is referenced twice.
- - *
- - * Programmers may incorporate any or all code into their programs,
- - * giving proper credit within the source. Publication of the
- - * source routines is permitted so long as proper credit is given
- - * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg,
- - * Omen Technology.
- - */
- -
- - /* #define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp) */
- -#define updcrc(cp, crc) ( (crctab[((crc >> 8) & 0xFF) ^ cp] ^ (crc << 8)) & 0xFFFF)
- -
- -
- -/* crctab calculated by Mark G. Mendel, Network Systems Corporation */
- -static unsigned short crctab[256] = {
- - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
- - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
- - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
- - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
- - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
- - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,
- - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,
- - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,
- - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,
- - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,
- - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,
- - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,
- - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,
- - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,
- - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,
- - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,
- - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,
- - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,
- - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,
- - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,
- - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,
- - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
- - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,
- - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,
- - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,
- - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,
- - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,
- - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,
- - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,
- - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,
- - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
- - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
- -};
- -
- =pftypes.h
- -/*
- - * Apple II ProDOS file types as of September, 1990
- - *
- - * See "About Apple II File Type Notes" by Apple Developer Technical
- - * Support for more information.
- - *
- - * This list is taken directly from the above named document, with the
- - * exception of the file types $B6 and $F9, for which the abbreviations
- - * "str" and "p16" are often found alongside the official abbreviations
- - * ("pif" and "os" respectively).
- - */
- -
- -struct ftypes {
- - unsigned char code;
- - char name[4];
- -} filetypes[] = {
- - 0x00, "unk", /* Unknown */
- - 0x01, "bad", /* Bad blocks */
- - 0x02, "pcd", /* Apple /// Pascal code */
- - 0x03, "ptx", /* Apple /// Pascal text */
- - 0x04, "txt", /* ASCII text */
- - 0x05, "pda", /* Apple /// Pascal data */
- - 0x06, "bin", /* Binary */
- - 0x07, "fnt", /* Apple /// Font */
- - 0x08, "fot", /* Apple II or /// Graphics */
- - 0x09, "ba3", /* Apple /// BASIC program */
- - 0x0A, "da3", /* Apple /// BASIC data */
- - 0x0B, "wpf", /* Apple /// Word Processor */
- - 0x0C, "sos", /* Apple /// SOS System */
- - 0x0F, "dir", /* Folder */
- - 0x10, "rpd", /* Apple /// RPS data */
- - 0x11, "rpi", /* Apple /// RPS index */
- - 0x12, "afd", /* Apple /// AppleFile discard */
- - 0x13, "afm", /* Apple /// AppleFile model */
- - 0x14, "afr", /* Apple /// AppleFile report format */
- - 0x15, "scl", /* Apple /// screen library */
- - 0x16, "pfs", /* PFS document */
- - 0x19, "adb", /* AppleWorks Data Base */
- - 0x1A, "awp", /* AppleWorks Word Processor */
- - 0x1B, "asp", /* AppleWorks Spreadsheet */
- - 0x20, "tdm", /* Desktop Manager document */
- - 0x2A, "8sc", /* Apple II Source Code */
- - 0x2B, "8ob", /* Apple II Object Code */
- - 0x2C, "8ic", /* Apple II Interpreted Code */
- - 0x2D, "8ld", /* Apple II Language Data */
- - 0x2E, "p8c", /* ProDOS 8 code module */
- - 0x42, "ftd", /* File Type Names */
- - 0x50, "gwp", /* Apple IIGS Word Processor */
- - 0x51, "gss", /* Apple IIGS Spreadsheet */
- - 0x52, "gdb", /* Apple IIGS Data Base */
- - 0x53, "drw", /* Drawing */
- - 0x54, "gdp", /* Desktop Publishing */
- - 0x55, "hmd", /* Hypermedia */
- - 0x56, "edu", /* Educational Data */
- - 0x57, "stn", /* Stationery */
- - 0x58, "hlp", /* Help File */
- - 0x59, "com", /* Communications File */
- - 0x5A, "cfg", /* Configuration file */
- - 0x5B, "anm", /* Animation file */
- - 0x5C, "mum", /* Multimedia document */
- - 0x5D, "ent", /* Game/Entertainment document */
- - 0x5E, "dvu", /* Development utility document */
- - 0x6B, "bio", /* PC Transporter BIOS */
- - 0x6D, "tdr", /* PC Transporter driver */
- - 0x6E, "pre", /* PC Transporter pre-boot */
- - 0x6F, "hdv", /* PC Transporter volume */
- - 0xA0, "wp", /* WordPerfect document */
- - 0xAB, "gsb", /* Apple IIGS BASIC program */
- - 0xAC, "tdf", /* Apple IIGS BASIC TDF */
- - 0xAD, "bdf", /* Apple IIGS BASIC data */
- - 0xB0, "src", /* Apple IIGS source code */
- - 0xB1, "obj", /* Apple IIGS object code */
- - 0xB2, "lib", /* Apple IIGS Library file */
- - 0xB3, "s16", /* GS/OS application */
- - 0xB4, "rtl", /* GS/OS Run-Time Library */
- - 0xB5, "exe", /* GS/OS Shell application */
- - 0xB6, "pif", /* Permanent initialization file */
- - 0xB6, "str", /* (alternate for PIF) */
- - 0xB7, "tif", /* Temporary initialization file */
- - 0xB8, "nda", /* New desk accessory */
- - 0xB9, "cda", /* Classic desk accessory */
- - 0xBA, "tol", /* Tool */
- - 0xBB, "dvr", /* Apple IIGS Device Driver File */
- - 0xBC, "ldf", /* Load file (generic) */
- - 0xBD, "fst", /* GS/OS File System Translator */
- - 0xBF, "doc", /* GS/OS document */
- - 0xC0, "pnt", /* Packed Super Hi-Res picture */
- - 0xC1, "pic", /* Super Hi-Res picture */
- - 0xC2, "ani", /* Paintworks animation */
- - 0xC3, "pal", /* Paintworks palette */
- - 0xC5, "oog", /* Object-oriented graphics */
- - 0xC6, "scr", /* Script */
- - 0xC7, "cdv", /* Control Panel document */
- - 0xC8, "fon", /* Font */
- - 0xC9, "fnd", /* Finder data */
- - 0xCA, "icn", /* Icons */
- - 0xD5, "mus", /* Music sequence */
- - 0xD6, "ins", /* Instrument */
- - 0xD7, "mdi", /* MIDI data */
- - 0xD8, "snd", /* Sampled sound */
- - 0xDB, "dbm", /* DB Master document */
- - 0xE0, "lbr", /* Archival library */
- - 0xE2, "atk", /* AppleTalk data */
- - 0xEE, "r16", /* EDASM 816 relocatable file */
- - 0xEF, "pas", /* Pascal area */
- - 0xF0, "cmd", /* BASIC command */
- - 0xF9, "os", /* GS/OS System file */
- - 0xF9, "p16", /* (alternate for GS/OS System file) */
- - 0xFA, "int", /* Integer BASIC program */
- - 0xFB, "ivr", /* Integer BASIC variables */
- - 0xFC, "bas", /* AppleSoft BASIC program */
- - 0xFD, "var", /* AppleSoft BASIC variables */
- - 0xFE, "rel", /* Relocatable code */
- - 0xFF, "sys" /* ProDOS 8 application */
- -};
- -
- -#define FTYPESIZE sizeof(filetypes)/sizeof(struct ftypes)
- + END OF ARCHIVE
-