// taken from somewhere #include #include #include unsigned char fill=0x00; static int LoadBinFile(char *fname,char *binFname,int start,int exec) { unsigned char mem[0x10000]; int i; int size; FILE *f; // clears mem for (i=0;i<0x10000;i++) mem[i]=fill; f=fopen(fname,"rb"); size=fread(mem,1,0x10000,f); fprintf(stderr,"Size : 0x%x start:0x%x exec:0x%x\n",size,start,exec); fclose(f); // we now have bin in mem from low to high... that is basiicaly what an stobin is supposed to do... f=fopen(binFname,"wb"); fputc(0x00,f); // size 16bit big endian fputc((((size)&0xFF00)>>8),f); fputc(((size)&0xFF),f); // begin address fputc(((start&0xFF00)>>8),f); fputc((start&0xFF),f); // data for (i=0;i>8),f); fputc((exec&0xFF),f); fclose(f); return 0; } int main(int argc, char *argv[]) { char *file_in=NULL; char *file_out=NULL; int start=-1; int exec=-1; int argnum; for (argnum=1;argnum