// a replacement for stobin... // taken from a special version of TEO, the thomson TO8 emulator... #include #include /* * Loader au format S19 de Motorola */ unsigned char fill=0x00; enum {vectrex,to8} bin_mode; static int LoadS19File(char *S19Fname,char *binFname) { unsigned char mem[0x10000]; int low=0xFFFF; int high=0x0000; int i; FILE *f; char c; // clears mem for (i=0;i<0x10000;i++) mem[i]=fill; f=fopen(S19Fname,"r"); if (f==NULL) return -1; while (!feof(f)) { while (!feof(f) && ((c=fgetc(f))!='S')); if (!feof(f)) { int adr; int lg; int i; int val; c=fgetc(f); if (c=='1') { fscanf(f,"%2x%4x",&lg,&adr); for (i=0;ihigh) high=adr+i; if (adr+i>8),f); fputc(((high-low+1)&0xFF),f); // begin address fputc(((low&0xFF00)>>8),f); fputc((low&0xFF),f); // data for (i=low;i<=high;i++) fputc(mem[i],f); fputc(0xFF,f); fputc(0x00,f); fputc(0x00,f); // run address (ie begin address here) fputc(((low&0xFF00)>>8),f); fputc((low&0xFF),f); break; } fclose(f); } int main(int argc, char *argv[]) { char *file_in=NULL; char *file_out=NULL; int start=-1; int end=-1; int exec=-1; int argnum; bin_mode=vectrex; for (argnum=1;argnum