/****************************************************************************** * * project name: TI-68k Developer Utilities * file name: ttppggen.c * initial date: 28/09/2000 * authors: thomas.nussbaumer@gmx.net * description: executes all steps to convert a TI binary to a PPG file * (PPG == packed program used in combination with ttstart) * ******************************************************************************/ /* This file is part of TI-68k Developer Utilities. This file is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. As a special exception, UNMODIFIED copies of ttppggen may also be redistributed or sold without source code, for any purpose. (The Lesser General Public License restrictions do apply in other respects; for example, they cover modification of the program.) This exception notice must be removed on modified copies of this file. 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include #include #include #include #include "tt.h" // generic defines #include "ttversion.h" // TI-68k Developer Utilities version info #include "revtools.h" // automatic cvs version extraction #ifdef FILE_REVISION #undef FILE_REVISION #endif #define FILE_REVISION "1.8" #define EMBEDDED_USE #include "ttbin2oth.c" #include "packhead.h" // compressed header definition #include "ttpack.c" #include "ttstrip.c" #undef EMBEDDED_USE //#define NO_KERNEL_PROGS 1 // disables generation of kernel-dependent ppgs //============================================================================= // outputs usage information of this tool //============================================================================= void PrintUsage() { PRINT_ID("TTPPGGen"); #ifdef NO_KERNEL_PROGS fprintf(USAGE_OUT, "Usage: ttppggen [flags] \n\n"\ "-quiet ... don't output standard messages\n"\ "-nowarn ... optional flag to turn off signature missmatch warning\n\n"\ "infile ... a valid 89z or 9xz NOSTUB program\n"\ "varname ... name of output ppg (without extension)\n\n"\ "NOTE: the type of file (89y or 9xy) which will be generated depends\n"\ " on the extension of the given infile\n\n"); #else fprintf(USAGE_OUT, "Usage: ttppggen [flags] \n\n"\ "-quiet ... don't output standard messages\n"\ "-nowarn ... optional flag to turn off signature missmatch warning\n\n"\ "infile ... a valid 89z or 9xz program (NOSTUB or kernel-dependent)\n"\ "varname ... name of output ppg (without extension)\n\n"\ "NOTE: the type of file (89y or 9xy) which will be generated depends\n"\ " on the extension of the given infile\n\n"); #endif } //============================================================================= // outputs a message with a special prefix //============================================================================= void OutMsg(char*s) { fprintf(stdout,"%s\n",s); } //============================================================================= // delete temporary files //============================================================================= void CleanUp() { remove("tmp_ppg.bin"); remove("tmp_ppg.pck"); } //============================================================================= // as usual: the main entry point ... //============================================================================= int main(int argc, char* argv[]) { char* infilename = NULL; char* varname = NULL; //char* description = 0; int ti89_version = 0; int no_warn = 0; int quiet = 0; char buffer[1000]; int n; char* tool_params[6]; FILE* fp; long inputsize; long outputsize; if (argc < 3) { PrintUsage(); return 1; } // parse arguments for (n=1; n