#include <fcntl.h>

/*

When open is used to creat a file under DOS 3.3, param3 is the file's type:

    Param3,hex    File type

    00            Text
    01            Integer basic
    02            Applesoft basic
    04            Binary
    08            Relocatable
    10            S-type file
    20            A-type file
    40            B-type file

*/

extern unsigned HB[];


int bload(name)
char *name;
{
   int fh, c=-1, fl=0, fa=0;

   fh = open(name,O_RDONLY,4);
   if (fh == -1)return -1;
   c = read(fh,&fa,2);
   if (c == 2)c = read(fh,&fl, 2);
   if (c == 2 && (fl == 0x2000 || fl == 8184))c = read(fh,(char *)HB[0],fl);
   close(fh);
   if (c == 0x2000 || c == 8184)c=0;
   else c=-2;
   return c;

}



© Copyright Bill Buckels 2010
All Rights Reserved.