/* int2tap - Convert an Intel segment file to a loadable Spectrum tape file Copyright (C) 2004 Ian Cowburn (ianc@noddybox.demon.co.uk) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------- $Name$ */ static const char id[]="$Id$"; #include #include #include #include #include #include #include "intel.h" #include "tap.h" #include "basic.h" /* ---------------------------------------- GLOBALS */ #undef TRUE #undef FALSE #define TRUE 1 #define FALSE 0 const char *progname; /* ---------------------------------------- PRIVATE UTILS */ static void Usage(void) { fprintf(stderr,"%s: usage %s [ -b ] [ -s ] [ -a address ] " "output-file input-file ... \n",progname,progname); exit(EXIT_FAILURE); } /* ---------------------------------------- MAIN */ int main(int argc, char *argv[]) { unsigned char mem[0x10000]; IntelInfo *info; char *outname; unsigned exec_addr; int bin_only; int split; int addr_defined; int base; int no; int f; int done; /* Set program name */ if ((progname=strrchr(argv[0],'/'))) { progname++; } else { progname=argv[0]; } /* Set defaults and parse args */ addr_defined=FALSE; bin_only=FALSE; split=FALSE; done=FALSE; f=1; while(fargc-2) { Usage(); } addr_defined=TRUE; exec_addr=(unsigned)strtoul(argv[++f],NULL,0); break; default: Usage(); break; } f++; } } if (base>=argc-1) { Usage(); } outname=argv[base++]; no=argc-base; if (!(info=malloc(sizeof *info * no))) { fprintf(stderr,"%s: malloc failed\n",progname); } /* Process Intel files */ for(f=0;fhigh) { high=info[f].high; } } TapBinary(mem,low,high-low+1); } TapClose(); return EXIT_SUCCESS; } /* END OF FILE */